Răsfoiți Sursa

Merge pull request #584 from John-Hong/John/release-3.17.0/SCRM-7245

feat(SCRM-7245): 优化超大数量的电子券交互
John-Hong 10 luni în urmă
părinte
comite
c34b35035c
1 a modificat fișierele cu 19 adăugiri și 9 ștergeri
  1. 19 9
      src/pages/parkingFeeV2/mixins/parkingFeeCoupon.js

+ 19 - 9
src/pages/parkingFeeV2/mixins/parkingFeeCoupon.js

@@ -73,6 +73,9 @@ export default {
             this.rowData = Array.from({length: this.rowData.length + 10}, (_, index) => index);
           }
         }
+        setTimeout(() => {
+          this.newGroupedCouponData()
+        }, 100)
       }
     },
     pageInit() {
@@ -253,7 +256,7 @@ export default {
       }
       // 如果杭州、福州的使用券打到上限则不自动计算其余券是否可选 +天津 20240911
       
-      if (this.checkedCouponList.length >= this.remainCoupons && ([0, 1, 3, 4, 2, 5, 6, 7, 8, 9, 10].indexOf(parkMallCode) > -1)) {
+      if (this.checkedCouponList.length >= this.remainCoupons && ([0, 1, 3, 4, 2, 5, 6, 7, 8, 9, 10].indexOf(this.parkMallCode) > -1)) {
 
       // if (this.checkedCouponList.length >= this.remainCoupons && (this.parkMallCode === 6 || this.parkMallCode === 2 || this.parkMallCode === 8 || this.parkMallCode === 7 || this.parkMallCode === 9 || this.parkMallCode === 5)) {
         return
@@ -263,14 +266,22 @@ export default {
       const {superposition, limitCountPerOrder = 0, name} = item;
       switch (superposition) {
         case '1': // 不可叠加
-          couponList = couponList.map((elm, i) => {
-            elm.disabled = i !== index
-            return elm;
+          this.rowData.forEach((elmIndex) => {
+            const elm = {
+              ...this.couponList[elmIndex]
+            }
+            this.$set(this.couponList, elmIndex , {
+              ...elm,
+              disabled:  elmIndex !== index
+            })
           })
-          break;
+        break;
         case '2': // 同类型可叠加
           // 找到
-          couponList = couponList.map((elm, i) => {
+          this.rowData.map((elmIndex) => {
+            const elm = {
+              ...this.couponList[elmIndex]
+            }
             // 只有 status === 'available' 的才会赋值为 false
             elm.disabled = elm?.status !== 'available' || !moment().isBefore(elm.expirationDate); // 默认可选
             // 找到所以 superposition === 2 的同类型的券
@@ -291,11 +302,10 @@ export default {
             } else {
               elm.disabled = true; // 非同批次的优惠券设置为不可选择
             }
-            return elm
+            this.$set(this.couponList, elmIndex , {...elm})
           })
-          break;
+        break;
       }
-      this.couponList = [...couponList];
     },
     // 根据电子券规则判断是否可选
     isDisabledByRule(item, index, showMsg) {