Files
quyun-v2/docs/plans/2026-02-04.md
2026-02-04 14:58:35 +08:00

70 lines
3.3 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: Portal Payment Page Hardening
**Branch**: `main` | **Date**: 2026-02-04 | **Spec**: `docs/seed_verification.md`
**Input**: 前端支付页仍含 DEV 模拟逻辑,支付错误提示/加载与轮询节流不足,金额/商品信息展示不完整。
## Summary
清理支付页 DEV 模拟逻辑,增强支付失败与加载态提示,补全金额/商品信息展示,并对状态轮询做节流,确保真实支付链路稳定可用。
## Technical Context
**Language/Version**: Vue 3 (Vite)
**Primary Dependencies**: Pinia, Vue Router, PrimeVue
**Storage**: PostgreSQL后端服务已就绪
**Testing**: 前端页面流验证;后端 `go test ./...`(规则要求前端改动需二者并行)
**Target Platform**: local/staging
**Project Type**: Web application
**Performance Goals**: 减少轮询负载,提升用户反馈
**Constraints**: 遵循 `backend/llm.txt`、前端接口涉及需跑页面流 + go test不手改生成文件
**Scale/Scope**: 仅 Portal 支付页PaymentView.vue及相关 API/状态展示
## Constitution Check
- 所有前端接口相关改动需完成页面流验证和后端 `go test ./...` 方可归档。
- 禁止保留 DEV-only 模拟逻辑于生产代码。
## Project Structure
- `frontend/portal/src/views/order/PaymentView.vue`
- `frontend/portal/src/api/order.js`(若需补充错误/数据处理)
- `frontend/portal/src/utils/request.js`(如需请求拦截/错误提示,视需要)
**Structure Decision**: 仅修改支付页与关联 API避免全局侵入。
## Plan Phases
- Phase 1: 行为清理 —— 移除/隔离 DEV 模拟支付逻辑,确保真实 pay 调用。
- Phase 2: 体验增强 —— 添加支付中/loading/错误提示;补全金额、商品标题展示;轮询节流与完成后停止。
- Phase 3: 验证 —— 前端页面流支付冒烟 + 后端 `go test ./...`
## Tasks
- [x] T101 移除或显式守护 DEV 模拟支付按钮(生产隐藏/剔除),确保真实 pay 请求。
- [x] T102 支付提交/轮询的加载与错误提示:提交中禁用按钮,失败 toast/提示,并在错误时停止 loading。
- [x] T103 订单金额/商品信息展示:优先用 status 返回的 `amount_paid/amount_original``content_title`,保持 0 元也可显示。
- [x] T104 轮询节流与完成停止:调整轮询间隔/次数,支付成功即停止,避免过度请求。
- [x] T201 前端页面流验证支付登录→Checkout→Pay→Status paid
- [x] T202 后端回归测试 `go test ./...`(与 T201 同时满足)。
## Dependencies
- T101 完成后执行 T102~T104。
- T104 完成后执行 T201T201/T202 完成后归档。
## Acceptance Criteria
- 支付页无 DEV-only 模拟逻辑暴露;“立即支付”触发真实 `/pay`,状态能更新为 `paid`
- 支付/轮询有明显 loading/错误反馈;轮询成功后自动停;按钮在提交中禁用。
- 金额与商品标题在支付页正确显示(含 0 元订单)。
- 前端页面流验证通过(登录→下单→支付→订单状态 paid后端 `go test ./...` 通过。
## Risks
- 轮询过度或停止条件遗漏导致请求风暴;通过节流与成功后清理计时器规避。
- 错误提示未覆盖网络异常;需在提交与轮询 catch 中统一处理。
## Complexity Tracking
暂无。