Commit 73bd7e75 authored by youjie's avatar youjie

优惠券满足条件

parent 9488eb50
...@@ -117,8 +117,16 @@ ...@@ -117,8 +117,16 @@
}) })
this.OverlayCalculation() this.OverlayCalculation()
this.checkOrderCoupon() this.checkOrderCoupon()
this.reorder()
}, },
methods: { methods: {
reorder(){
this.ts.sort((a,b) => {
const aerr = (a.err?a.err:'').length
const berr = (b.err?b.err:'').length
return aerr-berr
})
},
checkOrderCoupon(){ checkOrderCoupon(){
if (this.currentPrice && this.currentPrice.teamType==1) { if (this.currentPrice && this.currentPrice.teamType==1) {
//totalSeat:总机位 isSubstitution:1 (可候补) leaderNum:领队 //totalSeat:总机位 isSubstitution:1 (可候补) leaderNum:领队
...@@ -132,11 +140,7 @@ ...@@ -132,11 +140,7 @@
this.ts.forEach(x => { this.ts.forEach(x => {
if(x.couponsUseScope==10) x.err = errorMsg if(x.couponsUseScope==10) x.err = errorMsg
}) })
this.ts.sort((a,b) => { this.reorder()
const aerr = (a.err?a.err:'').length
const berr = (b.err?b.err:'').length
return aerr-berr
})
} }
this.ts.forEach((x)=>{ this.ts.forEach((x)=>{
if(!x.err && x.useCondition>this.price){ if(!x.err && x.useCondition>this.price){
...@@ -220,11 +224,7 @@ ...@@ -220,11 +224,7 @@
} }
} }
}) })
this.ts.sort((a,b) => { this.reorder()
const aerr = (a.err?a.err:'').length
const berr = (b.err?b.err:'').length
return aerr-berr
})
} }
}, },
}; };
......
...@@ -863,9 +863,9 @@ ...@@ -863,9 +863,9 @@
calcPzCouponHandler(){ calcPzCouponHandler(){
this.couponList.forEach((x)=>{ this.couponList.forEach((x)=>{
if(x.expansionModel.denomination>0){ if(x.expansionModel.denomination>0){
if(this.pzCoupon && this.pzCoupon.expansionModel.denomination<x.expansionModel.denomination) if(this.pzCoupon && this.pzCoupon.expansionModel.denomination<x.expansionModel.denomination&&(this.total>=x.orderGuestNum||!x.orderGuestNum))
this.pzCoupon=x this.pzCoupon=x
else if(!this.pzCoupon) else if(!this.pzCoupon&&(this.total>=x.orderGuestNum||!x.orderGuestNum))
this.pzCoupon=x this.pzCoupon=x
x.realDenomination = x.denomination x.realDenomination = x.denomination
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment