diff --git a/src/locales/en.js b/src/locales/en.js index 48e41491..f1159596 100644 --- a/src/locales/en.js +++ b/src/locales/en.js @@ -626,6 +626,8 @@ export default { 'No transaction data': 'No transaction data', 'Are you sure you want to delete this transaction?': 'Are you sure you want to delete this transaction?', 'Unable to delete this transaction': 'Unable to delete this transaction', + 'Total Expense': 'Total Expense', + 'Total Income': 'Total Income', 'Expense Chart': 'Expense Chart', 'Expense By Account': 'Expense By Account', 'Expense By Primary Category': 'Expense By Primary Category', diff --git a/src/locales/zh_Hans.js b/src/locales/zh_Hans.js index f60ec373..949fc917 100644 --- a/src/locales/zh_Hans.js +++ b/src/locales/zh_Hans.js @@ -626,6 +626,8 @@ export default { 'No transaction data': '没有交易数据', 'Are you sure you want to delete this transaction?': '您确定要删除该交易?', 'Unable to delete this transaction': '无法删除该交易', + 'Total Expense': '总支出', + 'Total Income': '总收入', 'Expense Chart': '支出图表', 'Expense By Account': '账号支出', 'Expense By Primary Category': '一级分类支出', diff --git a/src/views/mobile/statistics/Transaction.vue b/src/views/mobile/statistics/Transaction.vue index 56c13c44..2a4a0118 100644 --- a/src/views/mobile/statistics/Transaction.vue +++ b/src/views/mobile/statistics/Transaction.vue @@ -97,8 +97,19 @@ - - + + + + +
{{ $t('Total Expense') }}
+
{{ $t('Total Income') }}
+
+ {{ statisticsData.totalAmount | currency(defaultCurrency) }} +
+
+
@@ -329,7 +340,7 @@ export default { } } - const allStatisticsData = []; + const allStatisticsItems = []; for (let id in combinedData) { if (!Object.prototype.hasOwnProperty.call(combinedData, id)) { @@ -339,14 +350,17 @@ export default { const data = combinedData[id]; data.percent = data.totalAmount * 100 / allAmount; - allStatisticsData.push(data); + allStatisticsItems.push(data); } - allStatisticsData.sort(function (data1, data2) { + allStatisticsItems.sort(function (data1, data2) { return data2.totalAmount - data1.totalAmount; }); - return allStatisticsData; + return { + totalAmount: allAmount, + items: allStatisticsItems + }; }, chartData() { const self = this; @@ -359,8 +373,8 @@ export default { const allData = []; - for (let i = 0; i < this.statisticsData.length; i++) { - const data = this.statisticsData[i]; + for (let i = 0; i < this.statisticsData.items.length; i++) { + const data = this.statisticsData.items[i]; allData.push({ name: data.name, @@ -657,11 +671,22 @@ export default {