|
|
@@ -99,6 +99,7 @@ const { t } = useI18n()
|
|
|
const { proxy } = getCurrentInstance()
|
|
|
const Session = proxy?.Session
|
|
|
const $pigeon = proxy?.$pigeon
|
|
|
+const balance = ref(0)
|
|
|
|
|
|
// 响应式数据
|
|
|
const loginValue = ref(null)
|
|
|
@@ -123,8 +124,7 @@ const form = reactive({
|
|
|
})
|
|
|
const amountErrorMessage = ref('')
|
|
|
const setAllAmount = () => {
|
|
|
- const found = loginOptions.value.find(opt => opt.login === Number(loginValue.value))
|
|
|
- form.amount = found.balance
|
|
|
+ form.amount = balance.value
|
|
|
validateAmount()
|
|
|
}
|
|
|
const dialogSuccess = computed(() => dialogCheck.value && dialogVisible.value)
|
|
|
@@ -159,6 +159,7 @@ const rules = {
|
|
|
{
|
|
|
validateFunction: (rule, value, data, callback) => {
|
|
|
console.log(rule, value, data, callback, 2121212);
|
|
|
+ value = Number(value)
|
|
|
if (!value) {
|
|
|
callback(t('vaildate.amount.format'))
|
|
|
} else if (
|
|
|
@@ -173,6 +174,8 @@ const rules = {
|
|
|
amountLimits.maxAmount)
|
|
|
} else if (!/^[0-9]+([.]{1}[0-9]{1,2})?$/.test(value)) {
|
|
|
callback(t('vaildate.amount.format'))
|
|
|
+ } else if (value > balance.value) {
|
|
|
+ callback(t('Label.LoginBalance') + ':$' + balance.value);
|
|
|
}
|
|
|
return true
|
|
|
}
|
|
|
@@ -181,7 +184,7 @@ const rules = {
|
|
|
}
|
|
|
}
|
|
|
function validateAmount() {
|
|
|
- const value = form.amount
|
|
|
+ const value = Number(form.amount)
|
|
|
if (!value) {
|
|
|
amountErrorMessage.value = t('vaildate.amount.format')
|
|
|
return false
|
|
|
@@ -197,6 +200,8 @@ function validateAmount() {
|
|
|
amountLimits.maxAmount
|
|
|
} else if (!/^[0-9]+([.]{1}[0-9]{1,2})?$/.test(value)) {
|
|
|
amountErrorMessage.value = t('vaildate.amount.format')
|
|
|
+ } else if (value > balance.value) {
|
|
|
+ amountErrorMessage.value = t('Label.LoginBalance') + ':$' + balance.value
|
|
|
}
|
|
|
amountErrorMessage.value = ''
|
|
|
return true
|
|
|
@@ -475,6 +480,8 @@ watch(loginValue, (newVal) => {
|
|
|
if (newVal != null) {
|
|
|
step2.value = true
|
|
|
form.withdrawLogin = Number(newVal)
|
|
|
+ const found = loginOptions.value.find(opt => opt.login === Number(newVal))
|
|
|
+ balance.value = found.balance
|
|
|
form.depositLogin = null
|
|
|
form.amount = ''
|
|
|
amountErrorMessage.value = ''
|