This commit is contained in:
weipengfei 2024-01-20 18:39:15 +08:00
parent 4d258a0c2e
commit 0141fcc6b2
2 changed files with 36 additions and 18 deletions

View File

@ -1,6 +1,6 @@
<template>
<view class="">
<block v-for="(item, index) in info">
<!-- <block v-for="(item, index) in info">
<block v-if="item.type==1">
<view class="type_name">无门槛实物通用红包<text class="n_count">(2)</text></view>
<view class="r_list" v-for="(e, i) in item.list">
@ -44,10 +44,33 @@
<view class="n_tips">本单不可用原因未在平台指定店铺使用</view>
</view>
</block>
</block>
</block> -->
<view style="height: 30rpx;"></view>
<view class="r_list" v-for="(item, i) in list" :key="i">
<view class="r_item" @click="change(item)">
<image class="r_bg" src="/static/active/red_packet.webp"></image>
<view class="r_body">
<view class="r_count">
<view class="rc_count">
<text class="rc_icon"></text>{{item.coupon_price}}
</view>
</view>
<view class="r_content">
<view class="r_name">{{item.coupon_title}}</view>
<view>{{item.describe}}</view>
<view>有效期至 {{item.end_time}}</view>
</view>
<view class="r_icon">
<u-icon v-if="changeRed&&changeRed.uid==item.uid" name="checkmark-circle-fill" color="#FFF3CC" size="56rpx"></u-icon>
<u-icon v-else name="checkmark-circle" color="#FFF3CC" size="56rpx"></u-icon>
</view>
</view>
</view>
</view>
<view class="footer">
<view>已选 {{ changeRed.id!=-1?1:0 }} , 可减 <text class="red_i">¥</text> <text class="red_c">50</text></view>
<view>已选 {{ changeRed?1:0 }} , 可减 <text class="red_i">¥</text> <text class="red_c">0</text></view>
<view class="btn" @click="comfirm">确定</view>
</view>
</view>
@ -74,35 +97,27 @@
list: [1]
}
],
changeRed: {
type: -1,
id: -1,
},
list: [],
changeRed: null,
}
},
onLoad(option) {
const eventChannel = this.getOpenerEventChannel();
// acceptDataFromOpenerPageeventChannel
eventChannel.on('changeRedPacketInfo', (data) => {
console.log(data)
console.log(data);
this.list = data;
})
},
onShow() {},
methods: {
change(e, i) {
console.log(e, i);
if(this.changeRed.type==e&&this.changeRed.id==i){
this.changeRed = {
type: -1,
id: -1
}
}else this.changeRed = {
type: e,
id: i
}
if(this.changeRed&&this.changeRed.uid==e.uid)this.changeRed = null;
else this.changeRed = e;
},
comfirm(){
uni.$emit('changeRedPacket', { id: 1 });
uni.$emit('changeRedPacket', this.changeRed.uid);
uni.navigateBack()
}
},

View File

@ -677,6 +677,7 @@
interest_rate: '', //
settle_cycle: '', //
type_id: '', //
consumption_id: '', //id
};
},
computed: {
@ -1045,6 +1046,7 @@
cart_id: that.cartId.split(","),
address_id: address_id,
takes: that.take,
consumption_id: this.consumption_id,
use_coupon: that.subCoupon,
use_integral: that.use_integral,
product_type: that.product_type,
@ -1206,6 +1208,7 @@
res.eventChannel.emit('changeRedPacketInfo', this.platformConsumption)
uni.$once('changeRedPacket', (data)=>{
console.log('选择红包', data);
this.consumption_id = data;
})
}
})