From fb809790d865c5ec0a107c752f1a8c0be151cb9b Mon Sep 17 00:00:00 2001
From: 石广澎 <shiguangpeng@163.com>
Date: 星期五, 07 三月 2025 11:27:13 +0800
Subject: [PATCH] feat(支付):折扣券最大减免金额支持

---
 pay/scanpay.vue |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/pay/scanpay.vue b/pay/scanpay.vue
index a075456..e3f3f53 100644
--- a/pay/scanpay.vue
+++ b/pay/scanpay.vue
@@ -199,12 +199,14 @@
       couponInfo: {
         id: '',
         discount: 0,
-        thresholdValue: 0
+        thresholdValue: 0,
+        discountMax: 0,
       }, // 浼樻儬鍒稿唴瀹�
       checkCoupon: {
         id: null,
         discount: 0,
-        thresholdValue: 0
+        thresholdValue: 0,
+        discountMax: 0,
       },
     };
   },
@@ -224,7 +226,10 @@
         return parseFloat(num);
       }
       const dis = 1 - parseFloat(this.checkCoupon.discount)
-      const dic = Math.floor(this.$utils.accMul(this.money,100) * dis)
+      let dic = Math.floor(this.$utils.accMul(this.money,100) * dis)
+      if(dic>this.checkCoupon.discountMax){
+        dic = this.checkCoupon.discountMax
+      }
       return this.$utils.fenToYuan(dic).toFixed(2);
     },
     discount() {
@@ -236,7 +241,10 @@
         return parseFloat(num);
       }
       const dis = 1 - parseFloat(this.couponInfo.discount)
-      const dic = Math.floor(this.$utils.accMul(this.money,100) * dis)
+      let dic = Math.floor(this.$utils.accMul(this.money,100) * dis)
+      if(dic>this.couponInfo.discountMax){
+        dic = this.couponInfo.discountMax
+      }
       return this.$utils.fenToYuan(dic).toFixed(2);
     },
     payMoney() {
@@ -428,6 +436,7 @@
               thresholdValue: res.thresholdValue,
               discount: res.discount,
               discountType: res.discountType,
+              discountMax: res.discountMax
             }
           }
         }

--
Gitblit v1.9.1