Commit 97a362a1 authored by 罗超's avatar 罗超

Merge branch 'master' of http://gitlab.oytour.com/zk123/jz_travel

parents f5e781bb 9c9a8453
...@@ -69,6 +69,8 @@ ...@@ -69,6 +69,8 @@
value:'', value:'',
ts: [], ts: [],
stacking: 0, stacking: 0,
TotalDiscounts: 0,
money: 0,
}; };
}, },
mounted() { mounted() {
...@@ -95,6 +97,7 @@ ...@@ -95,6 +97,7 @@
} }
}) })
this.OverlayCalculation()
this.checkOrderCoupon() this.checkOrderCoupon()
}, },
methods: { methods: {
...@@ -129,7 +132,7 @@ ...@@ -129,7 +132,7 @@
}else{ }else{
this.$emit('close', -1) this.$emit('close', -1)
} }
console.log(this.currentChosen,'-----') // console.log(this.currentChosen,'-----')
}, },
// 不可叠加使用优惠券 // 不可叠加使用优惠券
radioChange(e){ radioChange(e){
...@@ -144,9 +147,10 @@ ...@@ -144,9 +147,10 @@
if(!this.currentChosen||this.currentChosen.length==0||(this.currentChosen.length==1&&this.currentChosen[0] != e)){ if(!this.currentChosen||this.currentChosen.length==0||(this.currentChosen.length==1&&this.currentChosen[0] != e)){
this.currentChosen = [e] this.currentChosen = [e]
}else{ }else{
this.currentChosen = 0; this.currentChosen = [];
this.value = 0 this.value = 0
} }
this.OverlayCalculation(1)
}, },
// 叠加使用优惠券 // 叠加使用优惠券
multipleChoice(e,i){ multipleChoice(e,i){
...@@ -165,6 +169,40 @@ ...@@ -165,6 +169,40 @@
let list = this.currentChosen.findIndex(x=>x==this.ts[i].id) let list = this.currentChosen.findIndex(x=>x==this.ts[i].id)
if(list==-1) this.currentChosen.push(e) if(list==-1) this.currentChosen.push(e)
} }
this.OverlayCalculation()
},
OverlayCalculation(type){
this.TotalDiscounts = 0
this.money = 0
if(this.currentChosen.length==0||type){
this.ts.forEach(x => {
if(x.overlapUse&&(x.err||type)){
x.err = null
}
})
return
}
let alreadyStacked = this.ts.filter(x => {
return x.check
})
alreadyStacked.forEach(x => {
this.TotalDiscounts+=x.denomination
this.money = this.price-this.TotalDiscounts
})
this.ts.forEach(x => {
if(x.overlapUse){
if(!x.check&&x.denomination>this.money){
x.err = '订单金额不满足'
}else {
x.err = null
}
}
})
this.ts.sort((a,b) => {
const aerr = (a.err?a.err:'').length
const berr = (b.err?b.err:'').length
return aerr-berr
})
} }
}, },
}; };
......
...@@ -648,7 +648,7 @@ ...@@ -648,7 +648,7 @@
}, },
usePzCouponHandler(){ usePzCouponHandler(){
this.showPz = false this.showPz = false
this.closeCouponHandler(this.pzCoupon.id) this.closeCouponHandler([this.pzCoupon.id])
this.pzCoupon = null this.pzCoupon = null
}, },
calcPzCouponHandler(){ calcPzCouponHandler(){
......
...@@ -653,7 +653,7 @@ ...@@ -653,7 +653,7 @@
<view style="font-size: 12px;width:1px;flex:1">请选择优惠券</view> <view style="font-size: 12px;width:1px;flex:1">请选择优惠券</view>
<view style="display: flex;align-items: center;"> <view style="display: flex;align-items: center;">
<text style="color:#F20707;font-size: 12px;" @click="showCouponHandler"> <text style="color:#F20707;font-size: 12px;" @click="showCouponHandler">
<text style="flex: 1;" v-if="useCouponId == 0 &&couponList.length>0">{{couponList.length}}张可用优惠券</text> <text style="flex: 1;" v-if="useCouponIds == 0 &&couponList.length>0">{{couponList.length}}张可用优惠券</text>
<text class="content" style="color:grey" v-else-if="couponList.length==0">暂无优惠券</text> <text class="content" style="color:grey" v-else-if="couponList.length==0">暂无优惠券</text>
<text class="content" v-else :style="{ color: mainColor }">已优惠 {{currentCoupon.discountMoney}}</text> <text class="content" v-else :style="{ color: mainColor }">已优惠 {{currentCoupon.discountMoney}}</text>
<!-- <u-icon name="ellipsis" size="36" v-if="couponList.length > 0"></u-icon> --> <!-- <u-icon name="ellipsis" size="36" v-if="couponList.length > 0"></u-icon> -->
...@@ -667,7 +667,7 @@ ...@@ -667,7 +667,7 @@
<view class="empty-block"></view> <view class="empty-block"></view>
</template> </template>
<coupon v-if="couponList.length > 0 && showCoupon" :list="couponList" :current="useCouponId" @close="closeCouponHandler" :current-price="realCurrentPriceInfo" :order="orderMsg"></coupon> <coupon v-if="couponList.length > 0 && showCoupon" :price="price" :list="couponList" :current="useCouponIds" @close="closeCouponHandler" :current-price="realCurrentPriceInfo" :order="orderMsg"></coupon>
<view style="padding: 50rpx 40rpx" v-if="tips != ''"> <view style="padding: 50rpx 40rpx" v-if="tips != ''">
<view class="big-title"> <view class="big-title">
<text>重要提示</text> <text>重要提示</text>
...@@ -780,7 +780,7 @@ ...@@ -780,7 +780,7 @@
GuestList: [], GuestList: [],
couponList: [], couponList: [],
showCoupon: false, showCoupon: false,
useCouponId: 0, useCouponIds: [],
currentCoupon: { currentCoupon: {
discountMoney: 0 discountMoney: 0
}, },
...@@ -973,18 +973,27 @@ ...@@ -973,18 +973,27 @@
}, },
closeCouponHandler(e) { closeCouponHandler(e) {
if (e != -1) { if (e != -1) {
this.useCouponId = e; this.useCouponIds = e;
if(this.useCouponId){ //叠加使用优惠券
this.currentCoupon = this.couponList.find(x => x.id == this.useCouponId) let TotalDiscountAmount = 0
if (this.currentCoupon.couponsType == 1) { this.couponList.forEach(x=>{
this.currentCoupon.discountMoney = this.currentCoupon.denomination let findIndex = this.useCouponIds.findIndex(y=>x.id==y)
} else { if(findIndex!=-1){
this.currentCoupon.discountMoney = (parseFloat(this.price) * (1 - parseFloat(this.currentCoupon.denomination / 10))) let discountMoney = 0
.toFixed(2) if(x.couponsType==1){
} discountMoney = x.denomination
}else{ }else{
this.currentCoupon.discountMoney = 0 discountMoney = (parseFloat(this.price) * (1 - parseFloat(x.denomination / 10)))
} .toFixed(2)
}
TotalDiscountAmount += discountMoney
}
})
if(TotalDiscountAmount)this.currentCoupon.discountMoney = TotalDiscountAmount
else this.currentCoupon.discountMoney = 0
}else{
this.currentCoupon.discountMoney = 0
this.useCouponIds = []
} }
this.showCoupon = false; this.showCoupon = false;
}, },
...@@ -1014,7 +1023,7 @@ ...@@ -1014,7 +1023,7 @@
}, },
usePzCouponHandler(){ usePzCouponHandler(){
this.showPz = false this.showPz = false
this.closeCouponHandler(this.pzCoupon.id) this.closeCouponHandler([this.pzCoupon.id])
this.pzCoupon = null this.pzCoupon = null
}, },
calcPzCouponHandler(){ calcPzCouponHandler(){
......
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