This commit is contained in:
2020-07-21 21:02:28 +08:00
parent 864f43e200
commit c89099f686
18 changed files with 611 additions and 118 deletions

View File

@@ -1,13 +1,13 @@
<template>
<view class="group">
<view>
<u-tabs-swiper ref="uTabs" :list="tabList" :current="current" @change="tabsChange" :is-scroll="false"
swiperWidth="750"></u-tabs-swiper>
<u-tabs-swiper ref="uTabs" :list="tabList" name="gc_name" :current="current" @change="tabsChange" :is-scroll="true" active-color="#FF780F" swiperWidth="750" height="88" :show-bar="false"></u-tabs-swiper>
</view>
<swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish" >
<swiper-item class="swiper-item" v-for="(_, index) in tabList" :key="index">
<scroll-view scroll-y style="height: 800rpx;width: 100%;" @scrolltolower="onreachBottom">
{{ index }}
<SpecialGoods v-for="(item, index) in pinTuanList" :key="index" :item="item" type='group'></SpecialGoods>
<u-empty text="暂无商品" mode="list" color="#000" v-if="!pinTuanList.length"></u-empty>
</scroll-view>
</swiper-item>
</swiper>
@@ -18,21 +18,42 @@ import SpecialGoods from "../../components/shop/special-shop/index"
export default {
data() {
return {
tabList: [{name: '推荐'}, {name: '推荐'}, {name: '推荐'}],
current: 0,
tabList: [],
current: Number,
swiperCurrent: 0,
page: 0,
pinTuanList: [],
}
},
components: {
SpecialGoods
},
onShow() {
this.getPinTuanList();
onLoad() {
this.getGoodsClass();
},
watch: {
current(index) {
console.log(this.tabList);
this.getPinTuanList(this.tabList[index].gc_id);
}
},
methods: {
getPinTuanList() {
this.$u.api.getPinTuanList().then(res => {
// 获取优惠券拼团分类
async getGoodsClass() {
return await this.$u.api.getGoodsClass().then(res => {
if(res.errCode == 0) {
this.tabList = res.data;
this.current = 0;
}
})
},
// 拼团列表
getPinTuanList(id) {
this.$u.api.getPinTuanList({
page: this.page,
gc_id: id,
}).then(res => {
this.pinTuanList = res.data;
})
},
// tabs通知swiper切换