Commit b741b17c by 张卓

分销商货架,首页分销商

parent 548132d0
<script>
import shop from "@/api/shop";
import spokesman from "@/api/spokesman";
import { themeColor, checkShowConditionIds } from "@/utils/mayi";
export default {
......@@ -39,7 +40,11 @@ export default {
logs.unshift(Date.now());
mpvue.setStorageSync("logs", logs);
}
//获取分销信息
// getSpokesmanInfo
spokesman.query_login_spoken().then(res=>{
})
// 初始
this.getShopInfo(extConfig);
......
......@@ -4,5 +4,22 @@ export default {
// 查询是否有分销员资格
getSpokesmanidByShare(){
return requestPOST(`${process.env.OLSHOP_URL}/spokesman/getSpokesmanByShare`)
}
},
//获取分销商主页商品列表POST
getDistributorHomepageGoodsList(data) {
return requestPOST(`${process.env.OLSHOP_URL}/distributorHomepageInfo/getDistributorHomepageGoodsList`, data)
},
// 获取当前登录分销员,查询结果不为空
query_login_spoken(params) {
return requestPOST(`${process.env.OLSHOP_URL}/spokesman/getLoginSpokesman`, params)
},
//POST 一键开店快速复制
oneClickShopQuickCopy(data) {
return requestPOST(`${process.env.OLSHOP_URL}/distributorHomepageInfo/oneClickShopQuickCopy`, data)
},
//POST 获取登录分销商主页信息
getDistributorHomepage(data) {
return requestPOST(`${process.env.OLSHOP_URL}/distributorHomepageInfo/getDistributorHomepage/${data}`, {})
},
}
......@@ -7,6 +7,7 @@ import orderApi from "./api/order"
import promoteApi from "./api/promote";
import indexApi from './api/index'
import cartApi from './api/cart'
import spokesmanApi from './api/spokesman'
import { DFSImg } from "@/utils/index";
import { $themeToLink, $themeAddToCard } from "@/utils/mayi";
import shop from "./api/shop";
......@@ -61,6 +62,7 @@ mpApp.promoteApi = promoteApi;
mpApp.indexApi = indexApi;
mpApp.cartApi = cartApi;
mpApp.DFSImg = DFSImg;
mpApp.spokesmanApi = spokesmanApi
mpApp.getThemePage = getThemePage
......
......@@ -4,6 +4,7 @@
<!-- <goods-list id="goodsList"></goods-list> -->
<!-- <scroll-view @scroll="scrolls" @scrolltolower="scrolltolower" style="height:100vh;overflow-y:auto;" scroll-y="true"> -->
<div style="position:relative;">
<get-index-homepage class="getIndexHomePage"></get-index-homepage>
<ThemeDataPlant></ThemeDataPlant>
<div v-for="(item,index) in pageData" :key="index">
<div v-if="item.componentCode=='banner' && item.componentInfo.visible == 1">
......@@ -90,6 +91,8 @@
<van-button type="primary">按钮</van-button> -->
</div>
<share-popup></share-popup>
<my-card></my-card>
<set-my-homepage></set-my-homepage>
</div>
</template>
......@@ -251,6 +254,9 @@ export default {
},
scrolls(el){
this.setFooterShow(el);
if(this.$mp.page && this.$mp.page.selectComponent(".getIndexHomePage")){
this.$mp.page.selectComponent(".getIndexHomePage").getScroll(el);
}
if(this.$mp.page && this.$mp.page.selectComponent(".goodsListItem")){
this.$mp.page.selectComponent(".goodsListItem").getScroll(el);
}
......
......@@ -15,7 +15,10 @@
"speedy-nav":"/static/nativeComponents/SpeedyNav/index",
"video-player":"/static/nativeComponents/VideoPlayer/index",
"photo-gallery":"/static/nativeComponents/PhotoGallery/index",
"live-broadcast":"/static/nativeComponents/LiveBroadcast/index"
"live-broadcast":"/static/nativeComponents/LiveBroadcast/index",
"my-card":"/static/nativeComponents/MyCard/index",
"get-index-homepage":"/static/nativeComponents/GetIndexHomePage/index",
"set-my-homepage":"/static/nativeComponents/SetMyHomePage/index"
},
"enablePullDownRefresh":true,
"backgroundColor":"#f5f5f5"
......
<!--static/nativeComponents/AreaNavigation/index.wxml-->
<van-sticky wx:if="{{datas.componentData.scrollPosition}}">
<van-sticky offset-top="44px" wx:if="{{datas.componentData.scrollPosition}}">
<view class="area-navigation clearfix" style="background-color:{{datas.componentData.backgroundColor}}">
<view style="width:100%;display:flex;">
<view class="area-l" style="font-size:{{datas.componentData.fontSize / 16 + 'em'}};color:{{datas.componentData.fontColor}};font-weight:{{datas.componentData.fontWeight}}" bindtap="changeOtherCity">
......
let app = getApp()
const { spokesmanApi, DFSImg, $themeToLink } = app;
const componentOptions = {
// 组件选项
options: {
multipleSlots: true
},
behaviors: [],
properties: {
datas: {
type: Object
},
scrollContent:{
type:String,
default:''
},
},
// 组件数据
data: {
isPageHidden: false, // 页面是否处于隐藏状态
query: {
pageSize: 9999,
pageNum: 1,
productCategoryId: '',
distributorHomepageId: '1',//分销商主页ID ,
goodsNameOrCode: '',//商品名或编码 ,
hotRecommendFlag: 1,//是否热门推荐(0:否,1:是) ,
},
lists: [],
isShow: ''
},
// 数据监听器
observers: {
scrollContent(scrollContent) {
console.log(scrollContent,555555555)
}
},
// 组件生命周期
lifetimes: {
created() {},
ready() {
// let $scrollContent = document.querySelector(this.scrollContent);
// $scrollContent.on('scroll', e => {
// if($scrollContent.scrollTop() > 24) {
// this.setData({ isShow: "is_show" });
// }else {
// this.setData({ isShow: "" });
// }
// });
// console.log(this.data.scrollContent,555555555)
this.init()
},
moved() {},
detached() {}
},
attached() {
},
definitionFilter() {},
onPageScroll() {
// console.log(e,444444444444);
},
// 页面生命周期
pageLifetimes: {
// 页面被展示
show() {
const { isPageHidden } = this.data;
// show事件发生前,页面不是处于隐藏状态时
if (!isPageHidden) {
return;
}
// 重新执行定时器等操作
},
// 页面被隐藏
hide() {
this.setData({
isPageHidden: true
});
// 清除定时器等操作
},
// 页面尺寸变化时
resize() {}
},
// 组件方法
methods: {
init() {
spokesmanApi.getDistributorHomepageGoodsList(this.data.query).then(res=>{
if(res.data.code == '200'&&res.data.data) {
let lists = [];
let num = Math.ceil(res.data.data.length/3);
for(let i = 0; i < num; i++) {
lists.push(new Array());
}
res.data.data.forEach((ele,index)=>{
ele.terminalProductGoods.imgUrl = DFSImg(ele.terminalProductGoods.imgUrl)
ele.terminalProductGoods.discountPrice = (ele.terminalProductGoods.discountPrice-0).toFixed(2)
ele.terminalProductGoods.salePrice = (ele.terminalProductGoods.salePrice-0).toFixed(2)
let flag = Math.ceil((index+1)/3)
lists[flag-1].push(ele)
})
// this.data.lists = lists;
this.setData({ lists: lists });
}
})
},
toSpokesmanHomePage() {
let linkVal = '/personalCenter/spokesmanCenter/mine/spokesmanHomePage?from=_goodsInfo'
$themeToLink({
type: 1,
link:linkVal,
});
},
getScroll(el) {
// console.log(el.scrollTop,555555555,this.data.isShow)
if(el.scrollTop > 24) {
if(this.data.isShow == 'is_show') {
return
}
this.setData({ isShow: "is_show" });
}else {
if(this.data.isShow) {
this.setData({ isShow: "" });
}
}
},
toGoodsInfo(event) {
const item = event.currentTarget.dataset.item;
let linkVal = `/goods/${item.terminalProductGoods.productId}`
$themeToLink({
type: 1,
link:linkVal,
});
}
}
};
Component(componentOptions);
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--static/nativeComponents/Notice/index.wxml-->
<view class="container">
<view class="section {{lists.length?'heightAuto':''}}">
<view class="go_my_spokesman_home go_my_spokesman_home_top {{isShow}}">
<view class="img">
<image mode="aspectFit" src="http://mayi-newshop.oss-cn-shanghai.aliyuncs.com/public/png/f254fe62-6dda-46f6-a2f4-a7b2aa0474df.png" />
</view>
<view class="title">
来自"你爹i的
<text></text>
"给您的推荐
</view>
<text class="go_btn" bindtap="toSpokesmanHomePage">查看更多</text>
</view>
<swiper indicator-dots="false" autoplay="true" interval="4000" duration="1000" style="height: 376rpx;" wx:if="{{lists.length}}">
<swiper-item wx:for="{{lists}}" class="shop_lists" wx:for-item="ele">
<view
class="list_item"
wx:for="{{ele}}"
wx:key="index"
bindtap="toGoodsInfo"
data-item="{{item}}"
>
<view class="item_img">
<image mode="aspectFit" style="height: 100%;" src="{{item.terminalProductGoods.imgUrl}}" alt="" />
</view>
<view class="shop_name">
{{item.terminalProductGoods.productName}}
</view>
<view class="sale_price">
销售价:<text style="text-decoration:line-through; ">¥{{item.terminalProductGoods.salePrice}}</text>
</view>
<view class="discount_price">折后价:¥{{item.terminalProductGoods.discountPrice}}</view>
<view class="show_price">
<view class="title">最高可省</view>
<view class="price"> {{(item.terminalProductGoods.salePrice-item.terminalProductGoods.discountPrice)}}元</view>
</view>
</view>
</swiper-item>
</swiper>
</view>
</view>
/* static/nativeComponents/Notice/index.wxss */
.container {
width: 100%;
padding: 48rpx 24rpx 0;
}
.section {
width: 702rpx;
height: auto;
background-image: url('https://mayi-newshop.oss-cn-shanghai.aliyuncs.com/product/SNzssemrfc.png');
background-repeat: no-repeat;
background-size: 100% 100%;
position: relative;
padding-top: 88rpx;
box-sizing: border-box;
}
.heightAuto {
height: 536rpx;
}
.go_my_spokesman_home,.go_my_spokesman_home_top {
box-sizing: border-box;
width: 100%;
height: 88rpx;
display: flex;
align-items: center;
padding: 0 20rpx;
position: absolute;
top: 0;
color: #fff;
font-size: 26rpx;
}
.go_my_spokesman_home_top .title text,.go_my_spokesman_home title text {
max-width: 300rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.go_my_spokesman_home_top .img,.go_my_spokesman_home .img {
width: 48rpx;
height: 48rpx;
display: flex;
justify-content: center;
align-items: center;
border-radius: 100%;
overflow: hidden;
margin-right: 10rpx;
}
.go_my_spokesman_home_top .go_btn,.go_my_spokesman_home .go_btn {
position: absolute;
right: 48rpx;
font-size: 24rpx;
}
.notice{
font-size: 32rpx;
position: relative;
overflow: hidden;
height: 80rpx;
width: calc(100vw - 40rpx);
margin-left: 20rpx;
}
.marquee {
position: absolute;
height: 80rpx;
line-height: 80rpx;
/* width: 100%; */
margin: 0 auto;
white-space: nowrap;
box-sizing: border-box;
}
.shop_lists {
width: 702rpx;
height: 448rpx;
padding: 8rpx 12rpx 8rpx 0;
display: flex;
font-size: 24rpx;
box-sizing: border-box;
// justify-content: space-between;
}
.shop_lists .list_item {
width: 220rpx;
height: 376rpx;
background-color: #fff;
border-radius: 4rpx;
overflow: hidden;
margin-left: 12rpx;
}
.shop_lists .list_item .shop_name {
margin-top: 10rpx;
margin-left: 14rpx;
color: #333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.shop_lists .list_item .sale_price {
margin-top: 10rpx;
margin-left: 14rpx;
color: #999;
transform: scale(.88) translateX(-14rpx) translateY(-8rpx);
white-space: nowrap;
}
.shop_lists .list_item .discount_price {
margin-top: 4rpx;
margin-left: 14rpx;
color: #FF4848;
transform: scale(.88) translateX(-14rpx) translateY(-14rpx);
white-space: nowrap;
}
.shop_lists .list_item .show_price {
display: flex;
color: #FACF58;
transform: scale(.75) translateX(-18rpx) translateY(-18rpx);
border-radius: 4rpx;
// overflow: hidden;
}
.shop_lists .list_item .show_price div {
padding: 4rpx 8rpx;
}
.shop_lists .list_item .show_price .title {
background-image: linear-gradient(to right, #61626B , #323339);
}
.shop_lists .list_item .show_price .price {
color: #333;
background-color: #FFD460;
border-radius: 0 4rpx 4rpx 0;
padding: 0 8rpx;
}
.shop_lists .list_item .item_img {
width: 220rpx;
height: 100px;
display: flex;
justify-content: center;
align-items: center;
}
.shop_lists .list_item .item_img img {
width: 100%;
height: 100%;
object-fit: contain;
}
.shop_lists .list_item>div {
// width: 100%;
// overflow: hidden;
// text-overflow: ellipsis;
white-space: nowrap;
}
.is_show,.is_show1 {
display: flex;
position: fixed;
background-color: #fff;
color: #fff;
width: 100%;
left: 0;
top: 0px;
z-index: 9999;
background-image: url('https://mayi-newshop.oss-cn-shanghai.aliyuncs.com/product/SNzssemrfc.png');
background-size: 100% 100%;
}
\ No newline at end of file
let app = getApp()
const { spokesmanApi, DFSImg, $themeToLink } = app;
const componentOptions = {
// 组件选项
options: {
multipleSlots: true
},
behaviors: [],
properties: {},
// 组件数据
data: {
isPageHidden: false,
},
// 数据监听器
observers: {},
// 组件生命周期
lifetimes: {
created() {},
ready() {
},
moved() {},
detached() {}
},
attached() {
},
definitionFilter() {},
onPageScroll() {
// console.log(e,444444444444);
},
// 页面生命周期
pageLifetimes: {
// 页面被展示
show() {
},
// 页面被隐藏
hide() {
},
// 页面尺寸变化时
resize() {}
},
// 组件方法
methods: {
toMyBusinessCard() {
let linkVal = '/personalCenter/spokesmanCenter/mine/myBusinessCard'
$themeToLink({
type: 1,
link:linkVal,
});
},
}
};
Component(componentOptions);
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="section">
<view class="setMyHomePage" bindtap="toMyBusinessCard">
<view class="icon_box">
<image mode="aspectFit" style="height: 100%;" src="https://mayi-newshop.oss-cn-shanghai.aliyuncs.com/product/c6anak6wtf.png" alt=""></image>
</view>
<text>名片</text>
</view>
</view>
.setMyHomePage {
position: fixed;
right: 16rpx;
top: 498rpx;
z-index: 99;
max-width: 100rpx;
display: flex;
flex-wrap: wrap;
justify-content: center;
text-shadow: 0px 0px 6rpx #000;
color: #fff;
font-size: 24rpx;
}
.setMyHomePage .icon_box {
width: 72rpx;
height: 72rpx;
display: flex;
justify-content: center;
align-items: center;
background-color: #fff;
border-radius: 100%;
box-shadow: rgba(0, 0, 0, 0.5) 0px 0px 10rpx;
}
.setMyHomePage .icon_box image {
width: 48rpx;
}
\ No newline at end of file
let app = getApp()
const { spokesmanApi, DFSImg, $themeToLink } = app;
const componentOptions = {
// 组件选项
options: {
multipleSlots: true
},
behaviors: [],
properties: {},
// 组件数据
data: {
isPageHidden: false,
showPop: false,
showSetMoreDiscountPrice: false,
distributionPrice1: 0,
showBaiFen: false,
},
// 数据监听器
observers: {},
// 组件生命周期
lifetimes: {
created() {},
ready() {
},
moved() {},
detached() {}
},
attached() {
},
definitionFilter() {},
onPageScroll() {
// console.log(e,444444444444);
},
// 页面生命周期
pageLifetimes: {
// 页面被展示
show() {
},
// 页面被隐藏
hide() {
},
// 页面尺寸变化时
resize() {}
},
// 组件方法
methods: {
toMyBusinessCard() {
// this.setData(showPop)
this.setData({ showPop: true });
},
setNewShop() {
// window.sessionStorage.setItem(getTokenTwo()+'currentState',0)
spokesmanApi.getDistributorHomepage('1').then(res=>{
// if(!this.$store.state.spokesmanModule.getLoginSpokesmanInfo.parentId) {
this.initShopDetail()
return
// }
if(res.code=='200'&&!(res.data&&res.data.id)) {
this.showSetMyShop = true;
}else if(res.code=='200'&&res.data&&res.data.id){
this.initShopDetail()
}
})
},
copyShop() {
console.log(this.data.distributionPrice1,888888888)
spokesmanApi.oneClickShopQuickCopy({grossProfitMargin: parseFloat(this.data.distributionPrice1)}).then(res=>{
if(res.data == 'true') {
this.initShopDetail()
}
})
},
closePopuop1() {
this.setData({ showPop: false });
},
closePopuop2() {
this.setData({ showSetMoreDiscountPrice: false });
},
initShopDetail() {
let linkVal = '/personalCenter/spokesmanCenter/mine/spokesmanHomePage?fromSpokesmanCenter=1'
$themeToLink({
type: 1,
link:linkVal,
});
},
checkedBtn() {
this.setData({ showPop: false });
this.setData({ showSetMoreDiscountPrice: true });
},
focus(){
// this.setData({ distributionPrice1: parseFloat(this.data.distributionPrice1) });
},
blur() {
// if(!(this.data.distributionPrice1-0)){
// this.setData({ distributionPrice1: 0 });
// }else {
// this.setData({ distributionPrice1: distributionPrice1 });
// }
},
setProfit(val) {
if(val.detail!==0&&!(val.detail.toString())) {
return
}
console.log(val.detail,val)
if(val.detail-0<0 || !(val.detail-0)) {
this.setData({ distributionPrice1: 0 });
return
}
if((val.detail-0).toString().indexOf('.')!=-1&&(val.detail-0).toString().substring((val.detail-0).toString().indexOf('.')+1).length>2) {
this.setData({ distributionPrice1: (val.detail-0).toFixed(2)-0 });
return
}
this.setData({ distributionPrice1: val.detail-0 });
},
}
};
Component(componentOptions);
{
"component": true,
"usingComponents": {
"van-popup":"/static/vant/popup/index",
"van-field": "/static/vant/field/index"
}
}
\ No newline at end of file
<view class="section">
<view class="setMyHomePage" bindtap="toMyBusinessCard">
<view class="icon_box">
<image mode="aspectFit" style="height: 100%;" src="https://mayi-newshop.oss-cn-shanghai.aliyuncs.com/product/aB2X4tPAZi.png" alt=""></image>
</view>
<text>我的小店</text>
</view>
</view>
<van-popup
show="{{ showPop }}"
bind:close="closePopuop1"
class="set_my_shop"
>
<view class="title van-hairline--bottom">
一键开店
<image mode="aspectFit" src="https://mayi-newshop.oss-cn-shanghai.aliyuncs.com/product/DHEyaHZ2tB.png" bindtap="closePopuop1" alt=""></image>
</view>
<view class="imgs">
<view class="img" bindtap="initShopDetail">
<image mode="aspectFit" src="https://mayi-newshop.oss-cn-shanghai.aliyuncs.com/product/G2hBD24ZjT.png" alt=""></image>
<text>自定义</text>
</view>
<view class="img" bindtap="checkedBtn">
<image mode="aspectFit" src="https://mayi-newshop.oss-cn-shanghai.aliyuncs.com/product/i6XJtbftZR.png" alt=""></image>
<text>快速复制</text>
</view>
</view>
</van-popup>
<van-popup show="{{showSetMoreDiscountPrice}}" class="set_more_price" bind:close="closePopuop2">
<view class="title van-hairline--bottom">
批量调价
<image bindtap="closePopuop2" src="https://mayi-newshop.oss-cn-shanghai.aliyuncs.com/product/DHEyaHZ2tB.png" alt=""></image>
</view>
<view class="ul">
<text>按毛利率输入(%)</text>
<view>
<van-field
value="{{distributionPrice1}}"
class="input"
ref="getFocus"
input-align="center"
type="digit"
inputmode='decimal'
bind:focus='focus'
bind:blur="blur"
bindinput="setProfit"
/>
</view>
<view style="color: #999;">当源头商家调整价格时,分销价也会同步调整,保证您的收益。</view>
</view>
<view class="submit" bindtap="copyShop">确认信息</view>
</van-popup>
.setMyHomePage {
position: fixed;
right: 16rpx;
top: 616rpx;
z-index: 99;
max-width: 100rpx;
display: flex;
flex-wrap: wrap;
justify-content: center;
text-shadow: 0px 0px 6rpx #000;
color: #fff;
font-size: 24rpx;
}
.setMyHomePage .icon_box {
width: 72rpx;
height: 72rpx;
display: flex;
justify-content: center;
align-items: center;
background-color: #fff;
border-radius: 100%;
box-shadow: rgba(0, 0, 0, 0.5) 0px 0px 10rpx;
}
.setMyHomePage .icon_box image {
width: 48rpx;
}
.set_my_shop {
width: 640rpx;
padding-bottom: 50rpx;
border-radius: 8rpx;
color: #000000;
font-size: 36rpx;
}
.set_my_shop .title {
width: 640rpx;
height: 94rpx;
display: flex;
justify-content: center;
align-items: center;
position: relative;
box-sizing: border-box;
}
.set_my_shop .title image {
width: 40rpx;
height: 40rpx;
right: 20rpx;
position: absolute;
right: 20rpx;
}
.set_my_shop .imgs {
width: 640rpx;
padding: 68rpx 40rpx;
display: flex;
align-items: center;
justify-content: space-around;
text-align: center;
font-size: 28rpx;
box-sizing: border-box;
}
.set_my_shop .imgs image {
width: 168rpx;
height: 168rpx;
margin-bottom: 20rpx;
}
.set_my_shop .set_bottom {
width: 426rpx;
height: 72rpx;
margin-left: 106rpx;
background-color: var(--main-color);
color: #fff;
font-size: 32rpx;
display: flex;
align-items: center;
justify-content: center;
}
.set_more_price {
width: 640rpx;
padding-bottom: 64rpx;
border-radius: 8rpx;
color: #000000;
font-size: 36rpx;
}
.ul {
width: 640rpx;
box-sizing: border-box;
padding: 40rpx 22rpx 0;
font-size: 26rpx;
}
.ul .li{
margin-top: 20rpx;
position: relative;
}
.ul .li .baiFen {
position: absolute;
top: 10rpx;
right: 40rpx;
color: #333;
}
.ul .li .setPrice {
position: absolute;
top: 10rpx;
right: 90rpx;
width: 36rpx;
height: 36rpx;
}
.ul .add_my_shop {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 90rpx 0 32rpx;
margin-top: 64rpx;
}
.ul .add_my_shop>div {
display: flex;
align-items: center;
}
.ul .rules_title {
margin-top: 10rpx;
color: #999999;
}
.ul .set_price_checked {
display: flex;
justify-content: space-between;
}
.set_more_price .submit{
width: 344rpx;
height:72rpx;
margin-left: 138rpx;
margin-top: 78rpx;
text-align: center;
line-height: 72rpx;
background-color: var(--main-color);
font-size: 32rpx;
color:rgba(255,252,252,1);
border-radius: 80rpx;
margin-bottom: 40rpx;
}
.set_more_price .input {
width: 456rpx;
height: 60rpx;
font-size: 30rpx;
background-color: #f3f3f3;
padding: 0;
margin-left: 58rpx;
border-radius: 40rpx;
text-align: center;
line-height: 60rpx;
}
.set_more_price .title {
width: 600rpx;
width: 100%;
height: 94rpx;
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
.set_more_price .title image {
width: 40rpx;
height: 40rpx;
right: 20rpx;
position: absolute;
right: 20rpx;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment