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