Commit 118688a6 by 李嘉林

进店规则

parent 3524bea4
......@@ -4478,9 +4478,9 @@
"dev": true
},
"get-intrinsic": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.2.tgz",
"integrity": "sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==",
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
"integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
"requires": {
"function-bind": "^1.1.1",
"has": "^1.0.3",
......@@ -5728,9 +5728,9 @@
"dev": true
},
"mayi-analytics": {
"version": "1.1.38",
"resolved": "https://registry.npmjs.org/mayi-analytics/-/mayi-analytics-1.1.38.tgz",
"integrity": "sha512-tqhPTMmerFHvGye8z6+S8okY4v5NimBbo/qW71DZLEerfBw9C5vdhyCKWckuYVBj82aV3nj5HB0pLxj3TSEoaA==",
"version": "1.1.40",
"resolved": "https://registry.npmjs.org/mayi-analytics/-/mayi-analytics-1.1.40.tgz",
"integrity": "sha512-7r+3U+48oilMLxshVsjInQ719/KTRdgm7W06Iss2wnCcUMuoVL9rXf02H2VDESvGhqBWAq8PwU5DUZ/Fih22Bw==",
"requires": {
"js-cookie": "^2.2.0",
"qs": "^6.7.0",
......@@ -5738,9 +5738,9 @@
},
"dependencies": {
"qs": {
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
"integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
"version": "6.11.1",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.1.tgz",
"integrity": "sha512-0wsrzgTz/kAVIeuxSjnpGC56rzYtr6JT/2BwEvMaPhFIoYa1aGO8LbzuU1R0uUYQkLpWBTOj0l/CLAJB64J6nQ==",
"requires": {
"side-channel": "^1.0.4"
}
......@@ -8904,9 +8904,9 @@
},
"dependencies": {
"object-inspect": {
"version": "1.12.2",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz",
"integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ=="
"version": "1.12.3",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
"integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g=="
}
}
},
......
......@@ -25,7 +25,7 @@
},
"dependencies": {
"hashids": "^2.2.8",
"mayi-analytics": "^1.1.38",
"mayi-analytics": "^1.1.40",
"mayi-front-tools": "^1.0.1",
"mpvue": "^2.0.0",
"mpvue-wxparse": "^0.6.5",
......
......@@ -8,6 +8,7 @@ import { query_isEntry } from "@/utils/mayi_fenxiao";
export default {
async created() {
wx.setStorageSync("firstView", 1);
console.log(new Date().getTime(),'load-----app-created')
// NODE_ENV
let extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {};
......@@ -20,6 +21,7 @@ export default {
xhyx_prod: { "mixid":"antgood", "shopid": 67 },
}
extConfig = shopItem[process.env.NODE_ENV];
wx.setStorageSync("extConfig", JSON.stringify(extConfig));
}
......
......@@ -58,6 +58,11 @@ export default {
data
);
},
// 获取线下门店详情
getOfflineStoreDetail(data) {
return requestPOST(
`${process.env.OLSHOP_URL}/shop/get_offline_store_detail?shopId=${data.shopId}`);
},
// 首页获取线下门店列表v2
changingOverShopForXinHua(data) {
return requestPOST(
......
<template>
<div class="storeAddr flex" v-if="openThousandsStoresFlag">
<div class="storeAddr flex">
<div class="left flex">
<div class="logo">
<image :src="shopLogo" alt=""></image>
<image :src="logoUrl" alt=""></image>
</div>
<div class="contentInfo flex" v-if="name != ''">
<p class="info">{{ name }}</p>
......@@ -14,7 +14,7 @@
<script>
import shop from "@/api/shop";
import { DFSImg } from "@/utils/index";
import {setStoreInfo, getStoreInfo} from "@/utils/mayi"
import { setStoreInfo, getStoreInfo } from "@/utils/mayi"
const app = getApp();
const { log } = app;
export default {
......@@ -32,26 +32,27 @@ export default {
shopName: "",
},
enterShopId: "", //进店规则门店id
logoUrl: "",
openThousandsStoresFlag: false,
};
},
onLoad() {
async onLoad() {
let shopInfo = await shop.getShopInfo(JSON.parse(wx.getStorageSync("extConfig")));
console.log(shopInfo,'-------------shopInfo')
if (shopInfo.data.code == 200) {
this.openThousandsStoresFlag = shopInfo.data.data.openThousandsStoresFlag == 1;
this.logoUrl = DFSImg(shopInfo.data.data.logoUrl, 400, 400);
console.log(this.openThousandsStoresFlag,this.logoUrl,'-------------shopInfo')
}
if (this.openThousandsStoresFlag) {
this.getLocationHandle(() => {
this.getShopList();
});
}
let { offlineShopName } = getStoreInfo();
this.name = offlineShopName || "";
},
computed: {
shopName() {
return app.globalData && app.globalData.shopInfo && app.globalData.shopInfo.shopName;
},
shopLogo() {
return app.globalData && app.globalData.shopInfo && DFSImg(app.globalData.shopInfo.logoUrl, 400, 400);
},
// 开启连锁商城(千店千面)
openThousandsStoresFlag() {
return app.globalData && app.globalData.shopInfo && app.globalData.shopInfo.openThousandsStoresFlag == 1
}
},
methods: {
getLocationHandle(callback) {
......@@ -86,12 +87,13 @@ export default {
});
return;
};
return;
// 进店规则获取门店id
let query = {
channelType: 2, //设备类型(0:pc,1:app,2:小程序)
consumerLongitude: this.offlineStoreReq.longitude, //经度,小程序和app可以获取到就要传,没有不传
consumerLatitude: this.offlineStoreReq.latitude, //纬度,小程序和app可以获取到就要传,没有不传
distributionOfficerShopId: "" //分销员门店id,没有不传
distributionOfficerShopcode: "" //分销员门店id,没有不传
}
let enterShopRes = await shop.getEnterShopId(query);
if (enterShopRes && enterShopRes.code == 200) {
......@@ -105,16 +107,18 @@ export default {
let isStore = false;
let { offlineShopName, offlineShopCode } = getStoreInfo();
console.log(offlineShopName, offlineShopCode, '------------------sa114')
if(this.enterShopId) {
if (this.enterShopId) {
// 如果有进店规则门店id则直接匹配存入
let ruleShop = this.storeList.filter(item => item.id == this.enterShopId);
if(ruleShop && ruleShop.length > 0) {
if (ruleShop && ruleShop.length > 0) {
this.name = ruleShop[0].shopName;
this.$store.dispatch("setShopCode", {
shopCode: ruleShop[0].shopCode,
});
this.$store.dispatch("setShopName", {
shopName: ruleShop[0].shopName,
});
this.$emit("toUpdate");
return;
}
}
......
......@@ -5,9 +5,9 @@
<div v-if="showSpokesManHome">
<get-index-homepage class="getIndexHomePage"></get-index-homepage>
</div>
<ThemeDataPlant></ThemeDataPlant>
<StoreAddr @toUpdate="toUpdate" @toPageLoading="toPageLoading"></StoreAddr>
<template v-if="!pageLoading">
<StoreAddr @toUpdate="toUpdate" @toPageLoading="toPageLoading"></StoreAddr>
<ThemeDataPlant></ThemeDataPlant>
<div v-for="(item,index) in pageData" :key="index">
<div v-if="item.componentCode=='banner' && item.componentInfo.visible == 1">
<banner :datas="item"></banner>
......@@ -214,6 +214,7 @@ export default {
showbottomCont: false, //展示底部logo
showSpe: false,
pageLoading: true,
firstOpenPage: true, //首次打开页面
};
},
components:{
......@@ -324,10 +325,12 @@ export default {
log.info('未登录状态=====================', err)
}
})
console.log('----onReady')
this.firstOpenPage = false;
},
onLoad(options) {
console.log(new Date().getTime(),'load-----home-onLoad')
console.log(options,'---------home----options')
console.log(options,this.firstOpenPage,'---------home----options')
log.info(options, '---------home----options')
let h5Params = options && options.params ? JSON.parse(decodeURIComponent(options.params)) : "";
console.log(h5Params,'--h5Params')
......@@ -338,6 +341,10 @@ export default {
offlineShopName:h5Params.offlineShopName,
});
}
// 进店规则--首次进店调用
if (wx.getStorageSync("firstView")) {
this.enterStoreRule(h5Params.offlineShopCode);
}
//进页面存储需要绑定的信息
if(options.userId||options.spokesmanRelId) {
wx.setStorage({
......@@ -472,8 +479,8 @@ export default {
}
}
})
console.log('storageGoodsList---detory');
this.pageLoading = false;
wx.removeStorageSync("firstView");
},
onShow() {
// this.pageLoading = false;
......@@ -506,6 +513,33 @@ export default {
},200),
methods: {
async enterStoreRule(offlineShopCode) {
console.log(wx.getStorageSync("locationObj"),'--locationObj')
let locationObj = wx.getStorageSync("locationObj") ? JSON.parse(wx.getStorageSync("locationObj")) : {};
let query = {
channelType: 2, //设备类型(0:pc,1:app,2:小程序)
consumerLongitude: locationObj.longitude?locationObj.longitude.toString() : "", //经度,小程序和app可以获取到就要传,没有不传
consumerLatitude: locationObj.latitude?locationObj.latitude.toString() : "", //纬度,小程序和app可以获取到就要传,没有不传
distributionOfficerShopCode: offlineShopCode || "" //分销员门店id,没有不传
}
let res = await shop.getEnterShopId(query);
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,
});
}
console.log(storeDetail, '-------storeDetail');
}
}
},
toUpdate() {
// 切换门店重新加载
this.getThemeList();
......@@ -987,7 +1021,9 @@ export default {
async getThemeList() {
this.pageLoading = true;
await app.getThemePage(this.$store.state.extConfig);
setTimeout(() => {
this.pageLoading = false;
}, 100);
}
},
async onShareAppMessage(res){
......
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