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.
yanzong_qianduan/pages/news/coupon/index.vue

283 lines
6.0 KiB

11 months ago
<template>
<view class="coupon">
9 months ago
<view class="rule" @click="openPage()">规则</view>
<view class="coupon-hd">
10 months ago
<image src="https://www.royaum.com.cn/static/news/coupon-bg.jpg"></image>
</view>
<view class="coupon-tab">
<view class="item" :class="tabIndex == 0?'item-on':''" @click="tabItem(0)">商品券</view>
<view class="item" :class="tabIndex == 1?'item-on':''" @click="tabItem(1)">服务券</view>
</view>
<view class="coupon-bd">
11 months ago
<view class="item" v-for="(item,index) in couponList" :key="index">
9 months ago
<view class="a" v-if="item.coupon_type==10"><text>{{ item.reduce_price?Number(item.reduce_price):''}}</text></view>
11 months ago
<view class="a" v-if="item.coupon_type==20"><text>{{item.discount}}</text></view>
9 months ago
<view class="b">{{item.min_price? Number(item.min_price):''}}元使用</view>
11 months ago
<view class="c">
<text v-if="item.apply_range==10">适用于全场商品</text>
<text v-if="item.apply_range==20">适用于部分商品</text>
</view>
9 months ago
<view class="d" @click="toUse(item)" v-if="item.state.value==0">去使用</view>
<view class="d" @click="receive(item)" v-else>点击领取</view>
<image :src="$picUrl+'/static/news/icon-coupon-01.png?t=2'"></image>
<view class="f" v-if="item.start_time&&item.end_time">有效期:{{item.start_time}}-{{item.end_time}}</view>
</view>
</view>
11 months ago
<view class="nolist" v-if="couponList.length==0">
<image :src="$picUrl+'/static/news/icon-coupon-03.png'"></image>
<view class="txt">暂无已使用优惠券</view>
</view>
11 months ago
<view class="footer" @click="goMyCoupon">
查看我的优惠券
<u-icon name="arrow-right" class="fooIcon"></u-icon>
</view>
</view>
</template>
<script>
import * as CouponApi from '@/api/coupon'
export default {
data() {
return {
11 months ago
tabIndex: 0,
couponList: []
}
},
onShow() {
this.getCoupon(this.tabIndex)
},
methods: {
11 months ago
getCoupon(index) {
const that = this
if (index == 0) {
CouponApi.list()
.then(res => {
that.couponList = res.data.list
})
.finally(() => that.isLoading = false)
} else {
CouponApi.serveList()
.then(res => {
that.couponList = res.data.list
})
.finally(() => that.isLoading = false)
}
},
9 months ago
openPage() {
uni.navigateTo({
url: '/pages/activity/presaleRule?type=7'
})
11 months ago
},
tabItem(index) {
this.tabIndex = index;
this.getCoupon(index)
},
receive(item) {
const that = this
CouponApi.receive({
couponId: item.coupon_id
})
.then(res => {
that.$toast(res.message)
that.getCoupon(that.tabIndex)
11 months ago
})
.finally(() => that.isLoading = false)
},
9 months ago
// 去使用
toUse(){
// 调到商品列表
uni.switchTab({
url: "/pages/index/index"
})
},
goMyCoupon() {
11 months ago
uni.navigateTo({
url: "/pages/news/coupon/list"
})
},
}
}
11 months ago
</script>
<style lang="scss" scoped>
.coupon {
background-color: #FB3A22;
overflow: hidden;
min-height: 100vh;
9 months ago
.rule {
right: 0;
top: 74rpx;
z-index: 999;
width: 100rpx;
height: 60rpx;
background-color: rgba(0, 0, 0, 0.3);
font-size: 24rpx;
font-weight: 400;
color: #FFFFFF;
line-height: 60rpx;
text-align: center;
position: absolute;
border-radius: 50rpx 0 0 50rpx;
}
11 months ago
.nolist {
width: 100%;
11 months ago
display: block;
margin: 0 auto;
text-align: center;
11 months ago
padding: 150rpx 50rpx;
image {
width: 388rpx;
height: 378rpx;
}
11 months ago
.txt {
font-size: 32rpx;
11 months ago
margin-top: 20rpx;
font-weight: 500;
11 months ago
color: #fff;
}
11 months ago
}
&-hd {
width: 100%;
height: 445rpx;
image {
width: 100%;
11 months ago
height: 100%;
}
11 months ago
}
&-tab {
padding: 0 40rpx;
display: flex;
align-items: center;
justify-content: space-between;
.item {
width: 316rpx;
line-height: 80rpx;
border-radius: 10rpx;
font-size: 32rpx;
color: #FFFFFF;
text-align: center;
11 months ago
&-on {
color: #F34A40;
background: #FFFFFF;
}
}
}
&-bd {
10 months ago
padding: 0 40rpx 180rpx;
11 months ago
overflow: hidden;
11 months ago
.item {
width: 662rpx;
9 months ago
height: 240rpx;
11 months ago
position: relative;
margin-top: 20rpx;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
.a {
width: 100%;
position: absolute;
left: 60rpx;
9 months ago
top: 20rpx;
11 months ago
z-index: 2;
9 months ago
font-size: 30rpx;
11 months ago
font-weight: 500;
color: #FE6900;
text {
9 months ago
font-size: 60rpx;
11 months ago
}
}
.b {
width: 100%;
position: absolute;
left: 60rpx;
9 months ago
top: 100rpx;
11 months ago
z-index: 2;
font-size: 32rpx;
font-weight: 500;
color: #6B6B6B;
}
.c {
width: 100%;
position: absolute;
left: 60rpx;
9 months ago
bottom: 22rpx;
11 months ago
z-index: 2;
font-size: 28rpx;
font-weight: 500;
color: #A7572C;
}
.d {
width: 188rpx;
line-height: 68rpx;
background: linear-gradient(180deg, #FF7366 0%, #FF5242 100%);
border-radius: 68rpx;
position: absolute;
right: 28rpx;
9 months ago
top: 35rpx;
11 months ago
z-index: 2;
font-size: 28rpx;
font-weight: 500;
color: #FFFFFF;
text-align: center;
}
9 months ago
.f{
height: 40rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 24rpx;
color: #AFAFAF;
line-height: 40rpx;
text-align: left;
font-style: normal;
text-transform: none;
position: absolute;
right: 28rpx;
bottom: 85rpx;
z-index: 2;
}
}
}
}
11 months ago
.footer {
display: flex;
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 148rpx;
justify-content: center;
align-items: center;
font-size: 36rpx;
font-weight: 500;
color: #FA3B22;
line-height: 148rpx;
background: linear-gradient(180deg, #FFFFFF 0%, #FEEECA 100%);
z-index: 999;
.fooIcon {
11 months ago
margin-left: 36rpx;
}
}
</style>