changes of boursecu

This commit is contained in:
2026-06-03 19:54:23 +03:30
parent eab6b0df52
commit 198f0a164b
12 changed files with 165 additions and 31 deletions
+8 -6
View File
@@ -31,7 +31,7 @@ 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 } from '@/utils/productDealMethod'
import { isCashLikeDealMethod, getInsufficientCashWalletMessage, getInsufficientGoldWalletMessage } from '@/utils/productDealMethod'
export const mobileValidation = (title?: string) => {
return {len: 11, message: `شماره همراه باید 11 رقم باشد`}
@@ -136,6 +136,7 @@ let methodP = 'cash'
let amountP =0
let isBuyP=true
let NumP=0
let groupTypeP: string | undefined
const checkNumber = async (_rule: Rule, value: number) => {
@@ -147,15 +148,15 @@ const checkNumber = async (_rule: Rule, value: number) => {
}
if (isBuyP){
if (!walletCash?.walletInfo?.cash && isCashLikeDealMethod(methodP)){
return Promise.reject('موجودی کیف پول ناکافی است')
return Promise.reject(getInsufficientCashWalletMessage(groupTypeP))
}
if (!walletCash?.walletInfo?.gold && methodP == 'gold'){
return Promise.reject('موجودی کیف طلا ناکافی است')
return Promise.reject(getInsufficientGoldWalletMessage(groupTypeP))
}
if (priceP * value > walletCash?.walletInfo?.cash && isCashLikeDealMethod(methodP))
return Promise.reject('موجودی کیف پول ناکافی است')
return Promise.reject(getInsufficientCashWalletMessage(groupTypeP))
if (amountP * value > walletCash?.walletInfo?.gold && methodP == 'gold')
return Promise.reject('موجودی کیف طلا ناکافی است')
return Promise.reject(getInsufficientGoldWalletMessage(groupTypeP))
else
return Promise.resolve();
}else {
@@ -166,11 +167,12 @@ if (isBuyP){
}
}
export const justNumber2 = (price: number, method?: string , amount?:number ,isBuy?:boolean) => {
export const justNumber2 = (price: number, method?: string , amount?:number ,isBuy?:boolean, groupType?: string) => {
priceP = price
methodP = method
amountP=amount
isBuyP=isBuy
groupTypeP = groupType
return {
required: true,
validator: checkNumber,