|
@@ -104,14 +104,13 @@ export default {
|
|
|
this.popup = true
|
|
|
},
|
|
|
pointsMath(type) {
|
|
|
- const {usedDiscountHours, maxDiscountHours} = this.newMemberPoints
|
|
|
if ( type === 'minus' && this.pointsTime ) {
|
|
|
this.pointsTime = this.pointsTime - 1;
|
|
|
this.newMemberPointsAvailable = this.newMemberPointsAvailable + this.newMemberPoints.pointsPerUnit;
|
|
|
return
|
|
|
}
|
|
|
// 可能还有隐藏上限,就是普通的points的使用,单次不能超过上限
|
|
|
- if(type === 'add' && this.newMemberPointsAvailable > this.newMemberPoints.pointsPerUnit && (this.pointsTime + usedDiscountHours < maxDiscountHours)) {
|
|
|
+ if(type === 'add' && this.isAdd()) {
|
|
|
this.pointsTime = this.pointsTime + 1
|
|
|
this.newMemberPointsAvailable = this.newMemberPointsAvailable - this.newMemberPoints.pointsPerUnit
|
|
|
} else {
|
|
@@ -120,6 +119,15 @@ export default {
|
|
|
// 调整当前积分
|
|
|
// 调整points的积分available
|
|
|
},
|
|
|
+ isAdd() {
|
|
|
+ const {usedDiscountHours, maxDiscountHours} = this.newMemberPoints
|
|
|
+ // const { hourPrice = 0 } = this.orderDetail?.parkingRule
|
|
|
+ const availableDiscountHours = maxDiscountHours - usedDiscountHours
|
|
|
+ if (!availableDiscountHours) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return this.newMemberPointsAvailable > this.newMemberPoints.pointsPerUnit && (this.pointsTime + usedDiscountHours < maxDiscountHours)
|
|
|
+ },
|
|
|
cancelPointsMathPopup() {
|
|
|
this.popup = false
|
|
|
},
|