diff --git a/frontend/src/views/Invoices/index.vue b/frontend/src/views/Invoices/index.vue
index f49f761..4cda6e3 100644
--- a/frontend/src/views/Invoices/index.vue
+++ b/frontend/src/views/Invoices/index.vue
@@ -28,30 +28,43 @@
-
-
-
-
-
-
-
-
-
-
-
-
@@ -79,8 +92,11 @@
}"
:row-style="getRowStyle"
>
-
-
+
@@ -90,7 +106,11 @@
-
+
{{ row.status_display }}
@@ -103,10 +123,16 @@
- {{ t('invoices.actions.view') }}
+ {{
+ t('invoices.actions.view')
+ }}
- {{ t('invoices.actions.upload') }}
- {{ t('invoices.actions.reject') }}
+ {{
+ t('invoices.actions.upload')
+ }}
+ {{
+ t('invoices.actions.reject')
+ }}
@@ -114,18 +140,32 @@
-
+
-
+
@@ -134,7 +174,12 @@
-
+
@@ -161,7 +206,14 @@ import { Document, Warning, CircleCheck, CircleClose } from '@element-plus/icons
import { ElMessage } from 'element-plus'
import UploadInvoiceDialog from './components/UploadInvoiceDialog.vue'
import RejectInvoiceDialog from './components/RejectInvoiceDialog.vue'
-import { getInvoices, getInvoiceSummary, uploadInvoice, rejectInvoice, issueInvoice, type Invoice } from '@/api/invoice'
+import {
+ getInvoices,
+ getInvoiceSummary,
+ uploadInvoice,
+ rejectInvoice,
+ issueInvoice,
+ type Invoice
+} from '@/api/invoice'
import { formatDateTime } from '@/utils/date'
const { t } = useI18n()
@@ -174,7 +226,6 @@ const stats = ref([
{ label: '已驳回', value: '0', type: 'rejected', icon: 'error', key: 'rejected_count' }
])
-
const filterForm = reactive({
keyword: '',
status: '',
@@ -198,7 +249,6 @@ const getRowStyle = ({ rowIndex }: { rowIndex: number }) => {
}
const fetchSummary = async () => {
-
try {
const res = await getInvoiceSummary()
if (res.code === '000000' && res.data) {
@@ -209,7 +259,6 @@ const fetchSummary = async () => {
}
})
}
-
} catch (error) {
console.error('Fetch summary error:', error)
}
@@ -230,15 +279,13 @@ const fetchData = async () => {
}
const res = await getInvoices(params)
if (res.code === '000000') {
- fetchSummary()
+ fetchSummary()
res.data.invoices.forEach((item: any) => {
item.created_at = formatDateTime(item.created_at)
})
tableData.value = res.data.invoices
totalCount.value = res.data.total_count
}
-
-
} catch (error: any) {
console.error('Fetch invoices error:', error)
ElMessage.error(error.backendMessage || t('invoices.messages.fetchError'))
@@ -249,7 +296,6 @@ const fetchData = async () => {
onMounted(() => {
fetchData()
-
})
const createForm = reactive({
@@ -295,7 +341,7 @@ const handleUploadSubmit = async (data: any) => {
try {
const formData = new FormData()
formData.append('invoice_no', currentRow.value.id)
- if (data.fileList && data.fileList.length > 0) {
+ if (data.fileList && data.fileList.length > 0) {
const file = data.fileList[0].raw
console.log('File to upload:', file)
formData.append('file', file)
@@ -308,15 +354,17 @@ const handleUploadSubmit = async (data: any) => {
// 1. 上传文件
const uploadRes = await uploadInvoice(formData)
console.log('Upload response:', uploadRes)
-
+
if (uploadRes.code === '000000' && (uploadRes.data?.file_url || uploadRes.data?.url)) {
const fileUrl = uploadRes.data.file_url || uploadRes.data.url
// 2. 调用开票接口
const issueRes = await issueInvoice(currentRow.value.id, {
invoice_file_url: fileUrl,
- issued_at: data.issued_at ? new Date(data.issued_at).toISOString().replace(/\.\d{3}/, '') : ''
+ issued_at: data.issued_at
+ ? new Date(data.issued_at).toISOString().replace(/\.\d{3}/, '')
+ : ''
})
-
+
if (issueRes.code === '000000') {
ElMessage.success(t('invoices.messages.uploadSuccess'))
uploadVisible.value = false
@@ -342,7 +390,8 @@ const handleReject = (row: any) => {
const handleRejectSubmit = async (data: any) => {
if (!currentRow.value?.id) return
try {
- const reasonText = data.reason === 'other' ? data.suggestion : t(`invoices.dialog.reasons.${data.reason}`)
+ const reasonText =
+ data.reason === 'other' ? data.suggestion : t(`invoices.dialog.reasons.${data.reason}`)
const res = await rejectInvoice(currentRow.value.id, {
reject_reason: reasonText,
suggestion: data.suggestion
@@ -376,7 +425,6 @@ const handleCurrentChange = (val: number) => {
min-height: calc(100vh - 80px);
}
-
.stats-row {
display: grid;
grid-template-columns: repeat(4, 1fr);
@@ -439,7 +487,6 @@ const handleCurrentChange = (val: number) => {
}
}
-
.filter-section {
background: var(--app-content-bg);
padding: 16px 24px;
@@ -447,7 +494,15 @@ const handleCurrentChange = (val: number) => {
margin-bottom: 24px;
display: flex;
align-items: center;
+ gap: 10px;
border: 1px solid var(--app-border-light);
+ .form_box{
+ width: 100%;
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: space-between;
+ gap: 10px;
+ }
.filter-form {
width: 100%;
@@ -481,7 +536,6 @@ const handleCurrentChange = (val: number) => {
}
}
-
.selected-count {
margin-right: 24px;
@@ -498,7 +552,6 @@ const handleCurrentChange = (val: number) => {
}
}
-
.btn-filter {
background-color: var(--el-color-primary);
border-color: var(--el-color-primary);
@@ -510,7 +563,6 @@ const handleCurrentChange = (val: number) => {
}
}
-
.table-section {
background: var(--app-content-bg);
padding: 24px;
@@ -519,7 +571,6 @@ const handleCurrentChange = (val: number) => {
box-shadow: var(--app-shadow);
}
-
.table-header-title {
display: flex;
align-items: center;