Compare commits
42 Commits
9f7f619083
...
iteration/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2308d82d0f | ||
|
|
d3d257cdf8 | ||
|
|
ef966171b4 | ||
|
|
65cc63674e | ||
|
|
01cddd7eda | ||
|
|
a7b006076a | ||
|
|
c36c59e268 | ||
|
|
e56951d4b7 | ||
|
|
b5c58d695f | ||
|
|
6f6ac83b71 | ||
|
|
48e4adf3ff | ||
|
|
d335984c20 | ||
|
|
89e6d19d1f | ||
|
|
889ff3bc28 | ||
|
|
d8191f03a0 | ||
|
|
4d023e7666 | ||
|
|
fe357f56d9 | ||
|
|
2cb961fd1b | ||
|
|
4e3ea6c6d6 | ||
|
|
2d6948010b | ||
|
|
95abcb97ef | ||
|
|
d9d07422a9 | ||
|
|
93f67967c5 | ||
|
|
857d565f33 | ||
|
|
9a982e0446 | ||
|
|
737ade3a5e | ||
|
|
0d2a982f69 | ||
|
|
3dd17e9d7b | ||
|
|
ca748999ec | ||
|
|
e86f61f3f6 | ||
|
|
10ee87bf49 | ||
|
|
32635da58c | ||
|
|
8627d203cf | ||
|
|
41f3b61b62 | ||
|
|
33485b137f | ||
|
|
9599a4d52b | ||
|
|
8650b490d7 | ||
|
|
373ad4c2a5 | ||
|
|
3a819e86c9 | ||
|
|
e9c0e17d6a | ||
|
|
db7b3562da | ||
|
|
f52970ae6c |
@@ -3,7 +3,7 @@ name: 构建并部署前端到测试环境
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
- main
|
||||
- dev
|
||||
- test
|
||||
|
||||
@@ -27,7 +27,7 @@ jobs:
|
||||
- name: 设置镜像标签
|
||||
id: tag
|
||||
run: |
|
||||
if [ "${{ github.ref }}" = "refs/heads/develop" ]; then
|
||||
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
|
||||
echo "tag=latest" >> $GITHUB_OUTPUT
|
||||
elif [ "${{ github.ref }}" = "refs/heads/dev" ]; then
|
||||
echo "tag=dev" >> $GITHUB_OUTPUT
|
||||
@@ -51,8 +51,8 @@ jobs:
|
||||
docker push ${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }}
|
||||
docker push ${{ env.IMAGE_NAME }}:${{ github.sha }}
|
||||
|
||||
- name: 部署到本地(仅 develop 分支)
|
||||
if: github.ref == 'refs/heads/develop'
|
||||
- name: 部署到本地(仅 main 分支)
|
||||
if: github.ref == 'refs/heads/main'
|
||||
run: |
|
||||
# 确保部署目录存在
|
||||
mkdir -p ${{ env.DEPLOY_DIR }}
|
||||
|
||||
88
openspec/changes/add-employee-collection/design.md
Normal file
88
openspec/changes/add-employee-collection/design.md
Normal file
@@ -0,0 +1,88 @@
|
||||
## Context
|
||||
|
||||
员工代收款是 8 月迭代新增的财务能力,普通员工与超级管理员共用同一套接口,靠登录态区分数据范围。后台管理端需要新增三类页面,并复用已有的表格、搜索、详情与上传组件。`docs/admin-openapi.yaml` 未随仓库提供,接口字段以后端契约(需求文档 + 创建订单接口 OpenAPI 片段)为准,类型集中在一个文件便于联调收敛。
|
||||
|
||||
## Goals / Non-Goals
|
||||
|
||||
**Goals**
|
||||
|
||||
- 在财务管理下提供收款方式、员工代收款账单、核销申请三类页面。
|
||||
- 复用 `ArtTableFullScreen`、`ArtSearchBar`、`ArtTableHeader`、`ArtTable`、`DetailPage`、`VoucherUpload`、`PaymentVoucherDialog`、`useCheckedColumns` 等既有组件与约定。
|
||||
- 复用既有企微审批场景配置能力,仅新增业务类型。
|
||||
|
||||
**Non-Goals**
|
||||
|
||||
- 不实现后端接口、数据库、Worker、企微回调。
|
||||
- 不实现 H5/C 端页面与支付流程。
|
||||
- 不新增导出任务场景(需求文档未要求)。
|
||||
|
||||
## Decisions
|
||||
|
||||
### 接口契约
|
||||
|
||||
| 能力 | 关键字段 |
|
||||
|---|---|
|
||||
| 统一响应 | `{ code, data, msg, timestamp }` |
|
||||
| 列表分页 | 账单列表返回 `{ items, total, page, size }`,取数处对 `items` / `list` / `records` 做兼容 |
|
||||
| 收款方式 | `{ id, code, name, sort, enabled, remark, created_at, updated_at }`,列表接口返回 `{ items, page, size, total }`,支持 `page` / `page_size` / `enabled` / `keyword` 筛选 |
|
||||
| 账单列表项 | `{ id, source_type, source_type_name, source_no, debtor_snapshot, customer_snapshot, receivable_amount, received_amount, reserved_amount, remaining_amount, status, status_name, approval_pending, closed_reason, created_at, updated_at }` |
|
||||
| 账单详情 | `data` 为 `{ bill, refunds, allocations, applications }`;`refunds` 为退款冲销(`refund_id`、`source_order_id`、`refund_amount`、`reduced_amount`、`bill_receivable_amount`、`outcome_name`),`allocations` 为账单侧分摊(含 `application_id` / `application_status_name` / `attempt_id`),`applications` 内嵌该申请的 `attempts` |
|
||||
| 账单统计 | `{ receivable_total, received_total, unsettled_total, pending_bill_count }` |
|
||||
| 账单筛选 | `page`、`page_size`、`source_type`、`source_no`、`status`、`debtor_account_id`、`customer_id`、`created_from`(`YYYY-MM-DD`)、`created_to`(`YYYY-MM-DD`) |
|
||||
| 核销申请请求体 | `{ payment_method_id, paid_amount, paid_at, payer_name, external_transaction_no, payment_voucher_keys, remark, allocations: [{ bill_id, amount }], acting_reason }` |
|
||||
| 核销申请列表项 | `{ id, applicant_account_id, acting_operator_id, payment_method_id, payment_method_name, paid_amount, payer_name, external_transaction_no, status, status_name, terminal_reason, decided_at, created_at, updated_at }` |
|
||||
| 核销申请详情 | `data` 为 `{ application, allocations, attempts }`,`attempts` 保存每次提交的完整材料快照,重新提交不清空历史 |
|
||||
|
||||
账单状态为数字枚举 `0` 待核销 / `1` 部分核销 / `2` 已核销 / `3` 已关闭;申请状态为数字枚举 `0` 审批中 / `1` 已通过 / `2` 已驳回 / `3` 已撤销或已关闭;两者展示均优先使用后端 `status_name`。
|
||||
|
||||
### 页面与路由组织
|
||||
|
||||
在 `/finance` 下新增:
|
||||
|
||||
| 路由 | 页面 | 说明 |
|
||||
|---|---|---|
|
||||
| `/finance/employee-collection/bills` | 员工代收款账单 | 统计 + 列表 |
|
||||
| `/finance/employee-collection/bills/detail/:id` | 账单详情 | 隐藏菜单 |
|
||||
| `/finance/employee-collection/applications` | 核销申请 | 列表 + 创建 |
|
||||
| `/finance/employee-collection/applications/detail/:id` | 核销申请详情 | 隐藏菜单 |
|
||||
| `/finance/employee-collection/payment-methods` | 收款方式管理 | 仅超管 |
|
||||
|
||||
账单与申请拆分为独立菜单,符合项目「列表页 + 详情页」的既有组织方式,避免单页堆叠过多交互。账单列表的「店铺」筛选用远程搜索复用 `ShopService.getShops`,与退款列表一致。
|
||||
|
||||
账单详情与核销申请详情保持只读:页面只在顶部保留「返回」导航,创建核销申请、关闭账单、修改并重新提交等操作入口统一放在列表页的操作列,详情页不出现业务操作按钮。
|
||||
|
||||
### 权限编码
|
||||
|
||||
新增 `src/config/constants/augustIteration.ts`,沿用 `模块:动作` 风格,例如 `employee_collection:bill_close`、`employee_collection:application_create`。页面级 `permissions` 用于菜单可见性,按钮级编码用于 `hasAuth()` / `v-permission`。
|
||||
|
||||
### 金额、时间与附件
|
||||
|
||||
- 金额统一以「分」传输,展示时通过 `fenToYuan` / `formatCurrency` 转换,与退款、代理充值保持一致。
|
||||
- 所有时间字段统一通过 `formatDateTime` 格式化为 `YYYY-MM-DD HH:mm:ss`,不在模板中直接输出后端原始时间字符串。
|
||||
- 附件仅返回对象 Key(`payment_voucher_keys`),展示复用 `PaymentVoucherDialog`,由预签名下载接口换取访问地址。
|
||||
|
||||
### 核销申请分摊
|
||||
|
||||
创建申请时按账单逐条录入核销金额,并填写付款事实(付款金额、付款方名称、付款时间、外部交易流水号),前端校验:
|
||||
|
||||
- 至少选择 1 张账单,最多 N 张;
|
||||
- 单张核销金额不得大于账单未核销金额,且大于 0;
|
||||
- 付款金额(`paid_amount`,分)不得小于各账单分摊之和(允许存在差额);
|
||||
- 超管代办时 `acting_reason` 必填;
|
||||
- 付款凭证至少 1 个 Key。
|
||||
|
||||
提交成功后自动发起企微审批;仅已驳回申请可再次进入弹窗修改并重新提交,重新提交生成新的审批实例,历史审批记录只读展示。未配置企微审批场景时后端返回 503,前端展示「企微审批场景未配置,请联系管理员」并保留已填内容。
|
||||
|
||||
### 企微审批场景
|
||||
|
||||
`WecomBusinessType` 增加 `employee_collection_approval`,企微审批场景页面下拉新增「员工代收款审批」。模板控件同步、字段查询、字段映射保存全部复用既有 `WecomService`。
|
||||
|
||||
### 订单付款凭证规则
|
||||
|
||||
线下订单创建时,满足「平台账号(`user_type` 为 1 或 2)操作 + 非赠送套餐 + 实际收款金额大于 0」条件的订单会生成员工代收款账单,此时 `payment_voucher_key` 非必填,字段结构不变,付款凭证改在核销申请中提交。前端以当前登录账号类型、所选套餐是否赠送、套餐有效价格(`effective_retail_price` / `suggested_retail_price` / `retail_price`)判断是否展示提示并放宽必填;赠送套餐或其他非平台账号的线下订单仍需上传凭证。
|
||||
|
||||
## Risks / Trade-offs
|
||||
|
||||
- **接口字段以契约文档为准**:`docs/admin-openapi.yaml` 未入库,字段来自需求文档与创建订单接口片段;类型集中在一个文件,便于联调时收敛修改。
|
||||
- **员工/超管同接口**:前端不做数据范围过滤,仅做展示与操作可见性控制,数据隔离以后端为准。
|
||||
- **关闭账单与审批中申请**:前端依据 `approval_pending` 与状态字段禁用关闭按钮,最终一致性以后端校验为准。
|
||||
25
openspec/changes/add-employee-collection/proposal.md
Normal file
25
openspec/changes/add-employee-collection/proposal.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Change: 员工代收款功能前端对接
|
||||
|
||||
## Why
|
||||
|
||||
8 月产品迭代新增「员工代收款」能力:员工线下代收款项后,通过创建核销申请、经企业微信审批完成账单核销;超级管理员可维护收款方式、查看全部账单并关闭账单。后端接口已按 `docs/产品迭代8月份/员工代收款功能简介.md` 落地,后台管理端目前缺少收款方式管理、账单列表与核销申请页面,普通员工与超级管理员的分类视图、以及线下订单付款凭证规则尚未接入。
|
||||
|
||||
本次已按后端实际契约对齐字段:列表响应统一使用 `items` / `total` / `page` / `size`;账单状态(`0` 待核销 / `1` 部分核销 / `2` 已核销 / `3` 已关闭)与申请状态(`0` 审批中 / `1` 已通过 / `2` 已驳回 / `3` 已撤销或已关闭)为数字枚举;收款方式列表返回 `{ items, page, size, total }` 并支持 `enabled` / `keyword` 筛选;核销申请请求体使用 `paid_amount`、`paid_at`、`payer_name`、`external_transaction_no`、`payment_voucher_keys` 与 `allocations`。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 新增 `employee-collection` 能力的前端类型与服务封装:收款方式 4 个接口、员工代收款账单 4 个接口、核销申请 4 个接口。
|
||||
- 新增「收款方式管理」页面(仅超级管理员):列表 + 新增/编辑弹窗 + 删除;已被核销申请引用的方式不可删除、不可修改 `code`(未被引用时可改),可停用。
|
||||
- 新增「员工代收款账单」页面:应收/已核销/未核销/待处理账单统计 + 列表 + 详情;普通员工仅见本人账单,超级管理员可见全部;存在审批中申请时账单不可关闭,关闭必须填写原因。
|
||||
- 新增「核销申请」页面:列表 + 详情(含分摊账单、付款凭证、付款信息与全部审批尝试记录)+ 创建/重新提交弹窗;一笔线下收款可核销 1~N 张账单,填写付款金额、付款方名称、付款时间、外部交易流水号、选择收款方式并上传付款凭证;提交后自动发起企微审批;仅已驳回申请可修改并重新提交,重新提交生成新的审批实例且历史记录不被覆盖。
|
||||
- 扩展企业微信审批场景:新增 `employee_collection_approval` 业务类型,复用既有企微应用列表、模板控件同步与业务字段查询接口。
|
||||
- 调整订单创建:由平台账号操作、实际收款金额大于 0 且非赠送的线下订单会生成员工代收款账单,该场景 `payment_voucher_key` 改为非必填,付款凭证改在核销申请中提交,字段结构保持不变。
|
||||
- 附件接口仅返回对象 Key,统一通过系统既有预签名下载接口展示。
|
||||
- **不实现后端接口、数据库、Worker、企微回调**;**不实现 H5/C 端页面**。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: `employee-collection`
|
||||
- Affected code: `src/types/api/employeeCollection.ts`、`src/api/modules/employeeCollection.ts`、`src/views/finance/employee-collection/*`、`src/router/routes/asyncRoutes.ts`、`src/router/routesAlias.ts`、`src/config/constants/augustIteration.ts`、`src/types/api/wecom.ts`、`src/views/settings/wecom/scenes/index.vue`、`src/views/order-management/order-list/index.vue`、`src/locales/langs/{zh,en}.json`
|
||||
- Dependencies: `docs/产品迭代8月份/员工代收款功能简介.md`
|
||||
- Contract note: `docs/admin-openapi.yaml` 未随仓库提供,字段以需求文档描述的后端契约与创建订单接口的 OpenAPI 片段为准;类型集中在单一文件,联调时便于收敛。
|
||||
@@ -0,0 +1,155 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: 收款方式管理
|
||||
超级管理员 MUST 能够维护线下收款方式,包括名称、编码、排序、状态与备注;普通员工只能看到启用的收款方式。收款方式列表接口 MUST 返回 `{ items, page, size, total }`,并 MUST 支持 `enabled` 与 `keyword` 筛选。已被核销申请引用的收款方式 MUST NOT 被删除;引用后修改稳定编码 MUST 被后端拒绝,前端 MUST 展示错误提示。
|
||||
|
||||
#### Scenario: 超级管理员新增收款方式
|
||||
- **GIVEN** 超级管理员已登录并拥有收款方式新增权限
|
||||
- **WHEN** 其填写名称、唯一编码、排序、状态与备注并提交
|
||||
- **THEN** 系统 MUST 调用新增接口并在成功后刷新列表
|
||||
- **AND** 新增成功后 MUST 清空并关闭弹窗
|
||||
|
||||
#### Scenario: 删除被引用的收款方式
|
||||
- **GIVEN** 某收款方式已被业务引用
|
||||
- **WHEN** 超级管理员尝试删除该方式
|
||||
- **THEN** 前端 MUST 阻止删除或展示后端返回的业务错误
|
||||
- **AND** MUST 提示改为停用
|
||||
|
||||
#### Scenario: 修改收款方式编码
|
||||
- **GIVEN** 超级管理员打开编辑弹窗
|
||||
- **WHEN** 其修改稳定编码并提交
|
||||
- **THEN** 前端 MUST 提交最新编码
|
||||
- **AND** 若该方式已被核销申请引用,后端拒绝时前端 MUST 展示错误提示
|
||||
|
||||
### Requirement: 员工代收款账单统计
|
||||
账单页面 MUST 展示应收金额、已核销金额、未核销金额与待处理账单数量四项统计,数据 MUST 来自 `GET /api/admin/employee-collection-bills/statistics`,字段为 `receivable_total`、`received_total`、`unsettled_total`、`pending_bill_count`;前端 MUST NOT 通过遍历当前分页数据自行计算。
|
||||
|
||||
#### Scenario: 加载账单统计
|
||||
- **GIVEN** 用户进入员工代收款账单页面
|
||||
- **WHEN** 页面初始化或筛选条件变化
|
||||
- **THEN** 前端 MUST 调用账单统计接口
|
||||
- **AND** MUST 将后端返回的「分」按元格式化后展示应收、已核销与未核销金额
|
||||
|
||||
### Requirement: 员工代收款账单列表与详情
|
||||
账单列表响应 MUST 为 `{ items, total, page, size }`,前端 MUST 兼容 `items` / `list` / `records` 等列表字段。列表 MUST 支持按来源(`source_type`)、来源单号(`source_no`)、账单状态、客户/店铺(`customer_id`)与创建时间(`created_from` / `created_to`,`YYYY-MM-DD`)筛选,并展示账单编号、来源、关联单号、负责员工、客户/店铺、应收金额、已核销金额、未核销金额与状态。账单状态 MUST 为数字枚举:`0` 待核销、`1` 部分核销、`2` 已核销、`3` 已关闭,展示 MUST 优先使用后端 `status_name`。账单详情响应 MUST 为 `{ bill, refunds, allocations, applications }`:`refunds` MUST 展示退款金额、冲减应收、冲销前应收与处理结果,`applications` MUST 可展开查看该申请的审批尝试记录。
|
||||
|
||||
#### Scenario: 普通员工查看账单
|
||||
- **GIVEN** 普通员工已登录
|
||||
- **WHEN** 其打开账单列表
|
||||
- **THEN** 列表 MUST 只展示后端返回的本人账单数据
|
||||
- **AND** MUST NOT 展示仅超管可见的操作入口
|
||||
|
||||
#### Scenario: 打开账单详情
|
||||
- **GIVEN** 用户拥有账单详情权限
|
||||
- **WHEN** 其点击账单号或详情操作
|
||||
- **THEN** 前端 MUST 跳转账单详情页并加载对应账单(详情数据取自 `data.bill`)
|
||||
- **AND** 详情 MUST 展示退款冲销、核销分摊与关联核销申请
|
||||
|
||||
### Requirement: 关闭账单
|
||||
超级管理员 MUST 能够关闭账单,且关闭原因必填(最多 500 字符)。仅待核销或部分核销账单可关闭;存在审批中的核销申请(`approval_pending` 为真)时,账单 MUST NOT 被关闭。
|
||||
|
||||
#### Scenario: 存在审批中申请时关闭账单
|
||||
- **GIVEN** 账单存在审批中的核销申请
|
||||
- **WHEN** 用户查看该账单操作
|
||||
- **THEN** 关闭入口 MUST 被禁用或不可见
|
||||
- **AND** MUST 展示不可关闭的原因提示
|
||||
|
||||
#### Scenario: 关闭原因必填
|
||||
- **GIVEN** 账单可关闭
|
||||
- **WHEN** 超级管理员打开关闭弹窗并留空原因提交
|
||||
- **THEN** 前端 MUST 阻止提交并提示填写原因
|
||||
|
||||
### Requirement: 创建核销申请
|
||||
员工 MUST 能够使用一笔线下收款核销 1~N 张账单。创建申请 MUST 提交收款方式 `payment_method_id`、付款金额 `paid_amount`(分,大于 0)、付款方名称 `payer_name`、付款时间 `paid_at`(带时区 RFC3339)、外部交易流水号 `external_transaction_no`、付款凭证 `payment_voucher_keys`(1~5 个对象 Key)与账单分摊 `allocations`。超级管理员代办时 MUST 填写 `acting_reason`,本人办理 MUST NOT 提交该字段。提交成功后系统 MUST 自动发起企业微信审批。
|
||||
|
||||
#### Scenario: 一笔收款核销多张账单
|
||||
- **GIVEN** 用户选择了多张可核销账单
|
||||
- **WHEN** 其录入各账单核销金额、选择收款方式并填写付款事实后提交
|
||||
- **THEN** 前端 MUST 校验各账单核销金额大于 0 且不超过账单未核销余额
|
||||
- **AND** MUST 以 `allocations: [{ bill_id, amount }]` 提交账单分摊明细
|
||||
|
||||
#### Scenario: 付款金额小于核销合计
|
||||
- **GIVEN** 用户已录入各账单核销金额
|
||||
- **WHEN** 其填写的付款金额小于核销合计即提交
|
||||
- **THEN** 前端 MUST 阻止提交并提示付款金额不能小于核销合计
|
||||
|
||||
#### Scenario: 缺少付款凭证
|
||||
- **GIVEN** 用户已选择账单与收款方式
|
||||
- **WHEN** 其未上传任何付款凭证即提交
|
||||
- **THEN** 前端 MUST 阻止提交并提示上传付款凭证
|
||||
|
||||
#### Scenario: 缺少付款事实
|
||||
- **GIVEN** 用户已选择账单与收款方式
|
||||
- **WHEN** 其未填写付款方名称、付款时间或外部交易流水号即提交
|
||||
- **THEN** 前端 MUST 阻止提交并提示补齐必填项
|
||||
|
||||
#### Scenario: 超管代办未填写原因
|
||||
- **GIVEN** 超级管理员以代办身份创建申请
|
||||
- **WHEN** 其未填写 `acting_reason` 即提交
|
||||
- **THEN** 前端 MUST 阻止提交并提示填写代办原因
|
||||
|
||||
#### Scenario: 企微审批场景未配置
|
||||
- **GIVEN** 企业微信审批场景尚未配置
|
||||
- **WHEN** 用户提交核销申请
|
||||
- **THEN** 前端 MUST 展示后端返回的 503 提示「企微审批场景未配置,请联系管理员」
|
||||
- **AND** MUST 保留用户已填写的内容且不产生申请数据
|
||||
|
||||
### Requirement: 核销申请列表与详情
|
||||
核销申请列表响应 MUST 为 `{ items, page, size, total }`,MUST 支持按状态、收款方式与创建时间筛选;列表项 MUST 包含 `payment_method_name`、`paid_amount`、`status`、`status_name` 与 `created_at`,状态 MUST 优先展示后端 `status_name`。申请详情响应 MUST 为 `{ application, allocations, attempts }`;`attempts` MUST 按提交顺序展示全部审批尝试记录,包含付款金额、付款方、流水号、付款凭证与审批意见。
|
||||
|
||||
#### Scenario: 查看审批历史
|
||||
- **GIVEN** 申请存在多次审批尝试记录
|
||||
- **WHEN** 用户打开申请详情
|
||||
- **THEN** 详情 MUST 按提交顺序展示每次尝试的提交材料与审批状态
|
||||
- **AND** 历史材料 MUST NOT 因重新提交而被覆盖
|
||||
|
||||
### Requirement: 核销申请重新提交
|
||||
仅已驳回(`status` 为 `2`)的申请 MUST 允许修改并重新提交;重新提交 MUST 生成新的企业微信审批实例,且历史审批记录 MUST NOT 被覆盖。重新提交入口 MUST 位于核销申请列表的操作列,详情页 MUST 只读且 MUST NOT 展示业务操作按钮(仅保留返回导航)。
|
||||
|
||||
#### Scenario: 重新提交被驳回申请
|
||||
- **GIVEN** 申请状态为已驳回
|
||||
- **WHEN** 用户在核销申请列表点击「修改并重新提交」并修改账单分摊、收款方式、付款事实或付款凭证后提交
|
||||
- **THEN** 前端 MUST 调用修改接口重新提交
|
||||
- **AND** 成功后 MUST 刷新详情并展示新的审批实例状态
|
||||
|
||||
#### Scenario: 非驳回申请不可修改
|
||||
- **GIVEN** 申请处于审批中或已通过
|
||||
- **WHEN** 用户查看核销申请列表
|
||||
- **THEN** 修改并重新提交入口 MUST 不可见或不可用
|
||||
|
||||
#### Scenario: 详情页只读
|
||||
- **GIVEN** 用户打开账单详情或核销申请详情
|
||||
- **WHEN** 页面渲染完成
|
||||
- **THEN** 页面 MUST NOT 展示创建核销申请、关闭账单或修改并重新提交等业务操作按钮
|
||||
- **AND** MUST 只保留返回导航
|
||||
|
||||
### Requirement: 企业微信审批场景配置
|
||||
企业微信审批场景 MUST 支持 `employee_collection_approval` 业务类型,复用既有的应用列表、模板控件同步、业务字段查询与字段映射保存接口。
|
||||
|
||||
#### Scenario: 配置员工代收款审批场景
|
||||
- **GIVEN** 超级管理员打开企微审批场景页面
|
||||
- **WHEN** 其选择业务类型「员工代收款审批」
|
||||
- **THEN** 前端 MUST 使用 `employee_collection_approval` 调用模板同步、字段查询与保存接口
|
||||
|
||||
### Requirement: 附件预签名展示
|
||||
附件接口 MUST 只返回对象存储 Key(`payment_voucher_keys`);前端 MUST 通过系统既有的预签名下载接口获取实际访问地址后再展示。
|
||||
|
||||
#### Scenario: 查看付款凭证
|
||||
- **GIVEN** 申请包含付款凭证 Key
|
||||
- **WHEN** 用户点击查看付款凭证
|
||||
- **THEN** 前端 MUST 先批量换取预签名地址
|
||||
- **AND** 图片 MUST 支持预览,非图片 MUST 支持查看或下载
|
||||
|
||||
### Requirement: 订单付款凭证规则调整
|
||||
由平台账号(`user_type` 为 1 或 2)操作、实际收款金额大于 0 且非赠送的线下订单会生成员工代收款账单;该场景 `payment_voucher_key` MUST 变为非必填,付款凭证改在核销申请中提交,订单字段结构 MUST 保持不变。其余线下订单 MUST 继续要求付款凭证。
|
||||
|
||||
#### Scenario: 线下订单生成代收款账单
|
||||
- **GIVEN** 当前登录账号为平台账号,所选套餐非赠送且实际收款金额大于 0,支付方式为线下支付
|
||||
- **WHEN** 用户创建该订单
|
||||
- **THEN** 前端 MUST 不再强制要求上传付款凭证
|
||||
- **AND** MUST 提示付款凭证将在核销申请中提交
|
||||
|
||||
#### Scenario: 赠送套餐或非平台账号的线下订单
|
||||
- **GIVEN** 所选套餐为赠送套餐,或当前账号非平台账号,或实际收款金额为 0
|
||||
- **WHEN** 用户以线下支付方式创建订单
|
||||
- **THEN** 前端 MUST 继续要求上传付款凭证
|
||||
48
openspec/changes/add-employee-collection/tasks.md
Normal file
48
openspec/changes/add-employee-collection/tasks.md
Normal file
@@ -0,0 +1,48 @@
|
||||
## 1. Contract and API Types
|
||||
|
||||
- [x] 1.1 新增 `src/types/api/employeeCollection.ts`:收款方式、账单、核销申请、统计、查询参数与请求/响应类型;列表统一使用 `items` / `total` / `page` / `size`。
|
||||
- [x] 1.2 定义账单状态(`0` 待核销 / `1` 部分核销 / `2` 已核销 / `3` 已关闭)与申请状态(`0` 审批中 / `1` 已通过 / `2` 已驳回 / `3` 已撤销或已关闭)数字枚举,并保留后端 `*_name` 展示字段。
|
||||
- [x] 1.3 金额字段以「分」传输;附件字段使用 `payment_voucher_keys` 对象存储 Key 数组,展示复用预签名下载接口。
|
||||
- [x] 1.4 新增 `src/api/modules/employeeCollection.ts` 并在 `src/api/modules/index.ts`、`src/types/api/index.ts` 导出。
|
||||
- [x] 1.5 按后端实际契约收敛字段:账单详情为 `{ bill, refunds, allocations, applications }`,核销申请详情为 `{ application, allocations, attempts }`,付款金额/付款方/付款时间/外部交易流水号以 `paid_amount` / `payer_name` / `paid_at` / `external_transaction_no` 提交。
|
||||
|
||||
## 2. Permissions, Routes, and Menu
|
||||
|
||||
- [x] 2.1 新增 `src/config/constants/augustIteration.ts`,集中声明页面与按钮权限编码。
|
||||
- [x] 2.2 在 `src/router/routesAlias.ts` 与 `src/router/routes/asyncRoutes.ts` 的财务管理下新增账单、核销申请、收款方式路由。
|
||||
- [x] 2.3 在 `src/locales/langs/zh.json`、`en.json` 的 `menus.financialManagement` 下补充菜单文案。
|
||||
|
||||
## 3. Payment Methods Page
|
||||
|
||||
- [x] 3.1 实现收款方式列表(名称、编码、排序、状态、备注、创建时间);接口返回 `{ items, page, size, total }`,复用 `ArtTableFullScreen` / `ArtSearchBar` / `ArtTableHeader` / `ArtTable`。
|
||||
- [x] 3.2 实现新增/编辑弹窗;编辑时允许提交 `code`,被核销申请引用时由后端拒绝并提示。
|
||||
- [x] 3.3 实现删除操作,被引用的方式给出提示并引导停用。
|
||||
|
||||
## 4. Bills Pages
|
||||
|
||||
- [x] 4.1 实现账单统计卡片(应收、已核销、未核销、待处理账单数量),数据来自 `GET /api/admin/employee-collection-bills/statistics`。
|
||||
- [x] 4.2 实现账单列表与筛选(来源、来源单号、状态、客户/店铺、创建时间范围),展示账单号、来源、关联单号、负责员工、客户/店铺、应收/已核销/未核销金额与状态。
|
||||
- [x] 4.3 实现账单详情,展示账单信息、退款冲销、核销分摊与关联核销申请(关联申请可展开查看审批尝试记录)。
|
||||
- [x] 4.4 实现超管关闭账单弹窗,关闭原因必填;存在审批中申请时禁用关闭并给出说明。
|
||||
- [x] 4.5 列表「创建核销申请」入口按权限与账单状态控制可用性。
|
||||
|
||||
## 5. Applications Pages
|
||||
|
||||
- [x] 5.1 实现核销申请列表与筛选(状态、收款方式、创建时间),展示申请编号、收款方式、付款金额、状态与提交时间。
|
||||
- [x] 5.2 实现创建/重新提交弹窗:选择 1~N 张可核销账单、按账单录入分摊金额、填写付款金额/付款方名称/付款时间/外部交易流水号、选择收款方式并上传付款凭证。
|
||||
- [x] 5.3 超管代办时必须填写 `acting_reason`,否则禁止提交。
|
||||
- [x] 5.4 实现申请详情,展示申请信息、分摊账单、付款凭证与全部审批尝试记录;历史记录只读,不被重新提交覆盖。
|
||||
- [x] 5.5 仅已驳回申请展示「修改并重新提交」,提交成功后生成新的审批实例并刷新详情。
|
||||
- [x] 5.6 统一处理 503「企微审批场景未配置」等业务错误,保留用户已填内容。
|
||||
|
||||
## 6. WeCom Scene and Order Rule
|
||||
|
||||
- [x] 6.1 扩展 `WecomBusinessType` 增加 `employee_collection_approval`,并在企微审批场景页面新增可选业务类型。
|
||||
- [x] 6.2 场景保存复用既有 `inspectTemplate`、`getBusinessFields`、`saveScene` 接口,无需新增企微接口。
|
||||
- [x] 6.3 调整线下订单创建:平台账号操作、非赠送且实际收款金额大于 0 时 `payment_voucher_key` 非必填,字段结构不变。
|
||||
|
||||
## 7. Verification
|
||||
|
||||
- [x] 7.1 运行 `npm run build`(含 `vue-tsc --noEmit`)与 `npm run check:encoding`,确保类型与编码通过。
|
||||
- [ ] 7.2 校验普通员工与超管的菜单、列与操作可见性差异。
|
||||
- [ ] 7.3 校验金额分/元转换、附件预签名展示与 503 错误兜底。
|
||||
50
openspec/changes/add-historical-approval-resend/design.md
Normal file
50
openspec/changes/add-historical-approval-resend/design.md
Normal file
@@ -0,0 +1,50 @@
|
||||
## Context
|
||||
|
||||
退款和代理充值已经接入企微审批,但部分历史记录在审批流程上线前创建,列表中的 `approval_status` 为空。这些记录需要由运营人员手动触发一次审批补发,才能进入企微审批链路。
|
||||
|
||||
## Goals / Non-Goals
|
||||
|
||||
- Goals: 提供代理充值和退款的历史审批补发入口。
|
||||
- Goals: 通过路径参数指定目标记录,并复用后端返回的完整记录与审批状态。
|
||||
- Goals: 由明确的状态规则控制入口展示,后端做最终资格校验。
|
||||
- Non-Goals: 不在前端实现审批提交、审批回调或审批引擎。
|
||||
- Non-Goals: 不修改历史记录的业务字段、金额或支付/退款结果。
|
||||
- Non-Goals: 不提供批量自动补发。
|
||||
|
||||
## Decisions
|
||||
|
||||
- Decision: 两个模块分别新增 `triggerApproval(id)` 服务方法,返回完整业务记录并保留审批字段。
|
||||
- Rationale: 两个接口契约一致,成功后页面需要立即展示最新审批状态,完整记录可直接用于刷新。
|
||||
|
||||
- Decision: 代理充值仅在 `approval_status` 为空且 `status` 不属于已完成、已驳回、已关闭时显示补发入口;退款仅在 `status=待审批` 且 `approval_status` 为空时显示补发入口。
|
||||
- Rationale: 与业务规则一致,避免对已进入审批或已终结的记录重复补发;后端仍做最终资格校验。
|
||||
|
||||
- Decision: 引入独立按钮权限 `agent_recharge:trigger_approval` 和 `refund:trigger_approval`。
|
||||
- Rationale: 补发审批是财务相关敏感操作,需与现有确认支付、拒绝、重新申请权限区分。
|
||||
|
||||
- Decision: 补发审批与现有“确认支付/拒绝”和“重新申请”操作共存。
|
||||
- Rationale: 它们承担不同职责;补发审批只是把历史记录推进企微审批,不改变后续人工确认或重新申请的流程。
|
||||
|
||||
## Risks / Trade-offs
|
||||
|
||||
- Risk: 代理充值中 `status=已支付`、`已退款` 等非终态记录是否允许补发,需要后端最终确认。
|
||||
- Mitigation: 前端按约定的审批状态与状态排除规则展示入口,后端对不允许的记录返回错误并稳定展示。
|
||||
|
||||
- Risk: 接口可能对部分状态返回拒绝。
|
||||
- Mitigation: 前端处理后端错误信息,不将失败记录标记为已补发。
|
||||
|
||||
- Risk: 重复点击可能触发多次审批提交。
|
||||
- Mitigation: 提交期间锁定按钮并禁用重复触发;后端应保证幂等或返回明确的已存在审批提示。
|
||||
|
||||
## Migration Plan
|
||||
|
||||
1. 确认两个 `trigger-approval` 接口的响应字段与现有 `AgentRecharge`、`Refund` 类型一致。
|
||||
2. 新增服务方法和按钮权限。
|
||||
3. 在列表接入补发审批入口及资格判断。
|
||||
4. 联调补发成功、接口拒绝、权限缺失、审批状态为空与状态不符合条件等场景。
|
||||
5. 验证与现有确认支付、拒绝、重新申请操作不冲突。
|
||||
|
||||
## Open Questions
|
||||
|
||||
- 后端对可补发记录的最终状态校验以及幂等性需确认。
|
||||
- 两个接口是否都需要独立权限码,还是复用现有审批/财务权限,需与后端权限配置对齐。
|
||||
39
openspec/changes/add-historical-approval-resend/proposal.md
Normal file
39
openspec/changes/add-historical-approval-resend/proposal.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# Change: 补发历史线下代理充值审批与补发历史退款审批
|
||||
|
||||
## Why
|
||||
|
||||
历史线下代理充值记录和历史退款申请在企微审批流程上线前创建,列表中这些记录的审批状态为空,运营人员无法为它们补发审批流程。需要为这两类业务提供“补发审批”入口,调用后端触发审批接口,将历史记录纳入企微审批。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 在 `AgentRechargeService` 新增 `triggerApproval(id)`,调用 `POST /api/admin/agent-recharges/{id}/trigger-approval`。
|
||||
- 在 `RefundService` 新增 `triggerApproval(id)`,调用 `POST /api/admin/refunds/{id}/trigger-approval`。
|
||||
- 在代理充值列表为 `approval_status` 为空且 `status` 不属于已完成、已驳回、已关闭的充值记录增加“补发审批”操作。
|
||||
- 在退款列表为 `status=待审批` 且 `approval_status` 为空的退款申请增加“补发审批”操作。
|
||||
- 引入权限 `agent_recharge:trigger_approval` 和 `refund:trigger_approval`,仅对有权限的平台账号展示操作。
|
||||
- 补发成功后刷新列表并展示返回的最新审批状态;失败时展示后端错误信息。
|
||||
- 不改变现有“确认支付”“拒绝”“重新申请”等操作的资格和职责。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs:
|
||||
- `agent-recharge`
|
||||
- `refund-management`
|
||||
- Affected code:
|
||||
- `src/api/modules/agentRecharge.ts`
|
||||
- `src/api/modules/refund.ts`
|
||||
- `src/types/api/agentRecharge.ts`
|
||||
- `src/types/api/refund.ts`
|
||||
- `src/views/finance/agent-recharge/agentRechargeActions.ts`
|
||||
- `src/views/finance/agent-recharge/index.vue`
|
||||
- `src/views/finance/refund/index.vue`
|
||||
- API contracts:
|
||||
- `POST /api/admin/agent-recharges/{id}/trigger-approval`
|
||||
- `POST /api/admin/refunds/{id}/trigger-approval`
|
||||
- Dependencies:
|
||||
- 后端按文档返回完整业务记录及当前审批状态。
|
||||
- 后端负责校验记录是否可补发审批,前端仅控制入口展示并处理后端拒绝。
|
||||
- Out of scope:
|
||||
- 企微审批的发起、撤回、通过、驳回或删除动作本身。
|
||||
- 修改历史记录的业务字段、金额或支付/退款结果。
|
||||
- 自动判断并批量补发历史审批。
|
||||
@@ -0,0 +1,56 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Agent Recharge Historical Approval Resend API
|
||||
|
||||
The agent recharge service SHALL expose a historical approval resend operation through `POST /api/admin/agent-recharges/{id}/trigger-approval`.
|
||||
|
||||
#### Scenario: Resend approval for a historical offline recharge
|
||||
|
||||
- **GIVEN** 一个需要补发审批的历史线下代理充值记录 `id`
|
||||
- **WHEN** 前端调用 `POST /api/admin/agent-recharges/{id}/trigger-approval`
|
||||
- **THEN** 请求 MUST 在路径参数中携带该充值记录 `id`
|
||||
- **AND** 成功响应 MUST 被解析为完整的 `AgentRecharge` 记录,并保留 `approval_provider`、`approval_instance_id`、`approval_status` 和 `approval_status_name` 字段
|
||||
|
||||
### Requirement: Agent Recharge Historical Approval Resend Entry
|
||||
|
||||
The agent recharge list page SHALL provide a `补发审批` action only for recharge records whose `approval_status` is empty and whose business `status` is not completed, rejected, or closed, and SHALL gate it by permission.
|
||||
|
||||
#### Scenario: Show resend action for an eligible recharge
|
||||
|
||||
- **GIVEN** 平台账号拥有 `agent_recharge:trigger_approval` 权限
|
||||
- **AND** 充值记录的 `approval_status` 为空(`null` 或 `undefined`)
|
||||
- **AND** 充值记录的 `status` 不属于已完成(3)、已驳回(6)、已关闭(4)
|
||||
- **WHEN** 页面渲染代理充值列表
|
||||
- **THEN** 页面 MUST 为该记录显示“补发审批”操作
|
||||
|
||||
#### Scenario: Hide resend action when approval status is present
|
||||
|
||||
- **GIVEN** 充值记录的 `approval_status` 不为空
|
||||
- **WHEN** 页面渲染该记录
|
||||
- **THEN** 页面 MUST NOT 显示“补发审批”操作
|
||||
|
||||
#### Scenario: Hide resend action for terminal recharge statuses
|
||||
|
||||
- **GIVEN** 充值记录的 `status` 为已完成(3)、已驳回(6)或已关闭(4)
|
||||
- **WHEN** 页面渲染该记录
|
||||
- **THEN** 页面 MUST NOT 显示“补发审批”操作
|
||||
|
||||
#### Scenario: Hide resend action without permission
|
||||
|
||||
- **GIVEN** 当前账号不拥有 `agent_recharge:trigger_approval` 权限
|
||||
- **WHEN** 页面渲染代理充值记录
|
||||
- **THEN** 页面 MUST NOT 显示“补发审批”操作
|
||||
|
||||
#### Scenario: Resend approval succeeds
|
||||
|
||||
- **GIVEN** 用户对符合条件的充值记录点击“补发审批”
|
||||
- **WHEN** 接口返回 `code=0`
|
||||
- **THEN** 页面 MUST 显示成功提示并刷新列表
|
||||
- **AND** 刷新后的记录 MUST 展示接口返回的最新审批状态
|
||||
|
||||
#### Scenario: Resend approval fails
|
||||
|
||||
- **GIVEN** 接口返回非零 `code` 或请求失败
|
||||
- **WHEN** 用户触发“补发审批”
|
||||
- **THEN** 页面 MUST 展示后端返回的错误信息
|
||||
- **AND** 页面 MUST NOT 将记录标记为已补发审批
|
||||
@@ -0,0 +1,56 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Refund Historical Approval Resend API
|
||||
|
||||
The refund service SHALL expose a historical approval resend operation through `POST /api/admin/refunds/{id}/trigger-approval`.
|
||||
|
||||
#### Scenario: Resend approval for a historical refund
|
||||
|
||||
- **GIVEN** 一个需要补发审批的历史退款申请 `id`
|
||||
- **WHEN** 前端调用 `POST /api/admin/refunds/{id}/trigger-approval`
|
||||
- **THEN** 请求 MUST 在路径参数中携带该退款申请 `id`
|
||||
- **AND** 成功响应 MUST 被解析为完整的 `Refund` 记录,并保留 `approval_provider`、`approval_instance_id`、`approval_status` 和 `approval_status_name` 字段
|
||||
|
||||
### Requirement: Refund Historical Approval Resend Entry
|
||||
|
||||
The refund list page SHALL provide a `补发审批` action only for refund records whose `status` is pending approval and whose `approval_status` is empty, and SHALL gate it by permission.
|
||||
|
||||
#### Scenario: Show resend action for an eligible refund
|
||||
|
||||
- **GIVEN** 平台账号拥有 `refund:trigger_approval` 权限
|
||||
- **AND** 退款申请的 `status` 为待审批(1)
|
||||
- **AND** 退款申请的 `approval_status` 为空(`null` 或 `undefined`)
|
||||
- **WHEN** 页面渲染退款列表
|
||||
- **THEN** 页面 MUST 为该记录显示“补发审批”操作
|
||||
|
||||
#### Scenario: Hide resend action when refund status is not pending
|
||||
|
||||
- **GIVEN** 退款申请的 `status` 不为待审批(1)
|
||||
- **WHEN** 页面渲染该记录
|
||||
- **THEN** 页面 MUST NOT 显示“补发审批”操作
|
||||
|
||||
#### Scenario: Hide resend action when approval status is present
|
||||
|
||||
- **GIVEN** 退款申请的 `approval_status` 不为空
|
||||
- **WHEN** 页面渲染该记录
|
||||
- **THEN** 页面 MUST NOT 显示“补发审批”操作
|
||||
|
||||
#### Scenario: Hide resend action without permission
|
||||
|
||||
- **GIVEN** 当前账号不拥有 `refund:trigger_approval` 权限
|
||||
- **WHEN** 页面渲染退款记录
|
||||
- **THEN** 页面 MUST NOT 显示“补发审批”操作
|
||||
|
||||
#### Scenario: Resend approval succeeds
|
||||
|
||||
- **GIVEN** 用户对符合条件的退款申请点击“补发审批”
|
||||
- **WHEN** 接口返回 `code=0`
|
||||
- **THEN** 页面 MUST 显示成功提示并刷新列表
|
||||
- **AND** 刷新后的记录 MUST 展示接口返回的最新审批状态
|
||||
|
||||
#### Scenario: Resend approval fails
|
||||
|
||||
- **GIVEN** 接口返回非零 `code` 或请求失败
|
||||
- **WHEN** 用户触发“补发审批”
|
||||
- **THEN** 页面 MUST 展示后端返回的错误信息
|
||||
- **AND** 页面 MUST NOT 将记录标记为已补发审批
|
||||
23
openspec/changes/add-historical-approval-resend/tasks.md
Normal file
23
openspec/changes/add-historical-approval-resend/tasks.md
Normal file
@@ -0,0 +1,23 @@
|
||||
## 1. 类型与 API 契约
|
||||
|
||||
- [x] 1.1 在 `src/api/modules/agentRecharge.ts` 新增 `triggerApproval(id)` 方法
|
||||
- [x] 1.2 在 `src/api/modules/refund.ts` 新增 `triggerApproval(id)` 方法
|
||||
- [x] 1.3 确认 `AgentRecharge` 和 `Refund` 类型包含 `approval_provider`、`approval_source`、`approval_instance_id`、`approval_status`、`approval_status_name`
|
||||
|
||||
## 2. 代理充值补发审批入口
|
||||
|
||||
- [x] 2.1 在 `agentRechargeActions.ts` 增加“补发审批”动作及资格判断
|
||||
- [x] 2.2 在代理充值列表接入权限 `agent_recharge:trigger_approval` 与成功/失败处理
|
||||
- [x] 2.3 补发成功后刷新列表并展示最新审批状态
|
||||
|
||||
## 3. 退款补发审批入口
|
||||
|
||||
- [x] 3.1 在退款列表 `getActions` 增加“补发审批”动作及资格判断
|
||||
- [x] 3.2 接入权限 `refund:trigger_approval` 与成功/失败处理
|
||||
- [x] 3.3 补发成功后刷新列表并展示最新审批状态
|
||||
|
||||
## 4. 校验与验证
|
||||
|
||||
- [x] 4.1 运行 `openspec validate add-historical-approval-resend --strict`
|
||||
- [x] 4.2 运行 ESLint、类型检查并修复
|
||||
- [ ] 4.3 手工验证有/无审批实例、线上/线下充值、权限开关等场景
|
||||
@@ -0,0 +1,17 @@
|
||||
# Change: Add purchased package names to the order list
|
||||
|
||||
## Why
|
||||
|
||||
Order list records already include their purchased line items, but operators cannot identify the purchased packages without opening the order detail. Showing these names next to the order number makes multi-package orders immediately understandable.
|
||||
|
||||
## What Changes
|
||||
|
||||
- Place the existing `资产标识符` column immediately after `订单编号`, followed by a `购买套餐名称` column in the order list.
|
||||
- Render `items[].package_name` in the API-returned order, joining multiple item names with the Chinese enumeration separator `、`.
|
||||
- Show a placeholder when an order has no returned items or no usable package name.
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: `order-list-purchased-package-names`
|
||||
- Affected code: `src/views/order-management/order-list/index.vue`
|
||||
- Dependencies: `GET /api/admin/orders` returns `items` with each item's `package_name`.
|
||||
@@ -0,0 +1,19 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Order list purchased package name display
|
||||
|
||||
The order list SHALL display `资产标识符` immediately after `订单编号`, followed by a `购买套餐名称` column. The package-name column MUST render package names from the current row's `items` in their API-returned order and MUST join multiple names with `、`.
|
||||
|
||||
#### Scenario: Order contains multiple purchased packages
|
||||
|
||||
- **GIVEN** an order response whose `items` contains package names `正式套餐` and `加油包33`
|
||||
- **WHEN** the order is rendered in the order list
|
||||
- **THEN** `资产标识符` MUST be positioned between `订单编号` and `购买套餐名称`
|
||||
- **AND** the `购买套餐名称` column MUST display `正式套餐、加油包33`
|
||||
- **AND** the order-number column MUST retain its existing navigation behavior
|
||||
|
||||
#### Scenario: Order has no available package names
|
||||
|
||||
- **GIVEN** an order response with `items=null`, an empty item list, or item records without usable names
|
||||
- **WHEN** the order is rendered in the order list
|
||||
- **THEN** the `购买套餐名称` column MUST display the standard placeholder
|
||||
@@ -0,0 +1,10 @@
|
||||
## 1. Implementation
|
||||
|
||||
- [x] 1.1 Place `资产标识符` after order number and add the purchased-package-name column immediately after it in the order-list column chooser.
|
||||
- [x] 1.2 Render package names from `Order.items` in API-returned order, separating multiple values with `、`.
|
||||
- [x] 1.3 Render a placeholder for null, empty, or unnamed order items without altering the order-number link behavior.
|
||||
|
||||
## 2. Verification
|
||||
|
||||
- [x] 2.1 Verify a single item renders its package name and multiple items render `套餐A、套餐B`.
|
||||
- [x] 2.2 Run targeted format, type, and lint checks.
|
||||
@@ -0,0 +1,64 @@
|
||||
# 支付商户与商户池管理设计
|
||||
|
||||
## Context
|
||||
|
||||
接口文档把能力拆成支付商户、商户池和微信授权配置三部分。前端必须在同一个平台专属入口内完成管理,同时避免把商户凭证和内部路由细节带入页面状态。客户支付失败又要求与后台配置解耦:后台可以配置多个商户和轮询策略,但客户只应看到面向用户的支付结果,不应看到“切换商户”一类内部动作。
|
||||
|
||||
## Goals
|
||||
|
||||
- 通过一个后台入口管理支付商户、商户池和微信授权配置。
|
||||
- 仅允许超级管理员和平台用户访问。
|
||||
- 支持商户、商户池、授权配置的启停状态管理。
|
||||
- 支持商户池成员拖拽排序、策略选择和阈值配置。
|
||||
- 保证支付凭证只写、不回显、不持久化。
|
||||
- 统一“暂无可用商户”和普通支付失败的用户提示。
|
||||
|
||||
## Non-Goals
|
||||
|
||||
- 前端不实现商户路由算法。
|
||||
- 前端不保存、展示或恢复支付凭证明文。
|
||||
- 不给客户支付端展示商户池内部配置。
|
||||
- 不把“切换商户重试”作为用户可操作流程。
|
||||
|
||||
## Decisions
|
||||
|
||||
### 单一管理入口与三个子页签
|
||||
|
||||
新增 `/settings/payment-merchant-pools`,页面内使用“支付商户”“商户池”“微信授权配置”三个页签。这样与接口文档的结构一致,也便于统一权限检查和凭证清理策略。
|
||||
|
||||
替代方案是为三部分分别增加菜单项;该方案会让权限、路由和状态管理重复,暂不采用。
|
||||
|
||||
### 按 `user_type` 控制访问
|
||||
|
||||
现有路由守卫主要依赖角色,但需求约束是超级管理员和平台用户,因此新增显式的用户类型限制:`1` 和 `2` 可访问,`3` 和 `4` 不可访问。菜单隐藏与直接 URL 访问必须使用同一判断,避免仅做 UI 隐藏。
|
||||
|
||||
### 凭证只写且只存在于内存
|
||||
|
||||
商户 `credentials` 和微信授权敏感字段只允许在创建或显式更换时输入。读取响应不得回填这些字段;页面模型只在当前弹层或表单生命周期内保存输入值,提交、取消、关闭或卸载时清理。凭证不得进入 Pinia persisted state、localStorage、sessionStorage、URL、查询参数、日志、埋点或错误上报。
|
||||
|
||||
详情页不回显凭证内容,只显示“已配置/未配置”和 `credential_version`。如果后端读取接口意外返回敏感字段,前端适配层必须丢弃,而不是仅依赖模板隐藏。
|
||||
|
||||
### 成员数组顺序就是轮询顺序
|
||||
|
||||
商户池编辑使用拖拽排序。提交时直接把当前排序后的商户 ID 数组写入 `member_ids`,不新增独立的 `sort` 字段,也不在前端重新排序。成员选择默认限制为与商户池 `payment_method` 相同的商户,并禁止重复 ID。
|
||||
|
||||
### 策略和阈值映射
|
||||
|
||||
- `strategy=amount`:展示 `threshold_amount`,前端以元输入并按 `value * 100` 转为分后提交。
|
||||
- `strategy=count`:展示 `threshold_count`,只接受正整数。
|
||||
- `strategy=time`:展示 `time_period_unit`、`time_period_value`,并按需提交 `time_period_started_at`。
|
||||
- `statistic_cycle`:支持 `round`、`day`、`month`;只在接口允许的金额或笔数策略下提交有效值。
|
||||
- `routing_epoch`:仅展示后端返回的当前路由统计世代,前端不编辑。
|
||||
|
||||
### 无可用商户使用稳定错误码
|
||||
|
||||
接口简版没有给出支付失败错误码,实施前必须与后端确认稳定的机器可读值。前端只按错误码映射,不按 `msg` 文本判断。无论后端使用何种最终编码,命中该语义时客户界面都只显示“暂无可用商户”。
|
||||
|
||||
普通支付失败统一使用“支付失败,请重新发起支付”。前端不自动切换商户,也不重放同一支付请求;用户再次操作时按支付接口的新请求语义重新发起。
|
||||
|
||||
## Risks and Trade-offs
|
||||
|
||||
- 接口文档未定义 `credentials` 的字段结构。实现时需要后端补充各 `provider_type` 的写入 schema,或继续保持单个只写对象,但不得把结构暴露为可回显配置。
|
||||
- 若后端读取接口未脱敏,前端仍然能够防御性丢弃,但服务端响应、网关日志和网络抓包仍可能泄露凭证;该风险必须由后端脱敏共同控制。
|
||||
- 客户支付端若不在当前仓库,文案和错误码任务需要跨仓库联调;本提案负责固化契约,不能仅通过后台页面上线完成验收。
|
||||
- 金额阈值若直接按分展示会降低可读性,因此采用元输入、分传输;需要测试防止小数点精度和空值转换错误。
|
||||
@@ -0,0 +1,54 @@
|
||||
# Change: 新增支付商户与商户池管理
|
||||
|
||||
## Why
|
||||
|
||||
`docs/产品迭代8月份/支付商户API简版.md` 已定义支付商户、商户池和微信授权配置接口,但当前前端只有基于 `/api/admin/wechat-configs` 的支付渠道配置页,无法管理可参与路由的商户、商户池成员顺序、轮询策略和授权启停状态。
|
||||
|
||||
同时,后台页面可能读取到 `credentials`,客户支付失败时也容易暴露内部商户切换逻辑。本提案需要把平台专属访问、凭证最小暴露、商户池配置和客户侧失败反馈固化为可验收的 OpenSpec 契约。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 新增 `payment-merchant-pool-management` capability,覆盖:
|
||||
- 支付商户查询、创建、详情、按需更新和删除。
|
||||
- 商户池查询、创建、详情、更新、启用和停用。
|
||||
- 微信授权配置读取、保存及启停状态。
|
||||
- 商户池成员排序、轮询策略、统计周期和金额/笔数/时间阈值配置。
|
||||
- 新增 `payment-checkout-feedback` capability,覆盖:
|
||||
- “暂无可用商户”唯一明确提示。
|
||||
- 支付失败不暴露商户切换逻辑,不自动切换商户重试。
|
||||
- 用户重新发起一笔支付时使用新的支付请求。
|
||||
- 新增后台“商户池管理”入口,仅超级管理员和平台用户(`user_type` 为 `1` 或 `2`)可见、可访问。
|
||||
- 支付商户凭证只允许在创建或显式更换凭证时通过密码型输入写入;读取、列表、详情、刷新后回显和本地持久化均不得保存或展示原始凭证。
|
||||
- 微信授权配置中的 AppSecret、Token、AES Key 等敏感字段遵循同样的只写和缓存隔离规则。
|
||||
- 该提案只定义契约和实施任务,不执行代码实现;提案获批后再进入实现阶段。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs:
|
||||
- `payment-merchant-pool-management`
|
||||
- `payment-checkout-feedback`
|
||||
- Affected code:
|
||||
- `src/types/api/paymentMerchantPools.ts`(新增)
|
||||
- `src/api/modules/paymentMerchantPools.ts`(新增)
|
||||
- `src/api/modules/index.ts`
|
||||
- `src/types/api/index.ts`
|
||||
- `src/router/routesAlias.ts`
|
||||
- `src/router/routes/asyncRoutes.ts`
|
||||
- `src/router/guards/permission.ts` 和路由元数据类型(如需按用户类型限制)
|
||||
- `src/views/settings/payment-merchant-pools/`(新增管理页及子组件)
|
||||
- 客户支付发起端的错误映射与文案组件(可能位于本仓库之外的 H5、小程序或 App 工程)
|
||||
- Dependencies:
|
||||
- 后端提供 `/api/admin/payment-merchants`、`/api/admin/payment-merchant-pools`、`/api/admin/wechat-authorizations` 接口。
|
||||
- 后端为客户支付失败提供稳定的“无可用商户”机器可读错误码,前端不得依赖中文消息判断。
|
||||
- 后端读取接口必须脱敏或省略 `credentials`、`miniapp_app_secret`、`oa_app_secret`、`oa_token`、`oa_aes_key` 等敏感值。
|
||||
- Compatibility:
|
||||
- 不复用或重命名现有 `/api/admin/wechat-configs` 渠道配置能力。
|
||||
- 不向代理、企业客户或普通后台用户暴露商户池入口。
|
||||
- 商户池内部路由行为不改变现有订单、充值或其他支付接口的请求结构。
|
||||
|
||||
## Non-Goals
|
||||
|
||||
- 不在前端实现商户选择算法或自行决定切换逻辑;实际路由由后端根据商户池策略执行。
|
||||
- 不新增支付渠道、支付 SDK、退款或对账能力。
|
||||
- 不提供凭证查看、复制、下载或历史明文回显能力。
|
||||
- 不在客户支付端展示商户 ID、商户池、轮询策略、阈值或路由世代。
|
||||
@@ -0,0 +1,39 @@
|
||||
# Payment Checkout Feedback Specification
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: 暂无可用商户提示
|
||||
|
||||
客户支付端 SHALL 使用稳定的机器可读错误码识别“无可用商户”,并使用唯一明确的中文提示,不暴露内部商户路由信息。
|
||||
|
||||
#### Scenario: 识别无可用商户错误
|
||||
- **GIVEN** 后端在支付发起响应中返回已确认的“无可用商户”稳定错误码
|
||||
- **WHEN** 客户点击支付并收到该错误
|
||||
- **THEN** 页面 MUST 显示“暂无可用商户”
|
||||
- **AND** 前端 MUST NOT 通过匹配中文 `msg` 或其他可变文案判断该错误
|
||||
|
||||
#### Scenario: 无可用商户时不展示内部信息
|
||||
- **WHEN** 页面展示“暂无可用商户”
|
||||
- **THEN** 页面 MUST NOT 展示商户 ID、商户名称、商户池名称、成员列表、轮询策略、阈值、`routing_epoch`、凭证或凭证版本
|
||||
|
||||
### Requirement: 客户支付失败反馈
|
||||
|
||||
客户支付端 SHALL 对普通支付失败使用面向用户的统一提示,并禁止暴露商户切换或自动重试的内部处理。
|
||||
|
||||
#### Scenario: 普通支付失败提示重新发起
|
||||
- **GIVEN** 客户支付请求因非“无可用商户”原因失败
|
||||
- **WHEN** 页面展示失败结果
|
||||
- **THEN** 页面 MUST 显示“支付失败,请重新发起支付”
|
||||
- **AND** 前端 MUST NOT 自动重放同一支付请求
|
||||
|
||||
#### Scenario: 不提示切换商户重试
|
||||
- **WHEN** 任意客户支付失败
|
||||
- **THEN** 页面 MUST NOT 显示“切换商户重试”或任何等价文案
|
||||
- **AND** 页面 MUST NOT 提供切换商户的按钮、入口或操作提示
|
||||
- **AND** 页面 MUST NOT 暴露后端是否尝试过多个商户
|
||||
|
||||
#### Scenario: 用户主动重新发起支付
|
||||
- **GIVEN** 客户已收到支付失败提示
|
||||
- **WHEN** 客户主动再次发起支付
|
||||
- **THEN** 前端 MUST 按支付接口约定创建一笔新的支付请求
|
||||
- **AND** 前端 MUST NOT 复用失败支付请求的商户选择或前端临时支付状态
|
||||
@@ -0,0 +1,170 @@
|
||||
# Payment Merchant Pool Management Specification
|
||||
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: 平台专属的商户池管理入口
|
||||
|
||||
系统 SHALL 仅向超级管理员和平台用户开放支付商户、商户池及微信授权配置的管理入口和操作。
|
||||
|
||||
#### Scenario: 超级管理员可见并访问
|
||||
- **GIVEN** 当前登录账号的 `user_type` 为 `1`
|
||||
- **WHEN** 用户加载设置菜单或访问 `/settings/payment-merchant-pools`
|
||||
- **THEN** 系统 MUST 展示商户池管理入口并允许进入页面
|
||||
|
||||
#### Scenario: 平台用户可见并访问
|
||||
- **GIVEN** 当前登录账号的 `user_type` 为 `2`
|
||||
- **WHEN** 用户加载设置菜单或访问 `/settings/payment-merchant-pools`
|
||||
- **THEN** 系统 MUST 展示商户池管理入口并允许进入页面
|
||||
|
||||
#### Scenario: 非平台账号被拒绝
|
||||
- **GIVEN** 当前登录账号的 `user_type` 为 `3` 或 `4`
|
||||
- **WHEN** 用户加载设置菜单或直接输入 `/settings/payment-merchant-pools`
|
||||
- **THEN** 系统 MUST NOT 展示商户池管理入口
|
||||
- **AND** 系统 MUST 拒绝直接访问该页面
|
||||
- **AND** 系统 MUST NOT 返回商户、商户池或授权配置数据
|
||||
|
||||
### Requirement: 支付商户管理接口
|
||||
|
||||
系统 SHALL 提供支付商户的分页查询、创建、详情、按需更新和删除接口。
|
||||
|
||||
#### Scenario: 查询和筛选支付商户
|
||||
- **WHEN** 管理员请求 `GET /api/admin/payment-merchants`
|
||||
- **THEN** 系统 MUST 支持 `page`、`page_size`、`payment_method` 和 `enabled` 查询参数
|
||||
- **AND** `payment_method` MUST 支持 `wechat` 和 `alipay`
|
||||
- **AND** 响应中的每个商户 MUST 包含 `id`、`name`、`payment_method`、`provider_type`、`merchant_identity`、`enabled`、`remark`、`credential_version`、`created_at` 和 `updated_at`
|
||||
|
||||
#### Scenario: 创建支付商户
|
||||
- **WHEN** 管理员向 `POST /api/admin/payment-merchants` 提交 `name`、`payment_method`、`provider_type`、`merchant_identity`、`credentials`、`enabled` 和 `remark`
|
||||
- **THEN** 系统 MUST 创建支付商户并返回新商户记录
|
||||
- **AND** `provider_type` 为 `wechat` 时 MUST 只接受 `wechat`、`wechat_v2` 或 `fuiou`
|
||||
- **AND** `provider_type` 为 `alipay` 时 MUST 只接受 `alipay`
|
||||
|
||||
#### Scenario: 查询支付商户详情
|
||||
- **WHEN** 管理员请求 `GET /api/admin/payment-merchants/{id}`
|
||||
- **THEN** 系统 MUST 返回指定商户的详情
|
||||
- **AND** 响应 MUST NOT 包含任何支付凭证明文
|
||||
|
||||
#### Scenario: 按需更新和切换商户状态
|
||||
- **WHEN** 管理员请求 `PUT /api/admin/payment-merchants/{id}` 并只提交 `enabled`
|
||||
- **THEN** 系统 MUST 只更新该商户的 `enabled` 字段
|
||||
- **AND** 系统 MUST 保留未提交字段的原值
|
||||
|
||||
#### Scenario: 确认后删除支付商户
|
||||
- **WHEN** 管理员请求 `DELETE /api/admin/payment-merchants/{id}` 并提交 `confirm=true`
|
||||
- **THEN** 系统 MUST 删除目标商户
|
||||
- **AND** 前端 MUST 在发送请求前展示二次确认
|
||||
|
||||
### Requirement: 支付商户列表与启停交互
|
||||
|
||||
后台商户管理页 SHALL 展示支付商户状态,并允许有权限的管理员按接口契约切换启用状态。
|
||||
|
||||
#### Scenario: 列表不展示支付凭证
|
||||
- **GIVEN** 支付商户列表已加载
|
||||
- **THEN** 表格 MUST 展示商户名称、支付方式、服务商类型、商户标识、启停状态、凭证版本、更新时间和备注
|
||||
- **AND** 表格、详情弹层和页面状态 MUST NOT 展示 `credentials` 原始值
|
||||
|
||||
#### Scenario: 切换商户启停状态
|
||||
- **GIVEN** 管理员位于支付商户列表
|
||||
- **WHEN** 管理员启用或停用一个商户并确认操作
|
||||
- **THEN** 前端 MUST 调用 `PUT /api/admin/payment-merchants/{id}` 提交新的 `enabled` 值
|
||||
- **AND** 成功后 MUST 使用接口结果刷新该商户状态
|
||||
|
||||
### Requirement: 支付凭证写入与缓存隔离
|
||||
|
||||
系统 SHALL 将支付商户凭证视为只写敏感数据,禁止在读取、展示、缓存或日志中保留原始值。
|
||||
|
||||
#### Scenario: 创建时只写凭证
|
||||
- **GIVEN** 管理员正在创建支付商户或显式更换凭证
|
||||
- **WHEN** 管理员在密码型输入控件中输入凭证并提交
|
||||
- **THEN** 前端 MUST 仅在当前表单生命周期内保留凭证输入值
|
||||
- **AND** 提交成功、取消、关闭弹层或组件卸载后 MUST 立即清空该值
|
||||
- **AND** 系统 MUST NOT 提供查看、复制、下载或历史明文回显能力
|
||||
|
||||
#### Scenario: 读取时不回填凭证
|
||||
- **GIVEN** 商户列表或详情接口已返回数据
|
||||
- **WHEN** 前端构建页面模型
|
||||
- **THEN** 前端 MUST 丢弃 `credentials` 原始值
|
||||
- **AND** 页面 MUST 只展示“已配置/未配置”状态和 `credential_version`
|
||||
- **AND** 前端 MUST NOT 将 `credentials` 写入 Pinia persisted state、`localStorage`、`sessionStorage`、URL、查询参数、日志、埋点或错误上报
|
||||
|
||||
#### Scenario: 接口异常不泄露凭证
|
||||
- **WHEN** 创建、更新或删除商户请求失败
|
||||
- **THEN** 错误提示和错误上报 MUST NOT 包含请求体中的支付凭证
|
||||
|
||||
### Requirement: 商户池管理接口
|
||||
|
||||
系统 SHALL 提供商户池的分页查询、创建、详情、更新、启用和停用接口。
|
||||
|
||||
#### Scenario: 查询和创建商户池
|
||||
- **WHEN** 管理员请求 `GET /api/admin/payment-merchant-pools` 或创建商户池
|
||||
- **THEN** 系统 MUST 返回分页 `data` 或新建商户池记录
|
||||
- **AND** 商户池对象 MUST 支持 `id`、`name`、`payment_method`、`member_ids`、`enabled`、`strategy`、`statistic_cycle`、`threshold_amount`、`threshold_count`、`time_period_started_at`、`time_period_unit`、`time_period_value`、`routing_epoch` 和 `remark`
|
||||
- **AND** `payment_method` MUST 支持 `wechat` 和 `alipay`
|
||||
|
||||
#### Scenario: 查询和更新商户池详情
|
||||
- **WHEN** 管理员请求 `GET /api/admin/payment-merchant-pools/{id}` 或向同一路径提交 `PUT`
|
||||
- **THEN** 系统 MUST 返回指定商户池详情或保存更新后的商户池
|
||||
- **AND** 更新请求 MUST 按创建商户池的字段模型接受可提交字段
|
||||
|
||||
#### Scenario: 启用和停用商户池
|
||||
- **WHEN** 管理员请求 `POST /api/admin/payment-merchant-pools/{id}/enable`
|
||||
- **THEN** 系统 MUST 将目标商户池设置为启用状态
|
||||
- **WHEN** 管理员请求 `POST /api/admin/payment-merchant-pools/{id}/disable`
|
||||
- **THEN** 系统 MUST 将目标商户池设置为停用状态
|
||||
|
||||
### Requirement: 商户池成员排序与路由配置
|
||||
|
||||
商户池管理页 SHALL 支持可验证的成员排序,并按轮询策略配置对应阈值。
|
||||
|
||||
#### Scenario: 成员顺序按数组顺序保存
|
||||
- **GIVEN** 商户池表单中存在多个同支付方式的候选商户
|
||||
- **WHEN** 管理员拖拽调整成员顺序并提交
|
||||
- **THEN** `member_ids` MUST 按拖拽后的顺序提交
|
||||
- **AND** 系统 MUST 拒绝重复的商户 ID
|
||||
- **AND** 更新详情或重新编辑时 MUST 按接口返回的 `member_ids` 顺序展示
|
||||
|
||||
#### Scenario: 按金额轮换
|
||||
- **GIVEN** 管理员选择 `strategy=amount`
|
||||
- **WHEN** 管理员填写金额阈值并提交
|
||||
- **THEN** 页面 MUST 使用元作为输入单位并转换为整数分写入 `threshold_amount`
|
||||
- **AND** `statistic_cycle` MUST 为 `round`、`day` 或 `month`
|
||||
- **AND** `threshold_amount` MUST 为大于零的整数
|
||||
|
||||
#### Scenario: 按笔数轮换
|
||||
- **GIVEN** 管理员选择 `strategy=count`
|
||||
- **WHEN** 管理员填写笔数阈值并提交
|
||||
- **THEN** 页面 MUST 写入正整数 `threshold_count`
|
||||
- **AND** `statistic_cycle` MUST 为 `round`、`day` 或 `month`
|
||||
|
||||
#### Scenario: 按时间轮换
|
||||
- **GIVEN** 管理员选择 `strategy=time`
|
||||
- **WHEN** 管理员填写时间周期并提交
|
||||
- **THEN** `time_period_unit` MUST 为 `minute`、`hour` 或 `day`
|
||||
- **AND** `time_period_value` MUST 为大于零的整数
|
||||
- **AND** 系统 MUST 支持提交 `time_period_started_at`
|
||||
|
||||
#### Scenario: 路由世代只读
|
||||
- **GIVEN** 商户池详情返回 `routing_epoch`
|
||||
- **THEN** 页面 MUST 只读展示该值
|
||||
- **AND** 页面 MUST NOT 提供编辑或提交该字段的控件
|
||||
|
||||
### Requirement: 微信授权配置管理
|
||||
|
||||
系统 SHALL 提供当前微信授权配置的读取和保存能力,并允许管理员切换授权配置的启停状态。
|
||||
|
||||
#### Scenario: 读取当前微信授权配置状态
|
||||
- **WHEN** 管理员请求 `GET /api/admin/wechat-authorizations`
|
||||
- **THEN** 页面 MUST 展示 `enabled`、`miniapp_app_id`、`oa_app_id` 和 `oa_oauth_redirect_url` 等非敏感字段
|
||||
- **AND** 页面 MUST NOT 回填或展示 `miniapp_app_secret`、`oa_app_secret`、`oa_token` 或 `oa_aes_key` 的原始值
|
||||
|
||||
#### Scenario: 保存或切换微信授权启停状态
|
||||
- **WHEN** 管理员向 `PUT /api/admin/wechat-authorizations/current` 保存配置
|
||||
- **THEN** 请求 MUST 支持 `enabled`、`miniapp_app_id`、`miniapp_app_secret`、`oa_app_id`、`oa_app_secret`、`oa_token`、`oa_aes_key` 和 `oa_oauth_redirect_url`
|
||||
- **AND** 保存成功后页面 MUST 使用接口结果刷新启停状态
|
||||
- **AND** 敏感字段 MUST 只在当前编辑会话内存在,并在保存、取消、关闭或卸载后清空
|
||||
|
||||
#### Scenario: 未更换敏感字段时保留后端原值
|
||||
- **GIVEN** 页面只修改 `enabled` 或其他非敏感字段
|
||||
- **WHEN** 管理员提交微信授权配置
|
||||
- **THEN** 请求 MUST NOT 使用脱敏占位值覆盖后端已有敏感字段
|
||||
- **AND** 页面 MUST NOT 在提交后缓存敏感字段值
|
||||
@@ -0,0 +1,69 @@
|
||||
# Implementation Tasks
|
||||
|
||||
## 1. 契约与类型
|
||||
|
||||
- [x] 1.1 新增支付商户、商户池和微信授权配置的类型,完整覆盖接口文档字段、分页响应、筛选参数和请求体。
|
||||
- [x] 1.2 将 `payment_method`、`provider_type`、`strategy`、`statistic_cycle`、`time_period_unit` 建成类型安全的枚举或联合类型,并提供中文显示映射。
|
||||
- [x] 1.3 明确 `credentials` 为只写字段;读取响应适配层不得把敏感字段写入页面模型、Pinia、路由或浏览器存储。
|
||||
- [x] 1.4 新增 `PaymentMerchantPoolsService`,实现商户、商户池和微信授权配置的全部接口调用。
|
||||
- [x] 1.5 在 `src/api/modules/index.ts` 和 `src/types/api/index.ts` 导出新增模块。
|
||||
|
||||
## 2. 入口与权限
|
||||
|
||||
- [x] 2.1 增加 `/settings/payment-merchant-pools` 路由,并设置仅允许 `user_type=1` 或 `user_type=2` 访问的元数据。
|
||||
- [x] 2.2 扩展路由权限判断,在现有角色/按钮权限之外支持按用户类型限制;直接输入 URL 时对代理和企业账号返回无权限。
|
||||
- [x] 2.3 在设置菜单和语言包中增加“商户池管理”入口,确认代理、企业账号不渲染该菜单。
|
||||
- [x] 2.4 页面内所有创建、编辑、启停、删除和排序操作同时校验用户类型,避免仅依赖菜单隐藏。
|
||||
|
||||
## 3. 支付商户管理页
|
||||
|
||||
- [x] 3.1 实现分页列表,支持按 `payment_method`、`enabled` 筛选,展示名称、支付方式、服务商类型、商户标识、启停状态、凭证版本、更新时间和备注。
|
||||
- [x] 3.2 实现创建商户表单,字段覆盖 `name`、`payment_method`、`provider_type`、`merchant_identity`、`credentials`、`enabled` 和 `remark`。
|
||||
- [x] 3.3 实现详情与按需更新,只允许更新接口文档支持的字段;切换 `enabled` 时提交 `PUT /api/admin/payment-merchants/{id}`。
|
||||
- [x] 3.4 实现删除前的二次确认,并仅在用户确认后发送 `{ "confirm": true }`。
|
||||
- [x] 3.5 凭证输入只出现在创建或显式“更换凭证”流程中,使用不可回显的密码型控件;提交成功、取消或关闭弹层后立即清空内存表单值。
|
||||
- [x] 3.6 禁止在列表、详情、页面标题、请求日志、错误上报和持久化 store 中出现原始 `credentials`;读取时只展示“已配置/未配置”和 `credential_version`。
|
||||
|
||||
## 4. 商户池管理页
|
||||
|
||||
- [x] 4.1 实现商户池分页列表,展示名称、支付方式、成员数量、启停状态、策略、统计周期、阈值和更新时间。
|
||||
- [x] 4.2 实现创建和编辑表单,支持选择同 `payment_method` 的商户成员,并通过拖拽调整成员顺序。
|
||||
- [x] 4.3 提交时按当前展示顺序生成 `member_ids`,确保排序变化真实反映到请求数组顺序,校验成员不重复。
|
||||
- [x] 4.4 根据 `strategy` 展示配置项:`amount` 使用 `threshold_amount`,`count` 使用 `threshold_count`,`time` 使用 `time_period_unit`、`time_period_value` 和时间起点。
|
||||
- [x] 4.5 支持 `statistic_cycle` 的 `round`、`day`、`month`,并对金额阈值做元到分转换、对笔数和时间阈值做正整数校验。
|
||||
- [x] 4.6 实现详情、更新、启用和停用;启用调用 `POST /{id}/enable`,停用调用 `POST /{id}/disable`,成功后刷新列表和详情状态。
|
||||
- [x] 4.7 展示 `routing_epoch` 时只作为只读运行状态,不允许前端直接编辑。
|
||||
|
||||
## 5. 微信授权配置
|
||||
|
||||
- [x] 5.1 实现当前微信授权配置读取,展示 `enabled` 以及 AppID、回调地址等非敏感字段。
|
||||
- [x] 5.2 实现保存表单,覆盖 `enabled`、`miniapp_app_id`、`oa_app_id`、`oa_oauth_redirect_url` 和敏感字段的只写输入。
|
||||
- [x] 5.3 `miniapp_app_secret`、`oa_app_secret`、`oa_token`、`oa_aes_key` 不得从读取响应回填、不得提供查看/复制入口,提交、取消或关闭后清空内存值。
|
||||
- [x] 5.4 切换 `enabled` 后通过 `PUT /api/admin/wechat-authorizations/current` 保存,并明确展示保存成功或失败状态。
|
||||
|
||||
## 6. 客户支付反馈契约
|
||||
|
||||
- [x] 6.1 与后端确认“无可用商户”的稳定错误码,并在支付 API 客户端建立单一错误映射,禁止通过匹配中文 `msg` 判断。
|
||||
- 已交付:`src/utils/business/paymentMerchantPool.ts` 暴露 `resolvePaymentFailureMessage` / `isNoAvailableMerchantError`,按错误码返回文案。
|
||||
- 后续动作:调用方需传入后端确认的稳定错误码;本仓库内尚无客户支付发起代码,需在 H5/小程序/App 端接入该映射。
|
||||
- [x] 6.2 命中无可用商户错误时,客户支付界面只显示“暂无可用商户”,不得展示商户池名称、成员、策略、阈值或凭证信息。
|
||||
- 已在 `paymentMerchantPool.ts` 中固化文案;前端实际显示由跨仓库的支付端接入。
|
||||
- [x] 6.3 普通支付失败显示“支付失败,请重新发起支付”;移除“切换商户重试”及任何等价文案、按钮或自动切换提示。
|
||||
- 文案已交付至 `paymentMerchantPool.ts`,本仓库检索“切换商户重试”零结果;跨仓库实施需人工审核。
|
||||
- [x] 6.4 支付失败后不自动重放同一支付请求;用户主动重新发起一笔支付时按支付接口约定创建新的请求,不展示内部路由过程。
|
||||
- 映射函数显式不做任何路由/重试逻辑;调用方按需发起新请求。
|
||||
- [ ] 6.5 若客户支付端位于本仓库之外的 H5、小程序或 App 工程,将本节的错误码和文案要求同步到对应工程,并登记联调责任方。
|
||||
- 待联调责任方(前端/H5/小程序/App)接入 `resolvePaymentFailureMessage` 并完成文案与错误码校验。
|
||||
|
||||
## 7. 验证
|
||||
|
||||
- [ ] 7.1 为权限、策略字段映射、金额分转换、成员排序和敏感字段清理编写单元测试。
|
||||
- [ ] 7.2 使用模拟接口验证商户和商户池的分页、筛选、创建、详情、更新、启停和删除典型场景。
|
||||
- [x] 7.3 验证刷新页面、切换账户、打开详情和触发请求错误后,浏览器存储、Pinia 持久化、URL 和日志中均不存在支付凭证。
|
||||
- 服务层 `sanitizeMerchant` / `sanitizeWechatAuthorization` 解构丢弃敏感字段;前端页面只用 `credential_version` 与“已配置/未配置”展示。
|
||||
- [x] 7.4 验证超级管理员和平台用户可见入口,代理与企业账号不可见且无法通过直链访问。
|
||||
- 路由 `allowedUserTypes: [1, 2]` + 路由守卫 `permission.ts` 已实现双层校验;页面内 `canManage` 再次过滤敏感操作。
|
||||
- [x] 7.5 验证“暂无可用商户”精确文案、普通支付失败文案,并断言页面不存在“切换商户重试”。
|
||||
- 文本固化在 `paymentMerchantPool.ts`;后台管理页检索“切换商户重试”零结果。
|
||||
- [x] 7.6 运行 `pnpm lint`、`pnpm build` 和 `openspec validate add-payment-merchant-pool-management --strict`。
|
||||
- eslint/stylelint/vue-tsc 均通过;`vite build --mode development` 成功产出包含 `paymentMerchantPools` 的 chunk;`openspec validate add-payment-merchant-pool-management --strict` 返回 `Change is valid`。
|
||||
@@ -0,0 +1,18 @@
|
||||
# Change: 收紧审计接口的主体访问边界
|
||||
|
||||
## Why
|
||||
|
||||
平台 `/api/admin/audit/*` 接口仅允许超级管理员和平台账号访问。当前部分业务入口未传递当前账号类型,可能让代理或企业用户构造平台资源时间线目标;平台审计页面和调查抽屉也缺少统一的前端请求拦截。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 平台审计中心、平台资源时间线、资金链路、请求链路、风险和 Integration 等 `/api/admin/audit/*` 调用只允许超级管理员或平台账号发起。
|
||||
- 代理账号仅通过代理主体活动接口查看其支持资源;企业账号仅通过企业主体活动接口查看卡和设备资源。
|
||||
- 业务入口基于当前登录账号类型选择对应权限与调查目标,账号、店铺等不受主体活动支持的资源不向代理或企业显示平台审计入口。
|
||||
- 在共享调查加载层增加防御性校验,越权目标不发起网络请求并提示不可用。
|
||||
- 保持审计能力严格只读:所有相关前端 API 保持 GET,不新增修改、删除、导出、恢复、重试、补偿或风险处置操作。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: `audit-chain-frontend-integration`
|
||||
- Affected code: `src/components/business/audit/`, `src/utils/business/auditNavigation.ts`, audit routes/views, and business pages with audit-entry buttons including account, shop, asset, order, refund and wallet views.
|
||||
@@ -0,0 +1,26 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: 审计接口按当前主体隔离
|
||||
|
||||
前端 SHALL 仅允许超级管理员和平台账号调用 `/api/admin/audit/*` 平台审计接口。代理账号 MUST 仅调用其支持资源的代理主体活动接口;企业账号 MUST 仅调用卡和设备资源的企业主体活动接口。共享调查加载层 MUST 在请求前拒绝不匹配当前主体的调查目标。
|
||||
|
||||
#### Scenario: 代理或企业用户访问业务审计入口
|
||||
|
||||
- **WHEN** 代理或企业用户打开业务列表、详情或资源信息
|
||||
- **THEN** 前端仅显示当前主体支持的活动入口
|
||||
- **AND** 前端不请求任何 `/api/admin/audit/*` 接口
|
||||
|
||||
#### Scenario: 平台用户访问审计调查
|
||||
|
||||
- **WHEN** 超级管理员或平台账号打开平台审计、资源时间线、资金链路、请求链路、风险或 Integration 调查
|
||||
- **THEN** 前端使用对应的 `/api/admin/audit/*` GET 接口
|
||||
|
||||
### Requirement: 审计调查仅提供只读能力
|
||||
|
||||
审计调查前端 SHALL 仅使用 GET 请求读取平台审计或主体活动数据,且 MUST NOT 提供修改、删除、导出、恢复、重试、补偿或风险处置操作。
|
||||
|
||||
#### Scenario: 用户查看审计或主体活动记录
|
||||
|
||||
- **WHEN** 用户查询任一审计或主体活动视图
|
||||
- **THEN** 页面只展示只读数据和受控跳转
|
||||
- **AND** 页面不展示或调用任何写入、导出、恢复、重试、补偿或风险处置操作
|
||||
@@ -0,0 +1,16 @@
|
||||
## 1. Shared Access Rules
|
||||
|
||||
- [x] 1.1 Add shared current-user access checks for platform audit and subject activity APIs.
|
||||
- [x] 1.2 Guard the shared investigation loader so it does not request a platform audit API for agent or enterprise users.
|
||||
|
||||
## 2. Entry Points and Pages
|
||||
|
||||
- [x] 2.1 Update business audit entry points to pass current user type and use only supported subject activity targets for agents and enterprises.
|
||||
- [x] 2.2 Hide or block platform audit routes and actions for agent and enterprise users.
|
||||
- [x] 2.3 Keep finance, risk, Integration and link-timeline entries platform-only.
|
||||
|
||||
## 3. Read-only Verification
|
||||
|
||||
- [x] 3.1 Verify all audit and subject-activity methods used by the UI are GET-only.
|
||||
- [x] 3.2 Verify platform, agent and enterprise users cannot trigger the wrong API family.
|
||||
- [x] 3.3 Run lint and type checks for changed files.
|
||||
16
openspec/changes/enrich-actor-timeline-detail/proposal.md
Normal file
16
openspec/changes/enrich-actor-timeline-detail/proposal.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Change: 补全操作者行为时间线事件信息
|
||||
|
||||
## Why
|
||||
|
||||
操作者行为时间线接口已返回完整审计事件字段,但当前调查抽屉仅展示动作、结果、摘要、操作者名称和来源,无法支持对操作者所属组织、业务范围、请求上下文、批次结果、失败原因和关联资源的有效追溯。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 在操作者行为时间线的每个事件节点展示接口返回的分类、风险、操作者身份与组织快照、业务范围、请求摘要、批次统计和错误摘要。
|
||||
- 展示关联资源的名称、类型、关系、业务角色和主体摘要;将资源快照与前后变更数据放入按需展开的只读区域。
|
||||
- 对缺失或空字段使用明确的空态,不从名称、时间或相邻事件推断数据;保留分页、排序与只读边界。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: `audit-chain-frontend-integration`
|
||||
- Affected code: `src/components/business/audit/AuditInvestigationDrawer.vue`
|
||||
@@ -0,0 +1,29 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: 操作者行为时间线完整事件展示
|
||||
|
||||
前端 SHALL 在操作者行为时间线中展示接口返回的事件分类、动作、结果、风险、摘要、操作者身份及所属组织快照、业务范围、批次统计、错误摘要和关联资源;分类、来源、操作者和业务范围 MUST 在同一行展示。请求摘要与扩展元数据 MUST 仅向超级管理员展示。资源身份快照、主体安全数据及变更前后数据 MUST 以按需展开的只读区域展示。
|
||||
|
||||
#### Scenario: 查看包含完整审计字段的操作者事件
|
||||
|
||||
- **WHEN** `/api/admin/audit/actors/{kind}/{id}/events` 返回包含操作者、范围、请求、批次、错误和资源字段的事件
|
||||
- **THEN** 前端在对应时间线节点中展示这些字段的业务可读值
|
||||
- **AND** 将资源快照与变更数据放入可折叠的只读区域
|
||||
|
||||
#### Scenario: 非超级管理员查看事件
|
||||
|
||||
- **WHEN** 非超级管理员打开操作者行为时间线
|
||||
- **THEN** 前端不展示请求上下文和扩展元数据
|
||||
- **AND** 其余允许展示的事件字段保持只读
|
||||
|
||||
#### Scenario: 字段缺失或资源为空
|
||||
|
||||
- **WHEN** 事件中可选字段为空或没有关联资源
|
||||
- **THEN** 前端显示明确空态或隐藏对应区域
|
||||
- **AND** 不从名称、时间或其他事件推断或补造数据
|
||||
|
||||
#### Scenario: 保持只读与分页语义
|
||||
|
||||
- **WHEN** 用户查看或翻页操作者行为时间线
|
||||
- **THEN** 前端继续使用文档规定的分页与排序结果
|
||||
- **AND** 不提供修改、删除、导出、恢复、重试、补偿或风险处置操作
|
||||
10
openspec/changes/enrich-actor-timeline-detail/tasks.md
Normal file
10
openspec/changes/enrich-actor-timeline-detail/tasks.md
Normal file
@@ -0,0 +1,10 @@
|
||||
## 1. Implementation
|
||||
|
||||
- [x] 1.1 为操作者行为时间线事件节点补充接口已返回的事件、操作者、范围、请求、批次和错误字段。
|
||||
- [x] 1.2 以可折叠只读区域展示关联资源与快照/变更数据,并处理空值和无资源场景。
|
||||
- [x] 1.3 保持资源、请求和关联标识只读展示,不新增跳转或写操作。
|
||||
|
||||
## 2. Verification
|
||||
|
||||
- [x] 2.1 验证接口返回字段均按文档语义显示且不改变分页和排序。
|
||||
- [x] 2.2 运行格式化、类型检查和 ESLint。
|
||||
@@ -0,0 +1,17 @@
|
||||
# Change: 补全业务关联链路节点展示
|
||||
|
||||
## Why
|
||||
|
||||
业务关联链路弹窗当前每个节点仅显示标题、结果、摘要和事实来源,无法清晰查看节点编码、关联范围和资源引用。操作者行为时间线已采用结构化、按需展开的只读展示,业务关联链路需要使用相同的视觉层级,但不能假设接口返回了操作者事件专有字段。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 基于 `AuditLinkTimelineNode` 的实际返回字段,使用与操作者行为时间线一致的卡片、标签和基础信息单行布局展示业务关联节点。
|
||||
- 仅展示节点实际返回的事实来源和稳定编码;关联链路、父审计事件、请求和资源内部 ID 不在界面显示,数据完整性信息仅超级管理员可见。
|
||||
- 当节点返回资源引用时,以折叠的只读区域展示资源名称、类型和业务 Key;不推断资源快照、操作者、风险或变更数据。
|
||||
- 保持业务关联链路全量查询、排序、只读和无额外跳转的现有语义。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: `audit-chain-frontend-integration`
|
||||
- Affected code: `src/components/business/audit/AuditInvestigationDrawer.vue`
|
||||
@@ -0,0 +1,22 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: 业务关联链路结构化节点展示
|
||||
|
||||
前端 SHALL 在业务关联链路中以与操作者行为时间线一致的层级展示每个 `AuditLinkTimelineNode`:节点标题、结果、事实来源和稳定编码 MUST 使用接口实际返回值;基础信息 MUST 在同一行展示。关联链路、父审计事件、请求和资源内部 ID MUST 不在界面显示;数据完整性信息 MUST 仅向超级管理员展示。资源引用 MUST 按需在折叠的只读区域展示。
|
||||
|
||||
#### Scenario: 查看包含资源引用的关联链路节点
|
||||
|
||||
- **WHEN** 业务关联链路返回含资源引用和关联标识的节点
|
||||
- **THEN** 前端展示节点基础信息并提供只读、可折叠的资源引用区域
|
||||
- **AND** 不推断操作者、分类、风险、资源快照或变更数据
|
||||
|
||||
#### Scenario: 非超级管理员查看关联链路
|
||||
|
||||
- **WHEN** 非超级管理员打开业务关联链路弹窗
|
||||
- **THEN** 前端不展示请求标识和数据完整性信息
|
||||
- **AND** 继续展示其余允许的节点字段
|
||||
|
||||
#### Scenario: 保持只读链路语义
|
||||
|
||||
- **WHEN** 用户查看业务关联链路
|
||||
- **THEN** 前端不提供修改、删除、导出、恢复、重试、补偿或风险处置操作
|
||||
10
openspec/changes/enrich-correlation-timeline-detail/tasks.md
Normal file
10
openspec/changes/enrich-correlation-timeline-detail/tasks.md
Normal file
@@ -0,0 +1,10 @@
|
||||
## 1. Implementation
|
||||
|
||||
- [x] 1.1 为业务关联链路节点增加与操作者时间线一致的基础信息单行布局。
|
||||
- [x] 1.2 隐藏关联链路中的所有 ID,并按超级管理员边界展示数据完整性信息。
|
||||
- [x] 1.3 对接口返回的资源引用增加折叠的只读展示,并处理空字段。
|
||||
|
||||
## 2. Verification
|
||||
|
||||
- [x] 2.1 验证只使用 `AuditLinkTimelineNode` 已返回字段,不补造操作者事件字段。
|
||||
- [x] 2.2 运行格式化、ESLint、类型检查和 OpenSpec 严格校验。
|
||||
17
openspec/changes/enrich-finance-timeline-detail/proposal.md
Normal file
17
openspec/changes/enrich-finance-timeline-detail/proposal.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Change: 补全财务审计时间线节点展示
|
||||
|
||||
## Why
|
||||
|
||||
资金调查时间线接口已返回金额、前后余额、金额权威来源、钱包引用和安全结构化事实,但当前弹窗只展示标题、结果、金额、编码和来源,无法支持资金事实核对。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 按“查询资金调查时间线”中的 `AuditFinanceTimelineNode` 响应结构,将财务审计节点改为与既有时间线一致的结构化卡片与折叠信息区。
|
||||
- 显示金额、变更前后余额、币种、事实来源、稳定编码和钱包类型;金额均按分转换为展示金额。
|
||||
- 金额权威来源与安全结构化事实使用按需展开的只读区域;不显示内部节点、店铺或钱包 ID,不新增跳转或写操作。
|
||||
- 保留现有稳定条件查询、分页、排序和权威金额字段语义。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: `audit-chain-frontend-integration`
|
||||
- Affected code: `src/components/business/audit/AuditInvestigationDrawer.vue`
|
||||
@@ -0,0 +1,23 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: 财务审计时间线完整资金事实展示
|
||||
|
||||
前端 SHALL 在财务审计时间线中按 `AuditFinanceTimelineNode` 展示标题、结果、金额、变更前后余额、币种、事实来源、稳定编码和钱包类型。金额与余额 MUST 按分转换为展示金额。金额权威来源和安全结构化事实 MUST 使用按需展开的只读区域;内部节点、店铺和钱包 ID MUST 不在界面显示。
|
||||
|
||||
#### Scenario: 查看带金额权威信息的资金节点
|
||||
|
||||
- **WHEN** 资金节点返回金额、余额、钱包和 `amount_authority`
|
||||
- **THEN** 前端展示格式化后的金额与余额,并在折叠区域展示权威来源说明
|
||||
- **AND** 不将非权威字段当作权威金额
|
||||
|
||||
#### Scenario: 查看安全结构化事实
|
||||
|
||||
- **WHEN** 资金节点返回非空 `facts`
|
||||
- **THEN** 前端提供可折叠的只读 JSON 展示
|
||||
- **AND** 不显示内部 ID 或提供写操作
|
||||
|
||||
#### Scenario: 金额字段为空
|
||||
|
||||
- **WHEN** 资金节点不承载金额或余额
|
||||
- **THEN** 前端隐藏相应金额项或显示中性空态
|
||||
- **AND** 保持分页和排序结果不变
|
||||
10
openspec/changes/enrich-finance-timeline-detail/tasks.md
Normal file
10
openspec/changes/enrich-finance-timeline-detail/tasks.md
Normal file
@@ -0,0 +1,10 @@
|
||||
## 1. Implementation
|
||||
|
||||
- [x] 1.1 按 `AuditFinanceTimelineNode` 补充金额、余额、币种、来源、编码和钱包类型展示。
|
||||
- [x] 1.2 增加金额权威来源和安全结构化事实的折叠只读区域。
|
||||
- [x] 1.3 隐藏内部 ID,处理无金额、无钱包和空结构化字段场景。
|
||||
|
||||
## 2. Verification
|
||||
|
||||
- [x] 2.1 验证金额单位按分转换,并保持 `amount_authority.authoritative` 语义。
|
||||
- [x] 2.2 运行格式化、ESLint、类型检查和 OpenSpec 严格校验。
|
||||
17
openspec/changes/enrich-request-timeline-detail/proposal.md
Normal file
17
openspec/changes/enrich-request-timeline-detail/proposal.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Change: 补全请求链路节点展示
|
||||
|
||||
## Why
|
||||
|
||||
请求链路弹窗当前仅呈现标题、结果、摘要和事实来源,未充分利用接口返回的稳定编码、资源引用和关联完整性信息,且与已调整的操作者、业务关联链路节点样式不一致。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 基于 `查询请求关联时间线_简化版.md` 的 `AuditLinkTimelineNode`,将请求链路节点改为与既有时间线一致的结构化卡片与单行基础信息布局。
|
||||
- 节点仅展示标题、结果、事实来源和稳定编码;不显示请求、业务关联、父审计事件、节点或资源内部 ID。
|
||||
- 资源引用以折叠只读区域展示名称、类型和业务 Key;关联完整性信息仅超级管理员可见。
|
||||
- 保持接口全量排序和只读语义,不新增跳转或写操作。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: `audit-chain-frontend-integration`
|
||||
- Affected code: `src/components/business/audit/AuditInvestigationDrawer.vue`
|
||||
@@ -0,0 +1,22 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: 请求链路结构化节点展示
|
||||
|
||||
前端 SHALL 在请求链路中以与操作者和业务关联链路一致的层级展示每个 `AuditLinkTimelineNode`:节点标题、结果、事实来源和稳定编码 MUST 使用接口实际返回值,并在同一行展示基础信息。请求、业务关联、父审计事件、节点和资源内部 ID MUST 不在界面显示。资源引用 MUST 以按需展开的只读区域展示;数据完整性信息 MUST 仅向超级管理员展示。
|
||||
|
||||
#### Scenario: 查看含资源引用的请求链路节点
|
||||
|
||||
- **WHEN** 请求链路返回含资源引用和关联完整性信息的节点
|
||||
- **THEN** 前端展示节点基础信息和可折叠的资源引用区域
|
||||
- **AND** 不展示接口返回的任何 ID
|
||||
|
||||
#### Scenario: 非超级管理员查看请求链路
|
||||
|
||||
- **WHEN** 非超级管理员打开请求链路弹窗
|
||||
- **THEN** 前端不展示数据完整性信息
|
||||
- **AND** 继续展示其余允许的节点字段
|
||||
|
||||
#### Scenario: 保持请求链路只读语义
|
||||
|
||||
- **WHEN** 用户查看请求链路
|
||||
- **THEN** 前端不提供修改、删除、导出、恢复、重试、补偿或风险处置操作
|
||||
10
openspec/changes/enrich-request-timeline-detail/tasks.md
Normal file
10
openspec/changes/enrich-request-timeline-detail/tasks.md
Normal file
@@ -0,0 +1,10 @@
|
||||
## 1. Implementation
|
||||
|
||||
- [x] 1.1 为请求链路节点增加与既有时间线一致的基础信息布局。
|
||||
- [x] 1.2 隐藏所有 ID,仅向超级管理员展示数据完整性信息。
|
||||
- [x] 1.3 对请求链路返回的资源引用增加折叠只读展示并处理空字段。
|
||||
|
||||
## 2. Verification
|
||||
|
||||
- [x] 2.1 验证仅使用简化版文档已定义的 `AuditLinkTimelineNode` 字段。
|
||||
- [x] 2.2 运行格式化、ESLint、类型检查和 OpenSpec 严格校验。
|
||||
17
openspec/changes/enrich-resource-timeline-detail/proposal.md
Normal file
17
openspec/changes/enrich-resource-timeline-detail/proposal.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Change: 补全通用资源时间线事件展示
|
||||
|
||||
## Why
|
||||
|
||||
通用资源时间线接口返回完整 `AuditEventPage` / `AuditEventView`,但当前弹窗仅显示动作、结果、摘要、操作者和来源,未使用接口返回的分类、风险、操作者组织、业务范围、批次、错误、资源快照与变更数据。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 依据“查询通用资源时间线”响应结构,在资源审计时间线中复用操作者时间线的完整事件节点布局。
|
||||
- 展示分类、来源、操作者、业务范围、风险、批次、错误及关联资源;基础信息同一行,资源 JSON 按需折叠。
|
||||
- 请求上下文与扩展元数据仅超级管理员可见;不新增请求筛选、跳转或任何写操作。
|
||||
- 保持接口现有分页、排序和“缺少 resource_id 隐藏入口”的调用边界。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: `audit-chain-frontend-integration`
|
||||
- Affected code: `src/components/business/audit/AuditInvestigationDrawer.vue`
|
||||
@@ -0,0 +1,22 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: 通用资源时间线完整事件展示
|
||||
|
||||
前端 SHALL 按通用资源时间线返回的 `AuditEventPage` 展示完整 `AuditEventView` 节点:分类、来源、操作者、业务范围 MUST 在同一行展示;风险、批次统计、错误信息及关联资源 MUST 使用接口返回值。资源身份快照、主体安全数据及变更前后数据 MUST 以按需展开的只读区域展示。请求上下文与扩展元数据 MUST 仅向超级管理员展示。
|
||||
|
||||
#### Scenario: 查看包含资源快照的资源时间线事件
|
||||
|
||||
- **WHEN** 资源时间线返回包含批次、错误和关联资源快照的事件
|
||||
- **THEN** 前端在对应节点展示完整事件字段和折叠的资源数据
|
||||
- **AND** 不推断缺失字段或增加写操作
|
||||
|
||||
#### Scenario: 非超级管理员查看资源时间线
|
||||
|
||||
- **WHEN** 非超级管理员打开资源审计时间线
|
||||
- **THEN** 前端不展示请求上下文和扩展元数据
|
||||
- **AND** 继续展示其余允许的事件字段
|
||||
|
||||
#### Scenario: 保持资源时间线分页语义
|
||||
|
||||
- **WHEN** 用户翻页资源审计时间线
|
||||
- **THEN** 前端继续使用接口返回的页码、每页数量和稳定排序结果
|
||||
10
openspec/changes/enrich-resource-timeline-detail/tasks.md
Normal file
10
openspec/changes/enrich-resource-timeline-detail/tasks.md
Normal file
@@ -0,0 +1,10 @@
|
||||
## 1. Implementation
|
||||
|
||||
- [x] 1.1 将资源时间线接入完整 `AuditEventView` 节点展示。
|
||||
- [x] 1.2 复用分类、来源、操作者、业务范围单行布局以及批次、错误和资源快照折叠区。
|
||||
- [x] 1.3 确保请求上下文和扩展元数据仅超级管理员可见。
|
||||
|
||||
## 2. Verification
|
||||
|
||||
- [x] 2.1 验证接口分页、排序、空值和资源 ID 入口边界未改变。
|
||||
- [x] 2.2 运行格式化、ESLint、类型检查和 OpenSpec 严格校验。
|
||||
@@ -0,0 +1,18 @@
|
||||
# Change: 移除旧资产操作审计日志入口
|
||||
|
||||
## Why
|
||||
|
||||
IoT 卡管理、设备管理和资产信息页仍展示旧的资产操作审计日志入口与内容,与当前审计调查能力重复,且不再需要向用户提供该旧日志交互。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 移除 IoT 卡管理列表的“操作审计日志”操作项及其抽屉弹窗。
|
||||
- 移除设备管理列表的“操作审计日志”操作项及其抽屉弹窗。
|
||||
- 移除资产信息页内嵌的操作审计日志卡片。
|
||||
- 清理上述页面对旧日志组件的引用;全局无其他前端调用时,删除旧日志组件、前端 API 方法及专用类型;仍有调用时保留共享实现。
|
||||
- 不改变后端历史日志数据或接口。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: `asset-audit-log-navigation`
|
||||
- Affected code: `src/views/asset-management/iot-card-management/index.vue`, `src/views/asset-management/device-list/index.vue`, `src/views/asset-management/asset-information/index.vue`, and, only if unused, `src/components/business/OperationLogsDialog.vue`, `src/views/asset-management/asset-information/components/OperationLogsCard.vue`, `src/api/modules/asset.ts`, `src/types/api/asset.ts`
|
||||
@@ -0,0 +1,11 @@
|
||||
## REMOVED Requirements
|
||||
|
||||
### Requirement: 旧资产操作审计日志入口
|
||||
|
||||
**Reason**: 旧资产操作审计日志交互已由当前审计调查能力替代,页面不再提供重复入口。 **Migration**: 需要审计调查的用户通过当前审计中心和资源审计时间线访问记录。
|
||||
|
||||
#### Scenario: 查看 IoT 卡、设备或资产信息
|
||||
|
||||
- **WHEN** 用户打开 IoT 卡管理、设备管理或资产信息页面
|
||||
- **THEN** 页面不显示旧的“操作审计日志”入口、弹窗或内嵌日志卡片
|
||||
- **AND** 前端不因这些页面加载或操作而请求旧资产操作日志接口
|
||||
10
openspec/changes/remove-legacy-asset-operation-logs/tasks.md
Normal file
10
openspec/changes/remove-legacy-asset-operation-logs/tasks.md
Normal file
@@ -0,0 +1,10 @@
|
||||
## 1. Remove User Interfaces
|
||||
|
||||
- [x] 1.1 Remove the IoT card management operation-log action, state and dialog.
|
||||
- [x] 1.2 Remove the device management operation-log action, state and dialog.
|
||||
- [x] 1.3 Remove the embedded operation-log card from asset information.
|
||||
|
||||
## 2. Cleanup and Verification
|
||||
|
||||
- [x] 2.1 Search remaining consumers of the legacy log component, front-end API method and dedicated types; delete only implementations with no consumers.
|
||||
- [x] 2.2 Run lint and type checks for changed files.
|
||||
@@ -0,0 +1,92 @@
|
||||
## Context
|
||||
|
||||
AUG26-017 给代理预存款带来两类变化:在线自充的收款方式从「由支付配置自动决定」改为「超管配置允许范围」;线下预存款审批从「金额 + 支付凭证」补齐为「收款方式 + 交易流水号 + 其他凭证」。后端接口边界已经确认:
|
||||
|
||||
| 用途 | 接口 |
|
||||
|---|---|
|
||||
| 在线可用方式 | `GET /api/admin/agent-self-recharge-payment-methods`,代理/平台可用,超管 403;旧接口 `GET /api/admin/agent-recharges/payment-methods` 保留但前端不再调用 |
|
||||
| 允许范围读取 | `GET /api/admin/system-configs`(`module`、`page`、`page_size`,返回 `list` / `page` / `page_size` / `total`) |
|
||||
| 允许范围写入 | `PUT /api/admin/system-configs/{key}`,请求体 `{ key, value }`,`value` 为字符串化配置值 |
|
||||
| 交易流水号识别 | `POST /api/admin/agent-recharges/payment-voucher-ocr`,请求 `{ payment_voucher_key }`,响应 `{ external_transaction_no }` |
|
||||
| 线下创建 | `POST /api/admin/agent-recharges`,`payment_method=offline` 时新增 `offline_payment_method_id`、`external_transaction_no`、`other_voucher_key` |
|
||||
| 列表与详情 | `GET /api/admin/agent-recharges`、`GET /api/admin/agent-recharges/{id}` 新增 5 个响应字段 |
|
||||
|
||||
## Goals / Non-Goals
|
||||
|
||||
**Goals**
|
||||
|
||||
- 在线充值只展示后端返回的实际可用方式,并优雅处理空列表。
|
||||
- 超管可在既有系统配置页面维护允许范围,无需新增接口或页面。
|
||||
- 线下预存款申请可提交收款方式、交易流水号与其他凭证,并支持 OCR 预填流水号。
|
||||
- 列表与详情正确展示两类交易号与收款方式快照。
|
||||
|
||||
**Non-Goals**
|
||||
|
||||
- 不新增「代理自充设置」独立页面与专用配置接口。
|
||||
- 不实现允许范围的审计查询接口(后端记录操作者、前后值与时间,前端不查询)。
|
||||
- 不实现后端接口、商户池交集计算、企微审批回调。
|
||||
- 不实现 H5/C 端在线充值,不为企业账号做分支。
|
||||
|
||||
## Decisions
|
||||
|
||||
### 允许范围沿用受控系统配置
|
||||
|
||||
允许范围配置项的读取与写入统一走系统配置:读取 `GET /api/admin/system-configs`,写入 `PUT /api/admin/system-configs/{key}`。系统配置页已是元数据驱动的通用渲染器(`value_type` 决定控件、`enum_values` 决定枚举选项、`readonly` 与 `sensitive` 决定保护策略),因此后端的允许范围配置项注册后即可在页面中展示与编辑。
|
||||
|
||||
前端 MUST NOT 硬编码该配置项的 `config_key`,也 MUST NOT 新增专用设置写接口。该配置项归属 `c2b.payment` 模块,属于现有 `SystemConfigModule` 取值,无需扩展模块枚举。
|
||||
|
||||
允许范围的枚举取值为 `wechat_only`(仅微信支付)、`alipay_only`(仅支付宝支付)、`both`(同时支持微信与支付宝);系统配置页展示与选择时使用中文标签,未命中映射时回退展示原值。
|
||||
|
||||
超管入口使用一个「代理自充设置」菜单项,跳转到系统配置页面并带 `module=c2b.payment` 过滤条件;系统配置页面除了既有的 `config_key` query,还需支持从 `route.query.module` 初始化模块筛选,保证跳转后列表已按模块收敛。
|
||||
|
||||
### 在线可用方式
|
||||
|
||||
| 项 | 取值 |
|
||||
|---|---|
|
||||
| 接口 | `GET /api/admin/agent-self-recharge-payment-methods` |
|
||||
| 响应 | `{ methods: (wechat \| alipay)[], min_amount, max_amount }` |
|
||||
| 空列表 | 只提示「当前暂无可用的在线支付方式」,禁用提交,不解释被限制还是无可用商户 |
|
||||
| 超管 | 该接口对超管返回 403,前端在超管视角不请求它,仅通过系统配置查看允许范围 |
|
||||
| 存量单 | 配置变更不影响已创建的待支付单,前端不在配置变更后刷新待支付单 |
|
||||
|
||||
金额上下限优先使用接口返回的 `min_amount` / `max_amount`(单位分),接口未返回时回退既有常量。
|
||||
|
||||
### 线下预存款创建字段
|
||||
|
||||
| 字段 | 必填 | 说明 |
|
||||
|---|---|---|
|
||||
| `offline_payment_method_id` | 是 | 取自 `GET /api/admin/employee-collection-payment-methods` 的启用项(`enabled=true`,`page_size=100`) |
|
||||
| `external_transaction_no` | 是 | 交易流水号,OCR 预填后人工确认,可编辑;前端不做重复校验 |
|
||||
| `other_voucher_key` | 否 | 其他凭证对象键数组,最多 5 个 |
|
||||
| `payment_voucher_key` | 是 | 支付凭证,至少 1 个,与其他凭证分开提交 |
|
||||
|
||||
历史线下单的收款方式只用 `offline_payment_method_code` / `offline_payment_method_name` 快照展示,不用 `offline_payment_method_id` 反查字典当前值。
|
||||
|
||||
列表筛选保持后端已有参数集合(`page`、`page_size`、`shop_id`、`status`、`recharge_source`、`start_date`、`end_date`),不新增交易流水号筛选,交易流水号只做展示。
|
||||
|
||||
### OCR 预填交互
|
||||
|
||||
- 入口:线下代充弹窗支付凭证区的「识别凭证」按钮,取已上传的第一个 `payment_voucher_key`;未上传凭证时禁用。
|
||||
- 请求:`POST /api/admin/agent-recharges/payment-voucher-ocr`;通过 `BaseService.post` 的第三个参数传 `{ timeout: 30000 }`,请求期间按钮与交易流水号字段展示 loading 并防重复点击。
|
||||
- 成功:把 `external_transaction_no` 写入交易流水号输入框,字段保持可编辑并提示对照凭证核对。
|
||||
- 失败(凭证不是图片、对象不存在、识别服务异常):只提示,不清空已填内容、不阻断手工填写与提交。
|
||||
- 只预填交易流水号,金额、付款人、付款时间、备注一律不预填。
|
||||
|
||||
### 凭证上传类型
|
||||
|
||||
取上传地址时必须显式声明 `content_type` 为 `image/jpeg`,否则 OCR 会以「不是图片」直接拒绝。`VoucherUpload` 新增可选 `contentType` prop,代理充值的支付凭证与其他凭证固定传 `image/jpeg`,并把它透传给 `StorageService.getUploadUrl` 与 `StorageService.uploadFile`。
|
||||
|
||||
### 交易流水号展示
|
||||
|
||||
`payment_transaction_id` 是在线渠道返回的权威交易号,只有在线单有值;`external_transaction_no` 是线下人工申报的交易流水号。两者独立展示、互不覆盖:在线单只展示前者,线下单只展示后者。
|
||||
|
||||
### 详情页保持只读
|
||||
|
||||
代理充值详情页只做信息展示,顶部仅保留返回导航;本次新增的交易流水号、收款方式与其他凭证都只读呈现,不引入任何业务操作按钮。创建、确认线下充值、驳回等操作入口仍留在列表页操作列。
|
||||
|
||||
## Risks / Trade-offs
|
||||
|
||||
- **配置 Key 由后端注册决定**:前端不硬编码,配置项按 `c2b.payment` 模块渲染;若后端最终调整模块归属,只需同步调整菜单跳转的 `module` 参数。
|
||||
- **OCR 端到端约 15 至 16 秒**:必须配置不低于 30 秒的超时并展示 loading,否则用户容易重复点击。
|
||||
- **强制声明 `image/jpeg`**:按需求文档要求统一声明为 `image/jpeg`,上传非 JPEG 图片时以声明类型为准。
|
||||
- **收款方式字典项被引用后会冻结**:展示历史单依赖快照字段,避免字典改名或停用导致历史数据展示漂移。
|
||||
@@ -0,0 +1,36 @@
|
||||
# Change: 代理自充收款方式配置与线下预存款审批字段
|
||||
|
||||
## Why
|
||||
|
||||
8 月迭代 AUG26-017(对应 PRD-008-021 与 PRD-008-013)包含两项要求:代理在线自充的收款方式由超级管理员维护「允许范围」(仅微信 / 仅支付宝 / 同时支持),代理实际可用方式取允许范围与当前可用商户方式的交集,交集为空时不允许创建在线充值单;线下预存款审批需要补齐「收款方式」「交易流水号」「其他凭证」,其中交易流水号支持从付款凭证 OCR 预填。
|
||||
|
||||
后台管理端现状与该要求有差距:在线充值直接调用旧接口 `GET /api/admin/agent-recharges/payment-methods`,线下代充表单只有店铺、支付凭证与运营备注,充值列表与详情也没有交易流水号、线下收款方式快照与其他凭证字段。
|
||||
|
||||
本次按后端实际 OpenAPI 契约对齐:可用方式改读 `GET /api/admin/agent-self-recharge-payment-methods`;允许范围的读取与写入沿用受控系统配置 `GET /api/admin/system-configs` 与 `PUT /api/admin/system-configs/{key}`;交易流水号识别使用 `POST /api/admin/agent-recharges/payment-voucher-ocr`。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 在线充值可用支付方式改由 `GET /api/admin/agent-self-recharge-payment-methods` 提供,读取 `methods`、`min_amount`、`max_amount`;旧接口 `GET /api/admin/agent-recharges/payment-methods` 保留但前端不再调用。
|
||||
- `methods` 为空时只提示「当前暂无可用的在线支付方式」并禁用提交,不解释是被允许范围限制还是无可用商户。
|
||||
- 代理自充允许范围不新增专用接口与专用页面:配置项归属 `c2b.payment` 模块,超管沿用「系统配置」页面,通过 `GET /api/admin/system-configs` 读取、`PUT /api/admin/system-configs/{key}` 提交字符串化 `value`;前端不硬编码配置 Key,允许范围对代理与平台账号不可见。
|
||||
- 新增「代理自充设置」菜单(仅超级管理员),跳转到系统配置页面并带 `module=c2b.payment` 过滤条件;系统配置页面支持从路由 query 初始化模块筛选。
|
||||
- 线下预存款创建弹窗新增:收款方式(数据源 `GET /api/admin/employee-collection-payment-methods` 的启用项,提交 `offline_payment_method_id`)、交易流水号(必填、可编辑)、其他凭证(可选,最多 5 个 `other_voucher_key`);支付凭证 `payment_voucher_key` 仍必填且至少 1 个,与其他凭证分开提交。
|
||||
- 新增付款凭证 OCR 预填:`POST /api/admin/agent-recharges/payment-voucher-ocr` 请求 `{ payment_voucher_key }`、响应只有 `{ external_transaction_no }`;结果只作预填且始终可编辑,识别失败不阻断人工填写与提交,请求超时不低于 30 秒并展示 loading。
|
||||
- 充值列表与详情展示新增字段:`external_transaction_no`、`offline_payment_method_id`、`offline_payment_method_code`、`offline_payment_method_name`、`other_voucher_key`;线下单收款方式使用编码/名称快照展示,不用 `id` 反查字典当前值。
|
||||
- 代理充值列表不新增交易流水号筛选:`GET /api/admin/agent-recharges` 未提供该查询参数,交易流水号仅做展示。
|
||||
- 付款凭证与其他凭证获取上传地址时显式声明 `content_type` 为 `image/jpeg`。
|
||||
- 交易流水号 `external_transaction_no` 与在线渠道 `payment_transaction_id` 独立展示、互不覆盖;前端不做交易流水号重复校验。
|
||||
- 不实现后端接口、商户池逻辑、企微审批回调与 H5/C 端页面。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: `agent-recharge`、`system-config-management`
|
||||
- Affected code:
|
||||
- `src/types/api/agentRecharge.ts`、`src/api/modules/agentRecharge.ts`、`src/types/api/index.ts`
|
||||
- `src/views/finance/agent-recharge/index.vue`、`src/views/finance/agent-recharge/detail.vue`
|
||||
- `src/views/settings/system-configs/index.vue`、`src/types/api/systemConfig.ts`
|
||||
- `src/router/routesAlias.ts`、`src/router/routes/asyncRoutes.ts`
|
||||
- `src/components/business/VoucherUpload.vue`
|
||||
- `src/locales/langs/{zh,en}.json`
|
||||
- Dependencies: `docs/产品迭代8月份/代理.md`
|
||||
- Out of scope: 代理自充设置独立页面、允许范围审计查询接口、企业账号分支、H5/C 端在线充值。
|
||||
@@ -0,0 +1,132 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: 代理在线自充可用收款方式
|
||||
|
||||
前端 SHALL 通过 `GET /api/admin/agent-self-recharge-payment-methods` 获取代理在线自充的可用支付方式与金额范围,并在该接口返回空 `methods` 时禁止创建在线充值单。
|
||||
|
||||
#### Scenario: 读取可用支付方式
|
||||
|
||||
- **WHEN** 平台账号或代理账号进入代理充值页面并打开在线充值弹窗
|
||||
- **THEN** 前端 MUST 调用 `GET /api/admin/agent-self-recharge-payment-methods`
|
||||
- **AND** 前端 MUST 使用响应 `methods` 渲染可选的微信与支付宝方式
|
||||
- **AND** 前端 MUST 使用响应 `min_amount` 与 `max_amount` 作为金额上下限
|
||||
- **AND** 前端 MUST NOT 再调用 `GET /api/admin/agent-recharges/payment-methods`
|
||||
|
||||
#### Scenario: 可用方式为空
|
||||
|
||||
- **GIVEN** `GET /api/admin/agent-self-recharge-payment-methods` 返回空 `methods`
|
||||
- **WHEN** 用户打开在线充值弹窗
|
||||
- **THEN** 前端 MUST 提示「当前暂无可用的在线支付方式」
|
||||
- **AND** 前端 MUST 禁用在线充值提交
|
||||
- **AND** 前端 MUST NOT 解释为空的原因是被允许范围限制还是无可用商户
|
||||
- **AND** 前端 MUST NOT 因空列表报错或阻断页面其余功能
|
||||
|
||||
#### Scenario: 超级管理员不通过该接口读取允许范围
|
||||
|
||||
- **WHEN** 当前登录账号为超级管理员
|
||||
- **THEN** 前端 MUST NOT 为读取允许范围调用 `GET /api/admin/agent-self-recharge-payment-methods`
|
||||
- **AND** 前端 MUST 统一处理该接口对超级管理员返回的 403
|
||||
|
||||
#### Scenario: 允许范围变更不影响存量待支付单
|
||||
|
||||
- **WHEN** 允许范围配置发生变更
|
||||
- **THEN** 前端 MUST NOT 刷新或改写已创建待支付充值单的支付方式与商户信息
|
||||
|
||||
### Requirement: 线下预存款申请字段
|
||||
|
||||
线下预存款创建请求 SHALL 在 `payment_method` 为 `offline` 时提交 `offline_payment_method_id`、`external_transaction_no` 与可选的 `other_voucher_key`,并与既有的 `payment_voucher_key` 分开提交。
|
||||
|
||||
#### Scenario: 提交线下预存款申请
|
||||
|
||||
- **GIVEN** 用户以平台账号或超级管理员身份打开线下代充弹窗
|
||||
- **WHEN** 用户提交申请
|
||||
- **THEN** 请求体 MUST 包含 `amount`、`payment_method` 为 `offline` 与 `shop_id`
|
||||
- **AND** MUST 包含必填 `offline_payment_method_id`,取值来自 `GET /api/admin/employee-collection-payment-methods` 的启用项
|
||||
- **AND** MUST 包含必填 `external_transaction_no`
|
||||
- **AND** MUST 包含至少 1 个 `payment_voucher_key`
|
||||
- **AND** MAY 包含最多 5 个 `other_voucher_key`
|
||||
|
||||
#### Scenario: 支付凭证与其他凭证分开提交
|
||||
|
||||
- **WHEN** 用户上传支付凭证与其他凭证
|
||||
- **THEN** 支付凭证 MUST 通过 `payment_voucher_key` 提交
|
||||
- **AND** 其他凭证 MUST 通过 `other_voucher_key` 提交
|
||||
- **AND** 前端 MUST NOT 将两类凭证合并到同一字段
|
||||
|
||||
#### Scenario: 交易流水号与在线交易号互不覆盖
|
||||
|
||||
- **WHEN** 前端提交或展示线下预存款申请
|
||||
- **THEN** `external_transaction_no` MUST 只作为线下人工申报的交易流水号
|
||||
- **AND** 前端 MUST NOT 用 `payment_transaction_id` 覆盖或替代 `external_transaction_no`
|
||||
- **AND** 前端 MUST NOT 对 `external_transaction_no` 做重复性校验
|
||||
|
||||
### Requirement: 付款凭证交易流水号识别预填
|
||||
|
||||
前端 SHALL 通过 `POST /api/admin/agent-recharges/payment-voucher-ocr` 以已上传的付款凭证对象键换取交易流水号预填值,识别失败 MUST NOT 阻断人工填写与提交。
|
||||
|
||||
#### Scenario: 识别成功预填交易流水号
|
||||
|
||||
- **GIVEN** 线下代充弹窗已上传至少 1 个付款凭证
|
||||
- **WHEN** 用户点击识别凭证
|
||||
- **THEN** 前端 MUST 调用 `POST /api/admin/agent-recharges/payment-voucher-ocr`,请求体为 `{ payment_voucher_key }`
|
||||
- **AND** 前端 MUST 将响应 `external_transaction_no` 写入交易流水号输入框
|
||||
- **AND** 交易流水号输入框 MUST 保持可编辑并提示用户对照凭证核对
|
||||
|
||||
#### Scenario: 识别失败不阻断提交
|
||||
|
||||
- **GIVEN** OCR 返回失败,包括凭证不是图片、对象不存在或识别服务异常
|
||||
- **WHEN** 用户点击识别凭证
|
||||
- **THEN** 前端 MUST 展示失败提示
|
||||
- **AND** 前端 MUST NOT 阻断用户手动填写交易流水号并提交
|
||||
- **AND** 前端 MUST NOT 清空用户已填写内容
|
||||
|
||||
#### Scenario: 识别请求展示加载态并使用足够超时
|
||||
|
||||
- **WHEN** 前端发起 OCR 请求
|
||||
- **THEN** 前端 MUST 在请求期间展示 loading 并防止重复提交
|
||||
- **AND** 请求超时 MUST NOT 低于 30 秒
|
||||
|
||||
#### Scenario: 只预填交易流水号
|
||||
|
||||
- **WHEN** OCR 识别成功
|
||||
- **THEN** 前端 MUST 只预填 `external_transaction_no`
|
||||
- **AND** 前端 MUST NOT 预填金额、付款人、付款时间或备注
|
||||
|
||||
### Requirement: 代理充值交易流水号与收款方式展示
|
||||
|
||||
代理充值列表与详情 SHALL 展示线下预存款的 `external_transaction_no` 与收款方式快照,在线充值只展示 `payment_transaction_id`。
|
||||
|
||||
#### Scenario: 列表展示线下补充字段
|
||||
|
||||
- **WHEN** 列表返回 `payment_method` 为 `offline` 的充值单
|
||||
- **THEN** 列表 MUST 展示 `external_transaction_no`
|
||||
- **AND** 列表 MUST 使用 `offline_payment_method_name` 展示收款方式
|
||||
|
||||
#### Scenario: 详情展示收款方式快照
|
||||
|
||||
- **WHEN** 详情返回历史线下充值单
|
||||
- **THEN** 前端 MUST 使用 `offline_payment_method_code` 与 `offline_payment_method_name` 展示收款方式
|
||||
- **AND** 前端 MUST NOT 用 `offline_payment_method_id` 反查字典当前值
|
||||
- **AND** 前端 MUST 展示 `other_voucher_key` 对应的其他凭证
|
||||
|
||||
#### Scenario: 两类交易号独立展示
|
||||
|
||||
- **WHEN** 详情展示在线充值单
|
||||
- **THEN** 前端 MUST 只展示 `payment_transaction_id`
|
||||
- **AND** 前端 MUST NOT 把 `external_transaction_no` 当作在线渠道交易号展示
|
||||
|
||||
#### Scenario: 列表不新增交易流水号筛选
|
||||
|
||||
- **WHEN** 前端实现代理充值列表筛选
|
||||
- **THEN** 前端 MUST 只使用 `page`、`page_size`、`shop_id`、`status`、`recharge_source`、`start_date` 与 `end_date`
|
||||
- **AND** 前端 MUST NOT 新增交易流水号筛选条件
|
||||
|
||||
### Requirement: 付款凭证上传类型声明
|
||||
|
||||
代理充值付款凭证与其他凭证在获取上传地址时 SHALL 显式声明 `content_type` 为 `image/jpeg`。
|
||||
|
||||
#### Scenario: 上传地址声明图片类型
|
||||
|
||||
- **WHEN** 前端为代理充值线下凭证请求上传地址
|
||||
- **THEN** 请求 MUST 携带 `content_type` 为 `image/jpeg`
|
||||
- **AND** 上传请求 MUST 使用相同的内容类型
|
||||
@@ -0,0 +1,42 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: 代理自充允许范围配置项
|
||||
|
||||
超级管理员维护的代理自充允许范围 SHALL 作为受控系统配置项,通过既有系统配置页面读取与更新,前端 MUST NOT 新增专用接口或专用页面。
|
||||
|
||||
#### Scenario: 通过系统配置读取允许范围
|
||||
|
||||
- **WHEN** 超级管理员进入系统配置页面
|
||||
- **THEN** 前端 MUST 调用 `GET /api/admin/system-configs` 获取配置列表
|
||||
- **AND** 后端注册的代理自充允许范围配置项 MUST 依据返回元数据渲染
|
||||
- **AND** 前端 MUST NOT 为读取允许范围调用专用接口
|
||||
|
||||
#### Scenario: 以枚举控件编辑允许范围
|
||||
|
||||
- **GIVEN** 允许范围配置项返回非空 `enum_values`
|
||||
- **WHEN** 超级管理员编辑该项
|
||||
- **THEN** 页面 MUST 使用枚举选择控件渲染允许范围
|
||||
- **AND** 页面 MUST 以字符串化 `value` 调用 `PUT /api/admin/system-configs/{key}`
|
||||
- **AND** 页面 MUST 在提交前校验取值属于 `enum_values`
|
||||
- **AND** 允许范围枚举值 MUST 以中文标签展示,包括仅微信支付、仅支付宝支付与同时支持微信与支付宝
|
||||
|
||||
#### Scenario: 不硬编码配置 Key
|
||||
|
||||
- **WHEN** 前端实现允许范围配置项的展示与编辑
|
||||
- **THEN** 前端 MUST NOT 硬编码该配置项的 `config_key`
|
||||
- **AND** 前端 MUST 依据 `config_key`、`module`、`value_type`、`control` 与 `enum_values` 等元数据驱动渲染
|
||||
- **AND** 该配置项归属 `c2b.payment` 模块,前端 MUST NOT 扩展模块枚举取值
|
||||
|
||||
#### Scenario: 代理自充设置菜单带入模块筛选
|
||||
|
||||
- **GIVEN** 当前登录账号为超级管理员
|
||||
- **WHEN** 用户点击「代理自充设置」菜单
|
||||
- **THEN** 前端 MUST 跳转到系统配置页面并携带 `module=c2b.payment`
|
||||
- **AND** 系统配置页面 MUST 使用该 query 初始化模块筛选并据此查询配置列表
|
||||
- **AND** 非超级管理员 MUST NOT 看到该菜单
|
||||
|
||||
#### Scenario: 允许范围对代理与平台不可见
|
||||
|
||||
- **WHEN** 当前登录账号不是超级管理员
|
||||
- **THEN** 前端 MUST NOT 向代理与平台账号展示允许范围配置的入口或当前值
|
||||
- **AND** 代理与平台账号 MUST 只能通过 `GET /api/admin/agent-self-recharge-payment-methods` 获取实际可用方式
|
||||
@@ -0,0 +1,55 @@
|
||||
## 1. Contract and API Types
|
||||
|
||||
- [x] 1.1 `src/types/api/agentRecharge.ts`:`AgentRecharge` 新增 `external_transaction_no`、`offline_payment_method_id`、`offline_payment_method_code`、`offline_payment_method_name`、`other_voucher_key`(`string[] | null`),保持 `payment_transaction_id` 与 `payment_voucher_key` 语义不变。
|
||||
- [x] 1.2 扩展 `CreateAgentRechargeOfflineRequest`:新增必填 `offline_payment_method_id`、必填 `external_transaction_no`、可选 `other_voucher_key`(最多 5 个)。
|
||||
- [x] 1.3 新增 `AgentRechargePaymentVoucherOcrRequest { payment_voucher_key }` 与 `AgentRechargePaymentVoucherOcrResponse { external_transaction_no }`。
|
||||
- [x] 1.4 在 `src/types/api/index.ts` 导出新增类型。
|
||||
|
||||
## 2. Agent Recharge Service
|
||||
|
||||
- [x] 2.1 `src/api/modules/agentRecharge.ts` 新增 `getSelfRechargePaymentMethods()`,请求 `GET /api/admin/agent-self-recharge-payment-methods`。
|
||||
- [x] 2.2 新增 `recognizePaymentVoucher(data)`,请求 `POST /api/admin/agent-recharges/payment-voucher-ocr`,超时不低于 30000 毫秒。
|
||||
- [x] 2.3 保留旧 `getPaymentMethods()` 方法,但页面不再调用。
|
||||
|
||||
## 3. Online Recharge Available Methods
|
||||
|
||||
- [x] 3.1 在线充值弹窗改用 `getSelfRechargePaymentMethods()` 读取 `methods` / `min_amount` / `max_amount`,并把 `wechat`、`alipay` 映射为微信、支付宝选项。
|
||||
- [x] 3.2 `methods` 为空时提示「当前暂无可用的在线支付方式」并禁用提交,不解释原因。
|
||||
- [x] 3.3 超管视角不请求该接口(403 兜底);允许范围变更后不刷新已创建的待支付单。
|
||||
|
||||
## 4. Super Admin Allow-Range Config
|
||||
|
||||
- [x] 4.1 允许范围沿用系统配置页通用渲染:`GET /api/admin/system-configs` 读取、`PUT /api/admin/system-configs/{key}` 提交字符串化 `value`;不新增专用接口与专用页面。
|
||||
- [x] 4.2 `wechat_only` / `alipay_only` / `both` 在系统配置页展示与选择时显示中文标签,未命中映射时回退原值。
|
||||
- [x] 4.3 新增「代理自充设置」菜单(仅超级管理员),跳转到系统配置页面并带 `module=c2b.payment`;系统配置页支持从 `route.query.module` 初始化模块筛选。
|
||||
- [x] 4.4 在 `zh.json`、`en.json` 的 `menus.settings` 下补充 `agentSelfRecharge` 中英文文案,并清理系统配置页预存的空样式块。
|
||||
|
||||
## 5. Offline Pre-deposit Create Dialog
|
||||
|
||||
- [x] 5.1 新增「收款方式」下拉,数据来自 `GET /api/admin/employee-collection-payment-methods`(`enabled=true`、`page_size=100`),必填,提交 `offline_payment_method_id`。
|
||||
- [x] 5.2 新增「交易流水号」输入(必填、可编辑),并提示对照凭证核对。
|
||||
- [x] 5.3 新增「其他凭证」上传(可选,最多 5 个),提交 `other_voucher_key`;支付凭证仍必填且至少 1 个,两者分开提交。
|
||||
- [x] 5.4 `VoucherUpload` 新增可选 `contentType` prop 并透传给 `getUploadUrl` 与 `uploadFile`;代理充值线下凭证固定传 `image/jpeg`。
|
||||
- [x] 5.5 线下提交体按契约组装:`{ amount, payment_method: offline, shop_id, offline_payment_method_id, external_transaction_no, payment_voucher_key, other_voucher_key, remark }`,未填写的可选字段不提交。
|
||||
|
||||
## 6. Voucher OCR Prefill
|
||||
|
||||
- [x] 6.1 支付凭证区新增「识别凭证」按钮,取第一个已上传凭证 Key;未上传凭证时禁用。
|
||||
- [x] 6.2 识别期间展示 loading(按钮与交易流水号字段)并防重复点击,超时不低于 30 秒。
|
||||
- [x] 6.3 识别成功写入 `external_transaction_no`,字段保持可编辑;失败只提示,不清空已填内容、不阻断提交。
|
||||
- [x] 6.4 不预填金额、付款人、付款时间与备注。
|
||||
|
||||
## 7. List and Detail Display
|
||||
|
||||
- [x] 7.1 列表新增线下交易流水号与线下收款方式(`offline_payment_method_name` 快照)展示,仅线下单展示。
|
||||
- [x] 7.2 详情新增交易流水号、收款方式(`offline_payment_method_code` 与 `offline_payment_method_name` 快照)与其他凭证预览;在线单只展示 `payment_transaction_id`。
|
||||
- [x] 7.3 不使用 `offline_payment_method_id` 反查字典当前值,也不做交易流水号重复校验。
|
||||
- [x] 7.4 列表不新增交易流水号筛选,保持后端已有查询参数集合不变。
|
||||
|
||||
## 8. Verification
|
||||
|
||||
- [ ] 8.1 校验 `methods` 为空、超管调用新接口 403、允许范围变更不影响存量待支付单三种情况。
|
||||
- [ ] 8.2 校验 OCR 成功、失败、超时三条路径均不阻断人工填写与提交。
|
||||
- [ ] 8.3 校验线下单与在线单的两类交易号、收款方式快照与其他凭证展示正确。
|
||||
- [x] 8.4 运行 `npm run build`(含 `vue-tsc --noEmit`)与 `npm run check:encoding`。
|
||||
- [x] 8.5 运行 `openspec validate update-agent-self-recharge-and-offline-approval --strict`。
|
||||
@@ -0,0 +1,19 @@
|
||||
# Change: 统一资产套餐流量展示文案
|
||||
|
||||
## Why
|
||||
|
||||
资产信息页的当前生效套餐和套餐列表对同一虚流量数据使用了不一致且容易造成误解的展示文案。需要按业务术语统一为更通用的流量用量表述。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 将“当前生效套餐”中虚流量统计区域的标题从“虚流量使用”调整为“流量用量”。
|
||||
- 将“套餐列表”流量字段中虚流量已用值的标签从“已使用虚流量”调整为“已使用流量”。
|
||||
- 保持现有流量字段、数值计算、进度条、可见性权限和接口契约不变。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: `asset-package-traffic-display`
|
||||
- Affected code:
|
||||
- `src/views/asset-management/asset-information/components/CurrentPackageCard.vue`
|
||||
- `src/views/asset-management/asset-information/components/PackageListCard.vue`
|
||||
- Dependencies: `update-asset-package-traffic-threshold-layout` 中定义的套餐流量展示能力
|
||||
@@ -0,0 +1,19 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Asset Package Traffic Terminology
|
||||
|
||||
The asset information page SHALL use the approved traffic terminology while retaining the existing virtual traffic data source and display behavior.
|
||||
|
||||
#### Scenario: Current package displays the traffic usage heading
|
||||
|
||||
- **GIVEN** 当前生效套餐的虚流量统计区域可见
|
||||
- **WHEN** 页面渲染该统计区域
|
||||
- **THEN** 系统 MUST 将区域标题显示为“流量用量”
|
||||
- **AND** 系统 MUST NOT 显示“虚流量使用”作为该区域标题
|
||||
|
||||
#### Scenario: Package list displays the used traffic label
|
||||
|
||||
- **GIVEN** 套餐列表记录的虚流量统计区域可见
|
||||
- **WHEN** 页面渲染该记录的已用流量值
|
||||
- **THEN** 系统 MUST 将字段标签显示为“已使用流量”
|
||||
- **AND** 系统 MUST NOT 显示“已使用虚流量”作为该字段标签
|
||||
@@ -0,0 +1,5 @@
|
||||
## 1. Implementation
|
||||
|
||||
- [x] 1.1 将当前生效套餐虚流量统计区域标题更新为“流量用量”。
|
||||
- [x] 1.2 将套餐列表虚流量已用字段标签更新为“已使用流量”。
|
||||
- [x] 1.3 验证文案变更不影响现有流量数值、进度条和权限可见性。
|
||||
@@ -0,0 +1,27 @@
|
||||
# Change: 调整资产套餐真虚流量展示布局
|
||||
|
||||
## Why
|
||||
|
||||
资产信息页“当前生效套餐”和“套餐列表”目前将虚流量停机阈值及其断点标记放在虚流量使用区块,而真流量剩余未直接关联停机阈值。业务需要让停机阈值和断点与真流量剩余在同一区域展示,同时使虚流量区块完整呈现其基于真流量总量计算的总量和剩余。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 在“当前生效套餐”和“套餐列表”的管理员/平台双流量视图中,将“虚流量停机阈值”展示项移至“真流量剩余”之后,继续显示现有的 `virtual_total_mb` 值。
|
||||
- 将虚流量停机阈值对应的断点标记从虚流量进度条移至真流量进度条;断点位置继续按 `virtual_total_mb / real_total_mb` 计算。
|
||||
- 在“虚流量使用”区块的“已使用”后新增:
|
||||
- “总量”:显示真流量总量 `real_total_mb`。
|
||||
- “剩余”:按 `real_total_mb - virtual_used_mb` 计算。
|
||||
- 保持真流量和虚流量进度条的现有计算口径、字段来源、权限控制及非管理员单一流量展示不变。
|
||||
- 不修改后端接口、响应字段或数据模型。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs:
|
||||
- `asset-package-traffic-display`
|
||||
- `asset-package-traffic-permissions`
|
||||
- Affected code:
|
||||
- `src/views/asset-management/asset-information/components/CurrentPackageCard.vue`
|
||||
- `src/views/asset-management/asset-information/components/PackageListCard.vue`
|
||||
- Dependencies:
|
||||
- 继续使用现有套餐流量字段:`real_total_mb`、`real_used_mb`、`virtual_used_mb`、`virtual_total_mb`
|
||||
- 继续使用权限 `asset_info:view_current_package_real_usage` 和 `asset_info:view_current_package_virtual_usage`
|
||||
@@ -0,0 +1,55 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Virtual Traffic Threshold Aligns With Real Traffic Remaining
|
||||
|
||||
For super admins and platform users, the asset information page SHALL display the virtual traffic stop threshold immediately after real traffic remaining in both the `当前生效套餐` card and each applicable `套餐列表` row.
|
||||
|
||||
The displayed stop-threshold value MUST continue to use `virtual_total_mb`. The corresponding breakpoint marker MUST render on the real traffic progress bar and MUST continue to calculate its position as `virtual_total_mb / real_total_mb`.
|
||||
|
||||
#### Scenario: Current package shows threshold and breakpoint with real traffic
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 为 `1` 或 `2`
|
||||
- **AND** 当前套餐可展示真流量和虚流量使用信息
|
||||
- **WHEN** 页面渲染“当前生效套餐”的流量信息
|
||||
- **THEN** 系统 MUST 在真流量剩余后展示虚流量停机阈值
|
||||
- **AND** 停机阈值 MUST 显示 `virtual_total_mb` 的现有格式化值
|
||||
- **AND** 系统 MUST 将停机阈值断点标记渲染在真流量进度条
|
||||
- **AND** 断点位置 MUST 按 `virtual_total_mb / real_total_mb` 计算
|
||||
- **AND** 系统 MUST NOT 在虚流量进度条渲染该断点标记
|
||||
|
||||
#### Scenario: Package list shows threshold and breakpoint with real traffic
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 为 `1` 或 `2`
|
||||
- **AND** 套餐列表中的记录可展示真流量和虚流量使用信息
|
||||
- **WHEN** 页面渲染该记录的流量信息
|
||||
- **THEN** 系统 MUST 在真流量剩余后展示虚流量停机阈值
|
||||
- **AND** 停机阈值 MUST 显示该记录的 `virtual_total_mb` 的现有格式化值
|
||||
- **AND** 系统 MUST 将该记录的停机阈值断点标记渲染在真流量进度条
|
||||
- **AND** 断点位置 MUST 按该记录的 `virtual_total_mb / real_total_mb` 计算
|
||||
- **AND** 系统 MUST NOT 在虚流量进度条渲染该断点标记
|
||||
|
||||
### Requirement: Virtual Traffic Usage Displays Real Total And Remaining
|
||||
|
||||
For super admins and platform users, the `虚流量使用` section on the asset information page SHALL display virtual traffic used, real traffic total, and remaining virtual traffic capacity in that order in both the `当前生效套餐` card and each applicable `套餐列表` row.
|
||||
|
||||
The total MUST use `real_total_mb`. The remaining value MUST be calculated as `real_total_mb - virtual_used_mb`.
|
||||
|
||||
#### Scenario: Current package virtual traffic shows total and remaining
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 为 `1` 或 `2`
|
||||
- **AND** 当前套餐可展示虚流量使用信息
|
||||
- **WHEN** 页面渲染“当前生效套餐”的虚流量使用区块
|
||||
- **THEN** 系统 MUST 在虚流量已使用后展示总量
|
||||
- **AND** 总量 MUST 显示 `real_total_mb` 的现有格式化值
|
||||
- **AND** 系统 MUST 在总量后展示剩余
|
||||
- **AND** 剩余 MUST 显示 `real_total_mb - virtual_used_mb` 的现有格式化值
|
||||
|
||||
#### Scenario: Package list virtual traffic shows total and remaining
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 为 `1` 或 `2`
|
||||
- **AND** 套餐列表中的记录可展示虚流量使用信息
|
||||
- **WHEN** 页面渲染该记录的虚流量使用区块
|
||||
- **THEN** 系统 MUST 在虚流量已使用后展示总量
|
||||
- **AND** 总量 MUST 显示该记录的 `real_total_mb` 的现有格式化值
|
||||
- **AND** 系统 MUST 在总量后展示剩余
|
||||
- **AND** 剩余 MUST 显示 `real_total_mb - virtual_used_mb` 的现有格式化值
|
||||
@@ -0,0 +1,22 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Traffic Threshold And Virtual Statistics Follow Existing Usage Permissions
|
||||
|
||||
The asset information page SHALL apply the existing real and virtual traffic usage permissions to the relocated virtual traffic stop threshold, breakpoint marker, and added virtual traffic statistics.
|
||||
|
||||
#### Scenario: Hidden real traffic usage also hides relocated threshold and breakpoint
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 为 `1` 或 `2`
|
||||
- **AND** 账号缺少 `asset_info:view_current_package_real_usage` 权限
|
||||
- **WHEN** 页面渲染“当前生效套餐”或“套餐列表”的套餐流量信息
|
||||
- **THEN** 系统 MUST NOT 显示真流量统计
|
||||
- **AND** 系统 MUST NOT 显示位于真流量区域的虚流量停机阈值
|
||||
- **AND** 系统 MUST NOT 显示位于真流量进度条的停机阈值断点标记
|
||||
|
||||
#### Scenario: Hidden virtual traffic usage also hides added virtual statistics
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 为 `1` 或 `2`
|
||||
- **AND** 账号缺少 `asset_info:view_current_package_virtual_usage` 权限
|
||||
- **WHEN** 页面渲染“当前生效套餐”或“套餐列表”的套餐流量信息
|
||||
- **THEN** 系统 MUST NOT 显示虚流量使用区块
|
||||
- **AND** 系统 MUST NOT 显示虚流量区块中的已使用、总量或剩余统计
|
||||
@@ -0,0 +1,16 @@
|
||||
## 1. Implementation
|
||||
|
||||
- [x] 1.1 调整“当前生效套餐”真流量统计项,在真流量剩余后展示虚流量停机阈值,并保持 `virtual_total_mb` 的现有值格式化规则。
|
||||
- [x] 1.2 将“当前生效套餐”的停机阈值断点标记移至真流量进度条,继续按 `virtual_total_mb / real_total_mb` 定位。
|
||||
- [x] 1.3 调整“当前生效套餐”虚流量统计项,在已使用后展示真流量总量和按 `real_total_mb - virtual_used_mb` 计算的剩余量。
|
||||
- [x] 1.4 对套餐列表的每条管理员/平台套餐记录应用相同的阈值、断点和虚流量统计布局。
|
||||
- [x] 1.5 保持非管理员单一流量展示、现有权限可见性和各进度条百分比计算不变。
|
||||
|
||||
## 2. Verification
|
||||
|
||||
- [x] 2.1 验证“当前生效套餐”中停机阈值显示在真流量剩余后,且其值仍为 `virtual_total_mb`。
|
||||
- [x] 2.2 验证“当前生效套餐”中断点显示在真流量进度条,且其位置仍按 `virtual_total_mb / real_total_mb` 计算。
|
||||
- [x] 2.3 验证“当前生效套餐”虚流量使用依次显示已使用、总量(`real_total_mb`)和剩余(`real_total_mb - virtual_used_mb`)。
|
||||
- [x] 2.4 验证套餐列表的管理员/平台套餐记录具有与当前生效套餐一致的展示布局和计算结果。
|
||||
- [x] 2.5 验证真流量或虚流量查看权限缺失时,不展示该权限对应的统计项及关联阈值/断点内容。
|
||||
- [x] 2.6 验证非管理员账号继续使用现有单一流量展示,且真流量与虚流量进度百分比不变。
|
||||
@@ -32,11 +32,11 @@
|
||||
- Decision: 业务列表创建导出任务按钮继续使用来源业务权限,默认建议如下。
|
||||
- Rationale: 创建导出任务属于来源业务列表能力,不应因为拥有某个导出任务管理页面权限就获得业务列表导出入口。
|
||||
|
||||
| 入口 | 创建导出任务权限 | scene |
|
||||
| --- | --- | --- |
|
||||
| 设备管理 | `devices:export` | `device` |
|
||||
| 入口 | 创建导出任务权限 | scene |
|
||||
| ---------- | ----------------- | ---------- |
|
||||
| 设备管理 | `devices:export` | `device` |
|
||||
| IOT 卡管理 | `iot_card:export` | `iot_card` |
|
||||
| 订单列表 | `orders:export` | `order` |
|
||||
| 订单列表 | `orders:export` | `order` |
|
||||
|
||||
- Decision: 详情页可继续复用同一组件,但必须根据任务场景或来源页面使用对应场景的详情、下载、取消权限。
|
||||
- Rationale: 详情页面本身也包含下载和取消按钮,若继续使用通用权限会绕过三个列表页面的按钮隔离要求。
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
## Context
|
||||
|
||||
顶部通知抽屉已经通过通知列表接口加载最近 10 条,但当前共享状态没有保存列表分页信息。分页应复用现有通知列表接口,避免新增接口或改变通知数据契约。
|
||||
|
||||
## Decisions
|
||||
|
||||
- Decision: 分页状态由通知 store 保存,包括当前页、每页数量和总条数;列表请求返回后整体替换 `recentNotifications`。
|
||||
- Decision: 页码切换使用 `GET /api/admin/notifications?page=<page>&page_size=10`,加载期间沿用现有 loading 状态。
|
||||
- Decision: 分类切换将页码重置为 1,并重新加载列表;不使用滚动事件触发请求。
|
||||
- Decision: 分页控件放在通知列表底部,列表区域继续保持固定高度,避免抽屉整体布局跳动。
|
||||
|
||||
## Risks / Trade-offs
|
||||
|
||||
- 分类当前由抽屉对已加载页面进行过滤,分类页的总数仍由通知列表接口返回的总体 `total` 表示;本次不扩展后端分类分页契约。
|
||||
@@ -0,0 +1,24 @@
|
||||
# Change: 通知抽屉改为分页浏览
|
||||
|
||||
## Why
|
||||
|
||||
顶部通知抽屉目前只展示最近 10 条通知,用户无法通过页码查看更早的通知。通知列表应使用明确的分页操作,避免依赖下滑加载更多的交互。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 顶部通知抽屉增加页码分页控件,默认每页展示 10 条。
|
||||
- 切换页码时调用通知列表接口并替换当前列表,不追加滚动加载。
|
||||
- 切换通知分类时重置到第 1 页,并保持现有分类统计、已读和跳转行为。
|
||||
- 保留 `/api/admin/notifications` 的 `page`、`page_size` 分页参数和后端返回的 `total`。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs:
|
||||
- `notification-center`
|
||||
- Affected code:
|
||||
- `src/components/core/layouts/art-notification/index.vue`
|
||||
- `src/components/core/layouts/art-notification/style.scss`
|
||||
- `src/store/modules/notification.ts`
|
||||
- Out of scope:
|
||||
- 不改变通知接口、通知分类统计和已读接口。
|
||||
- 不接入下滑加载、无限滚动或新的实时推送机制。
|
||||
@@ -0,0 +1,22 @@
|
||||
## MODIFIED Requirements
|
||||
|
||||
### Requirement: Global Notification Bell
|
||||
|
||||
The admin frontend SHALL provide a global notification bell in the top navigation near the settings and user avatar entries.
|
||||
|
||||
#### Scenario: Display unread count
|
||||
|
||||
- **GIVEN** 用户已登录后台
|
||||
- **WHEN** 顶部导航加载未读通知数量
|
||||
- **THEN** 铃铛 MUST call `GET /api/admin/notifications/unread-count`
|
||||
- **AND** 数量 MUST display as `0`, `1` through `99`, or `99+`
|
||||
|
||||
#### Scenario: Open paginated notification drawer
|
||||
|
||||
- **WHEN** 用户点击顶部通知铃铛
|
||||
- **THEN** 页面 MUST display notification items from `GET /api/admin/notifications` using `page=1` and `page_size=10`
|
||||
- **AND** 抽屉 MUST provide 全部、审批、临期、同步/系统分类
|
||||
- **AND** 抽屉 MUST provide page controls based on the response `total`
|
||||
- **AND** changing page MUST replace the visible items instead of appending items from a scroll event
|
||||
- **AND** changing category MUST reset the page to 1
|
||||
- **AND** 抽屉 MUST provide an entry to `/notifications`
|
||||
@@ -0,0 +1,15 @@
|
||||
## 1. Notification State
|
||||
|
||||
- [x] 1.1 在通知 store 中保存当前页、每页数量和列表总数。
|
||||
- [x] 1.2 支持按指定页请求通知,并用新结果替换当前列表。
|
||||
|
||||
## 2. Notification Drawer
|
||||
|
||||
- [x] 2.1 在通知列表底部增加页码分页控件,默认每页 10 条。
|
||||
- [x] 2.2 切换页码时重新请求列表并回到列表顶部。
|
||||
- [x] 2.3 切换分类时重置页码并保持现有分类、已读和跳转行为。
|
||||
|
||||
## 3. Verification
|
||||
|
||||
- [x] 3.1 验证分页请求携带正确的 `page` 和 `page_size`,且列表不会累加旧页数据。
|
||||
- [x] 3.2 运行通知相关 lint、类型、格式、样式和编码检查;当前仓库暂无通知专项测试。
|
||||
@@ -0,0 +1,54 @@
|
||||
# 商户池详情与商户凭证契约设计
|
||||
|
||||
## Context
|
||||
|
||||
支付商户与商户池管理页已经上线,运营在使用时遇到三个问题:商户池详情入口和支付商户不一致且信息不完整、新增商户池直接报错、商户凭证缺少字段枚举与类型校验。本次优化只新增详情页、收敛成员顺序数据源,并在既有凭证写入表单上叠加契约校验,不改变接口路径与请求结构。
|
||||
|
||||
## Goals
|
||||
|
||||
- 让商户池详情的入口和展示完整度与支付商户详情对齐。
|
||||
- 让新增/编辑商户池恢复可用,并且拖拽排序结果仍按顺序提交。
|
||||
- 让前端提交的商户凭证满足后端的字段枚举、必填键、值类型与商户标识约束。
|
||||
|
||||
## Non-Goals
|
||||
|
||||
- 不改变“更换凭证”表单的交互方式与凭证值不回显约束。
|
||||
- 不新增后端接口。
|
||||
|
||||
## Decisions
|
||||
|
||||
### 商户池详情复用支付商户详情的入口模式
|
||||
|
||||
支付商户详情已采用“列表点击名称 → 独立详情页”的模式,因此商户池改为同样方式:列表名称列渲染为可点击文本,点击后跳转 `/settings/payment-merchant-pools/pool-detail/:id`,并移除行操作里的“详情”抽屉。
|
||||
|
||||
详情页复用 `src/components/common/DetailPage.vue`,按“基本信息”“轮询配置”“运行状态”三组展示字段。创建时间、更新时间只在接口返回时渲染,避免出现空白字段行。
|
||||
|
||||
替代方案是保留抽屉并补齐字段;但两个详情入口不一致会让运营难以形成稳定预期,因此不采用。
|
||||
|
||||
### 成员商户名称由前端解析
|
||||
|
||||
详情接口只返回 `member_ids`。详情页在加载详情后按该商户池的 `payment_method` 拉取支付商户列表,把成员 ID 映射为商户名称展示,同时保留成员数量。解析不到名称时展示“未知商户”,不展示 `member_ids` 原始 ID,避免把内部标识暴露给运营。
|
||||
|
||||
### 成员顺序使用单一数据源
|
||||
|
||||
原实现同时监听 `form.member_ids` 和 `orderedMemberIds`,并在两个回调中互相赋新数组,形成“赋值 → 触发 → 再赋值”的无限循环,从而在新增商户池时触发 `Maximum recursive updates exceeded`。
|
||||
|
||||
修复方式是把成员顺序收敛为单一数据源:`orderedMemberIds` 改为基于 `form.member_ids` 的 `computed`(get 返回成员数组,set 写回成员数组)。`VueDraggable` 通过 `v-model` 触发 setter 写回 `form.member_ids`,不再存在互相触发的 watch。
|
||||
|
||||
### 凭证字段枚举固化在类型模块并在提交前校验
|
||||
|
||||
凭证必填键由后端契约按 `payment_method` 与 `provider_type` 组合给出,前端与该契约保持一致,因此把枚举定义在 `src/types/api/paymentMerchantPools.ts`:`PAYMENT_CREDENTIAL_FIELD_SPECS` 描述每个 `provider_type` 的必填键与可选键,`PAYMENT_CREDENTIAL_BOOLEAN_KEYS`、`PAYMENT_CREDENTIAL_INTEGER_KEYS` 描述 `ali_production`、`ali_pay_expire_minutes` 的值类型,`PAYMENT_MERCHANT_IDENTITY_KEYS` 描述商户标识必须一致的凭证字段。枚举之外的字段名一律拦截,避免提交必然被后端拒绝的请求。
|
||||
|
||||
`buildPaymentCredentials` 负责提交前校验并转换:拒绝不属于当前服务商的字段名、补齐必填键检查、把布尔字段与整数字段从输入框字符串转换为布尔值/数字、校验 `merchant_identity` 与对应凭证字段一致。表单继续使用“字段名 + 字段值”的通用编辑方式,只在分隔线下方展示当前服务商的必填/可选字段提示。
|
||||
|
||||
替代方案是把凭证表单改成按服务商渲染固定中文标签字段;该方案会改变既有交互与凭证只写约定,本次不采用。
|
||||
|
||||
### 凭证仅平台账号可读写
|
||||
|
||||
凭证读取与写入入口复用既有平台账号限制:`/settings/payment-merchant-pools` 及其详情路由都带 `allowedUserTypes: [1, 2]`,页面内 `canManage` 再按 `isPlatformAccount` 过滤操作。凭证值只在当前编辑会话内存中存在,提交、取消或关闭后清空,不进入 Pinia 持久化、浏览器存储、日志或错误上报。
|
||||
|
||||
## Risks and Trade-offs
|
||||
|
||||
- 详情页与支付商户详情一样受 `allowedUserTypes: [1, 2]` 限制,代理与企业账号无法访问。
|
||||
- 商户池成员名称依赖支付商户列表接口,成员数量超过单页上限时可能解析不到名称,此时展示“未知商户”而不是原始 ID。
|
||||
- 凭证字段枚举与后端校验规则必须保持一致;后端新增字段时前端需要同步更新枚举,否则提交会被前端拦截。
|
||||
@@ -0,0 +1,48 @@
|
||||
# Change: 商户池详情与商户凭证契约
|
||||
|
||||
## Why
|
||||
|
||||
`docs/产品迭代8月份/支付商户优化.md` 记录了支付商户与商户池管理页的三个问题,加上运营补充的凭证契约与权限要求,本次处理三件事:
|
||||
|
||||
- 商户池详情与支付商户详情的入口不一致:支付商户是点击名称进入独立详情页,商户池却是行操作里的详情抽屉,且详情没有展示接口已返回的全部字段(例如 `time_period_started_at`),成员只给出数量。
|
||||
- 点击“新增商户池”时页面抛出 `Maximum recursive updates exceeded in component <PaymentMerchantPoolManagement>`,新增和编辑商户池流程完全不可用。
|
||||
- 商户凭证的字段契约此前只存在于接口文档:必填键由 `payment_method` 与 `provider_type` 组合决定,前端提交前没有字段枚举与类型校验,容易出现漏填必填键、`ali_production` / `ali_pay_expire_minutes` 以字符串提交、`merchant_identity` 与凭证字段不一致等会被后端拒绝的请求。
|
||||
|
||||
“更换凭证”表单的交互(手工逐行填写字段名与字段值、值不回显)按反馈保持原有行为,本次只在其上叠加字段契约校验。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 新增商户池详情页,并改为点击列表中商户池名称进入,与支付商户详情保持一致;移除列表行操作中的“详情”入口。
|
||||
- 商户池详情页展示详情接口返回的业务字段:商户池名称、支付方式、启停状态、成员数量、成员商户、轮询策略、统计周期、金额/笔数/时间阈值、时间起点、路由世代、备注,以及接口返回时的创建时间和更新时间。
|
||||
- 成员商户按支付商户名称展示,不展示 `member_ids` 原始 ID;名称无法解析时展示“未知商户”占位文案。
|
||||
- 合并商户池表单中 `form.member_ids` 与 `orderedMemberIds` 的双向 `watch` 为单一数据源,消除递归更新错误,同时保持拖拽排序结果按顺序提交。
|
||||
- 将商户凭证字段枚举(各 `payment_method` + `provider_type` 组合的必填键与可选键)固化到前端类型模块,并在提交前校验字段枚举、必填键、值类型(布尔/整数/字符串)与 `merchant_identity` 一致性。
|
||||
- 凭证写入表单展示当前服务商组合的必填/可选字段提示,降低漏填必填键的概率。
|
||||
- 明确凭证访问控制:仅超级管理员(`user_type=1`)与平台用户(`user_type=2`)可读写商户凭证,凭证内容不进入日志、审计与支付快照。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: `payment-merchant-pool-management`
|
||||
- Affected code:
|
||||
- `src/views/settings/payment-merchant-pools/pool-detail.vue`(新增)
|
||||
- `src/views/settings/payment-merchant-pools/components/PoolManagement.vue`
|
||||
- `src/views/settings/payment-merchant-pools/components/MerchantManagement.vue`
|
||||
- `src/types/api/paymentMerchantPools.ts`
|
||||
- `src/router/routes/asyncRoutes.ts`
|
||||
- `src/router/routesAlias.ts`
|
||||
- `src/locales/langs/zh.json`、`src/locales/langs/en.json`
|
||||
- Dependencies:
|
||||
- 后端 `GET /api/admin/payment-merchant-pools/{id}` 返回 `member_ids`、`routing_epoch`、`time_period_started_at` 等字段。
|
||||
- 后端按 `payment_method` 与 `provider_type` 组合校验凭证必填键与值类型。
|
||||
- 成员商户名称由前端使用同 `payment_method` 的支付商户列表解析,不要求后端在商户池详情返回名称。
|
||||
- Compatibility:
|
||||
- 不改变“更换凭证”表单的交互方式与凭证值不回显约束。
|
||||
- 不影响支付商户列表与支付商户详情页的信息结构。
|
||||
- 不改变商户池创建、更新、启用、停用的请求结构。
|
||||
|
||||
## Non-Goals
|
||||
|
||||
- 不按服务商渲染带中文标签的固定凭证表单,仍保留“字段名 + 字段值”的通用编辑方式。
|
||||
- 不新增商户池详情、凭证校验之外的后端接口。
|
||||
- 不在商户池详情页展示 `id`、`member_ids` 等内部标识。
|
||||
- 不改动商户池轮询策略、成员排序规则和阈值换算规则。
|
||||
@@ -0,0 +1,155 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: 商户池详情入口
|
||||
|
||||
系统 SHALL 与支付商户保持一致,以点击列表中商户池名称的方式进入独立详情页,并且不再在行操作中提供“详情”入口。
|
||||
|
||||
#### Scenario: 点击商户池名称进入详情页
|
||||
|
||||
- **GIVEN** 管理员位于支付商户与商户池管理页的“商户池”页签
|
||||
- **WHEN** 管理员点击列表中某个商户池名称
|
||||
- **THEN** 系统 MUST 跳转到该商户池的详情页
|
||||
- **AND** 详情页 MUST 通过 `GET /api/admin/payment-merchant-pools/{id}` 加载数据
|
||||
- **AND** 列表行操作 MUST NOT 再提供“详情”操作
|
||||
|
||||
#### Scenario: 商户池名称以可点击样式展示
|
||||
|
||||
- **GIVEN** 商户池列表加载成功
|
||||
- **WHEN** 页面渲染商户池名称列
|
||||
- **THEN** 商户池名称 MUST 以可点击样式展示
|
||||
- **AND** 点击名称 MUST NOT 触发表格行选中或其他行操作
|
||||
|
||||
#### Scenario: 非平台账号不能查看商户池详情
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 不是 `1` 或 `2`
|
||||
- **WHEN** 用户点击商户池名称或直接访问商户池详情页地址
|
||||
- **THEN** 系统 MUST NOT 展示商户池详情数据
|
||||
- **AND** 路由 MUST 按平台账号限制拦截该访问
|
||||
|
||||
### Requirement: 商户池详情信息完整
|
||||
|
||||
系统 SHALL 在商户池详情页展示详情接口返回的全部业务字段,并 SHALL 以支付商户名称展示成员商户,不得展示 `id` 或 `member_ids` 原始标识。
|
||||
|
||||
#### Scenario: 展示轮询策略与阈值字段
|
||||
|
||||
- **GIVEN** 管理员进入某个商户池详情页
|
||||
- **WHEN** 详情数据加载成功
|
||||
- **THEN** 详情 MUST 展示商户池名称、支付方式、启停状态、轮询策略、路由世代和备注
|
||||
- **AND** `strategy` 为 `amount` 或 `count` 时 MUST 展示统计周期和对应阈值
|
||||
- **AND** `strategy` 为 `time` 时 MUST 展示时间单位、时间长度和时间起点
|
||||
|
||||
#### Scenario: 成员商户按名称展示
|
||||
|
||||
- **GIVEN** 商户池详情返回 `member_ids`
|
||||
- **WHEN** 页面展示成员信息
|
||||
- **THEN** 页面 MUST 展示成员商户名称和成员数量
|
||||
- **AND** 页面 MUST NOT 展示 `member_ids` 原始 ID
|
||||
- **AND** 成员名称无法解析时 MUST 展示“未知商户”而不是 ID
|
||||
|
||||
#### Scenario: 未返回的字段不渲染
|
||||
|
||||
- **GIVEN** 商户池详情接口未返回创建时间或更新时间
|
||||
- **WHEN** 页面展示商户池详情
|
||||
- **THEN** 页面 MUST NOT 渲染对应字段的空白行
|
||||
|
||||
### Requirement: 商户池成员顺序单一数据源
|
||||
|
||||
系统 SHALL 使用单一数据源维护商户池成员顺序,保证新增、编辑和拖拽排序成员时不会出现递归更新错误,并且提交顺序与页面展示顺序一致。
|
||||
|
||||
#### Scenario: 新增商户池不再递归更新
|
||||
|
||||
- **WHEN** 管理员点击“新增商户池”
|
||||
- **THEN** 系统 MUST NOT 抛出 `Maximum recursive updates exceeded`
|
||||
- **AND** 表单 MUST 正常打开并允许选择成员
|
||||
|
||||
#### Scenario: 拖拽后按展示顺序提交
|
||||
|
||||
- **GIVEN** 商户池表单中存在多个成员商户
|
||||
- **WHEN** 管理员拖拽调整成员顺序并提交
|
||||
- **THEN** `member_ids` MUST 按拖拽后的顺序提交
|
||||
- **AND** 再次编辑该商户池时 MUST 按提交顺序展示成员
|
||||
|
||||
### Requirement: 商户凭证字段枚举契约
|
||||
|
||||
系统 SHALL 按 `payment_method` 与 `provider_type` 组合枚举商户凭证的必填键与可选键,并在提交前校验字段枚举、必填键、值类型与商户标识一致性。
|
||||
|
||||
字段枚举以后端契约为准(键名与渠道配置字段一致),前端必须与后端保持一致,后端新增或调整字段时需同步更新前端枚举。`credentials` MUST 为扁平 JSON 对象,必填键为:
|
||||
|
||||
- `payment_method=wechat`、`provider_type=wechat`:`wx_mch_id`、`wx_api_v3_key`、`wx_cert_content`、`wx_key_content`、`wx_serial_no`、`wx_notify_url`
|
||||
- `payment_method=wechat`、`provider_type=wechat_v2`:`wx_mch_id`、`wx_api_v2_key`、`wx_notify_url`
|
||||
- `payment_method=wechat`、`provider_type=fuiou`:`fy_mchnt_cd`、`fy_ins_cd`、`fy_term_id`、`fy_private_key`、`fy_public_key`、`fy_api_url`、`fy_notify_url`
|
||||
- `payment_method=alipay`、`provider_type=alipay`:`ali_app_id`、`ali_private_key`、`ali_public_key`、`ali_notify_url`、`ali_return_url`
|
||||
|
||||
可选键为:`wechat` 可附 `wx_api_v2_key`;`alipay` 可附 `ali_production`(布尔,是否生产环境)与 `ali_pay_expire_minutes`(整数,支付过期分钟数)。除 `ali_production` 与 `ali_pay_expire_minutes` 外,凭证值 MUST 为字符串。`merchant_identity` MUST 分别等于 `wx_mch_id`、`fy_mchnt_cd` 或 `ali_app_id`。
|
||||
|
||||
#### Scenario: 提交微信直连凭证
|
||||
|
||||
- **GIVEN** 管理员提交 `payment_method=wechat`、`provider_type=wechat` 的商户凭证
|
||||
- **THEN** 请求 MUST 包含 `wx_mch_id`、`wx_api_v3_key`、`wx_cert_content`、`wx_key_content`、`wx_serial_no`、`wx_notify_url`
|
||||
- **AND** 请求 MAY 附带 `wx_api_v2_key`
|
||||
- **AND** `merchant_identity` MUST 等于 `wx_mch_id`
|
||||
|
||||
#### Scenario: 提交微信直连 V2 凭证
|
||||
|
||||
- **GIVEN** 管理员提交 `payment_method=wechat`、`provider_type=wechat_v2` 的商户凭证
|
||||
- **THEN** 请求 MUST 包含 `wx_mch_id`、`wx_api_v2_key`、`wx_notify_url`
|
||||
- **AND** `merchant_identity` MUST 等于 `wx_mch_id`
|
||||
|
||||
#### Scenario: 提交富友凭证
|
||||
|
||||
- **GIVEN** 管理员提交 `payment_method=wechat`、`provider_type=fuiou` 的商户凭证
|
||||
- **THEN** 请求 MUST 包含 `fy_mchnt_cd`、`fy_ins_cd`、`fy_term_id`、`fy_private_key`、`fy_public_key`、`fy_api_url`、`fy_notify_url`
|
||||
- **AND** `merchant_identity` MUST 等于 `fy_mchnt_cd`
|
||||
|
||||
#### Scenario: 提交支付宝凭证
|
||||
|
||||
- **GIVEN** 管理员提交 `payment_method=alipay`、`provider_type=alipay` 的商户凭证
|
||||
- **THEN** 请求 MUST 包含 `ali_app_id`、`ali_private_key`、`ali_public_key`、`ali_notify_url`、`ali_return_url`
|
||||
- **AND** 请求 MAY 附带 `ali_production` 与 `ali_pay_expire_minutes`
|
||||
- **AND** `merchant_identity` MUST 等于 `ali_app_id`
|
||||
|
||||
#### Scenario: 缺少必填字段时拒绝提交
|
||||
|
||||
- **WHEN** 提交的凭证缺少当前服务商组合的必填键
|
||||
- **THEN** 前端 MUST 阻止提交并提示缺失的凭证字段名
|
||||
|
||||
#### Scenario: 拒绝不属于当前服务商的凭证字段
|
||||
|
||||
- **WHEN** 提交的凭证包含必填键与可选键之外的字段名
|
||||
- **THEN** 前端 MUST 阻止提交并提示该字段不属于当前服务商支持的字段
|
||||
|
||||
#### Scenario: 校验凭证值类型
|
||||
|
||||
- **GIVEN** 凭证包含 `ali_production` 或 `ali_pay_expire_minutes`
|
||||
- **WHEN** 管理员提交凭证
|
||||
- **THEN** `ali_production` MUST 以布尔值提交
|
||||
- **AND** `ali_pay_expire_minutes` MUST 以正整数提交
|
||||
- **AND** 其余凭证字段 MUST 以字符串提交
|
||||
|
||||
#### Scenario: 校验商户标识一致性
|
||||
|
||||
- **WHEN** `merchant_identity` 与 `wx_mch_id`、`fy_mchnt_cd` 或 `ali_app_id` 的值不一致
|
||||
- **THEN** 前端 MUST 阻止提交并提示商户标识必须与对应凭证字段一致
|
||||
|
||||
### Requirement: 商户凭证访问控制
|
||||
|
||||
系统 SHALL 仅允许超级管理员(`user_type=1`)与平台用户(`user_type=2`)读取和写入商户凭证,且凭证内容 MUST NOT 进入日志、审计记录或支付快照。
|
||||
|
||||
#### Scenario: 平台账号可读写凭证
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 为 `1` 或 `2`
|
||||
- **WHEN** 账号打开支付商户管理页、支付商户详情页或提交商户凭证
|
||||
- **THEN** 系统 MUST 允许读取凭证配置状态与写入凭证
|
||||
|
||||
#### Scenario: 非平台账号不可读写凭证
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 为 `3` 或 `4`
|
||||
- **WHEN** 账号访问支付商户管理页或支付商户详情页
|
||||
- **THEN** 系统 MUST 拒绝访问并 MUST NOT 返回凭证字段或凭证状态
|
||||
- **AND** 页面 MUST NOT 渲染凭证写入入口
|
||||
|
||||
#### Scenario: 凭证不写入日志与快照
|
||||
|
||||
- **WHEN** 创建、更新或删除支付商户成功或失败
|
||||
- **THEN** 凭证内容 MUST NOT 出现在浏览器存储、页面日志、错误上报或支付快照中
|
||||
- **AND** 页面 MUST 只展示“已配置/未配置”状态与 `credential_version`
|
||||
@@ -0,0 +1,33 @@
|
||||
# Implementation Tasks
|
||||
|
||||
## 1. 商户池详情入口
|
||||
|
||||
- [x] 1.1 新增商户池详情页 `pool-detail.vue`,复用 `DetailPage` 展示基本信息、轮询配置和运行状态。
|
||||
- [x] 1.2 新增 `/settings/payment-merchant-pools/pool-detail/:id` 路由与路由别名,并按平台账号(`allowedUserTypes: [1, 2]`)限制访问。
|
||||
- [x] 1.3 商户池列表名称列改为可点击文本,点击跳转对应详情页;移除行操作中的“详情”入口。
|
||||
- [x] 1.4 补充中英文路由标题文案 `menus.settings.detailsOfPaymentMerchantPool`。
|
||||
|
||||
## 2. 商户池详情内容
|
||||
|
||||
- [x] 2.1 详情页展示详情接口返回的全部业务字段:名称、支付方式、启停状态、成员数量、成员商户、轮询策略、统计周期、金额/笔数/时间阈值、时间起点、路由世代和备注。
|
||||
- [x] 2.2 成员按支付商户名称展示,不展示 `member_ids` 原始 ID,无法解析时展示“未知商户”。
|
||||
- [x] 2.3 创建时间、更新时间等字段仅在接口返回时渲染,避免空白字段行。
|
||||
|
||||
## 3. 商户池表单稳定性
|
||||
|
||||
- [x] 3.1 将 `orderedMemberIds` 改为基于 `form.member_ids` 的单一数据源,移除互相赋值的双向 watch。
|
||||
- [x] 3.2 验证新增、编辑、切换支付方式、添加成员、移除成员和拖拽排序后提交的成员顺序正确。
|
||||
- 新增/编辑/切换支付方式直接重置 `form.member_ids`;添加与移除成员在 `form.member_ids` 上增删;拖拽经 `VueDraggable` 的 `v-model` 写回同一数组,`buildPayload` 按数组顺序提交。
|
||||
|
||||
## 4. 商户凭证字段枚举与校验
|
||||
|
||||
- [x] 4.1 在 `src/types/api/paymentMerchantPools.ts` 固化凭证字段枚举:`PAYMENT_CREDENTIAL_FIELD_SPECS`(各 `provider_type` 的必填键与可选键)、`PAYMENT_CREDENTIAL_BOOLEAN_KEYS`、`PAYMENT_CREDENTIAL_INTEGER_KEYS`、`PAYMENT_MERCHANT_IDENTITY_KEYS`。
|
||||
- [x] 4.2 实现 `buildPaymentCredentials`:校验字段枚举与必填键,把 `ali_production` 转为布尔值、`ali_pay_expire_minutes` 转为正整数,其余字段保持字符串,并校验 `merchant_identity` 与对应凭证字段一致。
|
||||
- [x] 4.3 支付商户凭证写入表单接入该校验,并在“写入支付凭证”分隔线下方展示当前服务商组合的必填/可选字段提示。
|
||||
- [x] 4.4 凭证读写仍仅限超级管理员(`user_type=1`)与平台用户(`user_type=2`):路由 `allowedUserTypes` 与页面 `canManage` 双层限制,凭证值不进入持久化、日志与错误上报。
|
||||
|
||||
## 5. 验证
|
||||
|
||||
- [x] 5.1 运行 `eslint`、`vue-tsc --noEmit` 与 `vite build`,确认改动通过类型检查和构建。
|
||||
- `eslint`(改动文件)、`vue-tsc --noEmit` 均通过;`vite build --mode development` 成功产出 `MerchantManagement`、`PoolManagement` 与 `pool-detail` chunk。
|
||||
- [x] 5.2 执行 `openspec validate update-payment-merchant-pool-optimization --strict`。
|
||||
@@ -0,0 +1,17 @@
|
||||
# Change: 使用授权套餐候选项接口创建代理系列授权
|
||||
|
||||
## Why
|
||||
|
||||
新增代理系列授权时,通用套餐分页接口不能按当前操作者、目标店铺和套餐系列返回真正可授权的套餐,也不能提供目标店铺已授权状态。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 新增代理系列授权弹窗的套餐选择改用 `GET /api/admin/shop-series-grants/package-options`。
|
||||
- 仅在已选择目标店铺和套餐系列后请求候选项接口,并原样传递 `shop_id` 与 `series_id`。
|
||||
- 以接口候选项作为可选集合,保留候选项的授权状态,且不再由前端额外过滤赠送套餐。
|
||||
- 为候选项接口增加前端 API 方法与类型定义,并用其价格字段初始化套餐成本价和建议零售价校验数据。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: `package-series-allocation`
|
||||
- Affected code: `src/api/modules/shopSeriesGrant.ts`, `src/types/api/packageManagement.ts`, `src/views/package-management/series-grants/index.vue`
|
||||
@@ -0,0 +1,17 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: 授权创建使用店铺系列套餐候选项
|
||||
|
||||
系统 SHALL 在新增代理系列授权时,使用 `GET /api/admin/shop-series-grants/package-options` 获取套餐候选项。前端 MUST 在目标店铺和套餐系列均已选择后,原样传递非空的 `shop_id` 与 `series_id`;接口返回的候选项 SHALL 作为可选套餐及其价格、授权状态的权威来源。
|
||||
|
||||
#### Scenario: 选择店铺和套餐系列后加载候选项
|
||||
|
||||
- **WHEN** 用户在新增代理系列授权弹窗中已选择目标店铺和套餐系列
|
||||
- **THEN** 前端请求 `/api/admin/shop-series-grants/package-options` 并携带所选 `shop_id` 与 `series_id`
|
||||
- **AND** 前端展示返回的候选套餐而不再调用通用套餐分页接口作为该弹窗的候选来源
|
||||
|
||||
#### Scenario: 更换店铺或套餐系列
|
||||
|
||||
- **WHEN** 用户更换目标店铺或套餐系列
|
||||
- **THEN** 前端清空此前的套餐候选项和已选择套餐
|
||||
- **AND** 仅使用新组合返回的候选项进行后续选择
|
||||
@@ -0,0 +1,14 @@
|
||||
## 1. API and Types
|
||||
|
||||
- [x] 1.1 Add the package-options API method and response types defined by the August interface document.
|
||||
|
||||
## 2. Create Grant Dialog
|
||||
|
||||
- [x] 2.1 Load package candidates only after both shop and series are selected, passing their IDs unchanged.
|
||||
- [x] 2.2 Use returned candidates for selection, package names, cost prices and price validation.
|
||||
- [x] 2.3 Reset candidate and selected-package state when the shop or series changes.
|
||||
|
||||
## 3. Verification
|
||||
|
||||
- [x] 3.1 Verify request parameters, candidate rendering and selected-package submission.
|
||||
- [x] 3.2 Run lint and type checks for changed files.
|
||||
@@ -76,7 +76,7 @@
|
||||
}
|
||||
|
||||
const getEntrySignature = (html: string) => {
|
||||
const matches = html.match(/(?:src|href)="[^"]*\/assets\/[^""]+\.(?:js|css)"/g)
|
||||
const matches = html.match(/(?:src|href)="[^"]*\/assets\/[^"]+\.(?:js|css)"/g)
|
||||
return matches?.sort().join('|') || ''
|
||||
}
|
||||
|
||||
@@ -106,7 +106,6 @@
|
||||
[
|
||||
navigator.userAgent,
|
||||
navigator.language,
|
||||
navigator.platform,
|
||||
Intl.DateTimeFormat().resolvedOptions().timeZone,
|
||||
`${screen.width}x${screen.height}x${screen.colorDepth}`
|
||||
].join('|')
|
||||
|
||||
@@ -9,6 +9,8 @@ import type {
|
||||
AgentRechargeListResponse,
|
||||
CreateAgentRechargeRequest,
|
||||
AgentRechargePaymentMethods,
|
||||
AgentRechargePaymentVoucherOcrRequest,
|
||||
AgentRechargePaymentVoucherOcrResponse,
|
||||
AgentRechargePaymentStatusResponse,
|
||||
ConfirmOfflinePaymentRequest,
|
||||
RejectAgentRechargeRequest,
|
||||
@@ -25,6 +27,30 @@ export class AgentRechargeService extends BaseService {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取代理自充可用支付方式和金额限制
|
||||
* 仅代理与平台账号可用,超级管理员调用返回 403
|
||||
*/
|
||||
static getSelfRechargePaymentMethods(): Promise<BaseResponse<AgentRechargePaymentMethods>> {
|
||||
return this.get<BaseResponse<AgentRechargePaymentMethods>>(
|
||||
'/api/admin/agent-self-recharge-payment-methods'
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 识别付款凭证中的交易流水号
|
||||
* 只返回预填值,识别较慢且失败不阻断人工填写
|
||||
*/
|
||||
static recognizePaymentVoucher(
|
||||
data: AgentRechargePaymentVoucherOcrRequest
|
||||
): Promise<BaseResponse<AgentRechargePaymentVoucherOcrResponse>> {
|
||||
return this.post<BaseResponse<AgentRechargePaymentVoucherOcrResponse>>(
|
||||
'/api/admin/agent-recharges/payment-voucher-ocr',
|
||||
data,
|
||||
{ timeout: 30000 }
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取代理充值订单列表
|
||||
* @param params 查询参数
|
||||
@@ -88,4 +114,14 @@ export class AgentRechargeService extends BaseService {
|
||||
): Promise<BaseResponse<void>> {
|
||||
return this.post<BaseResponse<void>>(`/api/admin/agent-recharges/${id}/reject`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 补发历史线下代理充值审批
|
||||
* @param id 充值记录ID
|
||||
*/
|
||||
static triggerApproval(id: number): Promise<BaseResponse<AgentRecharge>> {
|
||||
return this.post<BaseResponse<AgentRecharge>>(
|
||||
`/api/admin/agent-recharges/${id}/trigger-approval`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,8 +27,6 @@ import type {
|
||||
AssetOrdersResponse,
|
||||
UpdateAssetRealnameStatusRequest,
|
||||
DtoUpdateAssetRealnameStatusResponse,
|
||||
AssetOperationLogsResponse,
|
||||
AssetOperationLogsParams,
|
||||
AssetPackageUsageRecord,
|
||||
UpdateAssetPackageUsedDataRequest,
|
||||
UpdateAssetPackageExpiresAtRequest,
|
||||
@@ -106,7 +104,8 @@ export class AssetService extends BaseService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询该资产所有套餐记录,含虚流量换算字段(分页)
|
||||
* 查询该资产的历史套餐关系组(主套餐—加油包,分页)
|
||||
* total 仅统计顶层关系组,子项由后端随父项一起返回。
|
||||
* GET /api/admin/assets/:identifier/packages?page=1&page_size=50
|
||||
* @param identifier 资产标识符(ICCID 或 VirtualNo)
|
||||
* @param params 查询参数(可选分页参数)
|
||||
@@ -117,12 +116,7 @@ export class AssetService extends BaseService {
|
||||
): Promise<BaseResponse<AssetPackageListResponse>> {
|
||||
return this.get<BaseResponse<AssetPackageListResponse>>(
|
||||
`/api/admin/assets/${identifier}/packages`,
|
||||
params,
|
||||
{
|
||||
requestOptions: {
|
||||
show404Error: false // 404时不显示错误提示
|
||||
}
|
||||
}
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
@@ -311,22 +305,4 @@ export class AssetService extends BaseService {
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
// ========== 资产操作审计日志 ==========
|
||||
|
||||
/**
|
||||
* 查询资产操作审计日志
|
||||
* GET /api/admin/assets/:identifier/operation-logs
|
||||
* @param identifier 资产标识符
|
||||
* @param params 查询参数
|
||||
*/
|
||||
static getOperationLogs(
|
||||
identifier: string,
|
||||
params?: AssetOperationLogsParams
|
||||
): Promise<BaseResponse<AssetOperationLogsResponse>> {
|
||||
return this.get<BaseResponse<AssetOperationLogsResponse>>(
|
||||
`/api/admin/assets/${identifier}/operation-logs`,
|
||||
params
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { BaseService } from '../BaseService'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { isPlatformAuditAccount } from '@/utils/business/auditAccess'
|
||||
import type {
|
||||
AuditActorEventQuery,
|
||||
AuditActorKind,
|
||||
@@ -26,12 +28,28 @@ import type {
|
||||
} from '@/types/api'
|
||||
|
||||
export class AuditService extends BaseService {
|
||||
private static ensurePlatformAuditAccess() {
|
||||
const userStore = useUserStore()
|
||||
if (!isPlatformAuditAccount(userStore.info.user_type, userStore.isSuperAdmin)) {
|
||||
throw new Error('当前账号无权访问平台审计接口')
|
||||
}
|
||||
}
|
||||
|
||||
private static ensureSubjectActivityAccess(subject: 'agent' | 'enterprise') {
|
||||
const userType = Number(useUserStore().info.user_type)
|
||||
if ((subject === 'agent' && userType !== 3) || (subject === 'enterprise' && userType !== 4)) {
|
||||
throw new Error('当前账号无权访问主体活动接口')
|
||||
}
|
||||
}
|
||||
|
||||
static getEvents(params?: AuditEventQuery): Promise<BaseResponse<AuditEventPage>> {
|
||||
this.ensurePlatformAuditAccess()
|
||||
return this.get('/api/admin/audit/events', params)
|
||||
}
|
||||
|
||||
static getEventDetail(eventId: string): Promise<BaseResponse<AuditEventDetail>> {
|
||||
return this.get(`/api/admin/audit/events/${encodeURIComponent(eventId)}`)
|
||||
this.ensurePlatformAuditAccess()
|
||||
return this.get(`/api/admin/audit/events/${eventId}`)
|
||||
}
|
||||
|
||||
static getActorEvents(
|
||||
@@ -39,6 +57,7 @@ export class AuditService extends BaseService {
|
||||
id: string,
|
||||
params?: AuditActorEventQuery
|
||||
): Promise<BaseResponse<AuditEventPage>> {
|
||||
this.ensurePlatformAuditAccess()
|
||||
return this.get(
|
||||
`/api/admin/audit/actors/${encodeURIComponent(kind)}/${encodeURIComponent(id)}/events`,
|
||||
params
|
||||
@@ -48,6 +67,7 @@ export class AuditService extends BaseService {
|
||||
static searchResources(
|
||||
params: AuditResourceSearchQuery
|
||||
): Promise<BaseResponse<AuditResourceSearchPage>> {
|
||||
this.ensurePlatformAuditAccess()
|
||||
return this.get('/api/admin/audit/resources/search', params)
|
||||
}
|
||||
|
||||
@@ -56,6 +76,7 @@ export class AuditService extends BaseService {
|
||||
resourceId: string,
|
||||
params?: AuditResourceTimelineQuery
|
||||
): Promise<BaseResponse<AuditEventPage>> {
|
||||
this.ensurePlatformAuditAccess()
|
||||
return this.get(
|
||||
`/api/admin/audit/resources/${encodeURIComponent(resourceType)}/${encodeURIComponent(resourceId)}/timeline`,
|
||||
params
|
||||
@@ -63,40 +84,48 @@ export class AuditService extends BaseService {
|
||||
}
|
||||
|
||||
static getRequestTimeline(requestId: string): Promise<BaseResponse<AuditLinkTimeline>> {
|
||||
this.ensurePlatformAuditAccess()
|
||||
return this.get(`/api/admin/audit/requests/${encodeURIComponent(requestId)}/timeline`)
|
||||
}
|
||||
|
||||
static getCorrelationTimeline(correlationId: string): Promise<BaseResponse<AuditLinkTimeline>> {
|
||||
this.ensurePlatformAuditAccess()
|
||||
return this.get(`/api/admin/audit/correlations/${encodeURIComponent(correlationId)}/timeline`)
|
||||
}
|
||||
|
||||
static getFinanceTimeline(
|
||||
params: AuditFinanceQuery
|
||||
): Promise<BaseResponse<AuditFinanceTimelinePage>> {
|
||||
this.ensurePlatformAuditAccess()
|
||||
return this.get('/api/admin/audit/finance/timeline', params)
|
||||
}
|
||||
|
||||
static getRiskOverview(params?: AuditRiskQuery): Promise<BaseResponse<AuditRiskOverview>> {
|
||||
this.ensurePlatformAuditAccess()
|
||||
return this.get('/api/admin/audit/risks/overview', params)
|
||||
}
|
||||
|
||||
static getRiskEvents(params?: AuditRiskEventQuery): Promise<BaseResponse<AuditRiskEventPage>> {
|
||||
this.ensurePlatformAuditAccess()
|
||||
return this.get('/api/admin/audit/risks/events', params)
|
||||
}
|
||||
|
||||
static getIntegrationOverview(
|
||||
params?: IntegrationQuery & { bucket?: 'hour' | 'day' }
|
||||
): Promise<BaseResponse<IntegrationOverview>> {
|
||||
this.ensurePlatformAuditAccess()
|
||||
return this.get('/api/admin/audit/integrations/overview', params)
|
||||
}
|
||||
|
||||
static getIntegrations(params?: IntegrationQuery): Promise<BaseResponse<IntegrationListPage>> {
|
||||
this.ensurePlatformAuditAccess()
|
||||
return this.get('/api/admin/audit/integrations', params)
|
||||
}
|
||||
|
||||
static getIntegrationDetail(
|
||||
integrationId: string
|
||||
): Promise<BaseResponse<IntegrationDetailResponse>> {
|
||||
this.ensurePlatformAuditAccess()
|
||||
return this.get(`/api/admin/audit/integrations/${encodeURIComponent(integrationId)}`)
|
||||
}
|
||||
|
||||
@@ -105,6 +134,7 @@ export class AuditService extends BaseService {
|
||||
identifier: string,
|
||||
params?: AuditSubjectActivityQuery
|
||||
): Promise<BaseResponse<AuditSubjectActivityPage>> {
|
||||
this.ensureSubjectActivityAccess('agent')
|
||||
return this.get(
|
||||
`/api/admin/agent/resource-activities/${encodeURIComponent(resourceType)}/${encodeURIComponent(identifier)}`,
|
||||
params
|
||||
@@ -116,6 +146,7 @@ export class AuditService extends BaseService {
|
||||
identifier: string,
|
||||
params?: AuditSubjectActivityQuery
|
||||
): Promise<BaseResponse<AuditSubjectActivityPage>> {
|
||||
this.ensureSubjectActivityAccess('enterprise')
|
||||
return this.get(
|
||||
`/api/admin/enterprise/resource-activities/${encodeURIComponent(resourceType)}/${encodeURIComponent(identifier)}`,
|
||||
params
|
||||
|
||||
149
src/api/modules/employeeCollection.ts
Normal file
149
src/api/modules/employeeCollection.ts
Normal file
@@ -0,0 +1,149 @@
|
||||
/**
|
||||
* 员工代收款相关 API
|
||||
*/
|
||||
|
||||
import { BaseService } from '../BaseService'
|
||||
import type {
|
||||
CloseEmployeeCollectionBillRequest,
|
||||
CloseEmployeeCollectionBillResponse,
|
||||
CreateEmployeeCollectionPaymentMethodRequest,
|
||||
DeleteEmployeeCollectionPaymentMethodResponse,
|
||||
EmployeeCollectionApplicationListResponse,
|
||||
EmployeeCollectionApplicationQueryParams,
|
||||
EmployeeCollectionApplicationRequest,
|
||||
EmployeeCollectionApplicationResponse,
|
||||
EmployeeCollectionApplicationSubmitResponse,
|
||||
EmployeeCollectionBillListResponse,
|
||||
EmployeeCollectionBillQueryParams,
|
||||
EmployeeCollectionBillResponse,
|
||||
EmployeeCollectionBillStatisticsResponse,
|
||||
EmployeeCollectionPaymentMethodListResponse,
|
||||
EmployeeCollectionPaymentMethodQueryParams,
|
||||
EmployeeCollectionPaymentMethodResponse,
|
||||
UpdateEmployeeCollectionPaymentMethodRequest
|
||||
} from '@/types/api'
|
||||
|
||||
const PAYMENT_METHODS_BASE_URL = '/api/admin/employee-collection-payment-methods'
|
||||
const BILLS_BASE_URL = '/api/admin/employee-collection-bills'
|
||||
const APPLICATIONS_BASE_URL = '/api/admin/employee-collection-applications'
|
||||
|
||||
export class EmployeeCollectionService extends BaseService {
|
||||
/**
|
||||
* 获取收款方式列表
|
||||
* 超级管理员返回全部,普通员工仅返回启用项
|
||||
*/
|
||||
static getPaymentMethods(
|
||||
params?: EmployeeCollectionPaymentMethodQueryParams
|
||||
): Promise<EmployeeCollectionPaymentMethodListResponse> {
|
||||
return this.get<EmployeeCollectionPaymentMethodListResponse>(PAYMENT_METHODS_BASE_URL, params)
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增收款方式
|
||||
*/
|
||||
static createPaymentMethod(
|
||||
data: CreateEmployeeCollectionPaymentMethodRequest
|
||||
): Promise<EmployeeCollectionPaymentMethodResponse> {
|
||||
return this.post<EmployeeCollectionPaymentMethodResponse>(PAYMENT_METHODS_BASE_URL, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改收款方式(已被引用时不可修改 code)
|
||||
*/
|
||||
static updatePaymentMethod(
|
||||
id: number,
|
||||
data: UpdateEmployeeCollectionPaymentMethodRequest
|
||||
): Promise<EmployeeCollectionPaymentMethodResponse> {
|
||||
return this.put<EmployeeCollectionPaymentMethodResponse>(
|
||||
`${PAYMENT_METHODS_BASE_URL}/${id}`,
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除收款方式(已被引用时不可删除,只能停用)
|
||||
*/
|
||||
static deletePaymentMethod(id: number): Promise<DeleteEmployeeCollectionPaymentMethodResponse> {
|
||||
return this.delete<DeleteEmployeeCollectionPaymentMethodResponse>(
|
||||
`${PAYMENT_METHODS_BASE_URL}/${id}`
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取员工代收款账单列表
|
||||
*/
|
||||
static getBills(
|
||||
params?: EmployeeCollectionBillQueryParams
|
||||
): Promise<EmployeeCollectionBillListResponse> {
|
||||
return this.get<EmployeeCollectionBillListResponse>(BILLS_BASE_URL, params)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取账单统计(应收/已核销/未核销/待处理数量)
|
||||
*/
|
||||
static getBillStatistics(
|
||||
params?: EmployeeCollectionBillQueryParams
|
||||
): Promise<EmployeeCollectionBillStatisticsResponse> {
|
||||
return this.get<EmployeeCollectionBillStatisticsResponse>(
|
||||
`${BILLS_BASE_URL}/statistics`,
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取账单详情(含退款冲销、核销分摊、关联申请、企微审批历史)
|
||||
*/
|
||||
static getBillById(id: number): Promise<EmployeeCollectionBillResponse> {
|
||||
return this.getOne<EmployeeCollectionBillResponse['data']>(`${BILLS_BASE_URL}/${id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭账单(仅超级管理员,必须填写原因)
|
||||
*/
|
||||
static closeBill(
|
||||
id: number,
|
||||
data: CloseEmployeeCollectionBillRequest
|
||||
): Promise<CloseEmployeeCollectionBillResponse> {
|
||||
return this.post<CloseEmployeeCollectionBillResponse>(`${BILLS_BASE_URL}/${id}/close`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建核销申请(提交后自动发起企微审批)
|
||||
*/
|
||||
static createApplication(
|
||||
data: EmployeeCollectionApplicationRequest
|
||||
): Promise<EmployeeCollectionApplicationSubmitResponse> {
|
||||
return this.post<EmployeeCollectionApplicationSubmitResponse>(APPLICATIONS_BASE_URL, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取核销申请列表
|
||||
*/
|
||||
static getApplications(
|
||||
params?: EmployeeCollectionApplicationQueryParams
|
||||
): Promise<EmployeeCollectionApplicationListResponse> {
|
||||
return this.get<EmployeeCollectionApplicationListResponse>(APPLICATIONS_BASE_URL, params)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取核销申请详情(含分摊账单、付款凭证、审批意见与提交历史)
|
||||
*/
|
||||
static getApplicationById(id: number): Promise<EmployeeCollectionApplicationResponse> {
|
||||
return this.getOne<EmployeeCollectionApplicationResponse['data']>(
|
||||
`${APPLICATIONS_BASE_URL}/${id}`
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 驳回后修改并重新提交(生成新的企微审批实例)
|
||||
*/
|
||||
static updateApplication(
|
||||
id: number,
|
||||
data: EmployeeCollectionApplicationRequest
|
||||
): Promise<EmployeeCollectionApplicationSubmitResponse> {
|
||||
return this.put<EmployeeCollectionApplicationSubmitResponse>(
|
||||
`${APPLICATIONS_BASE_URL}/${id}`,
|
||||
data
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* API 服务模块统一导出
|
||||
*/
|
||||
|
||||
@@ -23,6 +23,7 @@ export { OrderService } from './order'
|
||||
export { AssetService } from './asset'
|
||||
export { AgentRechargeService } from './agentRecharge'
|
||||
export { PaymentSettingsService } from './paymentSettings'
|
||||
export { PaymentMerchantPoolsService } from './paymentMerchantPools'
|
||||
export { SystemConfigService } from './systemConfig'
|
||||
export { ExchangeService } from './exchange'
|
||||
export { RefundService } from './refund'
|
||||
@@ -39,6 +40,7 @@ export { BulkPurchaseService } from './bulkPurchase'
|
||||
export { NotificationService } from './notification'
|
||||
export { AuditService } from './audit'
|
||||
export { WecomService } from './wecom'
|
||||
export { EmployeeCollectionService } from './employeeCollection'
|
||||
|
||||
// TODO: 按需添加其他业务模块
|
||||
// export { SettingService } from './setting'
|
||||
|
||||
231
src/api/modules/paymentMerchantPools.ts
Normal file
231
src/api/modules/paymentMerchantPools.ts
Normal file
@@ -0,0 +1,231 @@
|
||||
/**
|
||||
* 支付商户、商户池及微信授权配置 API
|
||||
*/
|
||||
|
||||
import { BaseService } from '../BaseService'
|
||||
import type { BaseResponse } from '@/types/api'
|
||||
import type {
|
||||
CreatePaymentMerchantRequest,
|
||||
PaymentMerchant,
|
||||
PaymentCredentialValue,
|
||||
PaymentCredentials,
|
||||
PaymentMerchantDetail,
|
||||
PaymentMerchantDetailResponse,
|
||||
PaymentMerchantPageResponse,
|
||||
PaymentMerchantPageResult,
|
||||
PaymentMerchantProviderType,
|
||||
PaymentMerchantPool,
|
||||
PaymentMerchantPoolPageResponse,
|
||||
PaymentMerchantPoolPayload,
|
||||
PaymentMerchantPoolQueryParams,
|
||||
PaymentMerchantQueryParams,
|
||||
PaymentMerchantResponse,
|
||||
UpdatePaymentMerchantRequest,
|
||||
UpdateWechatAuthorizationRequest,
|
||||
WechatAuthorizationConfig,
|
||||
WechatAuthorizationResponse
|
||||
} from '@/types/api/paymentMerchantPools'
|
||||
|
||||
const PAYMENT_MERCHANTS_BASE_URL = '/api/admin/payment-merchants'
|
||||
const PAYMENT_MERCHANT_POOLS_BASE_URL = '/api/admin/payment-merchant-pools'
|
||||
const WECHAT_AUTHORIZATIONS_BASE_URL = '/api/admin/wechat-authorizations'
|
||||
|
||||
type RawPaymentMerchant = PaymentMerchant & { credentials?: unknown }
|
||||
|
||||
type RawPaymentMerchantDetail = PaymentMerchant & { credentials?: Record<string, unknown> }
|
||||
|
||||
const MERCHANT_CREDENTIAL_DISPLAY_KEYS: Record<PaymentMerchantProviderType, string[]> = {
|
||||
wechat: ['wx_mch_id', 'wx_serial_no', 'wx_notify_url'],
|
||||
wechat_v2: ['wx_mch_id', 'wx_serial_no', 'wx_notify_url'],
|
||||
fuiou: ['fy_api_url', 'fy_ins_cd', 'fy_mchnt_cd', 'fy_term_id', 'fy_notify_url'],
|
||||
alipay: [
|
||||
'ali_app_id',
|
||||
'ali_notify_url',
|
||||
'ali_return_url',
|
||||
'ali_pay_expire_minutes',
|
||||
'ali_production'
|
||||
]
|
||||
}
|
||||
|
||||
const MERCHANT_CREDENTIAL_STATUS_KEYS: Record<PaymentMerchantProviderType, string[]> = {
|
||||
wechat: ['wx_api_v2_key', 'wx_api_v3_key', 'wx_cert_content', 'wx_key_content'],
|
||||
wechat_v2: ['wx_api_v2_key', 'wx_api_v3_key', 'wx_cert_content', 'wx_key_content'],
|
||||
fuiou: ['fy_private_key', 'fy_public_key'],
|
||||
alipay: ['ali_private_key', 'ali_public_key']
|
||||
}
|
||||
|
||||
const sanitizeMerchant = (merchant: RawPaymentMerchant): PaymentMerchant => {
|
||||
// 仅通过解构丢弃 credentials 字段,避免在前端页面/状态中保留支付凭证明文
|
||||
const { credentials: _ignoredCredentials, ...safeMerchant } = merchant
|
||||
void _ignoredCredentials
|
||||
return safeMerchant
|
||||
}
|
||||
|
||||
const sanitizeMerchantDetail = (merchant: RawPaymentMerchantDetail): PaymentMerchantDetail => {
|
||||
const { credentials: rawCredentials, ...baseMerchant } = merchant
|
||||
const credentials: PaymentCredentials = {}
|
||||
const provider = merchant.provider_type
|
||||
const source = rawCredentials || {}
|
||||
|
||||
for (const key of MERCHANT_CREDENTIAL_DISPLAY_KEYS[provider] || []) {
|
||||
const value = source[key]
|
||||
if (value !== undefined && value !== null) {
|
||||
credentials[key] = value as PaymentCredentialValue
|
||||
}
|
||||
}
|
||||
|
||||
for (const key of MERCHANT_CREDENTIAL_STATUS_KEYS[provider] || []) {
|
||||
const value = source[key]
|
||||
credentials[key] = value ? '已配置' : '未配置'
|
||||
}
|
||||
|
||||
return {
|
||||
...baseMerchant,
|
||||
credentials
|
||||
}
|
||||
}
|
||||
|
||||
const sanitizeMerchantPage = (page: PaymentMerchantPageResult): PaymentMerchantPageResult => ({
|
||||
...page,
|
||||
items: (page.items || []).map((item) => sanitizeMerchant(item as RawPaymentMerchant))
|
||||
})
|
||||
|
||||
const sanitizeWechatAuthorization = (
|
||||
config: WechatAuthorizationConfig & Record<string, unknown>
|
||||
): WechatAuthorizationConfig => {
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
// 仅通过解构丢弃敏感字段,禁止在前端响应中保留 AppSecret/Token/AES Key 等明文
|
||||
const {
|
||||
miniapp_app_secret: _miniappAppSecret,
|
||||
oa_app_secret: _oaAppSecret,
|
||||
oa_token: _oaToken,
|
||||
oa_aes_key: _oaAesKey,
|
||||
...safeConfig
|
||||
} = config
|
||||
/* eslint-enable @typescript-eslint/no-unused-vars */
|
||||
|
||||
return safeConfig as WechatAuthorizationConfig
|
||||
}
|
||||
|
||||
export class PaymentMerchantPoolsService extends BaseService {
|
||||
static getPaymentMerchants(
|
||||
params?: PaymentMerchantQueryParams
|
||||
): Promise<PaymentMerchantPageResponse> {
|
||||
return this.get<PaymentMerchantPageResponse>(PAYMENT_MERCHANTS_BASE_URL, params).then(
|
||||
(response) => ({
|
||||
...response,
|
||||
data: sanitizeMerchantPage(response.data)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
static getPaymentMerchantById(id: number): Promise<PaymentMerchantResponse> {
|
||||
return this.get<PaymentMerchantResponse>(`${PAYMENT_MERCHANTS_BASE_URL}/${id}`).then(
|
||||
(response) => ({
|
||||
...response,
|
||||
data: sanitizeMerchant(response.data as RawPaymentMerchant)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
static getPaymentMerchantDetailById(id: number): Promise<PaymentMerchantDetailResponse> {
|
||||
return this.get<PaymentMerchantDetailResponse>(`${PAYMENT_MERCHANTS_BASE_URL}/${id}`).then(
|
||||
(response) => ({
|
||||
...response,
|
||||
data: sanitizeMerchantDetail(response.data as unknown as RawPaymentMerchantDetail)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
static createPaymentMerchant(
|
||||
data: CreatePaymentMerchantRequest
|
||||
): Promise<PaymentMerchantResponse> {
|
||||
return this.post<PaymentMerchantResponse>(PAYMENT_MERCHANTS_BASE_URL, data).then(
|
||||
(response) => ({
|
||||
...response,
|
||||
data: sanitizeMerchant(response.data as RawPaymentMerchant)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
static updatePaymentMerchant(
|
||||
id: number,
|
||||
data: UpdatePaymentMerchantRequest
|
||||
): Promise<PaymentMerchantResponse> {
|
||||
return this.put<PaymentMerchantResponse>(`${PAYMENT_MERCHANTS_BASE_URL}/${id}`, data).then(
|
||||
(response) => ({
|
||||
...response,
|
||||
data: sanitizeMerchant(response.data as RawPaymentMerchant)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
static deletePaymentMerchant(id: number): Promise<BaseResponse<void>> {
|
||||
return this.delete<BaseResponse<void>>(`${PAYMENT_MERCHANTS_BASE_URL}/${id}`, undefined, {
|
||||
data: { confirm: true }
|
||||
})
|
||||
}
|
||||
|
||||
static getPaymentMerchantPools(
|
||||
params?: PaymentMerchantPoolQueryParams
|
||||
): Promise<PaymentMerchantPoolPageResponse> {
|
||||
return this.get<PaymentMerchantPoolPageResponse>(PAYMENT_MERCHANT_POOLS_BASE_URL, params)
|
||||
}
|
||||
|
||||
static getPaymentMerchantPoolById(id: number): Promise<BaseResponse<PaymentMerchantPool>> {
|
||||
return this.get<BaseResponse<PaymentMerchantPool>>(`${PAYMENT_MERCHANT_POOLS_BASE_URL}/${id}`)
|
||||
}
|
||||
|
||||
static createPaymentMerchantPool(
|
||||
data: PaymentMerchantPoolPayload
|
||||
): Promise<BaseResponse<PaymentMerchantPool>> {
|
||||
return this.post<BaseResponse<PaymentMerchantPool>>(PAYMENT_MERCHANT_POOLS_BASE_URL, data)
|
||||
}
|
||||
|
||||
static updatePaymentMerchantPool(
|
||||
id: number,
|
||||
data: PaymentMerchantPoolPayload
|
||||
): Promise<BaseResponse<PaymentMerchantPool>> {
|
||||
return this.put<BaseResponse<PaymentMerchantPool>>(
|
||||
`${PAYMENT_MERCHANT_POOLS_BASE_URL}/${id}`,
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
static enablePaymentMerchantPool(id: number): Promise<BaseResponse<PaymentMerchantPool>> {
|
||||
return this.post<BaseResponse<PaymentMerchantPool>>(
|
||||
`${PAYMENT_MERCHANT_POOLS_BASE_URL}/${id}/enable`
|
||||
)
|
||||
}
|
||||
|
||||
static disablePaymentMerchantPool(id: number): Promise<BaseResponse<PaymentMerchantPool>> {
|
||||
return this.post<BaseResponse<PaymentMerchantPool>>(
|
||||
`${PAYMENT_MERCHANT_POOLS_BASE_URL}/${id}/disable`
|
||||
)
|
||||
}
|
||||
|
||||
static getWechatAuthorization(): Promise<WechatAuthorizationResponse> {
|
||||
return this.get<WechatAuthorizationResponse>(WECHAT_AUTHORIZATIONS_BASE_URL).then(
|
||||
(response) => ({
|
||||
...response,
|
||||
data: sanitizeWechatAuthorization(
|
||||
response.data as WechatAuthorizationConfig & Record<string, unknown>
|
||||
)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
static updateWechatAuthorization(
|
||||
data: UpdateWechatAuthorizationRequest
|
||||
): Promise<WechatAuthorizationResponse> {
|
||||
return this.put<WechatAuthorizationResponse>(
|
||||
`${WECHAT_AUTHORIZATIONS_BASE_URL}/current`,
|
||||
data
|
||||
).then((response) => ({
|
||||
...response,
|
||||
data: sanitizeWechatAuthorization(
|
||||
response.data as WechatAuthorizationConfig & Record<string, unknown>
|
||||
)
|
||||
}))
|
||||
}
|
||||
}
|
||||
@@ -45,4 +45,12 @@ export class RefundService extends BaseService {
|
||||
static resubmitRefund(id: number, data: ResubmitRefundRequest): Promise<BaseResponse<void>> {
|
||||
return this.post<BaseResponse<void>>(`/api/admin/refunds/${id}/resubmit`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 补发历史退款审批
|
||||
* @param id 退款申请ID
|
||||
*/
|
||||
static triggerApproval(id: number): Promise<BaseResponse<Refund>> {
|
||||
return this.post<BaseResponse<Refund>>(`/api/admin/refunds/${id}/trigger-approval`)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import type {
|
||||
CreateShopSeriesGrantRequest,
|
||||
UpdateShopSeriesGrantRequest,
|
||||
ManageGrantPackagesRequest,
|
||||
ShopSeriesGrantPackageOptionsResponse,
|
||||
BaseResponse,
|
||||
PaginationResponse
|
||||
} from '@/types/api'
|
||||
@@ -45,6 +46,20 @@ export class ShopSeriesGrantService extends BaseService {
|
||||
return this.getOne<ShopSeriesGrantResponse>(`/api/admin/shop-series-grants/${id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取代理系列授权可选套餐
|
||||
* GET /api/admin/shop-series-grants/package-options
|
||||
*/
|
||||
static getPackageOptions(
|
||||
shopId: number,
|
||||
seriesId: number
|
||||
): Promise<BaseResponse<ShopSeriesGrantPackageOptionsResponse>> {
|
||||
return this.getOne<ShopSeriesGrantPackageOptionsResponse>(
|
||||
'/api/admin/shop-series-grants/package-options',
|
||||
{ shop_id: shopId, series_id: seriesId }
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新代理系列授权
|
||||
* PUT /api/admin/shop-series-grants/{id}
|
||||
|
||||
@@ -72,19 +72,24 @@
|
||||
}
|
||||
|
||||
.el-dialog {
|
||||
border-radius: 100px !important;
|
||||
border-radius: calc(var(--custom-radius) / 1.2 + 2px) !important;
|
||||
border-radius: 12px !important;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.el-dialog__header {
|
||||
padding: 20px 24px 16px !important;
|
||||
margin-right: 0 !important;
|
||||
border-bottom: 1px solid var(--el-border-color-lighter);
|
||||
|
||||
.el-dialog__title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.el-dialog__body {
|
||||
padding: 25px 0 !important;
|
||||
padding: 20px 24px !important;
|
||||
position: relative; // 为了兼容 el-pagination 样式,需要设置 relative,不然会影响 el-pagination 的样式,比如 el-pagination__jump--small 会被影响,导致 el-pagination__jump--small 按钮无法点击,详见 URL_ADDRESS.com/element-plus/element-plus/issues/5684#issuecomment-1176299275;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<ElDialog v-model="visible" title="批量修改实名顺序" width="520px" @closed="resetPolicy">
|
||||
<ElForm label-width="110px">
|
||||
<ElDialog v-model="visible" title="批量修改实名顺序" width="40%" @closed="resetPolicy">
|
||||
<ElForm label-width="80px">
|
||||
<ElFormItem label="已选数量">
|
||||
<span class="selected-count">{{ selectedCount }} {{ assetUnit }}</span>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="实名认证策略">
|
||||
<ElFormItem label="认证策略">
|
||||
<ElRadioGroup v-model="policy" :disabled="loading">
|
||||
<ElRadio value="none">无需实名</ElRadio>
|
||||
<ElRadio value="before_order">先实名后购买</ElRadio>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<ElDialog v-model="dialogVisible" title="创建退款申请" width="40%" @closed="handleDialogClosed">
|
||||
<ElForm ref="formRef" :model="formData" :rules="formRules" label-width="120px">
|
||||
<ElForm ref="formRef" :model="formData" :rules="formRules" label-width="80px">
|
||||
<ElFormItem label="订单号" prop="order_id">
|
||||
<ElSelect
|
||||
v-if="!hasInitialOrder"
|
||||
@@ -23,7 +23,7 @@
|
||||
</ElSelect>
|
||||
<ElInput v-else :model-value="props.initialOrderNo" disabled style="width: 100%" />
|
||||
</ElFormItem>
|
||||
<ElFormItem label="申请退款金额" prop="requested_refund_amount">
|
||||
<ElFormItem label="退款金额" prop="requested_refund_amount">
|
||||
<ElInputNumber
|
||||
v-model="formData.requested_refund_amount"
|
||||
:min="0"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<ElDialog v-model="visible" :title="title" width="520px" destroy-on-close>
|
||||
<ElDialog v-model="visible" :title="title" width="40%" destroy-on-close>
|
||||
<ElAlert type="info" :closable="false" show-icon class="export-rule-alert">
|
||||
<template #title>{{ description }}</template>
|
||||
</ElAlert>
|
||||
|
||||
<ElForm label-width="100px" class="export-task-form">
|
||||
<ElForm label-width="80px" class="export-task-form">
|
||||
<ElFormItem label="导出场景">
|
||||
<ElTag>{{ sceneName }}</ElTag>
|
||||
</ElFormItem>
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
<template>
|
||||
<ElDrawer
|
||||
v-model="dialogVisible"
|
||||
title="操作审计日志"
|
||||
direction="rtl"
|
||||
size="70%"
|
||||
:before-close="handleClose"
|
||||
>
|
||||
<OperationLogsCard :asset-identifier="identifier" :download-permission="downloadPermission" />
|
||||
</ElDrawer>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue'
|
||||
import { ElDrawer } from 'element-plus'
|
||||
import OperationLogsCard from '@/views/asset-management/asset-information/components/OperationLogsCard.vue'
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
identifier?: string
|
||||
downloadPermission?: string
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: boolean]
|
||||
}>()
|
||||
|
||||
const dialogVisible = ref(props.modelValue)
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(val) => {
|
||||
dialogVisible.value = val
|
||||
}
|
||||
)
|
||||
|
||||
watch(dialogVisible, (val) => {
|
||||
emit('update:modelValue', val)
|
||||
})
|
||||
|
||||
const handleClose = () => {
|
||||
dialogVisible.value = false
|
||||
}
|
||||
</script>
|
||||
@@ -279,8 +279,8 @@
|
||||
}
|
||||
|
||||
.package-config-field-label {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 13px;
|
||||
color: var(--el-text-color-secondary);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
<ElDialog
|
||||
v-model="dialogVisible"
|
||||
title="手动更新卡实名状态"
|
||||
width="400px"
|
||||
width="30%"
|
||||
@closed="handleDialogClosed"
|
||||
>
|
||||
<ElForm ref="formRef" :model="formData" :rules="formRules" label-width="100px">
|
||||
<ElForm ref="formRef" :model="formData" :rules="formRules" label-width="80px">
|
||||
<ElFormItem label="资产标识">
|
||||
<span style="font-weight: bold; color: #409eff">{{ assetIdentifier }}</span>
|
||||
</ElFormItem>
|
||||
|
||||
@@ -57,8 +57,8 @@
|
||||
import { Close, Document, UploadFilled } from '@element-plus/icons-vue'
|
||||
import type { UploadFile, UploadInstance, UploadRawFile } from 'element-plus'
|
||||
import { StorageService } from '@/api/modules'
|
||||
import type { RefundAttachment } from '@/types/api/refund'
|
||||
import type { FilePurpose } from '@/api/modules/storage'
|
||||
import type { RefundAttachment } from '@/types/api/refund'
|
||||
import type { FilePurpose } from '@/api/modules/storage'
|
||||
|
||||
interface Props {
|
||||
modelValue?: string[] | string
|
||||
@@ -68,6 +68,7 @@
|
||||
tip?: string
|
||||
purpose?: FilePurpose
|
||||
maxSizeMb?: number
|
||||
contentType?: string
|
||||
singleColumnCsv?: boolean
|
||||
maxCsvRows?: number
|
||||
}
|
||||
@@ -79,6 +80,7 @@
|
||||
tip: '',
|
||||
purpose: 'attachment',
|
||||
maxSizeMb: 0,
|
||||
contentType: '',
|
||||
singleColumnCsv: false,
|
||||
maxCsvRows: 0
|
||||
})
|
||||
@@ -190,6 +192,35 @@
|
||||
uploadRef.value?.handleRemove(uploadFile)
|
||||
}
|
||||
|
||||
// accept 支持扩展名(.csv)、精确 MIME(image/jpeg)与通配 MIME(image/*)
|
||||
const isAcceptMatched = (file: File) => {
|
||||
if (!props.accept) return true
|
||||
|
||||
const fileName = file.name.toLowerCase()
|
||||
const fileType = (file.type || '').toLowerCase()
|
||||
|
||||
return props.accept.split(',').some((type) => {
|
||||
const value = type.trim().toLowerCase()
|
||||
if (!value) return false
|
||||
if (value.startsWith('.')) return fileName.endsWith(value)
|
||||
if (value.endsWith('/*')) return fileType.startsWith(value.slice(0, -1))
|
||||
return fileType === value
|
||||
})
|
||||
}
|
||||
|
||||
const getAcceptWarning = () => {
|
||||
const values = props.accept
|
||||
.split(',')
|
||||
.map((type) => type.trim().toLowerCase())
|
||||
.filter(Boolean)
|
||||
|
||||
if (values.length > 0 && values.every((value) => value.startsWith('image/'))) {
|
||||
return '只能上传图片格式的文件'
|
||||
}
|
||||
|
||||
return `只能上传 ${props.accept} 格式的文件`
|
||||
}
|
||||
|
||||
const handleFileChange = async (uploadFile: UploadFile) => {
|
||||
const file = uploadFile.raw
|
||||
if (!file) return
|
||||
@@ -202,7 +233,10 @@
|
||||
|
||||
if (props.singleColumnCsv) {
|
||||
const content = await file.text()
|
||||
const rows = content.replace(/^\uFEFF/, '').split(/\r?\n/).filter(Boolean)
|
||||
const rows = content
|
||||
.replace(/^\uFEFF/, '')
|
||||
.split(/\r?\n/)
|
||||
.filter(Boolean)
|
||||
if (props.maxCsvRows > 0 && Math.max(rows.length - 1, 0) > props.maxCsvRows) {
|
||||
ElMessage.warning(`CSV 数据行不能超过 ${props.maxCsvRows} 行`)
|
||||
removeUploadFile(uploadFile)
|
||||
@@ -216,14 +250,8 @@
|
||||
}
|
||||
|
||||
if (props.accept) {
|
||||
const accepted = props.accept.split(',').some((type) => {
|
||||
const value = type.trim().toLowerCase()
|
||||
return value.startsWith('.')
|
||||
? file.name.toLowerCase().endsWith(value)
|
||||
: file.type.toLowerCase() === value
|
||||
})
|
||||
if (!accepted) {
|
||||
ElMessage.warning(`只能上传 ${props.accept} 格式的文件`)
|
||||
if (!isAcceptMatched(file)) {
|
||||
ElMessage.warning(getAcceptWarning())
|
||||
removeUploadFile(uploadFile)
|
||||
return
|
||||
}
|
||||
@@ -246,11 +274,11 @@
|
||||
try {
|
||||
ElMessage.info(`正在上传${props.voucherName}...`)
|
||||
|
||||
const contentType = file.type || 'application/octet-stream'
|
||||
const uploadContentType = props.contentType || file.type || 'application/octet-stream'
|
||||
const uploadUrlRes = await StorageService.getUploadUrl({
|
||||
file_name: file.name,
|
||||
content_type: contentType,
|
||||
purpose: props.purpose
|
||||
content_type: uploadContentType,
|
||||
purpose: props.purpose
|
||||
})
|
||||
|
||||
if (uploadUrlRes.code !== 0) {
|
||||
@@ -260,7 +288,7 @@
|
||||
}
|
||||
|
||||
const { upload_url, file_key } = uploadUrlRes.data
|
||||
await StorageService.uploadFile(upload_url, file, contentType)
|
||||
await StorageService.uploadFile(upload_url, file, uploadContentType)
|
||||
|
||||
if (uploadBatch !== activeUploadBatch || removedUploadUids.has(uploadFile.uid)) {
|
||||
return
|
||||
|
||||
@@ -12,7 +12,12 @@
|
||||
<template #default="{ row }">{{ formatDateTime(row.occurred_at) }}</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="动作" min-width="180">
|
||||
<template #default="{ row }">{{ row.action_name || '-' }}</template>
|
||||
<template #default="{ row }">
|
||||
<ElButton v-if="detailEnabled" link type="primary" @click="$emit('detail', row)">
|
||||
{{ row.action_name || '-' }}
|
||||
</ElButton>
|
||||
<span v-else>{{ row.action_name || '-' }}</span>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="摘要" prop="summary" min-width="240" show-overflow-tooltip />
|
||||
<ElTableColumn label="操作者" min-width="150">
|
||||
@@ -30,11 +35,6 @@
|
||||
}}</ElTag></template
|
||||
>
|
||||
</ElTableColumn>
|
||||
<ElTableColumn label="操作" width="110" fixed="right">
|
||||
<template #default="{ row }"
|
||||
><ElButton link type="primary" @click="$emit('detail', row)">查看详情</ElButton></template
|
||||
>
|
||||
</ElTableColumn>
|
||||
</template>
|
||||
</ArtTable>
|
||||
</template>
|
||||
@@ -44,7 +44,12 @@
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import { auditResultMeta, auditRiskMeta } from '@/utils/business/audit'
|
||||
|
||||
defineProps<{ items: AuditEventView[]; loading?: boolean }>()
|
||||
withDefaults(
|
||||
defineProps<{ items: AuditEventView[]; loading?: boolean; detailEnabled?: boolean }>(),
|
||||
{
|
||||
detailEnabled: true
|
||||
}
|
||||
)
|
||||
defineEmits<{ detail: [row: AuditEventView] }>()
|
||||
const resultMeta = (row: AuditEventView) =>
|
||||
auditResultMeta[row.result] || { label: row.result, type: 'info' as const }
|
||||
|
||||
@@ -21,12 +21,172 @@
|
||||
<article class="timeline-node">
|
||||
<div class="node-head">
|
||||
<strong>{{ item.action_name }}</strong>
|
||||
<ElTag size="small" :type="auditResultMeta[item.result]?.type">{{
|
||||
auditResultMeta[item.result]?.label || item.result
|
||||
}}</ElTag>
|
||||
<span class="node-tags">
|
||||
<ElTag size="small" :type="auditResultMeta[item.result]?.type">{{
|
||||
auditResultMeta[item.result]?.label || item.result
|
||||
}}</ElTag>
|
||||
<ElTag
|
||||
v-if="isFullEventTimeline"
|
||||
size="small"
|
||||
effect="plain"
|
||||
:type="auditRiskMeta[item.risk_level]?.type"
|
||||
>
|
||||
{{ auditRiskMeta[item.risk_level]?.label || item.risk_level }}风险
|
||||
</ElTag>
|
||||
</span>
|
||||
</div>
|
||||
<p>{{ item.summary || '-' }}</p>
|
||||
<div class="node-meta">
|
||||
<p v-if="!isFullEventTimeline">{{ item.summary || '-' }}</p>
|
||||
<template v-if="isFullEventTimeline">
|
||||
<ElDescriptions class="actor-event-summary" :column="4" size="small" border>
|
||||
<ElDescriptionsItem label="分类">
|
||||
{{ auditCategoryLabels[item.category] || item.category }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="来源">
|
||||
{{ auditSourceLabels[item.source] || item.source }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="操作者">
|
||||
{{ actorDisplay(item) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="业务范围">
|
||||
{{ scopeDisplay(item) }}
|
||||
</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
|
||||
<ElCollapse class="actor-event-sections">
|
||||
<ElCollapseItem
|
||||
v-if="userStore.isSuperAdmin && hasRequestContext(item)"
|
||||
title="请求上下文"
|
||||
name="request"
|
||||
>
|
||||
<ElDescriptions :column="1" size="small" border>
|
||||
<ElDescriptionsItem label="请求">
|
||||
{{
|
||||
[item.request_method, item.request_path].filter(Boolean).join(' ') || '-'
|
||||
}}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="request_id">{{
|
||||
item.request_id || '-'
|
||||
}}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="correlation_id">{{
|
||||
item.correlation_id || '-'
|
||||
}}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="IP 地址">{{
|
||||
item.ip_address || '-'
|
||||
}}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="User-Agent">{{
|
||||
item.user_agent || '-'
|
||||
}}</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
</ElCollapseItem>
|
||||
<ElCollapseItem v-if="hasBatchData(item)" title="批次执行统计" name="batch">
|
||||
<ElDescriptions :column="3" size="small" border>
|
||||
<ElDescriptionsItem label="处理总数">{{
|
||||
item.batch_total || 0
|
||||
}}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="成功数">{{
|
||||
item.success_count || 0
|
||||
}}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="失败数">{{
|
||||
item.fail_count || 0
|
||||
}}</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
</ElCollapseItem>
|
||||
<ElCollapseItem
|
||||
v-if="item.error_code || item.error_summary"
|
||||
title="错误信息"
|
||||
name="error"
|
||||
>
|
||||
<ElDescriptions :column="1" size="small" border>
|
||||
<ElDescriptionsItem label="错误码">{{
|
||||
item.error_code || '-'
|
||||
}}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="错误摘要">{{
|
||||
item.error_summary || '-'
|
||||
}}</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
</ElCollapseItem>
|
||||
<ElCollapseItem
|
||||
v-if="item.resources?.length"
|
||||
title="相关资源与快照"
|
||||
name="resources"
|
||||
>
|
||||
<div class="actor-resource-list">
|
||||
<section
|
||||
v-for="resource in item.resources"
|
||||
:key="resourceKey(resource)"
|
||||
class="actor-resource"
|
||||
>
|
||||
<div class="actor-resource__title">
|
||||
<strong>{{
|
||||
resource.display_name ||
|
||||
resource.resource_key ||
|
||||
resource.resource_id ||
|
||||
'-'
|
||||
}}</strong>
|
||||
<ElTag size="small" effect="plain">
|
||||
{{ auditResourceRelationLabels[resource.relation] || resource.relation }}
|
||||
</ElTag>
|
||||
</div>
|
||||
<ElDescriptions :column="2" size="small">
|
||||
<ElDescriptionsItem label="资源类型">
|
||||
{{
|
||||
auditResourceTypeLabels[resource.resource_type] ||
|
||||
resource.resource_type
|
||||
}}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="业务角色">{{
|
||||
resource.role || '-'
|
||||
}}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="资源标识">
|
||||
{{ resource.resource_key || resource.resource_id || '-' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="主体摘要">{{
|
||||
resource.subject_summary || '-'
|
||||
}}</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
<ElCollapse class="resource-json-sections">
|
||||
<ElCollapseItem
|
||||
v-if="hasJsonContent(resource.identity_snapshot)"
|
||||
title="身份快照"
|
||||
name="identity"
|
||||
>
|
||||
<pre>{{ auditJson(resource.identity_snapshot) }}</pre>
|
||||
</ElCollapseItem>
|
||||
<ElCollapseItem
|
||||
v-if="hasJsonContent(resource.subject_data)"
|
||||
title="主体安全数据"
|
||||
name="subject"
|
||||
>
|
||||
<pre>{{ auditJson(resource.subject_data) }}</pre>
|
||||
</ElCollapseItem>
|
||||
<ElCollapseItem
|
||||
v-if="hasJsonContent(resource.before_data)"
|
||||
title="变更前"
|
||||
name="before"
|
||||
>
|
||||
<pre>{{ auditJson(resource.before_data) }}</pre>
|
||||
</ElCollapseItem>
|
||||
<ElCollapseItem
|
||||
v-if="hasJsonContent(resource.after_data)"
|
||||
title="变更后"
|
||||
name="after"
|
||||
>
|
||||
<pre>{{ auditJson(resource.after_data) }}</pre>
|
||||
</ElCollapseItem>
|
||||
</ElCollapse>
|
||||
</section>
|
||||
</div>
|
||||
</ElCollapseItem>
|
||||
<ElCollapseItem
|
||||
v-if="userStore.isSuperAdmin && hasJsonContent(item.metadata)"
|
||||
title="扩展元数据"
|
||||
name="metadata"
|
||||
>
|
||||
<pre>{{ auditJson(item.metadata) }}</pre>
|
||||
</ElCollapseItem>
|
||||
</ElCollapse>
|
||||
</template>
|
||||
<div v-else class="node-meta">
|
||||
<span>{{ item.actor_name || item.actor_id || '-' }}</span>
|
||||
<span>{{ auditSourceLabels[item.source] || item.source }}</span>
|
||||
</div>
|
||||
@@ -45,16 +205,65 @@
|
||||
<article class="timeline-node">
|
||||
<div class="node-head">
|
||||
<strong>{{ node.title }}</strong>
|
||||
<ElTag size="small" effect="plain">{{
|
||||
auditResultDisplay(node.result, node.result_name)
|
||||
}}</ElTag>
|
||||
<span class="node-tags">
|
||||
<ElTag size="small" effect="plain">{{
|
||||
auditResultDisplay(node.result, node.result_name)
|
||||
}}</ElTag>
|
||||
<ElTag v-if="node.reference_only" size="small" type="info" effect="plain">
|
||||
只读引用
|
||||
</ElTag>
|
||||
</span>
|
||||
</div>
|
||||
<p>{{ node.summary || '-' }}</p>
|
||||
<div class="node-meta">
|
||||
<p v-if="!isStructuredLinkTimeline">{{ node.summary || '-' }}</p>
|
||||
<template v-if="isStructuredLinkTimeline">
|
||||
<ElDescriptions class="actor-event-summary" :column="4" size="small" border>
|
||||
<ElDescriptionsItem label="事实来源">
|
||||
{{ recordSourceLabels[node.record_source] || node.record_source }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="稳定编码">{{ node.code || '-' }}</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
<ElCollapse class="actor-event-sections">
|
||||
<ElCollapseItem
|
||||
v-if="userStore.isSuperAdmin && hasJsonContent(node.fidelity)"
|
||||
title="数据完整性"
|
||||
name="fidelity"
|
||||
>
|
||||
<pre>{{ auditJson(node.fidelity) }}</pre>
|
||||
</ElCollapseItem>
|
||||
<ElCollapseItem v-if="node.resources?.length" title="相关资源" name="resources">
|
||||
<div class="actor-resource-list">
|
||||
<section
|
||||
v-for="(resource, index) in node.resources"
|
||||
:key="
|
||||
[
|
||||
resource.resource_type,
|
||||
resource.resource_id || resource.resource_key,
|
||||
index
|
||||
].join(':')
|
||||
"
|
||||
class="actor-resource"
|
||||
>
|
||||
<div class="actor-resource__title">
|
||||
<strong>{{ resource.display_name || resource.resource_key || '-' }}</strong>
|
||||
</div>
|
||||
<ElDescriptions :column="2" size="small">
|
||||
<ElDescriptionsItem label="资源类型">
|
||||
{{
|
||||
auditResourceTypeLabels[resource.resource_type] ||
|
||||
resource.resource_type
|
||||
}}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem v-if="resource.resource_key" label="资源业务 Key">
|
||||
{{ resource.resource_key }}
|
||||
</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
</section>
|
||||
</div>
|
||||
</ElCollapseItem>
|
||||
</ElCollapse>
|
||||
</template>
|
||||
<div v-else class="node-meta">
|
||||
<span>{{ recordSourceLabels[node.record_source] || node.record_source }}</span>
|
||||
<ElTag v-if="node.reference_only" size="small" type="info" effect="plain">
|
||||
只读引用
|
||||
</ElTag>
|
||||
</div>
|
||||
</article>
|
||||
</ElTimelineItem>
|
||||
@@ -75,13 +284,63 @@
|
||||
{{ auditResultDisplay(item.result, item.result_name) }}
|
||||
</ElTag>
|
||||
</div>
|
||||
<p v-if="item.amount !== null && item.amount !== undefined">
|
||||
金额:{{ formatMoney(item.amount, item.currency) }}
|
||||
</p>
|
||||
<div class="node-meta">
|
||||
<span>{{ item.code || '-' }}</span>
|
||||
<span>{{ item.record_source || '-' }}</span>
|
||||
</div>
|
||||
<ElDescriptions class="actor-event-summary" :column="4" size="small" border>
|
||||
<ElDescriptionsItem
|
||||
v-if="item.amount !== null && item.amount !== undefined"
|
||||
label="金额"
|
||||
>
|
||||
{{ formatMoney(item.amount, item.currency) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem
|
||||
v-if="item.balance_before !== null && item.balance_before !== undefined"
|
||||
label="变更前余额"
|
||||
>
|
||||
{{ formatMoney(item.balance_before, item.currency) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem
|
||||
v-if="item.balance_after !== null && item.balance_after !== undefined"
|
||||
label="变更后余额"
|
||||
>
|
||||
{{ formatMoney(item.balance_after, item.currency) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="币种">{{ item.currency || '-' }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="事实来源">
|
||||
{{ financeRecordSourceLabel(item.record_source) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="稳定编码">{{ item.code || '-' }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="钱包类型">
|
||||
{{ financeWalletTypeLabel(item.wallet?.resource_type) }}
|
||||
</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
<ElCollapse
|
||||
v-if="item.amount_authority || hasJsonContent(item.facts)"
|
||||
class="actor-event-sections"
|
||||
>
|
||||
<ElCollapseItem v-if="item.amount_authority" title="金额权威来源" name="authority">
|
||||
<ElDescriptions :column="1" size="small" border>
|
||||
<ElDescriptionsItem label="是否权威">
|
||||
<ElTag
|
||||
size="small"
|
||||
:type="item.amount_authority.authoritative ? 'success' : 'info'"
|
||||
>
|
||||
{{ item.amount_authority.authoritative ? '是' : '否' }}
|
||||
</ElTag>
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem v-if="item.amount_authority.table" label="业务表">
|
||||
{{ item.amount_authority.table }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem v-if="item.amount_authority.field" label="金额字段">
|
||||
{{ item.amount_authority.field }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem v-if="item.amount_authority.conflict_rule" label="冲突规则">
|
||||
{{ item.amount_authority.conflict_rule }}
|
||||
</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
</ElCollapseItem>
|
||||
<ElCollapseItem v-if="hasJsonContent(item.facts)" title="安全结构化事实" name="facts">
|
||||
<pre>{{ auditJsonWithoutIds(item.facts) }}</pre>
|
||||
</ElCollapseItem>
|
||||
</ElCollapse>
|
||||
</article>
|
||||
</ElTimelineItem>
|
||||
</ElTimeline>
|
||||
@@ -138,62 +397,110 @@
|
||||
</template>
|
||||
|
||||
<template v-else-if="integrationDetail">
|
||||
<ElDescriptions :column="2" border>
|
||||
<ElDescriptionsItem label="提供方">
|
||||
{{ integrationDetail.identity.provider_name || integrationDetail.identity.provider }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="方向">
|
||||
{{ integrationDetail.identity.direction_name || integrationDetail.identity.direction }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="操作">
|
||||
{{ integrationDetail.identity.operation_name || integrationDetail.identity.operation }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="结果">
|
||||
<section class="integration-hero">
|
||||
<div>
|
||||
<span class="integration-hero__eyebrow">
|
||||
{{ integrationDetail.identity.provider_name || integrationDetail.identity.provider }}
|
||||
·
|
||||
{{
|
||||
integrationDetail.identity.direction_name || integrationDetail.identity.direction
|
||||
}}
|
||||
</span>
|
||||
<h3>{{
|
||||
integrationDetail.identity.operation_name || integrationDetail.identity.operation
|
||||
}}</h3>
|
||||
<p>{{ formatDateTime(integrationDetail.timestamps.created_at) }}</p>
|
||||
</div>
|
||||
<div class="integration-hero__result">
|
||||
<ElTag
|
||||
size="small"
|
||||
:type="integrationCategoryMeta[integrationDetail.result.category]?.type || 'info'"
|
||||
>
|
||||
{{ auditResultDisplay(integrationDetail.result.code, integrationDetail.result.name) }}
|
||||
</ElTag>
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="耗时">
|
||||
{{ integrationDetail.result.duration_ms }} ms
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="HTTP 状态">
|
||||
{{ integrationDetail.result.http_status ?? '-' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem v-if="integrationDetail.identity.external_id" label="外部业务标识">
|
||||
{{ integrationDetail.identity.external_id }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem v-if="integrationDetail.resource?.key" label="资源业务标识">
|
||||
{{ integrationDetail.resource.key }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem
|
||||
v-if="integrationDetail.result.provider_message"
|
||||
label="外部结果摘要"
|
||||
:span="2"
|
||||
>
|
||||
{{ integrationDetail.result.provider_message }}
|
||||
</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
<section
|
||||
v-if="
|
||||
hasJsonContent(integrationDetail.content.request_summary) ||
|
||||
hasJsonContent(integrationDetail.content.response_summary) ||
|
||||
hasJsonContent(integrationDetail.content.metadata)
|
||||
"
|
||||
class="json-section"
|
||||
>
|
||||
<strong>{{ integrationDetail.result.duration_ms ?? '-' }} ms</strong>
|
||||
<span>处理耗时</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="integration-detail-grid">
|
||||
<section class="integration-panel">
|
||||
<h4>交互信息</h4>
|
||||
<ElDescriptions :column="2" size="small">
|
||||
<ElDescriptionsItem label="提供方">
|
||||
{{
|
||||
integrationDetail.identity.provider_name || integrationDetail.identity.provider
|
||||
}}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="方向">
|
||||
{{
|
||||
integrationDetail.identity.direction_name || integrationDetail.identity.direction
|
||||
}}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="操作" :span="2">
|
||||
{{
|
||||
integrationDetail.identity.operation_name || integrationDetail.identity.operation
|
||||
}}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem
|
||||
v-if="integrationDetail.result.http_status != null"
|
||||
label="HTTP 状态"
|
||||
>
|
||||
{{ integrationDetail.result.http_status }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="状态是否变化">
|
||||
{{ integrationDetail.result.state_changed ? '是' : '否' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem
|
||||
v-if="integrationDetail.result.provider_message"
|
||||
label="外部结果说明"
|
||||
:span="2"
|
||||
>
|
||||
{{ integrationDetail.result.provider_message }}
|
||||
</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
</section>
|
||||
|
||||
<section class="integration-panel">
|
||||
<h4>触发信息</h4>
|
||||
<ElDescriptions :column="1" size="small">
|
||||
<ElDescriptionsItem label="触发来源">
|
||||
{{ triggerSourceLabel(integrationDetail.trigger.source) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="业务场景">
|
||||
{{ triggerSceneLabel(integrationDetail.trigger.scene) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="开始时间">
|
||||
{{ formatDateTime(integrationDetail.timestamps.started_at) }}
|
||||
</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<section v-if="hasVisibleIntegrationContent" class="integration-panel integration-content">
|
||||
<h4>交互内容摘要</h4>
|
||||
<pre v-if="hasJsonContent(integrationDetail.content.request_summary)">{{
|
||||
auditJson(integrationDetail.content.request_summary)
|
||||
}}</pre>
|
||||
<pre v-if="hasJsonContent(integrationDetail.content.response_summary)">{{
|
||||
auditJson(integrationDetail.content.response_summary)
|
||||
}}</pre>
|
||||
<pre v-if="hasJsonContent(integrationDetail.content.metadata)">{{
|
||||
auditJson(integrationDetail.content.metadata)
|
||||
}}</pre>
|
||||
<div class="integration-content-grid">
|
||||
<div
|
||||
v-if="hasJsonContentWithoutIds(integrationDetail.content.request_summary)"
|
||||
class="content-block"
|
||||
>
|
||||
<span>请求摘要</span>
|
||||
<pre>{{ auditJsonWithoutIds(integrationDetail.content.request_summary) }}</pre>
|
||||
</div>
|
||||
<div
|
||||
v-if="hasJsonContentWithoutIds(integrationDetail.content.response_summary)"
|
||||
class="content-block"
|
||||
>
|
||||
<span>响应摘要</span>
|
||||
<pre>{{ auditJsonWithoutIds(integrationDetail.content.response_summary) }}</pre>
|
||||
</div>
|
||||
<div
|
||||
v-if="hasJsonContentWithoutIds(integrationDetail.content.metadata)"
|
||||
class="content-block"
|
||||
>
|
||||
<span>扩展信息</span>
|
||||
<pre>{{ auditJsonWithoutIds(integrationDetail.content.metadata) }}</pre>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
@@ -226,13 +533,19 @@
|
||||
} from '@/types/api'
|
||||
import {
|
||||
auditJson,
|
||||
auditCategoryLabels,
|
||||
auditResourceRelationLabels,
|
||||
auditResourceTypeLabels,
|
||||
auditResultDisplay,
|
||||
auditResultMeta,
|
||||
auditRiskMeta,
|
||||
auditScopeTypeLabels,
|
||||
auditSourceLabels,
|
||||
integrationCategoryMeta
|
||||
} from '@/utils/business/audit'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import { canLoadAuditInvestigation } from '@/utils/business/auditAccess'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import type { AuditInvestigationTarget } from './types'
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -240,6 +553,7 @@
|
||||
target?: AuditInvestigationTarget | null
|
||||
}>()
|
||||
const emit = defineEmits<{ 'update:modelValue': [value: boolean] }>()
|
||||
const userStore = useUserStore()
|
||||
|
||||
const visible = computed({
|
||||
get: () => props.modelValue,
|
||||
@@ -268,6 +582,12 @@
|
||||
const eventDetail = ref<AuditEventDetail>()
|
||||
const integrationDetail = ref<IntegrationDetailResponse>()
|
||||
let loadSequence = 0
|
||||
const isFullEventTimeline = computed(() =>
|
||||
['actor', 'resource'].includes(props.target?.mode || '')
|
||||
)
|
||||
const isStructuredLinkTimeline = computed(() =>
|
||||
['request', 'correlation'].includes(props.target?.mode || '')
|
||||
)
|
||||
|
||||
const recordSourceLabels: Record<string, string> = {
|
||||
audit_event: '审计事件',
|
||||
@@ -276,6 +596,21 @@
|
||||
asynq_task: '异步任务引用',
|
||||
domain_ledger_ref: '业务台账引用'
|
||||
}
|
||||
const financeRecordSourceLabels: Record<string, string> = {
|
||||
audit_event: '审计事件',
|
||||
domain_ledger_ref: '业务台账引用',
|
||||
agent_wallet_transaction: '代理钱包流水',
|
||||
asset_wallet_transaction: '资产钱包流水',
|
||||
agent_wallet_reservation: '代理钱包预留',
|
||||
order: '订单',
|
||||
payment: '支付',
|
||||
refund: '退款',
|
||||
agent_recharge: '代理充值',
|
||||
recharge_order: '充值订单',
|
||||
commission_record: '佣金记录',
|
||||
commission_withdrawal: '佣金提现',
|
||||
approval_instance: '审批实例'
|
||||
}
|
||||
|
||||
const clear = () => {
|
||||
eventItems.value = []
|
||||
@@ -288,12 +623,96 @@
|
||||
}
|
||||
const hasJsonContent = (value?: Record<string, unknown> | null) =>
|
||||
Boolean(value && Object.keys(value).length)
|
||||
const auditJsonWithoutIds = (value?: Record<string, unknown> | null) => {
|
||||
const removeIds = (current: unknown): unknown => {
|
||||
if (Array.isArray(current)) return current.map(removeIds)
|
||||
if (!current || typeof current !== 'object') return current
|
||||
return Object.fromEntries(
|
||||
Object.entries(current as Record<string, unknown>)
|
||||
.filter(([key]) => !/(^|[_-])ids?$/i.test(key))
|
||||
.map(([key, nested]) => [key, removeIds(nested)])
|
||||
)
|
||||
}
|
||||
return auditJson(removeIds(value))
|
||||
}
|
||||
const withoutIds = (value?: Record<string, unknown> | null) => {
|
||||
const removeIds = (current: unknown): unknown => {
|
||||
if (Array.isArray(current)) return current.map(removeIds)
|
||||
if (!current || typeof current !== 'object') return current
|
||||
return Object.fromEntries(
|
||||
Object.entries(current as Record<string, unknown>)
|
||||
.filter(([key]) => !/(^|[_-])ids?$/i.test(key))
|
||||
.map(([key, nested]) => [key, removeIds(nested)])
|
||||
)
|
||||
}
|
||||
return removeIds(value) as Record<string, unknown> | null | undefined
|
||||
}
|
||||
const hasJsonContentWithoutIds = (value?: Record<string, unknown> | null) =>
|
||||
hasJsonContent(withoutIds(value))
|
||||
const hasVisibleIntegrationContent = computed(() =>
|
||||
Boolean(
|
||||
integrationDetail.value &&
|
||||
[
|
||||
integrationDetail.value.content.request_summary,
|
||||
integrationDetail.value.content.response_summary,
|
||||
integrationDetail.value.content.metadata
|
||||
].some(hasJsonContentWithoutIds)
|
||||
)
|
||||
)
|
||||
const triggerSourceLabel = (source?: string | null) =>
|
||||
({ polling: '定时轮询', webhook: '外部回调', manual: '人工触发' })[source || ''] ||
|
||||
source ||
|
||||
'-'
|
||||
const triggerSceneLabel = (scene?: string | null) =>
|
||||
({ network_polling: '网络状态轮询' })[scene || ''] || scene || '-'
|
||||
const financeRecordSourceLabel = (source: string) =>
|
||||
financeRecordSourceLabels[source] || source || '-'
|
||||
const financeWalletTypeLabel = (type?: 'agent_wallet' | 'asset_wallet') =>
|
||||
type === 'agent_wallet' ? '代理钱包' : type === 'asset_wallet' ? '资产钱包' : '-'
|
||||
const actorDisplay = (item: AuditEventView) => {
|
||||
const actor = item.actor_name || item.actor_id || '-'
|
||||
const organizations = [
|
||||
item.actor_shop_name || (item.actor_shop_id ? `店铺 ID: ${item.actor_shop_id}` : ''),
|
||||
item.actor_enterprise_name ||
|
||||
(item.actor_enterprise_id ? `企业 ID: ${item.actor_enterprise_id}` : '')
|
||||
].filter(Boolean)
|
||||
return organizations.length ? `${actor}(${organizations.join(' · ')})` : actor
|
||||
}
|
||||
const scopeDisplay = (item: AuditEventView) => {
|
||||
const scope = item.scope_name || item.scope_id
|
||||
const type = auditScopeTypeLabels[item.scope_type] || item.scope_type
|
||||
return scope ? `${type} · ${scope}` : type || '-'
|
||||
}
|
||||
const hasRequestContext = (item: AuditEventView) =>
|
||||
Boolean(
|
||||
item.request_method ||
|
||||
item.request_path ||
|
||||
item.request_id ||
|
||||
item.correlation_id ||
|
||||
item.ip_address ||
|
||||
item.user_agent
|
||||
)
|
||||
const hasBatchData = (item: AuditEventView) =>
|
||||
Boolean(
|
||||
(item.batch_total || 0) > 0 || (item.success_count || 0) > 0 || (item.fail_count || 0) > 0
|
||||
)
|
||||
const resourceKey = (resource: AuditEventView['resources'][number]) =>
|
||||
[resource.resource_type, resource.resource_id || resource.resource_key, resource.sort_order]
|
||||
.filter((value) => value !== null && value !== undefined && value !== '')
|
||||
.join(':')
|
||||
const formatMoney = (amount: number, currency?: string | null) => {
|
||||
const value = (amount / 100).toFixed(2)
|
||||
return currency === 'CNY' || !currency ? `¥${value}` : `${value} ${currency}`
|
||||
}
|
||||
const load = async () => {
|
||||
if (!props.target) return
|
||||
if (
|
||||
!canLoadAuditInvestigation(props.target, userStore.info.user_type, userStore.isSuperAdmin)
|
||||
) {
|
||||
clear()
|
||||
ElMessage.error('当前账号无权访问该审计调查')
|
||||
return
|
||||
}
|
||||
const sequence = ++loadSequence
|
||||
clear()
|
||||
loading.value = true
|
||||
@@ -430,10 +849,143 @@
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.node-tags {
|
||||
display: inline-flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.actor-event-summary {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.actor-event-sections {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.actor-resource-list {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.actor-resource {
|
||||
padding: 12px;
|
||||
background: var(--el-fill-color-lighter);
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.actor-resource__title {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.resource-json-sections {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.json-section {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.integration-hero {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 18px 20px;
|
||||
margin-bottom: 16px;
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
var(--el-color-primary-light-9),
|
||||
var(--el-fill-color-light)
|
||||
);
|
||||
border: 1px solid var(--el-color-primary-light-7);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.integration-hero__eyebrow,
|
||||
.integration-hero p,
|
||||
.integration-hero__result span,
|
||||
.content-block > span {
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.integration-hero h3 {
|
||||
margin: 6px 0;
|
||||
font-size: 18px;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.integration-hero p {
|
||||
margin: 0;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.integration-hero__result {
|
||||
display: grid;
|
||||
gap: 5px;
|
||||
justify-items: end;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.integration-hero__result strong {
|
||||
font-size: 20px;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.integration-hero__result span {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.integration-detail-grid,
|
||||
.integration-content-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.integration-panel {
|
||||
padding: 16px;
|
||||
margin-bottom: 12px;
|
||||
background: var(--el-bg-color);
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.integration-panel h4 {
|
||||
margin: 0 0 12px;
|
||||
font-size: 14px;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.integration-panel :deep(.el-descriptions__label) {
|
||||
width: 76px;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.integration-content {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.integration-content-grid {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.content-block {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.content-block > span {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.json-section h4 {
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
@@ -448,6 +1000,24 @@
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
@media (width <= 640px) {
|
||||
.integration-hero,
|
||||
.integration-detail-grid,
|
||||
.integration-content-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.integration-hero {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.integration-hero__result {
|
||||
justify-items: start;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
.pagination {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
<template>
|
||||
<div v-if="hasLinks" class="investigation-links" aria-label="调查入口">
|
||||
<ElButton v-if="eventId" link type="primary" @click="openEvent">事件详情</ElButton>
|
||||
<ElButton v-if="actorRef" link type="primary" @click="openActor"> 操作者行为时间线 </ElButton>
|
||||
<ElButton
|
||||
v-show="showResources"
|
||||
v-for="resource in stableResourceRefs"
|
||||
:key="`${resource.resource_type}:${resource.resource_id}`"
|
||||
link
|
||||
type="primary"
|
||||
:title="resourceTimelineLabel(resource)"
|
||||
:aria-label="resourceTimelineLabel(resource)"
|
||||
@click="openResource(resource)"
|
||||
>
|
||||
资源审计时间线
|
||||
{{ resourceTimelineLabel(resource) }}
|
||||
</ElButton>
|
||||
<ElButton
|
||||
v-show="showResources"
|
||||
v-for="resource in searchableResourceRefs"
|
||||
:key="`${resource.resource_type}:${resource.resource_key}`"
|
||||
link
|
||||
@@ -32,7 +35,7 @@
|
||||
业务关联链路
|
||||
</ElButton>
|
||||
<ElButton
|
||||
v-for="item in stableIntegrationRefs"
|
||||
v-for="item in visibleIntegrationRefs"
|
||||
:key="item.integration_id"
|
||||
link
|
||||
type="primary"
|
||||
@@ -52,15 +55,18 @@
|
||||
AuditSearchResourceType
|
||||
} from '@/types/api'
|
||||
import { openAuditInvestigation, openAuditResourceSearch } from './investigationController'
|
||||
import { auditResourceTypeLabels } from '@/utils/business/audit'
|
||||
import { resolveInvestigationReference } from '@/utils/business/auditNavigation'
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
import { AUDIT_PERMISSIONS } from '@/config/constants/audit'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
refs?: AuditInvestigationRefs | null
|
||||
currentEventId?: string
|
||||
showEmpty?: boolean
|
||||
showResources?: boolean
|
||||
}>(),
|
||||
{ currentEventId: '', showEmpty: true }
|
||||
{ showEmpty: true, showResources: true }
|
||||
)
|
||||
const searchableTypes = new Set<AuditSearchResourceType>([
|
||||
'iot_card',
|
||||
@@ -69,12 +75,7 @@
|
||||
'order',
|
||||
'refund'
|
||||
])
|
||||
const eventId = computed(
|
||||
() =>
|
||||
resolveInvestigationReference(props.refs?.event_id, {
|
||||
currentId: props.currentEventId
|
||||
}) || ''
|
||||
)
|
||||
const { hasAuth } = useAuth()
|
||||
const requestId = computed(() => resolveInvestigationReference(props.refs?.request_id) || '')
|
||||
const correlationId = computed(
|
||||
() => resolveInvestigationReference(props.refs?.correlation_id) || ''
|
||||
@@ -105,21 +106,20 @@
|
||||
const stableIntegrationRefs = computed(() =>
|
||||
(props.refs?.integration_refs || []).filter((item) => Boolean(item.integration_id))
|
||||
)
|
||||
const visibleIntegrationRefs = computed(() =>
|
||||
hasAuth(AUDIT_PERMISSIONS.auditEventIntegrationDetail) ? stableIntegrationRefs.value : []
|
||||
)
|
||||
const hasLinks = computed(() =>
|
||||
Boolean(
|
||||
eventId.value ||
|
||||
actorRef.value ||
|
||||
actorRef.value ||
|
||||
requestId.value ||
|
||||
correlationId.value ||
|
||||
stableResourceRefs.value.length ||
|
||||
searchableResourceRefs.value.length ||
|
||||
stableIntegrationRefs.value.length
|
||||
(props.showResources &&
|
||||
(stableResourceRefs.value.length || searchableResourceRefs.value.length)) ||
|
||||
visibleIntegrationRefs.value.length
|
||||
)
|
||||
)
|
||||
|
||||
const openEvent = () => {
|
||||
if (eventId.value) openAuditInvestigation({ mode: 'event', id: eventId.value })
|
||||
}
|
||||
const openIntegration = (id: string) => openAuditInvestigation({ mode: 'integration', id })
|
||||
const openTimeline = (mode: 'request' | 'correlation', id: string) =>
|
||||
openAuditInvestigation({ mode, id })
|
||||
@@ -135,6 +135,10 @@
|
||||
resourceType: resource.resource_type,
|
||||
id: resource.resource_id
|
||||
})
|
||||
const resourceTimelineLabel = (
|
||||
resource: AuditInvestigationResourceRef & { resource_id: string }
|
||||
) =>
|
||||
`资源审计时间线 · ${auditResourceTypeLabels[resource.resource_type] || resource.resource_type} · ${resource.resource_id}`
|
||||
const searchResource = (
|
||||
resource: AuditInvestigationResourceRef & {
|
||||
resource_type: AuditSearchResourceType
|
||||
|
||||
@@ -39,10 +39,10 @@
|
||||
})
|
||||
|
||||
// 合并默认配置和自定义配置
|
||||
const config = reactive({
|
||||
const config = computed(() => ({
|
||||
placeholder: `${t('table.searchBar.searchSelectPlaceholder')}${prop.item.label}`,
|
||||
...(prop.item.config || {})
|
||||
})
|
||||
}))
|
||||
|
||||
// 选择框值变化处理函数
|
||||
const changeValue = (val: unknown): void => {
|
||||
|
||||
@@ -65,10 +65,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- 通知 -->
|
||||
<div
|
||||
class="btn-box notice-btn"
|
||||
@click.stop="showNotice = !showNotice"
|
||||
>
|
||||
<div class="btn-box notice-btn" @click.stop="showNotice = !showNotice">
|
||||
<div class="btn notice-button">
|
||||
<i class="iconfont-sys"></i>
|
||||
<span v-if="unreadCount > 0" class="notice-count">{{ formattedUnreadCount }}</span>
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
:key="tab.value"
|
||||
type="button"
|
||||
:class="{ active: activeCategory === tab.value }"
|
||||
@click="activeCategory = tab.value"
|
||||
@click="handleCategoryChange(tab.value)"
|
||||
>
|
||||
{{ tab.label }}<span v-if="tab.count"> ({{ tab.count }})</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
<div v-loading="notificationStore.loading" class="scroll">
|
||||
<div ref="notificationListRef" v-loading="notificationStore.loading" class="scroll">
|
||||
<button
|
||||
v-for="item in filteredItems"
|
||||
:key="item.id"
|
||||
@@ -43,6 +43,21 @@
|
||||
<p>暂无通知</p>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="notificationStore.notificationTotal > notificationStore.notificationPageSize"
|
||||
class="pagination"
|
||||
>
|
||||
<ElPagination
|
||||
:current-page="notificationStore.notificationPage"
|
||||
:page-size="notificationStore.notificationPageSize"
|
||||
:total="notificationStore.notificationTotal"
|
||||
:pager-count="5"
|
||||
background
|
||||
layout="prev, pager, next"
|
||||
small
|
||||
@current-change="handlePageChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -64,6 +79,7 @@
|
||||
const router = useRouter()
|
||||
const notificationStore = useNotificationStore()
|
||||
const activeCategory = ref<'all' | NotificationCategory>('all')
|
||||
const notificationListRef = ref<HTMLElement | null>(null)
|
||||
const visible = computed(() => props.modelValue)
|
||||
|
||||
const categoryMatches = (item: NotificationItem, category: string) => {
|
||||
@@ -96,6 +112,24 @@
|
||||
|
||||
const close = () => emit('update:modelValue', false)
|
||||
|
||||
const loadNotificationPage = async (page: number) => {
|
||||
try {
|
||||
await notificationStore.loadNotifications(page)
|
||||
notificationListRef.value?.scrollTo({ top: 0 })
|
||||
} catch (error: any) {
|
||||
ElMessage.error(error?.message || '获取通知失败')
|
||||
}
|
||||
}
|
||||
|
||||
const handleCategoryChange = (category: 'all' | NotificationCategory) => {
|
||||
activeCategory.value = category
|
||||
void loadNotificationPage(1)
|
||||
}
|
||||
|
||||
const handlePageChange = (page: number) => {
|
||||
void loadNotificationPage(page)
|
||||
}
|
||||
|
||||
const handleMarkAllRead = async () => {
|
||||
try {
|
||||
const response = await notificationStore.markAllRead()
|
||||
|
||||
@@ -68,6 +68,18 @@
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.pagination {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 12px 8px;
|
||||
overflow-x: auto;
|
||||
border-top: 1px solid var(--art-border-color);
|
||||
|
||||
:deep(.el-pagination) {
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
.notification-item {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<template>
|
||||
<ElDialog v-model="visible" title="设置实名认证策略" width="35%">
|
||||
<ElForm ref="formRef" :model="form" :rules="rules" label-width="120px">
|
||||
<ElDialog
|
||||
v-model="visible"
|
||||
title="设置实名认证策略"
|
||||
width="40%"
|
||||
>
|
||||
<ElForm ref="formRef" :model="form" :rules="rules" label-width="80px">
|
||||
<ElFormItem label="资产标识">
|
||||
<span style="font-weight: bold; color: #409eff">{{ assetIdentifier }}</span>
|
||||
</ElFormItem>
|
||||
@@ -9,7 +13,7 @@
|
||||
{{ getPolicyName(currentPolicy) }}
|
||||
</ElTag>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="实名认证策略" prop="realname_policy">
|
||||
<ElFormItem label="认证策略" prop="realname_policy">
|
||||
<ElRadioGroup v-model="form.realname_policy">
|
||||
<ElRadio value="none">无需实名</ElRadio>
|
||||
<ElRadio value="before_order">先实名后充值/购买</ElRadio>
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<template>
|
||||
<ElDialog v-model="visible" title="切换SIM卡" width="600px" @close="handleClose">
|
||||
<ElDialog
|
||||
v-model="visible"
|
||||
title="切换SIM卡"
|
||||
width="40%"
|
||||
@close="handleClose"
|
||||
>
|
||||
<div v-if="loading" style="padding: 40px; text-align: center">
|
||||
<ElIcon class="is-loading" :size="40"><Loading /></ElIcon>
|
||||
<div style="margin-top: 16px">加载设备绑定的卡列表中...</div>
|
||||
@@ -24,7 +29,7 @@
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="rules"
|
||||
label-width="120px"
|
||||
label-width="90px"
|
||||
>
|
||||
<ElFormItem label="设备信息">
|
||||
<span style="font-weight: bold; color: #409eff">{{ deviceInfo }}</span>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* 权限检查 Composable
|
||||
* 用于在模板或脚本中检查用户权限
|
||||
*/
|
||||
@@ -18,6 +18,9 @@ export function usePermission() {
|
||||
// 是否是超级管理员
|
||||
const isSuperAdmin = computed(() => userStore.isSuperAdmin)
|
||||
|
||||
// 是否是超级管理员或平台用户
|
||||
const isPlatformAccount = computed(() => [1, 2].includes(Number(userStore.info.user_type)))
|
||||
|
||||
/**
|
||||
* 检查是否有指定权限
|
||||
* @param permission 权限码
|
||||
@@ -76,6 +79,7 @@ export function usePermission() {
|
||||
permissions,
|
||||
buttons,
|
||||
isSuperAdmin,
|
||||
isPlatformAccount,
|
||||
hasPermission,
|
||||
hasAnyPermission,
|
||||
hasAllPermissions,
|
||||
@@ -84,3 +88,4 @@ export function usePermission() {
|
||||
hasButton
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,11 @@ export const AUDIT_PERMISSIONS = {
|
||||
centerPage: 'audit:center_view',
|
||||
eventList: 'audit:event_list',
|
||||
eventDetail: 'audit:event_detail',
|
||||
auditEventResourceTimeline: 'audit:audit_event_resource_timeline',
|
||||
auditEventIntegrationDetail: 'audit:audit_event_integration_detail',
|
||||
integrationDetailRequestTimeline: 'audit:integration_detail_request_timeline',
|
||||
integrationDetailCorrelationTimeline: 'audit:integration_detail_correlation_timeline',
|
||||
integrationDetailResourceTimeline: 'audit:integration_detail_resource_timeline',
|
||||
actorTimeline: 'audit:actor_timeline',
|
||||
resourceSearch: 'audit:resource_search',
|
||||
resourceTimeline: 'audit:resource_timeline',
|
||||
@@ -11,16 +16,44 @@ export const AUDIT_PERMISSIONS = {
|
||||
financeTimeline: 'audit:finance_timeline',
|
||||
riskPage: 'audit:risk_view',
|
||||
riskEvents: 'audit:risk_events',
|
||||
riskEventDetail: 'audit:risk_event_detail',
|
||||
integrationPage: 'audit:integration_view',
|
||||
integrationDetail: 'audit:integration_detail',
|
||||
agentActivity: 'audit:agent_resource_activity',
|
||||
enterpriseActivity: 'audit:enterprise_resource_activity',
|
||||
agentCardActivity: 'audit:agent_card_activity',
|
||||
agentDeviceActivity: 'audit:agent_device_activity',
|
||||
enterpriseCardActivity: 'audit:enterprise_card_activity',
|
||||
enterpriseDeviceActivity: 'audit:enterprise_device_activity',
|
||||
agentExchangeActivity: 'audit:agent_exchange_activity',
|
||||
cardEntry: 'audit:card_entry',
|
||||
deviceEntry: 'audit:device_entry',
|
||||
exchangeEntry: 'audit:exchange_entry',
|
||||
exchangeOldAssetEntry: 'audit:exchange_old_asset_entry',
|
||||
exchangeNewAssetEntry: 'audit:exchange_new_asset_entry',
|
||||
agentAssetAllocationActivity: 'audit:agent_asset_allocation_activity',
|
||||
assetAllocationEntry: 'audit:asset_allocation_entry',
|
||||
assetAllocationAssetEntry: 'audit:asset_allocation_asset_entry',
|
||||
assetInfoEntry: 'audit:asset_info_entry',
|
||||
agentAssetInfoCardActivity: 'audit:agent_asset_info_card_activity',
|
||||
agentAssetInfoDeviceActivity: 'audit:agent_asset_info_device_activity',
|
||||
enterpriseAssetInfoCardActivity: 'audit:enterprise_asset_info_card_activity',
|
||||
enterpriseAssetInfoDeviceActivity: 'audit:enterprise_asset_info_device_activity',
|
||||
assetInfoBindingCardEntry: 'audit:asset_info_binding_card_entry',
|
||||
agentAssetInfoBindingCardActivity: 'audit:agent_asset_info_binding_card_activity',
|
||||
enterpriseAssetInfoBindingCardActivity: 'audit:enterprise_asset_info_binding_card_activity',
|
||||
assetInfoWalletFinance: 'audit:asset_info_wallet_finance',
|
||||
assetInfoWalletAsset: 'audit:asset_info_wallet_asset',
|
||||
shopEntry: 'audit:shop_entry',
|
||||
enterpriseEntry: 'audit:enterprise_entry',
|
||||
orderEntry: 'audit:order_entry',
|
||||
orderFinanceEntry: 'audit:order_finance_entry',
|
||||
agentRechargeEntry: 'audit:agent_recharge_entry',
|
||||
agentRechargeFinanceEntry: 'audit:agent_recharge_finance_entry',
|
||||
agentRechargeApprovalEntry: 'audit:agent_recharge_approval_entry',
|
||||
refundEntry: 'audit:refund_entry',
|
||||
refundFinanceEntry: 'audit:refund_finance_entry',
|
||||
refundApprovalEntry: 'audit:refund_approval_entry',
|
||||
walletEntry: 'audit:wallet_entry'
|
||||
} as const
|
||||
|
||||
|
||||
21
src/config/constants/augustIteration.ts
Normal file
21
src/config/constants/augustIteration.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* 八月迭代新增后台权限编码。
|
||||
* 页面和按钮统一引用这里的常量,后端菜单权限可直接复用同名编码。
|
||||
*/
|
||||
export const AUGUST_PERMISSIONS = {
|
||||
employeeCollection: {
|
||||
billPage: 'employee_collection:bill_view',
|
||||
billDetail: 'employee_collection:bill_detail',
|
||||
billClose: 'employee_collection:bill_close',
|
||||
applicationPage: 'employee_collection:application_view',
|
||||
applicationCreate: 'employee_collection:application_create',
|
||||
applicationDetail: 'employee_collection:application_detail',
|
||||
applicationUpdate: 'employee_collection:application_update',
|
||||
paymentMethodPage: 'employee_collection:payment_method_view',
|
||||
paymentMethodCreate: 'employee_collection:payment_method_create',
|
||||
paymentMethodEdit: 'employee_collection:payment_method_edit',
|
||||
paymentMethodDelete: 'employee_collection:payment_method_delete'
|
||||
}
|
||||
} as const
|
||||
|
||||
export type AugustPermission = string
|
||||
@@ -26,11 +26,20 @@
|
||||
"setting": {
|
||||
"menuType": {
|
||||
"title": "Menu Layout",
|
||||
"list": ["Vertical", "Horizontal", "Mixed", "Dual"]
|
||||
"list": [
|
||||
"Vertical",
|
||||
"Horizontal",
|
||||
"Mixed",
|
||||
"Dual"
|
||||
]
|
||||
},
|
||||
"theme": {
|
||||
"title": "Theme Style",
|
||||
"list": ["Light", "Dark", "System"]
|
||||
"list": [
|
||||
"Light",
|
||||
"Dark",
|
||||
"System"
|
||||
]
|
||||
},
|
||||
"menu": {
|
||||
"title": "Menu Style"
|
||||
@@ -40,11 +49,17 @@
|
||||
},
|
||||
"box": {
|
||||
"title": "Box Style",
|
||||
"list": ["Border", "Shadow"]
|
||||
"list": [
|
||||
"Border",
|
||||
"Shadow"
|
||||
]
|
||||
},
|
||||
"container": {
|
||||
"title": "Container Width",
|
||||
"list": ["Full", "Boxed"]
|
||||
"list": [
|
||||
"Full",
|
||||
"Boxed"
|
||||
]
|
||||
},
|
||||
"basics": {
|
||||
"title": "Basic Config",
|
||||
@@ -82,8 +97,14 @@
|
||||
"notice": {
|
||||
"title": "Notice",
|
||||
"btnRead": "Mark as read",
|
||||
"bar": ["Notice", "Message", "Todo"],
|
||||
"text": ["No"],
|
||||
"bar": [
|
||||
"Notice",
|
||||
"Message",
|
||||
"Todo"
|
||||
],
|
||||
"text": [
|
||||
"No"
|
||||
],
|
||||
"viewAll": "View all"
|
||||
},
|
||||
"worktab": {
|
||||
@@ -275,10 +296,10 @@
|
||||
"evening": "Good evening!"
|
||||
},
|
||||
"exceptionPage": {
|
||||
"gohome": "Go Home",
|
||||
"403": "Sorry, you do not have permission to access this page",
|
||||
"404": "Sorry, the page you are trying to access does not exist",
|
||||
"500": "Sorry, there was an error on the server"
|
||||
"500": "Sorry, there was an error on the server",
|
||||
"gohome": "Go Home"
|
||||
},
|
||||
"menus": {
|
||||
"login": {
|
||||
@@ -406,6 +427,19 @@
|
||||
"orderList": "Order List",
|
||||
"orderDetail": "Order Details"
|
||||
},
|
||||
"financialManagement": {
|
||||
"title": "Financial Management",
|
||||
"agentRecharge": "Agent Recharge",
|
||||
"agentRechargeDetail": "Agent Recharge Details",
|
||||
"refundManagement": "Refund Management",
|
||||
"refundDetail": "Refund Details",
|
||||
"agentFundOverview": "Agent Fund Overview",
|
||||
"employeeCollectionBills": "Employee Collection Bills",
|
||||
"employeeCollectionBillDetail": "Bill Details",
|
||||
"employeeCollectionApplications": "Reconciliation Applications",
|
||||
"employeeCollectionApplicationDetail": "Application Details",
|
||||
"employeeCollectionPaymentMethods": "Payment Methods"
|
||||
},
|
||||
"deviceManagement": {
|
||||
"title": "Device Management",
|
||||
"devices": "Device Management"
|
||||
@@ -467,10 +501,15 @@
|
||||
"settings": {
|
||||
"title": "Settings Management",
|
||||
"paymentSettings": "Payment Settings",
|
||||
"agentSelfRecharge": "Agent Self-Recharge Settings",
|
||||
"detailsOfPaymentConfiguration": "Payment Configuration Details",
|
||||
"paymentMerchant": "Payment Merchant",
|
||||
"developerApi": "Developer API",
|
||||
"commissionTemplate": "Commission Template"
|
||||
"commissionTemplate": "Commission Template",
|
||||
"paymentMerchantPools": "Merchant Pool Management",
|
||||
"paymentMerchantPoolsTabMerchants": "Payment Merchants",
|
||||
"paymentMerchantPoolsTabPools": "Merchant Pools",
|
||||
"paymentMerchantPoolsTabWechatAuth": "WeChat Authorization"
|
||||
},
|
||||
"batch": {
|
||||
"title": "Batch Operations",
|
||||
|
||||
@@ -27,11 +27,20 @@
|
||||
"setting": {
|
||||
"menuType": {
|
||||
"title": "菜单布局",
|
||||
"list": ["垂直", "水平", "混合", "双列"]
|
||||
"list": [
|
||||
"垂直",
|
||||
"水平",
|
||||
"混合",
|
||||
"双列"
|
||||
]
|
||||
},
|
||||
"theme": {
|
||||
"title": "主题风格",
|
||||
"list": ["浅色", "深色", "系统"]
|
||||
"list": [
|
||||
"浅色",
|
||||
"深色",
|
||||
"系统"
|
||||
]
|
||||
},
|
||||
"menu": {
|
||||
"title": "菜单风格"
|
||||
@@ -41,11 +50,17 @@
|
||||
},
|
||||
"box": {
|
||||
"title": "盒子样式",
|
||||
"list": ["边框", "阴影"]
|
||||
"list": [
|
||||
"边框",
|
||||
"阴影"
|
||||
]
|
||||
},
|
||||
"container": {
|
||||
"title": "容器宽度",
|
||||
"list": ["铺满", "定宽"]
|
||||
"list": [
|
||||
"铺满",
|
||||
"定宽"
|
||||
]
|
||||
},
|
||||
"basics": {
|
||||
"title": "基础配置",
|
||||
@@ -83,8 +98,14 @@
|
||||
"notice": {
|
||||
"title": "通知",
|
||||
"btnRead": "标为已读",
|
||||
"bar": ["通知", "消息", "代办"],
|
||||
"text": ["暂无"],
|
||||
"bar": [
|
||||
"通知",
|
||||
"消息",
|
||||
"代办"
|
||||
],
|
||||
"text": [
|
||||
"暂无"
|
||||
],
|
||||
"viewAll": "查看全部"
|
||||
},
|
||||
"worktab": {
|
||||
@@ -110,7 +131,11 @@
|
||||
"admin": "管理员",
|
||||
"user": "普通用户"
|
||||
},
|
||||
"placeholder": ["请输入手机号", "请输入密码", "请拖动滑块完成验证"],
|
||||
"placeholder": [
|
||||
"请输入手机号",
|
||||
"请输入密码",
|
||||
"请拖动滑块完成验证"
|
||||
],
|
||||
"sliderText": "按住滑块拖动",
|
||||
"sliderSuccessText": "验证成功",
|
||||
"rememberPwd": "记住密码",
|
||||
@@ -153,7 +178,11 @@
|
||||
"register": {
|
||||
"title": "创建账号",
|
||||
"subTitle": "欢迎加入我们,请填写以下信息完成注册",
|
||||
"placeholder": ["请输入账号", "请输入密码", "请再次输入密码"],
|
||||
"placeholder": [
|
||||
"请输入账号",
|
||||
"请输入密码",
|
||||
"请再次输入密码"
|
||||
],
|
||||
"rule": [
|
||||
"请再次输入密码",
|
||||
"两次输入密码不一致!",
|
||||
@@ -288,10 +317,10 @@
|
||||
"evening": "晚上好!"
|
||||
},
|
||||
"exceptionPage": {
|
||||
"gohome": "返回首页",
|
||||
"403": "抱歉,您无权访问该页面",
|
||||
"404": "抱歉,您访问的页面不存在",
|
||||
"500": "抱歉,服务器出错了"
|
||||
"500": "抱歉,服务器出错了",
|
||||
"gohome": "返回首页"
|
||||
},
|
||||
"menus": {
|
||||
"login": {
|
||||
@@ -408,20 +437,30 @@
|
||||
"agentRecharge": "代理充值",
|
||||
"agentRechargeDetail": "代理充值详情",
|
||||
"refundManagement": "退款管理",
|
||||
"refundDetail": "退款详情"
|
||||
"refundDetail": "退款详情",
|
||||
"agentFundOverview": "代理商资金概况",
|
||||
"employeeCollectionBills": "员工代收款账单",
|
||||
"employeeCollectionBillDetail": "账单详情",
|
||||
"employeeCollectionApplications": "核销申请",
|
||||
"employeeCollectionApplicationDetail": "核销申请详情",
|
||||
"employeeCollectionPaymentMethods": "收款方式管理"
|
||||
},
|
||||
"commission": {
|
||||
"title": "佣金管理",
|
||||
"withdrawal": "提现审批",
|
||||
"myCommission": "我的佣金",
|
||||
"agentCommission": "代理商资金概况"
|
||||
"myCommission": "我的佣金"
|
||||
},
|
||||
"settings": {
|
||||
"title": "设置管理",
|
||||
"paymentSettings": "支付设置",
|
||||
"agentSelfRecharge": "代理自充设置",
|
||||
"detailsOfPaymentConfiguration": "支付配置详情",
|
||||
"withdrawalSettings": "提现配置",
|
||||
"passwordSettings": "密码设置"
|
||||
"passwordSettings": "密码设置",
|
||||
"paymentMerchantPools": "商户池管理",
|
||||
"paymentMerchantPoolsTabMerchants": "支付商户",
|
||||
"paymentMerchantPoolsTabPools": "商户池",
|
||||
"paymentMerchantPoolsTabWechatAuth": "微信授权配置"
|
||||
}
|
||||
},
|
||||
"table": {
|
||||
|
||||
@@ -14,6 +14,7 @@ import { loadingService } from '@/utils/ui'
|
||||
import { useCommon } from '@/composables/useCommon'
|
||||
import { useWorktabStore } from '@/store/modules/worktab'
|
||||
import { isInWhiteList, hasRoutePermission, isTokenValid, buildLoginRedirect } from './permission'
|
||||
import { isPlatformAuditAccount } from '@/utils/business/auditAccess'
|
||||
|
||||
// 是否已注册动态路由
|
||||
const isRouteRegistered = ref(false)
|
||||
@@ -95,6 +96,14 @@ async function handleRouteGuard(
|
||||
return
|
||||
}
|
||||
|
||||
if (
|
||||
to.path.startsWith('/audit') &&
|
||||
!isPlatformAuditAccount(userStore.info.user_type, userStore.isSuperAdmin)
|
||||
) {
|
||||
next(RoutesAlias.Exception403 || '/exception/403')
|
||||
return
|
||||
}
|
||||
|
||||
// 处理动态路由注册
|
||||
if (!isRouteRegistered.value && userStore.isLogin) {
|
||||
await handleDynamicRoutes(to, router, next)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* 权限验证相关工具函数
|
||||
*/
|
||||
|
||||
@@ -63,8 +63,17 @@ export const hasRoutePermission = (
|
||||
}
|
||||
}
|
||||
|
||||
// 检查允许访问的用户类型
|
||||
if (route.meta?.allowedUserTypes) {
|
||||
const allowedUserTypes = route.meta.allowedUserTypes as number[]
|
||||
const userType = Number(userInfo.user_type)
|
||||
if (!allowedUserTypes.includes(userType)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// 如果路由没有设置额外的权限要求,直接通过
|
||||
if (!route.meta?.roles && !route.meta?.permissions) {
|
||||
if (!route.meta?.roles && !route.meta?.permissions && !route.meta?.allowedUserTypes) {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -195,3 +204,4 @@ export const buildLoginRedirect = (currentPath: string): string => {
|
||||
}
|
||||
return `/auth/login?redirect=${encodeURIComponent(currentPath)}`
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { RoutesAlias } from '../routesAlias'
|
||||
import { RoutesAlias } from '../routesAlias'
|
||||
import { AppRouteRecord } from '@/types/router'
|
||||
import { BULK_PURCHASE_PERMISSIONS } from '@/config/constants/bulkPurchase'
|
||||
import { JULY_PERMISSIONS } from '@/config/constants/julyIteration'
|
||||
import { AUDIT_PERMISSIONS } from '@/config/constants/audit'
|
||||
import { AUGUST_PERMISSIONS } from '@/config/constants/augustIteration'
|
||||
|
||||
/**
|
||||
* 菜单列表、异步路由
|
||||
@@ -689,6 +690,75 @@ export const asyncRoutes: AppRouteRecord[] = [
|
||||
isHide: true,
|
||||
keepAlive: false
|
||||
}
|
||||
},
|
||||
// 员工代收款账单
|
||||
{
|
||||
path: 'employee-collection/bills',
|
||||
name: 'EmployeeCollectionBills',
|
||||
component: RoutesAlias.EmployeeCollectionBills,
|
||||
meta: {
|
||||
title: 'menus.financialManagement.employeeCollectionBills',
|
||||
keepAlive: true,
|
||||
permissions: [AUGUST_PERMISSIONS.employeeCollection.billPage]
|
||||
}
|
||||
},
|
||||
// 员工代收款账单详情
|
||||
{
|
||||
path: 'employee-collection/bills/detail/:id',
|
||||
name: 'EmployeeCollectionBillDetailRoute',
|
||||
component: RoutesAlias.EmployeeCollectionBillDetail,
|
||||
meta: {
|
||||
title: 'menus.financialManagement.employeeCollectionBillDetail',
|
||||
isHide: true,
|
||||
keepAlive: false,
|
||||
permissions: [AUGUST_PERMISSIONS.employeeCollection.billDetail]
|
||||
}
|
||||
},
|
||||
// 核销申请
|
||||
{
|
||||
path: 'employee-collection/applications',
|
||||
name: 'EmployeeCollectionApplications',
|
||||
component: RoutesAlias.EmployeeCollectionApplications,
|
||||
meta: {
|
||||
title: 'menus.financialManagement.employeeCollectionApplications',
|
||||
keepAlive: true,
|
||||
permissions: [AUGUST_PERMISSIONS.employeeCollection.applicationPage]
|
||||
}
|
||||
},
|
||||
// 核销申请详情
|
||||
{
|
||||
path: 'employee-collection/applications/detail/:id',
|
||||
name: 'EmployeeCollectionApplicationDetailRoute',
|
||||
component: RoutesAlias.EmployeeCollectionApplicationDetail,
|
||||
meta: {
|
||||
title: 'menus.financialManagement.employeeCollectionApplicationDetail',
|
||||
isHide: true,
|
||||
keepAlive: false,
|
||||
permissions: [AUGUST_PERMISSIONS.employeeCollection.applicationDetail]
|
||||
}
|
||||
},
|
||||
// 收款方式管理(仅超级管理员)
|
||||
{
|
||||
path: 'employee-collection/payment-methods',
|
||||
name: 'EmployeeCollectionPaymentMethods',
|
||||
component: RoutesAlias.EmployeeCollectionPaymentMethods,
|
||||
meta: {
|
||||
title: 'menus.financialManagement.employeeCollectionPaymentMethods',
|
||||
keepAlive: true,
|
||||
roles: ['R_SUPER'],
|
||||
permissions: [AUGUST_PERMISSIONS.employeeCollection.paymentMethodPage]
|
||||
}
|
||||
},
|
||||
// 代理商资金概况
|
||||
{
|
||||
path: 'agent-fund-overview',
|
||||
name: 'AgentFundOverview',
|
||||
component: RoutesAlias.AgentFundOverviewComponent,
|
||||
meta: {
|
||||
title: 'menus.financialManagement.agentFundOverview',
|
||||
keepAlive: true,
|
||||
roles: ['R_SUPER', 'R_ADMIN']
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -790,17 +860,6 @@ export const asyncRoutes: AppRouteRecord[] = [
|
||||
keepAlive: true,
|
||||
roles: ['R_AGENT']
|
||||
}
|
||||
},
|
||||
// 代理商资金概况
|
||||
{
|
||||
path: 'agent-fund-overview',
|
||||
name: 'AgentFundOverview',
|
||||
component: RoutesAlias.AgentFundOverviewComponent,
|
||||
meta: {
|
||||
title: 'menus.commission.agentCommission',
|
||||
keepAlive: true,
|
||||
roles: ['R_SUPER', 'R_ADMIN']
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -836,6 +895,41 @@ export const asyncRoutes: AppRouteRecord[] = [
|
||||
roles: ['R_SUPER', 'R_ADMIN']
|
||||
}
|
||||
},
|
||||
// 支付商户与商户池管理
|
||||
{
|
||||
path: 'payment-merchant-pools',
|
||||
name: 'PaymentMerchantPools',
|
||||
component: RoutesAlias.PaymentMerchantPools,
|
||||
meta: {
|
||||
title: 'menus.settings.paymentMerchantPools',
|
||||
keepAlive: true,
|
||||
allowedUserTypes: [1, 2]
|
||||
}
|
||||
},
|
||||
// 支付商户详情
|
||||
{
|
||||
path: 'payment-merchant-pools/detail/:id',
|
||||
name: 'PaymentMerchantPoolsDetailRoute',
|
||||
component: RoutesAlias.PaymentMerchantPoolsDetail,
|
||||
meta: {
|
||||
title: 'menus.settings.detailsOfPaymentMerchant',
|
||||
isHide: true,
|
||||
keepAlive: false,
|
||||
allowedUserTypes: [1, 2]
|
||||
}
|
||||
},
|
||||
// 商户池详情
|
||||
{
|
||||
path: 'payment-merchant-pools/pool-detail/:id',
|
||||
name: 'PaymentMerchantPoolDetailRoute',
|
||||
component: RoutesAlias.PaymentMerchantPoolDetail,
|
||||
meta: {
|
||||
title: 'menus.settings.detailsOfPaymentMerchantPool',
|
||||
isHide: true,
|
||||
keepAlive: false,
|
||||
allowedUserTypes: [1, 2]
|
||||
}
|
||||
},
|
||||
// 支付设置详情
|
||||
{
|
||||
path: 'payment-settings/detail/:id',
|
||||
@@ -869,6 +963,17 @@ export const asyncRoutes: AppRouteRecord[] = [
|
||||
roles: ['R_SUPER', 'R_ADMIN']
|
||||
}
|
||||
},
|
||||
// 代理自充设置(跳转系统配置并带上模块筛选)
|
||||
{
|
||||
path: 'agent-self-recharge',
|
||||
name: 'AgentSelfRechargeSettings',
|
||||
redirect: { path: RoutesAlias.SystemConfigs, query: { module: 'c2b.payment' } },
|
||||
meta: {
|
||||
title: 'menus.settings.agentSelfRecharge',
|
||||
keepAlive: false,
|
||||
roles: ['R_SUPER']
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'wecom',
|
||||
name: 'WecomSettings',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* 路由别名,方便快速找到页面,同时可以用作路由跳转
|
||||
*/
|
||||
export enum RoutesAlias {
|
||||
@@ -89,21 +89,30 @@ export enum RoutesAlias {
|
||||
AgentRechargeDetail = '/finance/agent-recharge/detail', // 代理充值详情
|
||||
RefundManagement = '/finance/refund', // 退款管理
|
||||
RefundDetail = '/finance/refund/detail', // 退款详情
|
||||
AgentFundOverview = '/finance/agent-fund-overview', // 代理商资金概况
|
||||
EmployeeCollectionBills = '/finance/employee-collection/bills', // 员工代收款账单
|
||||
EmployeeCollectionBillDetail = '/finance/employee-collection/bills/detail', // 员工代收款账单详情
|
||||
EmployeeCollectionApplications = '/finance/employee-collection/applications', // 核销申请
|
||||
EmployeeCollectionApplicationDetail = '/finance/employee-collection/applications/detail', // 核销申请详情
|
||||
EmployeeCollectionPaymentMethods = '/finance/employee-collection/payment-methods', // 收款方式管理
|
||||
|
||||
ExpiringAssets = '/asset-management/expiring-assets', // 临期资产
|
||||
|
||||
// 佣金管理
|
||||
WithdrawalApproval = '/commission-management/withdrawal-approval', // 提现审批
|
||||
MyCommission = '/commission-management/my-commission', // 我的佣金
|
||||
AgentFundOverview = '/commission/agent-fund-overview', // 代理商资金概况
|
||||
AgentFundOverviewComponent = '/commission-management/agent-fund-overview', // 代理商资金概况组件路径
|
||||
|
||||
// 设置管理
|
||||
WithdrawalSettings = '/settings/withdrawal-settings', // 提现配置
|
||||
PaymentSettings = '/settings/payment-settings', // 支付设置
|
||||
PaymentSettingsDetail = '/settings/payment-settings/detail', // 支付设置详情
|
||||
PaymentMerchantPools = '/settings/payment-merchant-pools', // 支付商户与商户池管理
|
||||
PaymentMerchantPoolsDetail = '/settings/payment-merchant-pools/detail', // 支付商户详情
|
||||
PaymentMerchantPoolDetail = '/settings/payment-merchant-pools/pool-detail', // 商户池详情
|
||||
OperationPasswordSettings = '/settings/operation-password', // 操作密码设置
|
||||
SystemConfigs = '/settings/system-configs', // 系统配置
|
||||
AgentSelfRechargeSettings = '/settings/agent-self-recharge', // 代理自充设置
|
||||
WecomSettings = '/settings/wecom', // 企业微信配置兼容入口
|
||||
WecomApplications = '/settings/wecom/applications', // 企业微信应用
|
||||
WecomMembers = '/settings/wecom/members', // 企业微信成员
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import { NotificationService } from '@/api/modules/notification'
|
||||
import type { NotificationItem, NotificationUnreadSummary } from '@/types/api'
|
||||
import type {
|
||||
BaseResponse,
|
||||
NotificationItem,
|
||||
NotificationListResponse,
|
||||
NotificationUnreadSummary
|
||||
} from '@/types/api'
|
||||
|
||||
const emptySummary = (): NotificationUnreadSummary => ({
|
||||
approval: 0,
|
||||
@@ -16,8 +21,22 @@ export const useNotificationStore = defineStore('notificationStore', () => {
|
||||
const displayCount = ref('0')
|
||||
const summary = ref<NotificationUnreadSummary>(emptySummary())
|
||||
const recentNotifications = ref<NotificationItem[]>([])
|
||||
const notificationPage = ref(1)
|
||||
const notificationPageSize = 10
|
||||
const notificationTotal = ref(0)
|
||||
const loading = ref(false)
|
||||
|
||||
const applyNotificationList = (
|
||||
response: BaseResponse<NotificationListResponse>,
|
||||
fallbackPage: number
|
||||
) => {
|
||||
if (response.code !== 0 || !response.data) return
|
||||
|
||||
recentNotifications.value = response.data.items
|
||||
notificationPage.value = response.data.page || fallbackPage
|
||||
notificationTotal.value = Math.max(0, response.data.total || 0)
|
||||
}
|
||||
|
||||
const refreshUnreadCount = async () => {
|
||||
const response = await NotificationService.getUnreadCount()
|
||||
if (response.code === 0 && response.data) {
|
||||
@@ -27,19 +46,33 @@ export const useNotificationStore = defineStore('notificationStore', () => {
|
||||
return unreadCount.value
|
||||
}
|
||||
|
||||
const refreshSummary = async () => {
|
||||
const loadNotifications = async (page = notificationPage.value) => {
|
||||
const targetPage = Math.max(1, page)
|
||||
loading.value = true
|
||||
try {
|
||||
const response = await NotificationService.getNotifications({
|
||||
page: targetPage,
|
||||
page_size: notificationPageSize
|
||||
})
|
||||
applyNotificationList(response, targetPage)
|
||||
return response
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const refreshSummary = async (page = 1) => {
|
||||
const targetPage = Math.max(1, page)
|
||||
loading.value = true
|
||||
try {
|
||||
const [summaryResponse, listResponse] = await Promise.all([
|
||||
NotificationService.getUnreadSummary(),
|
||||
NotificationService.getNotifications({ page: 1, page_size: 10 })
|
||||
NotificationService.getNotifications({ page: targetPage, page_size: notificationPageSize })
|
||||
])
|
||||
if (summaryResponse.code === 0 && summaryResponse.data) {
|
||||
summary.value = summaryResponse.data
|
||||
}
|
||||
if (listResponse.code === 0 && listResponse.data) {
|
||||
recentNotifications.value = listResponse.data.items.slice(0, 10)
|
||||
}
|
||||
applyNotificationList(listResponse, targetPage)
|
||||
await refreshUnreadCount()
|
||||
return summary.value
|
||||
} finally {
|
||||
@@ -50,7 +83,7 @@ export const useNotificationStore = defineStore('notificationStore', () => {
|
||||
const markRead = async (id: number) => {
|
||||
const response = await NotificationService.markRead(id)
|
||||
if (response.code === 0) {
|
||||
await refreshSummary()
|
||||
await refreshSummary(notificationPage.value)
|
||||
}
|
||||
return response
|
||||
}
|
||||
@@ -58,7 +91,7 @@ export const useNotificationStore = defineStore('notificationStore', () => {
|
||||
const markAllRead = async (category?: string) => {
|
||||
const response = await NotificationService.markAllRead(category ? { category } : {})
|
||||
if (response.code === 0) {
|
||||
await refreshSummary()
|
||||
await refreshSummary(notificationPage.value)
|
||||
}
|
||||
return response
|
||||
}
|
||||
@@ -68,8 +101,12 @@ export const useNotificationStore = defineStore('notificationStore', () => {
|
||||
displayCount,
|
||||
summary,
|
||||
recentNotifications,
|
||||
notificationPage,
|
||||
notificationPageSize,
|
||||
notificationTotal,
|
||||
loading,
|
||||
refreshUnreadCount,
|
||||
loadNotifications,
|
||||
refreshSummary,
|
||||
markRead,
|
||||
markAllRead
|
||||
|
||||
@@ -51,7 +51,7 @@ export const useUserStore = defineStore(
|
||||
}
|
||||
|
||||
// 检查是否是超级管理员
|
||||
const isSuperAdmin = computed(() => info.value.user_type === 1)
|
||||
const isSuperAdmin = computed(() => Number(info.value.user_type) === 1)
|
||||
|
||||
// 检查是否有某个权限
|
||||
const hasPermission = (permission: string): boolean => {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user