feat: Refactor transaction handling and add new features
- Updated ReasonGroupList.vue to modify classify button behavior for adding new classifications. - Refactored TransactionDetail.vue to integrate PopupContainer and enhance transaction detail display. - Improved TransactionDetailDialog.vue with updated classify button functionality. - Simplified BalanceView.vue by removing manual entry button. - Enhanced PeriodicRecord.vue to update classify button interactions. - Removed unused add transaction dialog from TransactionsRecord.vue. - Added new API endpoints in TransactionRecordController for parsing transactions and handling offsets. - Introduced BillForm.vue and ManualBillAdd.vue for streamlined bill entry. - Implemented OneLineBillAdd.vue for intelligent transaction parsing. - Created GlobalAddBill.vue for a unified bill addition interface.
This commit is contained in:
50
Web/src/components/Bill/ManualBillAdd.vue
Normal file
50
Web/src/components/Bill/ManualBillAdd.vue
Normal file
@@ -0,0 +1,50 @@
|
||||
<template>
|
||||
<div class="manual-bill-add">
|
||||
<BillForm
|
||||
ref="billFormRef"
|
||||
:loading="saving"
|
||||
@submit="handleSave"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { showToast } from 'vant'
|
||||
import { createTransaction } from '@/api/transactionRecord'
|
||||
import BillForm from './BillForm.vue'
|
||||
|
||||
const emit = defineEmits(['success'])
|
||||
|
||||
const saving = ref(false)
|
||||
const billFormRef = ref(null)
|
||||
|
||||
const handleSave = async (payload) => {
|
||||
saving.value = true
|
||||
try {
|
||||
const res = await createTransaction(payload)
|
||||
|
||||
if (!res.success) {
|
||||
throw new Error(res.message || '保存失败')
|
||||
}
|
||||
|
||||
showToast('保存成功')
|
||||
// 重置表单
|
||||
if (billFormRef.value) {
|
||||
billFormRef.value.reset()
|
||||
}
|
||||
emit('success')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
showToast('保存失败: ' + err.message)
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.manual-bill-add {
|
||||
/* padding-top: 10px; */
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user