feat: 积分商城-供应商-对账-发票5

This commit is contained in:
2026-09-08 20:17:09 +08:00
parent ff77ba16cc
commit 21646b8797
5 changed files with 66 additions and 3 deletions
+14 -2
View File
@@ -13,7 +13,7 @@
<el-table-column label="价税合计" width="120"><template #default="{ row }">¥{{ row.invoiceAmount }}</template></el-table-column>
<el-table-column label="开票日期" width="130"><template #default="{ row }">{{ dateText(row.invoiceDate) }}</template></el-table-column>
<el-table-column prop="failureMessage" label="说明" min-width="180" show-overflow-tooltip><template #default="{ row }">{{ row.failureMessage || '-' }}</template></el-table-column>
<el-table-column label="操作" width="190" fixed="right"><template #default="{ row }"><el-button link type="primary" @click="openDetail(row)">详情</el-button><el-button v-if="row.hasFile" link type="primary" :disabled="fileLoading" @click="openFile(row)">预览</el-button><el-button v-if="row.hasFile" link type="primary" :disabled="fileLoading" @click="openFile(row, true)">下载</el-button></template></el-table-column>
<el-table-column label="操作" width="190" fixed="right"><template #default="{ row }"><el-button link type="primary" @click="openDetail(row)">详情</el-button><el-button link type="primary" :loading="pushingId === row.id" :disabled="pushingId !== null || ![2, 3].includes(row.invoiceStatus)" @click="pushInvoice(row)">推送发票</el-button></template></el-table-column>
<template #empty><el-empty :image-size="80" description="暂无发票记录" /></template>
</el-table>
<el-pagination v-model:current-page="query.pageNumber" :page-size="query.pageSize" :total="totalCount" layout="total, prev, pager, next, jumper" @current-change="load" />
@@ -35,7 +35,7 @@
<script setup lang="ts">
import { onMounted, reactive, ref } from 'vue'
import { ElMessage } from 'element-plus'
import { ElMessage, ElMessageBox } from 'element-plus'
import { postAdmin } from '@/api/admin'
type Invoice = { id: number; settlementId: string; invoiceIds: string; invoiceCode: string; invoiceStatus: number; invoiceDate: string | null; invoiceType: number | null; invoiceAmount: string; invoiceNakeAmount: string; invoiceTaxAmount: string; invoiceTaxRate: string; taxIdNumber: string; checkCode: string; orderIds: string; failureMessage: string; hasFile: boolean }
const statuses: Record<number, string> = { 0: '未开票', 1: '开票中', 2: '成功', 3: '失败' }
@@ -48,6 +48,7 @@ const loading = ref(false)
const current = ref<Invoice>()
const detailVisible = ref(false)
const fileLoading = ref(false)
const pushingId = ref<number | null>(null)
const previewVisible = ref(false)
const previewUrl = ref('')
const load = async () => {
@@ -61,6 +62,17 @@ const load = async () => {
const search = () => { query.pageNumber = 1; return load() }
const reset = () => { query.settlementId = ''; query.invoiceStatus = undefined; return search() }
const openDetail = (row: Invoice) => { current.value = row; detailVisible.value = true }
const pushInvoice = async (row: Invoice) => {
if (pushingId.value !== null) return
pushingId.value = row.id
try {
await ElMessageBox.confirm(`确认向工会推送结算单 ${row.settlementId} 的开票结果?`, '推送发票', { confirmButtonText: '确认推送', cancelButtonText: '取消' })
await postAdmin('merchant-invoice-push', { id: row.id })
ElMessage.success('发票推送成功')
} catch (error) {
if (error !== 'cancel' && error !== 'close') ElMessage.error(error instanceof Error ? error.message : '发票推送失败')
} finally { pushingId.value = null }
}
const openFile = async (row: Invoice, download = false) => {
if (fileLoading.value) return
fileLoading.value = true