Commit 5f3ca3e5 by 李嘉林

feat: 进店规则优化

parent b220d8b5
......@@ -94,6 +94,13 @@ export default {
data
);
},
// 进店规则获取门店id预进入门店
getEnterShopIdV1(data) {
return requestPOST(
`${process.env.OLSHOP_URL}/enterShopRule/getEnterShopIdV1`,
data
);
},
// 商城二维码分配组织或跟进人
ShopCodeDistributionOrg(data) {
return requestPOST(
......
......@@ -7,7 +7,7 @@
</div> -->
<CustomNav :customBgOpacity="customBgOpacity"></CustomNav>
<StoreAddr v-if="showStoreAddr" @toUpdate="reloadEnterShopRule" @toPageLoading="toPageLoading" ref="StoreAddr"></StoreAddr>
<ThemeDataPlant></ThemeDataPlant>
<ThemeDataPlant v-if="!pageLoading"></ThemeDataPlant>
<div v-for="(item,index) in pageData" :key="index">
<div v-if="item.componentCode=='banner' && item.componentInfo.visible == 1">
<banner :datas="item"></banner>
......@@ -204,22 +204,22 @@ export default {
pageInfo: {},
pageData: [],
contentList: [],
themeColor:{
'--main-color':"",
'--minor-color':"",
themeColor: {
'--main-color': "",
'--minor-color': "",
},
changeLocation : '',
beforeScrollTop:0,
changeLocation: '',
beforeScrollTop: 0,
showSpokesManHome: false,//分销商货架是否展示
showMyCard: false,
showHomepage: false,//分销商首页入口
applySucessEntry: false,//成为分销弹框
getDistributorHomepageName: '',//小店入口名称
active:-1,
active: -1,
toHomePage: false,//是否分销隔断
options: 1,
// 新人有礼
newGiftList:[],
newGiftList: [],
newCustomerGiftActivityId: "", //新客活动id
showNewUser: false, //新客有礼入口
showgiftBag: false, //新客礼包弹框
......@@ -237,6 +237,9 @@ export default {
customBgOpacity: true, // 沉浸式风格
reloadPage: false, // 切换门店进入首页重新获取相关配置
showStoreAddr: false,
preEntryStoreId: "", // 预进入门店code
preEntryStore: {}, // 预进入门店
storeDetail: {},
};
},
components:{
......@@ -570,8 +573,6 @@ export default {
}
// 新人有礼弹窗
this.newUserFun();
// 新店调试
this.debugShopFun();
//清除商品列表组件懒加载缓存
// 需清除的缓存keyList
......@@ -617,6 +618,8 @@ export default {
}
},
async enterStoreRule() {
let _this = this;
await this.getEnterShopIdV1();
try {
console.log(wx.getStorageSync("locationObj"),'--locationObj')
let locationObj = wx.getStorageSync("locationObj") ? JSON.parse(wx.getStorageSync("locationObj")) : {};
......@@ -631,37 +634,93 @@ export default {
console.log(`%cgetEnterShopId${JSON.stringify(res)}`,'color:yellow;font-size:20px;')
if (res.data.code == 200) {
let enterShopId = res.data.data;
console.log(enterShopId,'--enterShopId')
if (enterShopId) {
let storeDetail = await shop.getOfflineStoreDetail({
shopId: enterShopId,
});
if (storeDetail.data.code == 200) {
setStoreInfo({
offlineShopCode: storeDetail.data.data.shopCode,
offlineShopName: storeDetail.data.data.shopName,
});
this.$refs.StoreAddr.reloadName();
console.log("refreshInit--------3")
this.refreshInit();
}
console.log(storeDetail, '-------storeDetail');
let loginUserInfo = wx.getStorageSync("loginUserInfo") || null;
let query2 = {
telephoneNum: loginUserInfo && loginUserInfo.mobilephone,
enterShopSource: "买家直接进入",
hitRule: "首页进入",
shopName: storeDetail.data.data.shopName,
}
log.info("进店规则-----",query2)
shop.saveEnterShopRecord(query2);
console.log(enterShopId, '--enterShopId');
let storeDetail = await shop.getOfflineStoreDetail({
shopId: enterShopId,
});
if (storeDetail.data.code == 200) {
this.storeDetail = storeDetail.data.data;
}
console.log('enterStoreRule->', this.preEntryStoreId, enterShopId)
if (this.preEntryStoreId && this.preEntryStoreId != enterShopId) {
wx.showModal({
title: '提醒',
content: `当前定位最近门店【${this.storeDetail.shopName}】是否要进入该门店?`,
success (res) {
if (res.confirm) {
_this.enterStore(enterShopId);
} else if (res.cancel) {
console.log('用户点击取消')
_this.setPageLoading();
}
}
})
} else {
await this.enterStore(enterShopId);
}
}
} catch (error) {
console.log('enterStoreRule-error->', error)
}
// this.setPageLoading();
},
async getEnterShopIdV1() {
this.preEntryStoreId = "";
try {
let res = await shop.getEnterShopIdV1({
channelType: 2,
consumerLongitude: "",
consumerLatitude: "",
distributionOfficerShopCode: ""
});
if (res.data.code == 200 && !isNaN(res.data.data - 0)) {
this.preEntryStoreId = res.data.data;
let storeDetail = await shop.getOfflineStoreDetail({
shopId: this.preEntryStoreId,
});
if (storeDetail.data.code == 200) {
this.storeDetail = storeDetail.data.data;
}
await this.enterStore(this.preEntryStoreId);
}
} catch (error) {
console.log('getEnterShopIdV1-error->', error)
}
},
async enterStore(enterId) {
if (enterId) {
if (this.storeDetail.shopCode) {
setStoreInfo({
offlineShopCode: this.storeDetail.shopCode,
offlineShopName: this.storeDetail.shopName,
});
this.$refs.StoreAddr.reloadName();
console.log("refreshInit--------3")
// this.refreshInit();
let that = this;
console.log("onPullDownRefresh");
console.log("refreshInit--------4")
this.refreshInit();
this.mpApp.pageCallBack = function (params) {
console.log("获取页面数据-3",params)
that.init(params);
};
}
console.log(this.storeDetail, '-------this.storeDetail');
let loginUserInfo = wx.getStorageSync("loginUserInfo") || null;
let query2 = {
telephoneNum: loginUserInfo && loginUserInfo.mobilephone,
enterShopSource: "买家直接进入",
hitRule: "首页进入",
shopName: this.storeDetail.shopName,
}
log.info("进店规则-----",query2)
shop.saveEnterShopRecord(query2);
}
},
getOfflineStoreDetail() {
},
toPageLoading() {
},
async setVisible(pageList, cb) {
......@@ -1190,6 +1249,8 @@ export default {
} catch (error) {
}
// 新店调试
this.debugShopFun();
wx.stopPullDownRefresh();
},
ShopCodeDistributionOrg() {
......
......@@ -159,7 +159,11 @@ export default {
}
},
onLoad(options) {
wx.removeStorageSync("firstView");
let { offlineShopCode, offlineShopName } = getStoreInfo();
// 新用户首次扫码进入此页没缓存认定为第一次访问
if (offlineShopCode) {
wx.removeStorageSync("firstView");
}
console.log(options,'---options')
if(wx.getStorageSync("sessionid")) {
......
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