优惠券领取与使用优化

This commit is contained in:
hupeng committed 2025-08-18 10:56:34 +08:00
1 parent 30b3464513
commit 91763cfe3c
2 files changed
+40 -30

No files matched your search

@@ -78,7 +78,9 @@
</view> </view>
</view> </view>
<view class="right" @click.stop="" v-if="activeTabIndex == 1"> <view class="right" @click.stop="" v-if="activeTabIndex == 1">
<view class="use immediate-use" :round="true" @tap="receive(item, index)" >立即领取</view> <!-- <view class="use immediate-use" :round="true" @tap="receive(item, index)" >立即领取</view> -->
<view class="use immediate-use" :round="true" v-if="item.isReceive == 0" @tap="receive(item, index)" >立即领取</view>
<view v-else class="used immediate-use">已领取</view>
</view> </view>
<view class="right" @click.stop="" v-if="activeTabIndex == 0"> <view class="right" @click.stop="" v-if="activeTabIndex == 0">
<view v-if="item.status == 0" class="use immediate-use" :round="true" @tap="useCouponWith(item)" >立即使用</view> <view v-if="item.status == 0" class="use immediate-use" :round="true" @tap="useCouponWith(item)" >立即使用</view>
@@ -266,6 +268,7 @@ const receive = async(coupon,index) => {
type: 'success' type: 'success'
}); });
detailModalVisible.value = false detailModalVisible.value = false
getCoupons(1)
} }
} }
@@ -513,10 +516,10 @@ page {
padding: 0 20rpx; padding: 0 20rpx;
font-size: 24rpx; font-size: 24rpx;
border-radius: 40rpx; border-radius: 40rpx;
//color: #ffffff!important; color: #ffffff!important;
//background-color: $u-type-warning!important; background-color: $uv-info-dark!important;
line-height: 40rpx; line-height: 40rpx;
//color: rgb(117, 142, 165); color: rgb(117, 142, 165);
margin-left: 20rpx; margin-left: 20rpx;
} }
} }
@@ -313,6 +313,9 @@ const amount = computed(() =>{
if (main.mycoupon.hasOwnProperty('id')) { if (main.mycoupon.hasOwnProperty('id')) {
amount -= parseFloat(main.mycoupon.value); amount -= parseFloat(main.mycoupon.value);
} }
if(amount < 0){
amount = 0
}
return amount.toFixed(2); return amount.toFixed(2);
}) })
@@ -494,34 +497,37 @@ const submit = () => {
} }
const pay = async() => { const pay = async() => {
let that = this; let that = this;
// #ifdef MP-WEIXIN // // #ifdef MP-WEIXIN
await new Promise(function(revolve) { // await new Promise(function(revolve) {
//订阅号信息id // //订阅号信息id
let subscribeMss = ['KBtfY9G1IWCzC6q-ZKo-Q-MmdP7aaF79nx0XFcBf3h4']; // let subscribeMss = ['KBtfY9G1IWCzC6q-ZKo-Q-MmdP7aaF79nx0XFcBf3h4'];
wx.showModal({ // wx.showModal({
title: '温馨提示', // title: '温馨提示',
content: '为更好的促进您与商家的交流,小程序需要在您成交时向您发送消息', // content: '为更好的促进您与商家的交流,小程序需要在您成交时向您发送消息',
confirmText: "同意", // confirmText: "同意",
cancelText: "拒绝", // cancelText: "拒绝",
success: function(res) { // success: function(res) {
if (res.confirm) { // if (res.confirm) {
uni.requestSubscribeMessage({ // uni.requestSubscribeMessage({
tmplIds: subscribeMss, // tmplIds: subscribeMss,
complete(res) { // complete(res) {
console.log(res) // console.log(res)
revolve(true) // revolve(true)
} // }
}); // });
} else { // } else {
revolve(true) // revolve(true)
} // }
} // }
}) // })
}); // });
// #endif // #endif
if(amount.value == 0){
payType.value = 'yue'
}
uni.showLoading({ uni.showLoading({
title: '加载中' title: '加载中'
}); });
@@ -557,12 +563,13 @@ const pay = async() => {
main.DEL_COUPON() main.DEL_COUPON()
if(amount.value == 0){ if(amount.value == 0){
uToast.value.show({ uToast.value.show({
message: '订单金额为0自动余额支付', message: '订单金额为0自动走余额支付',
type: 'success' type: 'success'
}); });
balancePay(order);
uni.hideLoading() uni.hideLoading()
return return
} }
if (payType.value == 'weixin') { if (payType.value == 'weixin') {
// 微信支付 // 微信支付