diff --git a/src/views/BDCenter/availableIncome.vue b/src/views/BDCenter/availableIncome.vue index 785a7e6..d38d507 100644 --- a/src/views/BDCenter/availableIncome.vue +++ b/src/views/BDCenter/availableIncome.vue @@ -35,7 +35,7 @@ > {{ t('loading') }}... ${{ availableIncome }}${{ availableIncome?.availableBalance }} @@ -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 }