135 lines
4.1 KiB
Vue
135 lines
4.1 KiB
Vue
|
<template>
|
|||
|
<view class="pad-x180">
|
|||
|
<!-- 状态栏 -->
|
|||
|
<status-nav :titleVal="title" :statusTitle="true"></status-nav>
|
|||
|
<!-- 列表 -->
|
|||
|
<view :style="{paddingTop: (statusHeight+15)+'px'}" class="pad-zy32">
|
|||
|
<view class="pad-x30">
|
|||
|
<view v-if="dataList.length!=0" class="mar-x20 animated fadeInLeft" v-for="(item,index) in dataList" :key="index">
|
|||
|
<view style="height: 200rpx;" class="disjbac posir">
|
|||
|
<view class="disjcac fc recerve-left" style="width: 218rpx;height: 200rpx;flex-shrink: 0;text-align: center;color: #FFFFFF;">
|
|||
|
<image v-if="item.get" class="posia quan-img" src="/static/public/quan-left-two.png" mode=""></image>
|
|||
|
<image v-else class="posia quan-img" src="/static/public/quan-left.png" mode=""></image>
|
|||
|
<view class="posir disjcac fc" style="z-index: 1;">
|
|||
|
<view class="fon28 mar-s20 mar-x36"><span>¥</span><span class="bold" style="font-size: 56rpx;">{{item.num}}</span></view>
|
|||
|
<view @tap="useEv(item.id)" class="fon24 quan-btn" :style="{color: item.get ? '#b3b3b3' : '#3875F6'}">{{['立即领取','已领取'][item.get]}}</view>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<view class="quan-right-box">
|
|||
|
<view class="fon28 col3 mar-s20">{{item.title}}</view>
|
|||
|
<view class="fon24 col80">满{{item.manPrice}}元可使用</view>
|
|||
|
<view class="fon20 col80 mar-x20">有效期:{{item.startTime}}至{{item.endTime}}</view>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<view class="tcenter bold fon36 pad-x20">详情</view>
|
|||
|
<view class="fon28" style="color: #1A1A1A; line-height: 40rpx;">
|
|||
|
<rich-text :nodes="richText"></rich-text>
|
|||
|
</view>
|
|||
|
<view class="posixzy bacf pad-sx25">
|
|||
|
<view @tap="allReceive" class="fon30 radius20 tc colf bold" style="margin: 0 83rpx;height: 90rpx;line-height: 90rpx;" :style="{background:publicColor}">一键领取</view>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
<!-- 用户信息授权,手机号授权 -->
|
|||
|
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
|||
|
</view>
|
|||
|
</template>
|
|||
|
|
|||
|
<script>
|
|||
|
export default {
|
|||
|
data() {
|
|||
|
return {
|
|||
|
dataList:[],
|
|||
|
zcList:[],
|
|||
|
page:1,
|
|||
|
size:10,
|
|||
|
sizeq: 162,
|
|||
|
title:'优惠券组',
|
|||
|
richText:'',
|
|||
|
groupId:''
|
|||
|
}
|
|||
|
},
|
|||
|
computed:{
|
|||
|
// 主题颜色
|
|||
|
publicColor() {
|
|||
|
return this.$store.state.publicColor
|
|||
|
},
|
|||
|
statusHeight() {
|
|||
|
return this.$store.state.statusHeight
|
|||
|
}
|
|||
|
},
|
|||
|
onLoad(op) {
|
|||
|
if(uni.getStorageSync('phone_active')!=0 && uni.getStorageSync('is_active')!=0){
|
|||
|
this.checkAllList(op.group_id);
|
|||
|
}
|
|||
|
},
|
|||
|
onUnload() {
|
|||
|
|
|||
|
},
|
|||
|
methods: {
|
|||
|
allReceive(){
|
|||
|
console.log(this.groupId);
|
|||
|
this.$requst.post('user/get-coupon-group',{group_id:this.groupId}).then(res=>{
|
|||
|
if(res.code==0){
|
|||
|
this.$toolAll.tools.showToast('领取成功(*^▽^*)');
|
|||
|
this.checkAllList(this.groupId);
|
|||
|
} else {
|
|||
|
this.$toolAll.tools.showToast(res.msg);
|
|||
|
}
|
|||
|
})
|
|||
|
},
|
|||
|
checkAllList(group_id){//查询所有优惠券列表
|
|||
|
this.$requst.post('user/get-coupon-group-info',{group_id}).then(res=>{
|
|||
|
if(res.code==0){
|
|||
|
this.groupId = res.data.id;
|
|||
|
this.title = res.data.title;
|
|||
|
this.richText = this.$toolAll.tools.escape2Html(res.data.content);
|
|||
|
this.dataList = [];
|
|||
|
this.zcList = [];
|
|||
|
if(res.data.coupon.length!=0){
|
|||
|
res.data.coupon.forEach(item=>{
|
|||
|
let obj = {
|
|||
|
id:item.id,
|
|||
|
num:item.amount/100,
|
|||
|
title:item.name,
|
|||
|
cover:this.$http + item.cover,
|
|||
|
manPrice:item.condition/100,
|
|||
|
startTime:item.begin_at.slice(0,10),
|
|||
|
endTime:item.end_at.slice(0,10),
|
|||
|
get:item.get
|
|||
|
}
|
|||
|
this.dataList.push(obj);//渲染的列表
|
|||
|
this.zcList.push(obj);//暂存的列表
|
|||
|
})
|
|||
|
}
|
|||
|
}
|
|||
|
})
|
|||
|
},
|
|||
|
useEv(id){
|
|||
|
this.$requst.post('user/get-coupon',{coupon_id:id}).then(res=>{
|
|||
|
if(res.code==0){
|
|||
|
this.$toolAll.tools.showToast('领取成功');
|
|||
|
this.checkAllList(this.groupId);
|
|||
|
} else {
|
|||
|
this.$toolAll.tools.showToast(res.msg);
|
|||
|
}
|
|||
|
})
|
|||
|
},
|
|||
|
}
|
|||
|
}
|
|||
|
</script>
|
|||
|
|
|||
|
<style>
|
|||
|
.isWen{color: #3875F6;}
|
|||
|
.isWen::after{
|
|||
|
content: '';
|
|||
|
display: block;
|
|||
|
height: 8rpx;
|
|||
|
width: 100%;
|
|||
|
position: absolute;
|
|||
|
bottom: -20rpx;
|
|||
|
background: #3875F6;
|
|||
|
}
|
|||
|
</style>
|