|
|
@@ -96,30 +96,31 @@
|
|
|
<van-tabs :active="hotActive" @change="hotActive = $event.detail.index" :ellipsis="false">
|
|
|
<van-tab :title="item.name" v-for="item in hotProductsList" :key="item.id"></van-tab>
|
|
|
</van-tabs>
|
|
|
- <div class="van-content" v-if="nowProductsList.length > 0">
|
|
|
- <product-grid-big :info="mainProductInfo"></product-grid-big>
|
|
|
- <grid-big></grid-big>
|
|
|
- <swiper
|
|
|
- :style="{ height: swiperHeight + 'rpx' }"
|
|
|
- :current="hotSwiperIndex"
|
|
|
- @change="hotSwiperIndex = $event.detail.current"
|
|
|
- >
|
|
|
- <swiper-item v-for="(list, index) in swiperProduct" :key="index">
|
|
|
- <div class="product-list">
|
|
|
- <div class="col-3" v-for="item in list" :key="item.id">
|
|
|
- <product-grid :info="item" :clo="3" :padding="3"></product-grid>
|
|
|
+ <div class="van-content" v-if="nowProductsList.length > 0 || mainProductInfo">
|
|
|
+ <product-grid-big :info="mainProductInfo" v-if="mainProductInfo"></product-grid-big>
|
|
|
+ <div v-if="nowProductsList.length > 0">
|
|
|
+ <swiper
|
|
|
+ :style="{ height: swiperHeight + 'rpx' }"
|
|
|
+ :current="hotSwiperIndex"
|
|
|
+ @change="hotSwiperIndex = $event.detail.current"
|
|
|
+ >
|
|
|
+ <swiper-item v-for="(list, index) in swiperProduct" :key="index">
|
|
|
+ <div class="product-list">
|
|
|
+ <div class="col-3" v-for="item in list" :key="item.id">
|
|
|
+ <product-grid :info="item" :clo="3" :padding="3"></product-grid>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </swiper-item>
|
|
|
- </swiper>
|
|
|
-
|
|
|
- <div class="dots">
|
|
|
- <div
|
|
|
- class="dot"
|
|
|
- :class="{ active: index === hotSwiperIndex }"
|
|
|
- v-for="(item, index) in swiperProduct"
|
|
|
- :key="index"
|
|
|
- ></div>
|
|
|
+ </swiper-item>
|
|
|
+ </swiper>
|
|
|
+
|
|
|
+ <div class="dots">
|
|
|
+ <div
|
|
|
+ class="dot"
|
|
|
+ :class="{ active: index === hotSwiperIndex }"
|
|
|
+ v-for="(item, index) in swiperProduct"
|
|
|
+ :key="index"
|
|
|
+ ></div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
@@ -271,7 +272,12 @@ export default {
|
|
|
...mapState(['userInfo', 'barHeight']),
|
|
|
hotProductsList() {
|
|
|
return this.hotProducts.map(item => {
|
|
|
- return { name: this.getName(item), products: item.products, mainProduct: item.mainProduct };
|
|
|
+ return {
|
|
|
+ name: this.getName(item),
|
|
|
+ img: item.img,
|
|
|
+ products: item.products,
|
|
|
+ mainProduct: item.mainProduct
|
|
|
+ };
|
|
|
});
|
|
|
},
|
|
|
nowProductsList() {
|
|
|
@@ -281,10 +287,11 @@ export default {
|
|
|
},
|
|
|
nowHotProductInfo() {
|
|
|
const allList = [...this.hotProductsList];
|
|
|
- return allList[Number(this.activeIndex)] ? allList[Number(this.activeIndex)] : {};
|
|
|
+ return allList[Number(this.hotActive)] ? allList[Number(this.hotActive)] : {};
|
|
|
},
|
|
|
mainProductInfo() {
|
|
|
- return { ...this.nowHotProductInfo }.mainProduct;
|
|
|
+ const info = { ...this.nowHotProductInfo }.mainProduct;
|
|
|
+ return { ...info, img: this.nowHotProductInfo.img || info.img };
|
|
|
},
|
|
|
swiperProduct() {
|
|
|
const list = [...this.nowProductsList];
|