Files
zkxw/docs/superpowers/plans/2026-10-09-protocol-preferential-price-payment.md
T
zlwuandCursor db31990ebe feat: 细胞存储缴费催缴、统一样本信息与协议支付能力增强
汇总近期业务改动:催缴菜单与后端、样本信息快捷登记与进度、运费关联、客户档案扩展、协议优惠/期次与押金划转,并同步 SQL 迁移与管理端页面收敛。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-10 21:20:37 +08:00

62 lines
2.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 优惠价驱动缴费金额 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: 工具函数与单测(去价目、分期必填)
- [x] 改写 `resolveSampleContractAmount`:仅优惠价,无则 `null`(不再回落 22880)
- [x] 删除或掏空 `resolvePerSamplePreset` 硬编码
- [x] 新增 `sampleScheduleRequiredFieldsHint(pay)`:分期每期金额与 dueDate
- [x] 更新 `protocol-sample-payment.test.ts`;`node --import tsx --test` 通过
### Task 2: SamplePaymentPanel
- [x] `emptyDjPayment` / 改价同步:合同 = 优惠价
- [x] 打开编辑:不强制用优惠价覆盖库内合同(仅改价 force)
- [x] 切分期:`dueAmount` 留空;dueDate 仍按公式
- [x] 去掉对 `resolvePerSamplePreset` / 默认分期金额模板的依赖
### Task 3: ProtocolFormDialog
- [x] 删除/停用 `applyPaymentPresetForMode`、样本数 watch 套价目、`resolvePaymentPreset` 引用
- [x] v2 保存前调用分期必填校验
- [x] 协议总金额跟随逻辑保持「默认同步可手改」
### Task 4: protocol-payment-presets 清理
- [x] 删除 `PRESETS` 与 `resolvePaymentPreset`;修复所有引用点
### Task 5: 后端校验
- [x] schedule validate:非 void 期 `due_amount` 与 `due_date` 必填
- [x] pytest 覆盖
### Task 6: 验证与图谱
- [x] 前端单测 + 后端相关 pytest
- [x] `./scripts/update-graph.sh frontend`(若改后端则 `all`)