finish transaction adding/editing page

This commit is contained in:
MaysWind
2020-12-26 23:50:46 +08:00
parent b653f7b3d5
commit 9a1094ba76
5 changed files with 126 additions and 5 deletions
+32
View File
@@ -216,6 +216,38 @@ export default {
getTransaction: ({ id }) => {
return axios.get('v1/transactions/get.json?id=' + id);
},
addTransaction: ({ type, categoryId, time, sourceAccountId, destinationAccountId, sourceAmount, destinationAmount, tagIds, comment }) => {
return axios.post('v1/transactions/add.json', {
type,
categoryId,
time,
sourceAccountId,
destinationAccountId,
sourceAmount,
destinationAmount,
tagIds,
comment
});
},
modifyTransaction: ({ id, type, categoryId, time, sourceAccountId, destinationAccountId, sourceAmount, destinationAmount, tagIds, comment }) => {
return axios.post('v1/transactions/modify.json', {
id,
type,
categoryId,
time,
sourceAccountId,
destinationAccountId,
sourceAmount,
destinationAmount,
tagIds,
comment
});
},
deleteTransaction: ({ id }) => {
return axios.post('v1/transactions/delete.json', {
id
});
},
getAllTransactionCategories: ({ type, parentId }) => {
return axios.get('v1/transaction/categories/list.json?type=' + (type || '0') + '&parent_id=' + (parentId || parentId === 0 ? parentId : '-1'));
},
+5
View File
@@ -37,6 +37,10 @@ function formatDate(date, format) {
return moment(date).format(format);
}
function formatUnixTime(unixTime, format) {
return moment.unix(unixTime).format(format);
}
function getUnixTime(date) {
return moment(date).unix();
}
@@ -395,6 +399,7 @@ export default {
isNumber,
isBoolean,
formatDate,
formatUnixTime,
getUnixTime,
copyObjectTo,
copyArrayTo,