Commit e3dd704b by 张立顺

feat 代码重构

1 parent 95e33a6a
Showing 277 changed files with 3438 additions and 437 deletions
...@@ -165,29 +165,16 @@ ...@@ -165,29 +165,16 @@
"pages/clueList/clueList", "pages/clueList/clueList",
"pages/clueDetail/clueDetail", "pages/clueDetail/clueDetail",
"pages/residentTarget/residentTarget", "pages/residentTarget/residentTarget",
"pages/aiInspectionDetail/aiInspectionDetail",
"pages/aiInspectionReception/aiInspectionReception",
"pages/trainingMaterials/trainingMaterials", "pages/trainingMaterials/trainingMaterials",
"pages/trainingMaterials/pages/playVideo/index", "pages/trainingMaterials/pages/playVideo/index",
"pages/createDeafeatOrder/createDeafeatOrder", "pages/createDeafeatOrder/createDeafeatOrder",
"pages/createDeafeatOrderAi/createDeafeatOrderAi", "pages/createDeafeatOrderAi/createDeafeatOrderAi",
"pages/aiExcercise/ai/ai",
"pages/aiExcercise/detail/detail",
"pages/aiExcercise/list/list",
"pages/aiExcercise/result/result",
"pages/beforeCreate/beforeCreate", "pages/beforeCreate/beforeCreate",
"pages/deliveryTarget/deliveryTarget", "pages/deliveryTarget/deliveryTarget",
"pages/carQuotation/reception/reception", "pages/carQuotation/reception/reception",
"pages/aiCheck/chat/chat",
"pages/aiCheck/result/result",
"pages/aiCheck/scene/scene",
"pages/aiCheck/start/start",
"pages/createDeafeatOrderBefore/createDeafeatOrderBefore", "pages/createDeafeatOrderBefore/createDeafeatOrderBefore",
"pages/receptionRecords/receptionRecords", "pages/receptionRecords/receptionRecords",
"pages/aiCheck/redundance/redundance",
"pages/aiCheck/detail/detail",
"pages/receptionDetail/receptionDetail", "pages/receptionDetail/receptionDetail",
"pages/aiCheck/defense/defense",
"pages/extract/extract/extract", "pages/extract/extract/extract",
"pages/extract/confirm/confirm", "pages/extract/confirm/confirm",
"pages/extract/success/success", "pages/extract/success/success",
...@@ -205,6 +192,25 @@ ...@@ -205,6 +192,25 @@
] ]
}, },
{ {
"root": "packageEquityAI",
"name": "packageEquityAI",
"pages": [
"pages/aiCheck/chat/chat",
"pages/aiCheck/result/result",
"pages/aiCheck/scene/scene",
"pages/aiCheck/start/start",
"pages/aiCheck/redundance/redundance",
"pages/aiCheck/detail/detail",
"pages/aiCheck/defense/defense",
"pages/aiCheck/exercise/ai/ai",
"pages/aiCheck/exercise/detail/detail",
"pages/aiCheck/exercise/list/list",
"pages/aiCheck/exercise/result/result",
"pages/aiInspectionDetail/aiInspectionDetail",
"pages/aiInspectionReception/aiInspectionReception"
]
},
{
"root": "tabOperating", "root": "tabOperating",
"name": "tabOperating", "name": "tabOperating",
"pages": [ "pages": [
......
...@@ -72,16 +72,25 @@ flowchart TB ...@@ -72,16 +72,25 @@ flowchart TB
| 项 | 内容 | | 项 | 内容 |
|----|------| |----|------|
| 关键路径 | `packageEquity/pages/`、`packageEquity/menu/`、`packageEquity/components/` | | 关键路径 | `packageEquity/pages/`、`packageEquity/menu/`、`packageEquity/components/` |
| 影响面文档 | [权益首页职责地图](../packageEquity/docs/HOMEPAGE-INDEX.md) · [**权益报价开单专章**](../packageEquity/docs/createOrderCarQuotation.md) · [下单总览](./order-creation/README.md) · [权益 Menu 架构](../packageEquity/docs/MENU-ARCHITECTURE.md) · [ADD-MENU-GUIDE-EQUITY](../packageEquity/docs/ADD-MENU-GUIDE-EQUITY.md) · [Tab 刷新变更](../packageEquity/docs/TAB-REFRESH-CHANGELOG.md) · [园区店 ID 全量](./YQ-MERCHANT-ID-USAGE.md) · [sceneType:0 专章](./EQUITY-SCENE0-YQ-MERCHANT-ID.md) · [分包分析](../packageEquity/docs/SUBPACKAGE-ANALYSIS.md) · [P1 迁移 Checklist](../packageEquity/docs/P1-SPLIT-MIGRATION-CHECKLIST.md) · [路由别名](../packageEquity/docs/ROUTE-ALIAS-COMPAT-DESIGN.md) | | 影响面文档 | [权益首页职责地图](../packageEquity/docs/HOMEPAGE-INDEX.md) · [**权益报价开单专章**](../packageEquity/docs/createOrderCarQuotation.md) · [下单页面瘦身需求](./requirements/2026-09-08-order-entry-page-slimming.md) · [下单第二阶段重构](./requirements/2026-09-08-order-entry-second-stage-refactor.md) · [下单总览](./order-creation/README.md) · [权益 Menu 架构](../packageEquity/docs/MENU-ARCHITECTURE.md) · [ADD-MENU-GUIDE-EQUITY](../packageEquity/docs/ADD-MENU-GUIDE-EQUITY.md) · [Tab 刷新变更](../packageEquity/docs/TAB-REFRESH-CHANGELOG.md) · [园区店 ID 全量](./YQ-MERCHANT-ID-USAGE.md) · [sceneType:0 专章](./EQUITY-SCENE0-YQ-MERCHANT-ID.md) · [分包分析](../packageEquity/docs/SUBPACKAGE-ANALYSIS.md) · [P1 迁移 Checklist](../packageEquity/docs/P1-SPLIT-MIGRATION-CHECKLIST.md) · [路由别名](../packageEquity/docs/ROUTE-ALIAS-COMPAT-DESIGN.md) |
| 改前检索关键词 | `sceneType:0`、`yqMerchantId`、`getYqStoreConfig`、`equityPage`、`OrderNoPopup` | | 改前检索关键词 | `sceneType:0`、`yqMerchantId`、`getYqStoreConfig`、`equityPage`、`OrderNoPopup` |
| 文档缺口 | — | | 文档缺口 | — |
### 权益 AI `packageEquityAI`
| 项 | 内容 |
|----|------|
| 关键路径 | `packageEquityAI/pages/aiCheck/`、`packageEquityAI/pages/aiCheck/exercise/`、`packageEquityAI/pages/aiInspection*`、`packageEquityAI/services/` |
| 影响面文档 | [分包分析](../packageEquity/docs/SUBPACKAGE-ANALYSIS.md) · [P1 迁移 Checklist](../packageEquity/docs/P1-SPLIT-MIGRATION-CHECKLIST.md) · [路由别名](../packageEquity/docs/ROUTE-ALIAS-COMPAT-DESIGN.md) · [迁移验收](./migrations/subpackage-ai-work-report-split/test-acceptance.md) |
| 改前检索关键词 | `AI_ROUTES`、`AI_ROUTE_PATHS`、`packageEquityAI`、`aiCheck/exercise`、`getSparringPage`、`getReportDetail` |
| 边界 | 普通分包,可依赖主包;主包及其他分包禁止静态引用本分包文件,跨包只通过页面路由进入 |
### 客户工单 `tabWorkOrder` ### 客户工单 `tabWorkOrder`
| 项 | 内容 | | 项 | 内容 |
|----|------| |----|------|
| 关键路径 | `tabWorkOrder/pages/createOrder/`(开单 ~3000 行)、`tabWorkOrder/pages/orderDetail/`、`tabWorkOrder/pages/abnormalFlowReport/` | | 关键路径 | `tabWorkOrder/pages/createOrder/`(开单 ~3000 行)、`tabWorkOrder/pages/orderDetail/`、`tabWorkOrder/pages/abnormalFlowReport/` |
| 影响面文档 | [**精品升级订单全流程维护手册**](./order-lifecycle/README.md) · [自动化测试验收表](./order-lifecycle/test-acceptance.md) · [PRD 追溯与偏差](./order-lifecycle/prd-traceability.md) · [异常流水/锁单开发清单](./异常流水提醒和锁单机制-前端开发清单.md) · [**createOrder 开单专章**](../tabWorkOrder/docs/createOrder.md) · [下单总览](./order-creation/README.md) · [createOrder 员工/礼券约定](../tabWorkOrder/pages/createOrder/AGENTS.md) · [组件回归](./components-optimization/REGRESSION.md)(补录流水等) | | 影响面文档 | [**精品升级订单全流程维护手册**](./order-lifecycle/README.md) · [下单页面瘦身需求](./requirements/2026-09-08-order-entry-page-slimming.md) · [下单第二阶段重构](./requirements/2026-09-08-order-entry-second-stage-refactor.md) · [自动化测试验收表](./order-lifecycle/test-acceptance.md) · [PRD 追溯与偏差](./order-lifecycle/prd-traceability.md) · [异常流水/锁单开发清单](./异常流水提醒和锁单机制-前端开发清单.md) · [**createOrder 开单专章**](../tabWorkOrder/docs/createOrder.md) · [下单总览](./order-creation/README.md) · [createOrder 员工/礼券约定](../tabWorkOrder/pages/createOrder/AGENTS.md) · [组件回归](./components-optimization/REGRESSION.md)(补录流水等) |
| 改前检索关键词 | `createOrder`、`orderCouponEffects`、`merchantStaffSelection`、`abnormalFlowTips`、`wx.$orderListRefresh`、`sceneType:1` | | 改前检索关键词 | `createOrder`、`orderCouponEffects`、`merchantStaffSelection`、`abnormalFlowTips`、`wx.$orderListRefresh`、`sceneType:1` |
| 文档缺口 | —(端到端生命周期见 [order-lifecycle/README.md](./order-lifecycle/README.md)) | | 文档缺口 | —(端到端生命周期见 [order-lifecycle/README.md](./order-lifecycle/README.md)) |
......
...@@ -76,8 +76,8 @@ flowchart LR ...@@ -76,8 +76,8 @@ flowchart LR
|------|------|-----|------------|------| |------|------|-----|------------|------|
| 战败下单 | [`createDeafeatOrder.js`](../packageEquity/pages/createDeafeatOrder/createDeafeatOrder.js)、[`createDeafeatOrderAi.js`](../packageEquity/pages/createDeafeatOrderAi/createDeafeatOrderAi.js) | `defeatOrderCreate` → `quotation.add.defeat.order` | `sellerMerchantId = userInfo.merchantId` | 转化归属园区店 | | 战败下单 | [`createDeafeatOrder.js`](../packageEquity/pages/createDeafeatOrder/createDeafeatOrder.js)、[`createDeafeatOrderAi.js`](../packageEquity/pages/createDeafeatOrderAi/createDeafeatOrderAi.js) | `defeatOrderCreate` → `quotation.add.defeat.order` | `sellerMerchantId = userInfo.merchantId` | 转化归属园区店 |
| 员工质检筛选 | [`employeeInspection/employeeInspection.js`](../packageEquity/pages/employeeInspection/employeeInspection.js) | `selectrecmerchantList` + `employeeBadgeReclistWithPage` | 请求 `RecMerchantNo`(园区店 merchantNo 拼接) | 按园区店筛质检记录 | | 员工质检筛选 | [`employeeInspection/employeeInspection.js`](../packageEquity/pages/employeeInspection/employeeInspection.js) | `selectrecmerchantList` + `employeeBadgeReclistWithPage` | 请求 `RecMerchantNo`(园区店 merchantNo 拼接) | 按园区店筛质检记录 |
| AI 话术对练 | [`aiCheck/chat/chat.js`](../packageEquity/pages/aiCheck/chat/chat.js)、[`result/result.js`](../packageEquity/pages/aiCheck/result/result.js) | `sparringCommit`、`setSparringVerify` | `yqMerchantId: merchantId` | 保存/验证对练记录 | | AI 话术对练 | [`aiCheck/chat/chat.js`](../packageEquityAI/pages/aiCheck/chat/chat.js)、[`result/result.js`](../packageEquityAI/pages/aiCheck/result/result.js) | `sparringCommit`、`setSparringVerify` | `yqMerchantId: merchantId` | 保存/验证对练记录 |
| AI 趣味对练 | [`aiExcercise/ai/ai.js`](../packageEquity/pages/aiExcercise/ai/ai.js) | `getSparringPage`(carEquityApi) | `yqMerchantId: merchantId` | 分页查对练任务 | | AI 趣味对练 | [`aiCheck/exercise/ai/ai.js`](../packageEquityAI/pages/aiCheck/exercise/ai/ai.js) | `getSparringPage`(carLifeApi) | `yqMerchantId: merchantId` | 分页查对练任务 |
### 1.5 packageEquity 内 API 封装汇总(园区店相关) ### 1.5 packageEquity 内 API 封装汇总(园区店相关)
......
...@@ -157,6 +157,8 @@ npm run test:orderLifecycle:e2e ...@@ -157,6 +157,8 @@ npm run test:orderLifecycle:e2e
| 文档 | 用途 | | 文档 | 用途 |
|------|------| |------|------|
| [精品与权益下单页面瘦身需求](./requirements/2026-09-08-order-entry-page-slimming.md) | 两个大页面的独立拆分范围、接口去重、路由/分包边界和测试先行验收 |
| [精品与权益下单第二阶段重构](./requirements/2026-09-08-order-entry-second-stage-refactor.md) | 两页剩余水合、回显、校验、支付工作流和异常恢复的独立设计 |
| [精品升级订单全流程维护手册](./order-lifecycle/README.md) | 新建、支付、撤销/退款、纠错、施工、出库、完工、返工的端到端入口 | | [精品升级订单全流程维护手册](./order-lifecycle/README.md) | 新建、支付、撤销/退款、纠错、施工、出库、完工、返工的端到端入口 |
| [订单全流程自动化测试验收表](./order-lifecycle/test-acceptance.md) | 逐场景覆盖、执行状态、数据阻塞和运行条件 | | [订单全流程自动化测试验收表](./order-lifecycle/test-acceptance.md) | 逐场景覆盖、执行状态、数据阻塞和运行条件 |
| [PRD 追溯矩阵与需求—代码偏差](./order-lifecycle/prd-traceability.md) | 评审资料、版本关系和偏差清单 | | [PRD 追溯矩阵与需求—代码偏差](./order-lifecycle/prd-traceability.md) | 评审资料、版本关系和偏差清单 |
...@@ -173,11 +175,13 @@ npm run test:orderLifecycle:e2e ...@@ -173,11 +175,13 @@ npm run test:orderLifecycle:e2e
|------|----------| |------|----------|
| `packageDynamicForm` | [动态表单文档](../packageDynamicForm/docs/README.md) | | `packageDynamicForm` | [动态表单文档](../packageDynamicForm/docs/README.md) |
| `packageEquity` | [分包分析](../packageEquity/docs/SUBPACKAGE-ANALYSIS.md) · [权益报价开单](../packageEquity/docs/createOrderCarQuotation.md) · [P1 拆分清单](../packageEquity/docs/P1-SPLIT-MIGRATION-CHECKLIST.md) · [路由兼容设计](../packageEquity/docs/ROUTE-ALIAS-COMPAT-DESIGN.md) | | `packageEquity` | [分包分析](../packageEquity/docs/SUBPACKAGE-ANALYSIS.md) · [权益报价开单](../packageEquity/docs/createOrderCarQuotation.md) · [P1 拆分清单](../packageEquity/docs/P1-SPLIT-MIGRATION-CHECKLIST.md) · [路由兼容设计](../packageEquity/docs/ROUTE-ALIAS-COMPAT-DESIGN.md) |
| `packageEquityAI` | [分包分析](../packageEquity/docs/SUBPACKAGE-ANALYSIS.md) · [路由兼容设计](../packageEquity/docs/ROUTE-ALIAS-COMPAT-DESIGN.md) · [迁移测试验收](./migrations/subpackage-ai-work-report-split/test-acceptance.md) |
| `tabWorkOrder` | [createOrder 专章](../tabWorkOrder/docs/createOrder.md) · [页面接口清单](../tabWorkOrder/docs/精品工单页面接口清单.md) | | `tabWorkOrder` | [createOrder 专章](../tabWorkOrder/docs/createOrder.md) · [页面接口清单](../tabWorkOrder/docs/精品工单页面接口清单.md) |
| `tabIndex` | [首页职责地图](../tabIndex/docs/HOMEPAGE-INDEX.md) · [菜单架构](../tabIndex/docs/MENU-ARCHITECTURE.md) · [新增菜单指南](../tabIndex/docs/ADD-MENU-GUIDE.md) | | `tabIndex` | [首页职责地图](../tabIndex/docs/HOMEPAGE-INDEX.md) · [菜单架构](../tabIndex/docs/MENU-ARCHITECTURE.md) · [新增菜单指南](../tabIndex/docs/ADD-MENU-GUIDE.md) |
## 设计、计划、报告与迁移 ## 设计、计划、报告与迁移
- [需求记录](./requirements/):已确认范围、业务不变量、影响面与验收口径。
- [设计记录](./designs/):已评审或作为实现依据的设计。 - [设计记录](./designs/):已评审或作为实现依据的设计。
- [实施计划](./plans/):可执行计划与历史任务步骤。 - [实施计划](./plans/):可执行计划与历史任务步骤。
- [验证报告](./reports/):需要长期保留的验证和修复结论。 - [验证报告](./reports/):需要长期保留的验证和修复结论。
......
...@@ -61,8 +61,8 @@ flowchart TB ...@@ -61,8 +61,8 @@ flowchart TB
| 报价-开单前日报校验 | [`createOrderCarQuotationSimple.js`](../packageEquity/pages/carQuotation/createOrderCarQuotationSimple/createOrderCarQuotationSimple.js) | `dj.api.smartcarlife.staff.daily.report.popup.need` | 请求 `yqMerchantId` + 4S `merchantId`, `sceneType:0` | | 报价-开单前日报校验 | [`createOrderCarQuotationSimple.js`](../packageEquity/pages/carQuotation/createOrderCarQuotationSimple/createOrderCarQuotationSimple.js) | `dj.api.smartcarlife.staff.daily.report.popup.need` | 请求 `yqMerchantId` + 4S `merchantId`, `sceneType:0` |
| 战败单创建 | [`createDeafeatOrder.js`](../packageEquity/pages/createDeafeatOrder/createDeafeatOrder.js), [`createDeafeatOrderAi.js`](../packageEquity/pages/createDeafeatOrderAi/createDeafeatOrderAi.js) | `dj.api.smartcarlife.vehicle.damage.upgrade.quotation.add.defeat.order` | 提交 `sellerMerchantId = userInfo.merchantId` | | 战败单创建 | [`createDeafeatOrder.js`](../packageEquity/pages/createDeafeatOrder/createDeafeatOrder.js), [`createDeafeatOrderAi.js`](../packageEquity/pages/createDeafeatOrderAi/createDeafeatOrderAi.js) | `dj.api.smartcarlife.vehicle.damage.upgrade.quotation.add.defeat.order` | 提交 `sellerMerchantId = userInfo.merchantId` |
| 员工质检列表筛选 | [`employeeInspection/employeeInspection.js`](../packageEquity/pages/employeeInspection/employeeInspection.js) | `selectrecmerchantList`(返回园区店列表)+ `employeeBadgeReclistWithPage` | 请求 `RecMerchantNo`(来自 `selectedYqMerchantList[].merchantNo`) | | 员工质检列表筛选 | [`employeeInspection/employeeInspection.js`](../packageEquity/pages/employeeInspection/employeeInspection.js) | `selectrecmerchantList`(返回园区店列表)+ `employeeBadgeReclistWithPage` | 请求 `RecMerchantNo`(来自 `selectedYqMerchantList[].merchantNo`) |
| AI 延保话术对练 | [`aiCheck/chat/chat.js`](../packageEquity/pages/aiCheck/chat/chat.js), [`aiCheck/result/result.js`](../packageEquity/pages/aiCheck/result/result.js) | `dj.api.carboutique.ai.sparring.detail.commit`, `dj.api.carboutique.ai.sparring.verify` | 请求 `yqMerchantId: userInfo.merchantId` | | AI 延保话术对练 | [`aiCheck/chat/chat.js`](../packageEquityAI/pages/aiCheck/chat/chat.js), [`aiCheck/result/result.js`](../packageEquityAI/pages/aiCheck/result/result.js) | `dj.api.carboutique.ai.sparring.detail.commit`, `dj.api.carboutique.ai.sparring.verify` | 请求 `yqMerchantId: userInfo.merchantId` |
| AI 趣味对练列表 | [`aiExcercise/ai/ai.js`](../packageEquity/pages/aiExcercise/ai/ai.js) | `dj.api.carboutique.ai.sparring.task.page` | 请求 `yqMerchantId: merchantId` | | AI 趣味对练列表 | [`aiCheck/exercise/ai/ai.js`](../packageEquityAI/pages/aiCheck/exercise/ai/ai.js) | `dj.api.carboutique.ai.sparring.task.page` | 请求 `yqMerchantId: merchantId` |
| 待补录订单弹窗 | [`components/OrderNoPopup/OrderNoPopup.js`](../packageEquity/components/OrderNoPopup/OrderNoPopup.js) | `dj.api.smartcarlife.weapp.waitinputorder.count` | 响应展示 `yqMerchantName` | | 待补录订单弹窗 | [`components/OrderNoPopup/OrderNoPopup.js`](../packageEquity/components/OrderNoPopup/OrderNoPopup.js) | `dj.api.smartcarlife.weapp.waitinputorder.count` | 响应展示 `yqMerchantName` |
| 报价/质检列表展示 | `carQuotation/index`, `equityQualityOrderList` | `quotationPage` | 响应展示 `parkMerchantName` | | 报价/质检列表展示 | `carQuotation/index`, `equityQualityOrderList` | `quotationPage` | 响应展示 `parkMerchantName` |
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
## 规模 ## 规模
- 节点:10035 - 节点:10180
- 关系:22957 - 关系:23159
- 未解析:155 - 未解析:169
## 节点类型 ## 节点类型
...@@ -14,32 +14,32 @@ ...@@ -14,32 +14,32 @@
| --- | --- | | --- | --- |
| apiOperation | 721 | | apiOperation | 721 |
| component | 266 | | component | 266 |
| document | 142 | | document | 143 |
| domain | 15 | | domain | 16 |
| endpoint | 399 | | endpoint | 399 |
| globalState | 39 | | globalState | 39 |
| method | 7195 | | method | 7291 |
| module | 880 | | module | 898 |
| page | 165 | | page | 165 |
| test | 213 | | test | 242 |
## 关系类型 ## 关系类型
| 类型 | 数量 | | 类型 | 数量 |
| --- | --- | | --- | --- |
| bindsEvent | 2463 | | bindsEvent | 2471 |
| calls | 2519 | | calls | 2522 |
| callsApi | 777 | | callsApi | 766 |
| callsEndpoint | 491 | | callsEndpoint | 491 |
| contains | 1879 | | contains | 1913 |
| coveredBy | 440 | | coveredBy | 469 |
| declares | 7205 | | declares | 7301 |
| definesApi | 721 | | definesApi | 721 |
| documentedBy | 533 | | documentedBy | 544 |
| imports | 2029 | | imports | 2110 |
| navigatesTo | 242 | | navigatesTo | 228 |
| readsState | 2719 | | readsState | 2685 |
| usesComponent | 866 | | usesComponent | 865 |
| writesState | 73 | | writesState | 73 |
## 使用入口 ## 使用入口
......
...@@ -19,12 +19,12 @@ ...@@ -19,12 +19,12 @@
| 类型 | 数量 | | 类型 | 数量 |
| --- | --- | | --- | --- |
| page | 56 | | page | 43 |
| component | 82 | | component | 64 |
| apiOperation | 79 | | apiOperation | 79 |
| globalState | 3 | | globalState | 3 |
| test | 23 | | test | 38 |
| document | 10 | | document | 11 |
## 可定位实体 ## 可定位实体
...@@ -114,28 +114,10 @@ ...@@ -114,28 +114,10 @@
| component | `packageEquity/components/MoreBtn/MoreBtn` | | component | `packageEquity/components/MoreBtn/MoreBtn` |
| component | `packageEquity/components/OrderNoPopup/OrderNoPopup` | | component | `packageEquity/components/OrderNoPopup/OrderNoPopup` |
| component | `packageEquity/components/orderInfoCom/orderInfoCom` | | component | `packageEquity/components/orderInfoCom/orderInfoCom` |
| component | `packageEquity/pages/aiCheck/components/AudioTts/AudioTts` |
| component | `packageEquity/pages/aiCheck/components/Popup/Popup` |
| component | `packageEquity/pages/aiCheck/components/SpeechPopup/SpeechPopup` |
| component | `packageEquity/pages/aiCheck/components/scenePopup/scenePopup` |
| component | `packageEquity/pages/aiCheck/detail/components/attitude/attitude` |
| component | `packageEquity/pages/aiCheck/detail/components/deliver/deliver` |
| component | `packageEquity/pages/aiCheck/detail/components/emoji/emoji` |
| component | `packageEquity/pages/aiCheck/detail/components/fluent/fluent` |
| component | `packageEquity/pages/aiCheck/detail/components/lineChat/lineChat` |
| component | `packageEquity/pages/aiCheck/detail/components/pieChat/pieChat` |
| component | `packageEquity/pages/aiCheck/detail/components/quality/index` |
| component | `packageEquity/pages/aiCheck/detail/components/sale/sale` |
| component | `packageEquity/pages/aiCheck/detail/components/skilled/skilled` |
| component | `packageEquity/pages/aiCheck/start/components/RecordList/RecordList` |
| component | `packageEquity/pages/aiCheck/start/components/introduction/introduction` |
| component | `packageEquity/pages/aiCheck/start/components/tipsPop/tipsPop` |
| component | `packageEquity/pages/aiExcercise/list/components/input-box` |
| component | `packageEquity/pages/aiInspection/components/circular/circular` | | component | `packageEquity/pages/aiInspection/components/circular/circular` |
| component | `packageEquity/pages/aiInspection/components/contentItem/contentItem` | | component | `packageEquity/pages/aiInspection/components/contentItem/contentItem` |
| component | `packageEquity/pages/aiInspection/components/dataBox/dataBox` | | component | `packageEquity/pages/aiInspection/components/dataBox/dataBox` |
| component | `packageEquity/pages/aiInspection/components/dateBox/dateBox` | | component | `packageEquity/pages/aiInspection/components/dateBox/dateBox` |
| component | `packageEquity/pages/aiInspectionDetail/components/audio/audio` |
| component | `packageEquity/pages/beforeCreate/components/recordList/recordList` | | component | `packageEquity/pages/beforeCreate/components/recordList/recordList` |
| component | `packageEquity/pages/carEquity/components/EquityList/EquityList` | | component | `packageEquity/pages/carEquity/components/EquityList/EquityList` |
| component | `packageEquity/pages/carEquity/components/FirstStep/FirstStep` | | component | `packageEquity/pages/carEquity/components/FirstStep/FirstStep` |
...@@ -192,6 +174,7 @@ ...@@ -192,6 +174,7 @@
| component | `packageEquity/pages/trainingMaterials/components/ListItem/index` | | component | `packageEquity/pages/trainingMaterials/components/ListItem/index` |
| component | `packageEquity/pages/trainingMaterials/components/Materials/materials` | | component | `packageEquity/pages/trainingMaterials/components/Materials/materials` |
| document | `docs/EQUITY-SCENE0-YQ-MERCHANT-ID.md` | | document | `docs/EQUITY-SCENE0-YQ-MERCHANT-ID.md` |
| document | `docs/requirements/2026-09-08-order-entry-page-slimming.md` |
| document | `packageEquity/docs/ADD-MENU-GUIDE-EQUITY.md` | | document | `packageEquity/docs/ADD-MENU-GUIDE-EQUITY.md` |
| document | `packageEquity/docs/DEVLOG.md` | | document | `packageEquity/docs/DEVLOG.md` |
| document | `packageEquity/docs/HOMEPAGE-INDEX.md` | | document | `packageEquity/docs/HOMEPAGE-INDEX.md` |
...@@ -205,19 +188,6 @@ ...@@ -205,19 +188,6 @@
| globalState | `globalData.selectInvoiceObj` | | globalState | `globalData.selectInvoiceObj` |
| globalState | `wx.$orderListDateListScreenRefresh` | | globalState | `wx.$orderListDateListScreenRefresh` |
| page | `packageEquity/pages/TabBar/equityPage` | | page | `packageEquity/pages/TabBar/equityPage` |
| page | `packageEquity/pages/aiCheck/chat/chat` |
| page | `packageEquity/pages/aiCheck/defense/defense` |
| page | `packageEquity/pages/aiCheck/detail/detail` |
| page | `packageEquity/pages/aiCheck/redundance/redundance` |
| page | `packageEquity/pages/aiCheck/result/result` |
| page | `packageEquity/pages/aiCheck/scene/scene` |
| page | `packageEquity/pages/aiCheck/start/start` |
| page | `packageEquity/pages/aiExcercise/ai/ai` |
| page | `packageEquity/pages/aiExcercise/detail/detail` |
| page | `packageEquity/pages/aiExcercise/list/list` |
| page | `packageEquity/pages/aiExcercise/result/result` |
| page | `packageEquity/pages/aiInspectionDetail/aiInspectionDetail` |
| page | `packageEquity/pages/aiInspectionReception/aiInspectionReception` |
| page | `packageEquity/pages/beforeCreate/beforeCreate` | | page | `packageEquity/pages/beforeCreate/beforeCreate` |
| page | `packageEquity/pages/carEquity/carBrands/carBrands` | | page | `packageEquity/pages/carEquity/carBrands/carBrands` |
| page | `packageEquity/pages/carEquity/carSeries/carSeries` | | page | `packageEquity/pages/carEquity/carSeries/carSeries` |
...@@ -272,11 +242,26 @@ ...@@ -272,11 +242,26 @@
| test | `packageEquity/tests/productStrategy.test.mjs` | | test | `packageEquity/tests/productStrategy.test.mjs` |
| test | `packageEquity/tests/quotationCustomerDailyFields.test.mjs` | | test | `packageEquity/tests/quotationCustomerDailyFields.test.mjs` |
| test | `packageEquity/tests/quotationCustomerDailyFields.ui.test.mjs` | | test | `packageEquity/tests/quotationCustomerDailyFields.ui.test.mjs` |
| test | `packageEquity/tests/quotationCustomerSelection.helpers.test.mjs` |
| test | `packageEquity/tests/quotationFirstStep.events.test.mjs` |
| test | `packageEquity/tests/quotationMoney.helpers.test.mjs` | | test | `packageEquity/tests/quotationMoney.helpers.test.mjs` |
| test | `packageEquity/tests/quotationPackageBoundary.test.mjs` |
| test | `packageEquity/tests/quotationPayload.helpers.test.mjs` | | test | `packageEquity/tests/quotationPayload.helpers.test.mjs` |
| test | `packageEquity/tests/quotationPricing.events.test.mjs` |
| test | `packageEquity/tests/quotationPricing.workflow.test.mjs` |
| test | `packageEquity/tests/quotationRoute.contract.test.mjs` |
| test | `packageEquity/tests/quotationSecondStep.events.test.mjs` |
| test | `packageEquity/tests/quotationSubmit.workflow.test.mjs` |
| test | `packageEquity/tests/receptionListService.test.mjs` | | test | `packageEquity/tests/receptionListService.test.mjs` |
| test | `packageEquity/tests/ruleFn.test.mjs` | | test | `packageEquity/tests/ruleFn.test.mjs` |
| test | `packageEquity/tests/serviceCenterNoticeService.test.mjs` | | test | `packageEquity/tests/serviceCenterNoticeService.test.mjs` |
| test | `packageEquity/tests/simpleQuotationCatalog.helpers.test.mjs` |
| test | `packageEquity/tests/simpleQuotationFormConfig.helpers.test.mjs` |
| test | `packageEquity/tests/simpleQuotationPage.contract.test.mjs` |
| test | `packageEquity/tests/simpleQuotationPayload.helpers.test.mjs` |
| test | `packageEquity/tests/simpleQuotationProduct.strategy.test.mjs` |
| test | `packageEquity/tests/simpleQuotationRoute.helpers.test.mjs` |
| test | `packageEquity/tests/simpleQuotationValidation.helpers.test.mjs` |
| test | `packageEquity/tests/staffOrderValidService.test.mjs` | | test | `packageEquity/tests/staffOrderValidService.test.mjs` |
| test | `packageEquity/tests/storeSwitch.test.mjs` | | test | `packageEquity/tests/storeSwitch.test.mjs` |
| test | `packageEquity/tests/tabRefreshService.test.mjs` | | test | `packageEquity/tests/tabRefreshService.test.mjs` |
......
# packageEquityAI 领域索引
> 此文件由 `npm run knowledge:build` 生成。代码事实请勿手工修改;业务语义维护在 `docs/knowledge/`。
## 人工语义
- 别名:AI 质检、AI 趣味对练、AI 陪练、权益 AI
- 根目录:`packageEquityAI`
- 核心入口:`packageEquityAI/pages/aiCheck/exercise/ai/ai`、`packageEquityAI/pages/aiCheck/start/start`、`packageEquityAI/pages/aiInspectionDetail/aiInspectionDetail`
- 风险关键词:`AI_ROUTES`、`aiCheck`、`exercise`、`getReportDetail`、`sparring`
## 已知文档缺口
| 缺口 | 补齐时机 |
| --- | --- |
| 暂无 | |
## 机器事实统计
| 类型 | 数量 |
| --- | --- |
| page | 13 |
| component | 18 |
| apiOperation | 0 |
| globalState | 0 |
| test | 0 |
| document | 3 |
## 可定位实体
| 类型 | 路径/符号 |
| --- | --- |
| component | `packageEquityAI/pages/aiCheck/components/AudioTts/AudioTts` |
| component | `packageEquityAI/pages/aiCheck/components/Popup/Popup` |
| component | `packageEquityAI/pages/aiCheck/components/SpeechPopup/SpeechPopup` |
| component | `packageEquityAI/pages/aiCheck/components/scenePopup/scenePopup` |
| component | `packageEquityAI/pages/aiCheck/detail/components/attitude/attitude` |
| component | `packageEquityAI/pages/aiCheck/detail/components/deliver/deliver` |
| component | `packageEquityAI/pages/aiCheck/detail/components/emoji/emoji` |
| component | `packageEquityAI/pages/aiCheck/detail/components/fluent/fluent` |
| component | `packageEquityAI/pages/aiCheck/detail/components/lineChat/lineChat` |
| component | `packageEquityAI/pages/aiCheck/detail/components/pieChat/pieChat` |
| component | `packageEquityAI/pages/aiCheck/detail/components/quality/index` |
| component | `packageEquityAI/pages/aiCheck/detail/components/sale/sale` |
| component | `packageEquityAI/pages/aiCheck/detail/components/skilled/skilled` |
| component | `packageEquityAI/pages/aiCheck/exercise/list/components/input-box` |
| component | `packageEquityAI/pages/aiCheck/start/components/RecordList/RecordList` |
| component | `packageEquityAI/pages/aiCheck/start/components/introduction/introduction` |
| component | `packageEquityAI/pages/aiCheck/start/components/tipsPop/tipsPop` |
| component | `packageEquityAI/pages/aiInspectionDetail/components/audio/audio` |
| document | `docs/migrations/subpackage-ai-work-report-split/test-acceptance.md` |
| document | `packageEquity/docs/ROUTE-ALIAS-COMPAT-DESIGN.md` |
| document | `packageEquity/docs/SUBPACKAGE-ANALYSIS.md` |
| page | `packageEquityAI/pages/aiCheck/chat/chat` |
| page | `packageEquityAI/pages/aiCheck/defense/defense` |
| page | `packageEquityAI/pages/aiCheck/detail/detail` |
| page | `packageEquityAI/pages/aiCheck/exercise/ai/ai` |
| page | `packageEquityAI/pages/aiCheck/exercise/detail/detail` |
| page | `packageEquityAI/pages/aiCheck/exercise/list/list` |
| page | `packageEquityAI/pages/aiCheck/exercise/result/result` |
| page | `packageEquityAI/pages/aiCheck/redundance/redundance` |
| page | `packageEquityAI/pages/aiCheck/result/result` |
| page | `packageEquityAI/pages/aiCheck/scene/scene` |
| page | `packageEquityAI/pages/aiCheck/start/start` |
| page | `packageEquityAI/pages/aiInspectionDetail/aiInspectionDetail` |
| page | `packageEquityAI/pages/aiInspectionReception/aiInspectionReception` |
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
| component | 46 | | component | 46 |
| apiOperation | 106 | | apiOperation | 106 |
| globalState | 2 | | globalState | 2 |
| test | 27 | | test | 33 |
| document | 4 | | document | 5 |
## 可定位实体 ## 可定位实体
...@@ -183,6 +183,7 @@ ...@@ -183,6 +183,7 @@
| component | `tabWorkOrder/pages/upgradeStaffDaily/components/selectItemPopup/selectItemPopup` | | component | `tabWorkOrder/pages/upgradeStaffDaily/components/selectItemPopup/selectItemPopup` |
| component | `tabWorkOrder/pages/upgradeStaffDaily/components/weekCalendar/weekCalendar` | | component | `tabWorkOrder/pages/upgradeStaffDaily/components/weekCalendar/weekCalendar` |
| document | `docs/order-lifecycle/README.md` | | document | `docs/order-lifecycle/README.md` |
| document | `docs/requirements/2026-09-08-order-entry-page-slimming.md` |
| document | `tabWorkOrder/docs/createOrder.md` | | document | `tabWorkOrder/docs/createOrder.md` |
| document | `tabWorkOrder/docs/精品工单页面接口清单.md` | | document | `tabWorkOrder/docs/精品工单页面接口清单.md` |
| document | `tabWorkOrder/pages/createOrder/AGENTS.md` | | document | `tabWorkOrder/pages/createOrder/AGENTS.md` |
...@@ -221,15 +222,20 @@ ...@@ -221,15 +222,20 @@
| page | `tabWorkOrder/pages/technicianSearchList/pages/index/technicianSearchList` | | page | `tabWorkOrder/pages/technicianSearchList/pages/index/technicianSearchList` |
| page | `tabWorkOrder/pages/updateOrderInfo/updateOrderInfo` | | page | `tabWorkOrder/pages/updateOrderInfo/updateOrderInfo` |
| page | `tabWorkOrder/pages/upgradeStaffDaily/upgradeStaffDaily` | | page | `tabWorkOrder/pages/upgradeStaffDaily/upgradeStaffDaily` |
| test | `tabWorkOrder/pages/createOrder/tests/createOrderCatalog.workflow.test.mjs` |
| test | `tabWorkOrder/pages/createOrder/tests/createOrderPage.contract.test.mjs` |
| test | `tabWorkOrder/pages/createOrder/tests/createOrderRoute.contract.test.mjs` |
| test | `tabWorkOrder/pages/createOrder/tests/customerDailyFields.helpers.test.mjs` | | test | `tabWorkOrder/pages/createOrder/tests/customerDailyFields.helpers.test.mjs` |
| test | `tabWorkOrder/pages/createOrder/tests/customerDailyFields.integration.test.mjs` | | test | `tabWorkOrder/pages/createOrder/tests/customerDailyFields.integration.test.mjs` |
| test | `tabWorkOrder/pages/createOrder/tests/customerDailyFields.ui.test.mjs` | | test | `tabWorkOrder/pages/createOrder/tests/customerDailyFields.ui.test.mjs` |
| test | `tabWorkOrder/pages/createOrder/tests/customerProfileEffects.test.mjs` | | test | `tabWorkOrder/pages/createOrder/tests/customerProfileEffects.test.mjs` |
| test | `tabWorkOrder/pages/createOrder/tests/dormantApproval.contract.test.mjs` |
| test | `tabWorkOrder/pages/createOrder/tests/goodsChooseEcho.helpers.test.mjs` | | test | `tabWorkOrder/pages/createOrder/tests/goodsChooseEcho.helpers.test.mjs` |
| test | `tabWorkOrder/pages/createOrder/tests/goodsPriceEcho.integration.test.mjs` | | test | `tabWorkOrder/pages/createOrder/tests/goodsPriceEcho.integration.test.mjs` |
| test | `tabWorkOrder/pages/createOrder/tests/goodsPriceEdit.helpers.test.mjs` | | test | `tabWorkOrder/pages/createOrder/tests/goodsPriceEdit.helpers.test.mjs` |
| test | `tabWorkOrder/pages/createOrder/tests/merchantStaffSelection.test.mjs` | | test | `tabWorkOrder/pages/createOrder/tests/merchantStaffSelection.test.mjs` |
| test | `tabWorkOrder/pages/createOrder/tests/minPriceApproval.test.mjs` | | test | `tabWorkOrder/pages/createOrder/tests/minPriceApproval.test.mjs` |
| test | `tabWorkOrder/pages/createOrder/tests/moneyPath.contract.test.mjs` |
| test | `tabWorkOrder/pages/createOrder/tests/orderCouponEffects.test.mjs` | | test | `tabWorkOrder/pages/createOrder/tests/orderCouponEffects.test.mjs` |
| test | `tabWorkOrder/pages/createOrder/tests/orderMerchantConfig.test.mjs` | | test | `tabWorkOrder/pages/createOrder/tests/orderMerchantConfig.test.mjs` |
| test | `tabWorkOrder/pages/createOrder/tests/pagePopupLock.test.mjs` | | test | `tabWorkOrder/pages/createOrder/tests/pagePopupLock.test.mjs` |
...@@ -239,6 +245,7 @@ ...@@ -239,6 +245,7 @@
| test | `tabWorkOrder/pages/createOrder/tests/selectOrderCatalogPreprocess.test.mjs` | | test | `tabWorkOrder/pages/createOrder/tests/selectOrderCatalogPreprocess.test.mjs` |
| test | `tabWorkOrder/pages/createOrder/tests/submitGoodsSnapshot.test.mjs` | | test | `tabWorkOrder/pages/createOrder/tests/submitGoodsSnapshot.test.mjs` |
| test | `tabWorkOrder/pages/createOrder/tests/submitPayload.helpers.test.mjs` | | test | `tabWorkOrder/pages/createOrder/tests/submitPayload.helpers.test.mjs` |
| test | `tabWorkOrder/pages/createOrder/tests/submitWorkflow.test.mjs` |
| test | `tabWorkOrder/pages/refundApply/tests/refundApplyMarketing.test.mjs` | | test | `tabWorkOrder/pages/refundApply/tests/refundApplyMarketing.test.mjs` |
| test | `tabWorkOrder/pages/upgradeStaffDaily/tests/dailyReportInconsistency.helpers.test.mjs` | | test | `tabWorkOrder/pages/upgradeStaffDaily/tests/dailyReportInconsistency.helpers.test.mjs` |
| test | `tests/abnormalFlowReport.helpers.test.mjs` | | test | `tests/abnormalFlowReport.helpers.test.mjs` |
......
This diff could not be displayed because it is too large.
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
"roots": ["tabWorkOrder", "pages/tabWorkOrder"], "roots": ["tabWorkOrder", "pages/tabWorkOrder"],
"entrypoints": ["pages/tabWorkOrder/pages/index/index", "tabWorkOrder/pages/createOrder/createOrder", "tabWorkOrder/pages/orderDetail/orderDetail"], "entrypoints": ["pages/tabWorkOrder/pages/index/index", "tabWorkOrder/pages/createOrder/createOrder", "tabWorkOrder/pages/orderDetail/orderDetail"],
"riskKeywords": ["createOrder", "orderDetail", "refund", "wx.$orderListRefresh"], "riskKeywords": ["createOrder", "orderDetail", "refund", "wx.$orderListRefresh"],
"documents": ["tabWorkOrder/docs/createOrder.md", "tabWorkOrder/docs/精品工单页面接口清单.md", "docs/order-lifecycle/README.md"] "documents": ["tabWorkOrder/docs/createOrder.md", "tabWorkOrder/docs/精品工单页面接口清单.md", "docs/order-lifecycle/README.md", "docs/requirements/2026-09-08-order-entry-page-slimming.md"]
}, },
{ {
"name": "packageEquity", "name": "packageEquity",
...@@ -71,7 +71,15 @@ ...@@ -71,7 +71,15 @@
"roots": ["packageEquity"], "roots": ["packageEquity"],
"entrypoints": ["packageEquity/pages/TabBar/equityPage", "packageEquity/pages/carQuotation/index/index", "packageEquity/pages/carQuotation/createOrderCarQuotation/createOrderCarQuotation"], "entrypoints": ["packageEquity/pages/TabBar/equityPage", "packageEquity/pages/carQuotation/index/index", "packageEquity/pages/carQuotation/createOrderCarQuotation/createOrderCarQuotation"],
"riskKeywords": ["quotation", "schemeConfirmation", "CarQuotationPay", "yqMerchantId"], "riskKeywords": ["quotation", "schemeConfirmation", "CarQuotationPay", "yqMerchantId"],
"documents": ["packageEquity/docs/SUBPACKAGE-ANALYSIS.md", "packageEquity/docs/createOrderCarQuotation.md", "docs/EQUITY-SCENE0-YQ-MERCHANT-ID.md"] "documents": ["packageEquity/docs/SUBPACKAGE-ANALYSIS.md", "packageEquity/docs/createOrderCarQuotation.md", "docs/EQUITY-SCENE0-YQ-MERCHANT-ID.md", "docs/requirements/2026-09-08-order-entry-page-slimming.md"]
},
{
"name": "packageEquityAI",
"aliases": ["权益 AI", "AI 质检", "AI 陪练", "AI 趣味对练"],
"roots": ["packageEquityAI"],
"entrypoints": ["packageEquityAI/pages/aiCheck/start/start", "packageEquityAI/pages/aiCheck/exercise/ai/ai", "packageEquityAI/pages/aiInspectionDetail/aiInspectionDetail"],
"riskKeywords": ["AI_ROUTES", "aiCheck", "exercise", "sparring", "getReportDetail"],
"documents": ["packageEquity/docs/SUBPACKAGE-ANALYSIS.md", "packageEquity/docs/ROUTE-ALIAS-COMPAT-DESIGN.md", "docs/migrations/subpackage-ai-work-report-split/test-acceptance.md"]
}, },
{ {
"name": "tabOperating", "name": "tabOperating",
......
...@@ -16,32 +16,101 @@ ...@@ -16,32 +16,101 @@
"FirstStep, SecondStep and SecondStepSimple properties and explicit event contracts", "FirstStep, SecondStep and SecondStepSimple properties and explicit event contracts",
"semantic route aliases, object parameters, refresh flags and target page existence", "semantic route aliases, object parameters, refresh flags and target page existence",
"packageEquity and tabWorkOrder source dependency boundaries", "packageEquity and tabWorkOrder source dependency boundaries",
"yuan and cent amount semantics with authoritative line total preservation" "yuan and cent amount semantics with authoritative line total preservation",
"boutique select-order catalog single-response directory and marketing mapping",
"simple quotation catalog, route, validation and dynamic form configuration adapters"
], ],
"tests": [ "tests": [
{ {
"id": "quotation-money-baseline", "id": "quotation-money-baseline",
"file": "packageEquity/tests/quotationMoney.helpers.test.mjs", "file": "packageEquity/tests/quotationMoney.helpers.test.mjs",
"level": "unit", "level": "unit",
"expectedBefore": "pass" "expectedBefore": "pass",
"status": "pass"
}, },
{ {
"id": "quotation-payload-baseline", "id": "quotation-payload-baseline",
"file": "packageEquity/tests/quotationPayload.helpers.test.mjs", "file": "packageEquity/tests/quotationPayload.helpers.test.mjs",
"level": "unit", "level": "unit",
"expectedBefore": "pass" "expectedBefore": "pass",
"status": "pass"
}, },
{ {
"id": "boutique-submit-payload-baseline", "id": "boutique-submit-payload-baseline",
"file": "tabWorkOrder/pages/createOrder/tests/submitPayload.helpers.test.mjs", "file": "tabWorkOrder/pages/createOrder/tests/submitPayload.helpers.test.mjs",
"level": "unit", "level": "unit",
"expectedBefore": "pass" "expectedBefore": "pass",
"status": "pass"
}, },
{ {
"id": "boutique-approval-disabled-baseline", "id": "boutique-approval-disabled-baseline",
"file": "tabWorkOrder/pages/createOrder/tests/orderMerchantConfig.test.mjs", "file": "tabWorkOrder/pages/createOrder/tests/orderMerchantConfig.test.mjs",
"level": "contract", "level": "contract",
"expectedBefore": "pass" "expectedBefore": "pass",
"status": "pass"
},
{
"id": "boutique-catalog-single-response",
"file": "tabWorkOrder/pages/createOrder/tests/createOrderCatalog.workflow.test.mjs",
"level": "unit",
"expectedBefore": "pass",
"status": "pass"
},
{
"id": "boutique-page-dead-code-contract",
"file": "tabWorkOrder/pages/createOrder/tests/createOrderPage.contract.test.mjs",
"level": "contract",
"expectedBefore": "pass",
"status": "pass"
},
{
"id": "simple-quotation-catalog",
"file": "packageEquity/tests/simpleQuotationCatalog.helpers.test.mjs",
"level": "unit",
"expectedBefore": "pass",
"status": "pass"
},
{
"id": "simple-quotation-route",
"file": "packageEquity/tests/simpleQuotationRoute.helpers.test.mjs",
"level": "unit",
"expectedBefore": "pass",
"status": "pass"
},
{
"id": "simple-quotation-validation",
"file": "packageEquity/tests/simpleQuotationValidation.helpers.test.mjs",
"level": "unit",
"expectedBefore": "pass",
"status": "pass"
},
{
"id": "simple-quotation-form-config",
"file": "packageEquity/tests/simpleQuotationFormConfig.helpers.test.mjs",
"level": "unit",
"expectedBefore": "pass",
"status": "pass"
},
{
"id": "simple-quotation-page-contract",
"file": "packageEquity/tests/simpleQuotationPage.contract.test.mjs",
"level": "contract",
"expectedBefore": "pass",
"status": "pass"
},
{
"id": "order-entry-ui-evidence-guard",
"file": "tests/order-entry-refactor/ui/smokeEvidence.helpers.test.mjs",
"level": "unit",
"expectedBefore": "pass",
"status": "pass"
},
{
"id": "order-entry-ui-connect-config",
"file": "tests/order-entry-refactor/ui/live-config.test.mjs",
"level": "unit",
"expectedBefore": "pass",
"status": "pass"
} }
], ],
"baseline": { "baseline": {
...@@ -61,10 +130,35 @@ ...@@ -61,10 +130,35 @@
"status": "pass" "status": "pass"
}, },
{ {
"command": "npm run test:quotation",
"status": "pass"
},
{
"command": "npm run test:order-entry-refactor", "command": "npm run test:order-entry-refactor",
"status": "pass" "status": "pass"
}, },
{ {
"command": "npm run test:subpackage-split",
"status": "pass"
},
{
"command": "node scripts/scan-component-paths.mjs",
"status": "pass"
},
{
"command": "npm run check:subpackage-boundaries",
"status": "pass"
},
{
"command": "npm run check:subpackage-size",
"status": "pass"
},
{
"command": "npm run test:order-entry-refactor:ui",
"status": "blocked",
"blocker": "the first 5/5 DevTools smoke passed, but a repeat run cannot complete against the current unresponsive automation service; QR preview also returns DevTools internal code 10"
},
{
"command": "npm test", "command": "npm test",
"status": "pass" "status": "pass"
}, },
...@@ -74,7 +168,8 @@ ...@@ -74,7 +168,8 @@
}, },
{ {
"command": "git diff --check", "command": "git diff --check",
"status": "pass" "status": "blocked",
"blocker": "user-owned config.js line 26 has a pre-existing trailing whitespace warning; target change paths pass scoped diff checks"
} }
] ]
} }
......
...@@ -26,27 +26,61 @@ ...@@ -26,27 +26,61 @@
| OR-BQ-APPROVAL | 最低价审批保持关闭、失效接线删除 | 关闭契约通过 | pass | | OR-BQ-APPROVAL | 最低价审批保持关闭、失效接线删除 | 关闭契约通过 | pass |
| OR-ALL | `npm test` 与静态边界 | 基线通过 | pass | | OR-ALL | `npm test` 与静态边界 | 基线通过 | pass |
表格中的“完成判定”是 post 门禁要求;实施过程中以每次实际测试输出更新状态,不用预期结果冒充已执行结果。 ## 2026-09-08 页面瘦身增量基线
需求范围与不变量见 [`docs/requirements/2026-09-08-order-entry-page-slimming.md`](../../requirements/2026-09-08-order-entry-page-slimming.md)。本增量遵守“文档与测试先行”,在继续修改运行时代码前记录:
- 迁移 pre 门禁:通过。
- `npm run test:order-entry-refactor`:42/42 通过。
- `npm run test:equity`:184/184 通过。
- 权益简易页:2167 行 / 61,626 B;WXML 97 行 / 3,639 B。
- 新增 `simpleQuotationCatalog.helpers.test.mjs`、`simpleQuotationRoute.helpers.test.mjs`、`simpleQuotationValidation.helpers.test.mjs`。
- 三个权益聚焦测试及一个精品初始化测试已观察到预期 RED:目标 helper/workflow 尚未实现,Node 分别报告 `ERR_MODULE_NOT_FOUND`;fixture 与测试文件本身无语法错误。
- 运行时代码实现与 GREEN 结果:完成;6 个新增聚焦/契约文件已纳入 `test:order-entry-refactor`。
- `config.js` 是用户自有环境改动,本轮不修改;其第 26 行现有尾随空格会使仓库级 `git diff --check` 报一项基线告警,交付时需与本轮变更的 diff-check 结果分开记录。
以上完成判定来自 2026-09-07 的实际执行结果:
- `npm run test:createOrder`:181/181 通过。
- `npm run test:quotation`:53/53 通过。
- `npm run test:equity`:184/184 通过。
- `npm run test:order-entry-refactor`:42/42 通过。
- `npm run test:subpackage-split`:52 通过、1 个需显式开启的 UI 用例跳过;其中一次性 ROP 转发契约 38/38 通过。
- `npm test`:退出码 0;首次运行发现历史活动价只读契约缺失,恢复兼容模块并改为整数分计算后复跑通过,未删除全局测试规避回归。
- 51 个本次变更的 `.js/.mjs` 文件通过 `node --check`。
- `node scripts/scan-component-paths.mjs`:`BROKEN_COMPONENT_PATHS=0`。
- `node scripts/scan-broken-imports.mjs`:仍为基线 `CRITICAL_CROSS_ROOT=2`、`OTHER_BROKEN=23`,目标改造目录未新增跨包错误。
- `npm run knowledge:check` 与 `git diff --check` 通过。
2026-09-08 页面瘦身增量实际结果:
- RED 证据:商品池、路由、校验、动态表单配置、精品单响应目录 workflow 均先因目标模块不存在报 `ERR_MODULE_NOT_FOUND`;页面静态契约先因调试输出和失效轮询命中失败。
- GREEN:`npm run test:order-entry-refactor` 70/70、`npm run test:equity` 200/200、`npm run test:createOrder` 189/189,`npm test` 退出码 0;迁移 post 门禁通过。
- 权益简易页从 2167 行 / 61,626 B 降至 1255 行 / 36,261 B;精品页从约 2968 行 / 98,664 B 降至 2666 行 / 88,705 B。
- 精品本页已移除 `getOrderBaseGoodsList` 调用;`selectOrderGoods.list` 的同一请求响应一次完成目录与营销映射,并具备同键在途复用和旧响应防覆盖。
- `node scripts/scan-component-paths.mjs`:`BROKEN_COMPONENT_PATHS=0`;`npm run check:subpackage-boundaries`:`BOUNDARY_ISSUES=0`。
- `node scripts/scan-broken-imports.mjs` 仍为仓库基线 `CRITICAL_CROSS_ROOT=2`、`OTHER_BROKEN=23`,本轮目标文件未新增项。
- 精品页静态契约先命中临时日志、停用待补录轮询和空生命周期 RED,清理后通过;共享 `waitinputorder` API facade 保留给其他消费者。
- 源码预算检查:`packageEquity=1,775,294` B(预算 1,850,000 B)、`packageEquityAI=463,807` B(预算 550,000 B),均通过;`tabWorkOrder` 原始目录为 2,028,036 B,只作预警,上传判定以开发者工具编译后分包字节为准。
## 开发者工具与包体 ## 开发者工具与包体
1. 标准权益、简易权益、精品创建页均能编译和打开。 1. 开发者工具热编译最后一次可见状态为 0 error;路由、组件与分包静态契约全部通过。
2. 方案确认、权益支付、精品确认/施工以及返回列表 alias 无编译错误。 2. 2026-09-08 14:19:53 再次刷新时,开发者工具 CLI 仍因同一请求被内部重复处理而在 `compile_start` 返回 `Error undefined (code 10)`;工具日志对应记录为 `task type:upload exec error abort`,约 40 秒后还出现 `updateProject id:undefined`。该返回不能作为成功状态,但同一次请求已实际生成二维码与完整 `info-output`,因此按产物继续扫码验收,并保留 CLI 异常记录。
3. 目标目录新增跨分包 import、失效 usingComponents 和 WXS 路径均为 0。 3. 当前代码编译产物:main `1,199,283` B、`packageEquity` `1,584,391` B、`packageEquityAI` `308,183` B、`tabWorkOrder` `1,379,565` B、总包 `7,033,342` B。主包和三个目标分包均低于 2 MiB;二维码产物为 `outputs/order-entry-refactor/device-preview-fresh-window.png`。
4. 记录 main、`packageEquity`、`tabWorkOrder` 和总包实际字节数;代码抽取不能造成无理由增长。 4. 本轮首次使用当前已登录的开发者工具自动化端口完成页面烟测,权益标准页、权益简易页、方案确认页、支付页和精品开单页 5/5 打开成功;后续重复执行时 IDE 自动化服务无响应并超时。证据脚本已增加“空/失败结果不覆盖成功记录”和 connect-only 配置的 RED→GREEN 测试。首次结果只证明开发者工具编译、路由和组件加载,不能替代 Android/iOS 实际下单。
## 真机矩阵 ## 真机矩阵
| 编号 | 平台 | 路径 | 验收要求 | | 编号 | 平台 | 路径 | 验收要求 |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| OR-DEVICE-EQ-STANDARD-A | Android | 标准新建、编辑回显、计价失败重试、方案确认、返回 | 实际通过或记录外部阻塞 | | OR-DEVICE-EQ-STANDARD-A | Android | 标准新建、编辑回显、计价失败重试、方案确认、返回 | ready:当前代码二维码已生成,等待扫码结果 |
| OR-DEVICE-EQ-STANDARD-I | iOS | 标准新建、编辑回显、计价失败重试、方案确认、返回 | 实际通过或记录外部阻塞 | | OR-DEVICE-EQ-STANDARD-I | iOS | 标准新建、编辑回显、计价失败重试、方案确认、返回 | ready:当前代码二维码已生成,等待扫码结果 |
| OR-DEVICE-EQ-SIMPLE-A | Android | 简易新建、错单重下、合同材料、支付、返回 | 实际通过或记录外部阻塞 | | OR-DEVICE-EQ-SIMPLE-A | Android | 简易新建、错单重下、合同材料、支付、返回 | ready:当前代码二维码已生成,等待扫码结果 |
| OR-DEVICE-EQ-SIMPLE-I | iOS | 简易新建、错单重下、合同材料、支付、返回 | 实际通过或记录外部阻塞 | | OR-DEVICE-EQ-SIMPLE-I | iOS | 简易新建、错单重下、合同材料、支付、返回 | ready:当前代码二维码已生成,等待扫码结果 |
| OR-DEVICE-BQ-A | Android | 正常、暂存、补录、纠错、战败、失败重试、后续跳转 | 实际通过或记录外部阻塞 | | OR-DEVICE-BQ-A | Android | 正常、暂存、补录、纠错、战败、失败重试、后续跳转 | ready:当前代码二维码已生成,等待扫码结果 |
| OR-DEVICE-BQ-I | iOS | 正常、暂存、补录、纠错、战败、失败重试、后续跳转 | 实际通过或记录外部阻塞 | | OR-DEVICE-BQ-I | iOS | 正常、暂存、补录、纠错、战败、失败重试、后续跳转 | ready:当前代码二维码已生成,等待扫码结果 |
## 发布判定 ## 发布判定
只有聚焦测试、`npm test`、开发者工具预览、包体记录、Android/iOS 真机矩阵和 migration post 门禁都通过,才可标记发布验收完成。外部账号、设备或后端环境不可用时允许保留可复现的 blocked 记录,但不能将 blocked 写成 pass。 代码与自动化验收已完成,当前代码的编译包体和二维码产物已生成。开发者工具 CLI 仍存在重复处理导致的 `code 10` 状态误报,Android/iOS 真机矩阵尚未回填,因此当前不能标记“发布验收完成”;有权限账号完成上述扫码矩阵后才能发布。
# 下单第二阶段重构 API 清单
本阶段不新增、不删除、不改名 ROP method,也不修改任何请求或响应字段。下列 API 只通过显式依赖注入进入 workflow,原 facade 和网关保持不变:
## 精品
- 精品五类提交相关 `createWithPay`、预录、补录和纠错 facade。
- `dj.api.smartcarlife.selectOrderGoods.list` 商品池权威响应。
- 门店配置、客户档案、场景、日报、学习任务和异常流水锁单接口。
## 权益简易下单
- `quotationAdd`、`updateQuotation`、`errorOrderById`。
- `quotationUpgrade`、`quotationRecording`、`getQuotationInfoById`、`updateCustomerInfo`。
- `checkZyPayFlag`、`checkRecord`、`staffDailyReportMerchantValid`。
- `getSelectOrderGoodsList`、`priceCounter`、`orderSettingList`。
实现不得改变上述调用参数;如发现必须改字段,应停止对应修改并重新执行 develop Swagger 契约门禁。
{
"id": "order-entry-second-stage-refactor",
"title": "精品与权益下单第二阶段独立重构",
"sourceProject": "dj-car-boutique-work-wechat",
"affectedPaths": [
"package.json",
"packageEquity/pages/carQuotation",
"packageEquity/tests",
"tabWorkOrder/pages/createOrder",
"docs"
],
"interfaces": [
"boutique five submit modes and route aliases",
"boutique order hydration, validation, payment selection and goods echo",
"simple quotation add, update, correct, recording, contract and payment outcomes",
"FirstStep public configuration and car selection eventbus lifecycle",
"yuan and cent amount semantics with authoritative prices",
"packageEquity and tabWorkOrder dependency boundaries"
],
"tests": [
{
"id": "boutique-validation",
"file": "tabWorkOrder/pages/createOrder/tests/orderValidation.helpers.test.mjs",
"level": "unit",
"expectedBefore": "fail",
"status": "fail"
},
{
"id": "boutique-payment-selection",
"file": "tabWorkOrder/pages/createOrder/tests/paymentSelection.helpers.test.mjs",
"level": "unit",
"expectedBefore": "fail",
"status": "fail"
},
{
"id": "boutique-order-hydration",
"file": "tabWorkOrder/pages/createOrder/tests/orderHydration.helpers.test.mjs",
"level": "unit",
"expectedBefore": "fail",
"status": "fail"
},
{
"id": "boutique-goods-echo",
"file": "tabWorkOrder/pages/createOrder/tests/goodsChooseEcho.workflow.test.mjs",
"level": "unit",
"expectedBefore": "fail",
"status": "fail"
},
{
"id": "simple-quotation-checkout",
"file": "packageEquity/tests/simpleQuotationCheckout.workflow.test.mjs",
"level": "unit",
"expectedBefore": "fail",
"status": "fail"
},
{
"id": "simple-quotation-total",
"file": "packageEquity/tests/simpleQuotationTotal.helpers.test.mjs",
"level": "unit",
"expectedBefore": "fail",
"status": "fail"
},
{
"id": "simple-quotation-lifecycle",
"file": "packageEquity/tests/simpleQuotationLifecycle.test.mjs",
"level": "unit",
"expectedBefore": "fail",
"status": "fail"
},
{
"id": "route-boundary-baseline",
"file": "packageEquity/tests/quotationRoute.contract.test.mjs",
"level": "contract",
"expectedBefore": "pass",
"status": "pass"
}
],
"baseline": {
"command": "npm run test:createOrder; npm run test:equity; npm run test:order-entry-refactor",
"result": "189 boutique, 200 equity and 70 focused tests pass before second-stage runtime changes"
},
"apiInventory": "docs/migrations/order-entry-second-stage-refactor/api-inventory.md",
"acceptance": "docs/migrations/order-entry-second-stage-refactor/test-acceptance.md"
}
# 精品与权益下单第二阶段重构测试验收
## 修改前基线
- `npm run knowledge:check`:通过。
- `npm run test:order-entry-refactor`:70/70 通过。
- `npm run test:createOrder`:189/189 通过。
- `npm run test:equity`:200/200 通过。
- `npm run check:subpackage-boundaries`:`BOUNDARY_ISSUES=0`。
- `npm run check:subpackage-size`:`packageEquity=1,775,294 B / 1,850,000 B`,`packageEquityAI=463,807 B / 550,000 B`。
- 已有编译产物:main `1,199,283 B`、packageEquity `1,584,391 B`、packageEquityAI `308,183 B`、tabWorkOrder `1,379,565 B`、总包 `7,033,342 B`。
## RED/GREEN 矩阵
| 编号 | 行为 | RED 证据 | 完成状态 |
| --- | --- | --- | --- |
| BQ2-VALID | 默认手机号、结构化校验、输入不变 | 新 helper 缺失 | not-run |
| BQ2-PAY | 支付矩阵一次性 patch | 新 helper 缺失 | not-run |
| BQ2-HYDRATE | 五入口订单水合 | 新 helper 缺失 | not-run |
| BQ2-ECHO | 单品/套餐/多规格无原地修改回显 | 新 workflow 缺失 | not-run |
| EQ2-CHECKOUT | 日报、支付、补录、合同 reject 可结束 | 新 workflow 缺失 | not-run |
| EQ2-TOTAL | 分整数汇总、无浮点长尾 | 新 helper 缺失 | not-run |
| EQ2-LIFECYCLE | eventbus 注册与卸载 | 新 service 缺失 | not-run |
| ROUTE-BOUNDARY | alias、对象参数、分包与组件路径 | 既有契约通过 | baseline-pass |
## 自动化完成门禁
完成时需记录以下命令的实际结果:
- 聚焦新增测试。
- `npm run test:createOrder`。
- `npm run test:equity`。
- `npm run test:order-entry-refactor`。
- `npm test`。
- `node scripts/scan-component-paths.mjs`。
- `npm run check:subpackage-boundaries`。
- `npm run check:subpackage-size`。
- `npm run knowledge:check`。
- `git diff --check`;用户自有 `config.js` 基线问题必须单独记录。
## 开发者工具与真机
开发者工具需重新打开精品开单、权益简易下单、权益支付页、权益列表及精品确认后续页,并确认无跨包编译报错。Android/iOS 真机需覆盖新建、编辑/回显、失败重试、补录/纠错、付款凭证、合同上传、线上支付和返回列表;设备或账号无法执行时记录为 blocked,不能写成通过。
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
| `getSensitive` | `/router/is/sensitive/1.0.0` | `AI` | `false` | | `getSensitive` | `/router/is/sensitive/1.0.0` | `AI` | `false` |
| `getPhrases` | `/router/similar/phrases/1.0.0` | `AI` | `false` | | `getPhrases` | `/router/similar/phrases/1.0.0` | `AI` | `false` |
| `getVoice` | `/router/get/voice/to/text/1.0.0` | `AI` | `false` | | `getVoice` | `/router/get/voice/to/text/1.0.0` | `AI` | `false` |
| `getVoiceConfig` | `/router/get/voice/config/1.0.0` | `AI` | `false` |
## AI ROP methods ## AI ROP methods
...@@ -28,6 +29,7 @@ ...@@ -28,6 +29,7 @@
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| `aiApi.getSparringPage` | `dj.api.carboutique.ai.sparring.staff.record.page` | `/rop-dj-pairexc/router` | `axios` 未收录 | 一次性覆盖:仅按现有调用原样迁移 | | `aiApi.getSparringPage` | `dj.api.carboutique.ai.sparring.staff.record.page` | `/rop-dj-pairexc/router` | `axios` 未收录 | 一次性覆盖:仅按现有调用原样迁移 |
| `aiApi.setSparringVerify` | `dj.api.carboutique.ai.sparring.verify` | `/rop-dj-pairexc/router` | `axios` 未收录 | 一次性覆盖:仅按现有调用原样迁移 | | `aiApi.setSparringVerify` | `dj.api.carboutique.ai.sparring.verify` | `/rop-dj-pairexc/router` | `axios` 未收录 | 一次性覆盖:仅按现有调用原样迁移 |
| `aiApi.getReportDetail` | `dj.api.carboutique.ai.sparring.report.detail` | `/rop-dj-pairexc/router` | `axios` 未收录 | 一次性覆盖:仅按现有调用原样迁移 |
| `aiApi.getToken` | `dj.api.smartcarlife.recepiton.customer.oss.getToken` | 默认 | `found`, fresh | 原样迁移 | | `aiApi.getToken` | `dj.api.smartcarlife.recepiton.customer.oss.getToken` | 默认 | `found`, fresh | 原样迁移 |
| `carEquityApi.getInspectionDetail` | `dj.api.smartcarlife.app.inspection.conversation.check.detail` | 默认 | `found`, fresh | 原样迁移 | | `carEquityApi.getInspectionDetail` | `dj.api.smartcarlife.app.inspection.conversation.check.detail` | 默认 | `found`, fresh | 原样迁移 |
| `carEquityApi.getSparringPage` | `dj.api.carboutique.ai.sparring.task.page` | `/rop-dj-pairexc/router` | `axios` 未收录 | 一次性覆盖:仅按现有调用原样迁移 | | `carEquityApi.getSparringPage` | `dj.api.carboutique.ai.sparring.task.page` | `/rop-dj-pairexc/router` | `axios` 未收录 | 一次性覆盖:仅按现有调用原样迁移 |
...@@ -39,7 +41,7 @@ ...@@ -39,7 +41,7 @@
| `carEquityApi.sparringRole` | `dj.api.carboutique.ai.sparring.role.info.page` | `/rop-dj-pairexc/router` | `found`, fresh | method 已收录;网关仍保持不变 | | `carEquityApi.sparringRole` | `dj.api.carboutique.ai.sparring.role.info.page` | `/rop-dj-pairexc/router` | `found`, fresh | method 已收录;网关仍保持不变 |
| `carEquityApi.sparringRrain` | `dj.api.carboutique.ai.sparring.start.train` | `/rop-dj-pairexc/router` | `axios` 未收录 | 一次性覆盖:仅按现有调用原样迁移 | | `carEquityApi.sparringRrain` | `dj.api.carboutique.ai.sparring.start.train` | `/rop-dj-pairexc/router` | `axios` 未收录 | 一次性覆盖:仅按现有调用原样迁移 |
`/rop-dj-pairexc/swagger-rop/api-docs` 经当前 develop 公共域名读取返回 HTTP 502,配置中心也未登记该 ROP source。因此上述 9 个方法属于“Swagger 尚未收录且目标 Swagger 不可验证”。用户于 2026-09-04 明确允许本次一次性契约覆盖:只能复制基线测试锁定的现有 method、payload identity、`/rop-dj-pairexc/router` 和 transport 参数;不得借此新增字段、改网关或改变响应处理。迁移后仍标注 Swagger 未验证。 `/rop-dj-pairexc/swagger-rop/api-docs` 经当前 develop 公共域名读取返回 HTTP 502,配置中心也未登记该 ROP source。因此上述 10 个方法属于“Swagger 尚未收录且目标 Swagger 不可验证”。用户于 2026-09-04 明确允许本次一次性契约覆盖:只能复制基线测试锁定的现有 method、payload identity、`/rop-dj-pairexc/router` 和 transport 参数;不得借此新增字段、改网关或改变响应处理。迁移后仍标注 Swagger 未验证。
## 工作日报 ROP methods ## 工作日报 ROP methods
......
{ {
"id": "subpackage-ai-work-report-split", "id": "subpackage-ai-work-report-split",
"title": "权益 AI 与旧版工作日报独立分包迁移", "title": "权益 AI 独立分包迁移(工作日报留待后续阶段)",
"sourceProject": "dj-car-boutique-work-wechat", "sourceProject": "dj-car-boutique-work-wechat",
"affectedPaths": [ "affectedPaths": [
"app.json", "app.json",
...@@ -8,20 +8,16 @@ ...@@ -8,20 +8,16 @@
"store", "store",
"utils", "utils",
"packageEquity", "packageEquity",
"tabWorkOrder", "packageEquityAI",
"tabIndex",
"packageUsedCar",
"packageDynamicForm",
"tests", "tests",
"docs" "docs"
], ],
"interfaces": [ "interfaces": [
"packageEquityAI semantic routes and legacy packageEquity route aliases", "packageEquityAI semantic routes and legacy packageEquity route aliases",
"packageWorkReport semantic routes and legacy tabWorkOrder route aliases",
"AI API request.post method, payload identity, gateway and transport flags", "AI API request.post method, payload identity, gateway and transport flags",
"work report API request.post method and payload identity", "work report API request.post method and payload identity as a non-migration regression guard",
"H5 page mapping, login allowlist and wx.$SCENE path", "H5 page mapping, login allowlist and wx.$SCENE path",
"cross-package imports, usingComponents78 and WXS src references" "cross-package imports, usingComponents and WXS src references"
], ],
"tests": [ "tests": [
{ {
...@@ -56,20 +52,30 @@ ...@@ -56,20 +52,30 @@
"status": "pass" "status": "pass"
}, },
{ {
"command": "node scripts/check-subpackage-boundaries.mjs", "command": "npm run check:subpackage-boundaries",
"status": "blocked", "status": "pass"
"blocker": "The migration boundary scanner is created during the implementation phase."
}, },
{ {
"command": "npm run check:subpackage-size", "command": "npm run check:subpackage-size",
"status": "blocked", "status": "pass"
"blocker": "The per-package size gate is created after the two target subpackages exist."
}, },
{ {
"command": "git diff --check", "command": "npm run knowledge:check",
"status": "pass"
},
{
"command": "node scripts/scan-component-paths.mjs",
"status": "pass" "status": "pass"
},
{
"command": "git diff --check -- app.json router store packageEquity packageEquityAI tests docs package.json project.config.json scripts",
"status": "pass"
},
{
"command": "git diff --check",
"status": "blocked",
"blocker": "User-owned config.js has a pre-existing trailing whitespace change and is intentionally excluded from this migration."
} }
] ]
} }
} }
...@@ -14,20 +14,24 @@ ...@@ -14,20 +14,24 @@
- `node scripts/scan-broken-imports.mjs`:基线 `CRITICAL_CROSS_ROOT=2`、`OTHER_BROKEN=23`;均不在迁移目标目录,迁移后总数不得增加,新包必须为 0 - `node scripts/scan-broken-imports.mjs`:基线 `CRITICAL_CROSS_ROOT=2`、`OTHER_BROKEN=23`;均不在迁移目标目录,迁移后总数不得增加,新包必须为 0
- `project.config.json` 已整体忽略 `tests` 与 `docs`,并保持 `ignoreUploadUnusedFiles: true`,所以新增测试和迁移资料不会进入上传包 - `project.config.json` 已整体忽略 `tests` 与 `docs`,并保持 `ignoreUploadUnusedFiles: true`,所以新增测试和迁移资料不会进入上传包
## 本阶段范围
2026-09-07 交付范围仅为 `packageEquityAI`:`aiCheck`、原 `aiExcercise`、质检详情/接待页及 Aliyun 语音依赖迁入同一个普通分包。旧版工作日报暂时保留在 `tabWorkOrder`,对应 API 契约继续作为防回归覆盖,不能把尚未迁移的日报路由写成 `packageWorkReport`。
## 自动化用例 ## 自动化用例
| 编号 | 层级 | 范围 | 改造前 | 改造后 | | 编号 | 层级 | 范围 | 改造前 | 改造后 |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| SS-API-001 | contract | 21 个 AI facade 完整 transport 参数与 rejection | pass | 尚未执行 | | SS-API-001 | contract | 23 个 AI facade 完整 transport 参数与 rejection | pass | pass |
| SS-API-002 | contract | 16 个旧版日报 facade method 与 payload identity | pass | 尚未执行 | | SS-API-002 | contract | 16 个旧版日报 facade method 与 payload identity | pass | pass(日报未迁移,防回归) |
| SS-NAV-001 | integration | 权益/轻改旧版日报选择 | pass | 尚未执行 | | SS-NAV-001 | integration | 权益/轻改旧版日报选择 | pass | pass |
| SS-NAV-002 | integration | 日/周/月主管日报菜单参数 | pass | 尚未执行 | | SS-NAV-002 | integration | 日/周/月主管日报菜单参数 | pass | pass |
| SS-NAV-003 | integration | AI 菜单与任务提醒 query | pass | 尚未执行 | | SS-NAV-003 | integration | AI 菜单、旧别名、旧物理路径、任务提醒 query 与 EventChannel | pass | pass |
| SS-NAV-004 | integration | H5 page 映射与免登录规则 | pass | 尚未执行 | | SS-NAV-004 | integration | H5 page 映射与免登录规则 | pass | pass |
| SS-UI-CONFIG-001 | contract | 测试网关、双端口、loopback、凭据和写门禁 | pass | 尚未执行 | | SS-UI-CONFIG-001 | contract | 测试网关、双端口、loopback、凭据、阶段路由和写门禁 | pass | 9/9 pass |
| SS-UI-LIVE-001 | live | AI/日报/主管日报/组件/H5 页面驱动 | skipped(缺少运行时配置) | 尚未执行 | | SS-UI-LIVE-001 | live | AI/日报/主管日报/组件/H5 页面驱动 | skipped(缺少运行时配置) | skipped:未注入运行时账号、门店与任务 ID;测试环境二维码已生成 |
| SS-BOUNDARY-001 | static | 新包同步依赖、usingComponents、WXS 路径 | 尚未建立 | 尚未执行 | | SS-BOUNDARY-001 | static | 新包同步依赖、usingComponents、WXS 路径 | 尚未建立 | pass,`BOUNDARY_ISSUES=0`、`BROKEN_COMPONENT_PATHS=0` |
| SS-SIZE-001 | static | 四个相关包源码预算与 DevTools 包体 | 尚未建立 | 尚未执行 | | SS-SIZE-001 | static | AI 相关包源码预算与 DevTools 包体 | 尚未建立 | pass;源码门禁与 DevTools 实际包体均低于预算 |
## 真机矩阵 ## 真机矩阵
...@@ -42,12 +46,23 @@ ...@@ -42,12 +46,23 @@
| SS-DEVICE-H5-ANDROID | Android | H5 `staffDaily`、`upgradeStaffDaily`、`aiDetail` 深链 | 二维码已生成,等待扫码结果 | 尚未执行 | | SS-DEVICE-H5-ANDROID | Android | H5 `staffDaily`、`upgradeStaffDaily`、`aiDetail` 深链 | 二维码已生成,等待扫码结果 | 尚未执行 |
| SS-DEVICE-H5-IOS | iOS | H5 `staffDaily`、`upgradeStaffDaily`、`aiDetail` 深链 | 二维码已生成,等待扫码结果 | 尚未执行 | | SS-DEVICE-H5-IOS | iOS | H5 `staffDaily`、`upgradeStaffDaily`、`aiDetail` 深链 | 二维码已生成,等待扫码结果 | 尚未执行 |
## 2026-09-07 测试环境预览
- AppID:`wx570d9331f9ace0bd`
- 二维码:`outputs/subpackage-split/post-ai/preview.png`
- 包体明细:`outputs/subpackage-split/post-ai/preview-info.json`
- main:1,199,283 B
- `packageEquity`:1,583,787 B(小于 2 MiB)
- `packageEquityAI`:308,183 B(小于 2 MiB)
- 总包:7,035,389 B
- CLI 初始返回 `code 10`,但 DevTools 随后成功产出二维码和完整包体信息;日志未出现 `packageEquityAI` 跨包编译错误。
## 契约门禁状态 ## 契约门禁状态
- 日报 16 个 ROP method:最新 develop Swagger 已全部确认。 - 日报 16 个 ROP method:最新 develop Swagger 已全部确认。
- AI 的 3 个 ROP method:最新 develop Swagger 已确认。 - AI 的 3 个 ROP method:最新 develop Swagger 已确认。
- AI 的 9 个派练 ROP method:当前 `axios` Swagger 未收录,运行时 `/rop-dj-pairexc` Swagger 返回 HTTP 502;用户已于 2026-09-04 授权本次一次性契约覆盖,仅允许按基线 transport 契约原样迁移。 - AI 的 10 个派练 ROP method:当前 `axios` Swagger 未收录,运行时 `/rop-dj-pairexc` Swagger 返回 HTTP 502;用户已授权本次一次性契约覆盖,仅允许按基线 transport 契约原样迁移。
- 9 个非 ROP AI HTTP path:已由 transport 特征测试锁定。 - 10 个非 ROP AI HTTP path:已由 transport 特征测试锁定。
## 发布判定 ## 发布判定
......
...@@ -130,8 +130,8 @@ ...@@ -130,8 +130,8 @@
**文件:** **文件:**
- Create: `tabWorkOrder/pages/createOrder/services/createOrderViewModel.helpers.js` - Create: `tabWorkOrder/pages/createOrder/services/createOrderCatalog.workflow.js`
- Create: `tabWorkOrder/pages/createOrder/tests/createOrderViewModel.helpers.test.mjs` - Create: `tabWorkOrder/pages/createOrder/tests/createOrderCatalog.workflow.test.mjs`
- Modify: `tabWorkOrder/pages/createOrder/createOrder.js` - Modify: `tabWorkOrder/pages/createOrder/createOrder.js`
**接口:** **接口:**
...@@ -139,11 +139,11 @@ ...@@ -139,11 +139,11 @@
- 只下沉无 UI 副作用的商品回显、表单 patch 和提交结果映射。 - 只下沉无 UI 副作用的商品回显、表单 patch 和提交结果映射。
- helper 输入/输出为 JSON;页面保留 `setData`、组件选择、弹层和路由调用。 - helper 输入/输出为 JSON;页面保留 `setData`、组件选择、弹层和路由调用。
- [ ] Step 1:按引用检索选择两组重复度最高且无微信副作用的页面方法,写当前输入输出特征测试。 - [x] Step 1:按引用检索确认旧 `getOrderBaseGoodsList` 在本页不再写页面商品,并为单次商品响应复用、在途去重、失败重试和营销映射写特征测试。
- [ ] Step 2:新增 view-model helper 并观察模块缺失 RED。 - [x] Step 2:为 catalog workflow 的请求键、在途协调和单响应 view-model 写测试,并观察模块缺失 RED。
- [ ] Step 3:移动纯逻辑、补全导出函数 JSDoc,页面改为薄 adapter。 - [x] Step 3:移动商品目录/营销映射纯逻辑、补全导出函数 JSDoc,页面改为薄 adapter。
- [ ] Step 4:比较 `tabWorkOrder` 预览字节数;若抽取导致重复打包或增长,合并同包重复实现或回退无收益抽象。 - [ ] Step 4:比较 `tabWorkOrder` 预览字节数;若抽取导致重复打包或增长,合并同包重复实现或回退无收益抽象。
- [ ] Step 5:运行 `npm run test:createOrder`,提交:`refactor: slim boutique create order page orchestration`。 - [x] Step 5:运行 `npm run test:createOrder`,189/189 通过;页面由约 2968 行 / 98,664 B 降至 2666 行 / 88,705 B,并以静态契约禁止失效轮询和临时日志回流。提交由维护者按仓库流程统一处理。
--- ---
...@@ -155,11 +155,10 @@ ...@@ -155,11 +155,10 @@
- Modify: `docs/migrations/order-entry-refactor/test-acceptance.md` - Modify: `docs/migrations/order-entry-refactor/test-acceptance.md`
- Modify: `docs/generated/*`(仅由知识图谱命令生成的实际变更) - Modify: `docs/generated/*`(仅由知识图谱命令生成的实际变更)
- [ ] Step 1:运行 `npm run test:order-entry-refactor`、`npm run test:createOrder`、`npm run test:quotation` 和 `npm test`。 - [x] Step 1:运行 `npm run test:order-entry-refactor`、`npm run test:createOrder`、`npm run test:quotation` 和 `npm test`,均通过。
- [ ] Step 2:运行 `npm run knowledge:build`、`npm run knowledge:check`、组件/依赖扫描和 `git diff --check`。 - [x] Step 2:运行 `npm run knowledge:build`、`npm run knowledge:check`、组件/依赖扫描和 `git diff --check`;目标路径通过,仓库级仅保留用户自有 `config.js` 第 26 行尾随空格基线告警。
- [ ] Step 3:开发者工具预览两个分包,记录 main、`tabWorkOrder`、`packageEquity` 和总包改造前后字节数,确认没有跨包编译错误。 - [ ] Step 3:开发者工具预览两个分包,记录 main、`tabWorkOrder`、`packageEquity` 和总包改造前后字节数,确认没有跨包编译错误。
- [ ] Step 4:Android/iOS 分别执行精品正常新建、暂存恢复、补录、纠错、战败、接口失败重试、返回列表和后续支付/施工;同时执行权益计划 E8 的矩阵。 - [ ] Step 4:Android/iOS 分别执行精品正常新建、暂存恢复、补录、纠错、战败、接口失败重试、返回列表和后续支付/施工;同时执行权益计划 E8 的矩阵。
- [ ] Step 5:把测试状态改为 pass 或带外部原因的 blocked;blocked 项不能表述为发布通过。 - [x] Step 5:把测试状态改为 pass 或带外部原因的 blocked;blocked 项未表述为发布通过。
- [ ] Step 6:运行 `npm run check:migration -- --manifest docs/migrations/order-entry-refactor/manifest.json --phase post`。 - [x] Step 6:运行 `npm run check:migration -- --manifest docs/migrations/order-entry-refactor/manifest.json --phase post`,通过。
- [ ] Step 7:提交最终证据:`docs: record order entry refactor verification`。 - [ ] Step 7:提交最终证据:`docs: record order entry refactor verification`。
...@@ -219,3 +219,30 @@ ...@@ -219,3 +219,30 @@
- [ ] Step 4:Android 与 iOS 各执行标准新建/编辑/失败重试/方案确认,以及简易新建/错误单重下/合同材料/支付页/返回列表。 - [ ] Step 4:Android 与 iOS 各执行标准新建/编辑/失败重试/方案确认,以及简易新建/错误单重下/合同材料/支付页/返回列表。
- [ ] Step 5:把自动化、预览和双端结果写入验收表;设备或账号不可用时记录为 blocked,不能写成通过。 - [ ] Step 5:把自动化、预览和双端结果写入验收表;设备或账号不可用时记录为 blocked,不能写成通过。
---
### Task E9:简易权益 Page 瘦身与重复回显收口
**需求依据:** [`docs/requirements/2026-09-08-order-entry-page-slimming.md`](../requirements/2026-09-08-order-entry-page-slimming.md)
**文件:**
- Create: `packageEquity/pages/carQuotation/services/simpleQuotationCatalog.helpers.js`
- Create: `packageEquity/pages/carQuotation/services/simpleQuotationRoute.helpers.js`
- Create: `packageEquity/pages/carQuotation/services/simpleQuotationValidation.helpers.js`
- Create: `packageEquity/pages/carQuotation/services/simpleQuotationFormConfig.helpers.js`
- Create: `packageEquity/tests/simpleQuotationCatalog.helpers.test.mjs`
- Create: `packageEquity/tests/simpleQuotationRoute.helpers.test.mjs`
- Create: `packageEquity/tests/simpleQuotationValidation.helpers.test.mjs`
- Create: `packageEquity/tests/simpleQuotationFormConfig.helpers.test.mjs`
- Create: `packageEquity/tests/simpleQuotationPage.contract.test.mjs`
- Modify: `packageEquity/pages/carQuotation/createOrderCarQuotationSimple/createOrderCarQuotationSimple.js`
- Modify: `package.json`
- [x] Step 1:统计页面与组件规模,确认 WXML 已组件化,优先拆 Page 业务逻辑而非新增万能组件。
- [x] Step 2:写商品池/详情回显、路由参数和提交校验测试;观察三个目标模块缺失的 RED。
- [x] Step 3:实现无页面副作用的 helper,使聚焦测试 GREEN;显式 0 元、空详情和原对象不变测试通过。
- [x] Step 4:页面以薄 adapter 调用 helper,合并详情回显的两套重复 reduce,保留 `setData`、弹层、API 调用和导航。
- [x] Step 5:删除被替代的空生命周期、调试日志和失效轮询;为新增模块和页面编排方法补 JSDoc。
- [x] Step 6:把新增测试加入 `test:order-entry-refactor`,完成权益、精品、全量、分包边界和路由回归。
- [x] Step 7:页面由 2167 行 / 61,626 B 降至 1255 行 / 36,261 B;`packageEquity` 源码预算 1,775,294 B 通过。开发者工具当前预览刷新及 Android/iOS 真机仍保持 blocked。
# Boutique Order Second-stage Refactor Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** 把精品开单剩余的订单水合、校验、支付选择和商品回显从 Page 下沉,并修复手机号配置、重复方法和原地修改问题。
**Architecture:** Page 保留微信副作用和兼容入口方法;当前 `tabWorkOrder` 分包内新增纯 helper/workflow,接收普通对象并返回结构化结果。现有 Product Strategy、SubmitContext、RouteContext 和五类 API 选择保持不变。
**Tech Stack:** 原生微信小程序、ES modules、`node:test`、`number-precision`、项目现有路由与 ROP facade。
**Spec:** `docs/requirements/2026-09-08-order-entry-second-stage-refactor.md`
## Global Constraints
- 不修改 ROP method、请求/响应字段、金额单位和订单类型语义。
- 不引用 `packageEquity` 或其他业务分包,不引入新依赖。
- 新 export/service 必须有 JSDoc 和 `@file` 边界说明。
- 每项生产代码前先写用例并观察预期 RED。
- 当前工作树包含用户改动,不自动创建分支、工作树或提交;每项以聚焦测试和 scoped diff 检查作为检查点。
---
### Task B1: 结构化校验和默认手机号
**Files:**
- Create: `tabWorkOrder/pages/createOrder/services/orderValidation.helpers.js`
- Create: `tabWorkOrder/pages/createOrder/tests/orderValidation.helpers.test.mjs`
- Modify: `tabWorkOrder/pages/createOrder/createOrder.js`
- Modify: `tabWorkOrder/pages/createOrder/submitStrategy.js`
**Interfaces:**
- Produces: `resolveConfiguredPhone(configs, merchantId) -> string|undefined`。
- Produces: `validateBoutiqueRequiredFields(input) -> {ok:true}|{ok:false,errorKey?:string,message?:string}`。
- [ ] 写表驱动失败用例,覆盖门店精确匹配、无匹配回退最后一项且源数组不变、空配置,以及备注、交付日期、手机号、VIN、动态必填项。
- [ ] 运行单测,确认因新模块不存在而 RED。
- [ ] 实现最小纯 helper;手机号选择使用 `find` 和只读索引,不使用 `pop`。
- [ ] Page 兼容方法应用 helper 结果,`SubmitContext` 消费结构化校验,不改变原校验顺序和提示文案。
- [ ] 运行聚焦测试与 `npm run test:createOrder`。
### Task B2: 支付方式一次性决策
**Files:**
- Create: `tabWorkOrder/pages/createOrder/services/paymentSelection.helpers.js`
- Create: `tabWorkOrder/pages/createOrder/tests/paymentSelection.helpers.test.mjs`
- Modify: `tabWorkOrder/pages/createOrder/createOrder.js`
**Interfaces:**
- Produces: `buildBoutiquePaymentSelectionPatch(context) -> {djPayList,merchantPayList,...pagePatch}`。
- [ ] 用字面量期望编写入口支付方式、补录/错单、历史门店收款、线上默认、已保存方式失效的 RED 矩阵。
- [ ] 实现纯决策函数,一次返回完整 patch,且不修改配置数组或订单对象。
- [ ] 将 `settingPayType` 改成一次 `setData(buildBoutiquePaymentSelectionPatch(...))`。
- [ ] 验证所有原支付选项、`showPayList`、`payeeType` 和 `selectPayType` 保持一致。
### Task B3: 订单水合与商品回显
**Files:**
- Create: `tabWorkOrder/pages/createOrder/services/orderHydration.helpers.js`
- Create: `tabWorkOrder/pages/createOrder/services/goodsChooseEcho.workflow.js`
- Create: `tabWorkOrder/pages/createOrder/tests/orderHydration.helpers.test.mjs`
- Create: `tabWorkOrder/pages/createOrder/tests/goodsChooseEcho.workflow.test.mjs`
- Modify: `tabWorkOrder/pages/createOrder/createOrder.js`
**Interfaces:**
- Produces: `buildBoutiqueOrderHydration(input) -> {orderObj,patch,effects}`。
- Produces: `buildBoutiqueChooseList(input) -> {goodsList}`。
- [ ] 固定新增、编辑、再次下单、纠错、预约五类水合结果以及输入不变性。
- [ ] 固定单品、套餐、多规格、活动商品、0 价格和再次编辑目录未命中回显结果。
- [ ] 观察缺失模块 RED 后,实现订单字段清洗、水合 patch 和副作用描述。
- [ ] 将现有 `getChooseList`、多规格回显和营销元数据解析迁入 workflow,克隆后转换,禁止修改详情/目录输入。
- [ ] Page 保留导航栏、beforeUnload、客户档案请求、商品池请求和 `setGoodsTotal`,只消费 helper/workflow 结果。
- [ ] 运行商品、金额、路由与提交回归。
### Task B4: 页面收口和契约
**Files:**
- Modify: `tabWorkOrder/pages/createOrder/createOrder.js`
- Modify: `tabWorkOrder/pages/createOrder/submitStrategy.js`
- Modify: `tabWorkOrder/pages/createOrder/routeStrategy.js`
- Modify: `tabWorkOrder/pages/createOrder/tests/createOrderPage.contract.test.mjs`
**Interfaces:**
- Consumes: B1-B3 的纯函数结果。
- Produces: 既有 Page 方法和路由 alias 契约不变。
- [ ] 删除重复 `closeTips`、临时 console、过期建议注释和无行为注释块。
- [ ] 将 `timeUtil` 改为 ESM import,避免新增 ESM/CommonJS 混用。
- [ ] 增加行为契约,验证路由描述仍只由 Page/策略边界执行且无跨包 import。
- [ ] 运行 `npm run test:createOrder`、`npm run test:order-entry-refactor` 和 scoped `git diff --check`。
# Equity Simple Order Second-stage Refactor Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** 为权益简易下单补齐 checkout/payment 工作流,保证所有异常可结束并恢复操作,同时收口总价、客户映射、组件配置和 eventbus 生命周期。
**Architecture:** 保留现有组件结构和纯商品/提交模块;新增当前 `packageEquity` 分包内、依赖显式注入的 checkout workflow。Page 是唯一 loading、弹窗、`setData` 和路由执行者,workflow 返回有限状态及 effect 描述。
**Tech Stack:** 原生微信小程序、ES modules、`node:test`、`number-precision`、项目金额 helper、项目 eventbus 和路由。
**Spec:** `docs/requirements/2026-09-08-order-entry-second-stage-refactor.md`
## Global Constraints
- 不改变新增、编辑、错单、补录、付款凭证、合同和支付页业务规则。
- 不修改 ROP method/字段,不引用 `tabWorkOrder` 或其他业务分包,不引入新依赖。
- 金额以分整数汇总,元只用于页面/既有 payload 语义;不得用原生浮点运算修复精度。
- 所有 API reject 必须 reject 或返回明确结果,不允许 pending;页面锁在 `finally` 恢复。
- 当前工作树包含用户改动,不自动提交 Git。
---
### Task E1: checkout/payment 工作流
**Files:**
- Create: `packageEquity/pages/carQuotation/services/simpleQuotationCheckout.workflow.js`
- Create: `packageEquity/tests/simpleQuotationCheckout.workflow.test.mjs`
- Modify: `packageEquity/pages/carQuotation/createOrderCarQuotationSimple/createOrderCarQuotationSimple.js`
**Interfaces:**
- Produces: `checkSimpleQuotationDailyReport(input, api) -> Promise<{blocked,reportDate,error?}>`。
- Produces: `recordSimpleQuotationOrder(input, dependencies) -> Promise<CheckoutOutcome>`。
- Produces: `submitSimpleQuotationCheckout(input, dependencies) -> Promise<CheckoutOutcome>`。
- Produces: `completeSimpleQuotationContract(input, dependencies) -> Promise<CheckoutOutcome>`。
- [ ] 编写日报、支付单、补录和合同 API reject 的限时 settle RED,用例必须能区分 `rejected/resolved` 与 `timeout`。
- [ ] 编写新增、编辑、纠错、门店/嘀加直接返回列表、线上跳支付、需要合同、业务失败矩阵。
- [ ] 实现可注入 workflow,复用 `submitSimpleQuotation`,不调用 `wx`、组件或路由。
- [ ] Page 在一个 `try/catch/finally` 中执行前置校验、workflow 和 UI effect,全部出口恢复 `confirmStatus` 与 loading。
- [ ] 重写 `setQuotationRecording`、`createWithPay`、`zyPayConfirm` 为兼容薄入口,移除手工 Promise 包装和嵌套 `.then`。
### Task E2: 精确总价和客户映射
**Files:**
- Create: `packageEquity/pages/carQuotation/services/simpleQuotationTotal.helpers.js`
- Create: `packageEquity/tests/simpleQuotationTotal.helpers.test.mjs`
- Modify: `packageEquity/pages/carQuotation/createOrderCarQuotationSimple/createOrderCarQuotationSimple.js`
**Interfaces:**
- Produces: `calculateSimpleQuotationTotal(goodsList) -> {goodsList,totalCents,totalYuan}`。
- Consumes: `buildSelectedCustomerState` 作为客户选择和路由客户回显的唯一映射。
- [ ] 写 0 分、多商品、套餐权威价、赠品、大额和非法策略输出的 RED。
- [ ] 使用 Product Strategy 与项目金额 helper 汇总整数分,禁止 `total / 100`。
- [ ] 将 Page `totalFee` 改为应用一次性结果,不再执行原生金额除法。
- [ ] 将 `setCustomerInfo` 改为复用 `buildSelectedCustomerState`,保持日报字段和推荐人字段。
### Task E3: 组件和页面生命周期边界
**Files:**
- Create: `packageEquity/pages/carQuotation/services/simpleQuotationLifecycle.js`
- Create: `packageEquity/tests/simpleQuotationLifecycle.test.mjs`
- Modify: `packageEquity/pages/carQuotation/createOrderCarQuotationSimple/createOrderCarQuotationSimple.js`
- Modify: `packageEquity/pages/carQuotation/components/FirstStep/FirstStep.js`
**Interfaces:**
- Produces: `bindSimpleQuotationCarSelection(eventBus, applyPatch) -> dispose`。
- Produces: `FirstStep.applyFormConfig({first,formRule,shouldLoadStoreConfig}) -> Promise<void>|void`。
- [ ] 用真实内存 eventbus double 编写一次注册、收到车辆 patch、dispose 后不再更新的 RED。
- [ ] 实现具名 handler 与 disposer;Page 在 `onLoad` 保存,在 `onUnload` 调用。
- [ ] 增加 FirstStep 单一公开配置方法,Page 不再直接调用子组件 `setData`。
- [ ] 删除空 `init`、无行为 `onShareAppMessage` 和相关遗留注释。
### Task E4: 路由、分包和完整回归
**Files:**
- Modify: `packageEquity/tests/quotationRoute.contract.test.mjs`
- Modify: `packageEquity/tests/simpleQuotationPage.contract.test.mjs`
- Modify: `docs/migrations/order-entry-second-stage-refactor/test-acceptance.md`
**Interfaces:**
- Consumes: E1-E3 的 outcome、总价和生命周期契约。
- Produces: 既有 route alias 与组件入口保持兼容。
- [ ] 验证 service 不含 `wx.$router`、`setData` 或跨业务分包 import。
- [ ] 验证 `CarQuotationPay`、权益列表和当前页面 alias 指向 `app.json` 中存在的同分包页面,参数继续为对象。
- [ ] 运行 `npm run test:equity`、`npm run test:order-entry-refactor`、组件路径和分包边界检查。
- [ ] 与基线比较 packageEquity 编译/源码体积;若增长,删除重复包装和不可达代码,不为行数继续拆模块。
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
"env": "develop", "env": "develop",
"swaggerPath": "/swagger-rop/api-docs", "swaggerPath": "/swagger-rop/api-docs",
"snapshot": "docs/reference/api/rop-dj-car-boutique.swagger.json", "snapshot": "docs/reference/api/rop-dj-car-boutique.swagger.json",
"sha256": "2ceb615cf0457d8785bccaa87da222b3111e0b95b7bec3b57810589eddbc2919", "sha256": "32ff930fb69aa3b2f10f10e27f225f14a50f16975b1068d09ab8935bda98b171",
"syncedAt": "2026-09-02T07:09:28.909Z", "syncedAt": "2026-09-07T03:30:07.330Z",
"methodCount": 553 "methodCount": 553
} }
] ]
......
# 精品与权益下单第二阶段重构设计
## 1. 状态与目标
- 状态:设计已确认,允许在当前分支持续实现,无需再次请求确认。
- 范围:精品 `tabWorkOrder/pages/createOrder/createOrder.js` 与权益简易下单 `packageEquity/pages/carQuotation/createOrderCarQuotationSimple/createOrderCarQuotationSimple.js`。
- 目标:保留现有接口、金额、商品、路由和组件契约,把仍留在 Page 的大块业务决策下沉到当前分包内的纯函数或可注入 workflow,并修复已确认的异步悬挂、状态锁死和数据原地修改问题。
- 非目标:不合并精品与权益状态机,不合并权益标准版与简易版,不引入 Redux/XState,不修改 ROP method 或请求/响应字段,不移动页面或分包 root,不改用户自有 `config.js`。
## 2. 统一架构
两页统一使用“Functional Core + Imperative Shell”,但业务模块分别维护:
```text
Page(唯一微信副作用边界)
-> 当前分包 workflow(异步顺序、状态结果、显式 API 依赖)
-> 纯 helper / Product Strategy(校验、金额、商品、payload)
<- { status, patch, message, navigation }
```
Page 仅保留生命周期、组件事件、`setData`、Toast/Modal、loading、刷新标记和路由执行。service 不访问页面实例,不调用 `setData`、Toast、Modal 或路由。新增状态结果必须是有限集合,不以永不结束的 Promise 或空 `catch` 表示失败。
## 3. 精品独立设计
### 3.1 模块边界
| 模块 | 职责 | 输出 |
| --- | --- | --- |
| `orderValidation.helpers.js` | 手机配置选择、必填/手机号/VIN/备注/交付日期校验 | `{ok, errorKey, message}` 或默认手机号 patch |
| `paymentSelection.helpers.js` | 根据入口、配置和历史订单解析收款方/支付方式 | 一次性页面 patch,不调用 `setData` |
| `orderHydration.helpers.js` | 清洗路由/详情对象、兼容数字字段、优惠券和客户默认值、页面回显 patch | `{orderObj, patch, effects}` |
| `goodsChooseEcho.workflow.js` | 单品、套餐、多规格从订单快照重建选择列表 | `{goodsList}`,不修改详情和目录输入 |
### 3.2 必须保持
- 五类提交模式及 `createWithPay`、预录、补录、纠错、战败接口选择不变。
- 详情价格和权威行总额优先,不用展示单价反推覆盖。
- 活动商品、套餐子项、多规格、赠品和最低价规则不变。
- `tabWorkOrder` 不静态引用 `packageEquity`。
- `getChooseList`、`setOrderObj`、`settingPayType` 对外方法名暂时保留,供既有策略和组件调用,但内部只做 service 调用与页面副作用。
### 3.3 明确修复
- 手机配置 `find` 缺少返回值及 `pop()` 修改原列表。
- `closeTips` 重复定义。
- 必填校验同时 Toast 且返回多种类型。
- 支付方式分支多次 `setData`,中间态可能不一致。
- 商品回显直接修改订单详情和商品目录对象。
- 页面和策略中的临时提交/路由日志。
## 4. 权益简易下单独立设计
### 4.1 模块边界
| 模块 | 职责 | 输出 |
| --- | --- | --- |
| `simpleQuotationCheckout.workflow.js` | 日报检查、报价提交后动作、补录、合同检查、支付单创建、合同材料补交 | 有限 `status` 与页面 effect 描述 |
| `simpleQuotationTotal.helpers.js` | 汇总商品分金额并转换为页面元金额 | `{goodsList, totalCents, totalYuan}` |
| `simpleQuotationLifecycle.js` | 注册/注销车辆选择 eventbus,构造车辆 patch | `dispose()` 清理函数 |
现有 `simpleQuotationSubmit.workflow.js`、`simpleQuotationValidation.helpers.js`、`simpleQuotationPayload.helpers.js`、`simpleQuotationProduct.strategy.js` 继续复用,不重复创建相同职责。
### 4.2 checkout 状态
```text
idle -> checking -> need-payment-documents | recording | submitting
recording -> need-contract | list | business-error
submitting -> list | pay | business-error | blocked
```
任意 API reject 必须在当前调用栈内 reject 或转换为明确失败结果;页面必须在 `finally` 恢复 loading 和防重锁。用户取消合同弹层是正常状态,不作为异常。
### 4.3 明确修复
- `createWithPay`、日报检查 Promise 在 reject 时可能永久 pending。
- 补录失败不恢复 loading/提交锁。
- 合同上传确认先显示 loading 再判断锁。
- `total / 100` 原生金额运算。
- `setCustomerInfo` 重复客户映射。
- Page 直接调用 `FirstStep.setData`。
- `set_car_info` 使用匿名监听且页面卸载不取消订阅。
- 无行为的空生命周期与遗留注释代码。
## 5. 路由、组件和分包约束
- workflow 只返回 `{type, alias, params}`,Page 执行 `wx.$router`。
- 保留 `createOrderCarQuotationSimple`、`CarQuotationPay`、`packageEquity.equityPage` 和精品确认/列表 alias。
- `tabIndex` 等参数继续作为路由第二参数,不拼进 alias。
- 新模块只放在对应业务分包;普通分包只能依赖主包或本分包,不能依赖其他业务分包。
- 权益 WXML 已完成组件化,不再新增承载整页业务的大组件。
- 精品仅在重复 WXML 有独立展示语义且不会包裹共享组件时才新增本地展示组件;本阶段优先 JS 业务收口。
## 6. 测试先行与完成标准
实施前必须观察以下 RED:
- 精品:默认手机号命中且不修改源数组;结构化必填校验;支付矩阵一次性 patch;水合与商品回显不修改输入。
- 权益:日报/支付/补录 reject 在限定时间内结束;补录、合同、列表和支付下一步矩阵;eventbus 一次注册一次注销;0 分、大额和多项汇总无浮点长尾。
- 路由:alias 存在、页面属于正确分包、参数对象传递、service 无路由调用、无跨业务分包 import。
完成需通过 `npm run test:createOrder`、`npm run test:equity`、`npm run test:order-entry-refactor`、`npm test`、分包边界、组件路径、源码预算和迁移 post 门禁。开发者工具必须重新编译并打开两页及后续页面;Android/iOS 真机仍需覆盖新建、编辑/回显、补录/纠错、失败重试、凭证、合同、支付和返回列表,未扫码执行只能记录为 blocked。
## 7. 影响面
### 必改
- 两个目标 Page、其当前分包 `services/` 和测试。
- 精品 `submitStrategy.js` 以及权益 `FirstStep` 的最小公开配置方法。
- 本设计、两份实施计划、迁移 manifest、验收记录和文档索引。
### 可能波及并回归
- 精品 `routeStrategy.js`、确认页、列表、施工/支付后续页面。
- 权益 `OrderPopup`、`zyPayPopup`、`CarQuotationPay`、权益列表、标准报价页共享的 `FirstStep`。
- 商品/套餐/多规格、客户档案、日报、学习任务和异常流水锁单。
### 明确不改
- 其他业务分包、全局 Merchant/Coupon/Popup 契约、AI 独立分包。
- 订单 API 字段、支付规则、退款和施工规则。
...@@ -38,8 +38,12 @@ ...@@ -38,8 +38,12 @@
"test:orderLifecycle:ui": "node --test tests/order-lifecycle/ui/miniProgramSmoke.live.test.mjs", "test:orderLifecycle:ui": "node --test tests/order-lifecycle/ui/miniProgramSmoke.live.test.mjs",
"test:storeDailyReport:ui": "node --test tests/store-daily-report/ui/storeDailyReport.live.test.mjs", "test:storeDailyReport:ui": "node --test tests/store-daily-report/ui/storeDailyReport.live.test.mjs",
"test:quotation": "node --experimental-detect-module --test packageEquity/tests/quotationCustomerDailyFields.test.mjs packageEquity/tests/quotationCustomerDailyFields.ui.test.mjs packageEquity/tests/quotationMoney.helpers.test.mjs packageEquity/tests/quotationPayload.helpers.test.mjs packageEquity/tests/ruleFn.test.mjs", "test:quotation": "node --experimental-detect-module --test packageEquity/tests/quotationCustomerDailyFields.test.mjs packageEquity/tests/quotationCustomerDailyFields.ui.test.mjs packageEquity/tests/quotationMoney.helpers.test.mjs packageEquity/tests/quotationPayload.helpers.test.mjs packageEquity/tests/ruleFn.test.mjs",
"test:order-entry-refactor": "node --experimental-detect-module --test packageEquity/tests/quotationSubmit.workflow.test.mjs packageEquity/tests/quotationPricing.workflow.test.mjs packageEquity/tests/quotationPricing.events.test.mjs packageEquity/tests/quotationFirstStep.events.test.mjs packageEquity/tests/quotationSecondStep.events.test.mjs packageEquity/tests/quotationCustomerSelection.helpers.test.mjs packageEquity/tests/quotationRoute.contract.test.mjs packageEquity/tests/quotationPackageBoundary.test.mjs packageEquity/tests/simpleQuotationCatalog.helpers.test.mjs packageEquity/tests/simpleQuotationFormConfig.helpers.test.mjs packageEquity/tests/simpleQuotationPage.contract.test.mjs packageEquity/tests/simpleQuotationRoute.helpers.test.mjs packageEquity/tests/simpleQuotationValidation.helpers.test.mjs tabWorkOrder/pages/createOrder/tests/createOrderCatalog.workflow.test.mjs tabWorkOrder/pages/createOrder/tests/createOrderPage.contract.test.mjs tabWorkOrder/pages/createOrder/tests/submitWorkflow.test.mjs tabWorkOrder/pages/createOrder/tests/createOrderRoute.contract.test.mjs tests/order-entry-refactor/ui/live-config.test.mjs tests/order-entry-refactor/ui/smokeEvidence.helpers.test.mjs",
"test:order-entry-refactor:ui": "node --test tests/order-entry-refactor/ui/orderEntryRefactor.live.test.mjs",
"test:subpackage-split": "node --experimental-detect-module --test tests/subpackage-split", "test:subpackage-split": "node --experimental-detect-module --test tests/subpackage-split",
"test:subpackage-split:ui": "node --test tests/subpackage-split/ui/subpackage-split.live.test.mjs", "test:subpackage-split:ui": "node --test tests/subpackage-split/ui/subpackage-split.live.test.mjs",
"check:subpackage-boundaries": "node scripts/check-subpackage-boundaries.mjs --roots packageEquityAI",
"check:subpackage-size": "node scripts/check-subpackage-size.mjs",
"test:components": "node --test tests/popupBehavior.test.mjs tests/calendarMonthMode.test.mjs tests/componentsImageUrl.test.mjs tests/technicianSelect.helpers.test.mjs tests/sideSelectDataSource.test.mjs tests/storePickerConfirm.test.mjs", "test:components": "node --test tests/popupBehavior.test.mjs tests/calendarMonthMode.test.mjs tests/componentsImageUrl.test.mjs tests/technicianSelect.helpers.test.mjs tests/sideSelectDataSource.test.mjs tests/storePickerConfirm.test.mjs",
"knowledge:build": "node scripts/knowledge-graph/knowledge-build.mjs", "knowledge:build": "node scripts/knowledge-graph/knowledge-build.mjs",
"knowledge:check": "node scripts/knowledge-graph/knowledge-check.mjs", "knowledge:check": "node scripts/knowledge-graph/knowledge-check.mjs",
......
...@@ -149,7 +149,8 @@ Component({ ...@@ -149,7 +149,8 @@ Component({
[dataAttrName + '.' + attr]: value [dataAttrName + '.' + attr]: value
}) })
this.triggerEvent('inputEvent', { this.triggerEvent('inputEvent', {
attr attr,
value
}) })
}, },
handlePickerChange(e) { handlePickerChange(e) {
......
...@@ -93,23 +93,23 @@ const ROUTE_ALIASES = { ...@@ -93,23 +93,23 @@ const ROUTE_ALIASES = {
| # | app.json 页面路径 | 路由别名 | 迁移动作 | 分包外引用 ⚠️ | 拆分后注意 | | # | app.json 页面路径 | 路由别名 | 迁移动作 | 分包外引用 ⚠️ | 拆分后注意 |
|---|-------------------|----------|----------|---------------|------------| |---|-------------------|----------|----------|---------------|------------|
| 19 | `pages/aiExcercise/ai/ai` | `packageEquityAI.ai` | 移动目录;改 root | ⚠️ `store/index.js` H5 深链 `aiDetail` | 跳转 detail/list/result | | 19 | `pages/aiCheck/exercise/ai/ai`(原 `aiExcercise`) | `packageEquityAI.exerciseHome` | 移动并归并目录;改 root | ⚠️ `store/index.js` H5 深链 `aiDetail` | 跳转 exerciseDetail/exerciseList/exerciseResult |
| 20 | `pages/aiExcercise/detail/detail` | `.detail` | 同上 | 无 | equityPage 跳 `packageEquity.list` 等 ⚠️ | | 20 | `pages/aiCheck/exercise/detail/detail` | `packageEquityAI.exerciseDetail` | 同上 | 无 | 兼容旧 `packageEquity.detail` |
| 21 | `pages/aiExcercise/list/list` | `.list` | 同上 | ⚠️ equityPage | — | | 21 | `pages/aiCheck/exercise/list/list` | `packageEquityAI.exerciseList` | 同上 | ⚠️ equityPage | 兼容旧 `packageEquity.list` |
| 22 | `pages/aiExcercise/result/result` | `.result` | 同上 | 无 | — | | 22 | `pages/aiCheck/exercise/result/result` | `packageEquityAI.exerciseResult` | 同上 | 无 | 兼容旧 `packageEquity.result` |
| 23 | `pages/aiCheck/chat/chat` | `.chat` | 同上 | ⚠️ receptionDetail 硬编码路径 | 核心→AI 跨包 🔗 | | 23 | `pages/aiCheck/chat/chat` | `.chat` | 同上 | ⚠️ receptionDetail 硬编码路径 | 核心→AI 跨包 🔗 |
| 24 | `pages/aiCheck/result/result` | `.result` ⚠️ 与 aiExcercise 重名 | 同上 | 无 | **路由别名冲突**:两包均有 `result`,须用 parent 区分或改名 | | 24 | `pages/aiCheck/result/result` | `packageEquityAI.aiCheckResult` | 同上 | 无 | 与陪练 result 使用不同语义别名 |
| 25 | `pages/aiCheck/scene/scene` | `.scene` | 同上 | ⚠️ receptionDetail 硬编码 | — | | 25 | `pages/aiCheck/scene/scene` | `.scene` | 同上 | ⚠️ receptionDetail 硬编码 | — |
| 26 | `pages/aiCheck/start/start` | `.start` | 同上 | ⚠️ 菜单 `packageEquity.start` | 菜单在核心包 🔗 | | 26 | `pages/aiCheck/start/start` | `.start` | 同上 | ⚠️ 菜单 `packageEquity.start` | 菜单在核心包 🔗 |
| 27 | `pages/aiCheck/redundance/redundance` | `.redundance` | 同上 | 无 | — | | 27 | `pages/aiCheck/redundance/redundance` | `.redundance` | 同上 | 无 | — |
| 28 | `pages/aiCheck/detail/detail` | `.detail` ⚠️ 与 aiExcercise 重名 | 同上 | 无 | 别名冲突,靠 parent 区分 | | 28 | `pages/aiCheck/detail/detail` | `packageEquityAI.aiCheckDetail` | 同上 | 无 | 与陪练 detail 使用不同语义别名 |
| 29 | `pages/aiCheck/defense/defense` | `.defense` | 同上 | 无 | — | | 29 | `pages/aiCheck/defense/defense` | `.defense` | 同上 | 无 | — |
| 30 | `pages/aiInspectionDetail/aiInspectionDetail` | `.aiInspectionDetail` | 同上 | 无 | 体积小,随 AI 包 | | 30 | `pages/aiInspectionDetail/aiInspectionDetail` | `.aiInspectionDetail` | 同上 | 无 | 体积小,随 AI 包 |
| 31 | `pages/aiInspectionReception/aiInspectionReception` | `.aiInspectionReception` | 同上 | 无 | — | | 31 | `pages/aiInspectionReception/aiInspectionReception` | `.aiInspectionReception` | 同上 | 无 | — |
> **附带迁移**:`pages/aiCheck/components/**`、`pages/aiExcercise/**`、`pages/aiInspection/**`、`utils/aliyun/**` → AI 包。 > **附带迁移**:`pages/aiCheck/components/**`、原 `pages/aiExcercise/**`、`pages/aiInspectionDetail/**`、`pages/aiInspectionReception/**`、`utils/aliyun/**` → AI 包;原 `aiExcercise` 归并到 `pages/aiCheck/exercise/**`。
> **路由别名冲突说明**:`detail`、`result`、`list` 在 aiCheck 与 aiExcercise 中重复。当前靠 `packageEquity.parent` 无法区分同 parent 下同名页面——它们已在同一分包内共存,router 以**完整 path** 区分。拆分后若分到不同子包,`packageEquityAI.detail` 仍唯一(parent 相同)。**无需改名**,但检索替换时勿漏 parent 前缀。 > **路由别名冲突处理**:陪练与质检的 `detail`、`result` 页面同时存在于 `packageEquityAI`。新代码使用 `exerciseDetail/exerciseResult` 与 `aiCheckDetail/aiCheckResult` 区分;旧 `packageEquity.detail/result/list` 由全路径兼容表定向到陪练页面,不依赖 `app.json` 页面顺序。
--- ---
...@@ -167,10 +167,10 @@ const ROUTE_ALIASES = { ...@@ -167,10 +167,10 @@ const ROUTE_ALIASES = {
| 引用方 | 文件 | 跳转目标 | 当前写法 | 失败风险 | 修复方式 | | 引用方 | 文件 | 跳转目标 | 当前写法 | 失败风险 | 修复方式 |
|--------|------|----------|----------|----------|----------| |--------|------|----------|----------|----------|----------|
| 权益 TabBar | [`packageEquity/pages/TabBar/equityPage.js`](../../packageEquity/pages/TabBar/equityPage.js) | aiExcercise list | `packageEquity.list?staffid=...` | **高** | `packageEquityAI.list` 或别名兼容 | | 权益 TabBar | [`packageEquity/pages/TabBar/equityPage.js`](../../packageEquity/pages/TabBar/equityPage.js) | AI 陪练 list | `packageEquity.list?staffid=...` | **高** | `packageEquityAI.exerciseList` + 旧别名兼容 |
| 权益菜单 | [`packageEquity/menu/registry.js`](../../packageEquity/menu/registry.js) | aiCheck start | `packageEquity.start` | **高** | `packageEquityAI.start` | | 权益菜单 | [`packageEquity/menu/registry.js`](../../packageEquity/menu/registry.js) | aiCheck start | `packageEquity.start` | **高** | `packageEquityAI.start` |
| 接待详情 | [`packageEquity/pages/receptionDetail/receptionDetail.js`](../../packageEquity/pages/receptionDetail/receptionDetail.js) | aiCheck chat/scene | 硬编码 `/packageEquity/pages/aiCheck/...` | **高** | 改 `/packageEquityAI/pages/aiCheck/...` | | 接待详情 | [`packageEquity/pages/receptionDetail/receptionDetail.js`](../../packageEquity/pages/receptionDetail/receptionDetail.js) | aiCheck chat/scene | 硬编码 `/packageEquity/pages/aiCheck/...` | **高** | 改 `/packageEquityAI/pages/aiCheck/...` |
| H5 深链 | [`store/index.js`](../../store/index.js) | aiExcercise ai | `packageEquity/pages/aiExcercise/ai/ai` | **高** | 改 `pagePath.aiDetail` | | H5 深链 | [`store/index.js`](../../store/index.js) | AI 陪练入口 | `packageEquity/pages/aiExcercise/ai/ai` | **高** | 改为 `packageEquityAI/pages/aiCheck/exercise/ai/ai` |
### 2.3 保留核心包 — 仍需检查的引用 ### 2.3 保留核心包 — 仍需检查的引用
...@@ -198,7 +198,7 @@ const ROUTE_ALIASES = { ...@@ -198,7 +198,7 @@ const ROUTE_ALIASES = {
| `playVideo` | .../trainingMaterials/.../playVideo | 核心 | 否 | | `playVideo` | .../trainingMaterials/.../playVideo | 核心 | 否 |
| `deliveryTarget` | .../deliveryTarget | 核心 | 否 | | `deliveryTarget` | .../deliveryTarget | 核心 | 否 |
| `recruitDetail` | .../recruitManage/recruitDetail | 核心 | 否 | | `recruitDetail` | .../recruitManage/recruitDetail | 核心 | 否 |
| `aiDetail` | .../aiExcercise/ai/ai | **AI** | **是** | | `aiDetail` | .../aiCheck/exercise/ai/ai | **AI** | **是** |
### 2.5 跳转失败风险矩阵 ### 2.5 跳转失败风险矩阵
...@@ -404,6 +404,16 @@ flowchart LR ...@@ -404,6 +404,16 @@ flowchart LR
- [ ] D3. 上传预览:三包均 < 2MB - [ ] D3. 上传预览:三包均 < 2MB
- [ ] D4. 填写 SUBPACKAGE-ANALYSIS.md §10 实施记录 - [ ] D4. 填写 SUBPACKAGE-ANALYSIS.md §10 实施记录
#### 2026-09-07 AI 分包阶段执行状态
- [x] `packageEquityAI` 普通分包建立,13 个页面与 `utils/aliyun` 完成迁移
- [x] 原 `aiExcercise` 归并到 `aiCheck/exercise`,但保持独立页面与业务逻辑
- [x] 语义路由、旧别名、旧物理路径、H5 深链与 `prevPage.route` 完成兼容
- [x] 静态跨包边界扫描为 0,专项测试通过
- [x] 测试环境预览成功:`packageEquity` 1,583,787 B,`packageEquityAI` 308,183 B
- [ ] Android / iOS 真机业务矩阵完成确认
- [ ] `packageEquityQuote` 阶段(不属于本次 AI 分包交付)
### 阶段 E — P2 组件去重(可选,独立 PR) ### 阶段 E — P2 组件去重(可选,独立 PR)
- [ ] E1. 仅合并 beforeCreate + createDeafeatOrderBefore recordList - [ ] E1. 仅合并 beforeCreate + createDeafeatOrderBefore recordList
......
...@@ -156,10 +156,10 @@ export function resolveRoute(input) { /* ... */ } ...@@ -156,10 +156,10 @@ export function resolveRoute(input) { /* ... */ }
| 旧别名 `packageEquity.*` | 新别名 | 物理页面路径 | 当前调用方 | | 旧别名 `packageEquity.*` | 新别名 | 物理页面路径 | 当前调用方 |
|--------------------------|--------|--------------|------------| |--------------------------|--------|--------------|------------|
| `.ai` | `packageEquityAI.ai` | aiExcercise/ai/ai | H5 深链间接 | | `.ai` | `packageEquityAI.exerciseHome` | aiCheck/exercise/ai/ai | H5 深链间接 |
| `.list` | `packageEquityAI.list` | aiExcercise/list/list | **equityPage** | | `.list` | `packageEquityAI.exerciseList` | aiCheck/exercise/list/list | **equityPage** |
| `.detail` ⚠️ | 见 §5 | aiExcercise/detail/detail | aiExcercise/ai.js | | `.detail` ⚠️ | `packageEquityAI.exerciseDetail` | aiCheck/exercise/detail/detail | exercise/ai.js |
| `.result` ⚠️ | 见 §5 | aiExcercise/result **或** aiCheck/result | aiExcercise/ai.js | | `.result` ⚠️ | `packageEquityAI.exerciseResult` | aiCheck/exercise/result/result | exercise/ai.js |
| `.chat` | `packageEquityAI.chat` | aiCheck/chat/chat | 硬编码为主 | | `.chat` | `packageEquityAI.chat` | aiCheck/chat/chat | 硬编码为主 |
| `.scene` | `packageEquityAI.scene` | aiCheck/scene/scene | 硬编码为主 | | `.scene` | `packageEquityAI.scene` | aiCheck/scene/scene | 硬编码为主 |
| `.start` | `packageEquityAI.start` | aiCheck/start/start | **menu registry** | | `.start` | `packageEquityAI.start` | aiCheck/start/start | **menu registry** |
...@@ -197,8 +197,8 @@ export function resolveRoute(input) { /* ... */ } ...@@ -197,8 +197,8 @@ export function resolveRoute(input) { /* ... */ }
| name | 冲突页面 | 当前活跃别名 | | name | 冲突页面 | 当前活跃别名 |
|------|----------|--------------| |------|----------|--------------|
| `index` | carQuotation/index、sceneMarket/index、playVideo/index | 无活跃 `packageEquity.index`(已注释) | | `index` | carQuotation/index、sceneMarket/index、playVideo/index | 无活跃 `packageEquity.index`(已注释) |
| `detail` | aiExcercise/detail、aiCheck/detail | `packageEquity.detail` → **aiExcercise** | | `detail` | aiCheck/exercise/detail、aiCheck/detail | `packageEquity.detail` → **AI 陪练** |
| `result` | aiExcercise/result、aiCheck/result | `packageEquity.result` → **aiExcercise** | | `result` | aiCheck/exercise/result、aiCheck/result | `packageEquity.result` → **AI 陪练** |
| `confirm` | extract/confirm、(无第二处) | extract 用硬编码路径 | | `confirm` | extract/confirm、(无第二处) | extract 用硬编码路径 |
| `clue` | sceneMarket/clue、(无第二处) | 硬编码为主 | | `clue` | sceneMarket/clue、(无第二处) | 硬编码为主 |
...@@ -206,10 +206,10 @@ export function resolveRoute(input) { /* ... */ } ...@@ -206,10 +206,10 @@ export function resolveRoute(input) { /* ... */ }
```javascript ```javascript
export const FULL_ROUTE_ALIASES = { export const FULL_ROUTE_ALIASES = {
// aiExcercise 语义(当前代码实际使用) // AI 陪练语义;物理目录归并到 aiCheck/exercise
'packageEquity.detail': '/packageEquityAI/pages/aiExcercise/detail/detail', 'packageEquity.detail': '/packageEquityAI/pages/aiCheck/exercise/detail/detail',
'packageEquity.result': '/packageEquityAI/pages/aiExcercise/result/result', 'packageEquity.result': '/packageEquityAI/pages/aiCheck/exercise/result/result',
'packageEquity.list': '/packageEquityAI/pages/aiExcercise/list/list', 'packageEquity.list': '/packageEquityAI/pages/aiCheck/exercise/list/list',
// 若未来启用 packageEquity.index,须显式指定 // 若未来启用 packageEquity.index,须显式指定
// 'packageEquity.index': '/packageEquityQuote/pages/carQuotation/index/index', // 'packageEquity.index': '/packageEquityQuote/pages/carQuotation/index/index',
...@@ -243,7 +243,7 @@ export const PATH_PREFIX_REWRITES = [ ...@@ -243,7 +243,7 @@ export const PATH_PREFIX_REWRITES = [
// AI 包 // AI 包
['/packageEquity/pages/aiCheck/', '/packageEquityAI/pages/aiCheck/'], ['/packageEquity/pages/aiCheck/', '/packageEquityAI/pages/aiCheck/'],
['/packageEquity/pages/aiExcercise/', '/packageEquityAI/pages/aiExcercise/'], ['/packageEquity/pages/aiExcercise/', '/packageEquityAI/pages/aiCheck/exercise/'],
['/packageEquity/pages/aiInspectionDetail/', '/packageEquityAI/pages/aiInspectionDetail/'], ['/packageEquity/pages/aiInspectionDetail/', '/packageEquityAI/pages/aiInspectionDetail/'],
['/packageEquity/pages/aiInspectionReception/', '/packageEquityAI/pages/aiInspectionReception/'], ['/packageEquity/pages/aiInspectionReception/', '/packageEquityAI/pages/aiInspectionReception/'],
] ]
...@@ -270,13 +270,13 @@ export const PATH_PREFIX_REWRITES = [ ...@@ -270,13 +270,13 @@ export const PATH_PREFIX_REWRITES = [
### 5.1 路由表 name 冲突(拆分后 packageEquityAI 内) ### 5.1 路由表 name 冲突(拆分后 packageEquityAI 内)
迁入 AI 包后,`aiExcercise/detail` 与 `aiCheck/detail` 同为 `parent=packageEquityAI, name=detail`。 迁入 AI 包后,`aiCheck/exercise/detail` 与 `aiCheck/detail` 同为 `parent=packageEquityAI, name=detail`。
**策略**: **策略**:
1. **对外别名**:`packageEquity.detail` / `.result` 走 Tier 2 绝对路径(指向 aiExcercise) 1. **对外兼容**:`packageEquity.detail` / `.result` 走绝对路径,仍指向 AI 陪练
2. **aiCheck 内部**:继续使用硬编码路径 + Tier 3 前缀重写 2. **新代码**:使用 `packageEquityAI.exerciseDetail` / `exerciseResult` 与 `aiCheckDetail` / `aiCheckResult`,不再依赖同名页面的路由顺序
3. **长期**:新增语义别名 `packageEquityAI.aiCheckDetail`(新代码使用,旧别名保留兼容) 3. **旧物理路径**:由 Tier 3 统一重写到 `aiCheck/exercise`,query 原样保留
### 5.2 `prevPage.route` 字符串常量 ### 5.2 `prevPage.route` 字符串常量
...@@ -314,7 +314,7 @@ H5 跳转走 `options.path` 物理路径,**不经过** `wx.$router.checkRouter ...@@ -314,7 +314,7 @@ H5 跳转走 `options.path` 物理路径,**不经过** `wx.$router.checkRouter
| `playVideo` | `packageEquity/pages/trainingMaterials/pages/playVideo/index` | 不变 | 否 | | `playVideo` | `packageEquity/pages/trainingMaterials/pages/playVideo/index` | 不变 | 否 |
| `deliveryTarget` | `packageEquity/pages/deliveryTarget/deliveryTarget` | 不变 | 否 | | `deliveryTarget` | `packageEquity/pages/deliveryTarget/deliveryTarget` | 不变 | 否 |
| `recruitDetail` | `packageEquity/pages/recruitManage/recruitDetail/recruitDetail` | 不变 | 否 | | `recruitDetail` | `packageEquity/pages/recruitManage/recruitDetail/recruitDetail` | 不变 | 否 |
| `aiDetail` | `packageEquity/pages/aiExcercise/ai/ai` | `packageEquityAI/pages/aiExcercise/ai/ai` | **是** | | `aiDetail` | `packageEquity/pages/aiExcercise/ai/ai` | `packageEquityAI/pages/aiCheck/exercise/ai/ai` | **是** |
未登录白名单数组(同文件 ~325 行)中含 `playVideo`、`deliveryTarget` 等物理路径,须同步检查。 未登录白名单数组(同文件 ~325 行)中含 `playVideo`、`deliveryTarget` 等物理路径,须同步检查。
...@@ -363,9 +363,9 @@ export const ROUTE_ALIASES = { ...@@ -363,9 +363,9 @@ export const ROUTE_ALIASES = {
```javascript ```javascript
export const FULL_ROUTE_ALIASES = { export const FULL_ROUTE_ALIASES = {
'packageEquity.list': '/packageEquityAI/pages/aiExcercise/list/list', 'packageEquity.list': '/packageEquityAI/pages/aiCheck/exercise/list/list',
'packageEquity.detail': '/packageEquityAI/pages/aiExcercise/detail/detail', 'packageEquity.detail': '/packageEquityAI/pages/aiCheck/exercise/detail/detail',
'packageEquity.result': '/packageEquityAI/pages/aiExcercise/result/result', 'packageEquity.result': '/packageEquityAI/pages/aiCheck/exercise/result/result',
} }
``` ```
...@@ -421,7 +421,7 @@ function checkRouter(route, events): ...@@ -421,7 +421,7 @@ function checkRouter(route, events):
| [`packageEquity/menu/jumpHandlers.js`](../../packageEquity/menu/jumpHandlers.js) | `packageEquity.createDeafeatOrder` | | [`packageEquity/menu/jumpHandlers.js`](../../packageEquity/menu/jumpHandlers.js) | `packageEquity.createDeafeatOrder` |
| [`packageEquity/pages/index/components/record-item/recordItem.js`](../../packageEquity/pages/index/components/record-item/recordItem.js) | `packageEquity.createDeafeatOrder` | | [`packageEquity/pages/index/components/record-item/recordItem.js`](../../packageEquity/pages/index/components/record-item/recordItem.js) | `packageEquity.createDeafeatOrder` |
| [`packageEquity/pages/createDeafeatOrderBefore/createDeafeatOrderBefore.js`](../../packageEquity/pages/createDeafeatOrderBefore/createDeafeatOrderBefore.js) | `packageEquity.createDeafeatOrder` | | [`packageEquity/pages/createDeafeatOrderBefore/createDeafeatOrderBefore.js`](../../packageEquity/pages/createDeafeatOrderBefore/createDeafeatOrderBefore.js) | `packageEquity.createDeafeatOrder` |
| [`packageEquity/pages/aiExcercise/ai/ai.js`](../../packageEquity/pages/aiExcercise/ai/ai.js) | `packageEquity.detail/result/list` | | [`packageEquityAI/pages/aiCheck/exercise/ai/ai.js`](../../packageEquityAI/pages/aiCheck/exercise/ai/ai.js) | `packageEquityAI.exerciseDetail/exerciseResult/exerciseList` |
### 9.2 依赖路径重写(Tier 3)的分包外文件 ### 9.2 依赖路径重写(Tier 3)的分包外文件
...@@ -458,14 +458,14 @@ function devWarnIfRewritten(from, to) { ...@@ -458,14 +458,14 @@ function devWarnIfRewritten(from, to) {
|---------|------|----------| |---------|------|----------|
| RA-01 | `packageEquity.carBrands` | alias → `packageEquityQuote.carBrands` | | RA-01 | `packageEquity.carBrands` | alias → `packageEquityQuote.carBrands` |
| RA-02 | `packageEquity.carBrands?cartips=a` | 保留 query | | RA-02 | `packageEquity.carBrands?cartips=a` | 保留 query |
| RA-03 | `packageEquity.list?staffid=1` | path `/packageEquityAI/pages/aiExcercise/list/list?staffid=1` | | RA-03 | `packageEquity.list?staffid=1` | path `/packageEquityAI/pages/aiCheck/exercise/list/list?staffid=1` |
| RA-04 | `packageEquity.equityPage` | 无重写 | | RA-04 | `packageEquity.equityPage` | 无重写 |
| RA-05 | `packageEquity.equityPage?tabIndex=1` | 无重写,保留 query | | RA-05 | `packageEquity.equityPage?tabIndex=1` | 无重写,保留 query |
| RA-06 | `/packageEquity/pages/aiCheck/chat/chat` | `/packageEquityAI/pages/aiCheck/chat/chat` | | RA-06 | `/packageEquity/pages/aiCheck/chat/chat` | `/packageEquityAI/pages/aiCheck/chat/chat` |
| RA-07 | `/packageEquity/pages/receptionDetail/receptionDetail` | 不变(核心包) | | RA-07 | `/packageEquity/pages/receptionDetail/receptionDetail` | 不变(核心包) |
| RA-08 | `/packageEquity/pages/carEquity/carBrands/carBrands?level=2` | Quote 前缀 + query | | RA-08 | `/packageEquity/pages/carEquity/carBrands/carBrands?level=2` | Quote 前缀 + query |
| RA-09 | `packageEquity.start` | `packageEquityAI.start` | | RA-09 | `packageEquity.start` | `packageEquityAI.start` |
| RA-10 | `packageEquity.detail` | Tier 2 绝对路径 aiExcercise | | RA-10 | `packageEquity.detail` | Tier 2 绝对路径 AI 陪练 detail |
运行:`node --test tests/routeAliases.test.mjs`(实施时创建) 运行:`node --test tests/routeAliases.test.mjs`(实施时创建)
......
...@@ -140,7 +140,7 @@ packageEquity/ ...@@ -140,7 +140,7 @@ packageEquity/
| 车权益选品 | `pages/carEquity/` | 145 KB | 4 | | 车权益选品 | `pages/carEquity/` | 145 KB | 4 |
| 权益首页组件 | `pages/index/` | 97 KB | 0(嵌入 TabBar) | | 权益首页组件 | `pages/index/` | 97 KB | 0(嵌入 TabBar) |
| 招聘管理 | `pages/recruitManage/` | 126 KB | 4 | | 招聘管理 | `pages/recruitManage/` | 126 KB | 4 |
| AI 练习 | `pages/aiExcercise/` | 91 KB | 4 | | AI 练习 | `pages/aiExcercise/` | 91 KB | 4;实施后归并到 `packageEquityAI/pages/aiCheck/exercise/` |
| 接待质检 | receptionDetail + newReceptionRecords 等 | ~155 KB | 4+ | | 接待质检 | receptionDetail + newReceptionRecords 等 | ~155 KB | 4+ |
| 场景营销 | `pages/sceneMarket/` | 63 KB | 4 | | 场景营销 | `pages/sceneMarket/` | 63 KB | 4 |
| 其他 | clue、extract、trainingMaterials、salaryAppeal 等 | 余量 | — | | 其他 | clue、extract、trainingMaterials、salaryAppeal 等 | 余量 | — |
...@@ -265,7 +265,7 @@ flowchart TB ...@@ -265,7 +265,7 @@ flowchart TB
subgraph ai ["packageEquityAI 新建"] subgraph ai ["packageEquityAI 新建"]
aiCheck["aiCheck"] aiCheck["aiCheck"]
aiEx["aiExcercise"] aiEx["aiCheck/exercise(原 aiExcercise)"]
aiInsp["aiInspection*"] aiInsp["aiInspection*"]
aliyun["utils/aliyun"] aliyun["utils/aliyun"]
end end
...@@ -308,7 +308,7 @@ flowchart TB ...@@ -308,7 +308,7 @@ flowchart TB
| 页面路径 | | 页面路径 |
|----------| |----------|
| `pages/aiCheck/*`(7 个注册页) | | `pages/aiCheck/*`(7 个注册页) |
| `pages/aiExcercise/*`(4 个注册页) | | `pages/aiCheck/exercise/*`(原 `aiExcercise`,4 个注册页) |
| `pages/aiInspectionDetail`、`pages/aiInspectionReception` | | `pages/aiInspectionDetail`、`pages/aiInspectionReception` |
| `utils/aliyun/*` | | `utils/aliyun/*` |
...@@ -457,7 +457,7 @@ gantt ...@@ -457,7 +457,7 @@ gantt
|---|------|------| |---|------|------|
| R-20 | aiCheck start → chat → result | 对话、评分正常 | | R-20 | aiCheck start → chat → result | 对话、评分正常 |
| R-21 | aiCheck detail / defense / redundance | 子页正常 | | R-21 | aiCheck detail / defense / redundance | 子页正常 |
| R-22 | aiExcercise 练习流程 | 语音 utils 正常 | | R-22 | aiCheck/exercise 陪练流程 | 语音 utils 正常 |
| R-23 | aiInspectionDetail / Reception | 质检详情正常 | | R-23 | aiInspectionDetail / Reception | 质检详情正常 |
### 9.4 跨包跳转 ### 9.4 跨包跳转
...@@ -477,13 +477,13 @@ gantt ...@@ -477,13 +477,13 @@ gantt
--- ---
## 10. 实施记录(待填) ## 10. 实施记录
| 日期 | 动作 | 压缩后体积 | 负责人 | 备注 | | 日期 | 动作 | 压缩后体积 | 负责人 | 备注 |
|------|------|------------|--------|------| |------|------|------------|--------|------|
| — | 基线测量(P0) | packageEquity: ___ KB | | 开发者工具上传面板 | | 2026-09-04 | 基线测量(P0) | packageEquity: 1,553,510 B | | DevTools preview-info |
| — | P2 去重完成 | | | | | — | P2 去重完成 | | | |
| — | P1 拆分上线 | 核心: ___ / Quote: ___ / AI: ___ KB | | | | 2026-09-07 | P1 AI 分包完成(测试环境预览) | packageEquity: 1,583,787 B / AI: 308,183 B | | `aiCheck` 与原 `aiExcercise` 合并到普通分包 `packageEquityAI`;Quote 尚未拆分 |
--- ---
......
...@@ -20,6 +20,7 @@ import { SCENE_TYPE } from './constants.js' ...@@ -20,6 +20,7 @@ import { SCENE_TYPE } from './constants.js'
import { resolveActionType } from './resolveActionType.js' import { resolveActionType } from './resolveActionType.js'
import { openWorkReportTemp } from './workReportHandler.js' import { openWorkReportTemp } from './workReportHandler.js'
import { openOrderPromptWithRestrictState } from '../../tabIndex/services/newOrderAbnormalFlowRestrict.service.js' import { openOrderPromptWithRestrictState } from '../../tabIndex/services/newOrderAbnormalFlowRestrict.service.js'
import { AI_ROUTES } from '../../router/routeAliases.js'
export { resolveActionType } export { resolveActionType }
...@@ -111,7 +112,7 @@ export function createEquityMenuJumpHandler(page) { ...@@ -111,7 +112,7 @@ export function createEquityMenuJumpHandler(page) {
if (item.id === 'customer_clue' || target === 'packageEquity.clueList') { if (item.id === 'customer_clue' || target === 'packageEquity.clueList') {
wx.$track.setTrackData(0, 'leads_page', {}, '', 0) wx.$track.setTrackData(0, 'leads_page', {}, '', 0)
} }
if (target === 'packageEquity.start') { if (target === AI_ROUTES.aiCheckStart || target === 'packageEquity.start') {
wx.$track.setTrackData(0, 'aiCheck_page', {}, '', 0) wx.$track.setTrackData(0, 'aiCheck_page', {}, '', 0)
} }
if (target === 'tabWorkOrder.mentorshipManage' && if (target === 'tabWorkOrder.mentorshipManage' &&
......
import { RECRUIT_MENU_ENABLED } from '../../config.js' import { RECRUIT_MENU_ENABLED } from '../../config.js'
import { AI_ROUTES } from '../../router/routeAliases.js'
import { MENU_SECTION } from './constants.js' import { MENU_SECTION } from './constants.js'
import { import {
DYNAMIC_FORM_EQUITY_MENUS, DYNAMIC_FORM_EQUITY_MENUS,
...@@ -320,7 +321,7 @@ export const ASYNC_MENU_REGISTRY = [ ...@@ -320,7 +321,7 @@ export const ASYNC_MENU_REGISTRY = [
section: MENU_SECTION.MAIN, section: MENU_SECTION.MAIN,
sortVal: 14, sortVal: 14,
default: true, default: true,
action: { type: 'router', target: 'packageEquity.start' }, action: { type: 'router', target: AI_ROUTES.aiCheckStart },
provider: 'aiFunPractice' provider: 'aiFunPractice'
}, },
{ {
......
...@@ -23,6 +23,7 @@ import { ...@@ -23,6 +23,7 @@ import {
resolveFirstUnreadNotice resolveFirstUnreadNotice
} from '../../services/serviceCenterNoticeService.js' } from '../../services/serviceCenterNoticeService.js'
import { enqueueServiceNoticePopup } from '~/utils/serviceNoticePopupHandler.js' import { enqueueServiceNoticePopup } from '~/utils/serviceNoticePopupHandler.js'
import { AI_ROUTES } from '~/router/routeAliases.js'
import { import {
loadAbnormalFlowTipState, loadAbnormalFlowTipState,
dismissAbnormalFlowTip, dismissAbnormalFlowTip,
...@@ -409,7 +410,7 @@ Page({ ...@@ -409,7 +410,7 @@ Page({
staff: { id, tryCount } staff: { id, tryCount }
} = list[0] } = list[0]
wx.$router.go( wx.$router.go(
`packageEquity.list?staffid=${id}&tryCount=${tryCount}&roleType=${aiType}&promptOnOff=${promptOnOff}` `${AI_ROUTES.exerciseList}?staffid=${id}&tryCount=${tryCount}&roleType=${aiType}&promptOnOff=${promptOnOff}`
) )
} }
} }
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
* @FilePath: \dj-car-boutique-work-wechat\packageEquity\pages\aiInspection\components\contentItem\contentItem.js * @FilePath: \dj-car-boutique-work-wechat\packageEquity\pages\aiInspection\components\contentItem\contentItem.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
import { AI_ROUTES } from '~/router/routeAliases.js'
// packageEquity/pages/aiInspection/components/contentItem/contentItem.js // packageEquity/pages/aiInspection/components/contentItem/contentItem.js
Component({ Component({
...@@ -49,7 +51,7 @@ Component({ ...@@ -49,7 +51,7 @@ Component({
const { const {
item item
} = this.data } = this.data
wx.$router.go('aiInspectionDetail', item) wx.$router.go(AI_ROUTES.inspectionDetail, item)
} }
} }
}) })
// packageEquity/pages/carEquity/components/SecondStep/SecondStep.js // packageEquity/pages/carEquity/components/SecondStep/SecondStep.js
import data from '../constant/stepData' import data from '../constant/stepData'
import fn from '../constant/ruleFn' import fn from '../constant/ruleFn'
import { priceCounter } from '~/packageEquity/api'
import { ImgUrl } from '~/config' import { ImgUrl } from '~/config'
import {
compareCentAmounts,
yuanToCentInteger
} from '../../services/quotationMoney.helpers.js'
const defaultLabelWidth = 'var(--fontSize140)' const defaultLabelWidth = 'var(--fontSize140)'
const IMG_URL = ImgUrl + '/' const IMG_URL = ImgUrl + '/'
Component({ Component({
...@@ -116,90 +119,26 @@ Component({ ...@@ -116,90 +119,26 @@ Component({
// console.log('activeNames', activeNames) // console.log('activeNames', activeNames)
// }, // },
onChangeInsurance(e) { onChangeInsurance(e) {
console.log(e) const { detail } = e
// vdQuotationGoodsList const { id: goodsId } = e.currentTarget.dataset
let { detail } = e
let { id } = e.currentTarget.dataset
console.log(detail, 'detail')
if (!detail) { if (!detail) {
return this.setData({ this.setData({
insuranceCheck: false insuranceCheck: false
}) })
} return this.triggerEvent('orderChange', {
let thisPage = wx.$router.getPageInstance() patch: {
let { quotationGoodsList } = this.data quotedPriceUpdate: '',
let goodsItem = quotationGoodsList.find(item => item.id == id) goodsId: '',
let { id: appreciation, goodsInfo, upgradeGoodsName: goodsName, upgradeGoodsServiceItemsList } = goodsItem goodsName: '',
thisPage.setData({}) valueAddedVehicleLoss: {
appreciation: '',
let params = thisPage.getInsurance() goodsName: '',
let owner = thisPage.getOwnerInfo()
owner.salesType = owner.salesType=='售后'?1:0
// const owner = wx.$util.deepClone(thisPage.data.owner)
params.owner = owner
params.goodsId = goodsItem.id
params.goodsName = goodsItem.goodsName
params.insureList = params.insureList.map(item => {
if (item.type == 3) {
item = {
appreciation,
goodsName,
type: 3 type: 3
} }
} }
return item
}) })
// params.owner = owner
// params.owner.price = this.multipliedByHundred(orderInfo.owner?.price) || ''
// console.log(thisPage)
if (params.owner?.buyCarTime) {
delete params.owner.buyCarTime
} }
// quotedPriceUpdate return this.triggerEvent('quoteRequested', { goodsId: goodsId })
delete params?.quotedPriceUpdate
// if (params?.quotedPriceUpdate) {
// }
// params.insureList = []
console.log(params, 'params')
wx.$util.showLoading()
priceCounter(params)
.then(result => {
wx.hideLoading()
console.log('result', result)
let { data, code, message } = result
if (code == 0) {
let thisPage = wx.$router.getPageInstance()
thisPage.setData({
['orderInfo.quotedPriceUpdate']: data.quotedPriceUpdate,
['orderInfo.goodsId']: goodsItem.id,
['orderInfo.goodsName']: goodsItem.goodsName,
['orderInfo.valueAddedVehicleLoss']: {
appreciation,
goodsName,
type: 3
},
['orderInfo.quotationGoodsInfo']: {
titlePictureUrl: goodsInfo.thumbUrl,
goodsName,
quotationGoodsServiceItemsRelationDTOList: upgradeGoodsServiceItemsList
}
})
this.setData({
insuranceCheck: true,
testQuotedPriceUpdate: data.quotedPriceUpdate / 100
})
} else {
wx.$util.showToast({
title: message || '获取报价失败',
icon: 'error'
})
}
})
.catch(err => {})
}, },
//--------自定义方法---------- //--------自定义方法----------
// 选择年份的区域,弹出弹窗框 // 选择年份的区域,弹出弹窗框
...@@ -212,13 +151,13 @@ Component({ ...@@ -212,13 +151,13 @@ Component({
// 弹出框确认事件 // 弹出框确认事件
onConfirm(e) { onConfirm(e) {
// console.log(e, 1111) const { value } = e.detail
let { value } = e.detail const vehiclesAndVessels = {
let thisPage = wx.$router.getPageInstance() ...(this.properties.orderInfo?.vehiclesAndVessels || {}),
console.log(value, 'value') compensation: value + '年'
thisPage.setData({ }
// ['orderInfo' + '.' + attrtype + '.' + attrname]: value this.triggerEvent('orderChange', {
['orderInfo.vehiclesAndVessels.compensation']: value + '年' patch: { vehiclesAndVessels }
}) })
this.setData({ this.setData({
showYear: false showYear: false
...@@ -226,21 +165,17 @@ Component({ ...@@ -226,21 +165,17 @@ Component({
this.cancelInsuranceCheck() this.cancelInsuranceCheck()
}, },
cancelInsuranceCheck() { cancelInsuranceCheck() {
// this.setData({ this.triggerEvent('orderChange', {
// // insuranceCheck: false patch: {
quotedPriceUpdate: '',
// }) goodsId: '',
let thisPage = wx.$router.getPageInstance() goodsName: '',
valueAddedVehicleLoss: {
thisPage.setData({
['orderInfo.quotedPriceUpdate']: '',
['orderInfo.goodsId']: '',
['orderInfo.goodsName']: '',
['orderInfo.valueAddedVehicleLoss']: {
appreciation: '', appreciation: '',
goodsName: '', goodsName: '',
type: 3 type: 3
} }
}
}) })
}, },
// 取消选择年份的弹框 // 取消选择年份的弹框
...@@ -274,8 +209,7 @@ Component({ ...@@ -274,8 +209,7 @@ Component({
// let { attrtype, attrname, typename } = e.target.dataset // let { attrtype, attrname, typename } = e.target.dataset
let { attrtype, attrname, typename } = e.currentTarget.dataset let { attrtype, attrname, typename } = e.currentTarget.dataset
console.log(attrtype, attrname, typename, 'attrType, attrName') console.log(attrtype, attrname, typename, 'attrType, attrName')
let thisPage = wx.$router.getPageInstance() let popValue = this.properties.orderInfo?.[attrtype]?.[attrname] || ''
let popValue = thisPage.data.orderInfo?.[attrtype]?.[attrname] || ''
this.setData({ this.setData({
popupShow: true, popupShow: true,
// popValue // popValue
...@@ -294,10 +228,9 @@ Component({ ...@@ -294,10 +228,9 @@ Component({
let { handletype, index } = e.currentTarget.dataset let { handletype, index } = e.currentTarget.dataset
// console.log(handletype, index, 'type, index') // console.log(handletype, index, 'type, index')
let thisPage = wx.$router.getPageInstance()
let popValue = '' let popValue = ''
if (handletype == 'edit') { if (handletype == 'edit') {
popValue = thisPage.data.orderInfo?.['otherInsuranceList']?.[index] || '' popValue = this.properties.orderInfo?.otherInsuranceList?.[index] || ''
} }
// console.log(popValue, 'popValue') // console.log(popValue, 'popValue')
this.setData({ this.setData({
...@@ -339,9 +272,12 @@ Component({ ...@@ -339,9 +272,12 @@ Component({
value = type == 'number' ? wx.$util.numberFixedDigit(value) : value value = type == 'number' ? wx.$util.numberFixedDigit(value) : value
if (type == 'number') { if (type == 'number') {
value = parseFloat(value) > 2000000 ? 2000000 : value const inputAmount = yuanToCentInteger(value)
const compared = inputAmount.ok
? compareCentAmounts(inputAmount.value, 200000000)
: { ok: false }
value = compared.ok && compared.value > 0 ? 2000000 : value
} }
let thisPage = wx.$router.getPageInstance()
console.log(attrtype) console.log(attrtype)
if (attrtype == 'modifyEquityQuotation') { if (attrtype == 'modifyEquityQuotation') {
...@@ -353,8 +289,16 @@ Component({ ...@@ -353,8 +289,16 @@ Component({
} }
// ['orderInfo' + '.' + attrType] // ['orderInfo' + '.' + attrType]
// console.log(['orderInfo' + '.' + attrType], '2') // console.log(['orderInfo' + '.' + attrType], '2')
thisPage.setData({ const patch = attrtype
['orderInfo' + '.' + attrtype + '.' + attrname]: value ? {
[attrtype]: {
...(this.properties.orderInfo?.[attrtype] || {}),
[attrname]: value
}
}
: { [attrname]: value }
this.triggerEvent('orderChange', {
patch: patch
}) })
this.cancelInsuranceCheck() this.cancelInsuranceCheck()
// console.log(thisPage.data) // console.log(thisPage.data)
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
</navigation-bar> </navigation-bar>
<!-- height: calc(100vh - {{navBarHeight}}px); --> <!-- height: calc(100vh - {{navBarHeight}}px); -->
<view class="layout" style="padding-top:{{navBarHeight}}px; "> <view class="layout" style="padding-top:{{navBarHeight}}px; ">
<first-step wx:if="{{step == 'first'}}" id="FirstStep" serviceInfo="{{owner}}" dataAttrName="{{dataAttrName}}" orderInfo="{{orderInfo}}" bindconfirm="handleFirstConfirm" bindeditSave="handleEditSave" mode="{{0}}" /> <first-step wx:if="{{step == 'first'}}" id="FirstStep" serviceInfo="{{owner}}" dataAttrName="{{dataAttrName}}" orderInfo="{{orderInfo}}" bindconfirm="handleFirstConfirm" bindeditSave="handleEditSave" bind:ownerChange="handleOwnerChange" bind:orderChange="handleOrderChange" bind:sceneChange="handleSceneChange" bind:customerSelected="handleCustomerSelected" bind:resetGoodsRequested="handleResetGoodsRequested" mode="{{0}}" />
<second-step wx:if="{{step == 'second'}}" id="SecondStep" orderInfo="{{orderInfo}}" quotationGoodsList="{{quotationGoodsList}}" bindconfirm="handleSecondConfirm" bindeditSave="handleEditSave" /> <second-step wx:if="{{step == 'second'}}" id="SecondStep" orderInfo="{{orderInfo}}" quotationGoodsList="{{quotationGoodsList}}" bindconfirm="handleSecondConfirm" bindeditSave="handleEditSave" bind:quoteRequested="handleQuoteRequested" bind:orderChange="handleOrderChange" />
</view> </view>
<!-- vin二次复核 --> <!-- vin二次复核 -->
<vin-sec-dialog wx:if="{{showVinDialog}}" showVinDialog="{{showVinDialog}}" secFormData="{{secFormData}}" bindonClose="handleSecClose" bindonConfirm="handleSecConfirm"></vin-sec-dialog> <vin-sec-dialog wx:if="{{showVinDialog}}" showVinDialog="{{showVinDialog}}" secFormData="{{secFormData}}" bindonClose="handleSecClose" bindonConfirm="handleSecConfirm"></vin-sec-dialog>
...@@ -19,6 +19,11 @@ ...@@ -19,6 +19,11 @@
subBtnShow="{{ false }}" subBtnShow="{{ false }}"
mode="{{ mode }}" mode="{{ mode }}"
bind:updateConfig="handleUpdateConfig" bind:updateConfig="handleUpdateConfig"
bind:ownerChange="handleOwnerChange"
bind:orderChange="handleOrderChange"
bind:sceneChange="handleSceneChange"
bind:customerSelected="handleCustomerSelected"
bind:resetGoodsRequested="handleResetGoodsRequested"
/> />
<second-step <second-step
wx:if="{{ orderInfo.baseSceneCode }}" wx:if="{{ orderInfo.baseSceneCode }}"
...@@ -31,6 +36,8 @@ ...@@ -31,6 +36,8 @@
paymentMethod="{{ paymentMethod }}" paymentMethod="{{ paymentMethod }}"
totalFee="{{ totalFee }}" totalFee="{{ totalFee }}"
bind:showTips="tipsEvent" bind:showTips="tipsEvent"
bind:quoteRequested="handleQuoteRequested"
bind:orderChange="handleOrderChange"
/> />
</view> </view>
<view wx:if="{{ showTips && !orderInfo.resetOrder }}" class="btns {{ isFullSucreen?'isFullSucreen-btn':'' }}"> <view wx:if="{{ showTips && !orderInfo.resetOrder }}" class="btns {{ isFullSucreen?'isFullSucreen-btn':'' }}">
......
/** /**
* @file 权益报价订单类型与商品策略区展示规则(纯函数,无页面副作用) * @file 权益报价订单类型与商品策略区展示规则(纯函数,无页面副作用)。
*/ */
/** 订单类型:与后端 orderType 一致 */ /** 订单类型:与后端 orderType 一致 */
const ORDER_TYPE = { export const ORDER_TYPE = {
NORMAL: 1, NORMAL: 1,
DISCOUNT: 2, DISCOUNT: 2,
GIFT: 3, GIFT: 3,
...@@ -13,24 +13,17 @@ const ORDER_TYPE = { ...@@ -13,24 +13,17 @@ const ORDER_TYPE = {
} }
/** 需要展示商品折扣/买赠/组合付款策略区的订单类型 */ /** 需要展示商品折扣/买赠/组合付款策略区的订单类型 */
const ORDER_TYPES_WITH_STRATEGY_UI = [ export const ORDER_TYPES_WITH_STRATEGY_UI = [
ORDER_TYPE.DISCOUNT, ORDER_TYPE.DISCOUNT,
ORDER_TYPE.GIFT, ORDER_TYPE.GIFT,
ORDER_TYPE.COMBINATION ORDER_TYPE.COMBINATION
] ]
/** /**
* 商品行是否展示订单策略区(打折/买赠/组合付款) * 商品行是否展示订单策略区。
* 正常订单、冲量活动、内部结算与精品工单一致,不展示策略区
* @param {number|string|undefined} orderType * @param {number|string|undefined} orderType
* @returns {boolean} * @returns {boolean}
*/ */
function shouldShowOrderStrategyBox(orderType) { export function shouldShowOrderStrategyBox(orderType) {
return ORDER_TYPES_WITH_STRATEGY_UI.includes(Number(orderType)) return ORDER_TYPES_WITH_STRATEGY_UI.includes(parseInt(String(orderType), 10))
}
module.exports = {
ORDER_TYPE,
ORDER_TYPES_WITH_STRATEGY_UI,
shouldShowOrderStrategyBox
} }
/**
* @file 标准版与简易版共用的客户档案选择映射,只处理字段语义完全一致的部分。
*/
import constantList from '../components/constant/constantList.js'
import { reconcileEquityCustomerDailyFields } from './customerDailyFields.helpers.js'
import { divideByHundred } from './quotationMoney.helpers.js'
/**
* 把客户档案映射为权益报价 owner 与订单字段 patch。
*
* @param {{currentOwner: object, orderInfo: object, customer: object}} input 映射输入
* @returns {{owner: object, orderPatch: object}} 两个父页面可分别应用的 patch
*/
export function buildSelectedCustomerState({
currentOwner = {},
orderInfo = {},
customer = {}
}) {
const { id: _customerRowId, ...customerFields } = customer
const salesTypeNumber = Number(customer.salesType)
const salesType = [0, 1, 2].includes(salesTypeNumber)
? salesTypeNumber
: 0
const salesTypeOption = constantList.salesTypeList.find(
item => item.optionId === salesType
)
const owner = reconcileEquityCustomerDailyFields(
{
...currentOwner,
...customerFields,
owner: customer.customerName,
phone: customer.customerPhone,
ownerGender: customer.customerSex == 2 ? '女' : '男',
seat: customer.carSeat || 5,
price:
customer.carPrice === undefined || customer.carPrice === ''
? currentOwner.price
: divideByHundred(customer.carPrice),
city: customer.customerCity,
ageRange: customer.customerAgeRange,
hobby: customer.customerHobby,
companion: customer.customerCompanion,
certificateNo: customer.customerCertificateNo || '',
salesType,
salesTypeLabel:
salesTypeOption?.optionLabel || constantList.salesTypeList[0].optionLabel,
customerTags: currentOwner.customerTags || '',
actualDeliveryDate: currentOwner.actualDeliveryDate || ''
},
orderInfo
)
return {
owner,
orderPatch: customer.salesUuid
? {
referrerId: customer.salesUuid,
referrer: customer.salesName
}
: {}
}
}
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
* 边界:纯函数,不读页面 data * 边界:纯函数,不读页面 data
*/ */
import NP from 'number-precision'
/** 默认需 ×100 / ÷100 的字段(与页面 needChangeList 一致) */ /** 默认需 ×100 / ÷100 的字段(与页面 needChangeList 一致) */
export const DEFAULT_NEED_CHANGE_LIST = [ export const DEFAULT_NEED_CHANGE_LIST = [
'price', 'price',
...@@ -13,25 +15,196 @@ export const DEFAULT_NEED_CHANGE_LIST = [ ...@@ -13,25 +15,196 @@ export const DEFAULT_NEED_CHANGE_LIST = [
'payPrice' 'payPrice'
] ]
const MAX_SAFE_INTEGER_TEXT = '9007199254740991'
/**
* 比较两个无符号整数字符串,避免把大额最小货币单位转成浮点数。
* @param {string} left
* @param {string} right
* @returns {-1|0|1}
*/
function compareUnsignedIntegerText(left, right) {
if (left.length !== right.length) return left.length > right.length ? 1 : -1
if (left === right) return 0
return left > right ? 1 : -1
}
/**
* 校验并规范化非负的整数最小货币单位。
* @param {string|number} value
* @returns {{ok:true,value:string}|{ok:false,error:string}}
*/
function normalizeCentText(value) {
if (value === '' || value === null || value === undefined) {
return { ok: false, error: '金额不能为空' }
}
if (typeof value === 'number' && !Number.isSafeInteger(value)) {
return { ok: false, error: '金额必须是安全整数' }
}
const raw = String(value).trim()
if (!/^\d+$/.test(raw)) {
return { ok: false, error: '金额必须是非负整数' }
}
return { ok: true, value: raw.replace(/^0+(?=\d)/, '') }
}
/**
* 将元金额严格转换为分整数。输入最多两位小数,不做隐式舍入。
* @param {string|number} value 元金额
* @returns {{ok:true,value:number}|{ok:false,error:string}}
*/
export function yuanToCentInteger(value) {
if (value === '' || value === null || value === undefined) {
return { ok: false, error: '金额不能为空' }
}
if (typeof value === 'number' && !Number.isFinite(value)) {
return { ok: false, error: '金额格式不正确' }
}
const normalizedValue = typeof value === 'number' ? NP.strip(value) : value
const raw = String(normalizedValue).trim()
const matched = raw.match(/^(\d+)(?:\.(\d{1,2}))?$/)
if (!matched) {
return { ok: false, error: '金额必须是非负数且最多两位小数' }
}
const major = matched[1].replace(/^0+(?=\d)/, '')
const minor = (matched[2] || '').padEnd(2, '0')
const centText = `${major}${minor}`.replace(/^0+(?=\d)/, '')
if (compareUnsignedIntegerText(centText, MAX_SAFE_INTEGER_TEXT) > 0) {
return { ok: false, error: '金额超出安全范围' }
}
return { ok: true, value: parseInt(centText, 10) }
}
/**
* 将分整数格式化为元文本,用于页面回显,不参与后续金额推导。
* @param {string|number} value 分金额
* @returns {{ok:true,value:string}|{ok:false,error:string}}
*/
export function centToYuanText(value) {
const normalized = normalizeCentText(value)
if (!normalized.ok) return normalized
const padded = normalized.value.padStart(3, '0')
return {
ok: true,
value: `${padded.slice(0, -2)}.${padded.slice(-2)}`
}
}
/**
* 比较两个分整数。
* @param {string|number} left
* @param {string|number} right
* @returns {{ok:true,value:-1|0|1}|{ok:false,error:string}}
*/
export function compareCentAmounts(left, right) {
const normalizedLeft = normalizeCentText(left)
const normalizedRight = normalizeCentText(right)
if (!normalizedLeft.ok || !normalizedRight.ok) {
return { ok: false, error: '金额必须是非负整数' }
}
return {
ok: true,
value: compareUnsignedIntegerText(
normalizedLeft.value,
normalizedRight.value
)
}
}
/**
* 校验正常报价最低一分,以及错单“原单元金额 + 关联流水分金额 = 当前元金额”。
* @param {{resetOrder?:boolean,originalPrice?:number|string,associatedFeeCents?:number|string,total:number|string}} input
* @returns {{ok:true}|{ok:false,reason:'invalid'|'below-minimum'|'unbalanced'}}
*/
export function validateQuotationOrderTotal(input = {}) {
const current = yuanToCentInteger(input.total)
if (!current.ok) return { ok: false, reason: 'invalid' }
if (!input.resetOrder) {
return current.value >= 1
? { ok: true }
: { ok: false, reason: 'below-minimum' }
}
const original = yuanToCentInteger(input.originalPrice ?? 0)
const associated = normalizeCentText(input.associatedFeeCents ?? 0)
if (!original.ok || !associated.ok) return { ok: false, reason: 'invalid' }
if (compareUnsignedIntegerText(associated.value, MAX_SAFE_INTEGER_TEXT) > 0) {
return { ok: false, reason: 'invalid' }
}
const associatedValue = parseInt(associated.value, 10)
if (original.value > Number.MAX_SAFE_INTEGER - associatedValue) {
return { ok: false, reason: 'invalid' }
}
return original.value + associatedValue === current.value
? { ok: true }
: { ok: false, reason: 'unbalanced' }
}
/**
* 对以“分”为单位的简易权益商品应用折扣。
* 比例值以 0-10 折表示并向上取整到分;直减值以元输入后精确转分。
* @param {number|string} baseCents 基础价(分)
* @param {number|string|null|undefined} discountType
* @param {number|string|null|undefined} discountValue
* @returns {{ok:true,finalCents:number,discountCents:number}|{ok:false,error:string}}
*/
export function applyQuotationCentDiscount(
baseCents,
discountType,
discountValue
) {
const normalizedBase = normalizeCentText(baseCents)
if (
!normalizedBase.ok ||
compareUnsignedIntegerText(normalizedBase.value, MAX_SAFE_INTEGER_TEXT) > 0
) {
return { ok: false, error: '商品分金额格式不正确' }
}
const base = parseInt(normalizedBase.value, 10)
let finalCents = base
const hasValue = !(
discountValue === '' ||
discountValue === null ||
discountValue === undefined
)
if (discountType == 4) {
finalCents = 0
} else if (discountType == 1 && hasValue) {
const ratio = yuanToCentInteger(discountValue)
if (!ratio.ok) return ratio
if (ratio.value > 0 && ratio.value <= 1000) {
const product = NP.times(base, ratio.value)
if (!Number.isSafeInteger(product)) {
return { ok: false, error: '折扣金额超出安全范围' }
}
const remainder = product % 1000
finalCents = (product - remainder) / 1000 + (remainder > 0 ? 1 : 0)
}
} else if (discountType == 2 && hasValue) {
const discount = yuanToCentInteger(discountValue)
if (!discount.ok) return discount
const remaining = NP.minus(base, discount.value)
finalCents = remaining > 0 ? remaining : 0
}
return {
ok: true,
finalCents,
discountCents: NP.minus(base, finalCents)
}
}
/** /**
* 除以 100 保留两位小数 * 除以 100 保留两位小数
* @param {string|number} str * @param {string|number} str
* @returns {number} * @returns {number}
*/ */
export function divideByHundred(str) { export function divideByHundred(str) {
const floatVal = parseFloat(str) const formatted = centToYuanText(str)
if (Number.isNaN(floatVal)) return 0 if (!formatted.ok) return 0
let rounded = Math.round(str * 100) / 10000 const [major, minor] = formatted.value.split('.')
let strVal = rounded.toString() return parseInt(major, 10) + parseInt(minor, 10) / 100
let searchVal = strVal.indexOf('.')
if (searchVal < 0) {
searchVal = strVal.length
strVal += '.'
}
while (strVal.length <= searchVal + 2) {
strVal += '0'
}
return parseFloat(strVal)
} }
/** /**
...@@ -40,19 +213,8 @@ export function divideByHundred(str) { ...@@ -40,19 +213,8 @@ export function divideByHundred(str) {
* @returns {number} * @returns {number}
*/ */
export function multipliedByHundred(str) { export function multipliedByHundred(str) {
const floatVal = parseFloat(str) const converted = yuanToCentInteger(str)
if (Number.isNaN(floatVal)) return 0 return converted.ok ? converted.value : 0
let rounded = Math.round(str * 10000) / 100
let strVal = rounded.toString()
let searchVal = strVal.indexOf('.')
if (searchVal < 0) {
searchVal = strVal.length
strVal += '.'
}
while (strVal.length <= searchVal + 2) {
strVal += '0'
}
return parseFloat(strVal)
} }
/** /**
......
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
import { import {
DEFAULT_NEED_CHANGE_LIST, DEFAULT_NEED_CHANGE_LIST,
compareCentAmounts,
divideByHundredObj, divideByHundredObj,
multipliedByHundred, yuanToCentInteger
multipliedByHundredObj
} from './quotationMoney.helpers.js' } from './quotationMoney.helpers.js'
import { import {
formatEquityDeliveryDateForSubmit, formatEquityDeliveryDateForSubmit,
...@@ -32,6 +32,31 @@ const INSURANCE_TYPE_TO_FORM_KEY = { ...@@ -32,6 +32,31 @@ const INSURANCE_TYPE_TO_FORM_KEY = {
} }
/** /**
* 将表单对象中的元字段严格转为分;空值沿用旧契约转为 0,非法值直接阻止提交。
* @param {object} source
* @param {string[]} needChangeList
* @param {string} path
* @returns {object}
*/
function scaleYuanFieldsForPayload(source, needChangeList, path) {
const out = { ...(source || {}) }
for (const key in out) {
if (!needChangeList.includes(key)) continue
const value = out[key]
if (value === '' || value === null || value === undefined) {
out[key] = 0
continue
}
const converted = yuanToCentInteger(value)
if (!converted.ok) {
throw new Error(`金额格式不正确:${path}.${key}`)
}
out[key] = converted.value
}
return out
}
/**
* 组装提交用 orderInfo(flatten insureList、注入 4S 店、分→元字段放大) * 组装提交用 orderInfo(flatten insureList、注入 4S 店、分→元字段放大)
* @param {object} orderInfo 页面 orderInfo 深拷贝前 * @param {object} orderInfo 页面 orderInfo 深拷贝前
* @param {{ merchantId?: *, merchantName?: string }} merchant4s * @param {{ merchantId?: *, merchantName?: string }} merchant4s
...@@ -47,18 +72,25 @@ export function buildInsurancePayload( ...@@ -47,18 +72,25 @@ export function buildInsurancePayload(
payload.merchantId4s = merchant4s.merchantId payload.merchantId4s = merchant4s.merchantId
payload.merchantName4s = merchant4s.merchantName payload.merchantName4s = merchant4s.merchantName
const business = multipliedByHundredObj(payload.business || {}, needChangeList) const business = scaleYuanFieldsForPayload(
const mutualStrength = multipliedByHundredObj( payload.business || {},
needChangeList,
'business'
)
const mutualStrength = scaleYuanFieldsForPayload(
payload.mutualStrength || {}, payload.mutualStrength || {},
needChangeList needChangeList,
'mutualStrength'
) )
const vehiclesAndVessels = multipliedByHundredObj( const vehiclesAndVessels = scaleYuanFieldsForPayload(
payload.vehiclesAndVessels || {}, payload.vehiclesAndVessels || {},
needChangeList needChangeList,
'vehiclesAndVessels'
) )
const valueAddedVehicleLoss = multipliedByHundredObj( const valueAddedVehicleLoss = scaleYuanFieldsForPayload(
payload.valueAddedVehicleLoss || {}, payload.valueAddedVehicleLoss || {},
needChangeList needChangeList,
'valueAddedVehicleLoss'
) )
payload.insureList = [ payload.insureList = [
...@@ -67,8 +99,14 @@ export function buildInsurancePayload( ...@@ -67,8 +99,14 @@ export function buildInsurancePayload(
vehiclesAndVessels, vehiclesAndVessels,
valueAddedVehicleLoss valueAddedVehicleLoss
] ]
;(payload.otherInsuranceList || []).forEach(item => { ;(payload.otherInsuranceList || []).forEach((item, index) => {
payload.insureList.push(multipliedByHundredObj(item, needChangeList)) payload.insureList.push(
scaleYuanFieldsForPayload(
item,
needChangeList,
`otherInsuranceList[${index}]`
)
)
}) })
INSURANCE_FORM_KEYS.forEach(key => { INSURANCE_FORM_KEYS.forEach(key => {
...@@ -99,7 +137,13 @@ export function buildOwnerPayload( ...@@ -99,7 +137,13 @@ export function buildOwnerPayload(
JSON.parse(JSON.stringify(owner || {})), JSON.parse(JSON.stringify(owner || {})),
context context
) )
out.price = multipliedByHundred(out?.price) || '' if (out?.price === '' || out?.price === null || out?.price === undefined) {
out.price = ''
} else {
const price = yuanToCentInteger(out.price)
if (!price.ok) throw new Error('金额格式不正确:owner.price')
out.price = price.value
}
out.customerTags = serializeEquityCustomerTags(out.customerTags) out.customerTags = serializeEquityCustomerTags(out.customerTags)
out.actualDeliveryDate = formatEquityDeliveryDateForSubmit( out.actualDeliveryDate = formatEquityDeliveryDateForSubmit(
out.actualDeliveryDate out.actualDeliveryDate
...@@ -151,8 +195,11 @@ export function mapQuotationGoodsList(apiRows, options = {}) { ...@@ -151,8 +195,11 @@ export function mapQuotationGoodsList(apiRows, options = {}) {
titlePictureUrl: item.goodsInfo?.thumbUrl titlePictureUrl: item.goodsInfo?.thumbUrl
} }
if (outTradeNo) { if (outTradeNo) {
mapped.isSeletct = const shopMinPrice = yuanToCentInteger(item.shopMinPrice)
multipliedByHundred(item.shopMinPrice) >= Number(totalFee || 0) const compared = shopMinPrice.ok
? compareCentAmounts(shopMinPrice.value, totalFee)
: { ok: false }
mapped.isSeletct = compared.ok && compared.value >= 0
} }
return mapped return mapped
}) })
......
/**
* @file 权益计价请求编排。父页面提供完整报价与车主数据,组件只上报商品选择意图。
*/
import { compareCentAmounts } from './quotationMoney.helpers.js'
/**
* 构建计价 payload,并避免修改页面当前表单对象。
*
* @param {{owner: object, quotation: object, goods: object}} input 页面计价上下文
* @returns {object} 计价接口 payload
*/
export function buildPricingPayload({ owner, quotation, goods }) {
const nextOwner = { ...owner }
delete nextOwner.buyCarTime
nextOwner.salesType = nextOwner.salesType === '售后' ? 1 : 0
const payload = {
...quotation,
owner: nextOwner,
goodsId: goods.id,
goodsName: goods.goodsName
}
delete payload.quotedPriceUpdate
if (Array.isArray(quotation.insureList)) {
payload.insureList = quotation.insureList.map(item =>
item.type == 3
? {
type: 3,
appreciation: goods.id,
goodsName: goods.upgradeGoodsName || goods.goodsName
}
: { ...item }
)
}
return payload
}
/**
* 请求权益计价并统一成功码解释。
*
* @param {object} payload 已构建的计价参数
* @param {{priceCounter: Function}} dependencies API 依赖
* @returns {Promise<{status: 'success'|'business-error', data: *, message: string, code: *}>} 计价结果
*/
export async function requestQuotationPrice(payload, { priceCounter }) {
const response = await priceCounter(payload)
const success = response?.code === 0 || response?.code === '0'
return {
status: success ? 'success' : 'business-error',
data: response?.data,
message: response?.message || (success ? '' : '计价失败'),
code: response?.code
}
}
/**
* 校验补录场景的商品最低权益价不得高于关联流水总额,两者单位均为分。
* @param {number|string} minimumPriceCents 最低权益价(分)
* @param {number|string} recordedTotalCents 补录流水总额(分)
* @returns {{ok:true}|{ok:false,reason:'invalid'|'above-recorded-total'}}
*/
export function validateRecordedPriceLimit(
minimumPriceCents,
recordedTotalCents
) {
const compared = compareCentAmounts(minimumPriceCents, recordedTotalCents)
if (!compared.ok) return { ok: false, reason: 'invalid' }
return compared.value > 0
? { ok: false, reason: 'above-recorded-total' }
: { ok: true }
}
/**
* @file 简易权益下单动态必填项配置。
* 边界:只复制和转换表单模板,不请求 API、不读取组件、不调用 setData。
*/
/**
* 深复制表单模板并保留校验函数引用,避免 JSON 序列化丢失 validator。
* @param {*} value 表单模板节点
* @returns {*} 独立副本
*/
function cloneSchema(value) {
if (Array.isArray(value)) return value.map(cloneSchema)
if (value && typeof value === 'object') {
return Object.fromEntries(
Object.entries(value).map(([key, child]) => [key, cloneSchema(child)])
)
}
return value
}
/**
* 根据后台必填项生成 FirstStep 所需的字段配置和校验规则。
* 后台未配置必填项时,页面应继续调用组件的门店档案配置作为降级来源。
* @param {{firstObjSimple?:object,formRuleSimple?:object}} schema 原始表单模板
* @param {Array<{fieldKey?:string,isRequired?:boolean|number}>} settingRows 订单配置接口数据
* @returns {{first:object,formRule:object,requiredFields:Array<string>,shouldLoadStoreConfig:boolean}}
*/
export function buildSimpleQuotationFormConfig(schema = {}, settingRows = []) {
const copied = cloneSchema(schema)
const first = copied.firstObjSimple || {}
const formRule = copied.formRuleSimple || {}
const requiredFields = (Array.isArray(settingRows) ? settingRows : [])
.filter(item => item?.isRequired)
.map(item => item.fieldKey)
.filter(Boolean)
if (requiredFields.includes('carBrand')) {
first.carFormList[0] = {
configItem: true,
label: '车型',
name: 'brands',
type: 'slot',
required: true,
requiredAfter: true
}
formRule.carSeriesName = [{ required: true, message: '车型不能为空' }]
}
if (requiredFields.includes('carNo')) {
first.carFormList[2] = {
label: '车架号',
maxlength: '17',
name: 'carVin',
type: 'input',
required: true,
requiredAfter: true
}
formRule.carVin = [
{ required: true, message: '车架号不能为空' },
{
validator: (rule, value) =>
value.length != 17 ? { message: '请输入正确的17位车架号' } : null
}
]
}
if (requiredFields.includes('idNumber')) {
const certificateIndex = (first.customerFormList || []).findIndex(
item => item.name === 'certificateNo'
)
if (certificateIndex >= 0) {
first.customerFormList[certificateIndex] = {
label: '证件号码',
maxlength: '18',
name: 'certificateNo',
placeholder: '请输入(必填)',
type: 'input',
required: true,
requiredAfter: true
}
}
formRule.certificateNo = [
{ required: true, message: '证件号码不能为空' },
{
validator: (rule, value) => {
if (value) {
return value.length != 18
? { message: '请输入正确的18位证件号' }
: null
}
}
}
]
}
return {
first,
formRule,
requiredFields,
shouldLoadStoreConfig: requiredFields.length === 0
}
}
/**
* @file 简易权益报价 payload 组装。
* 边界:仅做页面数据到既有 ROP 契约的映射,不调用 API、路由或 setData。
*/
import { yuanToCentInteger } from './quotationMoney.helpers.js'
import {
buildOwnerPayload,
mapOwnerSalesTypeForApi
} from './quotationPayload.helpers.js'
const ROOT_YUAN_FIELDS = [
'insurancePrice',
'total',
'quotedPriceUpdate',
'finalPrice',
'minEquityPrice'
]
/**
* 映射一条简易权益商品,保留后端/策略已经确定的分单位最终行价。
* @param {object} item 商品或套餐子项
* @param {object} [packageInfo] 套餐上下文
* @returns {object}
*/
function mapGoodsItem(item = {}, packageInfo) {
const finalPrice = item.discountType == 4
? 0
: item.finalPrice !== undefined
? item.finalPrice
: item.price
return {
...(packageInfo
? {
packageId: packageInfo.packageCode,
packageName: packageInfo.packageName,
packageNameAlias:
packageInfo.packageAlias || packageInfo.packageNameAlias
}
: {}),
goodsId: item.merchantGoodsId || item.upgradeGoodsId,
goodsName: item.upgradeGoodsName || item.goodsName,
goodsNameAlias: item.goodsAlias || item.goodsNameAlias,
specificationsName: item.specificationNameSequence,
specificationsValue: item.specificationData
? item.specificationData.replace(/;~;/g, '/')
: '',
goodsPrice: item.price,
finalPrice,
singleProductFinalPrice: finalPrice,
discountType: item.discountType,
discountValue: item.discountValue,
discountAmount: item.discountAmount || 0
}
}
/**
* 将简易页的单品、套餐和多规格展示结构映射为报价接口商品数组。
* 数量不会参与金额重算,最终行价以策略层产出的 finalPrice 为权威值。
* @param {Array<object>} goodsList 页面已选商品
* @returns {Array<object>}
*/
export function mapSimpleQuotationGoods(goodsList) {
return (Array.isArray(goodsList) ? goodsList : []).reduce((result, entry) => {
if (entry?.goods) {
result.push(mapGoodsItem(entry.goods))
}
if (entry?.packageGoods) {
;(entry.packageGoods.goodsList || []).forEach(item => {
result.push(mapGoodsItem(item, entry.packageGoods))
})
}
if (entry?.multipleSpecificationsGoods?.goods) {
result.push(mapGoodsItem(entry.multipleSpecificationsGoods.goods))
}
return result
}, [])
}
/**
* 构建简易权益报价的既有 API payload,并显式返回金额校验错误。
* @param {{owner?:object,orderInfo?:object,context?:{merchant4s?:object}}} input
* @returns {{ok:true,payload:object,errors:[]}|{ok:false,payload:null,errors:Array<{field:string,message:string}>}}
*/
export function buildSimpleQuotationPayload(input = {}) {
const sourceOrderInfo = input.orderInfo || {}
const orderInfo = JSON.parse(JSON.stringify(sourceOrderInfo))
const errors = []
ROOT_YUAN_FIELDS.forEach(field => {
const sourceValue = sourceOrderInfo[field]
if (sourceValue === '' || sourceValue === null || sourceValue === undefined) {
orderInfo[field] = 0
return
}
const converted = yuanToCentInteger(sourceValue)
if (!converted.ok) {
errors.push({ field, message: converted.error })
return
}
orderInfo[field] = converted.value
})
const ownerPrice = input.owner?.price
if (ownerPrice !== '' && ownerPrice !== null && ownerPrice !== undefined) {
const ownerPriceResult = yuanToCentInteger(ownerPrice)
if (!ownerPriceResult.ok) {
errors.push({ field: 'owner.price', message: ownerPriceResult.error })
}
}
if (errors.length) {
return { ok: false, payload: null, errors }
}
const merchant4s = input.context?.merchant4s || {}
orderInfo.merchantId4s = merchant4s.merchantId
orderInfo.merchantName4s = merchant4s.merchantName
orderInfo.vdQuotationGoodsList = mapSimpleQuotationGoods(
sourceOrderInfo.vdQuotationGoodsList
)
orderInfo.paymentDocList = orderInfo.paymentDocList || []
orderInfo.owner = buildOwnerPayload(input.owner, undefined, sourceOrderInfo)
orderInfo.owner.salesType = mapOwnerSalesTypeForApi(orderInfo.owner.salesType)
return { ok: true, payload: orderInfo, errors: [] }
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* 商品操作策略模式实现 * 商品操作策略模式实现
* *
* 设计意图: * 设计意图:
* 针对 createOrder 页面中存在的多种商品类型(普通商品、多规格商品、套餐商品), * 针对简易权益报价中存在的多种商品类型(普通商品、多规格商品、套餐商品),
* 采用策略模式(Strategy Pattern)统一封装商品的数据获取、价格计算、校验逻辑。 * 采用策略模式(Strategy Pattern)统一封装商品的数据获取、价格计算、校验逻辑。
* *
* 结构说明: * 结构说明:
...@@ -14,11 +14,15 @@ ...@@ -14,11 +14,15 @@
*/ */
import NP from 'number-precision' import NP from 'number-precision'
import {
const {
ORDER_TYPE, ORDER_TYPE,
shouldShowOrderStrategyBox shouldShowOrderStrategyBox
} = require('./orderStrategyUi') } from './orderStrategyUi.js'
import {
applyQuotationCentDiscount,
compareCentAmounts,
yuanToCentInteger
} from './quotationMoney.helpers.js'
export { ORDER_TYPE, shouldShowOrderStrategyBox } export { ORDER_TYPE, shouldShowOrderStrategyBox }
...@@ -55,11 +59,21 @@ ProductStrategy.prototype.getMinPrice = function () { ...@@ -55,11 +59,21 @@ ProductStrategy.prototype.getMinPrice = function () {
} }
ProductStrategy.prototype.getCount = function () { ProductStrategy.prototype.getCount = function () {
return this.item.count || 1 return this.item.count === '' || this.item.count == null ? 1 : this.item.count
} }
ProductStrategy.prototype.calculateSubtotal = function () { ProductStrategy.prototype.calculateSubtotal = function () {
return NP.times(parseFloat(this.getCount()), parseFloat(this.getPrice())) const countText = String(this.getCount()).trim()
if (!/^\d+$/.test(countText)) return 0
const count = parseInt(countText, 10)
const price = applyQuotationCentDiscount(
this.getPrice(),
DISCOUNT_TYPE.NONE,
0
)
if (!Number.isSafeInteger(count) || !price.ok) return 0
const total = NP.times(count, price.finalCents)
return Number.isSafeInteger(total) ? total : 0
} }
ProductStrategy.prototype.validatePrice = function (price) { ProductStrategy.prototype.validatePrice = function (price) {
...@@ -70,12 +84,18 @@ ProductStrategy.prototype.validatePrice = function (price) { ...@@ -70,12 +84,18 @@ ProductStrategy.prototype.validatePrice = function (price) {
return { valid: true } return { valid: true }
} }
if ( const minPrice = yuanToCentInteger(data.minSellPrice)
data.validMinSellPrice === 'Y' && const comparison = minPrice.ok
NP.divide(Number(checkPrice), 100) < Number(data.minSellPrice) ? compareCentAmounts(checkPrice, minPrice.value)
) { : { ok: false }
if (data.validMinSellPrice === 'Y') {
if (!comparison.ok) {
return { valid: false, message: '商品价格格式不正确' }
}
if (comparison.value < 0) {
return { valid: false, message: '单价不可低于商品最低价' } return { valid: false, message: '单价不可低于商品最低价' }
} }
}
return { valid: true } return { valid: true }
} }
...@@ -132,30 +152,13 @@ ProductStrategy.prototype.applyDiscount = function () { ...@@ -132,30 +152,13 @@ ProductStrategy.prototype.applyDiscount = function () {
const data = this.getData() const data = this.getData()
const basePrice = const basePrice =
data.basePrice !== undefined ? data.basePrice : this.getPrice() data.basePrice !== undefined ? data.basePrice : this.getPrice()
let finalPrice = basePrice const discounted = applyQuotationCentDiscount(
const type = data.discountType basePrice,
const value = data.discountValue data.discountType,
data.discountValue
if (type == DISCOUNT_TYPE.RATIO && value) { )
if (value > 0 && value <= 10) { data.finalPrice = discounted.ok ? discounted.finalCents : basePrice
finalPrice = NP.times(basePrice, NP.divide(value, 10)) data.discountAmount = discounted.ok ? discounted.discountCents : 0
// 折扣比例计算:向上取整到“分”(两位小数)
finalPrice = Math.ceil(finalPrice)
}
} else if (type == DISCOUNT_TYPE.AMOUNT && value) {
finalPrice = NP.minus(basePrice, NP.times(value, 100))
finalPrice = Math.round(finalPrice)
if (finalPrice < 0) finalPrice = 0
} else if (type == DISCOUNT_TYPE.GIFT) {
finalPrice = 0
} else if (type == DISCOUNT_TYPE.NONE || type == DISCOUNT_TYPE.NON_GIFT) {
finalPrice = basePrice
}
// this.setPrice(finalPrice)
data.finalPrice = finalPrice
data.discountAmount = NP.minus(basePrice, finalPrice)
} }
ProductStrategy.prototype.setError = function (isError) { ProductStrategy.prototype.setError = function (isError) {
...@@ -178,11 +181,12 @@ ProductStrategy.prototype.performValidation = function () { ...@@ -178,11 +181,12 @@ ProductStrategy.prototype.performValidation = function () {
const data = this.getData() const data = this.getData()
if (data.sellPrice !== undefined && data.validMinSellPrice === 'Y') { if (data.sellPrice !== undefined && data.validMinSellPrice === 'Y') {
if (Number(data.sellPrice) < Number(data.minSellPrice)) { const sellPrice = yuanToCentInteger(data.sellPrice)
data.basePriceError = true const minPrice = yuanToCentInteger(data.minSellPrice)
} else { const compared = sellPrice.ok && minPrice.ok
data.basePriceError = false ? compareCentAmounts(sellPrice.value, minPrice.value)
} : { ok: false }
data.basePriceError = !compared.ok || compared.value < 0
} }
return result return result
...@@ -275,9 +279,13 @@ PackageProductStrategy.prototype.performValidation = function () { ...@@ -275,9 +279,13 @@ PackageProductStrategy.prototype.performValidation = function () {
let hasError = false let hasError = false
if (this.item.packageGoods && this.item.packageGoods.goodsList) { if (this.item.packageGoods && this.item.packageGoods.goodsList) {
this.item.packageGoods.goodsList.forEach(subItem => { this.item.packageGoods.goodsList.forEach(subItem => {
const minPrice = yuanToCentInteger(subItem.minSellPrice)
const compared = minPrice.ok
? compareCentAmounts(subItem.price, minPrice.value)
: { ok: false }
if ( if (
subItem.validMinSellPrice === 'Y' && subItem.validMinSellPrice === 'Y' &&
NP.divide(Number(subItem.price), 100) < Number(subItem.minSellPrice) (!compared.ok || compared.value < 0)
) { ) {
subItem.errorTarget = true subItem.errorTarget = true
subItem.checkError = true subItem.checkError = true
...@@ -383,29 +391,13 @@ PackageProductStrategy.prototype.updateSubItemDiscount = function ( ...@@ -383,29 +391,13 @@ PackageProductStrategy.prototype.updateSubItemDiscount = function (
PackageProductStrategy.prototype.applySubItemDiscount = function (subItem) { PackageProductStrategy.prototype.applySubItemDiscount = function (subItem) {
const basePrice = subItem.basePrice const basePrice = subItem.basePrice
let finalPrice = basePrice const discounted = applyQuotationCentDiscount(
const type = subItem.discountType basePrice,
const value = subItem.discountValue subItem.discountType,
subItem.discountValue
if (type == DISCOUNT_TYPE.RATIO && value) { )
if (value > 0 && value <= 10) { subItem.finalPrice = discounted.ok ? discounted.finalCents : basePrice
finalPrice = NP.times(basePrice, NP.divide(value, 10)) subItem.discountAmount = discounted.ok ? discounted.discountCents : 0
// 折扣比例计算:向上取整到“分”(两位小数)
finalPrice = Math.ceil(finalPrice)
}
} else if (type == DISCOUNT_TYPE.AMOUNT && value) {
finalPrice = NP.minus(basePrice, NP.times(value, 100))
finalPrice = Math.round(finalPrice)
if (finalPrice < 0) finalPrice = 0
} else if (type == DISCOUNT_TYPE.GIFT) {
finalPrice = 0
} else if (type == DISCOUNT_TYPE.NONE || type == DISCOUNT_TYPE.NON_GIFT) {
finalPrice = basePrice
}
// subItem.price = finalPrice
subItem.finalPrice = finalPrice
subItem.discountAmount = NP.minus(basePrice, finalPrice)
} }
PackageProductStrategy.prototype.validateSubItemPrice = function ( PackageProductStrategy.prototype.validateSubItemPrice = function (
...@@ -416,12 +408,18 @@ PackageProductStrategy.prototype.validateSubItemPrice = function ( ...@@ -416,12 +408,18 @@ PackageProductStrategy.prototype.validateSubItemPrice = function (
return { valid: true } return { valid: true }
} }
if ( const minPrice = yuanToCentInteger(subItem.minSellPrice)
subItem.validMinSellPrice === 'Y' && const compared = minPrice.ok
Number(price) < Number(subItem.minSellPrice) ? compareCentAmounts(price, minPrice.value)
) { : { ok: false }
if (subItem.validMinSellPrice === 'Y') {
if (!compared.ok) {
return { valid: false, message: '商品价格格式不正确' }
}
if (compared.value < 0) {
return { valid: false, message: '单价不可低于商品最低价' } return { valid: false, message: '单价不可低于商品最低价' }
} }
}
return { valid: true } return { valid: true }
} }
......
/**
* @file 简易权益下单路由参数适配。
* 边界:不跳转、不 setData,只把入口参数转换为页面 patch 与 orderInfo patch。
*/
import NP from 'number-precision'
const PAYMENT_METHOD_ORDER_PATCH = Object.freeze({
1: { payType: 1, payee: 0 },
3: { payType: 2, payee: 1 },
4: { payType: 6, payee: 0 },
6: { payType: 7, payee: 0 }
})
/**
* 获取补录流水中的最晚到账时间戳。
* @param {Array<{accountDateValue:number}>} list 流水列表
* @returns {number|null}
*/
export function getLatestAccountTimestamp(list) {
if (!Array.isArray(list) || !list.length) return null
return list.reduce(
(latest, item) => Math.max(latest, item.accountDateValue),
-Infinity
)
}
/**
* 将简易权益页面入口参数转换为可合并状态。
* @param {object} options 路由参数
* @param {{formatAccountDate?:(timestamp:number)=>string}} dependencies 显式日期格式化依赖
* @returns {{pagePatch:object,orderPatch:object}}
*/
export function buildSimpleQuotationRouteState(options = {}, dependencies = {}) {
const pagePatch = {}
const orderPatch = {}
const paymentMethod = Number(options.paymentMethod)
if (options.paymentMethod !== undefined && options.paymentMethod !== null) {
pagePatch.paymentMethod = options.paymentMethod
if (PAYMENT_METHOD_ORDER_PATCH[paymentMethod]) {
Object.assign(orderPatch, PAYMENT_METHOD_ORDER_PATCH[paymentMethod])
}
}
const trades = options.selectOutTradeNoArr
if (!Array.isArray(trades) || !trades.length) {
return { pagePatch, orderPatch }
}
const switchValues = new Set(trades.map(item => Number(item.switchValue)))
const switchValue =
switchValues.size === 1 ? (switchValues.has(1) ? 1 : 2) : null
const outTradeNo = trades.map(item => item.outTradeNo).join(',')
const tradeNo = trades.map(item => item.tradeNo).join(',')
const totalFee = trades.reduce(
(total, item) => NP.plus(total, item.totalFee || 0),
0
)
const latestTimestamp = getLatestAccountTimestamp(trades)
const accountDate = dependencies.formatAccountDate
? dependencies.formatAccountDate(latestTimestamp)
: latestTimestamp
const isSingleInPeriod = switchValue == 1 && trades.length == 1
Object.assign(pagePatch, {
selectOutTradeNoArr: trades,
switchValue,
outTradeNo,
tradeNo,
totalFee,
accountDate,
showTips: true,
orderCreateType: options.orderCreateType || 'additionRecordOrder'
})
Object.assign(orderPatch, {
payType: isSingleInPeriod ? 1 : 5,
payee: 0,
outTradeNo,
tradeNo,
transactionNo: tradeNo,
switchValue,
selectOutTradeNoArr: trades,
successDateTime: isSingleInPeriod ? '' : accountDate,
pay2Time: isSingleInPeriod ? '' : accountDate
})
return { pagePatch, orderPatch }
}
/**
* @file 简易权益报价提交编排。三种业务动作保持独立且不包含页面副作用。
*/
import { classifyQuotationResponse } from './standardQuotationSubmit.workflow.js'
const ACTION_DEPENDENCY = Object.freeze({
add: 'quotationAdd',
update: 'updateQuotation',
correct: 'errorOrderById'
})
/**
* 提交简易权益报价。
*
* @param {{action: 'add'|'update'|'correct', payload: object}} input 提交输入
* @param {{quotationAdd: Function, updateQuotation: Function, errorOrderById: Function}} dependencies API 依赖
* @returns {Promise<{status: 'success'|'business-error', response: object}>} 提交结果
*/
export async function submitSimpleQuotation(input, dependencies) {
const dependencyName = ACTION_DEPENDENCY[input.action]
if (!dependencyName || typeof dependencies[dependencyName] !== 'function') {
throw new Error(`Unsupported simple quotation action: ${input.action}`)
}
const response = await dependencies[dependencyName](input.payload)
return {
status: classifyQuotationResponse(response).ok
? 'success'
: 'business-error',
response
}
}
/**
* @file 简易权益提交校验与付款凭证规范化。
* 边界:纯函数,不做表单组件校验、不弹窗、不请求 API、不修改页面状态。
*/
import { validateQuotationOrderTotal } from './quotationMoney.helpers.js'
const PAYMENT_DOCUMENT_PAY_TYPES = [2, 5, 6, 7]
const STRATEGY_ORDER_TYPES = [2, 3, 5]
/**
* 展开单品、套餐和多规格条目,供订单策略校验。
* @param {Array<object>} rows 页面商品列表
* @returns {Array<object>}
*/
function flattenSelectedGoods(rows) {
return (Array.isArray(rows) ? rows : []).flatMap(item => {
if (item.packageGoods?.goodsList) return item.packageGoods.goodsList
if (item.goods) return [item.goods]
if (item.multipleSpecificationsGoods?.goods) {
return [item.multipleSpecificationsGoods.goods]
}
return [item]
})
}
/**
* 返回简易权益提交前第一个业务校验结果,顺序与原页面保持一致。
* @param {object} orderInfo 页面订单状态
* @param {{associatedFeeCents?:number|string}} context 关联流水金额(分)
* @returns {{ok:true}|{ok:false,message:string,reason:string}}
*/
export function validateSimpleQuotationSubmission(orderInfo = {}, context = {}) {
if (!Array.isArray(orderInfo.vdQuotationGoodsList) || !orderInfo.vdQuotationGoodsList.length) {
return { ok: false, reason: 'goods-required', message: '请选择增值车损险商品' }
}
if (
!orderInfo.pay2Time &&
PAYMENT_DOCUMENT_PAY_TYPES.includes(Number(orderInfo.payType)) &&
!orderInfo.resetOrder &&
!orderInfo.selectOutTradeNoArr
) {
return {
ok: false,
reason: 'payment-time-required',
message: orderInfo.payType == 2 ? '请选择4S店收款时间' : '请选择嘀加收款时间'
}
}
if (orderInfo.payType == 7 && !orderInfo.notes) {
return { ok: false, reason: 'notes-required', message: '备注不能为空' }
}
if (STRATEGY_ORDER_TYPES.includes(Number(orderInfo.orderType))) {
const allItems = flattenSelectedGoods(orderInfo.vdQuotationGoodsList)
const hasEmptyDiscountValue = allItems.some(
item =>
(item.discountType == 1 || item.discountType == 2) &&
(item.discountValue === '' ||
item.discountValue === null ||
item.discountValue === undefined)
)
if (hasEmptyDiscountValue) {
return {
ok: false,
reason: 'discount-value-required',
message: '商品折扣值不能为空'
}
}
if (orderInfo.orderType == 3 && allItems.length < 2) {
return {
ok: false,
reason: 'gift-goods-count',
message: '买赠策略至少需要选择两个商品'
}
}
if (orderInfo.orderType == 3 && !allItems.some(item => item.discountType == 4)) {
return {
ok: false,
reason: 'gift-required',
message: '买赠策略需要至少有一个商品是赠品'
}
}
if (
orderInfo.orderType == 2 &&
!allItems.some(item => item.discountType && item.discountType != 0)
) {
return {
ok: false,
reason: 'discount-required',
message: '打折策略需要至少有一个商品选择折扣'
}
}
if (
orderInfo.orderType == 5 &&
!allItems.some(item => item.discountType && item.discountType != 0)
) {
return {
ok: false,
reason: 'combined-discount-required',
message: '组合付款需要至少有一个商品选择折扣'
}
}
}
const amount = validateQuotationOrderTotal({
resetOrder: orderInfo.resetOrder,
originalPrice: orderInfo.finalPrice,
associatedFeeCents: context.associatedFeeCents,
total: orderInfo.total
})
if (amount.ok) return { ok: true }
const messages = {
unbalanced: '原错误订单总价+关联交易流水必须等于商品总价',
'below-minimum': '订单总价最低不能小于0.01元',
invalid: '订单金额格式不正确'
}
return {
ok: false,
reason: amount.reason,
message: messages[amount.reason] || messages.invalid
}
}
/**
* 判断多流水或超分账期补录是否应先补付款凭证。
* @param {object} orderInfo 页面订单状态
* @returns {boolean}
*/
export function shouldRequestRecordedPaymentDocuments(orderInfo = {}) {
return Boolean(
!orderInfo.resetOrder &&
!orderInfo.paymentDocList?.length &&
(orderInfo.selectOutTradeNoArr?.length > 1 ||
(orderInfo.switchValue && orderInfo.switchValue != 1))
)
}
/**
* 判断普通门店/嘀加/对公/其它收款是否缺少流水号或付款凭证。
* @param {object} orderInfo 页面订单状态
* @returns {boolean}
*/
export function shouldRequestSimplePaymentDocuments(orderInfo = {}) {
return Boolean(
PAYMENT_DOCUMENT_PAY_TYPES.includes(Number(orderInfo.payType)) &&
!(orderInfo.transactionNo && orderInfo.paymentDocList?.length) &&
!orderInfo.resetOrder
)
}
/**
* 统一上传弹层字符串与详情回显对象为报价接口付款凭证结构。
* @param {Array<string|{paymentDocUrl:string}>} documents 页面付款凭证
* @returns {Array<{paymentDocUrl:string,type:1}>}
*/
export function normalizeSimplePaymentDocuments(documents) {
return (Array.isArray(documents) ? documents : []).map(document => ({
paymentDocUrl:
typeof document === 'string' ? document : document?.paymentDocUrl,
type: 1
}))
}
/**
* @file 标准权益报价提交编排。只负责选择接口和解释通用响应,不处理页面状态或导航。
*/
/**
* 将权益报价接口响应解释为稳定结果。
*
* ROP 通用成功码可能被 transport 保留为字符串,因此同时接受 0 与 '0'。
*
* @param {object|undefined|null} response 接口原始响应
* @returns {{ok: boolean, code: *, message: string, data: *}} 结构化响应
*/
export function classifyQuotationResponse(response) {
const code = response?.code
return {
ok: code === 0 || code === '0',
code,
message: response?.message || '报价失败',
data: response?.data
}
}
/**
* 提交标准权益报价,保持传入 payload 的对象身份和字段不变。
*
* @param {{payload: object, isEdit: boolean}} input 提交输入
* @param {{quotationAdd: Function, updateQuotation: Function}} dependencies API 依赖
* @returns {Promise<{status: 'success'|'business-error', response: object}>} 提交结果
*/
export async function submitStandardQuotation(input, dependencies) {
const request = input.isEdit
? dependencies.updateQuotation
: dependencies.quotationAdd
const response = await request(input.payload)
return {
status: classifyQuotationResponse(response).ok
? 'success'
: 'business-error',
response
}
}
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import reportPageTrackMixin from "~/mixins/reportPageTrackMixin"; import reportPageTrackMixin from "~/mixins/reportPageTrackMixin";
import { getRecordDetailList, getShortUrl } from "../../receptionRecordsApi"; import { getRecordDetailList, getShortUrl } from "../../receptionRecordsApi";
import { putRecordStudyStatus } from "~/api/serviceCenter/index.js"; import { putRecordStudyStatus } from "~/api/serviceCenter/index.js";
import { AI_ROUTES } from '~/router/routeAliases.js'
Page({ Page({
behaviors: [reportPageTrackMixin], behaviors: [reportPageTrackMixin],
...@@ -128,13 +129,13 @@ Page({ ...@@ -128,13 +129,13 @@ Page({
_this.onPause(); _this.onPause();
console.log(tag, stage); console.log(tag, stage);
if (tag && stage) { if (tag && stage) {
wx.navigateTo({ wx.$router.go(
url: `/packageEquity/pages/aiCheck/chat/chat?stage=${stage}&roleName=${tag}`, `${AI_ROUTES.aiCheckChat}?stage=${stage}&roleName=${tag}`
}); )
} else { } else {
wx.navigateTo({ wx.$router.go(
url: `/packageEquity/pages/aiCheck/scene/scene?stage=${stage}&roleName=${tag}`, `${AI_ROUTES.aiCheckScene}?stage=${stage}&roleName=${tag}`
}); )
} }
} else if (res.cancel) { } else if (res.cancel) {
console.log("用户点击取消"); console.log("用户点击取消");
......
import { describe, it } from 'node:test' import { describe, it } from 'node:test'
import assert from 'node:assert/strict' import assert from 'node:assert/strict'
import { createRequire } from 'node:module' import {
const require = createRequire(import.meta.url)
const {
ORDER_TYPE, ORDER_TYPE,
shouldShowOrderStrategyBox shouldShowOrderStrategyBox
} = require('../pages/carQuotation/createOrderCarQuotationSimple/orderStrategyUi.js') } from '../pages/carQuotation/services/orderStrategyUi.js'
describe('orderStrategyUi shouldShowOrderStrategyBox', () => { describe('orderStrategyUi shouldShowOrderStrategyBox', () => {
it('shows strategy UI only for discount, gift, and combination order types', () => { it('shows strategy UI only for discount, gift, and combination order types', () => {
......
...@@ -46,17 +46,21 @@ describe('quotation customer daily field UI contract', () => { ...@@ -46,17 +46,21 @@ describe('quotation customer daily field UI contract', () => {
assert.match(js, /isEquityActualDeliveryDateMissing/) assert.match(js, /isEquityActualDeliveryDateMissing/)
assert.match( assert.match(
js, js,
/isEquityActualDeliveryDateMissing\(\s*dailyFieldVisibility\.actualDeliveryDate,\s*thisPage\.data\[dataAttrName\]\?\.actualDeliveryDate\s*\)/ /isEquityActualDeliveryDateMissing\(\s*dailyFieldVisibility\.actualDeliveryDate,\s*owner\.actualDeliveryDate\s*\)/
) )
assert.match(js, /wx\.\$util\.showToast\('实际交付日期不能为空'\)/) assert.match(js, /wx\.\$util\.showToast\('实际交付日期不能为空'\)/)
}) })
it('IT-EQ-DAILY-UI-002: required certificate config no longer relies on index', () => { it('IT-EQ-DAILY-UI-002: required certificate config no longer relies on index', () => {
const simple = read( const page = read(
'../pages/carQuotation/createOrderCarQuotationSimple/createOrderCarQuotationSimple.js' '../pages/carQuotation/createOrderCarQuotationSimple/createOrderCarQuotationSimple.js'
) )
assert.doesNotMatch(simple, /customerFormList\[6\]/) const formConfig = read(
assert.match(simple, /findIndex\([\s\S]*certificateNo/) '../pages/carQuotation/services/simpleQuotationFormConfig.helpers.js'
)
assert.match(page, /buildSimpleQuotationFormConfig/)
assert.doesNotMatch(formConfig, /customerFormList\[6\]/)
assert.match(formConfig, /findIndex\([\s\S]*certificateNo/)
}) })
it('IT-EQ-DAILY-UI-003: payment detail shows stored daily fields', () => { it('IT-EQ-DAILY-UI-003: payment detail shows stored daily fields', () => {
...@@ -76,9 +80,16 @@ describe('quotation customer daily field UI contract', () => { ...@@ -76,9 +80,16 @@ describe('quotation customer daily field UI contract', () => {
'../pages/carQuotation/createOrderCarQuotationSimple/createOrderCarQuotationSimple.js' '../pages/carQuotation/createOrderCarQuotationSimple/createOrderCarQuotationSimple.js'
) )
assert.match(standard, /getOwnerInfo\(\)[\s\S]*buildOwnerPayload/) assert.match(standard, /getOwnerInfo\(\)[\s\S]*buildOwnerPayload/)
assert.match(standard, /orderInfo\.owner = owner[\s\S]*updateQuotation\(orderInfo\)[\s\S]*quotationAdd\(orderInfo\)/) assert.match(
standard,
/orderInfo\.owner = owner[\s\S]*submitStandardQuotation\([\s\S]*quotationAdd,[\s\S]*updateQuotation/
)
assert.match(simple, /getOwnerInfo\(\)[\s\S]*buildOwnerPayload/) assert.match(simple, /getOwnerInfo\(\)[\s\S]*buildOwnerPayload/)
assert.match(simple, /setQuotationRecording\(\)[\s\S]*orderInfo\.owner = owner[\s\S]*quotationRecording\(orderInfo\)/) assert.match(simple, /setQuotationRecording\(\)[\s\S]*orderInfo\.owner = owner[\s\S]*quotationRecording\(orderInfo\)/)
assert.match(
simple,
/orderInfo\.owner = owner[\s\S]*submitSimpleQuotation\([\s\S]*quotationAdd,[\s\S]*updateQuotation,[\s\S]*errorOrderById/
)
}) })
it('IT-EQ-DAILY-UI-005: FirstStep hides the whole date row through GLForm visibility context', () => { it('IT-EQ-DAILY-UI-005: FirstStep hides the whole date row through GLForm visibility context', () => {
......
import assert from 'node:assert/strict'
import test from 'node:test'
import { buildSelectedCustomerState } from '../pages/carQuotation/services/quotationCustomerSelection.helpers.js'
test('selected customer maps both page owner fields and preserves daily fields', () => {
const currentOwner = {
customerTags: '1',
actualDeliveryDate: 1788192000000,
untouched: 'keep'
}
const customer = {
id: 'customer-row-id',
customerName: '张三',
customerPhone: '13800000000',
customerSex: 2,
carSeat: 7,
carPrice: 12345,
customerCity: '深圳',
customerCertificateNo: 'CERT',
salesType: 0,
salesUuid: 'sales-1',
salesName: '销售甲'
}
const result = buildSelectedCustomerState({
currentOwner,
orderInfo: { baseSceneCode: '110101', baseSceneName: '2.3.1 会员权益升级' },
customer
})
assert.equal(result.owner.owner, '张三')
assert.equal(result.owner.phone, '13800000000')
assert.equal(result.owner.ownerGender, '女')
assert.equal(result.owner.price, 123.45)
assert.equal(result.owner.customerTags, '1')
assert.equal(result.owner.actualDeliveryDate, '2026-09-01')
assert.equal(result.owner.id, undefined)
assert.equal(result.orderPatch.referrerId, 'sales-1')
assert.equal(result.orderPatch.referrer, '销售甲')
})
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import path from 'node:path'
import test from 'node:test'
import { fileURLToPath } from 'node:url'
const projectRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..')
const read = relativePath => readFileSync(path.join(projectRoot, relativePath), 'utf8')
test('FirstStep reports explicit owner, order, scene, customer and goods-reset events', () => {
const source = read('packageEquity/pages/carQuotation/components/FirstStep/FirstStep.js')
assert.doesNotMatch(source, /getPageInstance\s*\(/)
for (const eventName of [
'ownerChange',
'orderChange',
'sceneChange',
'customerSelected',
'resetGoodsRequested'
]) {
assert.match(source, new RegExp(`triggerEvent\\(['"]${eventName}['"]`), eventName)
}
})
test('standard and simple pages bind every FirstStep state event', () => {
for (const relativePath of [
'packageEquity/pages/carQuotation/createOrderCarQuotation/createOrderCarQuotation.wxml',
'packageEquity/pages/carQuotation/createOrderCarQuotationSimple/createOrderCarQuotationSimple.wxml'
]) {
const template = read(relativePath)
for (const [eventName, handler] of [
['ownerChange', 'handleOwnerChange'],
['orderChange', 'handleOrderChange'],
['sceneChange', 'handleSceneChange'],
['customerSelected', 'handleCustomerSelected'],
['resetGoodsRequested', 'handleResetGoodsRequested']
]) {
assert.match(template, new RegExp(`bind:${eventName}="${handler}"`), relativePath)
}
}
})
test('GLForm includes the changed value so FirstStep never reads stale parent props', () => {
const formSource = read('packageEquity/components/GLForm/GLForm.js')
const firstStepSource = read(
'packageEquity/pages/carQuotation/components/FirstStep/FirstStep.js'
)
assert.match(formSource, /triggerEvent\(['"]inputEvent['"],\s*\{\s*attr,\s*value\s*\}/s)
assert.match(firstStepSource, /const value = e\.detail\.value/)
})
...@@ -5,7 +5,11 @@ import { ...@@ -5,7 +5,11 @@ import {
multipliedByHundred, multipliedByHundred,
divideByHundredObj, divideByHundredObj,
multipliedByHundredObj, multipliedByHundredObj,
DEFAULT_NEED_CHANGE_LIST DEFAULT_NEED_CHANGE_LIST,
yuanToCentInteger,
centToYuanText,
compareCentAmounts,
validateQuotationOrderTotal
} from '../pages/carQuotation/services/quotationMoney.helpers.js' } from '../pages/carQuotation/services/quotationMoney.helpers.js'
describe('quotationMoney.helpers', () => { describe('quotationMoney.helpers', () => {
...@@ -35,4 +39,79 @@ describe('quotationMoney.helpers', () => { ...@@ -35,4 +39,79 @@ describe('quotationMoney.helpers', () => {
const out = multipliedByHundredObj({ base: 1.5 }, DEFAULT_NEED_CHANGE_LIST) const out = multipliedByHundredObj({ base: 1.5 }, DEFAULT_NEED_CHANGE_LIST)
assert.equal(out.base, 150) assert.equal(out.base, 150)
}) })
it('IT-EQ-MNY-006: exact decimal yuan converts to integer cents without float tails', () => {
assert.deepEqual(yuanToCentInteger('0.29'), { ok: true, value: 29 })
assert.deepEqual(yuanToCentInteger('1000000.01'), {
ok: true,
value: 100000001
})
assert.deepEqual(yuanToCentInteger(0), { ok: true, value: 0 })
})
it('IT-EQ-MNY-007: invalid, negative and over-precision yuan are rejected explicitly', () => {
for (const value of ['', null, undefined, 'abc', '-1', '0.001']) {
assert.equal(yuanToCentInteger(value).ok, false, String(value))
}
})
it('IT-EQ-MNY-008: cents render as an exact two-decimal display string', () => {
assert.deepEqual(centToYuanText(1), { ok: true, value: '0.01' })
assert.deepEqual(centToYuanText('10000'), {
ok: true,
value: '100.00'
})
assert.equal(centToYuanText('1.2').ok, false)
assert.equal(centToYuanText(-1).ok, false)
})
it('IT-EQ-MNY-009: integer-cent comparison never converts through floating point', () => {
assert.deepEqual(compareCentAmounts('9007199254740990', '9007199254740989'), {
ok: true,
value: 1
})
assert.equal(compareCentAmounts('', 0).ok, false)
})
it('IT-EQ-MNY-010: validates normal and error-order totals in integer cents', () => {
assert.deepEqual(
validateQuotationOrderTotal({ resetOrder: false, total: '0.01' }),
{ ok: true }
)
assert.deepEqual(
validateQuotationOrderTotal({ resetOrder: false, total: '0' }),
{ ok: false, reason: 'below-minimum' }
)
assert.deepEqual(
validateQuotationOrderTotal({
resetOrder: true,
originalPrice: '0.10',
associatedFeeCents: 20,
total: '0.30'
}),
{ ok: true }
)
assert.equal(
validateQuotationOrderTotal({
resetOrder: true,
originalPrice: '0.10',
associatedFeeCents: 19,
total: '0.30'
}).reason,
'unbalanced'
)
})
it('IT-EQ-MNY-011: rejects malformed totals and accepts API float tails', () => {
assert.deepEqual(yuanToCentInteger(1999.9900000000002), {
ok: true,
value: 199999
})
for (const total of ['', 'invalid', '-1', '0.001', Infinity]) {
assert.equal(
validateQuotationOrderTotal({ resetOrder: false, total }).reason,
'invalid'
)
}
})
}) })
import assert from 'node:assert/strict'
import { readFileSync, readdirSync, statSync } from 'node:fs'
import path from 'node:path'
import test from 'node:test'
import { fileURLToPath } from 'node:url'
const projectRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..')
const quotationRoot = path.join(projectRoot, 'packageEquity/pages/carQuotation')
function listSourceFiles(directory) {
return readdirSync(directory, { withFileTypes: true }).flatMap(entry => {
const target = path.join(directory, entry.name)
if (entry.isDirectory()) return listSourceFiles(target)
return /\.(?:js|json|wxml|wxs)$/.test(entry.name) && statSync(target).isFile()
? [target]
: []
})
}
test('quotation sources do not import another business subpackage', () => {
for (const filePath of listSourceFiles(quotationRoot)) {
const source = readFileSync(filePath, 'utf8')
assert.doesNotMatch(source, /~\/(?:tabWorkOrder|packageUsedCar|packageDynamicForm)\//, filePath)
assert.doesNotMatch(source, /(?:\.\.\/)+(?:tabWorkOrder|packageUsedCar|packageDynamicForm)\//, filePath)
}
})
test('reusable simple quotation product strategy is not owned by the page directory', () => {
const componentPath = path.join(
quotationRoot,
'components/SecondStepSimple/SecondStep.js'
)
assert.doesNotMatch(
readFileSync(componentPath, 'utf8'),
/createOrderCarQuotationSimple\/productStrategy/
)
})
...@@ -157,4 +157,20 @@ describe('quotationPayload.helpers', () => { ...@@ -157,4 +157,20 @@ describe('quotationPayload.helpers', () => {
assert.equal(mapOwnerSalesTypeForApi(2), 2) assert.equal(mapOwnerSalesTypeForApi(2), 2)
assert.equal(mapOwnerSalesTypeFromApi(2), 2) assert.equal(mapOwnerSalesTypeFromApi(2), 2)
}) })
it('IT-EQ-PAY-008: invalid standard quotation amounts fail instead of becoming zero', () => {
assert.throws(
() => buildInsurancePayload({ business: { base: '0.001' } }),
/business\.base/
)
assert.throws(() => buildOwnerPayload({ price: '-1' }), /owner\.price/)
})
it('IT-EQ-PAY-009: minimum-price selection compares integer cents at the safe limit', () => {
const [mapped] = mapQuotationGoodsList(
[{ shopMinPrice: '90071992547409.90' }],
{ outTradeNo: 'trade-1', totalFee: '9007199254740989' }
)
assert.equal(mapped.isSeletct, true)
})
}) })
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import path from 'node:path'
import test from 'node:test'
import { fileURLToPath } from 'node:url'
const projectRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..')
test('second-step components emit quoteRequested and do not call pricing API', () => {
for (const relativePath of [
'packageEquity/pages/carQuotation/components/SecondStep/SecondStep.js',
'packageEquity/pages/carQuotation/components/SecondStepSimple/SecondStep.js'
]) {
const source = readFileSync(path.join(projectRoot, relativePath), 'utf8')
assert.match(source, /triggerEvent\(['"]quoteRequested['"],\s*\{\s*goodsId:/, relativePath)
assert.doesNotMatch(source, /import\s*\{\s*priceCounter\s*\}/, relativePath)
assert.doesNotMatch(source, /\bpriceCounter\s*\(/, relativePath)
}
})
test('quotation pages own quote requests and bind both components', () => {
for (const [script, template] of [
[
'packageEquity/pages/carQuotation/createOrderCarQuotation/createOrderCarQuotation.js',
'packageEquity/pages/carQuotation/createOrderCarQuotation/createOrderCarQuotation.wxml'
],
[
'packageEquity/pages/carQuotation/createOrderCarQuotationSimple/createOrderCarQuotationSimple.js',
'packageEquity/pages/carQuotation/createOrderCarQuotationSimple/createOrderCarQuotationSimple.wxml'
]
]) {
assert.match(
readFileSync(path.join(projectRoot, script), 'utf8'),
/async\s+handleQuoteRequested\s*\(/
)
assert.match(
readFileSync(path.join(projectRoot, template), 'utf8'),
/bind:quoteRequested="handleQuoteRequested"/
)
}
})
import assert from 'node:assert/strict'
import { describe, it } from 'node:test'
import {
buildPricingPayload,
requestQuotationPrice,
validateRecordedPriceLimit
} from '../pages/carQuotation/services/quotationPricing.workflow.js'
describe('quotationPricing.workflow', () => {
it('accepts only numeric or string zero success codes', async () => {
for (const code of [0, '0']) {
const result = await requestQuotationPrice(
{ goodsId: 12 },
{ priceCounter: async () => ({ code, data: { quotedPriceUpdate: 9900 } }) }
)
assert.equal(result.status, 'success')
assert.equal(result.data.quotedPriceUpdate, 9900)
}
for (const code of [1, '1', true, undefined]) {
const result = await requestQuotationPrice(
{ goodsId: 12 },
{ priceCounter: async () => ({ code, message: '不可报价' }) }
)
assert.deepEqual(result, {
status: 'business-error',
data: undefined,
message: '不可报价',
code
})
}
})
it('preserves payload identity and propagates reject', async () => {
const payload = { goodsId: 12, owner: { owner: '李四' } }
let received
await assert.rejects(
requestQuotationPrice(payload, {
priceCounter: async value => {
received = value
throw new Error('counter unavailable')
}
}),
/counter unavailable/
)
assert.equal(received, payload)
})
it('builds a new payload without mutating owner or quotation', () => {
const owner = { owner: '王五', buyCarTime: '2026-01-01', salesType: '售后' }
const quotation = {
owner: { stale: true },
quotedPriceUpdate: 100,
insureList: [{ type: 3, appreciation: 1 }]
}
const result = buildPricingPayload({
owner,
quotation,
goods: { id: 8, goodsName: '延保', appreciation: 8 }
})
assert.deepEqual(result.owner, { owner: '王五', salesType: 1 })
assert.equal(result.goodsId, 8)
assert.equal(result.goodsName, '延保')
assert.equal(result.quotedPriceUpdate, undefined)
assert.deepEqual(owner, {
owner: '王五',
buyCarTime: '2026-01-01',
salesType: '售后'
})
assert.deepEqual(quotation.insureList, [{ type: 3, appreciation: 1 }])
})
it('compares recorded totals and minimum equity prices as integer cents', () => {
assert.deepEqual(validateRecordedPriceLimit(100, 100), { ok: true })
assert.deepEqual(validateRecordedPriceLimit('101', 100), {
ok: false,
reason: 'above-recorded-total'
})
assert.deepEqual(validateRecordedPriceLimit('1.01', 100), {
ok: false,
reason: 'invalid'
})
})
})
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import path from 'node:path'
import { describe, it } from 'node:test'
import { fileURLToPath } from 'node:url'
const projectRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..')
const appConfig = JSON.parse(readFileSync(path.join(projectRoot, 'app.json'), 'utf8'))
const equityPackage = appConfig.subpackages.find(item => item.root === 'packageEquity')
const equityPages = new Set(equityPackage.pages.map(page => `${equityPackage.root}/${page}`))
describe('equity quotation route contract', () => {
for (const [alias, pagePath] of [
['createOrderCarQuotation', 'packageEquity/pages/carQuotation/createOrderCarQuotation/createOrderCarQuotation'],
['createOrderCarQuotationSimple', 'packageEquity/pages/carQuotation/createOrderCarQuotationSimple/createOrderCarQuotationSimple'],
['schemeConfirmation', 'packageEquity/pages/carQuotation/schemeConfirmation/schemeConfirmation'],
['CarQuotationPay', 'packageEquity/pages/carQuotation/CarQuotationPay/CarQuotationPay'],
['packageEquity.equityPage', 'packageEquity/pages/TabBar/equityPage']
]) {
it(`resolves ${alias} to an existing package page`, () => {
assert.ok(equityPages.has(pagePath), `${alias} -> ${pagePath}`)
assert.equal(path.basename(pagePath), alias.split('.').at(-1))
})
}
it('passes list tabIndex as a route parameter instead of embedding a query in the alias', () => {
for (const relativePath of [
'packageEquity/pages/carQuotation/createOrderCarQuotation/createOrderCarQuotation.js',
'packageEquity/pages/carQuotation/createOrderCarQuotationSimple/createOrderCarQuotationSimple.js'
]) {
const source = readFileSync(path.join(projectRoot, relativePath), 'utf8')
assert.doesNotMatch(
source,
/packageEquity\.equityPage\?tabIndex=/,
relativePath
)
}
})
})
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import path from 'node:path'
import test from 'node:test'
import { fileURLToPath } from 'node:url'
const projectRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..')
const read = relativePath => readFileSync(path.join(projectRoot, relativePath), 'utf8')
test('quotation step components never obtain or mutate a parent page instance', () => {
for (const relativePath of [
'packageEquity/pages/carQuotation/components/FirstStep/FirstStep.js',
'packageEquity/pages/carQuotation/components/SecondStep/SecondStep.js',
'packageEquity/pages/carQuotation/components/SecondStepSimple/SecondStep.js'
]) {
assert.doesNotMatch(read(relativePath), /getPageInstance\s*\(/, relativePath)
}
})
test('both SecondStep components publish order patches', () => {
for (const relativePath of [
'packageEquity/pages/carQuotation/components/SecondStep/SecondStep.js',
'packageEquity/pages/carQuotation/components/SecondStepSimple/SecondStep.js'
]) {
assert.match(read(relativePath), /triggerEvent\(['"]orderChange['"],\s*\{\s*patch:/, relativePath)
}
})
test('standard and simple pages bind SecondStep order patches', () => {
for (const relativePath of [
'packageEquity/pages/carQuotation/createOrderCarQuotation/createOrderCarQuotation.wxml',
'packageEquity/pages/carQuotation/createOrderCarQuotationSimple/createOrderCarQuotationSimple.wxml'
]) {
assert.match(read(relativePath), /<second-step[\s\S]*bind:orderChange="handleOrderChange"/)
}
})
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import path from 'node:path'
import { describe, it } from 'node:test'
import { fileURLToPath } from 'node:url'
import {
classifyQuotationResponse,
submitStandardQuotation
} from '../pages/carQuotation/services/standardQuotationSubmit.workflow.js'
import { submitSimpleQuotation } from '../pages/carQuotation/services/simpleQuotationSubmit.workflow.js'
const projectRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..')
it('quotation pages do not use an async Promise executor', () => {
for (const relativePath of [
'packageEquity/pages/carQuotation/createOrderCarQuotation/createOrderCarQuotation.js',
'packageEquity/pages/carQuotation/createOrderCarQuotationSimple/createOrderCarQuotationSimple.js'
]) {
assert.doesNotMatch(
readFileSync(path.join(projectRoot, relativePath), 'utf8'),
/new\s+Promise\s*\(\s*async\b/,
relativePath
)
}
})
it('quotation pages consume workflow status before navigating', () => {
const standard = readFileSync(
path.join(
projectRoot,
'packageEquity/pages/carQuotation/createOrderCarQuotation/createOrderCarQuotation.js'
),
'utf8'
)
const simple = readFileSync(
path.join(
projectRoot,
'packageEquity/pages/carQuotation/createOrderCarQuotationSimple/createOrderCarQuotationSimple.js'
),
'utf8'
)
assert.match(standard, /outcome\.status\s*!==\s*['"]success['"]/)
assert.match(standard, /return\s+submitStandardQuotation\s*\(/)
assert.match(simple, /submitOutcome\.status\s*!==\s*['"]success['"]/)
assert.match(simple, /status:\s*submitOutcome\.status/)
})
describe('standardQuotationSubmit.workflow', () => {
it('keeps add payload identity and classifies a string zero as success', async () => {
const payload = { owner: { owner: '张三' }, check: true }
let received
const result = await submitStandardQuotation(
{ payload, isEdit: false },
{
quotationAdd: async value => {
received = value
return { code: '0', data: 101 }
},
updateQuotation: async () => assert.fail('must not update')
}
)
assert.equal(received, payload)
assert.deepEqual(result, {
status: 'success',
response: { code: '0', data: 101 }
})
})
it('selects update only for edit and propagates API rejection', async () => {
const rejection = new Error('network unavailable')
await assert.rejects(
submitStandardQuotation(
{ payload: { id: 9 }, isEdit: true },
{
quotationAdd: async () => assert.fail('must not add'),
updateQuotation: async () => {
throw rejection
}
}
),
rejection
)
})
it('does not leave a rejected request pending', async () => {
const settled = await Promise.race([
submitStandardQuotation(
{ payload: {}, isEdit: false },
{
quotationAdd: async () => {
throw new Error('boom')
},
updateQuotation: async () => ({ code: 0 })
}
).then(
() => 'resolved',
() => 'rejected'
),
new Promise(resolve => setTimeout(() => resolve('timeout'), 50))
])
assert.equal(settled, 'rejected')
})
it('classifies non-zero and missing responses as business errors', () => {
assert.deepEqual(classifyQuotationResponse({ code: 2, message: '失败' }), {
ok: false,
code: 2,
message: '失败',
data: undefined
})
assert.deepEqual(classifyQuotationResponse(undefined), {
ok: false,
code: undefined,
message: '报价失败',
data: undefined
})
})
})
describe('simpleQuotationSubmit.workflow', () => {
for (const [action, expectedDependency] of [
['add', 'quotationAdd'],
['update', 'updateQuotation'],
['correct', 'errorOrderById']
]) {
it(`selects ${expectedDependency} for ${action} and preserves payload identity`, async () => {
const payload = { id: 7, marker: action }
const calls = []
const dependencies = Object.fromEntries(
['quotationAdd', 'updateQuotation', 'errorOrderById'].map(name => [
name,
async value => {
calls.push([name, value])
return { code: 0, data: 7 }
}
])
)
const result = await submitSimpleQuotation(
{ action, payload },
dependencies
)
assert.deepEqual(calls, [[expectedDependency, payload]])
assert.equal(result.status, 'success')
})
}
it('rejects an unsupported action before invoking an API', async () => {
await assert.rejects(
submitSimpleQuotation(
{ action: 'unknown', payload: {} },
{
quotationAdd: async () => assert.fail('must not add'),
updateQuotation: async () => assert.fail('must not update'),
errorOrderById: async () => assert.fail('must not correct')
}
),
/Unsupported simple quotation action/
)
})
})
import assert from 'node:assert/strict'
import { describe, it } from 'node:test'
import {
buildSimpleQuotationSelectedGoods,
normalizeSimpleQuotationCatalog,
prepareSimpleQuotationDetail
} from '../pages/carQuotation/services/simpleQuotationCatalog.helpers.js'
describe('simpleQuotationCatalog.helpers', () => {
it('IT-EQ-SIMPLE-CATALOG-001: normalizes single, package and multi-spec catalog rows without mutating the API response', () => {
const rows = [
{
id: 'single-row',
goodsFlag: 1,
goods: {
merchantGoodsId: 'single-1',
price: '12.34',
sellPrice: 9999,
upgradeGoodsAlias: '单品别名',
upgradeGoodsName: '单品',
position: '4大件',
specificationTypeSequence: 'type',
specificationNameSequence: '颜色;~;尺寸',
specificationData: '红;~;大',
upgradeGoodsServiceItemsList: [
{ serviceName: '服务A' },
{ serviceName: '服务B' }
],
goodsInfo: { thumbUrl: 'https://example.test/single.png' }
}
},
{
id: 'zero-row',
goodsFlag: 1,
goods: {
merchantGoodsId: 'zero-1',
price: 0,
sellPrice: '88.88',
upgradeGoodsName: '赠品候选'
}
},
{
id: 'package-row',
goodsFlag: 3,
packageGoods: {
packageCode: 'package-1',
goodsList: [
{ merchantGoodsId: 'package-good-1', price: '1.25', sellPrice: 125 },
{ merchantGoodsId: 'package-good-2', price: '2.50', sellPrice: 250 }
]
}
},
{
id: 'multi-row',
goodsFlag: 2,
multipleSpecificationsGoods: {
specificationGoodsMap: {
'红;~;大': [
{ merchantGoodsId: 'sku-1', price: '3.50', sellPrice: 350 }
]
},
specificationList: [
{
specificationValueList: [
{ specificationValue: '红', show: true },
{ specificationValue: '蓝', show: false }
]
}
]
}
}
]
const snapshot = structuredClone(rows)
const result = normalizeSimpleQuotationCatalog(rows)
assert.deepEqual(rows, snapshot)
assert.equal(result[0].goods.price, 1234)
assert.equal(result[0].goods.serveName, '燃油车4大件服务')
assert.equal(result[0].goods.specificationNameSequence, '颜色/尺寸')
assert.equal(result[0].goods.specificationData, '红/大')
assert.equal(result[0].goods.titlePictureUrl, 'https://example.test/single.png')
assert.equal(result[1].goods.price, 0)
assert.equal(result[2].packageGoods.goodsList[0].price, 125)
assert.equal(result[2].packageGoods.sellPrice, 375)
assert.equal(
result[3].multipleSpecificationsGoods.specificationGoodsMap['红;~;大'][0].price,
350
)
assert.deepEqual(
result[3].multipleSpecificationsGoods.specificationList[0]
.specificationSelectValueList,
['红']
)
})
it('IT-EQ-SIMPLE-ECHO-001: rebuilds detail goods from the catalog and preserves authoritative detail prices', () => {
const catalog = normalizeSimpleQuotationCatalog([
{
goodsFlag: 1,
goods: {
merchantGoodsId: 'single-1',
price: '10.00',
minSellPrice: 900,
validMinSellPrice: true
}
},
{
goodsFlag: 3,
packageGoods: {
packageCode: 'package-1',
goodsList: [
{
merchantGoodsId: 'package-good-1',
price: '2.00',
sellPrice: 200,
minSellPrice: 180,
validMinSellPrice: false
},
{
merchantGoodsId: 'package-good-2',
price: '3.00',
sellPrice: 300
}
]
}
},
{
goodsFlag: 2,
multipleSpecificationsGoods: {
specificationGoodsMap: {
'红;~;大': [
{ merchantGoodsId: 'sku-1', price: '5.00', sellPrice: 500 }
]
},
specificationList: []
}
}
])
const detailRows = [
{ goodsId: 'single-1', goodsName: '单品', goodsPrice: 1200, finalPrice: 1100 },
{
packageId: 'package-1',
packageName: '套餐',
goodsId: 'package-good-1',
goodsName: '套餐一',
goodsPrice: 210,
finalPrice: 200
},
{
packageId: 'package-1',
packageName: '套餐',
goodsId: 'package-good-2',
goodsName: '套餐二',
goodsPrice: 320,
finalPrice: 300
},
{
goodsId: 'sku-1',
goodsName: '多规格',
goodsPrice: 550,
finalPrice: 525,
specificationsValue: '红/大',
discountType: 2,
discountValue: 0.25,
discountAmount: 25
}
]
const detailSnapshot = structuredClone(detailRows)
const catalogSnapshot = structuredClone(catalog)
const result = buildSimpleQuotationSelectedGoods(detailRows, catalog)
assert.deepEqual(detailRows, detailSnapshot)
assert.deepEqual(catalog, catalogSnapshot)
assert.equal(result.length, 3)
assert.equal(result[0].goods.price, 1200)
assert.equal(result[0].goods.minSellPrice, 900)
assert.equal(result[1].packageGoods.goodsList.length, 2)
assert.equal(result[1].price, 530)
assert.equal(result[2].multipleSpecificationsGoods.goods.price, 550)
assert.equal(result[2].multipleSpecificationsGoods.goods.finalPrice, 525)
assert.equal(result[2].multipleSpecificationsGoods.goods.specificationStr, '红/大')
})
it('IT-EQ-SIMPLE-ECHO-002: prepares edit and error-order detail state without dereferencing a missing response body', () => {
assert.equal(prepareSimpleQuotationDetail(null, [], {}).ok, false)
const detail = {
id: 7,
owner: { price: 12345, salesType: 1 },
insurancePrice: 101,
quotedPriceUpdate: 202,
finalPrice: 303,
payType: 2,
outTradeNo: 'out-1',
transactionNo: '',
vdQuotationGoodsList: []
}
const result = prepareSimpleQuotationDetail(detail, [], {
resetOrder: true,
salesTypeOptions: [
{ optionId: 0, optionLabel: '售前' },
{ optionId: 1, optionLabel: '售后' }
]
})
assert.equal(result.ok, true)
assert.equal(result.detail.owner.price, 123.45)
assert.equal(result.detail.insurancePrice, 1.01)
assert.equal(result.detail.owner.salesTypeLabel, '售后')
assert.equal(result.detail.owner.ownerGender, '男')
assert.equal(result.detail.resetOrder, true)
assert.equal(result.detail.payType, 5)
assert.equal(result.detail.payee, 0)
assert.equal(result.detail.transactionNo, 'out-1')
assert.equal('outTradeNo' in result.detail, false)
assert.deepEqual(detail, {
id: 7,
owner: { price: 12345, salesType: 1 },
insurancePrice: 101,
quotedPriceUpdate: 202,
finalPrice: 303,
payType: 2,
outTradeNo: 'out-1',
transactionNo: '',
vdQuotationGoodsList: []
})
})
})
import assert from 'node:assert/strict'
import { describe, it } from 'node:test'
import { buildSimpleQuotationFormConfig } from '../pages/carQuotation/services/simpleQuotationFormConfig.helpers.js'
function createSchema() {
return {
firstObjSimple: {
carFormList: [{ name: 'brands' }, { name: 'carNo' }, { name: 'carVin' }],
customerFormList: [
{ name: 'owner' },
{ name: 'certificateNo', placeholder: '请输入(非必填)' }
]
},
formRuleSimple: {
phone: [{ validator: () => null }],
carVin: [{ validator: () => null }],
certificateNo: [{ validator: () => null }]
}
}
}
describe('simpleQuotationFormConfig.helpers', () => {
it('IT-EQ-SIMPLE-FORM-001: keeps the source schema immutable and preserves validators', () => {
const source = createSchema()
const originalPhoneValidator = source.formRuleSimple.phone[0].validator
const result = buildSimpleQuotationFormConfig(source, [])
assert.equal(result.shouldLoadStoreConfig, true)
assert.notEqual(result.first, source.firstObjSimple)
assert.notEqual(result.formRule, source.formRuleSimple)
assert.equal(result.formRule.phone[0].validator, originalPhoneValidator)
assert.equal(source.firstObjSimple.carFormList[0].required, undefined)
})
it('IT-EQ-SIMPLE-FORM-002: maps car brand and VIN requirements to the existing component contract', () => {
const result = buildSimpleQuotationFormConfig(createSchema(), [
{ fieldKey: 'carBrand', isRequired: 1 },
{ fieldKey: 'carNo', isRequired: true }
])
assert.equal(result.shouldLoadStoreConfig, false)
assert.deepEqual(result.requiredFields, ['carBrand', 'carNo'])
assert.equal(result.first.carFormList[0].required, true)
assert.equal(result.first.carFormList[0].name, 'brands')
assert.equal(result.first.carFormList[2].required, true)
assert.equal(result.formRule.carVin[0].message, '车架号不能为空')
assert.deepEqual(result.formRule.carVin[1].validator({}, '123'), {
message: '请输入正确的17位车架号'
})
assert.equal(result.formRule.carVin[1].validator({}, '1'.repeat(17)), null)
})
it('IT-EQ-SIMPLE-FORM-003: marks certificate number required without depending on its array index', () => {
const source = createSchema()
source.firstObjSimple.customerFormList.reverse()
const result = buildSimpleQuotationFormConfig(source, [
{ fieldKey: 'idNumber', isRequired: 1 },
{ fieldKey: 'ignored', isRequired: 0 }
])
const certificate = result.first.customerFormList.find(
item => item.name === 'certificateNo'
)
assert.equal(certificate.required, true)
assert.equal(certificate.placeholder, '请输入(必填)')
assert.equal(result.formRule.certificateNo[0].message, '证件号码不能为空')
assert.deepEqual(result.formRule.certificateNo[1].validator({}, '123'), {
message: '请输入正确的18位证件号'
})
assert.equal(result.formRule.certificateNo[1].validator({}, ''), undefined)
})
})
import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
import { describe, it } from 'node:test'
const pageUrl = new URL(
'../pages/carQuotation/createOrderCarQuotationSimple/createOrderCarQuotationSimple.js',
import.meta.url
)
describe('simple quotation page contract', () => {
it('IT-EQ-SIMPLE-PAGE-001: keeps business transformations in local services without cross-package imports', async () => {
const source = await readFile(pageUrl, 'utf8')
assert.match(source, /simpleQuotationCatalog\.helpers\.js/)
assert.match(source, /simpleQuotationRoute\.helpers\.js/)
assert.match(source, /simpleQuotationValidation\.helpers\.js/)
assert.match(source, /simpleQuotationFormConfig\.helpers\.js/)
assert.doesNotMatch(source, /tabWorkOrder|packageEquityAI/)
})
it('IT-EQ-SIMPLE-PAGE-002: removes debug output and the disabled wait-order polling path', async () => {
const source = await readFile(pageUrl, 'utf8')
assert.doesNotMatch(source, /console\.log\s*\(/)
assert.doesNotMatch(source, /\bwaitinputorder\b/)
assert.doesNotMatch(source, /\bgetWaitOrder\b/)
assert.doesNotMatch(source, /\bsetTime\s*\(/)
assert.doesNotMatch(source, /\bupdateOrderStatus\b/)
})
})
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import {
buildSimpleQuotationPayload,
mapSimpleQuotationGoods
} from '../pages/carQuotation/services/simpleQuotationPayload.helpers.js'
describe('simpleQuotationPayload.helpers', () => {
it('IT-EQ-SIMPLE-PAY-001: maps single, package and multi-spec goods without re-deriving authoritative line totals', () => {
const goods = [
{
goods: {
merchantGoodsId: 'single-1',
goodsName: '单品',
goodsAlias: '单品别名',
specificationNameSequence: '颜色',
specificationData: '红;~;大',
price: 100,
finalPrice: 123,
quantity: 3,
discountType: 1,
discountValue: 9,
discountAmount: 7
}
},
{
packageGoods: {
packageCode: 'package-1',
packageName: '套餐',
packageAlias: '套餐别名',
goodsList: [
{
merchantGoodsId: 'package-good-1',
goodsName: '套餐商品',
price: 200,
finalPrice: 150,
quantity: 0,
discountType: 2
}
]
}
},
{
multipleSpecificationsGoods: {
goods: {
merchantGoodsId: 'sku-1',
upgradeGoodsName: '多规格商品',
price: 300,
finalPrice: 260,
discountType: 3
}
}
},
{
goods: {
merchantGoodsId: 'gift-1',
goodsName: '赠品',
price: 999,
finalPrice: 999,
discountType: 4
}
}
]
const mapped = mapSimpleQuotationGoods(goods)
assert.equal(mapped.length, 4)
assert.equal(mapped[0].finalPrice, 123)
assert.equal(mapped[0].singleProductFinalPrice, 123)
assert.equal(mapped[1].packageId, 'package-1')
assert.equal(mapped[1].finalPrice, 150)
assert.equal(mapped[2].goodsId, 'sku-1')
assert.equal(mapped[2].finalPrice, 260)
assert.equal(mapped[3].finalPrice, 0)
})
it('IT-EQ-SIMPLE-PAY-002: builds the existing API payload in integer cents without mutating page state', () => {
const input = {
owner: {
customerName: '张三',
price: '0.29',
salesType: '售后'
},
orderInfo: {
id: 8,
insurancePrice: '1.01',
total: '2.02',
quotedPriceUpdate: '3.03',
finalPrice: '4.04',
minEquityPrice: '5.05',
paymentDocList: undefined,
vdQuotationGoodsList: [
{
goods: {
merchantGoodsId: 'g-1',
goodsName: '商品',
price: 99,
discountType: 4
}
}
]
},
context: {
merchant4s: { merchantId: 11, merchantName: '测试门店' }
}
}
const snapshot = structuredClone(input)
const result = buildSimpleQuotationPayload(input)
assert.equal(result.ok, true)
assert.equal(result.payload.insurancePrice, 101)
assert.equal(result.payload.total, 202)
assert.equal(result.payload.quotedPriceUpdate, 303)
assert.equal(result.payload.finalPrice, 404)
assert.equal(result.payload.minEquityPrice, 505)
assert.equal(result.payload.owner.price, 29)
assert.equal(result.payload.owner.salesType, 1)
assert.deepEqual(result.payload.paymentDocList, [])
assert.deepEqual(result.payload.vdQuotationGoodsList[0], {
goodsId: 'g-1',
goodsName: '商品',
goodsNameAlias: undefined,
specificationsName: undefined,
specificationsValue: '',
goodsPrice: 99,
finalPrice: 0,
singleProductFinalPrice: 0,
discountType: 4,
discountValue: undefined,
discountAmount: 0
})
assert.equal(result.payload.merchantId4s, 11)
assert.deepEqual(input, snapshot)
})
it('IT-EQ-SIMPLE-PAY-003: missing optional amounts become zero but invalid amounts block submission', () => {
const empty = buildSimpleQuotationPayload({
owner: {},
orderInfo: { vdQuotationGoodsList: [] },
context: {}
})
assert.equal(empty.ok, true)
assert.equal(empty.payload.total, 0)
assert.deepEqual(empty.payload.vdQuotationGoodsList, [])
const invalid = buildSimpleQuotationPayload({
owner: {},
orderInfo: {
total: '0.001',
finalPrice: '-1',
vdQuotationGoodsList: []
},
context: {}
})
assert.equal(invalid.ok, false)
assert.deepEqual(
invalid.errors.map(item => item.field),
['total', 'finalPrice']
)
})
})
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import {
DISCOUNT_TYPE,
getProductStrategy
} from '../pages/carQuotation/services/simpleQuotationProduct.strategy.js'
describe('simpleQuotationProduct.strategy money units', () => {
it('IT-EQ-PRODUCT-001: compares a cent price with a yuan minimum using the same unit', () => {
const strategy = getProductStrategy({
goods: {
price: 100,
minSellPrice: '1.01',
validMinSellPrice: 'Y'
}
})
assert.deepEqual(strategy.performValidation(), {
valid: false,
message: '单价不可低于商品最低价'
})
})
it('IT-EQ-PRODUCT-002: fixed-amount discount converts yuan to exact integer cents', () => {
const item = { goods: { price: 100 } }
const strategy = getProductStrategy(item)
strategy.setDiscount(DISCOUNT_TYPE.AMOUNT, '0.29')
assert.equal(item.goods.finalPrice, 71)
assert.equal(item.goods.discountAmount, 29)
})
it('IT-EQ-PRODUCT-003: package child uses the same exact amount and minimum-price rules', () => {
const item = {
packageGoods: {
price: 100,
goodsList: [
{
price: 100,
minSellPrice: '1.01',
validMinSellPrice: 'Y'
}
]
}
}
const strategy = getProductStrategy(item)
strategy.updateSubItemDiscount(0, DISCOUNT_TYPE.AMOUNT, '0.29')
assert.equal(item.packageGoods.goodsList[0].finalPrice, 71)
assert.equal(strategy.performValidation().valid, false)
})
it('IT-EQ-PRODUCT-004: ratio discount preserves the existing upward cent rule', () => {
const item = { goods: { price: 101 } }
getProductStrategy(item).setDiscount(DISCOUNT_TYPE.RATIO, '9.5')
assert.equal(item.goods.finalPrice, 96)
})
it('IT-EQ-PRODUCT-005: malformed minimum-price inputs fail closed', () => {
const invalidPrice = getProductStrategy({
goods: {
price: 'invalid',
minSellPrice: '1.00',
validMinSellPrice: 'Y'
}
})
assert.equal(invalidPrice.validatePrice().valid, false)
const invalidMinimum = getProductStrategy({
goods: {
price: 100,
minSellPrice: 'invalid',
validMinSellPrice: 'Y'
}
})
assert.equal(invalidMinimum.validatePrice().valid, false)
})
it('IT-EQ-PRODUCT-006: explicit zero quantity never falls back to one', () => {
const strategy = getProductStrategy({ count: 0, goods: { price: 100 } })
assert.equal(strategy.getCount(), 0)
assert.equal(strategy.calculateSubtotal(), 0)
})
it('IT-EQ-PRODUCT-007: over-precision ratios do not create float-tail totals', () => {
const item = { goods: { price: 101 } }
getProductStrategy(item).setDiscount(DISCOUNT_TYPE.RATIO, '9.501')
assert.equal(item.goods.finalPrice, 101)
assert.equal(item.goods.discountAmount, 0)
})
})
import assert from 'node:assert/strict'
import { describe, it } from 'node:test'
import {
buildSimpleQuotationRouteState,
getLatestAccountTimestamp
} from '../pages/carQuotation/services/simpleQuotationRoute.helpers.js'
describe('simpleQuotationRoute.helpers', () => {
it('IT-EQ-SIMPLE-ROUTE-001: maps each supported payment entry without mixing route and order state', () => {
assert.deepEqual(buildSimpleQuotationRouteState({ paymentMethod: 1 }), {
pagePatch: { paymentMethod: 1 },
orderPatch: { payType: 1, payee: 0 }
})
assert.deepEqual(buildSimpleQuotationRouteState({ paymentMethod: 3 }), {
pagePatch: { paymentMethod: 3 },
orderPatch: { payType: 2, payee: 1 }
})
assert.deepEqual(buildSimpleQuotationRouteState({ paymentMethod: 4 }), {
pagePatch: { paymentMethod: 4 },
orderPatch: { payType: 6, payee: 0 }
})
assert.deepEqual(buildSimpleQuotationRouteState({ paymentMethod: 6 }), {
pagePatch: { paymentMethod: 6 },
orderPatch: { payType: 7, payee: 0 }
})
assert.deepEqual(buildSimpleQuotationRouteState({ paymentMethod: 5 }), {
pagePatch: { paymentMethod: 5 },
orderPatch: {}
})
})
it('IT-EQ-SIMPLE-ROUTE-002: maps one in-period trade to online pay and keeps zero-cent totals exact', () => {
const trades = [
{
outTradeNo: 'out-1',
tradeNo: 'trade-1',
totalFee: 0,
switchValue: 1,
accountDateValue: 100
}
]
const result = buildSimpleQuotationRouteState(
{ selectOutTradeNoArr: trades },
{ formatAccountDate: value => `date:${value}` }
)
assert.deepEqual(result.pagePatch, {
selectOutTradeNoArr: trades,
switchValue: 1,
outTradeNo: 'out-1',
tradeNo: 'trade-1',
totalFee: 0,
accountDate: 'date:100',
showTips: true,
orderCreateType: 'additionRecordOrder'
})
assert.deepEqual(result.orderPatch, {
payType: 1,
payee: 0,
outTradeNo: 'out-1',
tradeNo: 'trade-1',
transactionNo: 'trade-1',
switchValue: 1,
selectOutTradeNoArr: trades,
successDateTime: '',
pay2Time: ''
})
})
it('IT-EQ-SIMPLE-ROUTE-003: mixed settlement periods use the latest date and combined recorded-payment fields', () => {
const trades = [
{
outTradeNo: 'out-1',
tradeNo: 'trade-1',
totalFee: 101,
switchValue: 1,
accountDateValue: 100
},
{
outTradeNo: 'out-2',
tradeNo: 'trade-2',
totalFee: 202,
switchValue: 2,
accountDateValue: 300
}
]
const result = buildSimpleQuotationRouteState(
{ selectOutTradeNoArr: trades, orderCreateType: 'custom-record' },
{ formatAccountDate: value => `date:${value}` }
)
assert.equal(getLatestAccountTimestamp(trades), 300)
assert.equal(result.pagePatch.switchValue, null)
assert.equal(result.pagePatch.totalFee, 303)
assert.equal(result.pagePatch.accountDate, 'date:300')
assert.equal(result.pagePatch.orderCreateType, 'custom-record')
assert.equal(result.orderPatch.payType, 5)
assert.equal(result.orderPatch.successDateTime, 'date:300')
assert.equal(result.orderPatch.pay2Time, 'date:300')
assert.equal(result.orderPatch.outTradeNo, 'out-1,out-2')
assert.equal(result.orderPatch.transactionNo, 'trade-1,trade-2')
})
})
import assert from 'node:assert/strict'
import { describe, it } from 'node:test'
import {
normalizeSimplePaymentDocuments,
shouldRequestSimplePaymentDocuments,
validateSimpleQuotationSubmission
} from '../pages/carQuotation/services/simpleQuotationValidation.helpers.js'
const goods = item => [{ goodsFlag: 1, goods: { merchantGoodsId: 'g-1', ...item } }]
describe('simpleQuotationValidation.helpers', () => {
it('IT-EQ-SIMPLE-VALID-001: returns the first existing submit message in business order', () => {
assert.equal(
validateSimpleQuotationSubmission({ vdQuotationGoodsList: [] }).message,
'请选择增值车损险商品'
)
assert.equal(
validateSimpleQuotationSubmission({
vdQuotationGoodsList: goods({}),
payType: 2,
resetOrder: false
}).message,
'请选择4S店收款时间'
)
assert.equal(
validateSimpleQuotationSubmission({
vdQuotationGoodsList: goods({}),
payType: 7,
pay2Time: '2026-09-08',
notes: '',
resetOrder: false
}).message,
'备注不能为空'
)
})
it('IT-EQ-SIMPLE-VALID-002: accepts an explicit zero discount and rejects missing strategy values', () => {
assert.equal(
validateSimpleQuotationSubmission({
vdQuotationGoodsList: goods({ discountType: 1, discountValue: 0 }),
orderType: 2,
payType: 1,
total: '1.00'
}).ok,
true
)
assert.equal(
validateSimpleQuotationSubmission({
vdQuotationGoodsList: goods({ discountType: 1, discountValue: '' }),
orderType: 2,
payType: 1,
total: '1.00'
}).message,
'商品折扣值不能为空'
)
})
it('IT-EQ-SIMPLE-VALID-003: preserves buy-gift and combined-payment strategy rules', () => {
assert.equal(
validateSimpleQuotationSubmission({
vdQuotationGoodsList: goods({ discountType: 4 }),
orderType: 3,
payType: 1,
total: '1.00'
}).message,
'买赠策略至少需要选择两个商品'
)
assert.equal(
validateSimpleQuotationSubmission({
vdQuotationGoodsList: [
...goods({ merchantGoodsId: 'g-1', discountType: 0 }),
...goods({ merchantGoodsId: 'g-2', discountType: 0 })
],
orderType: 3,
payType: 1,
total: '1.00'
}).message,
'买赠策略需要至少有一个商品是赠品'
)
assert.equal(
validateSimpleQuotationSubmission({
vdQuotationGoodsList: goods({ discountType: 0 }),
orderType: 5,
payType: 1,
total: '1.00'
}).message,
'组合付款需要至少有一个商品选择折扣'
)
})
it('IT-EQ-SIMPLE-VALID-004: keeps amount validation and payment-document decisions deterministic', () => {
assert.equal(
validateSimpleQuotationSubmission({
vdQuotationGoodsList: goods({}),
orderType: 1,
payType: 1,
total: '0'
}).message,
'订单总价最低不能小于0.01元'
)
assert.equal(
shouldRequestSimplePaymentDocuments({
payType: 6,
resetOrder: false,
transactionNo: '',
paymentDocList: []
}),
true
)
assert.equal(
shouldRequestSimplePaymentDocuments({
payType: 6,
resetOrder: true,
transactionNo: '',
paymentDocList: []
}),
false
)
})
it('IT-EQ-SIMPLE-VALID-005: normalizes popup strings and detail documents without mutating either input', () => {
const documents = [
'https://example.test/new.png',
{ paymentDocUrl: 'https://example.test/echo.png', type: 2 }
]
const snapshot = structuredClone(documents)
assert.deepEqual(normalizeSimplePaymentDocuments(documents), [
{ paymentDocUrl: 'https://example.test/new.png', type: 1 },
{ paymentDocUrl: 'https://example.test/echo.png', type: 1 }
])
assert.deepEqual(documents, snapshot)
})
})
// packageEquity/pages/aiCheck/chat/chat.js // packageEquity/pages/aiCheck/chat/chat.js
import carLifeApi from "../../../carEquityApi"; import carLifeApi from '../../../services/carLifeApi.js'
import api from '~/api/api.js' import api from '~/api/api.js'
import { AI_ROUTES } from '~/router/routeAliases.js'
const VOICE = { const VOICE = {
1: "zhifeng_emo", 1: "zhifeng_emo",
2: "stanley", 2: "stanley",
...@@ -11,7 +12,7 @@ const VOICE = { ...@@ -11,7 +12,7 @@ const VOICE = {
}; };
let timer = null; let timer = null;
let duration = 0; let duration = 0;
import aiApi from "../../../aiApi"; import aiApi from '../../../services/aiApi.js'
const linkChainList = [{ const linkChainList = [{
id: 1, id: 1,
name: "接待", name: "接待",
...@@ -396,14 +397,14 @@ Page({ ...@@ -396,14 +397,14 @@ Page({
title: "订阅成功", title: "订阅成功",
icon: "none", icon: "none",
}); });
wx.redirectTo({ wx.$router.redirectTo(
url: `/packageEquity/pages/aiCheck/result/result?roleType=${roleType}&id=${id}&entry=${entry}`, `${AI_ROUTES.aiCheckResult}?roleType=${roleType}&id=${id}&entry=${entry}`
}); )
}, },
fail(res) { fail(res) {
wx.redirectTo({ wx.$router.redirectTo(
url: `/packageEquity/pages/aiCheck/result/result?roleType=${roleType}&id=${id}&entry=${entry}`, `${AI_ROUTES.aiCheckResult}?roleType=${roleType}&id=${id}&entry=${entry}`
}); )
} }
}); });
}); });
......
...@@ -3,14 +3,14 @@ const { ...@@ -3,14 +3,14 @@ const {
ALIYUN, ALIYUN,
bytedanceConfig bytedanceConfig
} = require("~/config") } = require("~/config")
const getToken = require("~/packageEquity/utils/aliyun/token").getToken const getToken = require('~/packageEquityAI/utils/aliyun/token').getToken
const SpeechSynthesizer = require("~/packageEquity/utils/aliyun/tts") const SpeechSynthesizer = require('~/packageEquityAI/utils/aliyun/tts')
const sleep = require("~/packageEquity/utils/aliyun/util").sleep const sleep = require('~/packageEquityAI/utils/aliyun/util').sleep
const formatTime = require("~/packageEquity/utils/aliyun/util").formatTime const formatTime = require('~/packageEquityAI/utils/aliyun/util').formatTime
const fs = wx.getFileSystemManager() const fs = wx.getFileSystemManager()
import getSignature from '../../upload/signature' import getSignature from '../../upload/signature'
import uploadFile from '../../upload/uploadFile' import uploadFile from '../../upload/uploadFile'
import aiApi from "../../../../aiApi"; import aiApi from '../../../../services/aiApi.js'
import { import {
speechEmoji, speechEmoji,
soundEmoji, soundEmoji,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!