先下单后支付优惠券相关调试
This commit is contained in:
@@ -150,10 +150,23 @@
|
||||
type: Object
|
||||
},
|
||||
},
|
||||
watch :{
|
||||
listinfo:{
|
||||
immediate: true,
|
||||
handler (newVal) {
|
||||
console.log(newVal)
|
||||
this.$forceUpdate()
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
console.log(this.listinfo.shopId)
|
||||
uni.$on('couponItem',this.changeCoupon)
|
||||
this.getCalcUsablePoints()
|
||||
},
|
||||
onShow() {
|
||||
// uni.$on('couponItem',this.changeCoupon)
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 监听优惠券/商品券选择
|
||||
@@ -190,11 +203,12 @@
|
||||
num: couponData.type == 1 ? 1 : couponData.num,
|
||||
})
|
||||
}
|
||||
if ( _this.isPointsChecked) {
|
||||
console.log(_this.listinfo.payAmount)
|
||||
// if ( _this.isPointsChecked ) {
|
||||
_this.pointsChange()
|
||||
_this.getCalcUsablePoints()
|
||||
}
|
||||
|
||||
// }
|
||||
this.$emit("setPayAmount",_this.listinfo.payAmount)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "优惠券满减金额大于订单金额不可使用",
|
||||
@@ -202,7 +216,7 @@
|
||||
})
|
||||
}
|
||||
} else { //商品券
|
||||
// this.listinfo.details
|
||||
|
||||
// 筛选选中商品券商品列表
|
||||
let couponList = _this.listinfo.details.filter(v => v.productId == couponData.proId);
|
||||
//金额从小到大排序
|
||||
@@ -216,7 +230,7 @@
|
||||
productTicketList.map((item,index) => {
|
||||
productTicketNum += item.num
|
||||
})
|
||||
console.log(productTicketNum)
|
||||
console.log(minCouponList)
|
||||
minCouponList.map((item,index) => {
|
||||
productNumber += item.number
|
||||
if ( productNum > 0 && productNumber > productTicketNum) {
|
||||
@@ -227,7 +241,6 @@
|
||||
productPayAmount = productPayAmount + (num*(item.memberPrice > 0 ? item.memberPrice : item.salePrice))
|
||||
}
|
||||
})
|
||||
console.log(minCouponList)
|
||||
_this.userCouponInfos.push({
|
||||
userCouponId: couponData.id,
|
||||
type: couponData.type,
|
||||
@@ -243,11 +256,13 @@
|
||||
discountAmount: productPayAmount,
|
||||
num: productNum == 0 ? couponData.num : (couponData.num - productNum),
|
||||
})
|
||||
|
||||
if ( _this.isPointsChecked) {
|
||||
console.log(productNum)
|
||||
console.log(_this.favorable)
|
||||
// if ( _this.isPointsChecked) {
|
||||
_this.pointsChange()
|
||||
_this.getCalcUsablePoints()
|
||||
}
|
||||
// }
|
||||
this.$emit("setPayAmount",_this.listinfo.payAmount)
|
||||
}
|
||||
uni.$off('couponItem')
|
||||
},
|
||||
@@ -267,6 +282,7 @@
|
||||
this.freeDisabled = false
|
||||
this.listinfo.payAmount = (Number(this.listinfo.payAmount)+(this.calcUsablePointsData.pointsNum/this.calcUsablePointsData.equivalentPoints)).toFixed(2);
|
||||
}
|
||||
this.$emit("setPayAmount",_this.listinfo.payAmount)
|
||||
},
|
||||
goUrl(item){
|
||||
switch (item.type){
|
||||
@@ -544,7 +560,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
// padding: 0 30rpx;
|
||||
padding: 0 30rpx;
|
||||
box-sizing: border-box;
|
||||
padding-bottom: 26rpx;
|
||||
padding-top: 26rpx;
|
||||
|
||||
Reference in New Issue
Block a user