Ver Fonte

余额不足禁用余额支付

lifanagju_citu há 1 ano atrás
pai
commit
4b4fefefbc
1 ficheiros alterados com 8 adições e 1 exclusões
  1. 8 1
      pages/pay/index.vue

+ 8 - 1
pages/pay/index.vue

@@ -174,7 +174,14 @@
     if (code !== 0) {
       return
     }
-    state.payMethods = getPayMethods(data)
+    const payMethods = getPayMethods(data)
+
+    // 余额不足禁用余额支付
+    if ((state?.orderInfo?.price-0) > (sheep.$store('user')?.userWallet?.balance-0)) {
+      payMethods.forEach(e => { if (e.value === 'wallet') e.disabled = true })
+    }
+    
+    state.payMethods = payMethods
   }
 
   onLoad((options) => {