code refactor

This commit is contained in:
MaysWind
2025-08-29 00:43:34 +08:00
parent 8f6adaa417
commit b79ffafaee
7 changed files with 49 additions and 54 deletions
+3 -3
View File
@@ -185,6 +185,7 @@ const customExchangeRateToDelete = ref<LocalizedLatestExchangeRate | null>(null)
const showDeleteActionSheet = ref<boolean>(false);
const textDirection = computed<TextDirection>(() => getCurrentLanguageTextDirection());
const numeralSystem = computed<NumeralSystem>(() => getCurrentNumeralSystemType());
const displayBaseAmount = computed<string>(() => formatAmountToLocalizedNumerals(baseAmount.value, baseCurrency.value));
const baseAmountFontSizeClass = computed<string>(() => {
if (baseAmount.value >= 100000000 || baseAmount.value <= -100000000) {
@@ -275,13 +276,12 @@ function remove(customExchangeRate: LocalizedLatestExchangeRate | null, confirm:
}
function getFinalConvertedAmount(toExchangeRate: LocalizedLatestExchangeRate, displayLocalizedDigits: boolean): string {
const numeralSystem = getCurrentNumeralSystemType();
const fromExchangeRate = exchangeRatesStore.latestExchangeRateMap[baseCurrency.value];
const exchangeRateAmount = getConvertedAmount(baseAmount.value / 100, fromExchangeRate, toExchangeRate);
if (!exchangeRateAmount) {
if (displayLocalizedDigits) {
return numeralSystem.digitZero;
return numeralSystem.value.digitZero;
} else {
return NumeralSystem.WesternArabicNumerals.digitZero;
}
@@ -290,7 +290,7 @@ function getFinalConvertedAmount(toExchangeRate: LocalizedLatestExchangeRate, di
let ret = formatExchangeRateAmountToWesternArabicNumerals(exchangeRateAmount);
if (displayLocalizedDigits) {
ret = numeralSystem.replaceWesternArabicDigitsToLocalizedDigits(ret);
ret = numeralSystem.value.replaceWesternArabicDigitsToLocalizedDigits(ret);
}
return ret;