feat(F006-W17.6): 服务商品页 PageHeader 加 SKU 总数 (type=2)
This commit is contained in:
parent
8116e04291
commit
bae319fe98
@ -71,6 +71,9 @@ const filters = reactive({ title: '', enterpriseName: '', checkStatus: '' })
|
||||
// 状态统计 (与 tab 解耦, 跨 tab 一致)
|
||||
const checkStats = reactive({ pending: 0, approved: 0, rejected: 0 })
|
||||
|
||||
// W17.6: 服务商品总数 + SKU 总数 (服务商品 type=2, 全量, 不分 checkStatus)
|
||||
const counts = reactive({ goodCount: 0, skuCount: 0 })
|
||||
|
||||
const columns = [
|
||||
{ type: 'selection' as const, label: '', width: 50 },
|
||||
{ prop: 'serviceGoodId', label: '服务ID', width: 100 },
|
||||
@ -129,6 +132,18 @@ async function loadStats() {
|
||||
}
|
||||
}
|
||||
|
||||
// W17.6: 全量服务商品数 + 全量 SKU 数 (服务, type=2, 不分 checkStatus / 搜索)
|
||||
async function loadCounts() {
|
||||
try {
|
||||
const r: any = await httpGet('/supplier/good/sku-count', { type: 2 })
|
||||
counts.goodCount = Number(r?.goodCount ?? 0)
|
||||
counts.skuCount = Number(r?.skuCount ?? 0)
|
||||
} catch {
|
||||
counts.goodCount = 0
|
||||
counts.skuCount = 0
|
||||
}
|
||||
}
|
||||
|
||||
async function load() {
|
||||
loading.value = true
|
||||
error.value = null
|
||||
@ -167,8 +182,8 @@ async function load() {
|
||||
} finally { loading.value = false }
|
||||
}
|
||||
|
||||
function onSearch() { page.value = 1; Promise.all([load(), loadStats()]) }
|
||||
function onReset() { filters.title = ''; filters.enterpriseName = ''; filters.checkStatus = ''; page.value = 1; Promise.all([load(), loadStats()]) }
|
||||
function onSearch() { page.value = 1; Promise.all([load(), loadStats(), loadCounts()]) }
|
||||
function onReset() { filters.title = ''; filters.enterpriseName = ''; filters.checkStatus = ''; page.value = 1; Promise.all([load(), loadStats(), loadCounts()]) }
|
||||
function onPageChange(p: number) { page.value = p; load() }
|
||||
function onLimitChange(l: number) { limit.value = l; page.value = 1; load() }
|
||||
function onSelectionChange(rows: ServiceGood[]) { selection.value = rows }
|
||||
@ -192,12 +207,12 @@ function onDeleteBatch() { if (!selection.value.length) return ElMessage.warning
|
||||
function onExport() { ElMessage.success('导出服务商品 (mock)') }
|
||||
function onAdd() { ElMessage.info('新增服务商品 (mock)') }
|
||||
|
||||
onMounted(() => Promise.all([load(), loadStats()]))
|
||||
onMounted(() => Promise.all([load(), loadStats(), loadCounts()]))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="rr-page">
|
||||
<PageHeader title="服务商品管理" :sub="`共 ${checkStats.pending + checkStats.approved + checkStats.rejected} 个服务商品`">
|
||||
<PageHeader title="服务商品管理" :sub="`共 ${counts.goodCount} 个服务商品,${counts.skuCount} 个SKU`">
|
||||
<el-button @click="onExport">导出</el-button>
|
||||
<el-button type="primary" @click="onAdd">新增服务</el-button>
|
||||
</PageHeader>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user