|
@@ -38,6 +38,11 @@ const bankColumns = [
|
|
|
{ label: 'NAGAD', value: 'NAGAD' },
|
|
|
{ label: 'ROCKET', value: 'ROCKET' },
|
|
|
]
|
|
|
+
|
|
|
+// 提现限制
|
|
|
+const withdrawMinAmount = 300
|
|
|
+const withdrawMaxAmount = 20000
|
|
|
+
|
|
|
const loading = ref<boolean>(false)
|
|
|
async function submit() {
|
|
|
if (!formData.value.bank) {
|
|
@@ -56,6 +61,32 @@ async function submit() {
|
|
|
toast.info(t('wallet.withdraw.error.amount'))
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+ // 校验金额是否为有效数字
|
|
|
+ const amount = Number(formData.value.amount)
|
|
|
+ if (Number.isNaN(amount)) {
|
|
|
+ toast.info(t('wallet.withdraw.error.amount'))
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验金额范围
|
|
|
+ if (amount < withdrawMinAmount) {
|
|
|
+ toast.info(t('wallet.withdraw.notes.4', [formatNumber(withdrawMinAmount), formatNumber(withdrawMaxAmount)]))
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (amount > withdrawMaxAmount) {
|
|
|
+ toast.info(t('wallet.withdraw.notes.4', [formatNumber(withdrawMinAmount), formatNumber(withdrawMaxAmount)]))
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验余额是否充足
|
|
|
+ const balance = Number(queryParams.value.balance)
|
|
|
+ if (amount > balance) {
|
|
|
+ toast.info(t('wallet.withdraw.error.amount'))
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
loading.value = true
|
|
|
try {
|
|
|
const res = await withdrawAdd({ ...formData.value, accountType: queryParams.value.type, channel: formData.value.bank })
|
|
@@ -159,6 +190,7 @@ onLoad((options) => {
|
|
|
:placeholder="t('wallet.withdraw.form.amount')"
|
|
|
no-border
|
|
|
custom-class="flex-1 bandhu-auth-input-field"
|
|
|
+ type="digit"
|
|
|
/>
|
|
|
<wd-button
|
|
|
type="error"
|
|
@@ -183,7 +215,7 @@ onLoad((options) => {
|
|
|
<br>
|
|
|
{{ $t('wallet.withdraw.notes.3') }}
|
|
|
<br>
|
|
|
- {{ t('wallet.withdraw.notes.4', ['300', '20,000']) }}
|
|
|
+ {{ t('wallet.withdraw.notes.4', [formatNumber(withdrawMinAmount), formatNumber(withdrawMaxAmount)]) }}
|
|
|
<br>
|
|
|
{{ t('wallet.withdraw.notes.5', [withdrawRate]) }}
|
|
|
</view>
|