feat(操作金币页): 更改获取可用余额的接口
This commit is contained in:
parent
99fe4bb5c6
commit
578cb30b5e
@ -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
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user