更新个人需求清单,新增信用额度和可用额度的标注;在账户列表和交易列表中显示可用额度;修改记账页面的时间选择为默认日期选择器;优化账户余额显示逻辑

This commit is contained in:
2026-04-06 01:16:38 +08:00
parent ba85852543
commit 4ff73b475a
6 changed files with 93 additions and 59 deletions
+10 -1
View File
@@ -276,6 +276,10 @@
</v-btn>
<v-spacer/>
<span class="account-balance ms-2">{{ accountBalance(element, activeSubAccount[element.id]) }}</span>
<small class="text-medium-emphasis ms-2"
v-if="!activeSubAccount[element.id] && element.creditLimit">
{{ tt('Available') }}: {{ getRemainingCredit(element) }}
</small>
</div>
</v-card-text>
</v-card>
@@ -365,7 +369,7 @@ type ClearAllTransactionsDialogType = InstanceType<typeof ClearAllTransactionsDi
const display = useDisplay();
const { tt, getAllDateRanges, getCurrencyName, joinMultiText } = useI18n();
const { tt, getAllDateRanges, getCurrencyName, joinMultiText, formatAmountToLocalizedNumeralsWithCurrency } = useI18n();
const {
loading,
@@ -473,6 +477,11 @@ function hasAccount(accountCategory: AccountCategory): boolean {
return accountsStore.hasAccount(accountCategory, !showHidden.value);
}
function getRemainingCredit(account: Account): string {
const available = (account.creditLimit ?? 0) + account.balance;
return formatAmountToLocalizedNumeralsWithCurrency(available, account.currency);
}
function accountCurrency(account: Account): string | null {
if (account.type === AccountType.SingleAccount.type) {
return getCurrencyName(account.currency);