优化功能
This commit is contained in:
@ -64,6 +64,7 @@
|
||||
|
||||
<!-- 团购券 -->
|
||||
<view v-if="couponType == 2">
|
||||
checkedId--{{checkedId}}
|
||||
<view class="mx-30rpx">
|
||||
<view class="mx30rpx">
|
||||
<text class="text-[#303133] font-bold text-30rpx leading-42rpx">可用团购券</text>
|
||||
@ -181,11 +182,16 @@
|
||||
},
|
||||
|
||||
/**
|
||||
* 选择优惠券
|
||||
* 选择/取消选择优惠券
|
||||
* @param id 优惠券ID
|
||||
*/
|
||||
handleCheck: (id: number) => {
|
||||
checkedId.value = id
|
||||
// 如果是优惠券的话则是可以取消选择
|
||||
if (couponType.value == 1 && checkedId.value === id) {
|
||||
checkedId.value = 0 // 再次点击已选中时取消选择
|
||||
} else {
|
||||
checkedId.value = id
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -193,12 +199,14 @@
|
||||
*/
|
||||
handleConfirmCoupon: () => {
|
||||
let coupon = null
|
||||
if (couponType.value == CouponType.Discount) {
|
||||
coupon = couponList.value.use.find(item => item.user_coupon_id === checkedId.value)
|
||||
} else {
|
||||
coupon = groupCouponList.value.find(item => item.id === checkedId.value)
|
||||
|
||||
if (checkedId.value > 0) {
|
||||
if (couponType.value == CouponType.Discount) {
|
||||
coupon = couponList.value.use.find(item => item.user_coupon_id === checkedId.value)
|
||||
} else {
|
||||
coupon = groupCouponList.value.find(item => item.id === checkedId.value)
|
||||
}
|
||||
}
|
||||
console.log("🚀 ~ coupon:", coupon)
|
||||
|
||||
uni.$emit('chooseCoupon', { coupon })
|
||||
router.navigateBack()
|
||||
|
||||
Reference in New Issue
Block a user