Quellcode durchsuchen

Merge pull request #385 from John-Hong/John/release-3.0.0/SCRM-5416

fix(SCRM-5416): 从consume的defaultDiscountTime和maxDiscountTime之间取最小值
John-Hong vor 1 Jahr
Ursprung
Commit
4f5db221a6

+ 2 - 2
src/pages/parkingFee/mixins/parkingFeeDiscounts.js

@@ -251,10 +251,10 @@ export default {
         // this.consume.
       }
       this.isReduces = this.consume.hasOwnProperty('selected') || this.consume.hasOwnProperty('defaultSelected') ? false : true;
-      this.reduceHours = this.consume.hasOwnProperty('discountFee') ? this.consume.discountFee / this.orderDetail.parkingRule.hourPrice : this.consume.defaultDiscountTime;
+      this.reduceHours = this.consume.hasOwnProperty('discountFee') ? this.consume.discountFee / this.orderDetail.parkingRule.hourPrice : Math.min(this.consume.defaultDiscountTime, this.consume.maxDiscountTime);
       if (JSON.stringify(this.consume) !== '{}') {
         const isSelected = this.consume.hasOwnProperty('selected') ? this.consume.selected : this.consume.defaultSelected;
-        this.maxReduceDiscount = this.consume.hasOwnProperty('discountFee') ? this.consume.discountFee / hourPrice : this.consume.defaultDiscountTime;
+        this.maxReduceDiscount = this.consume.hasOwnProperty('discountFee') ? this.consume.discountFee / hourPrice : Math.min(this.consume.defaultDiscountTime, this.consume.maxDiscountTime);
         // const remainingLimitToIncrease = Math.abs(this.remainPrice - this.availableDiscountFee) / hourPrice
         // if (remainingLimitToIncrease) {
         //   this.maxReduceDiscountInit();

+ 3 - 3
src/pages/parkingFeeV2/Discounts/index.js

@@ -112,7 +112,7 @@ export default {
     // }
     // 消费减免(拆分部分)提示文本
     reduceSplitMessage() {
-      // console.log(106, this.reduceHours);
+// console.log(106, this.reduceHours);
       if (!this.enableConsumeNonSplit) {
         return `选择${this.reduceHours}小时,`;
       }
@@ -254,10 +254,10 @@ export default {
         // this.consume.
       }
       this.isReduces = this.consume.hasOwnProperty('selected') || this.consume.hasOwnProperty('defaultSelected') ? false : true;
-      this.reduceHours = this.consume.hasOwnProperty('discountFee') ? this.consume.discountFee / this.orderDetail.parkingRule.hourPrice : this.consume.defaultDiscountTime;
+      this.reduceHours = this.consume.hasOwnProperty('discountFee') ? this.consume.discountFee / this.orderDetail.parkingRule.hourPrice : Math.min(this.consume.defaultDiscountTime, this.consume.maxDiscountTime);
       if (JSON.stringify(this.consume) !== '{}') {
         const isSelected = this.consume.hasOwnProperty('selected') ? this.consume.selected : this.consume.defaultSelected;
-        this.maxReduceDiscount = this.consume.hasOwnProperty('discountFee') ? this.consume.discountFee / hourPrice : this.consume.defaultDiscountTime;
+        this.maxReduceDiscount = this.consume.hasOwnProperty('discountFee') ? this.consume.discountFee / hourPrice : Math.min(this.consume.defaultDiscountTime, this.consume.maxDiscountTime);
         // const remainingLimitToIncrease = Math.abs(this.remainPrice - this.availableDiscountFee) / hourPrice
         // if (remainingLimitToIncrease) {
         //   this.maxReduceDiscountInit();