优惠券相关更新

This commit is contained in:
GaoHao
2024-11-21 16:27:32 +08:00
parent 76a80729c8
commit 151562d5e6
10 changed files with 234 additions and 138 deletions

View File

@@ -322,7 +322,7 @@
minCouponList.map((v,indexs) => {
for (let i = 0; i < v.num; i++){
if ( productAllNum < productDetailsNum && productNum < item.num && ((v.memberPrice > 0 ? v.memberPrice : v.price) < (this.listinfo.payAmount - productPayAmount) )) {
if ( productAllNum < productDetailsNum && productNum < item.num && ((v.memberPrice > 0 ? v.memberPrice : v.price) <= (this.listinfo.payAmount - productPayAmount) )) {
productNum++
productAllNum++
productPayAmount += v.memberPrice > 0 ? v.memberPrice : v.price

View File

@@ -101,7 +101,7 @@
</view>
</view>
</block>
<view class="cell-item column" v-if="listinfo.orderInfo.couponInfoList.productCoupon.length > 0">
<view class="cell-item column" v-if="listinfo.orderInfo&&listinfo.orderInfo.couponInfoList && listinfo.orderInfo.couponInfoList.productCoupon.length > 0">
<view class="label">商品券</view>
<view class="val column">
<view class="productCoupon" v-for="(item,index) in listinfo.orderInfo.couponInfoList.productCoupon" :key="index">

View File

@@ -18,7 +18,7 @@
</view>
</view>
</view>
<u-radio activeColor="#E8AD7B" :disabled="freeCheck&&index==0" icon-size="36" size="36" :name="item.type">
<u-radio activeColor="#E8AD7B" :disabled="(freeCheck&&index==0) || (index!=0&&payAmount<=0) || (rechargeFreeChecked&&index==0)" icon-size="36" size="36" :name="item.type">
</u-radio>
</view>
@@ -55,6 +55,12 @@
}
},
props:{
rechargeFreeChecked:{
type: Boolean
},
payAmount:{
type: Number
},
amountVIP:{
type: Object
},
@@ -77,6 +83,31 @@
// this.$emit("groupChange",{type:this.radiovalue ,name: name })
// }
// }
payAmount:{
immediate: true,
handler (newVal) {
if ( newVal <= 0 ) {
this.radiovalue = 1
let name = this.paymentMethodName[this.radiovalue-1].name;
this.$emit("groupChange",{type:this.radiovalue ,name: name })
}
}
},
rechargeFreeChecked:{
immediate: true,
handler (newVal) {
if ( newVal ) {
// #ifdef MP-WEIXIN
this.radiovalue = 2
// #endif
// #ifdef MP-ALIPAY
this.radiovalue = 3
// #endif
let name = this.paymentMethodName[this.radiovalue-1].name;
this.$emit("groupChange",{type:this.radiovalue ,name: name })
}
}
},
freeCheck:{
immediate: true,
handler (newVal) {
@@ -88,14 +119,13 @@
this.radiovalue = 3
// #endif
let name = this.paymentMethodName[this.radiovalue-1].name;
console.log({type:this.radiovalue ,name: name })
this.$emit("groupChange",{type:this.radiovalue ,name: name })
}
}
},
},
mounted() {
console.log(this.amountVIP)
// console.log(this.amountVIP)
// this.getAount();
},
@@ -105,10 +135,12 @@
* @param {Object}
*/
groupChange(type) {
console.log(type)
if ( this.freeCheck && type == 1 ) {
return;
}
if ( this.payAmount<=0 && type != 1 ) {
return;
}
this.radiovalue = type;
let name = this.paymentMethodName[type-1].name;
this.$emit("groupChange",{type:type ,name: name })

View File

@@ -4,7 +4,7 @@
<view class="rechargeFree_bg" @click="changeFree">
<view class="left">
<view class="icon">优惠</view>
<view class="text">充值消费{{freeDingConfig.rechargeTimes}}订单满{{freeDingConfig.rechargeThreshold}}可用本单立享免单</view>
<view class="text">充值消费{{freeDingConfig.rechargeTimes}}订单满{{freeDingConfig.rechargeThreshold}}可用本单立享免单</view>
</view>
<u-checkbox-group iconPlacement="right" >
<u-checkbox :disabled="freeDisabled" v-model="rechargeFreeChecked" :checked="rechargeFreeChecked" @change="changeFree" activeColor="#E8AD7B" shape="circle" icon-size="36" size="36">
@@ -18,8 +18,7 @@
export default {
data() {
return {
rechargeFreeChecked: false,
disabled: false,
freeDisabled: false,
}
},
props:{
@@ -32,26 +31,22 @@
payAmount: {
type: Number
},
freeDisabled: {
rechargeFreeChecked: {
type: Boolean
}
},
},
watch: {
freeDisabled (newVal) {
if ( this.payAmount < this.freeDingConfig.rechargeThreshold ) {
this.freeDisabled = true
}
},
payAmount (newVal) {
if ( this.payAmount < this.freeDingConfig.rechargeThreshold ) {
this.freeDisabled = true
} else {
this.freeDisabled = false
}
}
},
mounted() {
if ( this.payAmount < this.freeDingConfig.rechargeThreshold ) {
this.freeDisabled = true
}
},
methods: {
@@ -62,9 +57,6 @@
if ( this.freeDisabled ) {
return;
}
this.rechargeFreeChecked = !this.rechargeFreeChecked;
this.$emit("changeFree",this.rechargeFreeChecked)
}
}