coupon
This commit is contained in:
@@ -37,11 +37,11 @@
|
||||
<scroll-view scroll-y class="details">
|
||||
<view v-for="(item, index) in pointslogList" :key="index" class="details-item">
|
||||
<view class="item-left">
|
||||
<view class="item-title">{{ item.pl_desc }}</view>
|
||||
<view class="item-title u-line-1">{{ item.pl_desc }}</view>
|
||||
<view class="item-date">{{ item.pl_addtime }}</view>
|
||||
</view>
|
||||
<view class="item-right" :class="[item.pl_addtime < 0 ? 'negative' : 'positive']">
|
||||
{{ item.pl_addtime > 0 ? item.pl_addtime : '+' + 10.00 }}
|
||||
<view class="item-right" :class="[item.pl_points < 0 ? 'negative' : 'positive']">
|
||||
{{ Number(item.pl_points) > 0 ? '+' + item.pl_points : item.pl_points }}
|
||||
</view>
|
||||
</view>
|
||||
<u-empty text="暂无明细" mode="data" color="#000" v-if="!pointslogList.length"></u-empty>
|
||||
@@ -75,6 +75,14 @@ export default {
|
||||
components: {
|
||||
CouponView
|
||||
},
|
||||
onLoad(option) {
|
||||
if(option.current) this.current = option.current;
|
||||
},
|
||||
watch: {
|
||||
current(value) {
|
||||
this.swiperCurrent = value;
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.getMemberPointsStat();
|
||||
this.getPointslogList();
|
||||
@@ -186,6 +194,7 @@ export default {
|
||||
justify-content: space-between;
|
||||
.item-left {
|
||||
.item-title {
|
||||
width: 450rpx;
|
||||
font-size: 32rpx;
|
||||
color: rgba(51,51,51,1);
|
||||
margin-bottom: 23rpx;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="coupon-swiper">
|
||||
<u-tabs-swiper ref="coupon" :list="couponGroupList" :is-scroll="true" active-color="#FF780F" :current="couponCurrent" font-size="24" :show-bar="false" @change="couponTabsChange" height="88" ></u-tabs-swiper>
|
||||
<u-tabs-swiper ref="coupon" :list="couponGroupList" name="gc_name" :is-scroll="true" active-color="#FF780F" :current="couponCurrent" font-size="24" :show-bar="false" @change="couponTabsChange" height="88" ></u-tabs-swiper>
|
||||
<swiper :current="swiperCouponCurrent" @animationfinish="couponAnimationFinish" :style="{ height: swiperHeight }">
|
||||
<swiper-item class="swiper-coupon-item" v-for="(_, i) in couponGroupList" :key="i">
|
||||
<scroll-view scroll-y style="height: 100%;">
|
||||
@@ -31,43 +31,9 @@ export default {
|
||||
swiperHeight: '',
|
||||
couponCurrent: 0,
|
||||
swiperCouponCurrent: 0,
|
||||
couponGroupList: [
|
||||
{
|
||||
name: '平台'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}, {
|
||||
name: '分类名称'
|
||||
}
|
||||
],
|
||||
couponList: [
|
||||
{
|
||||
index: 0
|
||||
},
|
||||
{
|
||||
index: 1
|
||||
},
|
||||
],
|
||||
couponGroupList: [],
|
||||
couponList: [],
|
||||
page: 0,
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@@ -75,8 +41,35 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.setViewHeight();
|
||||
this.getGoodsClass();
|
||||
},
|
||||
watch: {
|
||||
couponCurrent(index) {
|
||||
const id = this.couponGroupList[index].gc_id;
|
||||
this.getCouponList({ gc_id: id });
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getGoodsClass() {
|
||||
this.$u.api.getGoodsClass().then(res => {
|
||||
if(res.errCode == 0) {
|
||||
this.couponGroupList = res.data;
|
||||
this.getCouponList(this.couponGroupList[0].gc_id);
|
||||
}
|
||||
})
|
||||
},
|
||||
getCouponList({ gc_id }) {
|
||||
this.$u.api.getCouponList({
|
||||
page: this.page,
|
||||
gc_id: gc_id,
|
||||
}).then(res => {
|
||||
if(res.errCode == 0) {
|
||||
this.couponList = res.data;
|
||||
} else {
|
||||
this.couponList = [];
|
||||
}
|
||||
})
|
||||
},
|
||||
exchangeCoupon(id) {
|
||||
console.log(id);
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<swiper :current="swiperCurrent" @animationfinish="animationfinish" :style="{ height: swiperHeight }">
|
||||
<swiper-item class="swiper-item" v-for="(_, index) in list" :key="index">
|
||||
<scroll-view scroll-y class="scroll-coupon">
|
||||
<view class="coupon-item" v-for="(coupon, c_index) in test" :key="c_index">
|
||||
<view class="coupon-item" v-for="(coupon, c_index) in couponList" :key="c_index">
|
||||
<Coupon :couponInfo="coupon" :status='index' :type="1" @use="useCoupon($event)"></Coupon>
|
||||
</view>
|
||||
</scroll-view>
|
||||
@@ -24,35 +24,10 @@ export default {
|
||||
}, {
|
||||
name: '已过期'
|
||||
}],
|
||||
current: 0,
|
||||
current: Number,
|
||||
swiperCurrent: 0,
|
||||
swiperHeight: '',
|
||||
test: [
|
||||
{
|
||||
index: 0
|
||||
},
|
||||
{
|
||||
index: 1
|
||||
},
|
||||
{
|
||||
index: 2
|
||||
},
|
||||
{
|
||||
index: 3
|
||||
},
|
||||
{
|
||||
index: 4
|
||||
},
|
||||
{
|
||||
index: 5
|
||||
},
|
||||
{
|
||||
index: 6
|
||||
},
|
||||
{
|
||||
index: 7
|
||||
}
|
||||
]
|
||||
couponList: []
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@@ -61,7 +36,25 @@ export default {
|
||||
onLoad() {
|
||||
this.setViewHeight();
|
||||
},
|
||||
onShow() {
|
||||
this.current = 0;
|
||||
},
|
||||
watch: {
|
||||
current(value) {
|
||||
let status = value + 1;
|
||||
this.getMemberCouponList(status);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getMemberCouponList(current) {
|
||||
this.$u.api.getMemberCouponList({
|
||||
status: current
|
||||
}).then(res => {
|
||||
if(res.errCode == 0) {
|
||||
this.couponList = res.data;
|
||||
}
|
||||
})
|
||||
},
|
||||
useCoupon(id) {
|
||||
console.log(id);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user