fix bug of register page

This commit is contained in:
2026-06-06 17:43:46 +03:30
32 changed files with 823 additions and 464 deletions
+18 -5
View File
@@ -31,10 +31,23 @@ export function inputLenRules(len: number, title?: string) {
import {computed, ref} from 'vue'
import type {Rule} from 'ant-design-vue/es/form'
import {useWalletStore} from "@/store/walletStore";
import { isCashLikeDealMethod, getInsufficientCashWalletMessage, getInsufficientGoldWalletMessage } from '@/utils/productDealMethod'
import { isCashLikeDealMethod, isMainMetalWalletDealMethod, getInsufficientCashWalletMessage, getInsufficientGoldWalletMessage } from '@/utils/productDealMethod'
export const mobileValidation = (title?: string) => {
return {len: 11, message: `شماره همراه باید 11 رقم باشد`}
export const mobileValidation = (title?: string): Rule => {
const label = title ?? 'شماره تلفن'
return {
validator: (_rule, value) => {
const normalized = String(value ?? '').trim()
if (!normalized) {
return Promise.resolve()
}
if (!/^09\d{9}$/.test(normalized)) {
return Promise.reject(`${label} باید با 09 شروع شود و 11 رقم باشد`)
}
return Promise.resolve()
},
trigger: ['change', 'blur'],
}
}
export const required = (title?: string) => {
@@ -150,12 +163,12 @@ if (isBuyP){
if (!walletCash?.walletInfo?.cash && isCashLikeDealMethod(methodP)){
return Promise.reject(getInsufficientCashWalletMessage(groupTypeP))
}
if (!walletCash?.walletInfo?.gold && methodP == 'gold'){
if (!walletCash?.walletInfo?.gold && isMainMetalWalletDealMethod(methodP)){
return Promise.reject(getInsufficientGoldWalletMessage(groupTypeP))
}
if (priceP * value > walletCash?.walletInfo?.cash && isCashLikeDealMethod(methodP))
return Promise.reject(getInsufficientCashWalletMessage(groupTypeP))
if (amountP * value > walletCash?.walletInfo?.gold && methodP == 'gold')
if (amountP * value > walletCash?.walletInfo?.gold && isMainMetalWalletDealMethod(methodP))
return Promise.reject(getInsufficientGoldWalletMessage(groupTypeP))
else
return Promise.resolve();