fix(F006-W13.1+13.2): 实物商品 16131 条 + 服务商品独立接 pageList (type 区分)
W13.1 实物商品: - /supplier/good/search (16080 条, 缺字段) → /supplier/good/pageList?type=1 (16131 条, 完整字段) - 完整字段: supplierGoodId/enterpriseName/unitName/brandName/checkStatus/checkOpinion/createDate - 状态 tab (待审核/已通过/已驳回) 现在能真筛 (之前 search 不返 checkStatus) - Playwright 验: 标题"商品管理" rows=10 sub="共 16131 个商品" W13.2 服务商品拆出来: - 之前 /supplier/servicegood redirect 到 /supplier/good (W3.xC 后端无端点) - 现在用 /supplier/good/pageList?type=2 是真服务商品端点 (2 条: 家政服务等) - menu-labels 服务商品 path 改回 /supplier/servicegood (独立路由) - ServiceGoodListView 接 pageList+type=2, 表格显示服务区域/服务ID/分类等 - Playwright 验: 标题"服务商品管理" rows=2 sub="共 2 个服务商品" W13.1+W13.2 改的源文件: - src/modules/supplier/good/GoodListView.vue - src/modules/supplier/servicegood/ServiceGoodListView.vue - src/config/menu-labels.ts (servicegood path 改 /supplier/servicegood)
This commit is contained in:
parent
392a4c0acc
commit
99166d8abe
@ -74,7 +74,7 @@ export const MENU_LABELS: MenuLabel[] = [
|
||||
|
||||
// ===== 供应商模块 =====
|
||||
{ url: 'supplier/good', label: '实物商品', icon: 'Box', path: '/supplier/good', sort: 300 },
|
||||
{ url: 'supplier/servicegood', label: '服务商品', icon: 'Box', path: '/supplier/good', sort: 301 },
|
||||
{ url: 'supplier/servicegood', label: '服务商品', icon: 'Box', path: '/supplier/servicegood', sort: 301 },
|
||||
{ url: 'supplier/activityzone', label: '活动专区', icon: 'Promotion', path: '/supplier/activity', sort: 302 },
|
||||
{ url: 'supplier/coupon', label: '优惠券', icon: 'Ticket', path: '/supplier/coupon', sort: 303 },
|
||||
{ url: 'supplier/promoter', label: '推广返佣', icon: 'UserFilled', path: '/supplier/promoter', sort: 304 },
|
||||
|
||||
@ -143,27 +143,28 @@ async function load() {
|
||||
loading.value = true
|
||||
error.value = null
|
||||
try {
|
||||
// 后端 /supplier/good/page 400 (按 id 查), 真实分页端点是 /supplier/good/search (16080 条)
|
||||
const data = await httpGet<{ total: number | string; list: any[] }>('/supplier/good/search', {
|
||||
// W13.1: /supplier/good/pageList 返完整字段 (16133 条) — 比 search 端点更全
|
||||
const data = await httpGet<{ total: number | string; list: any[] }>('/supplier/good/pageList', {
|
||||
page: page.value,
|
||||
limit: limit.value,
|
||||
type: 1, // 1=实物商品 (2=服务商品, 在 ServiceGoodListView 单独展示)
|
||||
...(filters.title ? { title: filters.title } : {})
|
||||
})
|
||||
let rows = (data.list || []).map((it: any) => ({
|
||||
id: String(it.id),
|
||||
supplierGoodId: 'G' + String(it.id),
|
||||
supplierGoodId: it.supplierGoodId || String(it.id),
|
||||
icon: it.icon || null,
|
||||
title: it.title || '--',
|
||||
enterpriseName: '--', // search 端点不返, 留占位
|
||||
enterpriseName: it.enterpriseName || '--',
|
||||
firstCategoryName: it.firstCategoryName || '',
|
||||
secondCategoryName: it.secondCategoryName || '',
|
||||
thirdCategoryName: it.thirdCategoryName || '',
|
||||
brandName: it.brandName || '--',
|
||||
unitName: '--', // search 端点不返
|
||||
unitName: it.unitName || '--',
|
||||
onShelf: it.onShelf ?? 1,
|
||||
checkOpinion: '',
|
||||
checkStatus: 2, // search 不返, 默认已通过
|
||||
createDate: '',
|
||||
checkOpinion: it.checkOpinion || '',
|
||||
checkStatus: it.checkStatus ?? 2,
|
||||
createDate: it.createDate || '',
|
||||
raw: it
|
||||
}))
|
||||
if (filters.enterpriseName) rows = rows.filter(r => r.enterpriseName.includes(filters.enterpriseName))
|
||||
|
||||
@ -80,17 +80,37 @@ async function load() {
|
||||
loading.value = true
|
||||
error.value = null
|
||||
try {
|
||||
await new Promise(r => setTimeout(r, 200))
|
||||
let rows = [...FALLBACK]
|
||||
// W13.2: /supplier/good/pageList?type=2 是服务商品端点 (与实物商品共用 supplier_good 表, type 区分)
|
||||
const data = await httpGet<{ total: number | string; list: any[] }>('/supplier/good/pageList', {
|
||||
page: page.value,
|
||||
limit: limit.value,
|
||||
type: 2
|
||||
})
|
||||
let rows = (data.list || []).map((it: any) => ({
|
||||
id: String(it.id),
|
||||
serviceGoodId: it.supplierGoodId || String(it.id),
|
||||
icon: it.icon || null,
|
||||
title: it.title || '--',
|
||||
enterpriseName: it.enterpriseName || '--',
|
||||
categoryName: [it.firstCategoryName, it.secondCategoryName, it.thirdCategoryName].filter(Boolean).join(' / ') || '--',
|
||||
serviceArea: it.enterpriseAddress || '--',
|
||||
price: it.remark || '--', // 服务的"价格"实际在 remark 字段 (家政类)
|
||||
checkStatus: it.checkStatus ?? 2,
|
||||
onShelf: it.onShelf ?? 1,
|
||||
createDate: it.createDate || '',
|
||||
unit: '--',
|
||||
checkOpinion: it.checkOpinion || '',
|
||||
raw: it
|
||||
}))
|
||||
if (filters.title) rows = rows.filter(r => r.title.includes(filters.title))
|
||||
if (filters.enterpriseName) rows = rows.filter(r => r.enterpriseName.includes(filters.enterpriseName))
|
||||
if (filters.checkStatus) rows = rows.filter(r => String(r.checkStatus) === filters.checkStatus)
|
||||
list.value = rows
|
||||
total.value = rows.length
|
||||
total.value = Number(data.total) || 0
|
||||
} catch (e: any) {
|
||||
error.value = e?.msg || '加载失败'
|
||||
list.value = FALLBACK
|
||||
total.value = FALLBACK.length
|
||||
error.value = e?.msg || e?.message || '加载失败'
|
||||
list.value = []
|
||||
total.value = 0
|
||||
} finally { loading.value = false }
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user