fix bug
This commit is contained in:
@@ -32,6 +32,7 @@ import {computed, ref} from 'vue'
|
||||
import type {Rule} from 'ant-design-vue/es/form'
|
||||
import {useWalletStore} from "@/store/walletStore";
|
||||
import { isCashLikeDealMethod, isMainMetalWalletDealMethod, getInsufficientCashWalletMessage, getInsufficientGoldWalletMessage } from '@/utils/productDealMethod'
|
||||
import { getCashWalletBalance } from '@/utils/productAssets'
|
||||
|
||||
export const mobileValidation = (title?: string): Rule => {
|
||||
const label = title ?? 'شماره تلفن'
|
||||
@@ -160,13 +161,14 @@ const checkNumber = async (_rule: Rule, value: number) => {
|
||||
return Promise.reject('استفاده از اعداد اعشاری مجاز نمی باشد')
|
||||
}
|
||||
if (isBuyP){
|
||||
if (!walletCash?.walletInfo?.cash && isCashLikeDealMethod(methodP)){
|
||||
const availableCash = getCashWalletBalance(walletCash?.walletInfo)
|
||||
if (!availableCash && isCashLikeDealMethod(methodP)){
|
||||
return Promise.reject(getInsufficientCashWalletMessage(groupTypeP))
|
||||
}
|
||||
if (!walletCash?.walletInfo?.gold && isMainMetalWalletDealMethod(methodP)){
|
||||
return Promise.reject(getInsufficientGoldWalletMessage(groupTypeP, methodP))
|
||||
}
|
||||
if (priceP * value > walletCash?.walletInfo?.cash && isCashLikeDealMethod(methodP))
|
||||
if (priceP * value > availableCash && isCashLikeDealMethod(methodP))
|
||||
return Promise.reject(getInsufficientCashWalletMessage(groupTypeP))
|
||||
if (amountP * value > walletCash?.walletInfo?.gold && isMainMetalWalletDealMethod(methodP))
|
||||
return Promise.reject(getInsufficientGoldWalletMessage(groupTypeP, methodP))
|
||||
|
||||
Reference in New Issue
Block a user