feat(withdraw): 添加兑换汇率计算功能

- 新增 selectedExchangeRate 变量用于获取钻石兑换汇率
- 更新预览界面显示正确的汇率值
- 将汇率值传递给依赖数组以确保正确更新
This commit is contained in:
JiaJun
2026-07-07 15:53:26 +08:00
parent 77c1d4aa65
commit 8519a36ab7

View File

@@ -108,6 +108,9 @@ export function useWithdrawVm() {
currencyCode,
)
const selectedRate = selectedCurrency.withdrawCoinsPerFiatValue || 1
const selectedExchangeRate =
config.rates.find((rate) => rate.currency === selectedCurrency.code)
?.diamondsPerFiatUnitValue || selectedRate
const sortedPayChannels = useMemo(
() =>
[
@@ -246,7 +249,7 @@ export function useWithdrawVm() {
exchangeRateLabel: t('gameDesktop.withdraw.preview.exchangeRate', {
currency: selectedCurrency.code,
}),
exchangeRateValue: `1:${formatNumber(locale, selectedRate)}`,
exchangeRateValue: `1:${formatNumber(locale, selectedExchangeRate)}`,
convertibleLabel: t('gameDesktop.withdraw.preview.convertible', {
currency: selectedCurrency.code,
}),
@@ -260,6 +263,7 @@ export function useWithdrawVm() {
locale,
selectedCurrency.code,
selectedCurrency.label,
selectedExchangeRate,
selectedRate,
t,
],