Browse Source

fix(SCRM-4957): 修改多次选择消费拆分逻辑

john 1 năm trước cách đây
mục cha
commit
5224202890

+ 6 - 4
src/pages/parkingFeeV2/mixins/parkingFeeDiscounts.js

@@ -304,11 +304,12 @@ export default {
         * 当前消费减免用户可用优惠上限:Z
         * 消费减免真实可用优惠: D > Z ? Z : D
         * */
-        const isSelected = this.consume.hasOwnProperty('selected') ? this.consume.selected : this.consume.defaultSelected;
-        const reduceHours = isSelected ? this.reduceHours : 0
-        const otherFee = remainConsumeTime - this.remainPrice - reduceHours
+        const isSelected = this.checkedList.indexOf('reduces') >  -1;
+        // const reduceHours = isSelected ? this.reduceHours : 0
+        const remainHour = this.remainPrice / hourPrice
         // 当前订单的总可用余额: remainConsumeTime 
         const couponCodesLength = couponCodes?.split('#')?.length || 0; // 上限
+        // const maxOneTimeDiscountFee = maxOneTimeDiscountTime * hourPrice;
         // 实际上限
         // remainConsumeTime - this.reduceHours 剩余优惠
         // couponCodesLength - this.reduceHours 剩余上限
@@ -316,7 +317,8 @@ export default {
         // this.maxReduceDiscount = remainConsumeTime - this.reduceHours <= couponCodesLength - this.reduceHours 
         // 转化公式之后
         // this.maxReduceDiscount = remainConsumeTime > couponCodesLength ? couponCodesLength : remainConsumeTime
-        this.maxReduceDiscount = couponCodesLength > defaultDiscountTime ? defaultDiscountTime : couponCodesLength; 
+        // console.log(319, this.remainPrice >= maxOneTimeDiscountFee)
+        this.maxReduceDiscount = couponCodesLength > defaultDiscountTime ? defaultDiscountTime> remainHour > defaultDiscountTime ? defaultDiscountTime : remainHour : remainHour > couponCodesLength?couponCodesLength:remainHour; 
         // this.reduceHours = this.maxReduceDiscount
         !isSelected && (this.reduceHours = this.maxReduceDiscount)
         return

+ 1 - 1
src/store/order/index.js

@@ -1,4 +1,4 @@
-import checkOutQHResponse from "@/api/mockData/checkout.pd19.response.json";
+import checkOutQHResponse from "@/api/mockData/checkout.pd17.response.json";
 import { checkOut,calculateDiscount,ordersAndPrepay,currentUnlicensedPlate,unlicensedCarCheckIn,unlicensedCarCheckout } from '@/api/parking';
 import state from "@/store/order/state";
 import mutations from "@/store/order/mutations";