feat(F006): 询价列表加审核状态tab(全部/待审核/已通过/已驳回) + 详情页审核通过/驳回操作

This commit is contained in:
zou 2026-08-31 17:52:15 +08:00
parent a468b07044
commit d49e839280
2 changed files with 48 additions and 12 deletions

View File

@ -11,7 +11,7 @@
import { ref, onMounted, watch, computed } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import { httpGet } from '@/utils/request'
import { httpGet, httpPost } from '@/utils/request'
import PageHeader from '@/components/PageHeader/PageHeader.vue'
interface Inquiry {
@ -126,6 +126,31 @@ async function load() {
}
}
// === 审核操作: apprStatus 2=通过 3=驳回 ===
const auditLoading = ref(false)
async function onAudit(status: number) {
const note = status === 3 ? prompt('请输入驳回原因:') : ''
if (status === 3 && note === null) return
auditLoading.value = true
try {
const res: any = await httpPost('/supplier/inquiry/saveInquiryAudit', {
id: detail.value?.id,
apprStatus: status,
...(status === 3 && note ? { auditNote: note } : {}),
})
if (res?.code === 0) {
ElMessage.success(status === 2 ? '审核通过,询价已发布' : '已驳回')
load()
} else {
ElMessage.error(res?.msg || '操作失败')
}
} catch (e: any) {
ElMessage.error(e?.msg || e?.message || '操作失败')
} finally {
auditLoading.value = false
}
}
function fmtDate(s: any): string {
if (!s) return '--'
return String(s).substring(0, 19).replace('T', ' ')
@ -165,6 +190,10 @@ watch(inquiryId, load)
</el-tag>
</div>
<div class="rr-header-actions">
<template v-if="detail.raw?.apprStatus === 1">
<el-button type="success" :loading="auditLoading" @click="onAudit(2)">审核通过</el-button>
<el-button type="danger" :loading="auditLoading" @click="onAudit(3)">驳回</el-button>
</template>
<el-button @click="onExportPriceComparison">导出基础价格分析表</el-button>
</div>
</div>

View File

@ -52,7 +52,8 @@ const limit = ref(10)
const filters = ref({
status: '',
customer: '',
searchKey: ''
searchKey: '',
apprStatus: ''
})
function fmtDate(ts?: string | number | null) {
@ -77,7 +78,7 @@ async function load() {
const resp = await httpGet<any>('/supplier/inquiry/page', {
page: page.value,
limit: limit.value,
...(filters.value.status ? { status: filters.value.status } : {})
...(filters.value.apprStatus ? { apprStatus: filters.value.apprStatus } : {})
})
const arr = Array.isArray(resp) ? resp : (resp?.list || [])
total.value = Number(resp?.total || (arr.length + (page.value - 1) * limit.value))
@ -87,6 +88,7 @@ async function load() {
product: it.title || it.product || it.productName || '--',
qty: it.purchaseQuantity || it.qty || '--',
status: it.status || (it.apprStatus != null ? (['pending','quoting','done','cancelled'][it.apprStatus] || 'pending') : 'pending'),
apprStatus: it.apprStatus,
time: it.publishDate || it.createDate || it.time,
raw: it
}))
@ -104,16 +106,19 @@ async function load() {
function onSearch() { page.value = 1; load() }
const tabItems = computed(() => STATUS_TABS.map(t => ({
key: t.value,
label: t.label,
count: t.value === '' ? stats.all : (stats[t.value] || 0)
})))
// 审核状态 tab (运营审核用): ''=全部 1=待审核 2=已通过 3=已驳回
const AUDIT_TABS = [
{ value: '', label: '全部' },
{ value: '1', label: '待审核' },
{ value: '2', label: '已通过' },
{ value: '3', label: '已驳回' },
]
const tabItems = computed(() => AUDIT_TABS.map(t => ({ key: t.value, label: t.label })))
function onReset() { filters.value.status = ''; filters.value.customer = ''; filters.value.searchKey = ''; page.value = 1; load() }
function onPageChange(p: number) { page.value = p; load() }
function onLimitChange(l: number) { limit.value = l; page.value = 1; load() }
function onStatusTab(v: string) {
filters.value.status = v
filters.value.apprStatus = v
page.value = 1
load()
}
@ -125,7 +130,7 @@ const columns = computed(() => [
{ prop: 'customer', label: '客户', minWidth: 180 },
{ prop: 'product', label: '商品', minWidth: 180 },
{ prop: 'qty', label: '数量', width: 120 },
{ prop: 'status', label: '状态', width: 100, slot: 'status' },
{ prop: 'apprStatus', label: '审核状态', width: 100, slot: 'apprStatus' },
{ prop: 'time', label: '时间', width: 170, slot: 'time' },
{ label: '操作', width: 100, slot: 'action' }
])
@ -165,8 +170,10 @@ onMounted(() => { load() })
@limit-change="onLimitChange"
@row-click="onRowClick"
>
<template #status="{ row }">
<span :class="['rr-badge', `rr-badge-${row.status}`]">{{ STATUS_LABEL[row.status] || row.status }}</span>
<template #apprStatus="{ row }">
<el-tag :type="row.apprStatus === 1 ? 'warning' : (row.apprStatus === 2 ? 'success' : (row.apprStatus === 3 ? 'danger' : 'info'))" size="small">
{{ row.apprStatus === 1 ? '待审核' : (row.apprStatus === 2 ? '已通过' : (row.apprStatus === 3 ? '已驳回' : '--')) }}
</el-tag>
</template>
<template #time="{ row }">
<span class="rr-time">{{ fmtDate(row.time) }}</span>