2020-08-13 08:12:57 +00:00
|
|
|
<template>
|
|
|
|
<view>
|
|
|
|
<view class='coupon-list' v-if="couponsList.length">
|
|
|
|
<view class='item acea-row row-center-wrapper' v-for='(item,index) in couponsList' :key="index">
|
2021-01-19 02:16:45 +00:00
|
|
|
<view class='money' :class="item.validStr==='unusable'||item.validStr==='overdue'||item.validStr==='notStart' ? 'moneyGray' : ''">
|
2020-08-13 08:12:57 +00:00
|
|
|
<view>¥<text class='num'>{{item.money}}</text></view>
|
|
|
|
<view class="pic-num">满{{ item.minPrice }}元可用</view>
|
|
|
|
</view>
|
|
|
|
<view class='text'>
|
2021-01-19 02:16:45 +00:00
|
|
|
<view class='condition line2'>
|
|
|
|
<span class="line-title" :class="item.validStr==='unusable'||item.validStr==='overdue'||item.validStr==='notStart' ? 'bg-color-huic' : 'bg-color-check'" v-if="item.useType === 1">通用</span>
|
|
|
|
<span class="line-title" :class="item.validStr==='unusable'||item.validStr==='overdue'||item.validStr==='notStart' ? 'bg-color-huic' : 'bg-color-check'" v-else-if="item.useType === 2">商品</span>
|
|
|
|
<span class="line-title" :class="item.validStr==='unusable'||item.validStr==='overdue'||item.validStr==='notStart' ? 'bg-color-huic' : 'bg-color-check'" v-else-if="item.useType === 3">品类</span>
|
|
|
|
<span>{{item.name}}</span>
|
2020-08-13 08:12:57 +00:00
|
|
|
</view>
|
|
|
|
<view class='data acea-row row-between-wrapper'>
|
2021-01-19 02:16:45 +00:00
|
|
|
<view>{{item.useStartTimeStr}}~{{item.useEndTimeStr}}</view>
|
|
|
|
<view class='bnt' :class="item.validStr==='unusable'||item.validStr==='overdue'||item.validStr==='notStart'?'gray':'bg-color'">{{item.validStr | validStrFilter}}</view>
|
2020-08-13 08:12:57 +00:00
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class='noCommodity' v-if="!couponsList.length && loading==true">
|
|
|
|
<view class='pictrue'>
|
|
|
|
<image src='../../../static/images/noCoupon.png'></image>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<!-- #ifdef MP -->
|
|
|
|
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
|
|
|
|
<!-- #endif -->
|
|
|
|
<home></home>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import {
|
|
|
|
getUserCoupons
|
|
|
|
} from '@/api/api.js';
|
|
|
|
import {
|
|
|
|
toLogin
|
|
|
|
} from '@/libs/login.js';
|
|
|
|
import {
|
|
|
|
mapGetters
|
|
|
|
} from "vuex";
|
|
|
|
// #ifdef MP
|
|
|
|
import authorize from '@/components/Authorize';
|
|
|
|
// #endif
|
|
|
|
import home from '@/components/home';
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
// #ifdef MP
|
|
|
|
authorize,
|
|
|
|
// #endif
|
|
|
|
home
|
|
|
|
},
|
2021-01-19 02:16:45 +00:00
|
|
|
filters: {
|
|
|
|
validStrFilter(status) {
|
|
|
|
const statusMap = {
|
|
|
|
'usable': '可用',
|
|
|
|
'unusable': '已用',
|
|
|
|
'overdue': '过期',
|
|
|
|
'notStart': '未开始'
|
|
|
|
}
|
|
|
|
return statusMap[status]
|
|
|
|
}
|
|
|
|
},
|
2020-08-13 08:12:57 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
couponsList: [],
|
|
|
|
loading: false,
|
|
|
|
isAuto: false, //没有授权的不会自动授权
|
|
|
|
isShowAuth: false //是否隐藏授权
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: mapGetters(['isLogin']),
|
|
|
|
onLoad() {
|
|
|
|
if (this.isLogin) {
|
|
|
|
this.getUseCoupons();
|
|
|
|
} else {
|
|
|
|
// #ifdef H5 || APP-PLUS
|
|
|
|
toLogin();
|
|
|
|
// #endif
|
|
|
|
// #ifdef MP
|
|
|
|
this.isAuto = true;
|
|
|
|
this.$set(this, 'isShowAuth', true)
|
|
|
|
// #endif
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
/**
|
|
|
|
* 授权回调
|
|
|
|
*/
|
|
|
|
onLoadFun: function() {
|
|
|
|
this.getUseCoupons();
|
|
|
|
},
|
|
|
|
// 授权关闭
|
|
|
|
authColse: function(e) {
|
|
|
|
this.isShowAuth = e
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 获取领取优惠券列表
|
|
|
|
*/
|
|
|
|
getUseCoupons: function() {
|
|
|
|
let that = this;
|
|
|
|
getUserCoupons({status:0}).then(res => {
|
|
|
|
that.loading = true;
|
2020-12-23 07:56:45 +00:00
|
|
|
that.$set(that, 'couponsList', res.data || []);
|
2020-08-13 08:12:57 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.money {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.pic-num {
|
|
|
|
color: #ffffff;
|
2021-01-19 02:16:45 +00:00
|
|
|
font-size: 24rpx;
|
|
|
|
}
|
|
|
|
.coupon-list .item .text{
|
|
|
|
height: 100%;
|
2020-08-13 08:12:57 +00:00
|
|
|
}
|
|
|
|
.coupon-list .item .text .condition{
|
2021-01-19 02:16:45 +00:00
|
|
|
/* display: flex;
|
|
|
|
align-items: center; */
|
2020-08-13 08:12:57 +00:00
|
|
|
}
|
|
|
|
.condition .line-title {
|
2021-01-19 02:16:45 +00:00
|
|
|
width: 90rpx;
|
2020-08-13 08:12:57 +00:00
|
|
|
height: 40rpx !important;
|
2020-12-23 07:56:45 +00:00
|
|
|
line-height: 40rpx !important;
|
2021-01-19 02:16:45 +00:00
|
|
|
padding: 2rpx 10rpx;
|
2020-08-13 08:12:57 +00:00
|
|
|
-webkit-box-sizing: border-box;
|
|
|
|
box-sizing: border-box;
|
|
|
|
background: rgba(255, 247, 247, 1);
|
|
|
|
border: 1px solid rgba(232, 51, 35, 1);
|
|
|
|
opacity: 1;
|
2021-01-19 02:16:45 +00:00
|
|
|
border-radius: 20rpx;
|
|
|
|
font-size: 18rpx !important;
|
2020-08-13 08:12:57 +00:00
|
|
|
color: #e83323;
|
|
|
|
margin-right: 12rpx;
|
|
|
|
}
|
|
|
|
</style>
|