|
@@ -1,38 +1,54 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <view class="container">
|
|
|
|
|
|
|
+ <view class="container" :style="appThemeStyle">
|
|
|
<view v-if="list.length" class="coupon-list">
|
|
<view v-if="list.length" class="coupon-list">
|
|
|
<view class="coupon-item" v-for="(item, index) in list" :key="index">
|
|
<view class="coupon-item" v-for="(item, index) in list" :key="index">
|
|
|
- <view class="item-wrapper"
|
|
|
|
|
- :class="[ item.state.value ? 'color-' + color[index % color.length] : 'color-gray' ]">
|
|
|
|
|
- <view class="coupon-type">{{ CouponTypeEnum[item.coupon_type].name }}</view>
|
|
|
|
|
- <view class="tip dis-flex flex-dir-column flex-x-center">
|
|
|
|
|
- <view v-if="item.coupon_type == CouponTypeEnum.FULL_DISCOUNT.value">
|
|
|
|
|
- <text class="f-30">¥</text>
|
|
|
|
|
- <text class="money">{{ item.reduce_price }}</text>
|
|
|
|
|
|
|
+ <view class="item-wrapper" :class="[ !item.state.value ? 'disable' : '' ]">
|
|
|
|
|
+ <!-- 优惠券类型 (标签) -->
|
|
|
|
|
+ <view class="coupon-tag">
|
|
|
|
|
+ <text>{{ CouponTypeEnum[item.coupon_type].name }}</text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="coupon-left">
|
|
|
|
|
+ <!-- 优惠额度/折扣 -->
|
|
|
|
|
+ <view class="coupon-reduce">
|
|
|
|
|
+ <view class="coupon-reduce-unit"><text>¥</text></view>
|
|
|
|
|
+ <view class="coupon-reduce-amount">
|
|
|
|
|
+ <text class="value">{{ item.reduce_price }}</text>
|
|
|
|
|
+ </view>
|
|
|
</view>
|
|
</view>
|
|
|
- <text class="money" v-if="item.coupon_type == CouponTypeEnum.DISCOUNT.value">{{ item.discount }}折</text>
|
|
|
|
|
- <text class="pay-line">满{{ item.min_price }}元可用</text>
|
|
|
|
|
|
|
+ <!-- 最低消费金额 -->
|
|
|
|
|
+ <text class="coupon-hint">满{{ item.min_price }}元可用</text>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="split-line"></view>
|
|
|
|
|
- <view class="content dis-flex flex-dir-column flex-x-between">
|
|
|
|
|
- <view class="title oneline-hide">{{ item.name }}</view>
|
|
|
|
|
- <view class="bottom dis-flex flex-y-center">
|
|
|
|
|
- <view class="time flex-box">
|
|
|
|
|
- <text v-if="item.expire_type == 10">领取{{ item.expire_day }}天内有效</text>
|
|
|
|
|
- <text v-if="item.expire_type == 20">
|
|
|
|
|
|
|
+ <view class="coupon-content">
|
|
|
|
|
+ <view class="coupon-name">{{ item.name }}</view>
|
|
|
|
|
+ <view class="coupon-middle">
|
|
|
|
|
+ <view class="coupon-expire">
|
|
|
|
|
+ <text v-if="item.expire_type == CouponTypeEnum.FULL_DISCOUNT.value">领取后{{ item.expire_day }}天内有效</text>
|
|
|
|
|
+ <text v-if="item.expire_type == CouponTypeEnum.DISCOUNT.value">
|
|
|
<block v-if="item.start_time === item.end_time">{{ item.start_time }} 当天有效</block>
|
|
<block v-if="item.start_time === item.end_time">{{ item.start_time }} 当天有效</block>
|
|
|
<block v-else>{{ item.start_time }}~{{ item.end_time }}</block>
|
|
<block v-else>{{ item.start_time }}~{{ item.end_time }}</block>
|
|
|
</text>
|
|
</text>
|
|
|
</view>
|
|
</view>
|
|
|
- <view v-if="$checkModule('market-coupon') && item.state.value" class="receive" @click="receive(item.coupon_id)">
|
|
|
|
|
- <text>立即领取</text>
|
|
|
|
|
- </view>
|
|
|
|
|
- <view v-else class="receive state">
|
|
|
|
|
- <text>{{ item.state.text }}</text>
|
|
|
|
|
- </view>
|
|
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view v-if="item.describe" class="coupon-expand" @click="handleDescribe(index)">
|
|
|
|
|
+ <text>使用说明</text>
|
|
|
|
|
+ <text class="coupon-expand-arrow iconfont icon-arrow-down" :class="[item.expand ? 'expand' : '']" />
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view class="coupon-right">
|
|
|
|
|
+ <view v-if="$checkModule('market-coupon') && item.state.value" class="btn-receive" @click="handleReceive(item.coupon_id)">
|
|
|
|
|
+ <text>领取</text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <view v-if="!item.state.value" class="state-text">
|
|
|
|
|
+ <text>{{ item.state.text }}</text>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
+ <!-- 优惠券描述 -->
|
|
|
|
|
+ <view :class="[item.expand ? 'expand' : '']" class="coupon-expand-rules">
|
|
|
|
|
+ <view class="coupon-expand-rules-content">
|
|
|
|
|
+ <view class="pre">{{ item.describe }}</view>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<empty v-if="!list.length" :isLoading="isLoading" />
|
|
<empty v-if="!list.length" :isLoading="isLoading" />
|
|
@@ -45,8 +61,6 @@
|
|
|
import { CouponTypeEnum } from '@/common/enum/coupon'
|
|
import { CouponTypeEnum } from '@/common/enum/coupon'
|
|
|
import Empty from '@/components/empty'
|
|
import Empty from '@/components/empty'
|
|
|
|
|
|
|
|
- const color = ['red', 'blue', 'violet', 'yellow']
|
|
|
|
|
-
|
|
|
|
|
export default {
|
|
export default {
|
|
|
components: {
|
|
components: {
|
|
|
Empty
|
|
Empty
|
|
@@ -55,8 +69,6 @@
|
|
|
return {
|
|
return {
|
|
|
// 枚举类
|
|
// 枚举类
|
|
|
CouponTypeEnum,
|
|
CouponTypeEnum,
|
|
|
- // 颜色组
|
|
|
|
|
- color,
|
|
|
|
|
// 优惠券列表
|
|
// 优惠券列表
|
|
|
list: [],
|
|
list: [],
|
|
|
// 正在加载中
|
|
// 正在加载中
|
|
@@ -82,14 +94,12 @@
|
|
|
const app = this
|
|
const app = this
|
|
|
app.isLoading = true
|
|
app.isLoading = true
|
|
|
CouponApi.list({}, { load })
|
|
CouponApi.list({}, { load })
|
|
|
- .then(result => {
|
|
|
|
|
- app.list = result.data.list
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ .then(result => app.list = result.data.list)
|
|
|
.finally(() => app.isLoading = false)
|
|
.finally(() => app.isLoading = false)
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
// 立即领取
|
|
// 立即领取
|
|
|
- receive(couponId) {
|
|
|
|
|
|
|
+ handleReceive(couponId) {
|
|
|
const app = this
|
|
const app = this
|
|
|
MyCouponApi.receive(couponId)
|
|
MyCouponApi.receive(couponId)
|
|
|
.then(result => {
|
|
.then(result => {
|
|
@@ -98,6 +108,11 @@
|
|
|
// 刷新优惠券列表
|
|
// 刷新优惠券列表
|
|
|
app.getCouponList(false)
|
|
app.getCouponList(false)
|
|
|
})
|
|
})
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ // 展开优惠券描述
|
|
|
|
|
+ handleDescribe(index) {
|
|
|
|
|
+ this.list[index].expand = !this.list[index].expand
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -109,143 +124,186 @@
|
|
|
padding: 20rpx;
|
|
padding: 20rpx;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
.coupon-item {
|
|
.coupon-item {
|
|
|
- position: relative;
|
|
|
|
|
- overflow: hidden;
|
|
|
|
|
margin-bottom: 22rpx;
|
|
margin-bottom: 22rpx;
|
|
|
|
|
+ font-size: 24rpx;
|
|
|
|
|
+ background: #fff;
|
|
|
|
|
+ // min-height: 178rpx;
|
|
|
|
|
+ border-radius: 12rpx;
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ box-shadow: 0 16rpx 80rpx 0 rgba(0, 0, 0, .04);
|
|
|
|
|
+ position: relative;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.item-wrapper {
|
|
.item-wrapper {
|
|
|
- width: 100%;
|
|
|
|
|
display: flex;
|
|
display: flex;
|
|
|
- background: #fff;
|
|
|
|
|
- border-radius: 8rpx;
|
|
|
|
|
- color: #fff;
|
|
|
|
|
- height: 180rpx;
|
|
|
|
|
-
|
|
|
|
|
- .coupon-type {
|
|
|
|
|
- position: absolute;
|
|
|
|
|
- top: 0;
|
|
|
|
|
- right: 0;
|
|
|
|
|
- z-index: 10;
|
|
|
|
|
- width: 128rpx;
|
|
|
|
|
- padding: 3px 0;
|
|
|
|
|
- background: #a771ff;
|
|
|
|
|
- font-size: 20rpx;
|
|
|
|
|
- text-align: center;
|
|
|
|
|
- color: #ffffff;
|
|
|
|
|
- transform: rotate(45deg);
|
|
|
|
|
- transform-origin: 64rpx 64rpx;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
|
|
|
- &.color-blue {
|
|
|
|
|
- background: linear-gradient(-125deg, #57bdbf, #2f9de2);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ &.disable {
|
|
|
|
|
+ .coupon-tag {
|
|
|
|
|
+ background: linear-gradient(-113deg, #bdbdbd, #a2a1a2);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .coupon-reduce {
|
|
|
|
|
+ color: #757575;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- &.color-red {
|
|
|
|
|
- background: linear-gradient(-128deg, #ff6d6d, #ff3636);
|
|
|
|
|
|
|
+ .state-text {
|
|
|
|
|
+ color: #757575;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .coupon-tag {
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ left: 0;
|
|
|
|
|
+ top: 0;
|
|
|
|
|
+ color: #fff;
|
|
|
|
|
+ width: 96rpx;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ font-size: 22rpx;
|
|
|
|
|
+ border-radius: 12rpx 0 12rpx 0;
|
|
|
|
|
+ font-weight: 500;
|
|
|
|
|
+ height: 34rpx;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ background: linear-gradient(to right, $main-bg, $main-bg2);
|
|
|
|
|
+ color: $main-text;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .coupon-left {
|
|
|
|
|
+ width: 242rpx;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-flow: column;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ position: relative;
|
|
|
|
|
|
|
|
- &.color-violet {
|
|
|
|
|
- background: linear-gradient(-113deg, #ef86ff, #b66ff5);
|
|
|
|
|
|
|
+ .coupon-reduce {
|
|
|
|
|
+ color: $main-bg;
|
|
|
|
|
|
|
|
- .coupon-type {
|
|
|
|
|
- background: #55b5ff;
|
|
|
|
|
|
|
+ &-unit {
|
|
|
|
|
+ display: inline-block;
|
|
|
|
|
+ margin-right: -4rpx;
|
|
|
|
|
+ font-size: 32rpx;
|
|
|
|
|
+ font-weight: 600;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ &-amount {
|
|
|
|
|
+ display: inline-block;
|
|
|
|
|
+
|
|
|
|
|
+ .value {
|
|
|
|
|
+ font-size: 48rpx;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- &.color-yellow {
|
|
|
|
|
- background: linear-gradient(-141deg, #f7d059, #fdb054);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- &.color-gray {
|
|
|
|
|
- background: linear-gradient(-113deg, #bdbdbd, #a2a1a2);
|
|
|
|
|
|
|
+ .coupon-hint {
|
|
|
|
|
+ margin-top: 16rpx;
|
|
|
|
|
+ color: #757575;
|
|
|
|
|
+ font-size: 24rpx;
|
|
|
|
|
+ white-space: nowrap;
|
|
|
|
|
+ text-overflow: ellipsis;
|
|
|
|
|
+ overflow: hidden;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- .coupon-type {
|
|
|
|
|
- background: #9e9e9e;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ .coupon-content {
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ padding: 32rpx 0;
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-direction: column;
|
|
|
|
|
+ flex-wrap: nowrap;
|
|
|
|
|
+ align-items: flex-start;
|
|
|
|
|
+ justify-content: space-between;
|
|
|
|
|
+
|
|
|
|
|
+ .coupon-name {
|
|
|
|
|
+ color: #212121;
|
|
|
|
|
+ font-size: 28rpx;
|
|
|
|
|
+ font-weight: 500;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- .content {
|
|
|
|
|
|
|
+ .coupon-middle {
|
|
|
flex: 1;
|
|
flex: 1;
|
|
|
- padding: 30rpx 20rpx;
|
|
|
|
|
- border-radius: 8px 0 0 8px;
|
|
|
|
|
|
|
+ padding-top: 12rpx;
|
|
|
|
|
+ margin-bottom: 26rpx;
|
|
|
|
|
|
|
|
- .title {
|
|
|
|
|
- width: 400rpx;
|
|
|
|
|
- font-size: 32rpx;
|
|
|
|
|
|
|
+ .coupon-expire {
|
|
|
|
|
+ color: #757575;
|
|
|
|
|
+ font-size: 24rpx;
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- .bottom {
|
|
|
|
|
- .time {
|
|
|
|
|
- font-size: 24rpx;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- .receive {
|
|
|
|
|
- height: 46rpx;
|
|
|
|
|
- width: 122rpx;
|
|
|
|
|
- border: 1px solid #fff;
|
|
|
|
|
- border-radius: 30rpx;
|
|
|
|
|
- color: #fff;
|
|
|
|
|
- font-size: 24rpx;
|
|
|
|
|
- display: flex;
|
|
|
|
|
- justify-content: center;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
-
|
|
|
|
|
- &.state {
|
|
|
|
|
- border: none;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ .coupon-expand {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ color: #9e9e9e;
|
|
|
|
|
+ font-size: 24rpx;
|
|
|
|
|
+
|
|
|
|
|
+ &-arrow {
|
|
|
|
|
+ margin-top: 4rpx;
|
|
|
|
|
+ font-size: 24rpx;
|
|
|
|
|
+ display: inline-block;
|
|
|
|
|
+ vertical-align: initial;
|
|
|
|
|
+ transform: rotate(0);
|
|
|
|
|
+ margin-left: 8rpx;
|
|
|
|
|
+ transition: all .15s ease-in-out;
|
|
|
|
|
+
|
|
|
|
|
+ &.expand {
|
|
|
|
|
+ transform: rotate(180deg);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- .tip {
|
|
|
|
|
- position: relative;
|
|
|
|
|
- flex: 0 0 32%;
|
|
|
|
|
- text-align: center;
|
|
|
|
|
- border-radius: 0 8px 8px 0;
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- .money {
|
|
|
|
|
- font-weight: bold;
|
|
|
|
|
- font-size: 52rpx;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ .coupon-right {
|
|
|
|
|
+ padding-right: 38rpx;
|
|
|
|
|
|
|
|
- .pay-line {
|
|
|
|
|
- font-size: 22rpx;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ .btn-receive,
|
|
|
|
|
+ .state-text {
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ width: 100rpx;
|
|
|
|
|
+ padding: 15rpx 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- .split-line {
|
|
|
|
|
- position: relative;
|
|
|
|
|
- flex: 0 0 0;
|
|
|
|
|
- border-left: 4rpx solid #fff;
|
|
|
|
|
- margin: 0 5px 0 3px;
|
|
|
|
|
- background: #fff;
|
|
|
|
|
-
|
|
|
|
|
- &:before,
|
|
|
|
|
- {
|
|
|
|
|
- border-radius: 0 0 16rpx 16rpx;
|
|
|
|
|
- top: 0;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ .btn-receive {
|
|
|
|
|
+ font-size: 23rpx;
|
|
|
|
|
+ line-height: 1;
|
|
|
|
|
+ font-weight: 500;
|
|
|
|
|
+ border-radius: 8rpx;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ background: linear-gradient(to right, $main-bg, $main-bg2);
|
|
|
|
|
+ color: $main-text;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- &:after {
|
|
|
|
|
- border-radius: 16rpx 16rpx 0 0;
|
|
|
|
|
- bottom: 0;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ .state-text {}
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- &:before,
|
|
|
|
|
- &:after {
|
|
|
|
|
- content: '';
|
|
|
|
|
- position: absolute;
|
|
|
|
|
- width: 24rpx;
|
|
|
|
|
- height: 12rpx;
|
|
|
|
|
- background: #f7f7f7;
|
|
|
|
|
- left: -14rpx;
|
|
|
|
|
- z-index: 1;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ .coupon-expand-rules {
|
|
|
|
|
+ display: none;
|
|
|
|
|
+ position: relative;
|
|
|
|
|
|
|
|
|
|
+ &.expand {
|
|
|
|
|
+ top: -30rpx;
|
|
|
|
|
+ display: block;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ &-content {
|
|
|
|
|
+ padding: 8rpx 30rpx 8rpx 242rpx;
|
|
|
|
|
+ font-weight: 400;
|
|
|
|
|
+ color: #9e9e9e;
|
|
|
|
|
+ line-height: 36rpx;
|
|
|
|
|
+
|
|
|
|
|
+ .pre {
|
|
|
|
|
+ font-family: auto;
|
|
|
|
|
+ white-space: pre-wrap;
|
|
|
|
|
+ word-wrap: break-word;
|
|
|
|
|
+ word-break: break-all;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-</style>
|
|
|
|
|
|
|
+</style>
|