lex-xin 4 місяців тому
батько
коміт
23f581d97e

+ 15 - 3
src/views/order-detail/use-coupons/choice-coupon.tsx

@@ -94,9 +94,21 @@ export default defineComponent({
 
         // 判断使用优惠券之后还有没有其它优惠券可用
         this.list.forEach((item: any) => {
-          const disItem: any = this.orderGoodsType.find((goods: any) => goods.orderType === item.couponCategory)
-          const useLastAmount = disItem ? disItem.price - (usedMap.get(item.couponCategory) || 0) : 0
-          if (!item.checked && (useList.length > 0  || Number(item.useLimit) > useLastAmount)) {
+          let disabled = true
+          if(item.couponCategory === 'UNIVERSAL') {
+            this.orderGoodsType.forEach((goods: any) => {
+              const useLastAmount = goods ? goods.price - (usedMap.get(item.couponCategory) || 0) : 0
+              if(Number(item.useLimit) <= useLastAmount && disabled) {
+                disabled = false
+              }
+            })
+          } else {
+            const disItem: any = this.orderGoodsType.find((goods: any) => goods.orderType === item.couponCategory)
+            const useLastAmount = disItem ? disItem.price - (usedMap.get(item.couponCategory) || 0) : 0
+            disabled = Number(item.useLimit) > useLastAmount
+          }
+          
+          if (!item.checked && (useList.length > 0  || disabled)) {
             item.disabled = true
           } else {
             item.disabled = false

+ 16 - 6
src/views/order-detail/use-coupons/index.tsx

@@ -141,14 +141,24 @@ export default defineComponent({
 
         // 处理可用优惠券是否支付使用
         this.list.forEach((item: any) => {
-          const disItem: any = this.orderGoodsType.find((goods: any) => goods.orderType === item.couponCategory)
-          const useLastAmount = disItem.price || 0
           item.checked = false
-          // 如果使用金额大于订单金额则优惠券不可用
-          if (item.useLimit > useLastAmount) {
-            item.disabled = true
+          if(item.couponCategory === 'UNIVERSAL') {
+            let disabled = true;
+            this.orderGoodsType.forEach((goods: any) => {
+              if(item.useLimit <= goods.price && disabled) {
+                disabled = false
+              }
+            })
+            item.disabled = disabled
           } else {
-            item.disabled = false
+            const disItem: any = this.orderGoodsType.find((goods: any) => goods.orderType === item.couponCategory)
+            const useLastAmount = disItem.price || 0
+            // 如果使用金额大于订单金额则优惠券不可用
+            if (item.useLimit > useLastAmount) {
+              item.disabled = true
+            } else {
+              item.disabled = false
+            }
           }
         })