|
@@ -459,13 +459,18 @@ export default defineComponent({
|
|
|
this.orderGoodsType.forEach((type: any) => {
|
|
|
tempPrice[type.orderType] = type.price
|
|
|
})
|
|
|
- ;(item || []).forEach((item: any) => {
|
|
|
- discountCount += Number(item.discountPrice)
|
|
|
- if(item.couponCategory === 'UNIVERSAL') {
|
|
|
- universalCount += Number(item.discountPrice)
|
|
|
+ ;(item || []).forEach((child: any) => {
|
|
|
+ if(child.couponCategory === 'UNIVERSAL') {
|
|
|
+ universalCount += Number(child.discountPrice)
|
|
|
} else {
|
|
|
- const tempCoupon = couponToOrderTypeEnum[item.couponCategory]
|
|
|
- const price = tempPrice[tempCoupon] - Number(item.discountPrice)
|
|
|
+ const tempCoupon = couponToOrderTypeEnum[child.couponCategory]
|
|
|
+ let price = tempPrice[tempCoupon] - Number(child.discountPrice)
|
|
|
+ // 折扣金额
|
|
|
+ if(price >= 0) {
|
|
|
+ discountCount += Number(child.discountPrice)
|
|
|
+ } else {
|
|
|
+ discountCount += Number(tempPrice[tempCoupon])
|
|
|
+ }
|
|
|
tempPrice[tempCoupon] = price >= 0 ? price : 0
|
|
|
}
|
|
|
})
|
|
@@ -475,13 +480,13 @@ export default defineComponent({
|
|
|
for(let i in tempPrice) {
|
|
|
tempAllAmount += tempPrice[i]
|
|
|
}
|
|
|
- console.log(tempAllAmount, 'tempAllAmount')
|
|
|
+ // 判断 通用券的金额是否大于订单的金额
|
|
|
+ if(universalCount >= tempAllAmount) {
|
|
|
+ universalCount = tempAllAmount
|
|
|
+ }
|
|
|
|
|
|
const lastAmount = Number(
|
|
|
- numberToTwoUp(
|
|
|
- Number(this.orderAmount) -
|
|
|
- orderStatus.orderObject.discountCardPrice -
|
|
|
- Number(discountCount)
|
|
|
+ numberToTwoUp(tempAllAmount - Number(universalCount)
|
|
|
)
|
|
|
)
|
|
|
this.orderPrice = lastAmount >= 0 ? lastAmount : 0
|
|
@@ -490,7 +495,8 @@ export default defineComponent({
|
|
|
return item.couponIssueId
|
|
|
})
|
|
|
orderStatus.orderObject.couponId = couponIds.join(',') || ''
|
|
|
- orderStatus.orderObject.couponDiscountPrice = discountCount
|
|
|
+ orderStatus.orderObject.couponDiscountPrice = discountCount + universalCount
|
|
|
+
|
|
|
},
|
|
|
onConfirm(val: any) {
|
|
|
// debugger
|