Commit 118688a6 by 李嘉林

进店规则

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