diff --git a/common/js/request.js b/common/js/request.js index 4192d5a..e3bd523 100644 --- a/common/js/request.js +++ b/common/js/request.js @@ -85,21 +85,26 @@ export default { } }, async getCurArea() { - let curLocation = uni.getStorageSync('curLocation'); - if (curLocation && curLocation.updateTimes) { - let curTimes = new Date().getTime(); - let deltaSeconds = curTimes - Number(curLocation.updateTimes); - if (deltaSeconds >= 15 * 60 * 1000) { - // 设定重新获取定位的时间间隔为15分钟 + try{ + let curLocation = uni.getStorageSync('curLocation'); + console.log(curLocation) + if (curLocation && curLocation.updateTimes) { + let curTimes = new Date().getTime(); + let deltaSeconds = curTimes - Number(curLocation.updateTimes); + if (deltaSeconds >= 15 * 60 * 1000) { + // 设定重新获取定位的时间间隔为15分钟 + await this.wxGetLocation(); + curLocation = uni.getStorageSync('curLocation'); + } + } else { await this.wxGetLocation(); curLocation = uni.getStorageSync('curLocation'); } - } else { - await this.wxGetLocation(); - curLocation = uni.getStorageSync('curLocation'); - } - if (curLocation && curLocation.area) { - return curLocation.area; + if (curLocation && curLocation.area) { + return curLocation.area; + } + }catch(e){ + console.error(e) } return null; }, diff --git a/components/goods-card/horizontal-goods-card.vue b/components/goods-card/horizontal-goods-card.vue index a1e5c47..dee9b93 100644 --- a/components/goods-card/horizontal-goods-card.vue +++ b/components/goods-card/horizontal-goods-card.vue @@ -16,19 +16,29 @@ {{product.goodsPrice}} - + {{product.goodsStandardList[0].discountPrice}} ¥{{product.goodsStandardList[0].goodsPrice}} + / + {{product.goodsUnit}} - + {{product.goodsStandardList[0].goodsPrice}} + / + {{product.goodsUnit}} {{product.payMoney}} - - {{product.type}} + + + + {{product.parGoodsCategoryName}} + / + + {{product.deptGoodsCategoryName}} + diff --git a/pages/index/home.vue b/pages/index/home.vue index 1f2b280..8e98828 100644 --- a/pages/index/home.vue +++ b/pages/index/home.vue @@ -138,7 +138,7 @@ async loadData() { this.initBasicData(); // 加载区域信息 - this.loadRegionList(); + await this.loadRegionList(); await this.getCurAreaArr(); // 加载热门类目 let hotCategoryRes = await this.$request.getHotCategory({ @@ -169,7 +169,7 @@ this.searchInfo.area = areaArr; } else { // 默认选中第一个 - this.searchInfo.area = [regionList[0], subRegionList[0], subSubRegionList[0]]; + this.searchInfo.area = [this.areaList[0][0], this.areaList[1][0], this.areaList[2][0]]; } }, async loadCategoryList() { diff --git a/pages/index/worker-home.vue b/pages/index/worker-home.vue index 2a53b4b..8b50e81 100644 --- a/pages/index/worker-home.vue +++ b/pages/index/worker-home.vue @@ -184,19 +184,25 @@ type: 1 }); typeList = typeList.data; - // let col1Id = idArr ? idArr[0] : typeList[0].goodsCategoryId; - // let subTypeList = await this.$request.listByStepWithAllNode({ - // goodsCategoryId: col1Id - // }); - // subTypeList = subTypeList.data; - // let col2Id = idArr ? idArr[1] : subTypeList[0].goodsCategoryId; - // let subSubTypeList = await this.$request.listByStepWithAllNode({ - // goodsCategoryId: col2Id - // }); - // subSubTypeList = subSubTypeList.data; + let subTypeList = []; + let subSubTypeList = []; + if (typeList && typeList.length) { + let col1Id = typeList[0].goodsCategoryId; + subTypeList = await this.$request.listByStepWithAllNode({ + goodsCategoryId: col1Id + }); + subTypeList = subTypeList.data; + } + // if (subTypeList && subTypeList.length) { + // let col2Id = subTypeList[0].goodsCategoryId; + // subSubTypeList = await this.$request.listByStepWithAllNode({ + // goodsCategoryId: col2Id + // }); + // subSubTypeList = subSubTypeList.data; + // } this.categoryList.push(typeList); - this.categoryList.push([]); - this.categoryList.push([]); + this.categoryList.push(subTypeList); + this.categoryList.push(subSubTypeList); }, async loadRegionList() { let regionList = await this.$request.areaListByStep(); diff --git a/pages/product/filtered-products.vue b/pages/product/filtered-products.vue index 39de819..6fc3c97 100644 --- a/pages/product/filtered-products.vue +++ b/pages/product/filtered-products.vue @@ -234,20 +234,26 @@ goodsCategoryId: res[0].goodsCategoryId, type: 1 }); - typeList = typeList.data; - // let col1Id = idArr ? idArr[0] : typeList[0].goodsCategoryId; - // let subTypeList = await this.$request.listByStepWithAllNode({ - // goodsCategoryId: col1Id - // }); - // subTypeList = subTypeList.data; - // let col2Id = idArr ? idArr[1] : subTypeList[0].goodsCategoryId; - // let subSubTypeList = await this.$request.listByStepWithAllNode({ - // goodsCategoryId: col2Id - // }); - // subSubTypeList = subSubTypeList.data; + typeList = typeList.data; + let subTypeList = []; + let subSubTypeList = []; + if (typeList && typeList.length) { + let col1Id = typeList[0].goodsCategoryId; + subTypeList = await this.$request.listByStepWithAllNode({ + goodsCategoryId: col1Id + }); + subTypeList = subTypeList.data; + } + // if (subTypeList && subTypeList.length) { + // let col2Id = subTypeList[0].goodsCategoryId; + // subSubTypeList = await this.$request.listByStepWithAllNode({ + // goodsCategoryId: col2Id + // }); + // subSubTypeList = subSubTypeList.data; + // } this.categoryList.push(typeList); - this.categoryList.push([]); - this.categoryList.push([]); + this.categoryList.push(subTypeList); + this.categoryList.push(subSubTypeList); }, async loadRegionList() { let regionList = await this.$request.areaListByStep(); diff --git a/pages/product/product-detail.vue b/pages/product/product-detail.vue index 3bcb686..f111c32 100644 --- a/pages/product/product-detail.vue +++ b/pages/product/product-detail.vue @@ -19,7 +19,7 @@ + :show-center-play-btn="true" :show-fullscreen-btn="true"> @@ -405,7 +405,7 @@ } .lg-screen-swiper { - height: 130vw; + height: 115vw; transition: all 0.5s ease-in-out; }