createOrderCarQuotation.md 3.77 KB

createOrderCarQuotation 权益报价专章(标准模式)

路径:packageEquity/pages/carQuotation/createOrderCarQuotation

总览对比见 order-creation/README.md
mode !== 0 门店走 createOrderCarQuotationSimple(本专章不覆盖 Simple 业务,仅作对照)。


1. 业务定位

车损权益升级报价:收集车主与保险信息 → 选择权益 SKU → 后端计价 → 生成告知书 → 支付。

路由分支(全库多处):

merchant.mode ? 'createOrderCarQuotationSimple' : 'createOrderCarQuotation'

2. 入口与 onRoute

来源 参数
equityPage / beforeCreate 新建
carQuotation/index paymentMethod、草稿
关联支付 outTradeNo、totalFee
编辑 id
改价回跳 id + modifyEquityQuotation

onLoad / onShow 为空;数据在 onRoute 与 Step 组件 attached 中加载。


3. 步骤与组件

flowchart LR
  F[FirstStep mode=0] --> S[SecondStep]
  S --> API[quotationAdd/update]
  API --> SC[schemeConfirmation]
  SC --> Pay[CarQuotationPay]
组件 职责
FirstStep 场景、员工、车主表单
SecondStep 保险块 + 权益单选 + priceCounter
VinSecDialog OCR 后 VIN 二次确认

组件通过 wx.$router.getPageInstance() 调用页面 getInsurance() / getOwnerInfo()。


4. 保险与权益数据

orderInfo 表单块 → 提交时 flatten 为 insureList:

type 表单字段
0 business 商业险
1 mutualStrength 交强险
2 vehiclesAndVessels 车船税
3 valueAddedVehicleLoss 增值车损
4 otherInsuranceList[] 其他

金额字段在 quotationMoney.helpers.js 中 ×100 / ÷100(needChangeList)。

组装逻辑:quotationPayload.helpers.js — buildInsurancePayload、buildOwnerPayload、parseInsureListToForm。


5. 商品与计价

  • getQuotationInfo → listByMerchantIdAndIds → mapQuotationGoodsList
  • 关联支付单:outTradeNo 时 isSeletct = shopMinPrice×100 >= totalFee
  • 用户选权益 → SecondStep.onChangeInsurance → priceCounter → 写 quotedPriceUpdate

6. 提交与后续

操作 方法 API
第二步确认 handleSecondConfirmCheck(true) quotationAdd / updateQuotation
存草稿 handleEditSave 同上 check:false
改价 updateEquityPrice quotationPicture

成功 → schemeConfirmation → quotationUpgrade → CarQuotationPay。


7. 已知缺口

项 说明
setCustomerInfo / resetGoods Simple 页有实现,标准页未定义(FirstStep 可能调用失败)
隐私协议 WXML 绑定 agreeClick 页面未实现
与 createOrder 无共享业务模块;仅 VIN、分元转换模式类似

8. 测试与回归

命令:

  • npm run test:quotation — 报价 helper + ruleFn(16 用例)
  • npm run test:equity — 全权益分包测试

手动回归: 见 order-creation/README.md MR-EQ-* 表。

改前检索: createOrderCarQuotation 字符串;FirstStep/SecondStep 是否共用改动。