Commit 5ea3c458 by 李嘉林

优化

parent aee5135c
<template> <template>
<div class="storeAddr flex"> <div class="storeAddr flex">
<div class="left flex"> <div class="left flex" v-if="openThousandsStoresFlag">
<div class="logo"> <div class="logo">
<image :src="logoUrl" alt=""></image> <image :src="logoUrl" alt=""></image>
</div> </div>
...@@ -46,15 +46,20 @@ export default { ...@@ -46,15 +46,20 @@ export default {
} }
if (this.openThousandsStoresFlag) { if (this.openThousandsStoresFlag) {
this.getLocationHandle(() => { this.getLocationHandle(() => {
this.getShopList(); this.$emit("toUpdate");
// this.getShopList();
}); });
} }
let { offlineShopName } = getStoreInfo(); this.reloadName();
this.name = offlineShopName || "";
}, },
computed: { computed: {
}, },
methods: { methods: {
reloadName() {
let { offlineShopName } = getStoreInfo();
this.name = offlineShopName || "";
console.log(this.name,'----name')
},
getLocationHandle(callback) { getLocationHandle(callback) {
let _this = this; let _this = this;
wx.getLocation({ wx.getLocation({
......
...@@ -5,8 +5,7 @@ ...@@ -5,8 +5,7 @@
<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>
<template v-if="!pageLoading"> <StoreAddr @toUpdate="reloadEnterShopRule" @toPageLoading="toPageLoading" ref="StoreAddr"></StoreAddr>
<StoreAddr @toUpdate="toUpdate" @toPageLoading="toPageLoading"></StoreAddr>
<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">
...@@ -111,6 +110,7 @@ ...@@ -111,6 +110,7 @@
</div> </div>
<bottomCont v-if="showbottomCont"></bottomCont> <bottomCont v-if="showbottomCont"></bottomCont>
<template>
</template> </template>
</div> </div>
<share-popup></share-popup> <share-popup></share-popup>
...@@ -174,7 +174,7 @@ import memberInfo from "../../components/basicTool/member-info"; ...@@ -174,7 +174,7 @@ import memberInfo from "../../components/basicTool/member-info";
import GoodsFliters from "../../components/common/GoodsFliters"; import GoodsFliters from "../../components/common/GoodsFliters";
import SelectGoods from "../../components/common/SelectGoods"; import SelectGoods from "../../components/common/SelectGoods";
import TwoBAddCart from "../../components/common/TwoBAddCart"; import TwoBAddCart from "../../components/common/TwoBAddCart";
import { setTabBarActive, checkTabbarPage,themeColor, checkShowConditionIds, setStoreInfo } from "../../utils/mayi.js"; import { setTabBarActive, checkTabbarPage,themeColor, checkShowConditionIds, setStoreInfo, getStoreInfo } from "../../utils/mayi.js";
import indexApi from "@/api/index.js"; import indexApi from "@/api/index.js";
import { throttle, concatUrl } from "../../utils/index.js" import { throttle, concatUrl } from "../../utils/index.js"
import mpvueCropper from '@/components/mpvue-cropper' import mpvueCropper from '@/components/mpvue-cropper'
...@@ -332,19 +332,15 @@ export default { ...@@ -332,19 +332,15 @@ export default {
console.log(new Date().getTime(),'load-----home-onLoad') console.log(new Date().getTime(),'load-----home-onLoad')
console.log(options,this.firstOpenPage,'---------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')
if (h5Params) { if (Object.keys(h5Params).length>0) {
// 存储h5url门店信息 // 存储h5url门店信息
setStoreInfo({ setStoreInfo({
offlineShopCode:h5Params.offlineShopCode, offlineShopCode:h5Params.offlineShopCode,
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({
...@@ -479,11 +475,8 @@ export default { ...@@ -479,11 +475,8 @@ export default {
} }
} }
}) })
this.pageLoading = false;
wx.removeStorageSync("firstView");
}, },
onShow() { onShow() {
// this.pageLoading = false;
console.log(new Date().getTime(),'load-----home-onShow') console.log(new Date().getTime(),'load-----home-onShow')
// 设置显示条件 // 设置显示条件
console.log(new Date().getTime(),'--------on--------------show') console.log(new Date().getTime(),'--------on--------------show')
...@@ -513,14 +506,29 @@ export default { ...@@ -513,14 +506,29 @@ export default {
},200), },200),
methods: { methods: {
async enterStoreRule(offlineShopCode) { reloadEnterShopRule() {
// 进店规则--首次进店调用
if (wx.getStorageSync("firstView")) {
console.log('reloadEnterShopRule-------1')
wx.removeStorageSync("firstView");
this.enterStoreRule();
} else {
console.log('reloadEnterShopRule-------2')
this.pageLoading = false;
}
},
async enterStoreRule() {
let shopInfo = await shop.getShopInfo(JSON.parse(wx.getStorageSync("extConfig")));
let openThousandsStoresFlag = shopInfo.data.data.openThousandsStoresFlag == 1;
if (!openThousandsStoresFlag) return;
console.log(wx.getStorageSync("locationObj"),'--locationObj') console.log(wx.getStorageSync("locationObj"),'--locationObj')
let locationObj = wx.getStorageSync("locationObj") ? JSON.parse(wx.getStorageSync("locationObj")) : {}; let locationObj = wx.getStorageSync("locationObj") ? JSON.parse(wx.getStorageSync("locationObj")) : {};
let { offlineShopCode } = getStoreInfo();
let query = { let query = {
channelType: 2, //设备类型(0:pc,1:app,2:小程序) channelType: 2, //设备类型(0:pc,1:app,2:小程序)
consumerLongitude: locationObj.longitude?locationObj.longitude.toString() : "", //经度,小程序和app可以获取到就要传,没有不传 consumerLongitude: locationObj.longitude?locationObj.longitude.toString() : "", //经度,小程序和app可以获取到就要传,没有不传
consumerLatitude: locationObj.latitude?locationObj.latitude.toString() : "", //纬度,小程序和app可以获取到就要传,没有不传 consumerLatitude: locationObj.latitude?locationObj.latitude.toString() : "", //纬度,小程序和app可以获取到就要传,没有不传
distributionOfficerShopCode: offlineShopCode || "" //分销员门店id,没有不传 distributionOfficerShopCode: offlineShopCode|| "" //分销员门店id,没有不传
} }
let res = await shop.getEnterShopId(query); let res = await shop.getEnterShopId(query);
if (res.data.code == 200) { if (res.data.code == 200) {
...@@ -535,10 +543,12 @@ export default { ...@@ -535,10 +543,12 @@ export default {
offlineShopCode: storeDetail.data.data.shopCode, offlineShopCode: storeDetail.data.data.shopCode,
offlineShopName: storeDetail.data.data.shopName, offlineShopName: storeDetail.data.data.shopName,
}); });
this.$refs.StoreAddr.reloadName();
} }
console.log(storeDetail, '-------storeDetail'); console.log(storeDetail, '-------storeDetail');
} }
} }
// this.pageLoading = false;
}, },
toUpdate() { toUpdate() {
// 切换门店重新加载 // 切换门店重新加载
...@@ -1023,7 +1033,7 @@ export default { ...@@ -1023,7 +1033,7 @@ export default {
await app.getThemePage(this.$store.state.extConfig); await app.getThemePage(this.$store.state.extConfig);
setTimeout(() => { setTimeout(() => {
this.pageLoading = false; this.pageLoading = false;
}, 100); }, 500);
} }
}, },
async onShareAppMessage(res){ async onShareAppMessage(res){
...@@ -1100,8 +1110,10 @@ export default { ...@@ -1100,8 +1110,10 @@ export default {
log.info(res,'-----onShareTimeline') log.info(res,'-----onShareTimeline')
}, },
onPullDownRefresh(){ onPullDownRefresh(){
this.pageLoading = true;
setTimeout(() => { setTimeout(() => {
wx.stopPullDownRefresh(); wx.stopPullDownRefresh();
this.pageLoading = false;
}, 1500); }, 1500);
log.info('onPullDownRefresh',this.$store.state.extConfig) log.info('onPullDownRefresh',this.$store.state.extConfig)
app.getShopInfo(this.$store.state.extConfig); app.getShopInfo(this.$store.state.extConfig);
......
...@@ -81,10 +81,11 @@ Component({ ...@@ -81,10 +81,11 @@ Component({
if(res.data.code == '200'){ if(res.data.code == '200'){
let list = res.data.data let list = res.data.data
if(list == null || list.length == 0){ if(list == null || list.length == 0){
if(this.query.pageNum == 1){ if(this.data.query.pageNum == 1){
this.setData({ this.setData({
showList: false showList: false
}) })
console.log('------change1')
} }
}else{ }else{
list.forEach((item,index) => { list.forEach((item,index) => {
...@@ -140,7 +141,10 @@ Component({ ...@@ -140,7 +141,10 @@ Component({
} }
if (this.data.WaterfallFlowList.length <= 0) { if (this.data.WaterfallFlowList.length <= 0) {
this.showList = false; this.setData({
showList : false
})
console.log('------change2')
} }
} }
if (list == null || list.length < 10) { if (list == null || list.length < 10) {
...@@ -159,6 +163,7 @@ Component({ ...@@ -159,6 +163,7 @@ Component({
finished : true, finished : true,
showList : false showList : false
}) })
console.log('------change3')
} }
}) })
......
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