Commit 00cf326a by 张卓

分销商首页流程

parent 1bcb7e93
...@@ -3,6 +3,7 @@ import shop from "@/api/shop"; ...@@ -3,6 +3,7 @@ import shop from "@/api/shop";
import spokesman from "@/api/spokesman"; import spokesman from "@/api/spokesman";
import { themeColor, checkShowConditionIds } from "@/utils/mayi"; import { themeColor, checkShowConditionIds } from "@/utils/mayi";
export default { export default {
created() { created() {
// NODE_ENV // NODE_ENV
...@@ -41,11 +42,6 @@ export default { ...@@ -41,11 +42,6 @@ export default {
logs.unshift(Date.now()); logs.unshift(Date.now());
mpvue.setStorageSync("logs", logs); mpvue.setStorageSync("logs", logs);
} }
//获取分销信息
// getSpokesmanInfo
spokesman.query_login_spoken().then(res=>{
})
// 初始 // 初始
this.getShopInfo(extConfig); this.getShopInfo(extConfig);
......
...@@ -23,7 +23,23 @@ export default { ...@@ -23,7 +23,23 @@ export default {
}, },
// 客户点击按钮后关闭提醒 // 客户点击按钮后关闭提醒
apply_for_withdraw(data) { apply_for_withdraw(data) {
return requestPOST(`${process.env.OLSHOP_URL}/spokesman/noReminderRequired`, { data }) return requestPOST(`${process.env.OLSHOP_URL}/spokesman/noReminderRequired`, data )
},
//成为下级客户
becomepokesmanCustomer(params) {
return requestPOST(`${process.env.OLSHOP_URL}/spokesman/becomepokesmanCustomer/`+params+``, {})
},
//绑定上级关系
saveCustomerInviterInviteeRel(params) {
return requestPOST(`${process.env.OLSHOP_URL}/user/saveCustomerInviterInviteeRel/`+params+``, {})
},
//获取个人名片主页快捷访问开关
getHomePageQuickAccess() {
return requestPOST(`${process.env.OLSHOP_URL}/personalBusinessCardInfo/getHomePageQuickAccess`, {})
},
// 获取是否打开弹窗,是否展示入口
query_isEntry(data) {
return requestPOST(`${process.env.OLSHOP_URL}/spokesman/getSpokesmanRemindAndDisplayEntryByLogin`, { data })
}, },
} }
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
<!-- <goods-list id="goodsList"></goods-list> --> <!-- <goods-list id="goodsList"></goods-list> -->
<!-- <scroll-view @scroll="scrolls" @scrolltolower="scrolltolower" style="height:100vh;overflow-y:auto;" scroll-y="true"> --> <!-- <scroll-view @scroll="scrolls" @scrolltolower="scrolltolower" style="height:100vh;overflow-y:auto;" scroll-y="true"> -->
<div style="position:relative;"> <div style="position:relative;">
<div v-if="showSpokesManHome">
<get-index-homepage class="getIndexHomePage"></get-index-homepage> <get-index-homepage class="getIndexHomePage"></get-index-homepage>
</div>
<ThemeDataPlant></ThemeDataPlant> <ThemeDataPlant></ThemeDataPlant>
<div v-for="(item,index) in pageData" :key="index"> <div v-for="(item,index) in pageData" :key="index">
<div v-if="item.componentCode=='banner' && item.componentInfo.visible == 1"> <div v-if="item.componentCode=='banner' && item.componentInfo.visible == 1">
...@@ -93,10 +95,16 @@ ...@@ -93,10 +95,16 @@
<bottomCont></bottomCont> <bottomCont></bottomCont>
</div> </div>
<share-popup></share-popup> <share-popup></share-popup>
<div v-if="showMyCard">
<my-card></my-card> <my-card></my-card>
<set-my-homepage></set-my-homepage> </div>
<div v-if="showHomepage">
<set-my-homepage :getDistributorHomepageName="getDistributorHomepageName"></set-my-homepage>
</div>
<div v-if="applySucessEntry">
<apply-sucess-entry></apply-sucess-entry> <apply-sucess-entry></apply-sucess-entry>
</div> </div>
</div>
</template> </template>
<script> <script>
...@@ -115,6 +123,7 @@ import coupon from '@/components/activity/coupon' ...@@ -115,6 +123,7 @@ import coupon from '@/components/activity/coupon'
import integralTurntable from '@/components/activity/integralTurntable' import integralTurntable from '@/components/activity/integralTurntable'
import spellGroup from '@/components/activity/spellGroup' import spellGroup from '@/components/activity/spellGroup'
import { setTabBarActive, checkTabbarPage,themeColor } from "../../utils/mayi.js"; import { setTabBarActive, checkTabbarPage,themeColor } from "../../utils/mayi.js";
import { getMiniProgram, becomeRelation, getHomePageQuickAccess, query_isEntry, getDistributorHomepage } from "@/utils/mayi_fenxiao";
import { throttle } from "../../utils/index.js" import { throttle } from "../../utils/index.js"
const app = getApp(); const app = getApp();
...@@ -129,6 +138,11 @@ export default { ...@@ -129,6 +138,11 @@ export default {
}, },
changeLocation : '', changeLocation : '',
beforeScrollTop:0, beforeScrollTop:0,
showSpokesManHome: false,//分销商货架是否展示
showMyCard: false,
showHomepage: false,//分销商首页入口
applySucessEntry: false,//成为分销弹框
getDistributorHomepageName: '',//小店入口名称
}; };
}, },
components:{ components:{
...@@ -212,6 +226,29 @@ export default { ...@@ -212,6 +226,29 @@ export default {
app.getThemePage(this.$store.state.extConfig); app.getThemePage(this.$store.state.extConfig);
} }
let that = this; let that = this;
//获取个人名片入口
getHomePageQuickAccess().then(res=>{
that.showMyCard = res;
})
query_isEntry().then((data)=>{
//分销弹框信息
app.globalData.applySucessEntry = data;
console.log(app.globalData.applySucessEntry,1111112222222222,data)
if (
data.applyRemind == "true" &&
data.displayEntry == "true"
) {
that.applySucessEntry = true
}else if (
data.applyRemindByDistributor == "true" &&
data.displayEntryByDistributor == "true"
) {
that.applySucessEntry = true
}
// that.applySucessEntry = res;
})
//获取分销信息
this.getSpokesmanInit(options)
// 来源 // 来源
if (options.from == "logout") { if (options.from == "logout") {
//来自用户登出 //来自用户登出
...@@ -246,6 +283,11 @@ export default { ...@@ -246,6 +283,11 @@ export default {
}, },
onShow() { onShow() {
// let linkVal = '/personalCenter/spokesmanCenter/mine/spokesmanHomePage?from=_goodsInfo'
// app.$themeToLink({
// type: 1,
// link:linkVal,
// });
this.getCartNum(); this.getCartNum();
setTabBarActive.bind(this)(checkTabbarPage('/')); setTabBarActive.bind(this)(checkTabbarPage('/'));
this.$mp.page.onPageScroll= (el)=>{ this.$mp.page.onPageScroll= (el)=>{
...@@ -263,11 +305,42 @@ export default { ...@@ -263,11 +305,42 @@ export default {
console.log("36", this.pageData); console.log("36", this.pageData);
console.log(app.globalData.shopInfo,'app') console.log(app.globalData.shopInfo,'app')
wx.setNavigationBarTitle({title : app.globalData.shopInfo.shopName}) wx.setNavigationBarTitle({title : app.globalData.shopInfo.shopName})
wx.stopPullDownRefresh() wx.stopPullDownRefresh()
}, },
async getSpokesmanInit(extConfig) {
//绑定上下级关系
await becomeRelation(extConfig)
//获取分销基本信息
this.getSpokesmanInfo(extConfig)
},
getSpokesmanInfo(extConfig) {
getMiniProgram().then(res=>{
app.globalData.spokesmanInfo = res;
getDistributorHomepage(app.globalData.spokesmanInfo).then(ele=>{
if(ele.id) {
this.getDistributorHomepageName = '我的小店';
}else {
this.getDistributorHomepageName = '一键开店';
}
});
if(
app.globalData.spokesmanInfo&&
app.globalData.spokesmanInfo.parentSpokesmanDistributionModel == '1'&&
app.globalData.spokesmanInfo.distributorHomepage.id) {
this.showSpokesManHome = true;
}else {
this.showSpokesManHome = false;
}
if(app.globalData.spokesmanInfo&&app.globalData.spokesmanInfo.distributionModel == '1') {
this.showHomepage = true;
}else{
this.showHomepage = false;
}
})
},
scrolls(el){ scrolls(el){
// this.setFooterShow(el); // this.setFooterShow(el);
if (this.pageData) { if (this.pageData) {
......
import spokesman from "@/api/spokesman";
//查询分销信息
export function getMiniProgram(query) {
return new Promise(function (resolve, reject) {
spokesman.query_login_spoken().then(res=>{
if(res.data.code == '200') {
resolve(res.data.data);
}else {
reject(res.data.data)
}
});
});
}
//绑定商上下级关系
export function becomeRelation(extConfig) {
spokesman.becomepokesmanCustomer(79988).then(res=>{
})
if(extConfig&&extConfig.spokesmanRelId) {
spokesman.becomepokesmanCustomer(extConfig.spokesmanRelId).then(res=>{
})
}else if(extConfig&&extConfig.userId) {
spokesman.saveCustomerInviterInviteeRel(extConfig.userId).then(res=>{
})
}
}
//查询个人名片入口
export function getHomePageQuickAccess() {
return new Promise(function (resolve, reject) {
spokesman.getHomePageQuickAccess().then(res=>{
if(res.data.code == '200' && res.data.data == 'true') {
resolve(true)
}else {
resolve(false)
}
})
})
}
//查询成为分销弹框
export function query_isEntry() {
return new Promise(function (resolve, reject) {
spokesman.query_isEntry().then(res=>{
if (
res.data.code == "200" &&
res.data.data &&
res.data.data != "null" &&
res.data.data != "false"
) {
resolve(res.data.data)
}
})
})
}
//查询是否有自己的小店
export function getDistributorHomepage(spokesmanInfo) {
return new Promise(function (resolve, reject) {
spokesman.getDistributorHomepage(spokesmanInfo.id).then(res=>{
if (
res.data.code == "200" &&
res.data.data &&
res.data.data != "null" &&
res.data.data != "false"
) {
resolve(res.data.data)
}
})
})
}
\ No newline at end of file
...@@ -11,6 +11,7 @@ const componentOptions = { ...@@ -11,6 +11,7 @@ const componentOptions = {
data: { data: {
isPageHidden: false, isPageHidden: false,
showPop: true, showPop: true,
nickname: '',
}, },
// 数据监听器 // 数据监听器
observers: {}, observers: {},
...@@ -18,7 +19,8 @@ const componentOptions = { ...@@ -18,7 +19,8 @@ const componentOptions = {
lifetimes: { lifetimes: {
created() {}, created() {},
ready() { ready() {
this.setData({ nickname: app.globalData.applySucessEntry.nicknameByDistributor || app.globalData.applySucessEntry.nickname });
console.log(app.globalData.applySucessEntry,222221111111)
}, },
moved() {}, moved() {},
detached() {} detached() {}
...@@ -55,6 +57,7 @@ const componentOptions = { ...@@ -55,6 +57,7 @@ const componentOptions = {
}, },
toSpokesmanCenter() { toSpokesmanCenter() {
let linkVal = '/personalCenter/spokesmanCenter' let linkVal = '/personalCenter/spokesmanCenter'
this.setData({ showPop: false });
spokesmanApi.apply_for_withdraw({type:'applyRemindFlag'}).then(res => { spokesmanApi.apply_for_withdraw({type:'applyRemindFlag'}).then(res => {
if (res.code == "200") { if (res.code == "200") {
console.log(res,9999) console.log(res,9999)
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<view class="ApplySucessEntry"> <view class="ApplySucessEntry">
<view class="ent-top"> <view class="ent-top">
<text>恭喜您</text> <text>恭喜您</text>
<text>已成为分销商</text> <text>已成为{{nickname}}</text>
</view> </view>
<text class="toApply">现在邀请好友购买,即可赚取奖励金</text> <text class="toApply">现在邀请好友购买,即可赚取奖励金</text>
<view style="width:100%;display:flex;justify-content: center;" bindtap="toSpokesmanCenter"> <view style="width:100%;display:flex;justify-content: center;" bindtap="toSpokesmanCenter">
......
...@@ -22,10 +22,12 @@ const componentOptions = { ...@@ -22,10 +22,12 @@ const componentOptions = {
pageSize: 9999, pageSize: 9999,
pageNum: 1, pageNum: 1,
productCategoryId: '', productCategoryId: '',
distributorHomepageId: '1',//分销商主页ID , // distributorHomepageId: '1',//分销商主页ID ,
goodsNameOrCode: '',//商品名或编码 , goodsNameOrCode: '',//商品名或编码 ,
hotRecommendFlag: 1,//是否热门推荐(0:否,1:是) , hotRecommendFlag: 1,//是否热门推荐(0:否,1:是) ,
}, },
spokesmanInfo: {},
parentSpokesmanHandImage: '11111111',
lists: [], lists: [],
isShow: '' isShow: ''
}, },
...@@ -87,7 +89,15 @@ const componentOptions = { ...@@ -87,7 +89,15 @@ const componentOptions = {
// 组件方法 // 组件方法
methods: { methods: {
init() { init() {
spokesmanApi.getDistributorHomepageGoodsList(this.data.query).then(res=>{ this.setData({ spokesmanInfo: app.globalData.spokesmanInfo });
this.spokesmanInfo = app.globalData.spokesmanInfo;
let parentSpokesmanHandImage = DFSImg(app.globalData.spokesmanInfo.parentSpokesmanHandImage);
this.setData({parentSpokesmanHandImage: parentSpokesmanHandImage});
let query = {
...this.data.query,
distributorHomepageId: this.spokesmanInfo.distributorHomepage.id,
}
spokesmanApi.getDistributorHomepageGoodsList(query).then(res=>{
if(res.data.code == '200'&&res.data.data) { if(res.data.code == '200'&&res.data.data) {
let lists = []; let lists = [];
let num = Math.ceil(res.data.data.length/3); let num = Math.ceil(res.data.data.length/3);
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
<view class="section {{lists.length?'heightAuto':''}}"> <view class="section {{lists.length?'heightAuto':''}}">
<view class="go_my_spokesman_home go_my_spokesman_home_top {{isShow}}"> <view class="go_my_spokesman_home go_my_spokesman_home_top {{isShow}}">
<view class="img"> <view class="img">
<image mode="aspectFit" src="http://mayi-newshop.oss-cn-shanghai.aliyuncs.com/public/png/f254fe62-6dda-46f6-a2f4-a7b2aa0474df.png" /> <image mode="aspectFit" src="{{parentSpokesmanHandImage}}" />
</view> </view>
<view class="title"> <view class="title">
来自"你爹i的 来自"{{spokesmanInfo.parentSpokesmanNickname}}
<text></text> <text></text>
"给您的推荐 "给您的推荐
</view> </view>
......
...@@ -73,7 +73,6 @@ ...@@ -73,7 +73,6 @@
display: flex; display: flex;
font-size: 24rpx; font-size: 24rpx;
box-sizing: border-box; box-sizing: border-box;
// justify-content: space-between;
} }
.shop_lists .list_item { .shop_lists .list_item {
width: 220rpx; width: 220rpx;
...@@ -110,13 +109,15 @@ ...@@ -110,13 +109,15 @@
color: #FACF58; color: #FACF58;
transform: scale(.75) translateX(-18rpx) translateY(-18rpx); transform: scale(.75) translateX(-18rpx) translateY(-18rpx);
border-radius: 4rpx; border-radius: 4rpx;
// overflow: hidden;
} }
.shop_lists .list_item .show_price div { .shop_lists .list_item .show_price div {
padding: 4rpx 8rpx; padding: 4rpx 8rpx;
} }
.shop_lists .list_item .show_price .title { .shop_lists .list_item .show_price .title {
background-image: linear-gradient(to right, #61626B , #323339); background-image: linear-gradient(to right, #61626B , #323339);
min-width: 50px;
display: flex;
align-items: center;
} }
.shop_lists .list_item .show_price .price { .shop_lists .list_item .show_price .price {
color: #333; color: #333;
......
...@@ -6,7 +6,11 @@ const componentOptions = { ...@@ -6,7 +6,11 @@ const componentOptions = {
multipleSlots: true multipleSlots: true
}, },
behaviors: [], behaviors: [],
properties: {}, properties: {
getDistributorHomepageName: {
type: String
}
},
// 组件数据 // 组件数据
data: { data: {
isPageHidden: false, isPageHidden: false,
...@@ -14,6 +18,7 @@ const componentOptions = { ...@@ -14,6 +18,7 @@ const componentOptions = {
showSetMoreDiscountPrice: false, showSetMoreDiscountPrice: false,
distributionPrice1: 0, distributionPrice1: 0,
showBaiFen: false, showBaiFen: false,
spokesmanInfo: {},
}, },
// 数据监听器 // 数据监听器
observers: {}, observers: {},
...@@ -21,7 +26,7 @@ const componentOptions = { ...@@ -21,7 +26,7 @@ const componentOptions = {
lifetimes: { lifetimes: {
created() {}, created() {},
ready() { ready() {
this.setData({ spokesmanInfo: app.globalData.spokesmanInfo });
}, },
moved() {}, moved() {},
detached() {} detached() {}
...@@ -54,14 +59,14 @@ const componentOptions = { ...@@ -54,14 +59,14 @@ const componentOptions = {
}, },
setNewShop() { setNewShop() {
// window.sessionStorage.setItem(getTokenTwo()+'currentState',0) // window.sessionStorage.setItem(getTokenTwo()+'currentState',0)
spokesmanApi.getDistributorHomepage('1').then(res=>{ spokesmanApi.getDistributorHomepage(this.data.spokesmanInfo.id).then(res=>{
// if(!this.$store.state.spokesmanModule.getLoginSpokesmanInfo.parentId) { if(!this.data.spokesmanInfo.parentId) {
this.initShopDetail() this.initShopDetail()
return return
// } }
if(res.code=='200'&&!(res.data&&res.data.id)) { if(res.data.code=='200'&&!(res.data.data&&res.data.data.id)) {
this.showSetMyShop = true; this.setData({ showPop: true });
}else if(res.code=='200'&&res.data&&res.data.id){ }else if(res.data.code=='200'&&res.data.data&&res.data.data.id){
this.initShopDetail() this.initShopDetail()
} }
}) })
...@@ -69,7 +74,7 @@ const componentOptions = { ...@@ -69,7 +74,7 @@ const componentOptions = {
copyShop() { copyShop() {
console.log(this.data.distributionPrice1,888888888) console.log(this.data.distributionPrice1,888888888)
spokesmanApi.oneClickShopQuickCopy({grossProfitMargin: parseFloat(this.data.distributionPrice1)}).then(res=>{ spokesmanApi.oneClickShopQuickCopy({grossProfitMargin: parseFloat(this.data.distributionPrice1)}).then(res=>{
if(res.data == 'true') { if(res.data.data == 'true') {
this.initShopDetail() this.initShopDetail()
} }
}) })
......
<view class="section"> <view class="section">
<view class="setMyHomePage" bindtap="toMyBusinessCard"> <view class="setMyHomePage" bindtap="setNewShop">
<view class="icon_box"> <view class="icon_box">
<image mode="aspectFit" style="height: 100%;" src="https://mayi-newshop.oss-cn-shanghai.aliyuncs.com/product/aB2X4tPAZi.png" alt=""></image> <image mode="aspectFit" style="height: 100%;" src="https://mayi-newshop.oss-cn-shanghai.aliyuncs.com/product/aB2X4tPAZi.png" alt=""></image>
</view> </view>
<text>我的小店</text> <text>{{getDistributorHomepageName}}</text>
</view> </view>
</view> </view>
......
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