You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
2.7 KiB
106 lines
2.7 KiB
<template>
|
|
<view class="page">
|
|
<!-- 优惠券tab -->
|
|
<view class="coupon-tab">
|
|
<view class="tab" :class="{'action':TabShow===0}" @click="onCouponTab(0,'can_use')">
|
|
<text>未使用</text>
|
|
<text class="line"></text>
|
|
</view>
|
|
<view class="tab" :class="{'action':TabShow===1}" @click="onCouponTab(1,'used')">
|
|
<text>已使用</text>
|
|
<text class="line"></text>
|
|
</view>
|
|
<view class="tab" :class="{'action':TabShow===2}" @click="onCouponTab(2,'expired')">
|
|
<text>已过期</text>
|
|
<text class="line"></text>
|
|
</view>
|
|
</view>
|
|
<!-- 优惠券列表 -->
|
|
<view class="coupon-list" v-if="list.length>0">
|
|
<view class="list" v-for="(item,index) in list" :key="index" @click="userMyCoupon(item)">
|
|
<view class="list-data" :class="{'coupon-lose':TabShow!=0}">
|
|
<view class="coupon-price">
|
|
<view class="discounts">
|
|
<text class="min">¥</text>
|
|
<text class="max">{{item.coupon.amount}}</text>
|
|
</view>
|
|
<view class="full-reduction"><text>{{item.coupon.type_text}}</text></view>
|
|
<!-- <view class="jag"></view> -->
|
|
</view>
|
|
<view class="coupon-info">
|
|
<view class="info-title">
|
|
<view class="tag"><text>{{item.coupon.amount_text}}</text></view>
|
|
</view>
|
|
<view class="date-get">
|
|
<view class="title"><text>{{item.coupon.use_scope_text}}</text></view>
|
|
<view class="date"><text>{{item.coupon.use_start_time}}-{{item.coupon.use_end_time}}</text></view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
</view>
|
|
<view class="use-status" v-if="TabShow != 0">
|
|
<text v-if="TabShow === 1">已使用</text>
|
|
<text v-else-if="TabShow === 2">已过期</text>
|
|
</view>
|
|
|
|
</view>
|
|
</view>
|
|
<view class="empty" v-else>
|
|
<image src="../../static/image/not-order.png" mode="widthFix"></image>
|
|
<view class="emptyText">暂无数据</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {couponList} from '@/common/api.js'
|
|
export default {
|
|
|
|
data() {
|
|
return {
|
|
TabShow: 0,
|
|
|
|
list:[],
|
|
id:null,
|
|
};
|
|
},
|
|
methods:{
|
|
/**
|
|
* 优惠券tab点击
|
|
* @param {Number} type
|
|
*/
|
|
onCouponTab(index,type){
|
|
this.TabShow = index;
|
|
this.getList(type)
|
|
},
|
|
/**
|
|
* 去使用点击
|
|
*/
|
|
userMyCoupon(item){
|
|
// if(item.status!="used"){
|
|
uni.navigateTo({
|
|
url: '/pages/warehouse/weituo?coupon_id='+item.id+'&num='+item.amount+'&coupon=1&id='+this.id+"&enough="+item.enough
|
|
})
|
|
// }
|
|
|
|
},
|
|
getList(type){
|
|
couponList({type:type}).then(res=>{
|
|
this.list = res.data.data
|
|
})
|
|
},
|
|
},
|
|
onLoad(option){
|
|
this.id = option.id
|
|
this.getList('can_use')
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
@import 'MyCoupon.scss';
|
|
.empty{
|
|
margin-top:20%;
|
|
}
|
|
</style>
|
|
|