2022-05-27 02:57:12 +00:00
|
|
|
|
<template>
|
2022-06-07 02:24:54 +00:00
|
|
|
|
<view class="pad-x180" style="padding-bottom: 240rpx;">
|
2022-05-27 02:57:12 +00:00
|
|
|
|
<!-- 状态栏 -->
|
|
|
|
|
<status-nav :titleVal="title" :statusTitle="true"></status-nav>
|
|
|
|
|
<!-- 列表 -->
|
|
|
|
|
<view :style="{paddingTop: (statusHeight+15)+'px'}" class="pad-zy32">
|
2022-05-31 05:27:10 +00:00
|
|
|
|
<view class="fon28 mar-x50" style="color: #1A1A1A; line-height: 40rpx;">
|
2022-05-27 11:02:13 +00:00
|
|
|
|
<rich-text :nodes="richText"></rich-text>
|
|
|
|
|
</view>
|
2022-05-31 03:01:11 +00:00
|
|
|
|
<view class="pad-x30">
|
2022-05-27 02:57:12 +00:00
|
|
|
|
<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;">
|
2022-06-08 05:59:00 +00:00
|
|
|
|
<view class="fon28 mar-s20 mar-x36"><span class="bold" style="font-size: 56rpx;">{{item.num}}</span><span v-if="item.unit">{{item.unit}}</span></view>
|
2022-05-27 02:57:12 +00:00
|
|
|
|
<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>
|
2022-05-31 03:01:11 +00:00
|
|
|
|
</view>
|
2022-06-07 02:24:54 +00:00
|
|
|
|
<view class="posixzy bacf pad-sx25" style="background: none; bottom: 150rpx;">
|
2022-05-27 11:02:13 +00:00
|
|
|
|
<view @tap="allReceive" class="fon30 radius20 tc colf bold" style="margin: 0 83rpx;height: 90rpx;line-height: 90rpx;" :style="{background:publicColor}">{{['一键领取','立即使用'][dataList[0].get]}}</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="disjcac" v-if="ifLing" style="position: fixed;top: 0;left: 0;bottom: 0;right: 0;background-color: rgba(0, 0, 0, .7);z-index: 2;padding: 0 100rpx;">
|
|
|
|
|
<view class="tcenter radius30 bacf width100 pad-sx50">
|
|
|
|
|
<view class="bold pad-s30" style="font-size: 48rpx;">恭喜您领取成功</view>
|
|
|
|
|
<view @tap="allReceive" class="disjcac fon38" style="width: 426rpx;height: 80rpx;border-radius: 20rpx;color: #FFFFFF;margin: 0 auto;margin-top: 100rpx;margin-bottom: 10rpx;" :style="{backgroundColor:publicColor}">立即使用</view>
|
2022-05-27 02:57:12 +00:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 用户信息授权,手机号授权 -->
|
|
|
|
|
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
|
2022-06-06 08:33:52 +00:00
|
|
|
|
<!-- 底部导航 -->
|
|
|
|
|
<view class="posixzy">
|
|
|
|
|
<bottom-tab></bottom-tab>
|
|
|
|
|
</view>
|
2022-05-27 02:57:12 +00:00
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2022-06-06 08:33:52 +00:00
|
|
|
|
import bottomTab from '@/components/bottom-tab.vue';
|
2022-05-27 02:57:12 +00:00
|
|
|
|
export default {
|
2022-06-06 08:33:52 +00:00
|
|
|
|
components: {
|
|
|
|
|
bottomTab,
|
|
|
|
|
},
|
2022-05-27 02:57:12 +00:00
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
dataList:[],
|
|
|
|
|
zcList:[],
|
|
|
|
|
page:1,
|
|
|
|
|
size:10,
|
|
|
|
|
sizeq: 162,
|
|
|
|
|
title:'优惠券组',
|
|
|
|
|
richText:'',
|
2022-05-27 11:02:13 +00:00
|
|
|
|
groupId:'',
|
|
|
|
|
ifLing:false
|
2022-05-27 02:57:12 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed:{
|
|
|
|
|
// 主题颜色
|
|
|
|
|
publicColor() {
|
|
|
|
|
return this.$store.state.publicColor
|
|
|
|
|
},
|
|
|
|
|
statusHeight() {
|
|
|
|
|
return this.$store.state.statusHeight
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-05-27 11:02:13 +00:00
|
|
|
|
onShareAppMessage() {
|
|
|
|
|
var shareObj = {
|
|
|
|
|
title: `${ya.detailObj.title}`, // 默认是小程序的名称(可以写slogan等)
|
|
|
|
|
path: `/pagesB/couponGroup/couponGroup?group_id=${this.groupId}&share_id=${uni.getStorageSync('userId')}&invite_code=${uni.getStorageSync('invite_code')}`, // 默认是当前页面,必须是以‘/’开头的完整路径
|
|
|
|
|
imageUrl: `` //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
|
|
|
|
|
};
|
|
|
|
|
},
|
2022-05-27 02:57:12 +00:00
|
|
|
|
onLoad(op) {
|
|
|
|
|
if(uni.getStorageSync('phone_active')!=0 && uni.getStorageSync('is_active')!=0){
|
|
|
|
|
this.checkAllList(op.group_id);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onUnload() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
allReceive(){
|
2022-05-27 11:02:13 +00:00
|
|
|
|
if(this.dataList[0].get) {
|
|
|
|
|
uni.reLaunch({
|
2022-05-31 03:01:11 +00:00
|
|
|
|
url:'/pagesA/coupon/coupon'
|
2022-05-27 11:02:13 +00:00
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
this.$requst.post('user/get-coupon-group',{group_id:this.groupId}).then(res=>{
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
// this.$toolAll.tools.showToast('领取成功(*^▽^*)');
|
|
|
|
|
this.ifLing = true;
|
|
|
|
|
this.checkAllList(this.groupId);
|
|
|
|
|
} else {
|
|
|
|
|
this.$toolAll.tools.showToast(res.msg);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
2022-05-27 02:57:12 +00:00
|
|
|
|
},
|
|
|
|
|
checkAllList(group_id){//查询所有优惠券列表
|
|
|
|
|
this.$requst.post('user/get-coupon-group-info',{group_id}).then(res=>{
|
2022-06-07 02:24:54 +00:00
|
|
|
|
console.log(res,'优惠券列表')
|
2022-05-27 02:57:12 +00:00
|
|
|
|
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),
|
2022-06-07 02:24:54 +00:00
|
|
|
|
get:item.get,
|
2022-06-08 05:59:00 +00:00
|
|
|
|
type:item.type,
|
|
|
|
|
unit:item.unit
|
2022-05-27 02:57:12 +00:00
|
|
|
|
}
|
|
|
|
|
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>
|