feat(操作金币页): 更改获取可用余额的接口

This commit is contained in:
hzj 2025-11-19 10:29:50 +08:00
parent 99fe4bb5c6
commit 578cb30b5e

View File

@ -35,7 +35,7 @@
>
<span v-if="loading" class="loading-text">{{ t('loading') }}...</span>
<span v-else style="font-weight: 700; color: #333; font-size: 1.1em"
>${{ availableIncome }}</span
>${{ availableIncome?.availableBalance }}</span
>
</div>
</div>
@ -748,6 +748,7 @@ import { setDocumentDirection } from '@/locales/i18n'
import { useIdentityStore } from '@/stores/identity.js'
import {
apiGetBankBalance, //
getBankBalance,
apiExchange, //
apiTransfer, //
@ -768,7 +769,7 @@ const identityStore = useIdentityStore()
//
locale.value && setDocumentDirection(locale.value)
const availableIncome = ref('')
const availableIncome = ref({})
const selectedCoin = ref(null)
const selectedExchangeOption = ref(null)
const activeAction = ref(route.query.activeAction || 'Exchange')
@ -893,18 +894,22 @@ const initializePayee = () => {
const fetchBankBalance = async () => {
loading.value = true
try {
const response = await getBankBalance()
let salaryType =
identityStore.identity == 'BD_LEADER'
? 'BD_LEADER_SALARY'
: identityStore.identity == 'BD'
? 'BD_SALARY'
: ''
if (response.status && typeof response.body === 'number') {
availableIncome.value = response.body.toFixed(2) || '0.00'
} else {
availableIncome.value = '-'
try {
const response = await apiGetBankBalance(salaryType)
if (response.status && response.body) {
availableIncome.value = response.body || {}
}
} catch (error) {
console.error('Failed to fetch bank balance:', error)
availableIncome.value = '-'
showError(error.response?.errorMsg || t('failed_to_load_balance'))
showError(t('failed_to_load_balance'))
} finally {
loading.value = false
}