fix(F006-W12.3): OrderListView load 函数适配 httpGet 已解 data (r.list/r.total, 不是 r.data.list)

This commit is contained in:
zou 2026-07-06 10:29:22 +08:00
parent 689e93a673
commit db472a0e2f

View File

@ -103,8 +103,9 @@ async function load() {
loading.value = true loading.value = true
error.value = null error.value = null
try { try {
// W12.3 修复: httpGet() 已解开 res.data.data, 所以 r 直接是 {total, list, page, limit}
const r: any = await httpGet(endpoint.value, { page: page.value, limit: limit.value }) const r: any = await httpGet(endpoint.value, { page: page.value, limit: limit.value })
const respList = r?.data?.list || [] const respList: any[] = Array.isArray(r?.list) ? r.list : []
const rows: Order[] = respList.map((it: any) => ({ const rows: Order[] = respList.map((it: any) => ({
id: it.orderId || '', id: it.orderId || '',
orderNo: it.orderId || '', orderNo: it.orderId || '',
@ -123,8 +124,8 @@ async function load() {
raw: it raw: it
})) }))
list.value = rows list.value = rows
// 后端返 total 是 string, 转 number // 后端 total 是字符串 "1356", parseInt 兜底
const t = r?.data?.total const t = r?.total
total.value = typeof t === 'string' ? parseInt(t, 10) : (Number(t) || 0) total.value = typeof t === 'string' ? parseInt(t, 10) : (Number(t) || 0)
} catch (e: any) { } catch (e: any) {
error.value = e?.msg || e?.message || '加载失败' error.value = e?.msg || e?.message || '加载失败'