汇总近期业务改动:催缴菜单与后端、样本信息快捷登记与进度、运费关联、客户档案扩展、协议优惠/期次与押金划转,并同步 SQL 迁移与管理端页面收敛。 Co-authored-by: Cursor <cursoragent@cursor.com>
2.9 KiB
2.9 KiB
优惠价驱动缴费金额 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: 废除采集协议单价目表默认金额;样本合同/合计/协议总默认均由优惠价驱动;分期金额手填且保存强校验。
Architecture: 纯函数在 protocol-sample-payment.ts 解析优惠价与校验;SamplePaymentPanel 生成空金额期次;ProtocolFormDialog 去掉 resolvePaymentPreset 套用;后端 schedule 校验补齐每期金额与应缴日必填。
Tech Stack: Vue 3 + TypeScript(web-admin)、FastAPI(backend)、node:test / pytest
Design spec: docs/superpowers/specs/2026-10-09-protocol-preferential-price-payment-design.md
File map
| File | Responsibility |
|---|---|
web-admin/src/utils/protocol-sample-payment.ts |
优惠价解析、合计、分期必填校验文案;删除硬编码 preset |
web-admin/src/utils/protocol-sample-payment.test.ts |
单测 |
web-admin/src/utils/protocol-payment-presets.ts |
删除 PRESETS / resolvePaymentPreset |
web-admin/src/views/cell-storage/protocol/SamplePaymentPanel.vue |
新建/改价/分期空金额 |
web-admin/src/views/cell-storage/protocol/ProtocolFormDialog.vue |
去掉价目套用;保存调新校验 |
backend/app/services/sample_payment_schedule_validate.py |
各期金额+应缴日必填 |
backend/tests/test_sample_payment_schedule_validate.py |
后端单测 |
Task 1: 工具函数与单测(去价目、分期必填)
- 改写
resolveSampleContractAmount:仅优惠价,无则null(不再回落 22880) - 删除或掏空
resolvePerSamplePreset硬编码 - 新增
sampleScheduleRequiredFieldsHint(pay):分期每期金额与 dueDate - 更新
protocol-sample-payment.test.ts;node --import tsx --test通过
Task 2: SamplePaymentPanel
emptyDjPayment/ 改价同步:合同 = 优惠价- 打开编辑:不强制用优惠价覆盖库内合同(仅改价 force)
- 切分期:
dueAmount留空;dueDate 仍按公式 - 去掉对
resolvePerSamplePreset/ 默认分期金额模板的依赖
Task 3: ProtocolFormDialog
- 删除/停用
applyPaymentPresetForMode、样本数 watch 套价目、resolvePaymentPreset引用 - v2 保存前调用分期必填校验
- 协议总金额跟随逻辑保持「默认同步可手改」
Task 4: protocol-payment-presets 清理
- 删除
PRESETS与resolvePaymentPreset;修复所有引用点
Task 5: 后端校验
- schedule validate:非 void 期
due_amount与due_date必填 - pytest 覆盖
Task 6: 验证与图谱
- 前端单测 + 后端相关 pytest
./scripts/update-graph.sh frontend(若改后端则all)