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.
hezhiying/pages/MyCoupon/MyCoupon.vue

99 lines
2.4 KiB

1 year ago
<template>
<view class="page">
<!-- 优惠券tab -->
<view class="coupon-tab">
1 year ago
<view class="tab" :class="{'action':TabShow===0}" @click="onCouponTab(0,'can_use')">
1 year ago
<text>未使用</text>
<text class="line"></text>
</view>
1 year ago
<view class="tab" :class="{'action':TabShow===1}" @click="onCouponTab(1,'used')">
1 year ago
<text>已使用</text>
<text class="line"></text>
</view>
1 year ago
<view class="tab" :class="{'action':TabShow===2}" @click="onCouponTab(2,'expired')">
1 year ago
<text>已过期</text>
<text class="line"></text>
</view>
</view>
<!-- 优惠券列表 -->
<view class="coupon-list">
1 year ago
<view class="list" v-for="(item,index) in list" :key="index">
1 year ago
<view class="list-data" :class="{'coupon-lose':TabShow!=0}">
<view class="coupon-price">
<view class="discounts">
<text class="min"></text>
1 year ago
<text class="max">{{item.coupon.amount}}</text>
1 year ago
</view>
1 year ago
<view class="full-reduction"><text>{{item.coupon.type_text}}</text></view>
<!-- <view class="jag"></view> -->
1 year ago
</view>
<view class="coupon-info">
<view class="info-title">
1 year ago
<view class="tag"><text>{{item.coupon.amount_text}}</text></view>
1 year ago
</view>
<view class="date-get">
1 year ago
<view class="title"><text>{{item.coupon.use_scope_text}}</text></view>
<view class="date"><text>{{item.coupon.get_start_time}}-{{item.coupon.get_end_time}}</text></view>
1 year ago
</view>
1 year ago
1 year ago
</view>
</view>
<view class="use-status" v-if="TabShow != 0">
<text v-if="TabShow === 1">已使用</text>
<text v-else-if="TabShow === 2">已过期</text>
</view>
1 year ago
1 year ago
</view>
</view>
1 year ago
<view class="empty">
<image src="../../static/image/not-order.png" mode="widthFix"></image>
<view class="emptyText">暂无数据</view>
</view>
1 year ago
</view>
</template>
<script>
1 year ago
import {couponList} from '@/common/api.js'
1 year ago
export default {
1 year ago
1 year ago
data() {
return {
TabShow: 0,
1 year ago
list:[]
1 year ago
};
},
methods:{
/**
* 优惠券tab点击
* @param {Number} type
*/
1 year ago
onCouponTab(index,type){
this.TabShow = index;
this.getList(type)
1 year ago
},
/**
* 去使用点击
*/
onCouponUse(){
uni.navigateTo({
url: '/pages/SearchGoodsList/SearchGoodsList'
})
1 year ago
},
getList(type){
couponList({type:type}).then(res=>{
this.list = res.data.data
})
},
},
onLoad(){
this.getList('can_use')
},
1 year ago
};
</script>
<style scoped lang="scss">
@import 'MyCoupon.scss';
</style>