code refactor

This commit is contained in:
MaysWind
2023-07-02 00:51:26 +08:00
parent 4e8f530fbb
commit 9adfd286f9
17 changed files with 139 additions and 67 deletions
+11 -5
View File
@@ -503,9 +503,9 @@ export default {
const account = accountCategory.accounts[i];
if (this.showAccountBalance && account.isAsset) {
account.displayBalance = this.$locale.getDisplayCurrency(account.balance, account.currency);
account.displayBalance = this.getDisplayCurrency(account.balance, account.currency);
} else if (this.showAccountBalance && account.isLiability) {
account.displayBalance = this.$locale.getDisplayCurrency(-account.balance, account.currency);
account.displayBalance = this.getDisplayCurrency(-account.balance, account.currency);
} else {
account.displayBalance = '***';
}
@@ -544,7 +544,7 @@ export default {
totalBalance = totalBalance + '+';
}
accountCategory.displayBalance = this.$locale.getDisplayCurrency(totalBalance, this.defaultCurrency);
accountCategory.displayBalance = this.getDisplayCurrency(totalBalance, this.defaultCurrency);
} else {
accountCategory.displayBalance = '***';
}
@@ -1067,10 +1067,16 @@ export default {
},
getDisplayAmount(amount, hideAmount) {
if (hideAmount) {
return this.$locale.getDisplayCurrency('***');
return this.getDisplayCurrency('***');
}
return this.$locale.getDisplayCurrency(amount);
return this.getDisplayCurrency(amount);
},
getDisplayCurrency(value, currencyCode) {
return this.$locale.getDisplayCurrency(value, currencyCode, {
currencyDisplayMode: this.settingsStore.appSettings.currencyDisplayMode,
enableThousandsSeparator: this.settingsStore.appSettings.thousandsSeparator
});
},
getPrimaryCategoryName(categoryId, allCategories) {
return getTransactionPrimaryCategoryName(categoryId, allCategories);
+9 -3
View File
@@ -842,15 +842,21 @@ export default {
},
getDisplayAmount(amount, currency, hideAmount) {
if (hideAmount) {
return this.$locale.getDisplayCurrency('***', currency);
return this.getDisplayCurrency('***', currency);
}
return this.$locale.getDisplayCurrency(amount, currency);
return this.getDisplayCurrency(amount, currency);
},
getDisplayMonthTotalAmount(amount, currency, symbol, incomplete) {
const displayAmount = this.$locale.getDisplayCurrency(amount, currency);
const displayAmount = this.getDisplayCurrency(amount, currency);
return symbol + displayAmount + (incomplete ? '+' : '');
},
getDisplayCurrency(value, currencyCode) {
return this.$locale.getDisplayCurrency(value, currencyCode, {
currencyDisplayMode: this.settingsStore.appSettings.currencyDisplayMode,
enableThousandsSeparator: this.settingsStore.appSettings.thousandsSeparator
});
},
getTransactionTypeName(type, defaultName) {
switch (type){
case this.allTransactionTypes.ModifyBalance: