<template>
|
<view>
|
<view class='coupon-list-window' :class='coupon.show==true?"on":""'>
|
<view class="occupy" v-if="!orderShow"></view>
|
<view class='title'>优惠券<text class='iconfont icon-guanbi' @click='close'></text></view>
|
<view v-if="!orderShow" class="nav acea-row row-around">
|
<view :class="['acea-row', 'row-middle', type === 1 ? 'on' : '']" @click="setType(1)">通用券</view>
|
<view :class="['acea-row', 'row-middle', type === 2 ? 'on' : '']" @click="setType(2)">商品券</view>
|
<view :class="['acea-row', 'row-middle', type === 3 ? 'on' : '']" @click="setType(3)">品类券</view>
|
</view>
|
<view class='coupon-list' v-if="coupon.list.length" :style="{'margin-top':(orderShow?'0':'50rpx')}">
|
<view class='item acea-row row-center-wrapper' v-for='(item,index) in coupon.list' :key="index"
|
@click="getCouponUser(index,item.id)">
|
<view class='money'
|
:class="item.validStr==='unusable'||item.validStr==='overdue'||item.validStr==='notStart' ? 'moneyGray' : ''">
|
<view v-if="item.displayDiscount"><text class='num isDis' >{{ item.displayDiscount.split(',')[0] }}</text><text style="font-size: 30rpx;">{{ item.displayDiscount.split(',').length>1?item.displayDiscount.split(',')[1]:'' }}</text></view>
|
<view v-else-if="item.moneyType==2"><text class='num iszk'>{{ item.money?(Number(item.money)*10):'' }}</text></view>
|
<view v-else><text class='num' >{{ item.money?Number(item.money):'' }}</text></view>
|
<view class="pic-num" v-if="item.displayDiscount">{{item.displayDiscount.split(',').length>2?item.displayDiscount.split(',')[2]:''}}</view>
|
<view class="pic-num" v-else>满{{ item.minPrice?Number(item.minPrice):'' }}元可用</view>
|
<span class='corner tp rt'></span>
|
<span class='corner bm rt'></span>
|
</view>
|
<view class='text'
|
:class="item.validStr==='unusable'||item.validStr==='overdue'||item.validStr==='notStart' ? 'textGray' : ''">
|
<view class='condition line2'>
|
<span class="line-title"
|
:class="item.validStr==='unusable'||item.validStr==='overdue'||item.validStr==='notStart' ? 'gray' : 'bg-color-check'"
|
v-if="item.useType === 1">通用</span>
|
<span class="line-title"
|
:class="item.validStr==='unusable'||item.validStr==='overdue'||item.validStr==='notStart' ? 'gray' : 'bg-color-check'"
|
v-else-if="item.useType === 2">商品</span>
|
<span class="line-title"
|
:class="item.validStr==='unusable'||item.validStr==='overdue'||item.validStr==='notStart' ? 'gray' : 'bg-color-check'"
|
v-else-if="item.useType === 3">品类</span>
|
<span class="name">{{item.name}}</span>
|
</view>
|
<view class='data acea-row row-between-wrapper'>
|
<view>
|
<view v-if="item.useStartTimeStr">{{item.useStartTimeStr}}</view>
|
<view v-if="item.useEndTimeStr">至{{item.useEndTimeStr}}</view>
|
</view>
|
<view class='bnt bg-blue' v-if="selectCouponId==item.id">取消使用</view>
|
<view class='bnt bg-blue' v-else>立即使用</view>
|
<!-- <view class='bnt' :class="item.validStr==='unusable'||item.validStr==='overdue'||item.validStr==='notStart'?'gray':'bg-blue'">{{item.validStr | validStrFilter}}</view> -->
|
</view>
|
<span class='corner tp lt'></span>
|
<span class='corner bm lt'></span>
|
</view>
|
<image class="checkedIcon" v-if="selectCouponId==item.id" src='https://ossacmall.bluedeer.com.cn/app/static/images/i_checked.png'></image>
|
</view>
|
</view>
|
<view class='noCommodity' v-if="coupon.list.length<=0">
|
<view class='pictrue'>
|
<image src='https://ossacmall.bluedeer.com.cn/app/static/images/noCoupon.png'></image>
|
</view>
|
</view>
|
<!-- <view class="occupy" v-if="!orderShow"></view> -->
|
<!-- <view class='title'>优惠券<text class='iconfont icon-guanbi' @click='close'></text></view> -->
|
<!-- <view class='coupon-list' :style="{'margin-top':!orderShow?'0':'50rpx'}">
|
<block v-if="coupon.list.length">
|
<view class='item acea-row row-center-wrapper' v-for="(item,index) in coupon.list"
|
@click="getCouponUser(index,item.id)" :key='index'>
|
<view class='money acea-row row-column row-center-wrapper' :class='item.isUse?"moneyGray":""'>
|
<view>¥<text class='num'>{{item.money?Number(item.money):''}}</text></view>
|
<view class="pic-num">满{{item.minPrice}}元可用</view>
|
</view>
|
<view class='text'>
|
<view class='condition line2'>
|
<span class='line-title' :class='item.isUse?"gray":""' v-if='item.useType===1'>通用</span>
|
<span class='line-title' :class='item.isUse?"gray":""'
|
v-else-if='item.useType===3'>品类</span>
|
<span class='line-title' :class='item.isUse?"gray":""' v-else>商品</span>
|
<span>{{item.name}}</span>
|
</view>
|
<view class='data acea-row row-between-wrapper'>
|
<view v-if="item.day>0">领取后{{item.day}}天内可用</view>
|
<view v-else>
|
{{ item.useStartTimeStr&& item.useEndTimeStr ? item.useStartTimeStr + " - " + item.useEndTimeStr : ""}}
|
</view>
|
<view class='bnt gray' v-if="item.isUse">{{item.use_title || '已领取'}}</view>
|
<view class='bnt bg-color' v-else>{{coupon.statusTile || '立即领取'}}</view>
|
</view>
|
</view>
|
</view>
|
</block>
|
<view class='pictrue' v-else>
|
<image src='https://ossacmall.bluedeer.com.cn/app/static/images/noCoupon.png'></image>
|
</view>
|
</view>
|
-->
|
</view>
|
<view class='mask' catchtouchmove="true" :hidden='coupon.show==false' @click='close'></view>
|
</view>
|
</template>
|
|
<script>
|
import {
|
setCouponReceive
|
} from '@/api/api.js';
|
export default {
|
props: {
|
//打开状态 0=领取优惠券,1=使用优惠券
|
openType: {
|
type: Number,
|
default: 0,
|
},
|
coupon: {
|
type: Object,
|
default: function() {
|
return {};
|
}
|
},
|
type: {
|
type: Number
|
},
|
selectCouponId:{
|
type:Number
|
},
|
//下单页面使用优惠券组件不展示tab切换页
|
orderShow: {
|
type: String,
|
default: function() {
|
return '';
|
}
|
}
|
},
|
data() {
|
return {};
|
},
|
|
methods: {
|
close: function() {
|
this.$emit('ChangCouponsClone');
|
},
|
getCouponUser: function(index, id) {
|
let that = this;
|
let list = that.coupon.list;
|
//if (list[index].isUse == true && this.openType == 0) return true;
|
switch (this.openType) {
|
case 0:
|
//领取优惠券
|
let ids = [];
|
ids.push(id);
|
if(list[index].isUse == true){
|
if(that.selectCouponId==list[index].id){
|
that.$emit('ChangCoupons', list[index]);
|
}else{
|
that.$emit('ChangCoupons', list[index],true);
|
}
|
}else{
|
setCouponReceive(id).then(res => {
|
that.addTrack('yy_getCoupon', {
|
'couponName_var':list[index].name,
|
'couponId_var':id
|
});
|
|
that.$emit('ChangCouponsUseState', index);
|
that.$util.Tips({
|
title: "领取成功"
|
});
|
that.$emit('ChangCoupons', list[index]);
|
})
|
}
|
break;
|
case 1:
|
that.$emit('ChangCoupons', list[index]);
|
break;
|
}
|
},
|
setType: function(type) {
|
this.$emit('tabCouponType', type);
|
}
|
}
|
}
|
</script>
|
|
<style scoped lang="scss">
|
.coupon-list-window {
|
position: fixed;
|
bottom: 0;
|
left: 0;
|
width: 100%;
|
background-color: #f5f5f5;
|
border-radius: 16rpx 16rpx 0 0;
|
z-index: 555;
|
transform: translate3d(0, 100%, 0);
|
transition: all .3s cubic-bezier(.25, .5, .5, .9);
|
}
|
|
.coupon-list-window.on {
|
transform: translate3d(0, 0, 0);
|
}
|
|
.coupon-list-window .title {
|
height: 124rpx;
|
width: 100%;
|
text-align: center;
|
line-height: 124rpx;
|
font-size: 32rpx;
|
font-weight: bold;
|
position: relative;
|
}
|
|
.coupon-list-window .title .iconfont {
|
position: absolute;
|
right: 30rpx;
|
top: 50%;
|
transform: translateY(-50%);
|
font-size: 35rpx;
|
color: #8a8a8a;
|
font-weight: normal;
|
}
|
|
.coupon-list-window .coupon-list {
|
margin: 0 0 30rpx 0;
|
height: 823rpx;
|
overflow: auto;
|
padding-top: 30rpx;
|
}
|
|
.money {
|
display: flex;
|
flex-direction: column;
|
justify-content: center;
|
background: #FFE20E !important;
|
border-radius: 14rpx;
|
color: #000000 !important;
|
border-right: 4rpx dashed #FFFFFF;
|
position: relative;
|
width: 260rpx !important;
|
|
&.moneyGray {
|
background: #DDDDDD !important;
|
color: #6f6f6f !important;
|
}
|
|
.num {
|
position: relative;
|
|
&::before {
|
content: '¥';
|
position: absolute;
|
left: -22rpx;
|
top: 8rpx;
|
font-size: 26rpx;
|
// height: 30rpx;
|
// width: 30rpx;
|
}
|
}
|
.isDis{
|
&::before{
|
display: none;
|
}
|
&::after{
|
display:none;
|
}
|
}
|
.iszk{
|
padding-right: 30rpx;
|
&::before{
|
display: none;
|
}
|
&::after {
|
content: '折';
|
position: absolute;
|
right: 0;
|
bottom: 7px;
|
font-size: 30rpx;
|
// height: 30rpx;
|
// width: 30rpx;
|
}
|
}
|
}
|
|
.pic-num {
|
// color: #ffffff;
|
font-size: 24rpx;
|
}
|
|
.coupon-list {
|
margin-top: 128rpx;
|
|
.corner {
|
position: absolute;
|
width: 30rpx;
|
height: 30rpx;
|
background-color: #f5f5f5;
|
border-radius: 50%;
|
|
&.rt {
|
right: -15rpx;
|
}
|
|
&.tp {
|
top: -15rpx;
|
}
|
|
&.bm {
|
bottom: -15rpx;
|
}
|
|
&.lt {
|
left: -15rpx;
|
}
|
}
|
|
.item {
|
margin-bottom: 30rpx;
|
position: relative;
|
}
|
}
|
|
.coupon-list .item .text {
|
height: 100%;
|
background-color: #FFE20E;
|
border-radius: 14rpx;
|
position: relative;
|
width: 426rpx !important;
|
|
&.textGray {
|
background-color: #DDDDDD !important;
|
|
.gray {
|
background-color: #F5F5F5 !important;
|
color: #979797 !important;
|
}
|
|
.data,
|
.condition {
|
color: #6f6f6f !important;
|
}
|
}
|
|
.data {
|
padding-bottom: 16rpx;
|
color: #000000;
|
font-size: 22rpx;
|
}
|
|
.bnt {
|
// width: 158rpx;
|
height: 60rpx;
|
border-radius: 8rpx;
|
line-height: 60rpx;
|
text-align: center;
|
|
&.bg-blue {
|
background-color: #016DCC;
|
}
|
}
|
}
|
|
.coupon-list .item .text .condition {
|
/* display: flex;
|
align-items: center; */
|
}
|
|
.condition .name {
|
font-weight: bold;
|
}
|
|
.condition .line-title {
|
width: 90rpx;
|
height: 40rpx !important;
|
line-height: 40rpx !important;
|
padding: 4rpx 12rpx;
|
-webkit-box-sizing: border-box;
|
box-sizing: border-box;
|
background: rgba(4, 199, 99, 1);
|
// border: 1px solid rgba(232, 51, 35, 1);
|
opacity: 1;
|
border:none;
|
border-radius: 20rpx;
|
font-size: 24rpx !important;
|
color: #FFFFFF;
|
margin-right: 12rpx;
|
}
|
|
.noCommodity {
|
margin-top: 300rpx;
|
}
|
|
// .coupon-list-window .pictrue {
|
// width: 414rpx;
|
// height: 336rpx;
|
// margin: 208rpx auto;
|
// }
|
|
// .coupon-list-window .pictrue image {
|
// width: 100%;
|
// height: 100%;
|
// }
|
|
// .pic-num {
|
// color: #fff;
|
// font-size: 24rpx;
|
// }
|
|
|
|
.nav {
|
// position: absolute;
|
// top: 0;
|
// left: 0;
|
width: 100%;
|
height: 96rpx;
|
border-bottom: 2rpx solid #F5F5F5;
|
border-top-left-radius: 16rpx;
|
border-top-right-radius: 16rpx;
|
background-color: #FFFFFF;
|
font-size: 30rpx;
|
color: #999999;
|
}
|
|
.nav .acea-row {
|
color: #999999
|
}
|
|
.nav .acea-row.on {
|
color: #000;
|
position: relative;
|
|
&::after {
|
content: '';
|
position: absolute;
|
width: 60rpx;
|
height: 44rpx;
|
bottom: 12rpx;
|
clip-path: circle(50% at 50% 100%);
|
border: 6rpx solid #FFE20E;
|
border-radius: 50%;
|
}
|
}
|
.checkedIcon{
|
width: 32rpx;
|
height: 32rpx;
|
position: absolute;
|
right: 18rpx;
|
top: 18rpx;
|
}
|
// .nav .acea-row:only-child {
|
// border-bottom-color: transparent;
|
// }
|
|
// .occupy {
|
// height: 106rpx;
|
// }
|
|
// .coupon-list .item {
|
// margin-bottom: 20rpx;
|
// box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.06);
|
// }
|
|
// .coupon-list .item .money {
|
// font-weight: normal;
|
// }
|
</style>
|