Browse Source

fix:地区显示映射问题

zhangyong/milestone-20250913-现金管理
lihui 1 month ago
parent
commit
aac3d34173
  1. 30
      src/components/workspace/CashManagement.vue

30
src/components/workspace/CashManagement.vue

@ -132,9 +132,8 @@ const fetchCashData = async () => {
value: resMap.get(m.name) ?? 0
}))
} else {
// 1.
// 1.
const currencyMap = {
// usd: '',
sgd: '新币',
myr: '马币',
hkd: '港币',
@ -143,26 +142,31 @@ const fetchCashData = async () => {
vdn: '越南盾',
};
// 2. market totalSGD
// res使currencyMapkey
const currencyKeys = res.length > 0
? Object.keys(res[0]).filter(key => key !== 'market' && key !== 'totalSGD')
// 2. market totalSGD currencyMap
const currencyKeys =
res.length > 0
? Object.keys(res[0]).filter(
key =>
key !== 'market' &&
key !== 'totalSGD' &&
Object.keys(currencyMap).includes(key.toLowerCase())
)
: Object.keys(currencyMap);
// 3. res0
// 3.
markets.value = currencyKeys.map(currency => {
// keycurrencyMap
const lowerCurrency = currency.toLowerCase();
// res0
const total = res.length > 0
const total =
res.length > 0
? res.reduce((sum, item) => sum + (Number(item[currency]) || 0), 0)
: 0;
return {
// 使res
name: currencyMap[lowerCurrency] || currency.toUpperCase(),
value: total
name: currencyMap[lowerCurrency],
value: total,
};
});
}

Loading…
Cancel
Save