diff --git a/src/consts/transaction.js b/src/consts/transaction.js
new file mode 100644
index 00000000..c8d930ba
--- /dev/null
+++ b/src/consts/transaction.js
@@ -0,0 +1,10 @@
+const allTransactionTypes = {
+ ModifyBalance: 1,
+ Income: 2,
+ Expense: 3,
+ Transfer: 4
+};
+
+export default {
+ allTransactionTypes: allTransactionTypes,
+};
diff --git a/src/lib/services.js b/src/lib/services.js
index c084526a..63fda984 100644
--- a/src/lib/services.js
+++ b/src/lib/services.js
@@ -213,6 +213,9 @@ export default {
id
});
},
+ getTransaction: ({ id }) => {
+ return axios.get('v1/transactions/get.json?id=' + id);
+ },
getAllTransactionCategories: ({ type, parentId }) => {
return axios.get('v1/transaction/categories/list.json?type=' + (type || '0') + '&parent_id=' + (parentId || parentId === 0 ? parentId : '-1'));
},
diff --git a/src/lib/utils.js b/src/lib/utils.js
index 681539b4..c8be80c5 100644
--- a/src/lib/utils.js
+++ b/src/lib/utils.js
@@ -37,6 +37,10 @@ function formatDate(date, format) {
return moment(date).format(format);
}
+function getUnixTime(date) {
+ return moment(date).unix();
+}
+
function copyObjectTo(fromObject, toObject) {
if (!isObject(fromObject)) {
return toObject;
@@ -347,6 +351,7 @@ export default {
isNumber,
isBoolean,
formatDate,
+ getUnixTime,
copyObjectTo,
copyArrayTo,
appendThousandsSeparator,
diff --git a/src/locales/en.js b/src/locales/en.js
index 15f8e8f8..df66d4fb 100644
--- a/src/locales/en.js
+++ b/src/locales/en.js
@@ -509,6 +509,7 @@ export default {
'Transaction Time': 'Transaction Time',
'Tags': 'Tags',
'Your transaction description (optional)': 'Your transaction description (optional)',
+ 'Unable to get transaction': 'Unable to get transaction',
'User Profile': 'User Profile',
'Language': 'Language',
'Auto Update Exchange Rates Data': 'Auto Update Exchange Rates Data',
diff --git a/src/locales/zh_Hans.js b/src/locales/zh_Hans.js
index 2a9686dd..c9033d77 100644
--- a/src/locales/zh_Hans.js
+++ b/src/locales/zh_Hans.js
@@ -509,6 +509,7 @@ export default {
'Transaction Time': '交易时间',
'Tags': '标签',
'Your transaction description (optional)': '你的交易描述 (可选)',
+ 'Unable to get transaction': '无法获取交易',
'User Profile': '用户信息',
'Language': '语言',
'Auto Update Exchange Rates Data': '自动更新汇率数据',
diff --git a/src/mobile-main.js b/src/mobile-main.js
index d26fce8d..d1f8d84e 100644
--- a/src/mobile-main.js
+++ b/src/mobile-main.js
@@ -20,6 +20,7 @@ import currency from './consts/currency.js';
import colors from './consts/color.js';
import icons from './consts/icon.js';
import account from './consts/account.js';
+import transaction from './consts/transaction.js';
import category from './consts/category.js';
import licenses from './consts/licenses.js';
import version from './lib/version.js';
@@ -62,6 +63,7 @@ Vue.prototype.$constants = {
colors: colors,
icons: icons,
account: account,
+ transaction: transaction,
category: category,
};
diff --git a/src/router/mobile.js b/src/router/mobile.js
index 66d499b9..d58b51b1 100644
--- a/src/router/mobile.js
+++ b/src/router/mobile.js
@@ -6,7 +6,7 @@ import SignUpPage from '../views/mobile/Signup.vue';
import UnlockPage from '../views/mobile/Unlock.vue';
import TransactionDetailPage from '../views/mobile/transactions/Detail.vue';
-import TransactionNewPage from '../views/mobile/transactions/New.vue';
+import TransactionEditPage from '../views/mobile/transactions/Edit.vue';
import AccountListPage from '../views/mobile/accounts/List.vue';
import AccountEditPage from '../views/mobile/accounts/Edit.vue';
@@ -140,8 +140,13 @@ const routes = [
beforeEnter: checkLogin
},
{
- path: '/transaction/new',
- component: TransactionNewPage,
+ path: '/transaction/add',
+ component: TransactionEditPage,
+ beforeEnter: checkLogin
+ },
+ {
+ path: '/transaction/edit',
+ component: TransactionEditPage,
beforeEnter: checkLogin
},
{
diff --git a/src/views/mobile/Home.vue b/src/views/mobile/Home.vue
index 982891aa..a785a5aa 100644
--- a/src/views/mobile/Home.vue
+++ b/src/views/mobile/Home.vue
@@ -17,7 +17,7 @@
{{ $t('Accounts') }}
-
+
diff --git a/src/views/mobile/transactions/Edit.vue b/src/views/mobile/transactions/Edit.vue
new file mode 100644
index 00000000..4f6bf664
--- /dev/null
+++ b/src/views/mobile/transactions/Edit.vue
@@ -0,0 +1,402 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/mobile/transactions/New.vue b/src/views/mobile/transactions/New.vue
deleted file mode 100644
index a68041a4..00000000
--- a/src/views/mobile/transactions/New.vue
+++ /dev/null
@@ -1,317 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-