fix some bugs

This commit is contained in:
2026-07-19 21:49:31 +03:30
parent 37d86ba36e
commit 0106c94d24
3 changed files with 56 additions and 4 deletions
@@ -10,9 +10,11 @@ import { useInfiniteScroll } from '@vueuse/core'
import { message } from 'ant-design-vue'
import type { Card } from '@/models/wallet'
import { useUserStore } from '@/store/userStore'
import { useSettingsStore } from '@/store/settingsStore'
import { useDesktopBreakpoint } from '@/layouts/composables/useAppLayout'
import type { TableEngineInput, TableOutput } from '@/models/table'
import { getTransactionTable, getTransactionTable2 } from '@/api/transaction'
import { formatWalletMinHint, parseWalletMinRial } from '@/utils/walletMinAmount'
export interface WalletPageContext {
isDeposit: ReturnType<typeof ref<boolean>>
@@ -30,6 +32,8 @@ export interface WalletPageContext {
withdrawItems: ReturnType<typeof ref<Transaction[]>>
mobileDepositScrollEl: ReturnType<typeof ref<HTMLElement | null>>
desktopDepositScrollEl: ReturnType<typeof ref<HTMLElement | null>>
minWithdrawHint: ReturnType<typeof computed<string>>
minDepositHint: ReturnType<typeof computed<string>>
usePriceWithoutType: typeof usePriceWithoutType
usePrice: typeof usePrice
setIsDeposit: (val: boolean) => void
@@ -48,6 +52,7 @@ export function useWalletPage() {
const isDeposit = ref(true)
const walletStore = useWalletStore()
const userStore = useUserStore()
const settingsStore = useSettingsStore()
const isDesktop = useDesktopBreakpoint()
const showAddCard = ref(false)
const chargeAccountModal = ref(false)
@@ -87,6 +92,19 @@ export function useWalletPage() {
const unitCalculator = computed(() => (walletStore?.walletInfo?.cash ?? 0) / 100)
const minWithdrawAmount = computed(() =>
parseWalletMinRial(settingsStore.getSettingByKey('min_withdraw')),
)
const minDepositAmount = computed(() =>
parseWalletMinRial(settingsStore.getSettingByKey('min_deposit')),
)
const minWithdrawHint = computed(() =>
formatWalletMinHint('withdraw', minWithdrawAmount.value),
)
const minDepositHint = computed(() =>
formatWalletMinHint('deposit', minDepositAmount.value),
)
const disableButton = computed(() => {
if (loading.value) return true
if (walletStore?.walletInfo?.cash && !isDeposit.value) {
@@ -95,13 +113,16 @@ export function useWalletPage() {
walletStore?.walletInfo?.cash <= 0 ||
walletStore?.walletInfo?.cash < parseInt(String(form.value?.value)) ||
isNaN(parseInt(String(form.value?.value))) ||
parseInt(String(form.value?.value)) < 1000000
parseInt(String(form.value?.value)) < minWithdrawAmount.value
)
}
return true
}
if (isDeposit.value) {
return isNaN(parseInt(String(form.value?.value))) || parseInt(String(form.value?.value)) < 1000000
return (
isNaN(parseInt(String(form.value?.value))) ||
parseInt(String(form.value?.value)) < minDepositAmount.value
)
}
return false
})
@@ -267,6 +288,8 @@ export function useWalletPage() {
withdrawItems,
mobileDepositScrollEl,
desktopDepositScrollEl,
minWithdrawHint,
minDepositHint,
usePriceWithoutType,
usePrice,
setIsDeposit,