2020-06-11 16:12:04 +08:00
|
|
|
<template>
|
|
|
|
<view class="group">
|
|
|
|
<view class="top">
|
|
|
|
<text>全部拼团</text>
|
2020-07-21 21:02:28 +08:00
|
|
|
<text @click="viewMore">查看更多></text>
|
2020-06-11 16:12:04 +08:00
|
|
|
</view>
|
|
|
|
<view class="label">
|
2020-07-21 21:02:28 +08:00
|
|
|
<u-tabs-swiper ref="group" :list="classifyList" name="gc_name" :is-scroll="true" active-color="#FF780F" :current="current" font-size="24" :show-bar="false" @change="tabsChange" height="88"></u-tabs-swiper>
|
2020-06-11 16:12:04 +08:00
|
|
|
</view>
|
2020-08-05 17:38:11 +08:00
|
|
|
<swiper :current="swiperCurrent" @animationfinish="animationfinish" style="height: 260rpx">
|
2020-07-23 20:58:56 +08:00
|
|
|
<swiper-item class="swiper-item list" v-for="(_, i) in classifyList" :key="i">
|
2020-07-20 17:17:41 +08:00
|
|
|
<!-- 最多显示3个 -->
|
|
|
|
<sitem :info="info" v-for="(info, index) in groupList.slice(0, 3)" :key="index"></sitem>
|
2020-07-24 19:48:57 +08:00
|
|
|
<u-empty text="暂无拼团商品" mode="list" color="#000" v-if="!groupList.length" style="margin: 0 auto;"></u-empty>
|
2020-07-20 17:17:41 +08:00
|
|
|
</swiper-item>
|
|
|
|
</swiper>
|
2020-06-11 16:12:04 +08:00
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import sitem from "./item"
|
|
|
|
export default {
|
|
|
|
name:"group",
|
|
|
|
components:{
|
|
|
|
sitem
|
2020-07-20 17:17:41 +08:00
|
|
|
},
|
2020-06-11 16:12:04 +08:00
|
|
|
data(){
|
|
|
|
return {
|
2020-07-24 19:48:57 +08:00
|
|
|
current: -1,
|
2020-07-20 17:17:41 +08:00
|
|
|
swiperCurrent: 0,
|
2020-07-24 19:48:57 +08:00
|
|
|
groupList: [], // 拼团商品
|
2020-07-24 20:35:28 +08:00
|
|
|
classifyList: [],
|
2020-06-11 16:12:04 +08:00
|
|
|
}
|
2020-07-20 17:17:41 +08:00
|
|
|
},
|
2020-07-24 19:48:57 +08:00
|
|
|
watch: {
|
|
|
|
current(value) {
|
|
|
|
this.getPinTuanList(this.classifyList[value].gc_id);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
created() {
|
2020-07-24 20:35:28 +08:00
|
|
|
this.getGoodsClass();
|
2020-07-24 19:48:57 +08:00
|
|
|
},
|
2020-07-20 17:17:41 +08:00
|
|
|
methods: {
|
2020-07-24 20:35:28 +08:00
|
|
|
// 获取优惠券拼团分类
|
|
|
|
getGoodsClass() {
|
|
|
|
this.$u.api.getGoodsClass().then(res => {
|
|
|
|
if(res.errCode == 0) {
|
|
|
|
this.classifyList = res.data;
|
|
|
|
this.current = 0;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
2020-07-24 19:48:57 +08:00
|
|
|
// 拼团列表
|
|
|
|
getPinTuanList(id) {
|
|
|
|
this.$u.api.getPinTuanList({
|
|
|
|
page: 0,
|
|
|
|
gc_id: id,
|
|
|
|
}).then(res => {
|
|
|
|
this.groupList = res.data;
|
|
|
|
})
|
|
|
|
},
|
2020-07-20 17:17:41 +08:00
|
|
|
tabsChange(index) {
|
|
|
|
this.swiperCurrent = index;
|
|
|
|
},
|
|
|
|
animationfinish(e) {
|
|
|
|
let current = e.detail.current;
|
|
|
|
this.swiperCurrent = current;
|
|
|
|
this.current = current;
|
|
|
|
},
|
2020-07-21 21:02:28 +08:00
|
|
|
viewMore() {
|
|
|
|
this.$u.route({
|
|
|
|
url: 'pageC/groupBuy/index',
|
|
|
|
})
|
|
|
|
}
|
2020-07-20 17:17:41 +08:00
|
|
|
}
|
2020-06-11 16:12:04 +08:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.group{
|
2020-07-24 19:48:57 +08:00
|
|
|
background-color: #ffffff;
|
|
|
|
.top {
|
|
|
|
padding: 0 30rpx;
|
2020-06-11 16:12:04 +08:00
|
|
|
height: 90rpx;
|
|
|
|
width: 100%;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
|
|
|
>text:first-child{
|
|
|
|
font-size: 30rpx;
|
|
|
|
color: #333;
|
|
|
|
}
|
|
|
|
>text:last-child{
|
|
|
|
font-size: 18rpx;
|
|
|
|
color: #999;
|
|
|
|
}
|
|
|
|
}
|
2020-07-24 19:48:57 +08:00
|
|
|
.list {
|
|
|
|
box-sizing: border-box;
|
2020-07-24 20:35:28 +08:00
|
|
|
padding: 0 30rpx;
|
2020-06-11 16:12:04 +08:00
|
|
|
display: flex;
|
2020-08-05 17:38:11 +08:00
|
|
|
> view {
|
|
|
|
&:not(:nth-child(3n)) {
|
2020-08-04 19:08:04 +08:00
|
|
|
margin-right: 20rpx;
|
|
|
|
}
|
|
|
|
}
|
2020-06-11 16:12:04 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|