Commit eacc79a8 authored by youjie's avatar youjie

修复小包团优惠券

parent 08292bd5
...@@ -199,9 +199,7 @@ export default { ...@@ -199,9 +199,7 @@ export default {
} }
}, },
created() { created() {
console.log(uni.getStorageSync("b2b_user"),'=======b2b_user')
this.erpBaseInfo = uni.getStorageSync("b2b_user").erpBaseInfo this.erpBaseInfo = uni.getStorageSync("b2b_user").erpBaseInfo
console.log(this.datas,'----=====datas')
}, },
mounted() { mounted() {
setTimeout(() => { setTimeout(() => {
......
...@@ -825,21 +825,36 @@ ...@@ -825,21 +825,36 @@
); );
}, },
calcMaxCouponHandle(){ calcMaxCouponHandle(){
const shengyu = this.realCurrentPriceInfo.totalSeat-this.realCurrentPriceInfo.leaderNum
const remainNum = this.realCurrentPriceInfo.remainNum
const orderNum = this.orderMsg.ManNum+this.orderMsg.ChirdNeedBedNum+this.orderMsg.ChirdNoBedNum
let errorMsg = null
if (this.realCurrentPriceInfo && this.realCurrentPriceInfo.teamType==1) {
if(shengyu!=remainNum) errorMsg = '当前定制团存在其他订单,无法使用专享优惠券'
else if(orderNum<shengyu) errorMsg = '报名人数小于团队机位人数,无法使用专享优惠券'
}
if(this.couponList && this.couponList.length>0){ if(this.couponList && this.couponList.length>0){
let maxCouponId = 0 let maxCouponId = 0
let discount = 0 let discount = 0
const money = this.price const money = this.price
this.couponList.forEach(x=>{ this.couponList.forEach(x=>{
if(x.couponsType==1 && x.denomination>discount&&(this.total>=x.orderGuestNum||!x.orderGuestNum)&&this.price>=x.useCondition) { if(x.couponsUseScope==10&&errorMsg) {
discount=x.denomination uni.showToast({
maxCouponId = x.id title:errorMsg,
} icon:'none'
if(x.couponsType==2){ })
let disMoney = money*(1-x.denomination) }else{
if(discount<disMoney&&(this.total>=x.orderGuestNum||!x.orderGuestNum)&&this.price>=x.useCondition){ if(x.couponsType==1 && x.denomination>discount&&(this.total>=x.orderGuestNum||!x.orderGuestNum)&&this.price>=x.useCondition) {
discount=disMoney discount=x.denomination
maxCouponId = x.id maxCouponId = x.id
} }
if(x.couponsType==2){
let disMoney = money*(1-x.denomination)
if(discount<disMoney&&(this.total>=x.orderGuestNum||!x.orderGuestNum)&&this.price>=x.useCondition){
discount=disMoney
maxCouponId = x.id
}
}
} }
}) })
if(maxCouponId>0) this.closeCouponHandler([maxCouponId]) if(maxCouponId>0) this.closeCouponHandler([maxCouponId])
......
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