mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 17:24:26 +08:00
code refactor
This commit is contained in:
@@ -627,7 +627,7 @@ export const useTransactionsStore = defineStore('transactions', {
|
|||||||
geoLocation: null
|
geoLocation: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
setTransactionSuitableDestinationAmount(transaction, oldValue, newValue, destinationAccountCurrency) {
|
setTransactionSuitableDestinationAmount(transaction, oldValue, newValue) {
|
||||||
const accountsStore = useAccountsStore();
|
const accountsStore = useAccountsStore();
|
||||||
const exchangeRatesStore = useExchangeRatesStore();
|
const exchangeRatesStore = useExchangeRatesStore();
|
||||||
|
|
||||||
@@ -638,7 +638,7 @@ export const useTransactionsStore = defineStore('transactions', {
|
|||||||
const destinationAccount = accountsStore.allAccountsMap[transaction.destinationAccountId];
|
const destinationAccount = accountsStore.allAccountsMap[transaction.destinationAccountId];
|
||||||
|
|
||||||
if (sourceAccount && destinationAccount && sourceAccount.currency !== destinationAccount.currency) {
|
if (sourceAccount && destinationAccount && sourceAccount.currency !== destinationAccount.currency) {
|
||||||
const decimalNumberCount = getCurrencyFraction(destinationAccountCurrency);
|
const decimalNumberCount = getCurrencyFraction(destinationAccount.currency);
|
||||||
const exchangedOldValue = exchangeRatesStore.getExchangedAmount(oldValue, sourceAccount.currency, destinationAccount.currency);
|
const exchangedOldValue = exchangeRatesStore.getExchangedAmount(oldValue, sourceAccount.currency, destinationAccount.currency);
|
||||||
const exchangedNewValue = exchangeRatesStore.getExchangedAmount(newValue, sourceAccount.currency, destinationAccount.currency);
|
const exchangedNewValue = exchangeRatesStore.getExchangedAmount(newValue, sourceAccount.currency, destinationAccount.currency);
|
||||||
|
|
||||||
|
|||||||
@@ -757,7 +757,7 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.transactionsStore.setTransactionSuitableDestinationAmount(this.transaction, oldValue, newValue, this.destinationAccountCurrency);
|
this.transactionsStore.setTransactionSuitableDestinationAmount(this.transaction, oldValue, newValue);
|
||||||
},
|
},
|
||||||
'transaction.destinationAmount': function (newValue) {
|
'transaction.destinationAmount': function (newValue) {
|
||||||
if (this.mode === 'view' || this.loading) {
|
if (this.mode === 'view' || this.loading) {
|
||||||
|
|||||||
@@ -882,7 +882,7 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.transactionsStore.setTransactionSuitableDestinationAmount(this.transaction, oldValue, newValue, this.destinationAccountCurrency);
|
this.transactionsStore.setTransactionSuitableDestinationAmount(this.transaction, oldValue, newValue);
|
||||||
},
|
},
|
||||||
'transaction.destinationAmount': function (newValue) {
|
'transaction.destinationAmount': function (newValue) {
|
||||||
if (this.mode === 'view' || this.loading) {
|
if (this.mode === 'view' || this.loading) {
|
||||||
|
|||||||
Reference in New Issue
Block a user