feat: 比价记录状态列按 admin 口径显示,外部缺失标成功+感叹号
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,8 +4,9 @@ import { useEffect, useState } from 'react';
|
||||
import type { CSSProperties, ReactNode } from 'react';
|
||||
import {
|
||||
App, Button, Card, Col, Collapse, DatePicker, Descriptions, Divider, Drawer, Input, InputNumber,
|
||||
Row, Select, Space, Spin, Statistic, Table, Tag, Typography,
|
||||
Row, Select, Space, Spin, Statistic, Table, Tag, Tooltip, Typography,
|
||||
} from 'antd';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons';
|
||||
import type { ColumnsType } from 'antd/es/table';
|
||||
import dayjs, { type Dayjs } from 'dayjs';
|
||||
import { api, errMsg } from '@/lib/api';
|
||||
@@ -19,28 +20,16 @@ import type {
|
||||
|
||||
const { RangePicker } = DatePicker;
|
||||
|
||||
// 主状态只对外呈现生命周期口径;below_minimum/store_closed 是迁移前历史兼容值。
|
||||
// admin_status 只有四个生命周期值;外部缺失由 outcome_hint(感叹号)承载。
|
||||
const STATUS_COLOR: Record<string, string> = {
|
||||
success: 'green',
|
||||
below_minimum: 'green',
|
||||
failed: 'red',
|
||||
store_closed: 'red',
|
||||
store_not_found: 'red',
|
||||
items_not_found: 'red',
|
||||
no_delivery: 'red',
|
||||
unsupported: 'red',
|
||||
cancelled: 'default',
|
||||
running: 'blue',
|
||||
};
|
||||
const STATUS_LABEL: Record<string, string> = {
|
||||
success: '成功',
|
||||
below_minimum: '成功',
|
||||
failed: '失败',
|
||||
store_closed: '失败',
|
||||
store_not_found: '失败',
|
||||
items_not_found: '失败',
|
||||
no_delivery: '失败',
|
||||
unsupported: '失败',
|
||||
cancelled: '中途退出',
|
||||
running: '进行中',
|
||||
};
|
||||
@@ -413,7 +402,16 @@ export default function ComparisonRecordsPage() {
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{ title: '状态', dataIndex: 'status', width: 72, render: (s: string) => <Tag color={STATUS_COLOR[s]}>{STATUS_LABEL[s] || s}</Tag> },
|
||||
{ title: '状态', dataIndex: 'admin_status', width: 88, render: (_: string, r) => (
|
||||
<span>
|
||||
<Tag color={STATUS_COLOR[r.admin_status]}>{STATUS_LABEL[r.admin_status] || r.admin_status}</Tag>
|
||||
{r.outcome_hint && (
|
||||
<Tooltip title={r.outcome_hint}>
|
||||
<ExclamationCircleOutlined style={{ color: '#faad14', marginLeft: 2 }} />
|
||||
</Tooltip>
|
||||
)}
|
||||
</span>
|
||||
) },
|
||||
// 产品文档指定展示“原平台”;字段名仍沿用后端 source_platform_name。
|
||||
{ title: '原平台', dataIndex: 'source_platform_name', width: 90, render: (v) => v || '-' },
|
||||
{
|
||||
@@ -624,7 +622,10 @@ export default function ComparisonRecordsPage() {
|
||||
<Descriptions.Item label="用户">
|
||||
{detail.phone || (detail.user_id != null ? `#${detail.user_id}` : '匿名')}{detail.nickname ? `(${detail.nickname})` : ''}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="状态"><Tag color={STATUS_COLOR[detail.status]}>{STATUS_LABEL[detail.status] || detail.status}</Tag></Descriptions.Item>
|
||||
<Descriptions.Item label="状态">
|
||||
<Tag color={STATUS_COLOR[detail.admin_status]}>{STATUS_LABEL[detail.admin_status] || detail.admin_status}</Tag>
|
||||
{detail.outcome_hint && <Tooltip title={detail.outcome_hint}><ExclamationCircleOutlined style={{ color: '#faad14', marginLeft: 4 }} /></Tooltip>}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="业务">{detail.business_type}</Descriptions.Item>
|
||||
<Descriptions.Item label="耗时">{fmtMs(detail.total_ms)}</Descriptions.Item>
|
||||
<Descriptions.Item label="步数">{detail.step_count ?? '-'}</Descriptions.Item>
|
||||
|
||||
Reference in New Issue
Block a user