feat: 退款企微审批详情与业务处理状态
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 7m2s

This commit is contained in:
luo
2026-07-24 16:30:58 +08:00
parent 9a84cd0d31
commit 4c6d871c35
10 changed files with 552 additions and 620 deletions

View File

@@ -0,0 +1,89 @@
## ADDED Requirements
### Requirement: Refund Creation Submits WeCom Approval Materials
The refund creation flow SHALL submit the refund business materials required for an external WeCom approval.
#### Scenario: Create refund with business materials
- **GIVEN** 用户打开退款创建表单
- **WHEN** 用户填写退款金额、退款原因、备注并完成附件上传
- **THEN** 系统 MUST submit the refund amount, reason, remark and attachment metadata to `POST /api/admin/refunds`
- **AND** 每个附件 MUST use the structure `{ file_key, file_name, file_size }`
#### Scenario: Submitted amount is immutable locally
- **GIVEN** 退款申请已创建并进入企微审批
- **WHEN** 用户查看退款记录
- **THEN** 页面 MUST NOT provide a local control to modify the submitted refund amount
- **AND** any changed amount MUST be submitted through the defined resubmission flow only
### Requirement: Refund Detail Displays WeCom Approval
The refund detail page SHALL display the backend-provided WeCom approval object as a read-only approval record.
#### Scenario: Display approval details
- **GIVEN** `GET /api/admin/refunds/{id}` returns an `approval` object
- **WHEN** 用户打开退款详情
- **THEN** 页面 MUST display the approval source, `sp_no`, status, status name, applicant, approvers, comments, attachments and timeline
- **AND** 页面 MUST preserve the backend approval values without locally changing or deriving them
#### Scenario: No local approval controls
- **GIVEN** 用户查看退款列表或退款详情
- **WHEN** 页面展示企微审批信息
- **THEN** 页面 MUST NOT display local approve, reject, return or manual refund confirmation buttons
- **AND** 页面 MUST NOT call local approval action endpoints for this flow
### Requirement: Refund Processing Result Is Independent From Approval
The refund detail page SHALL display business processing status separately from WeCom approval status.
#### Scenario: Display processing result
- **GIVEN** 退款详情返回 `processing_status` and its result fields
- **WHEN** 用户查看退款业务处理区域
- **THEN** 页面 MUST display the processing status, failure summary and business process result
- **AND** 页面 MUST display a system-retrying or contact-administrator message when indicated by the backend
#### Scenario: Display required lifecycle states
- **GIVEN** 后端返回审批中、通过处理中、处理成功、驳回、撤销或通过后撤销异常状态
- **WHEN** 页面渲染退款列表或详情
- **THEN** 页面 MUST show an explicit status for the returned state
- **AND** 页面 MUST NOT infer processing completion from approval status alone
### Requirement: Refund Resubmission Has Restricted Editable Fields
The refund resubmission flow SHALL allow resubmission only for rejected, revoked or deleted records and SHALL preserve immutable business snapshots.
#### Scenario: Resubmit an eligible refund
- **GIVEN** 退款状态为已驳回、已撤销或已删除
- **WHEN** 用户发起重新申请
- **THEN** 页面 MUST allow editing the refund amount, attachments and refund reason
- **AND** 系统 MUST submit the request to `POST /api/admin/refunds/{id}/resubmit`
#### Scenario: Reject resubmission for an ineligible refund
- **GIVEN** 退款记录不属于已驳回、已撤销或已删除状态
- **WHEN** 用户查看退款详情
- **THEN** 页面 MUST NOT enable the resubmission action
- **AND** 页面 MUST handle a backend rejection without creating a new approval request
#### Scenario: Preserve refund snapshots on resubmission
- **GIVEN** 用户填写重新申请表单
- **WHEN** 用户修改可编辑字段
- **THEN** 页面 MUST NOT provide controls to change the order snapshot, asset snapshot or submitter snapshot
### Requirement: Refund Pages Use Backend Approval And Processing Data
The refund list and detail pages SHALL use backend response data as the source of truth for approval and processing display.
#### Scenario: Refresh refund status
- **WHEN** 用户刷新退款列表或重新加载退款详情
- **THEN** 页面 MUST use the latest refund, approval and processing data returned by the backend
- **AND** 页面 MUST NOT reconstruct a status from stale local form data or legacy status mappings