轮播图及视频调整;产品列表查询字段补充;选择品类第一级去掉全部选项

This commit is contained in:
donqi 2022-08-29 19:16:34 +08:00
parent 9e8e906ece
commit 0a2a568a12
6 changed files with 72 additions and 45 deletions

View File

@ -85,21 +85,26 @@ export default {
} }
}, },
async getCurArea() { async getCurArea() {
let curLocation = uni.getStorageSync('curLocation'); try{
if (curLocation && curLocation.updateTimes) { let curLocation = uni.getStorageSync('curLocation');
let curTimes = new Date().getTime(); console.log(curLocation)
let deltaSeconds = curTimes - Number(curLocation.updateTimes); if (curLocation && curLocation.updateTimes) {
if (deltaSeconds >= 15 * 60 * 1000) { let curTimes = new Date().getTime();
// 设定重新获取定位的时间间隔为15分钟 let deltaSeconds = curTimes - Number(curLocation.updateTimes);
if (deltaSeconds >= 15 * 60 * 1000) {
// 设定重新获取定位的时间间隔为15分钟
await this.wxGetLocation();
curLocation = uni.getStorageSync('curLocation');
}
} else {
await this.wxGetLocation(); await this.wxGetLocation();
curLocation = uni.getStorageSync('curLocation'); curLocation = uni.getStorageSync('curLocation');
} }
} else { if (curLocation && curLocation.area) {
await this.wxGetLocation(); return curLocation.area;
curLocation = uni.getStorageSync('curLocation'); }
} }catch(e){
if (curLocation && curLocation.area) { console.error(e)
return curLocation.area;
} }
return null; return null;
}, },

View File

@ -16,19 +16,29 @@
<text class="text-price text-red text-bold text-xl">{{product.goodsPrice}}</text> <text class="text-price text-red text-bold text-xl">{{product.goodsPrice}}</text>
</view> </view>
<view v-else-if="product.goodsStandardList && product.goodsStandardList.length > 0"> <view v-else-if="product.goodsStandardList && product.goodsStandardList.length > 0">
<view v-if="product.goodsStandardList[0].discountPrice" class="flex justify-start align-center"> <view v-if="product.goodsStandardList[0].discountPrice">
<text class="text-price text-red text-bold text-xl">{{product.goodsStandardList[0].discountPrice}}</text> <text class="text-price text-red text-bold text-xl">{{product.goodsStandardList[0].discountPrice}}</text>
<text class="text-del" v-if="product.goodsPrice">¥{{product.goodsStandardList[0].goodsPrice}}</text> <text class="text-del" v-if="product.goodsPrice">¥{{product.goodsStandardList[0].goodsPrice}}</text>
<text class="margin-left-xs">/</text>
<text>{{product.goodsUnit}}</text>
</view> </view>
<view v-else-if="product.goodsStandardList[0].goodsPrice" class="flex justify-start align-center"> <view v-else-if="product.goodsStandardList[0].goodsPrice">
<text class="text-price text-red text-bold text-xl">{{product.goodsStandardList[0].goodsPrice}}</text> <text class="text-price text-red text-bold text-xl">{{product.goodsStandardList[0].goodsPrice}}</text>
<text class="margin-left-xs">/</text>
<text>{{product.goodsUnit}}</text>
</view> </view>
</view> </view>
<view v-else-if="product.payMoney" class="flex justify-start align-center"> <view v-else-if="product.payMoney" class="flex justify-start align-center">
<text class="text-price text-red text-bold text-xl">{{product.payMoney}}</text> <text class="text-price text-red text-bold text-xl">{{product.payMoney}}</text>
</view> </view>
<view class="padding-xs" v-if="product.type"> <view class="padding-xs">
<view class='cu-tag light bg-blue'>{{product.type}}</view> <view class='cu-tag light bg-blue'>
<text v-if="product.parGoodsCategoryName">
{{product.parGoodsCategoryName}}
<text class="margin-lr-xs">/</text>
</text>
<text>{{product.deptGoodsCategoryName}}</text>
</view>
</view> </view>
</view> </view>
<view v-if="ifShowServArea"> <view v-if="ifShowServArea">

View File

@ -138,7 +138,7 @@
async loadData() { async loadData() {
this.initBasicData(); this.initBasicData();
// //
this.loadRegionList(); await this.loadRegionList();
await this.getCurAreaArr(); await this.getCurAreaArr();
// //
let hotCategoryRes = await this.$request.getHotCategory({ let hotCategoryRes = await this.$request.getHotCategory({
@ -169,7 +169,7 @@
this.searchInfo.area = areaArr; this.searchInfo.area = areaArr;
} else { } 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() { async loadCategoryList() {

View File

@ -184,19 +184,25 @@
type: 1 type: 1
}); });
typeList = typeList.data; typeList = typeList.data;
// let col1Id = idArr ? idArr[0] : typeList[0].goodsCategoryId; let subTypeList = [];
// let subTypeList = await this.$request.listByStepWithAllNode({ let subSubTypeList = [];
// goodsCategoryId: col1Id if (typeList && typeList.length) {
// }); let col1Id = typeList[0].goodsCategoryId;
// subTypeList = subTypeList.data; subTypeList = await this.$request.listByStepWithAllNode({
// let col2Id = idArr ? idArr[1] : subTypeList[0].goodsCategoryId; goodsCategoryId: col1Id
// let subSubTypeList = await this.$request.listByStepWithAllNode({ });
// goodsCategoryId: col2Id subTypeList = subTypeList.data;
// }); }
// subSubTypeList = subSubTypeList.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(typeList);
this.categoryList.push([]); this.categoryList.push(subTypeList);
this.categoryList.push([]); this.categoryList.push(subSubTypeList);
}, },
async loadRegionList() { async loadRegionList() {
let regionList = await this.$request.areaListByStep(); let regionList = await this.$request.areaListByStep();

View File

@ -235,19 +235,25 @@
type: 1 type: 1
}); });
typeList = typeList.data; typeList = typeList.data;
// let col1Id = idArr ? idArr[0] : typeList[0].goodsCategoryId; let subTypeList = [];
// let subTypeList = await this.$request.listByStepWithAllNode({ let subSubTypeList = [];
// goodsCategoryId: col1Id if (typeList && typeList.length) {
// }); let col1Id = typeList[0].goodsCategoryId;
// subTypeList = subTypeList.data; subTypeList = await this.$request.listByStepWithAllNode({
// let col2Id = idArr ? idArr[1] : subTypeList[0].goodsCategoryId; goodsCategoryId: col1Id
// let subSubTypeList = await this.$request.listByStepWithAllNode({ });
// goodsCategoryId: col2Id subTypeList = subTypeList.data;
// }); }
// subSubTypeList = subSubTypeList.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(typeList);
this.categoryList.push([]); this.categoryList.push(subTypeList);
this.categoryList.push([]); this.categoryList.push(subSubTypeList);
}, },
async loadRegionList() { async loadRegionList() {
let regionList = await this.$request.areaListByStep(); let regionList = await this.$request.areaListByStep();

View File

@ -19,7 +19,7 @@
<swiper :class="changeSwiperHeight ? 'sm-screen-swiper' : 'sm-screen-swiper lg-screen-swiper'" @change="changeSwiper"> <swiper :class="changeSwiperHeight ? 'sm-screen-swiper' : 'sm-screen-swiper lg-screen-swiper'" @change="changeSwiper">
<swiper-item v-if="productDetail.goodsVideoUrl"> <swiper-item v-if="productDetail.goodsVideoUrl">
<video style="width: 100%; height: 100%;" id="productVideo" :src="productDetail.goodsVideoUrl" :controls="true" :autoplay="false" <video style="width: 100%; height: 100%;" id="productVideo" :src="productDetail.goodsVideoUrl" :controls="true" :autoplay="false"
:show-center-play-btn="true" :show-fullscreen-btn="false" @click="clickSwiper($event, item, 0)"></video> :show-center-play-btn="true" :show-fullscreen-btn="true"></video>
</swiper-item> </swiper-item>
<swiper-item v-for="(item,index) in swiperList" :key="item.goodsImgsId" @click="clickSwiper($event, item, 1)"> <swiper-item v-for="(item,index) in swiperList" :key="item.goodsImgsId" @click="clickSwiper($event, item, 1)">
<image style="width: 100%; height: 100%;" :src="item.imgUrl" mode="aspectFit"></image> <image style="width: 100%; height: 100%;" :src="item.imgUrl" mode="aspectFit"></image>
@ -405,7 +405,7 @@
} }
.lg-screen-swiper { .lg-screen-swiper {
height: 130vw; height: 115vw;
transition: all 0.5s ease-in-out; transition: all 0.5s ease-in-out;
} }
</style> </style>