From 2f83be5e40bfbf01c1645d47ea141211292c7449 Mon Sep 17 00:00:00 2001 From: chengma Date: Sat, 8 Aug 2026 10:29:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=AD=E6=96=87=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=BD=93=E5=89=8D=E6=AD=A5=E9=AA=A4=20(#39)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/task_detail_view.py | 19 ++++++++++++++++++- client/test/test_task_detail_view.py | 9 +++++++++ docs/client/05-ui-specification.md | 2 ++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/client/src/task_detail_view.py b/client/src/task_detail_view.py index 342e3bf..34e80ed 100644 --- a/client/src/task_detail_view.py +++ b/client/src/task_detail_view.py @@ -48,6 +48,19 @@ TASK_STATUS_TEXT = { TaskStatus.CANCELLED: "已取消", } +CURRENT_STEP_TEXT = { + "open_goods": "正在打开商品页面", + "collecting": "正在采集商品信息", + "collect_skus": "正在采集颜色、价格和尺码", + "select_options": "正在选择商品规格", + "placing_order": "正在提交订单", + "reconcile_order": "正在核对订单", + "submit_result": "正在提交任务结果", + "completed": "已完成", + "failed": "执行失败", + "interrupted": "上次执行中断", +} + @dataclass(frozen=True) class ColorPriceView: @@ -206,7 +219,11 @@ def build_task_detail_view_data(detail: TaskDetail) -> TaskDetailViewData: title=_non_empty_text(pdd_data.get("title")) or detail.title or "未采集", goods_id=_non_empty_text(pdd_data.get("goods_id")) or detail.goods_id or "—", goods_url=detail.goods_url, - current_step=detail.current_step or "—", + current_step=( + CURRENT_STEP_TEXT.get(detail.current_step, "未知步骤") + if detail.current_step + else "—" + ), target_spec=target_spec, quantity=str(detail.quantity) if detail.quantity is not None else "—", updated_at=detail.updated_at, diff --git a/client/test/test_task_detail_view.py b/client/test/test_task_detail_view.py index 6fc113b..6c85fb6 100644 --- a/client/test/test_task_detail_view.py +++ b/client/test/test_task_detail_view.py @@ -2,6 +2,7 @@ import os import unittest +from dataclasses import replace os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") @@ -109,6 +110,14 @@ class TaskDetailViewTest(unittest.TestCase): self.assertEqual(data.sizes, []) self.assertEqual(data.shop_name, "未采集") self.assertEqual(data.sales, "未采集") + self.assertEqual(data.current_step, "已完成") + + def test_unknown_current_step_does_not_show_english_to_buyer(self): + detail = replace(make_detail(), current_step="future_internal_step") + + data = build_task_detail_view_data(detail) + + self.assertEqual(data.current_step, "未知步骤") def test_window_builds_color_section_before_size_section(self): window = TaskDetailWindow(make_detail(collected_data())) diff --git a/docs/client/05-ui-specification.md b/docs/client/05-ui-specification.md index 58b7bfc..8ec502b 100644 --- a/docs/client/05-ui-specification.md +++ b/docs/client/05-ui-specification.md @@ -186,6 +186,8 @@ class TaskTableModel(QAbstractTableModel): 当前 Client 使用可调整大小的非模态详情窗口。用户可以点击表格“详情”、双击任务行,或选中任务后按 Enter 打开。相同任务只保留一个详情窗口;再次打开时切回已有窗口。按 Esc 或“关闭”按钮返回任务列表。 +详情面向采购人员,任务类型、状态、当前步骤和错误说明优先使用中文。数据库中的 `current_step` 等内部值只用于业务判断和日志,不直接显示;遇到尚未适配的新步骤时显示“未知步骤”。 + 采集规格按下面顺序展示: 1. **颜色:**放在上方,每个颜色旁边直接显示采集到的价格;未采集到价格时显示“价格未采集”。同一颜色意外出现多个价格时显示最低价到最高价,并显示“价格不一致”,方便检查采集结果。