Commit 5ea3c458 by 李嘉林

优化

parent aee5135c
<template>
<div class="storeAddr flex">
<div class="left flex">
<div class="left flex" v-if="openThousandsStoresFlag">
<div class="logo">
<image :src="logoUrl" alt=""></image>
</div>
......@@ -46,15 +46,20 @@ export default {
}
if (this.openThousandsStoresFlag) {
this.getLocationHandle(() => {
this.getShopList();
this.$emit("toUpdate");
// this.getShopList();
});
}
let { offlineShopName } = getStoreInfo();
this.name = offlineShopName || "";
this.reloadName();
},
computed: {
},
methods: {
reloadName() {
let { offlineShopName } = getStoreInfo();
this.name = offlineShopName || "";
console.log(this.name,'----name')
},
getLocationHandle(callback) {
let _this = this;
wx.getLocation({
......
......@@ -5,112 +5,112 @@
<div v-if="showSpokesManHome">
<get-index-homepage class="getIndexHomePage"></get-index-homepage>
</div>
<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>
</div>
<div v-else-if="item.componentCode=='goods-list' && item.componentInfo.visible == 1" style="height:100%;">
<!-- ***这个商品列表组件中需要对数据做缓存,可能有多个地方同时引用此组件
必须在缓存前加个唯一标识不然所有组件全部操作同一个缓存
-->
<goods-list :storageKey="'home'+index" :class="['goodsListItem' + index,'goodsListItemIndex0']" :datas="item" :datasIndex="0" :goodsListIndex="0"></goods-list>
</div>
<div v-else-if="item.componentCode == 'area-navigation' && item.componentInfo.visible == 1">
<area-navigation :datas="item" :changeLocation="changeLocation"></area-navigation>
</div>
<div v-else-if="item.componentCode == 'cube-nav' && item.componentInfo.visible == 1">
<cube-nav :datas="item"></cube-nav>
</div>
<div v-else-if="item.componentCode == 'time-limited-discount' && item.componentInfo.visible == 1">
<time-limited-discount :class="'time-limited-discount'+index" :datas="item" :k="index"></time-limited-discount>
</div>
<div v-if="item.componentCode == 'links' && item.componentInfo.visible == 1">
<links :datas="item"></links>
</div>
<div v-if="item.componentCode == 'interval' && item.componentInfo.visible == 1">
<interval :datas="item"></interval>
</div>
<div v-if="item.componentCode == 'partition' && item.componentInfo.visible == 1">
<partition :datas="item"></partition>
</div>
<div v-if="item.componentCode == 'shop-popup' && item.componentInfo.visible == 1">
<shop-popup :datas="item"></shop-popup>
</div>
<div v-if="item.componentCode == 'float-button' && item.componentInfo.visible == 1">
<float-button :datas="item"></float-button>
</div>
<div v-if="item.componentCode == 'text-text' && item.componentInfo.visible == 1">
<text-text :datas="item"></text-text>
</div>
<div v-if="item.componentCode == 'img-text' && item.componentInfo.visible == 1">
<img-text :datas="item"></img-text>
</div>
<div v-if="item.componentCode == 'goods-search' && item.componentInfo.visible == 1">
<goods-search :datas="item"></goods-search>
</div>
<div v-if="item.componentCode == 'notice' && item.componentInfo.visible == 1">
<notice :datas="item"></notice>
</div>
<div v-if="item.componentCode == 'pop-up' && item.componentInfo.visible == 1">
<pop-up :datas="item"></pop-up>
</div>
<div v-if="item.componentCode == 'coupon' && item.componentInfo.visible == 1">
<coupon :datas="item"></coupon>
</div>
<div v-if="item.componentCode == 'integral-turntable' && item.componentInfo.visible == 1">
<integralTurntable :datas="item"></integralTurntable>
</div>
<div v-if="item.componentCode == 'speedy-nav' && item.componentInfo.visible == 1">
<speedy-nav :datas="item"></speedy-nav>
</div>
<div v-if="item.componentCode == 'video-player' && item.componentInfo.visible == 1" >
<video-player :class="'VideoPlayer' + index" :datas="item" :indexs="index"></video-player>
</div>
<div v-if="item.componentCode == 'official-account' && item.componentInfo.visible == 1">
<official-account></official-account>
</div>
<div v-if="item.componentCode == 'transverse-label' && item.componentInfo.visible == 1">
<transverse-label :datas="item" :componentIndex="index"></transverse-label>
</div>
<div v-if="item.componentCode == 'photo-gallery' && item.componentInfo.visible == 1">
<photo-gallery :datas="item"></photo-gallery>
</div>
<div v-if="item.componentCode == 'live-broadcast' && item.componentInfo.visible == 1">
<live-broadcast :datas="item"></live-broadcast>
</div>
<div v-if="item.componentCode == 'information' && item.componentInfo.visible == 1">
<information :datas="item"></information>
</div>
<div v-if="item.componentCode == 'share-picture' && item.componentInfo.visible == 1">
<share-picture :datas="item"></share-picture>
</div>
<div v-if="item.componentCode == 'merchants-list' && item.componentInfo.visible == 1">
<merchants-list :class="'merchants-list' +index" :datas="item"></merchants-list>
</div>
<div v-if="item.componentCode == 'spell-group' && item.componentInfo.visible == 1">
<spell-group :datas="item"></spell-group>
</div>
<div v-if="item.componentCode == 'wo-timeout' && item.componentInfo.visible == 1">
<wo-timeout :datas="item"></wo-timeout>
</div>
<div v-if="item.componentCode == 'custom-list' && item.componentInfo.visible == 1">
<custom-list :datas="item"></custom-list>
</div>
<div v-if="item.componentCode == 'rich-text' && item.componentInfo.visible == 1">
<rich-text :datas="item"></rich-text>
</div>
<div v-if="item.componentCode == 'member-info' && item.componentInfo.visible == 1">
<member-info :datas="item"></member-info>
</div>
<div v-if="item.componentCode == 'brand-list' && item.componentInfo.visible == 1">
<brandList :datas="item"></brandList>
</div>
<StoreAddr @toUpdate="reloadEnterShopRule" @toPageLoading="toPageLoading" ref="StoreAddr"></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>
</div>
<bottomCont v-if="showbottomCont"></bottomCont>
<div v-else-if="item.componentCode=='goods-list' && item.componentInfo.visible == 1" style="height:100%;">
<!-- ***这个商品列表组件中需要对数据做缓存,可能有多个地方同时引用此组件
必须在缓存前加个唯一标识不然所有组件全部操作同一个缓存
-->
<goods-list :storageKey="'home'+index" :class="['goodsListItem' + index,'goodsListItemIndex0']" :datas="item" :datasIndex="0" :goodsListIndex="0"></goods-list>
</div>
<div v-else-if="item.componentCode == 'area-navigation' && item.componentInfo.visible == 1">
<area-navigation :datas="item" :changeLocation="changeLocation"></area-navigation>
</div>
<div v-else-if="item.componentCode == 'cube-nav' && item.componentInfo.visible == 1">
<cube-nav :datas="item"></cube-nav>
</div>
<div v-else-if="item.componentCode == 'time-limited-discount' && item.componentInfo.visible == 1">
<time-limited-discount :class="'time-limited-discount'+index" :datas="item" :k="index"></time-limited-discount>
</div>
<div v-if="item.componentCode == 'links' && item.componentInfo.visible == 1">
<links :datas="item"></links>
</div>
<div v-if="item.componentCode == 'interval' && item.componentInfo.visible == 1">
<interval :datas="item"></interval>
</div>
<div v-if="item.componentCode == 'partition' && item.componentInfo.visible == 1">
<partition :datas="item"></partition>
</div>
<div v-if="item.componentCode == 'shop-popup' && item.componentInfo.visible == 1">
<shop-popup :datas="item"></shop-popup>
</div>
<div v-if="item.componentCode == 'float-button' && item.componentInfo.visible == 1">
<float-button :datas="item"></float-button>
</div>
<div v-if="item.componentCode == 'text-text' && item.componentInfo.visible == 1">
<text-text :datas="item"></text-text>
</div>
<div v-if="item.componentCode == 'img-text' && item.componentInfo.visible == 1">
<img-text :datas="item"></img-text>
</div>
<div v-if="item.componentCode == 'goods-search' && item.componentInfo.visible == 1">
<goods-search :datas="item"></goods-search>
</div>
<div v-if="item.componentCode == 'notice' && item.componentInfo.visible == 1">
<notice :datas="item"></notice>
</div>
<div v-if="item.componentCode == 'pop-up' && item.componentInfo.visible == 1">
<pop-up :datas="item"></pop-up>
</div>
<div v-if="item.componentCode == 'coupon' && item.componentInfo.visible == 1">
<coupon :datas="item"></coupon>
</div>
<div v-if="item.componentCode == 'integral-turntable' && item.componentInfo.visible == 1">
<integralTurntable :datas="item"></integralTurntable>
</div>
<div v-if="item.componentCode == 'speedy-nav' && item.componentInfo.visible == 1">
<speedy-nav :datas="item"></speedy-nav>
</div>
<div v-if="item.componentCode == 'video-player' && item.componentInfo.visible == 1" >
<video-player :class="'VideoPlayer' + index" :datas="item" :indexs="index"></video-player>
</div>
<div v-if="item.componentCode == 'official-account' && item.componentInfo.visible == 1">
<official-account></official-account>
</div>
<div v-if="item.componentCode == 'transverse-label' && item.componentInfo.visible == 1">
<transverse-label :datas="item" :componentIndex="index"></transverse-label>
</div>
<div v-if="item.componentCode == 'photo-gallery' && item.componentInfo.visible == 1">
<photo-gallery :datas="item"></photo-gallery>
</div>
<div v-if="item.componentCode == 'live-broadcast' && item.componentInfo.visible == 1">
<live-broadcast :datas="item"></live-broadcast>
</div>
<div v-if="item.componentCode == 'information' && item.componentInfo.visible == 1">
<information :datas="item"></information>
</div>
<div v-if="item.componentCode == 'share-picture' && item.componentInfo.visible == 1">
<share-picture :datas="item"></share-picture>
</div>
<div v-if="item.componentCode == 'merchants-list' && item.componentInfo.visible == 1">
<merchants-list :class="'merchants-list' +index" :datas="item"></merchants-list>
</div>
<div v-if="item.componentCode == 'spell-group' && item.componentInfo.visible == 1">
<spell-group :datas="item"></spell-group>
</div>
<div v-if="item.componentCode == 'wo-timeout' && item.componentInfo.visible == 1">
<wo-timeout :datas="item"></wo-timeout>
</div>
<div v-if="item.componentCode == 'custom-list' && item.componentInfo.visible == 1">
<custom-list :datas="item"></custom-list>
</div>
<div v-if="item.componentCode == 'rich-text' && item.componentInfo.visible == 1">
<rich-text :datas="item"></rich-text>
</div>
<div v-if="item.componentCode == 'member-info' && item.componentInfo.visible == 1">
<member-info :datas="item"></member-info>
</div>
<div v-if="item.componentCode == 'brand-list' && item.componentInfo.visible == 1">
<brandList :datas="item"></brandList>
</div>
</div>
<bottomCont v-if="showbottomCont"></bottomCont>
<template>
</template>
</div>
<share-popup></share-popup>
......@@ -174,7 +174,7 @@ import memberInfo from "../../components/basicTool/member-info";
import GoodsFliters from "../../components/common/GoodsFliters";
import SelectGoods from "../../components/common/SelectGoods";
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 { throttle, concatUrl } from "../../utils/index.js"
import mpvueCropper from '@/components/mpvue-cropper'
......@@ -332,19 +332,15 @@ export default {
console.log(new Date().getTime(),'load-----home-onLoad')
console.log(options,this.firstOpenPage,'---------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')
if (h5Params) {
if (Object.keys(h5Params).length>0) {
// 存储h5url门店信息
setStoreInfo({
offlineShopCode:h5Params.offlineShopCode,
offlineShopName:h5Params.offlineShopName,
});
}
// 进店规则--首次进店调用
if (wx.getStorageSync("firstView")) {
this.enterStoreRule(h5Params.offlineShopCode);
}
//进页面存储需要绑定的信息
if(options.userId||options.spokesmanRelId) {
wx.setStorage({
......@@ -479,11 +475,8 @@ export default {
}
}
})
this.pageLoading = false;
wx.removeStorageSync("firstView");
},
onShow() {
// this.pageLoading = false;
console.log(new Date().getTime(),'load-----home-onShow')
// 设置显示条件
console.log(new Date().getTime(),'--------on--------------show')
......@@ -513,32 +506,49 @@ export default {
},200),
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')
let locationObj = wx.getStorageSync("locationObj") ? JSON.parse(wx.getStorageSync("locationObj")) : {};
let { offlineShopCode } = getStoreInfo();
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,没有不传
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');
}
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(storeDetail, '-------storeDetail');
}
}
// this.pageLoading = false;
},
toUpdate() {
// 切换门店重新加载
......@@ -1023,7 +1033,7 @@ export default {
await app.getThemePage(this.$store.state.extConfig);
setTimeout(() => {
this.pageLoading = false;
}, 100);
}, 500);
}
},
async onShareAppMessage(res){
......@@ -1100,8 +1110,10 @@ export default {
log.info(res,'-----onShareTimeline')
},
onPullDownRefresh(){
this.pageLoading = true;
setTimeout(() => {
wx.stopPullDownRefresh();
this.pageLoading = false;
}, 1500);
log.info('onPullDownRefresh',this.$store.state.extConfig)
app.getShopInfo(this.$store.state.extConfig);
......
......@@ -81,10 +81,11 @@ Component({
if(res.data.code == '200'){
let list = res.data.data
if(list == null || list.length == 0){
if(this.query.pageNum == 1){
if(this.data.query.pageNum == 1){
this.setData({
showList: false
})
console.log('------change1')
}
}else{
list.forEach((item,index) => {
......@@ -140,7 +141,10 @@ Component({
}
if (this.data.WaterfallFlowList.length <= 0) {
this.showList = false;
this.setData({
showList : false
})
console.log('------change2')
}
}
if (list == null || list.length < 10) {
......@@ -159,6 +163,7 @@ Component({
finished : true,
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