zhb 1 mesiac pred
rodič
commit
0622e383d4
1 zmenil súbory, kde vykonal 13 pridanie a 5 odobranie
  1. 13 5
      pages/customer/withdrawal.vue

+ 13 - 5
pages/customer/withdrawal.vue

@@ -933,6 +933,10 @@ const rules = computed(() => ({
             );
             return false;
           }
+          if (value > loginAmount.value) {
+            callback(t('Label.LoginBalance') + ':$' + loginAmount.value);
+            return false;
+          }
           if (/^[0-9]+([.]{1}[0-9]{1,2})?$/.test(value)) {
             return true;
           } else {
@@ -1006,7 +1010,7 @@ const rules = computed(() => ({
 // 验证金额
 const amountErrorMessage = ref('')
 const validateAmount = () => {
-  const amount = form.amount
+  const amount = Number(form.amount)
   if (!amount && amount !== 0) {
     amountErrorMessage.value = t('vaildate.amount.format')
     return false
@@ -1024,6 +1028,10 @@ const validateAmount = () => {
     amountErrorMessage.value = t('vaildate.amount.format')
     return false
   }
+  if (amount > loginAmount.value) {
+    amountErrorMessage.value = t('Label.LoginBalance') + ':$' + loginAmount.value
+    return false
+  }
   amountErrorMessage.value = ''
   return true
 }
@@ -2008,11 +2016,9 @@ const channelList = computed(() => userStore.channelList)
 const channelListOptions = ref([])
 const channelId = ref(null)
 const loading = ref(false)
+const loginAmount = ref(0)
 const setAllAmount = () => {
-  const found = loginOptions.value.find(opt => opt.login === Number(loginValue.value))
-  console.log(found, 1212);
-
-  form.amount = parseInt(found.balance)
+  form.amount = loginAmount.value
   validateAmount()
 }
 const allTabs = computed(() => {
@@ -2088,6 +2094,8 @@ watch(loginValue, (newVal) => {
   if (newVal) {
     // const found = loginOptions.value.find(opt => opt.login === Number(newVal))
     // loginValueDoc.value = found.label
+    const found = loginOptions.value.find(opt => opt.login === Number(loginValue.value))
+    loginAmount.value = found.balance ? Number(found.balance) : 0
     showTable();
   }
 });