feat: 审计页面新增提交与审核日期范围筛选,并优化发票列表凭证展示及上传逻辑。

This commit is contained in:
Wei_佳 2025-11-24 14:10:00 +08:00
parent def0d75840
commit d9c6150ae1
3 changed files with 62 additions and 63 deletions

View File

@ -92,11 +92,11 @@ const handleUploadFinish = ({ file, event }) => {
try {
const res = JSON.parse(event.target.response)
// url
if (res.url) {
if (res.code === 200 && res.data?.url) {
// fileList
const targetFile = fileList.value.find(f => f.id === file.id) || file
targetFile.url = res.url
targetFile.name = res.filename || targetFile.name
targetFile.url = res.data.url
targetFile.name = res.data.filename || targetFile.name
targetFile.status = 'finished' //
// formData.attachments

View File

@ -70,12 +70,9 @@ const renderInvoiceType = (type) => {
const columns = [
{
title: 'ID',
key: 'receiptId',
key: 'id',
width: 80,
align: 'center',
render(row) {
return row.receipt?.id || '-'
},
},
{
title: '提交时间',
@ -88,38 +85,25 @@ const columns = [
},
{
title: '付款凭证',
key: 'receipt',
key: 'receipts',
width: 140,
align: 'center',
render(row) {
const list = Array.isArray(row.receipt) ? row.receipt : row.receipt ? [row.receipt] : []
const urls = list
.map((item) => (typeof item === 'string' ? item : item?.url))
.filter(Boolean)
const list = Array.isArray(row.receipts) ? row.receipts : []
const urls = list.map((item) => item?.url).filter(Boolean)
if (!urls.length) return '-'
return h(
'div',
{ style: 'display:flex; gap:6px; justify-content:center;' },
{ style: 'display:flex; gap:6px; justify-content:center; align-items: center;' },
urls.slice(0, 3).map((url, idx) =>
h(
'a',
{
href: url,
target: '_blank',
rel: 'noopener noreferrer',
key: `${url}-${idx}`,
style: 'display:inline-block',
},
{
default: () =>
h('img', {
src: url,
style:
'width:46px;height:46px;object-fit:cover;border-radius:4px;border:1px solid #e5e6eb;',
alt: '付款凭证',
}),
}
)
h('img', {
src: url,
style:
'width:40px;height:40px;object-fit:cover;border-radius:4px;border:1px solid #e5e6eb;cursor:pointer;',
alt: '付款凭证',
onClick: () => window.open(url, '_blank'),
})
)
)
},
@ -230,22 +214,11 @@ const columns = [
]
//
async function handleInvoice(row) {
function handleInvoice(row) {
const editable = row.status === 'pending'
invoiceModalMode.value = editable ? 'send' : 'view'
currentInvoice.value = row
invoiceModalVisible.value = true
await fetchDetail(row)
}
async function fetchDetail(row) {
try {
const id = row?.receipt?.id || row.id
const { data } = await api.getInvoiceById({ id })
currentInvoice.value = data || row
} catch (error) {
currentInvoice.value = row
$message.error(error?.message || '获取详情失败')
}
}
//
@ -253,6 +226,7 @@ async function fetchDetail(row) {
async function handleInvoiceConfirm(formData) {
try {
const payload = {
receipt_id: formData.id,
email: formData.email,
subject: formData.email, // subject email
body: formData.content, // content -> body

View File

@ -1,5 +1,6 @@
<script setup>
import { h, onMounted, ref, watch } from 'vue'
import dayjs from 'dayjs'
import { useRoute, useRouter } from 'vue-router'
import {
NButton,
@ -29,6 +30,30 @@ const router = useRouter()
const route = useRoute()
const $table = ref(null)
const queryItems = ref({})
const submittedDateRange = ref(null)
const auditedDateRange = ref(null)
const handleSubmittedDateRangeChange = (val) => {
if (val && val.length === 2) {
queryItems.value.submitted_start = dayjs(val[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss')
queryItems.value.submitted_end = dayjs(val[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss')
} else {
queryItems.value.submitted_start = null
queryItems.value.submitted_end = null
}
$table.value?.handleSearch()
}
const handleAuditedDateRangeChange = (val) => {
if (val && val.length === 2) {
queryItems.value.audited_start = dayjs(val[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss')
queryItems.value.audited_end = dayjs(val[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss')
} else {
queryItems.value.audited_start = null
queryItems.value.audited_end = null
}
$table.value?.handleSearch()
}
//
const renderStatus = (status) => {
@ -48,24 +73,24 @@ const columns = [
{ title: '编号', key: 'id', width: 80, align: 'center' },
{
title: '手机号',
key: 'phone',
key: 'user_phone',
width: 120,
align: 'center',
ellipsis: { tooltip: true },
render(row) {
return row.phone || row.user_phone || row.user?.phone || '-'
},
},
{
title: '微信号',
key: 'wechat',
width: 120,
align: 'center',
ellipsis: { tooltip: true },
render(row) {
return row.wechat || row.user_wechat || row.user?.wechat || '-'
return row.user_phone || row.user?.phone || '-'
},
},
// {
// title: '',
// key: 'wechat',
// width: 120,
// align: 'center',
// ellipsis: { tooltip: true },
// render(row) {
// return row.wechat || row.user_wechat || row.user?.wechat || '-'
// },
// },
{
title: '评估结果',
key: 'valuation_result',
@ -300,7 +325,7 @@ watch(
@keypress.enter="$table?.handleSearch()"
/>
</QueryBarItem>
<QueryBarItem label="微信号" :label-width="80">
<!-- <QueryBarItem label="微信号" :label-width="80">
<NInput
v-model:value="queryItems.wechat"
clearable
@ -309,25 +334,25 @@ watch(
style="width: 200px"
@keypress.enter="$table?.handleSearch()"
/>
</QueryBarItem>
</QueryBarItem> -->
<QueryBarItem label="提交时间" :label-width="80">
<NDatePicker
v-model:value="queryItems.created_at"
v-model:value="submittedDateRange"
type="daterange"
clearable
placeholder="请选择提交时间"
style="width: 280px"
@update:value="$table?.handleSearch()"
@update:value="handleSubmittedDateRangeChange"
/>
</QueryBarItem>
<QueryBarItem label="审核时间" :label-width="80">
<NDatePicker
v-model:value="queryItems.reviewed_at"
v-model:value="auditedDateRange"
type="daterange"
clearable
placeholder="请选择审核时间"
style="width: 280px"
@update:value="$table?.handleSearch()"
@update:value="handleAuditedDateRangeChange"
/>
</QueryBarItem>
<QueryBarItem label="状态" :label-width="80">