Commit eacc79a8 authored by youjie's avatar youjie

修复小包团优惠券

parent 08292bd5
......@@ -199,9 +199,7 @@ export default {
}
},
created() {
console.log(uni.getStorageSync("b2b_user"),'=======b2b_user')
this.erpBaseInfo = uni.getStorageSync("b2b_user").erpBaseInfo
console.log(this.datas,'----=====datas')
},
mounted() {
setTimeout(() => {
......
......@@ -825,21 +825,36 @@
);
},
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){
let maxCouponId = 0
let discount = 0
const money = this.price
this.couponList.forEach(x=>{
if(x.couponsType==1 && x.denomination>discount&&(this.total>=x.orderGuestNum||!x.orderGuestNum)&&this.price>=x.useCondition) {
discount=x.denomination
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
if(x.couponsUseScope==10&&errorMsg) {
uni.showToast({
title:errorMsg,
icon:'none'
})
}else{
if(x.couponsType==1 && x.denomination>discount&&(this.total>=x.orderGuestNum||!x.orderGuestNum)&&this.price>=x.useCondition) {
discount=x.denomination
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])
......
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