fix: 订单状态筛选不再发送 cancelled,工作台状态统计改用接口 counts
This commit is contained in:
@@ -305,7 +305,6 @@ const shiftDate = (days: number) => {
|
||||
const load = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const statusKeys = Object.keys(STATUS_LABELS)
|
||||
const [
|
||||
todayRes,
|
||||
cancelRes,
|
||||
@@ -313,7 +312,6 @@ const load = async () => {
|
||||
recentRes,
|
||||
cancelListRes,
|
||||
trendRes,
|
||||
...statusResList
|
||||
] = await Promise.all([
|
||||
escortApi.list({ page: 1, pageSize: 1, appointmentDate: today() }),
|
||||
escortApi.list({ page: 1, pageSize: 1, cancelStatus: 'requested' }),
|
||||
@@ -328,7 +326,6 @@ const load = async () => {
|
||||
endDate: today(),
|
||||
includeCancelled: '1',
|
||||
}),
|
||||
...statusKeys.map((status) => escortApi.list({ page: 1, pageSize: 1, status })),
|
||||
])
|
||||
|
||||
summary.today = todayRes.total
|
||||
@@ -337,10 +334,15 @@ const load = async () => {
|
||||
recent.value = recentRes.records
|
||||
cancelRequests.value = cancelListRes.records
|
||||
|
||||
statusKeys.forEach((status, index) => {
|
||||
statusCounts[status] = statusResList[index]?.total || 0
|
||||
})
|
||||
summary.pending = statusCounts.pending || 0
|
||||
// 状态分布直接取列表接口的 counts:取消由 counts.cancelled 统计(含历史 status=cancelled 数据),
|
||||
// 不能按 status=cancelled 查询,取消不在服务状态枚举内
|
||||
const totals = recentRes.counts
|
||||
statusCounts.pending = totals.pending || 0
|
||||
statusCounts.confirmed = totals.confirmed || 0
|
||||
statusCounts.in_progress = totals.inProgress || 0
|
||||
statusCounts.completed = totals.completed || 0
|
||||
statusCounts.cancelled = totals.cancelled || 0
|
||||
summary.pending = statusCounts.pending
|
||||
|
||||
const countsByDate: Record<string, number> = {}
|
||||
trendRes.records.forEach((item) => {
|
||||
@@ -356,6 +358,8 @@ const load = async () => {
|
||||
}
|
||||
trend.dates = dates
|
||||
trend.counts = counts
|
||||
} catch {
|
||||
// 错误提示由请求层统一弹出;401 会跳转登录页
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user