From cb22bee25aca798133c4b4e253c734f95e1e2881 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Tue, 22 Dec 2020 00:37:07 +0800 Subject: [PATCH] code refactor --- src/views/mobile/transactions/Edit.vue | 44 +++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/views/mobile/transactions/Edit.vue b/src/views/mobile/transactions/Edit.vue index 2cc6f28f..32a26187 100644 --- a/src/views/mobile/transactions/Edit.vue +++ b/src/views/mobile/transactions/Edit.vue @@ -42,11 +42,11 @@ :style="{ fontSize: sourceAmountFontSize + 'px' }" :header="$t(sourceAmountName)" :title="transaction.sourceAmount | currency" - @click="transaction.showSourceAmountSheet = true" + @click="showSourceAmountSheet = true" > @@ -56,12 +56,12 @@ :style="{ fontSize: destinationAmountFontSize + 'px' }" :header="$t('Transfer In Amount')" :title="transaction.destinationAmount | currency" - @click="transaction.showDestinationAmountSheet = true" + @click="showDestinationAmountSheet = true" v-if="transaction.type === $constants.transaction.allTransactionTypes.Transfer" > @@ -72,7 +72,7 @@ link="#" :class="{ 'disabled': !hasAvailableExpenseCategories }" :header="$t('Category')" - @click="transaction.showCategorySheet = true" + @click="showCategorySheet = true" v-if="transaction.type === $constants.transaction.allTransactionTypes.Expense" >
@@ -86,7 +86,7 @@ secondary-key-field="id" secondary-value-field="id" secondary-title-field="name" secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color" :items="allCategories[$constants.category.allCategoryTypes.Expense]" - :show.sync="transaction.showCategorySheet" + :show.sync="showCategorySheet" v-model="transaction.expenseCategory"> @@ -97,7 +97,7 @@ link="#" :class="{ 'disabled': !hasAvailableIncomeCategories }" :header="$t('Category')" - @click="transaction.showCategorySheet = true" + @click="showCategorySheet = true" v-if="transaction.type === $constants.transaction.allTransactionTypes.Income" >
@@ -111,7 +111,7 @@ secondary-key-field="id" secondary-value-field="id" secondary-title-field="name" secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color" :items="allCategories[$constants.category.allCategoryTypes.Income]" - :show.sync="transaction.showCategorySheet" + :show.sync="showCategorySheet" v-model="transaction.incomeCategory"> @@ -122,7 +122,7 @@ link="#" :class="{ 'disabled': !hasAvailableTransferCategories }" :header="$t('Category')" - @click="transaction.showCategorySheet = true" + @click="showCategorySheet = true" v-if="transaction.type === $constants.transaction.allTransactionTypes.Transfer" >
@@ -136,7 +136,7 @@ secondary-key-field="id" secondary-value-field="id" secondary-title-field="name" secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color" :items="allCategories[$constants.category.allCategoryTypes.Transfer]" - :show.sync="transaction.showCategorySheet" + :show.sync="showCategorySheet" v-model="transaction.transferCategory"> @@ -147,7 +147,7 @@ :class="{ 'disabled': !allAccounts.length }" :header="$t(sourceAccountName)" :title="transaction.sourceAccountId | accountName(allAccounts)" - @click="transaction.showSourceAccountSheet = true" + @click="showSourceAccountSheet = true" > @@ -167,7 +167,7 @@ :header="$t('Destination Account')" :title="transaction.destinationAccountId | accountName(allAccounts)" v-if="transaction.type === $constants.transaction.allTransactionTypes.Transfer" - @click="transaction.showDestinationAccountSheet = true" + @click="showDestinationAccountSheet = true" > @@ -232,7 +232,7 @@ export default { return { editTransactionId: null, transaction: { - type: 3, + type: self.$constants.transaction.allTransactionTypes.Expense, unixTime: self.$utilities.getUnixTime(now), time: self.$utilities.formatDate(now, 'YYYY-MM-DDTHH:mm'), expenseCategory: '', @@ -243,19 +243,19 @@ export default { sourceAmount: 0, destinationAmount: 0, tagIds: [], - comment: '', - showSourceAmountSheet: false, - showDestinationAmountSheet: false, - showCategorySheet: false, - showSourceAccountSheet: false, - showDestinationAccountSheet: false + comment: '' }, allAccounts: [], categoriedAccounts: [], allCategories: {}, allTags: [], loading: true, - submitting: false + submitting: false, + showSourceAmountSheet: false, + showDestinationAmountSheet: false, + showCategorySheet: false, + showSourceAccountSheet: false, + showDestinationAccountSheet: false }; }, computed: {