feat(F006): 询价列表加审核状态tab(全部/待审核/已通过/已驳回) + 详情页审核通过/驳回操作
This commit is contained in:
parent
a468b07044
commit
d49e839280
@ -11,7 +11,7 @@
|
|||||||
import { ref, onMounted, watch, computed } from 'vue'
|
import { ref, onMounted, watch, computed } from 'vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { httpGet } from '@/utils/request'
|
import { httpGet, httpPost } from '@/utils/request'
|
||||||
import PageHeader from '@/components/PageHeader/PageHeader.vue'
|
import PageHeader from '@/components/PageHeader/PageHeader.vue'
|
||||||
|
|
||||||
interface Inquiry {
|
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 {
|
function fmtDate(s: any): string {
|
||||||
if (!s) return '--'
|
if (!s) return '--'
|
||||||
return String(s).substring(0, 19).replace('T', ' ')
|
return String(s).substring(0, 19).replace('T', ' ')
|
||||||
@ -165,6 +190,10 @@ watch(inquiryId, load)
|
|||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
<div class="rr-header-actions">
|
<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>
|
<el-button @click="onExportPriceComparison">导出基础价格分析表</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -52,7 +52,8 @@ const limit = ref(10)
|
|||||||
const filters = ref({
|
const filters = ref({
|
||||||
status: '',
|
status: '',
|
||||||
customer: '',
|
customer: '',
|
||||||
searchKey: ''
|
searchKey: '',
|
||||||
|
apprStatus: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
function fmtDate(ts?: string | number | null) {
|
function fmtDate(ts?: string | number | null) {
|
||||||
@ -77,7 +78,7 @@ async function load() {
|
|||||||
const resp = await httpGet<any>('/supplier/inquiry/page', {
|
const resp = await httpGet<any>('/supplier/inquiry/page', {
|
||||||
page: page.value,
|
page: page.value,
|
||||||
limit: limit.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 || [])
|
const arr = Array.isArray(resp) ? resp : (resp?.list || [])
|
||||||
total.value = Number(resp?.total || (arr.length + (page.value - 1) * limit.value))
|
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 || '--',
|
product: it.title || it.product || it.productName || '--',
|
||||||
qty: it.purchaseQuantity || it.qty || '--',
|
qty: it.purchaseQuantity || it.qty || '--',
|
||||||
status: it.status || (it.apprStatus != null ? (['pending','quoting','done','cancelled'][it.apprStatus] || 'pending') : 'pending'),
|
status: it.status || (it.apprStatus != null ? (['pending','quoting','done','cancelled'][it.apprStatus] || 'pending') : 'pending'),
|
||||||
|
apprStatus: it.apprStatus,
|
||||||
time: it.publishDate || it.createDate || it.time,
|
time: it.publishDate || it.createDate || it.time,
|
||||||
raw: it
|
raw: it
|
||||||
}))
|
}))
|
||||||
@ -104,16 +106,19 @@ async function load() {
|
|||||||
|
|
||||||
function onSearch() { page.value = 1; load() }
|
function onSearch() { page.value = 1; load() }
|
||||||
|
|
||||||
const tabItems = computed(() => STATUS_TABS.map(t => ({
|
// 审核状态 tab (运营审核用): ''=全部 1=待审核 2=已通过 3=已驳回
|
||||||
key: t.value,
|
const AUDIT_TABS = [
|
||||||
label: t.label,
|
{ value: '', label: '全部' },
|
||||||
count: t.value === '' ? stats.all : (stats[t.value] || 0)
|
{ 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 onReset() { filters.value.status = ''; filters.value.customer = ''; filters.value.searchKey = ''; page.value = 1; load() }
|
||||||
function onPageChange(p: number) { page.value = p; load() }
|
function onPageChange(p: number) { page.value = p; load() }
|
||||||
function onLimitChange(l: number) { limit.value = l; page.value = 1; load() }
|
function onLimitChange(l: number) { limit.value = l; page.value = 1; load() }
|
||||||
function onStatusTab(v: string) {
|
function onStatusTab(v: string) {
|
||||||
filters.value.status = v
|
filters.value.apprStatus = v
|
||||||
page.value = 1
|
page.value = 1
|
||||||
load()
|
load()
|
||||||
}
|
}
|
||||||
@ -125,7 +130,7 @@ const columns = computed(() => [
|
|||||||
{ prop: 'customer', label: '客户', minWidth: 180 },
|
{ prop: 'customer', label: '客户', minWidth: 180 },
|
||||||
{ prop: 'product', label: '商品', minWidth: 180 },
|
{ prop: 'product', label: '商品', minWidth: 180 },
|
||||||
{ prop: 'qty', label: '数量', width: 120 },
|
{ 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' },
|
{ prop: 'time', label: '时间', width: 170, slot: 'time' },
|
||||||
{ label: '操作', width: 100, slot: 'action' }
|
{ label: '操作', width: 100, slot: 'action' }
|
||||||
])
|
])
|
||||||
@ -165,8 +170,10 @@ onMounted(() => { load() })
|
|||||||
@limit-change="onLimitChange"
|
@limit-change="onLimitChange"
|
||||||
@row-click="onRowClick"
|
@row-click="onRowClick"
|
||||||
>
|
>
|
||||||
<template #status="{ row }">
|
<template #apprStatus="{ row }">
|
||||||
<span :class="['rr-badge', `rr-badge-${row.status}`]">{{ STATUS_LABEL[row.status] || row.status }}</span>
|
<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>
|
||||||
<template #time="{ row }">
|
<template #time="{ row }">
|
||||||
<span class="rr-time">{{ fmtDate(row.time) }}</span>
|
<span class="rr-time">{{ fmtDate(row.time) }}</span>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user