添加信用额度功能:在账户模型中新增信用额度字段,更新相关请求和响应结构,修改账户创建和修改逻辑,更新界面以支持信用额度的显示和编辑。
This commit is contained in:
@@ -113,6 +113,7 @@
|
||||
<div class="nested-list-item-title">
|
||||
<span>{{ account.name }}</span>
|
||||
<div class="item-footer" v-if="account.comment">{{ account.comment }}</div>
|
||||
<div class="item-footer" v-if="account.creditLimit">{{ tt('Available') }}: {{ getRemainingCredit(account) }}</div>
|
||||
</div>
|
||||
<div class="nested-list-item-after" v-if="account.type === AccountType.MultiSubAccounts.type">
|
||||
<span>{{ accountBalance(account) }}</span>
|
||||
@@ -241,7 +242,7 @@ const props = defineProps<{
|
||||
f7router: Router.Router;
|
||||
}>();
|
||||
|
||||
const { tt, getCurrentLanguageTextDirection } = useI18n();
|
||||
const { tt, getCurrentLanguageTextDirection, formatAmountToLocalizedNumeralsWithCurrency } = useI18n();
|
||||
const { showAlert, showToast, routeBackOnError } = useI18nUIComponents();
|
||||
|
||||
const {
|
||||
@@ -288,6 +289,14 @@ const noAvailableAccount = computed<boolean>(() => {
|
||||
}
|
||||
});
|
||||
|
||||
function getRemainingCredit(account: Account): string {
|
||||
if (!account.creditLimit) {
|
||||
return '';
|
||||
}
|
||||
const remaining = account.creditLimit + account.balance; // balance is negative for credit cards
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(remaining, account.currency);
|
||||
}
|
||||
|
||||
function hasAccount(accountCategory: AccountCategory, visibleOnly: boolean): boolean {
|
||||
return accountsStore.hasAccount(accountCategory, visibleOnly);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user