mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-14 23:17:33 +08:00
add confirm dialog when saving a transaction whose amount is 0
This commit is contained in:
@@ -565,6 +565,7 @@ export default {
|
||||
'Transaction Time': 'Transaction Time',
|
||||
'Tags': 'Tags',
|
||||
'Your transaction description (optional)': 'Your transaction description (optional)',
|
||||
'Are you sure you want to save this transaction whose amount is 0?': 'Are you sure you want to save this transaction whose amount is 0?',
|
||||
'Unable to get transaction': 'Unable to get transaction',
|
||||
'Unable to add transaction': 'Unable to add transaction',
|
||||
'Unable to save transaction': 'Unable to save transaction',
|
||||
|
||||
@@ -565,6 +565,7 @@ export default {
|
||||
'Transaction Time': '交易时间',
|
||||
'Tags': '标签',
|
||||
'Your transaction description (optional)': '你的交易描述 (可选)',
|
||||
'Are you sure you want to save this transaction whose amount is 0?': '您确定要保存这个金额为0的交易?',
|
||||
'Unable to get transaction': '无法获取交易',
|
||||
'Unable to add transaction': '无法添加交易',
|
||||
'Unable to save transaction': '无法保存交易',
|
||||
|
||||
@@ -640,9 +640,6 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
self.submitting = true;
|
||||
self.$showLoading(() => self.submitting);
|
||||
|
||||
const submitTransaction = {
|
||||
type: self.transaction.type,
|
||||
time: self.transaction.unixTime,
|
||||
@@ -671,27 +668,40 @@ export default {
|
||||
submitTransaction.id = self.transaction.id;
|
||||
}
|
||||
|
||||
self.$store.dispatch('saveTransaction', {
|
||||
transaction: submitTransaction
|
||||
}).then(() => {
|
||||
self.submitting = false;
|
||||
self.$hideLoading();
|
||||
const doSubmit = function () {
|
||||
self.submitting = true;
|
||||
self.$showLoading(() => self.submitting);
|
||||
|
||||
if (self.mode === 'add') {
|
||||
self.$toast('You have added a new transaction');
|
||||
} else if (self.mode === 'edit') {
|
||||
self.$toast('You have saved this transaction');
|
||||
}
|
||||
self.$store.dispatch('saveTransaction', {
|
||||
transaction: submitTransaction
|
||||
}).then(() => {
|
||||
self.submitting = false;
|
||||
self.$hideLoading();
|
||||
|
||||
router.back();
|
||||
}).catch(error => {
|
||||
self.submitting = false;
|
||||
self.$hideLoading();
|
||||
if (self.mode === 'add') {
|
||||
self.$toast('You have added a new transaction');
|
||||
} else if (self.mode === 'edit') {
|
||||
self.$toast('You have saved this transaction');
|
||||
}
|
||||
|
||||
if (!error.processed) {
|
||||
self.$toast(error.message || error);
|
||||
}
|
||||
});
|
||||
router.back();
|
||||
}).catch(error => {
|
||||
self.submitting = false;
|
||||
self.$hideLoading();
|
||||
|
||||
if (!error.processed) {
|
||||
self.$toast(error.message || error);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (submitTransaction.sourceAmount === 0) {
|
||||
self.$confirm('Are you sure you want to save this transaction whose amount is 0?', () => {
|
||||
doSubmit();
|
||||
});
|
||||
} else {
|
||||
doSubmit();
|
||||
}
|
||||
},
|
||||
autoChangeCommentTextareaSize() {
|
||||
const app = this.$f7;
|
||||
|
||||
Reference in New Issue
Block a user