Compare commits
157 Commits
4c0207c6e6
...
feature/ga
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f4eed917e | ||
|
|
1a1ec485a5 | ||
|
|
f2614d8efb | ||
|
|
06684e1fc0 | ||
|
|
049f8257fb | ||
|
|
ecce4f6e7b | ||
|
|
c706f543a4 | ||
|
|
d82e716d33 | ||
|
|
22e796ba23 | ||
|
|
6dedd9f852 | ||
|
|
7f3ff10fda | ||
|
|
eeeab03295 | ||
|
|
0d77a7d55b | ||
|
|
16effb69f3 | ||
|
|
c31183205d | ||
|
|
b2a76adc9a | ||
|
|
52268859aa | ||
|
|
f1006187f6 | ||
|
|
944f17ec3f | ||
|
|
633c88d0aa | ||
|
|
f61a3f84b6 | ||
|
|
327516dd40 | ||
|
|
2f23aeaaba | ||
|
|
2c64957e55 | ||
|
|
1a5f3d1e7d | ||
|
|
d02ce01f6a | ||
|
|
aec2a27a65 | ||
|
|
f896cad34f | ||
|
|
7a74bec337 | ||
|
|
5364916b1d | ||
|
|
6655638116 | ||
|
|
e79d599da1 | ||
|
|
015f990fb6 | ||
|
|
063337e6a3 | ||
|
|
c26d36154c | ||
|
|
669610a84a | ||
|
|
a26d7b4284 | ||
|
|
10fccc4def | ||
|
|
0a28b7d8ef | ||
|
|
c136f68ab8 | ||
|
|
c5d7a260d0 | ||
|
|
ffba959d45 | ||
|
|
9a6761e01d | ||
|
|
2c00341a7c | ||
| 5c1dc59579 | |||
| d52219b5c8 | |||
| bce5d6f270 | |||
| 42e57cf698 | |||
| 55eec78a90 | |||
| cb1561a317 | |||
|
|
94764b0e0a | ||
|
|
a6ce24f2f2 | ||
|
|
085a83d4e4 | ||
|
|
e37d4902ca | ||
|
|
08889d2e42 | ||
|
|
5e7f5eaba4 | ||
|
|
ac541b17af | ||
|
|
68d8f769d1 | ||
|
|
068d0c4ac2 | ||
|
|
9a3a764120 | ||
|
|
cea805f5d8 | ||
|
|
76d4e4ec02 | ||
|
|
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 | ||
|
|
9f7f619083 | ||
|
|
b8b2854aa6 | ||
|
|
fa3d7088f9 | ||
|
|
34455a9f18 | ||
|
|
db9aaa7920 | ||
|
|
1e740b1526 | ||
|
|
81d52892f5 | ||
|
|
06f39815db | ||
|
|
83f1c88c65 | ||
|
|
055fed0cf1 | ||
|
|
93ed3fbd63 | ||
|
|
17d2eeebc5 | ||
|
|
4394ae0f78 | ||
|
|
827de02f2b | ||
|
|
831f03c3a7 | ||
|
|
ee266c51cc | ||
|
|
b51a3f5537 | ||
|
|
261f5f2853 | ||
|
|
0e8a11430a | ||
|
|
2706c52a47 | ||
|
|
f0a2b84e53 | ||
|
|
cc6fc9243e | ||
|
|
dd6bceeeb7 | ||
|
|
ee508c3e1e | ||
|
|
9289a6e940 | ||
|
|
eb13763020 | ||
|
|
d1ff4d5f6c | ||
|
|
4c6d871c35 | ||
|
|
9a84cd0d31 | ||
|
|
e043fd86d1 | ||
|
|
a0c44ff538 | ||
|
|
15122e225a | ||
|
|
127fdb560b | ||
|
|
5e15127a89 | ||
|
|
d7c2c146fe | ||
|
|
3a819e86c9 | ||
|
|
e9c0e17d6a | ||
|
|
d5fd8ac564 | ||
|
|
7d3352038a | ||
|
|
8faa2ea2ef | ||
|
|
8de4339505 | ||
|
|
68aa03b538 | ||
|
|
fbfdd01eec | ||
|
|
5079f97326 | ||
|
|
830476d49d | ||
|
|
db7b3562da | ||
|
|
f52970ae6c | ||
|
|
47a2d88c9d | ||
|
|
6febc66eca | ||
|
|
45d255cabf | ||
|
|
eddfd157ad | ||
| 09225dd8bc | |||
| 563804f67f | |||
|
|
e95dc8e4f5 | ||
|
|
ca338dd345 | ||
|
|
fac05db39a | ||
|
|
2c8524485b |
18
.dockerignore
Normal file
18
.dockerignore
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
.git
|
||||||
|
.gitea
|
||||||
|
.husky
|
||||||
|
.vscode
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
.env.local
|
||||||
|
.env.*.local
|
||||||
|
openspec
|
||||||
|
.codex
|
||||||
|
.claude
|
||||||
|
.agents
|
||||||
@@ -3,9 +3,13 @@ name: 构建并部署前端到测试环境
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- feature/gateway-rate-limit
|
||||||
|
- iteration/august
|
||||||
- dev
|
- dev
|
||||||
- test
|
- test
|
||||||
|
# 如果不再需要 main 分支触发构建,可以把下面这行删掉;
|
||||||
|
# 如果只是想保留构建(不部署),可以留着,反正部署条件已经只认 iteration/august
|
||||||
|
- main
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: registry.boss160.cn
|
REGISTRY: registry.boss160.cn
|
||||||
@@ -13,7 +17,7 @@ env:
|
|||||||
DEPLOY_DIR: /opt/junhong_cmp_web
|
DEPLOY_DIR: /opt/junhong_cmp_web
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -24,67 +28,49 @@ jobs:
|
|||||||
git clone https://git.boss160.cn/luo/one-pipe-system.git .
|
git clone https://git.boss160.cn/luo/one-pipe-system.git .
|
||||||
git checkout ${{ github.sha }}
|
git checkout ${{ github.sha }}
|
||||||
|
|
||||||
- name: 设置镜像标签
|
|
||||||
id: tag
|
|
||||||
run: |
|
|
||||||
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
|
|
||||||
echo "tag=latest" >> $GITHUB_OUTPUT
|
|
||||||
elif [ "${{ github.ref }}" = "refs/heads/dev" ]; then
|
|
||||||
echo "tag=dev" >> $GITHUB_OUTPUT
|
|
||||||
elif [ "${{ github.ref }}" = "refs/heads/test" ]; then
|
|
||||||
echo "tag=test" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "tag=unknown" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: 登录 Docker Registry
|
- name: 登录 Docker Registry
|
||||||
run: |
|
run: |
|
||||||
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login "${{ env.REGISTRY }}" --username "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
|
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login "${{ env.REGISTRY }}" --username "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
|
||||||
|
|
||||||
- name: 构建前端镜像
|
- name: 校验镜像存在
|
||||||
run: |
|
run: |
|
||||||
docker build -t ${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} .
|
if ! docker manifest inspect "${{ env.IMAGE_NAME }}:${{ github.sha }}" >/dev/null 2>&1; then
|
||||||
docker tag ${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }} ${{ env.IMAGE_NAME }}:${{ github.sha }}
|
echo "镜像不存在:${{ env.IMAGE_NAME }}:${{ github.sha }}"
|
||||||
|
echo "请先在开发机完成 pre-push 镜像构建和推送"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
- name: 推送镜像到 Registry
|
- name: 部署到测试环境
|
||||||
|
if: github.ref == 'refs/heads/feature/gateway-rate-limit'
|
||||||
run: |
|
run: |
|
||||||
docker push ${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }}
|
mkdir -p "${{ env.DEPLOY_DIR }}"
|
||||||
docker push ${{ env.IMAGE_NAME }}:${{ github.sha }}
|
cp -v docker-compose.prod.yml "${{ env.DEPLOY_DIR }}/"
|
||||||
|
cd "${{ env.DEPLOY_DIR }}"
|
||||||
|
|
||||||
- name: 部署到本地(仅 main 分支)
|
IMAGE_TAG=${{ github.sha }} docker compose -f docker-compose.prod.yml pull
|
||||||
if: github.ref == 'refs/heads/main'
|
IMAGE_TAG=${{ github.sha }} docker compose -f docker-compose.prod.yml up -d
|
||||||
run: |
|
|
||||||
# 确保部署目录存在
|
|
||||||
mkdir -p ${{ env.DEPLOY_DIR }}
|
|
||||||
|
|
||||||
echo "当前工作目录: $(pwd)"
|
echo "等待服务健康检查通过..."
|
||||||
echo "当前目录内容:"
|
for i in $(seq 1 30); do
|
||||||
ls -la
|
WEB_HEALTH=$(docker inspect junhong-cmp-web --format='{{if .State.Health}}{{.State.Health.Status}}{{else}}none{{end}}' 2>/dev/null || true)
|
||||||
|
if [ "$WEB_HEALTH" = "healthy" ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
if [ "$i" -eq 30 ]; then
|
||||||
|
echo "前端服务在等待窗口内未恢复健康"
|
||||||
|
docker compose -f docker-compose.prod.yml logs web --tail=100
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
|
||||||
# 更新 docker-compose.prod.yml
|
IMAGE_TAG=${{ github.sha }} docker compose -f docker-compose.prod.yml ps
|
||||||
echo "更新部署配置文件..."
|
|
||||||
cp -v docker-compose.prod.yml ${{ env.DEPLOY_DIR }}/
|
|
||||||
|
|
||||||
cd ${{ env.DEPLOY_DIR }}
|
|
||||||
|
|
||||||
echo "拉取最新镜像..."
|
|
||||||
docker compose -f docker-compose.prod.yml pull
|
|
||||||
|
|
||||||
echo "重启服务..."
|
|
||||||
docker compose -f docker-compose.prod.yml up -d
|
|
||||||
|
|
||||||
echo "等待服务启动..."
|
|
||||||
sleep 5
|
|
||||||
|
|
||||||
echo "部署完成!"
|
|
||||||
docker compose -f docker-compose.prod.yml ps
|
|
||||||
|
|
||||||
- name: 构建结果通知
|
- name: 构建结果通知
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ job.status }}" = "success" ]; then
|
if [ "${{ job.status }}" = "success" ]; then
|
||||||
echo "构建成功: ${{ steps.tag.outputs.tag }}"
|
echo "部署成功: ${{ github.sha }}"
|
||||||
echo "镜像标签: ${{ github.sha }}"
|
|
||||||
else
|
else
|
||||||
echo "构建失败"
|
echo "部署失败"
|
||||||
fi
|
fi
|
||||||
|
|||||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -2,6 +2,13 @@ node_modules
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
dist
|
dist
|
||||||
docs
|
docs
|
||||||
|
!docs/
|
||||||
|
docs/*
|
||||||
|
!docs/权限.md
|
||||||
|
!docs/api/
|
||||||
|
docs/api/*
|
||||||
|
!docs/api/package-silence.openapi.json
|
||||||
|
!docs/2026-10-26-轮询账户限流-后台接入交付.md
|
||||||
dist-ssr
|
dist-ssr
|
||||||
*.local
|
*.local
|
||||||
.cursorrules
|
.cursorrules
|
||||||
|
|||||||
1
.husky/pre-push
Executable file
1
.husky/pre-push
Executable file
@@ -0,0 +1 @@
|
|||||||
|
node scripts/deploy-frontend.mjs --pre-push
|
||||||
13
Dockerfile
13
Dockerfile
@@ -6,15 +6,16 @@ FROM --platform=linux/amd64 node:20-alpine AS builder
|
|||||||
# 使用阿里云镜像源加速
|
# 使用阿里云镜像源加速
|
||||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||||
|
|
||||||
# 设置工作目录
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
|
|
||||||
# 安装 pnpm
|
# 清除宿主机注入的失效代理,再安装 pnpm
|
||||||
RUN corepack enable && corepack prepare pnpm@10.15.0 --activate
|
RUN npm config delete proxy && npm config delete https-proxy && npm install --global pnpm@10.15.0 --registry=https://registry.npmmirror.com
|
||||||
|
|
||||||
# 设置 npm 镜像源
|
|
||||||
RUN pnpm config set registry https://registry.npmmirror.com
|
RUN pnpm config set registry https://registry.npmmirror.com
|
||||||
|
|
||||||
|
# 限制 Node 堆,防止前端构建耗尽宿主机内存
|
||||||
|
ARG NODE_OPTIONS=--max-old-space-size=1536
|
||||||
|
ENV NODE_OPTIONS=${NODE_OPTIONS}
|
||||||
|
|
||||||
# 复制 package.json 和 pnpm-lock.yaml(利用 Docker 缓存)
|
# 复制 package.json 和 pnpm-lock.yaml(利用 Docker 缓存)
|
||||||
COPY package.json pnpm-lock.yaml ./
|
COPY package.json pnpm-lock.yaml ./
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ RUN pnpm run nd
|
|||||||
# ================================
|
# ================================
|
||||||
# 阶段 2: 运行阶段
|
# 阶段 2: 运行阶段
|
||||||
# ================================
|
# ================================
|
||||||
FROM --platform=linux/amd64 nginx:alpine
|
FROM --platform=linux/amd64 nginx:1.31.2-alpine
|
||||||
|
|
||||||
# 使用阿里云镜像源加速
|
# 使用阿里云镜像源加速
|
||||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||||
|
|||||||
@@ -1,20 +1,25 @@
|
|||||||
version: '3.8'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
image: registry.boss160.cn/junhong/cmp-admin-web:latest
|
image: registry.boss160.cn/junhong/cmp-admin-web:${IMAGE_TAG:-latest}
|
||||||
container_name: junhong-cmp-web
|
container_name: junhong-cmp-web
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- '3001:80'
|
- '3001:80'
|
||||||
networks:
|
networks:
|
||||||
- junhong-network
|
- junhong-network
|
||||||
|
|
||||||
|
# === 以下是新增的修复内容 ===
|
||||||
|
tmpfs:
|
||||||
|
- /run:rw
|
||||||
|
- /tmp:rw
|
||||||
|
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ['CMD', 'wget', '--no-verbose', '--tries=1', '--spider', 'http://127.0.0.1:80/health']
|
test: ['CMD', 'wget', '--no-verbose', '--tries=1', '--spider', 'http://127.0.0.1:80/health']
|
||||||
interval: 30s
|
interval: 30s
|
||||||
timeout: 3s
|
timeout: 3s
|
||||||
retries: 3
|
retries: 3
|
||||||
start_period: 5s
|
start_period: 5s
|
||||||
|
|
||||||
logging:
|
logging:
|
||||||
driver: 'json-file'
|
driver: 'json-file'
|
||||||
options:
|
options:
|
||||||
|
|||||||
128
docs/2026-10-26-轮询账户限流-后台接入交付.md
Normal file
128
docs/2026-10-26-轮询账户限流-后台接入交付.md
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
# 轮询账户限流:后台接入交付
|
||||||
|
|
||||||
|
本次仅修改本后台前端,未修改独立 C 端、未推送 Git 或部署生产、未配置数据库菜单。真实接口权限和调度行为仍需测试环境联调。本地写操作全部通过 mock 验证。
|
||||||
|
|
||||||
|
## 后台配置与使用
|
||||||
|
|
||||||
|
新增菜单、隐藏详情、按钮编码和平台账号限制见 [权限增量清单](./权限.md#轮询管理运营商账户限流与调度2026-10-26-增量)。原有网关、轮询配置预览/统计、停复机记录 URL 和权限保留。仅超级管理员的维护项不列入普通配置清单。
|
||||||
|
|
||||||
|
UI 沿用店铺列表表头、可选列、分页和店铺详情返回/标题/两列布局;窄屏详情单列。时间统一店铺格式,运营商账户按名称远程搜索,搜索条件 >=4 才出现展开。
|
||||||
|
|
||||||
|
新增配置字段现可保存,旧文档“仅预览”已失效。四项间隔:空继承、0 禁止且不再继承、正数执行。编辑清空使用 clear_fields,保存 warnings 单独展示;不再发送保护期间隔。
|
||||||
|
|
||||||
|
## C 端需要同步哪些
|
||||||
|
|
||||||
|
**必须修改(文档明确要求)**
|
||||||
|
|
||||||
|
1. C 端资产详情调用 `GET /api/c/v1/asset/info` 后,不再展示保护期状态(`device_protect_status`),包括标签、说明、倒计时和相关状态分支(如有)。
|
||||||
|
2. 废弃字段可能仍返回固定 `none`,也可能缺失;兼容解析,但不能再依赖它决定页面展示或是否允许操作。不要把 `none` 当成新的异常状态。
|
||||||
|
|
||||||
|
**随新后端回归验证(不是要求 C 端增加后台功能)**
|
||||||
|
|
||||||
|
- 订单/套餐生效、有效期变化后,重新读取资产实际 `enable_polling`;后台可能自动恢复轮询,不要仅凭旧前端缓存维持“已关闭”。
|
||||||
|
- 指令队列启用时,业务受理不等于上游已完成停复机。若 C 端有即时完成提示,改为区分“已受理/处理中”和实际状态,并在合理刷新后确认。
|
||||||
|
- 资产详情读入口的请求检查、延迟确认及冷却由后端场景配置控制,C 端不要自行复制调度逻辑或高频循环触发。
|
||||||
|
|
||||||
|
C 端不需要新增本次后台菜单、告警/调度参数/导入接口;本仓库没有修改任何 C 端代码。若 C 端本来没有保护期 UI 或逻辑,第一项只需核查删除残留引用。
|
||||||
|
|
||||||
|
## 接口覆盖
|
||||||
|
|
||||||
|
文档 46 个新增操作中,已有 GatewayService 17 个、PollingConfigService 7 个,本次 PollingSchedulerService 补 22 个。自动测试逐条解析原文附录的 46 个方法/路径,与实际服务调用对照,不以数量代替路径验收。
|
||||||
|
|
||||||
|
下表路径省略 `/api/admin`。精确 URL、Query/Body 测试位于 `gateway.test.mjs`、`pollingConfigExtensions.test.mjs`、`pollingScheduler.test.mjs`。
|
||||||
|
|
||||||
|
| HTTP 操作 | 服务方法 | 后台入口 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| `DELETE /gateway-error-classifications/{id}` | `GatewayService.deleteRule` | 上游错误分类 |
|
||||||
|
| `DELETE /polling-carrier-params/{carrier_id}` | `PollingSchedulerService.resetCarrierParam` | 账户参数维护 |
|
||||||
|
| `DELETE /polling-rate-limit-groups/{id}` | `GatewayService.deleteGroup` | 网关限流组维护 |
|
||||||
|
| `GET /card-polling-pauses` | `PollingSchedulerService.getPauses` | 不轮询清单 |
|
||||||
|
| `GET /card-stop-resume-records` | `GatewayService.getRecords` | 停复机记录 |
|
||||||
|
| `GET /gateway-error-classifications` | `GatewayService.getRules` | 上游错误分类 |
|
||||||
|
| `GET /iot-cards/{id}/polling-state` | `PollingSchedulerService.getCardState` | 单卡/设备绑定卡/告警详情 |
|
||||||
|
| `GET /iot-cards/{id}/stop-resume-records` | `GatewayService.getCardRecords` | 单卡/告警详情 |
|
||||||
|
| `GET /polling-carrier-params` | `PollingSchedulerService.getCarrierParams` | 运营商账户调度参数 |
|
||||||
|
| `GET /polling-carrier-params/{carrier_id}` | `PollingSchedulerService.getCarrierParam` | 账户参数详情 |
|
||||||
|
| `GET /polling-check-scenes` | `PollingSchedulerService.getScenes` | 请求检查场景 |
|
||||||
|
| `GET /polling-configs/match-preview` | `PollingConfigService.previewMatch` | 配置匹配预览 |
|
||||||
|
| `GET /polling-configs/recalculate-due/{task_id}` | `PollingConfigService.getRecalculateTask` | 重算进度 |
|
||||||
|
| `GET /polling-failure-alerts` | `PollingSchedulerService.getAlerts` | 告警普通/停机被拒 |
|
||||||
|
| `GET /polling-failure-alerts/summary` | `PollingSchedulerService.getAlertSummary` | 告警账户汇总 |
|
||||||
|
| `GET /polling-failure-alerts/{id}` | `PollingSchedulerService.getAlert` | 告警详情 |
|
||||||
|
| `GET /polling-options` | `GatewayService.getOptions` | 网关各页枚举 |
|
||||||
|
| `GET /polling-rate-limit-groups` | `GatewayService.getGroups` | 网关限流组 |
|
||||||
|
| `GET /polling-rate-limit-groups/{id}` | `GatewayService.getGroup` | 网关限流组详情 |
|
||||||
|
| `GET /polling-stats/carrier-queues` | `PollingSchedulerService.getQueues` | 账户队列监控 |
|
||||||
|
| `GET /polling-stats/carriers` | `GatewayService.getCarrierStats` | 网关汇总/限流模式 |
|
||||||
|
| `GET /polling-stats/carriers/{carrier_id}/trend` | `GatewayService.getCarrierTrend` | 账户调用趋势 |
|
||||||
|
| `GET /polling-stats/pre-reset` | `PollingConfigService.getPreResetStats` | 重置日前统计 |
|
||||||
|
| `GET /polling-stats/tiers` | `PollingConfigService.getTierStats` | 分层统计 |
|
||||||
|
| `GET /polling-status-imports` | `PollingSchedulerService.getImports` | 导入任务列表 |
|
||||||
|
| `GET /polling-status-imports/{id}` | `PollingSchedulerService.getImport` | 导入逐行结果 |
|
||||||
|
| `GET /polling-status/impact` | `PollingSchedulerService.getImpact` | 单项/批量/导入确认 |
|
||||||
|
| `GET /stop-resume-rule/dry-run` | `PollingSchedulerService.dryRun` | 规则演练(只读) |
|
||||||
|
| `POST /devices/batch-update-polling-status` | `PollingSchedulerService.toggleDevices` | 设备批量/清单恢复 |
|
||||||
|
| `POST /gateway-error-classifications` | `GatewayService.createRule` | 上游错误分类 |
|
||||||
|
| `POST /gateway-error-classifications/test` | `GatewayService.testRule` | 错误分类测试 |
|
||||||
|
| `POST /iot-cards/batch-update-polling-status` | `PollingSchedulerService.toggleCards` | 卡批量/清单恢复 |
|
||||||
|
| `POST /polling-configs/match-preview` | `PollingConfigService.previewDraft` | 配置草稿预览 |
|
||||||
|
| `POST /polling-configs/recalculate-due` | `PollingConfigService.recalculateDue` | 重算到期 |
|
||||||
|
| `POST /polling-failure-alerts/close-polling` | `PollingSchedulerService.closeAlertPolling` | 告警批量关闭卡轮询 |
|
||||||
|
| `POST /polling-rate-limit-groups` | `GatewayService.createGroup` | 网关限流组维护 |
|
||||||
|
| `POST /polling-status-imports` | `PollingSchedulerService.createImport` | 创建导入 |
|
||||||
|
| `POST /stop-resume-rule/dry-run/export` | `PollingSchedulerService.exportDryRun` | 演练导出 |
|
||||||
|
| `PUT /gateway-error-classifications/{id}` | `GatewayService.updateRule` | 上游错误分类 |
|
||||||
|
| `PUT /gateway-error-classifications/{id}/status` | `GatewayService.setRuleStatus` | 上游错误分类 |
|
||||||
|
| `PUT /polling-carrier-params/{carrier_id}` | `PollingSchedulerService.saveCarrierParam` | 账户参数维护 |
|
||||||
|
| `PUT /polling-check-scenes/{scene}` | `PollingSchedulerService.saveScene` | 请求检查场景维护 |
|
||||||
|
| `PUT /polling-configs/priorities` | `PollingConfigService.updatePriorities` | 整体优先级(拖动/上移下移) |
|
||||||
|
| `PUT /polling-failure-alerts/{id}/status` | `PollingSchedulerService.handleAlert` | 告警处理 |
|
||||||
|
| `PUT /polling-rate-limit-groups/{id}` | `GatewayService.updateGroup` | 网关限流组维护 |
|
||||||
|
| `PUT /polling-rate-limit-groups/{id}/status` | `GatewayService.setGroupStatus` | 网关限流组维护 |
|
||||||
|
|
||||||
|
### 16 个既有接口改动的处理
|
||||||
|
|
||||||
|
| 既有接口 | 接入结果 |
|
||||||
|
| --- | --- |
|
||||||
|
| GET /polling-configs | 列表新增资产/套餐条件、重置日前窗口和间隔列 |
|
||||||
|
| GET /polling-configs/:id | 编辑读入全部新增字段,废弃保护间隔不再参与 |
|
||||||
|
| POST /polling-configs | 白名单保存新增匹配及窗口字段、三态间隔,展示 warnings |
|
||||||
|
| PUT /polling-configs/:id | clear_fields 显式清空,0 保留,展示 warnings |
|
||||||
|
| GET /assets/resolve/:identifier | 不再映射废弃保护期展示;其余资产身份不变 |
|
||||||
|
| GET /assets/:identifier/realtime-status | 不再更新保护期 UI 字段 |
|
||||||
|
| POST /assets/:identifier/refresh | 沿用刷新读取,界面无保护期展示 |
|
||||||
|
| GET /api/c/v1/asset/info | 独立 C 端同步项,本仓库不改 |
|
||||||
|
| PUT /carriers/:id | 0→1 首次不带确认;展示后端实际影响后确认重提 |
|
||||||
|
| GET /system-configs | 新增 polling 模块,复用 string/int/bool/json 编辑与校验 |
|
||||||
|
| GET /iot-cards/standalone | 三态是否轮询筛选,保留 false |
|
||||||
|
| GET /devices | 新增筛选与是否轮询列 |
|
||||||
|
| PATCH /assets/:identifier/polling-status | 先读 impact 确认,拒绝/取消恢复 UI,不提供强制参数 |
|
||||||
|
| POST /storage/upload-url | purpose=polling_status_import;校验 key 前缀后上传,成功才建任务 |
|
||||||
|
| POST /export-tasks | 三个新增场景;卡/设备保留 enable_polling 筛选 |
|
||||||
|
| GET /export-tasks | 三个场景列表、共用详情与下载权限;历史文件不做客户端改写 |
|
||||||
|
|
||||||
|
`PUT /system-configs/:key` 继续走原编辑能力,新增键来自服务器;本次不会自动修改 scheduler、rate_limit_mode、queue_enabled。
|
||||||
|
|
||||||
|
## 验证与限制
|
||||||
|
|
||||||
|
本地复现:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$tests = @(rg --files scripts/tests -g '*.test.mjs')
|
||||||
|
node --import ./scripts/tests/register-esbuild.mjs --test $tests
|
||||||
|
.\node_modules\.bin\vue-tsc.cmd --noEmit
|
||||||
|
node scripts/tests/verifyBuild.mjs
|
||||||
|
node scripts/tests/verifyBuild.mjs --serve --scheduler
|
||||||
|
```
|
||||||
|
|
||||||
|
最后一项在 `http://127.0.0.1:5190` 启动本地 mock,所有 /api 被拦截;可使用 local-scheduler-platform/admin/agent/enterprise 模拟 token。该结果不等于线上后端已联调。
|
||||||
|
|
||||||
|
已覆盖:46 路径映射、22 新方法请求结构、null/0/false、清空与废弃字段、权限/身份、500 条和 CSV 50000 行边界、引号换行、部分成功、影响说明失败/取消、上传失败、迟到请求/账号范围切换/卸载、模板编译。旧实名管控回归改成后端实际文案确认。
|
||||||
|
|
||||||
|
生产构建的既有循环依赖、常量 v-model 和大 chunk 警告仍存在;未在本次跨范围重构。后端若将实名确认提示升级为独立错误码,可替换当前的语义识别,避免依赖提示中的“实名/确认”关键词。当前未知网络错误或不相关错误不会触发确认重试。
|
||||||
|
|
||||||
|
2026-10-26 最终回归:全量 191 项通过(本次调度接入新增 17 项,保留并升级原有回归)。类型检查、生产构建、针对性 ESLint / Prettier / 新增组件样式检查、全仓 UTF-8 编码检查通过。
|
||||||
|
|
||||||
|
浏览器使用本地 mock 验证了平台账号入口、特殊告警视图、批量 impact 确认与四类逐项结果、CSV 上传建任务/详情、演练汇总与明细、时间格式、网关 80% 成功率及 p95 超桶显示;检查了浅/深色与 375/390/768/1024/1440 宽度布局。开发热更新仍可能遇到项目既有 API 循环依赖,刷新后进行验收,不把热更新错误当作真实接口结果。
|
||||||
|
|
||||||
|
真实后端账号、数据范围、错误码、异步终态和导出文件内容需由部署后的联调确认;本次未进行线上写入、Git 推送或部署。
|
||||||
4390
docs/api/package-silence.openapi.json
Normal file
4390
docs/api/package-silence.openapi.json
Normal file
File diff suppressed because it is too large
Load Diff
437
docs/权限.md
Normal file
437
docs/权限.md
Normal file
@@ -0,0 +1,437 @@
|
|||||||
|
# 权限清单
|
||||||
|
|
||||||
|
## 套餐管理:真流量预警规则
|
||||||
|
|
||||||
|
页面 URL:`/package-management/traffic-alert-rules`
|
||||||
|
|
||||||
|
| 类型 | 权限名称 | 权限编码 |
|
||||||
|
| -------- | ------------- | ------------------------------------ |
|
||||||
|
| 页面查看 | `rulesView` | `package_traffic_alert:rules_view` |
|
||||||
|
| 新增规则 | `ruleCreate` | `package_traffic_alert:rule_create` |
|
||||||
|
| 编辑规则 | `ruleUpdate` | `package_traffic_alert:rule_update` |
|
||||||
|
| 启用规则 | `ruleEnable` | `package_traffic_alert:rule_enable` |
|
||||||
|
| 停用规则 | `ruleDisable` | `package_traffic_alert:rule_disable` |
|
||||||
|
|
||||||
|
启用和停用不得复用编辑权限。
|
||||||
|
|
||||||
|
## 套餐管理:真流量达量预警
|
||||||
|
|
||||||
|
| 页面/操作 | URL | 权限名称 | 权限编码 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 预警列表 | `/package-management/traffic-alerts` | `recordsView` | `package_traffic_alert:records_view` |
|
||||||
|
| 点击套餐名称进入预警详情 | `/package-management/traffic-alerts/detail/:id` | `recordDetail` | `package_traffic_alert:record_detail` |
|
||||||
|
| 导出预警记录 | — | `export` | `package_traffic_alert:export` |
|
||||||
|
| 导出任务页面 | `/asset-management/export-task-management/export-package-traffic-alert` | `page` | `export_task:package_traffic_alert_page` |
|
||||||
|
|
||||||
|
## 店铺管理:店铺列表
|
||||||
|
|
||||||
|
| 页面/操作 | URL | 权限名称 | 权限编码 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 店铺列表 | `/shop-management/list` | `listView` | `shop:list_view` |
|
||||||
|
| 店铺详情 | `/shop-management/detail/:id` | `detailView` | `shop:detail_view` |
|
||||||
|
| 新增店铺 | — | — | `shop:add` |
|
||||||
|
| 批量交接 | — | `batch` | `shop:business_owner_batch` |
|
||||||
|
| 导入业务员 | — | `importPage` | `shop:business_owner_import_view` |
|
||||||
|
| 查看店铺详情 | — | — | `shop:detail` |
|
||||||
|
| 切换店铺状态 | — | — | `shop:modify_status` |
|
||||||
|
| 账号列表 | — | — | `shop:look_customer` |
|
||||||
|
| 默认角色 | — | — | `shop:default_role` |
|
||||||
|
| 调整实际信用额度 | — | — | `shop:credit_limit_manage` |
|
||||||
|
| 编辑店铺 | — | — | `shop:edit` |
|
||||||
|
| 删除店铺 | — | — | `shop:delete` |
|
||||||
|
| 审计记录 | — | — | `audit:shop_entry` / `audit:agent_resource_activity` |
|
||||||
|
| 资金链路 | — | — | `audit:finance_timeline` |
|
||||||
|
|
||||||
|
## 店铺管理:业务用户组
|
||||||
|
|
||||||
|
页面 URL:`/shop-management/business-user-groups`
|
||||||
|
|
||||||
|
| 类型 | 权限名称 | 权限编码 |
|
||||||
|
| -------- | --------- | ----------------------------- |
|
||||||
|
| 页面查看 | `page` | `business_user_group:page` |
|
||||||
|
| 新增 | `create` | `business_user_group:create` |
|
||||||
|
| 编辑 | `update` | `business_user_group:update` |
|
||||||
|
| 删除 | `delete` | `business_user_group:delete` |
|
||||||
|
| 成员管理 | `members` | `business_user_group:members` |
|
||||||
|
|
||||||
|
## 店铺管理:批量换绑业务员
|
||||||
|
|
||||||
|
页面 URL:`/shop-management/business-owner-import`
|
||||||
|
|
||||||
|
| 类型 | 权限名称 | 权限编码 |
|
||||||
|
| ---------------------------- | -------------- | ----------------------------------- |
|
||||||
|
| 页面查看 | `importPage` | `shop:business_owner_import_view` |
|
||||||
|
| 创建导入任务 | `importCreate` | `shop:business_owner_import_create` |
|
||||||
|
| 详情按钮 | `importDetail` | `shop:business_owner_import_detail` |
|
||||||
|
| 详情页面(当前为列表页抽屉) | `importDetail` | `shop:business_owner_import_detail` |
|
||||||
|
|
||||||
|
## 店铺管理:代理注册申请
|
||||||
|
|
||||||
|
列表不显示操作列,点击“申请店铺”名称进入详情页。
|
||||||
|
|
||||||
|
| 页面/操作 | URL | 权限名称 | 权限编码 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 申请列表 | `/shop-management/agent-distribution-registrations` | `list` | `agent_distribution_registration:list` |
|
||||||
|
| 申请详情 | `/shop-management/agent-distribution-registrations/detail/:id` | `detail` | `agent_distribution_registration:detail` |
|
||||||
|
| 恢复审批 | — | `recoverApproval` | `agent_distribution_registration:recover_approval` |
|
||||||
|
|
||||||
|
## 资产管理:手机号资产关联
|
||||||
|
|
||||||
|
页面 URL:`/asset-management/phone-asset-association`
|
||||||
|
|
||||||
|
| 类型 | 权限名称 | 权限编码 |
|
||||||
|
| ---------------- | -------------------- | ---------------------------------------------- |
|
||||||
|
| 页面查看 | `list` | `phone_asset_association:list` |
|
||||||
|
| 单条解绑 | `unbind` | `phone_asset_association:unbind` |
|
||||||
|
| 批量解绑 | `unbindBatch` | `phone_asset_association:unbind_batch` |
|
||||||
|
| 解绑导入页面 | `unbindImportPage` | `phone_asset_association:unbind_import_view` |
|
||||||
|
| 创建解绑导入任务 | `unbindImportCreate` | `phone_asset_association:unbind_import_create` |
|
||||||
|
|
||||||
|
## 资产管理:解绑导入任务
|
||||||
|
|
||||||
|
| 页面/操作 | URL | 权限名称 | 权限编码 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 任务列表 | `/asset-management/task-management/phone-asset-unbind-import-tasks` | `unbindImportPage` | `phone_asset_association:unbind_import_page` |
|
||||||
|
| 任务详情 | `/asset-management/task-management/phone-asset-unbind-import-tasks/detail` | `unbindImportDetail` | `phone_asset_association:unbind_import_detail` |
|
||||||
|
| 详情按钮 | — | `unbindImportDetail` | `asset_association:unbind_import_detail` |
|
||||||
|
|
||||||
|
## 资产管理:临期资产
|
||||||
|
|
||||||
|
页面 URL:`/asset-management/expiring-assets`
|
||||||
|
|
||||||
|
| 类型 | 权限名称 | 权限编码 |
|
||||||
|
| -------- | -------- | ----------------------- |
|
||||||
|
| 页面查看 | `page` | `expiring_asset:page` |
|
||||||
|
| 导出 | `export` | `expiring_asset:export` |
|
||||||
|
|
||||||
|
## 资产管理:导出任务页面
|
||||||
|
|
||||||
|
详情按钮为导出任务列表中的任务编号点击入口,权限编码按导出场景区分;详情页面统一使用 `id` 查询参数。
|
||||||
|
|
||||||
|
| 导出场景 | 列表页面 URL | 页面权限编码 | 详情按钮权限编码 | 详情页面 URL |
|
||||||
|
| --- | --- | --- | --- | --- |
|
||||||
|
| 设备 | `/asset-management/export-task-management/export-device` | `export_task:device_page` | `export_task:device_detail` | `/asset-management/export-task-management/export-task-detail?id=:id` |
|
||||||
|
| IoT 卡 | `/asset-management/export-task-management/export-iot-card` | `export_task:iot_card_page` | `export_task:iot_card_detail` | `/asset-management/export-task-management/export-task-detail?id=:id` |
|
||||||
|
| 订单 | `/asset-management/export-task-management/export-order` | `export_task:order_page` | `export_task:order_detail` | `/asset-management/export-task-management/export-task-detail?id=:id` |
|
||||||
|
| 套餐 | `/asset-management/export-task-management/export-package` | `export_task:package_page` | `export_task:package_detail` | `/asset-management/export-task-management/export-task-detail?id=:id` |
|
||||||
|
| 代理主钱包流水 | `/asset-management/export-task-management/export-agent-wallet-transaction` | `export_task:agent_wallet_transaction_page` | `export_task:agent_wallet_transaction_detail` | `/asset-management/export-task-management/export-task-detail?id=:id` |
|
||||||
|
| 代理充值 | `/asset-management/export-task-management/export-agent-recharge` | `export_task:agent_recharge_page` | `export_task:agent_recharge_detail` | `/asset-management/export-task-management/export-task-detail?id=:id` |
|
||||||
|
| 退款 | `/asset-management/export-task-management/export-refund` | `export_task:refund_page` | `export_task:refund_detail` | `/asset-management/export-task-management/export-task-detail?id=:id` |
|
||||||
|
| 换货 | `/asset-management/export-task-management/export-exchange` | `export_task:exchange_page` | `export_task:exchange_detail` | `/asset-management/export-task-management/export-task-detail?id=:id` |
|
||||||
|
| 佣金明细 | `/asset-management/export-task-management/export-commission-record` | `export_task:commission_record_page` | `export_task:commission_record_detail` | `/asset-management/export-task-management/export-task-detail?id=:id` |
|
||||||
|
| 套餐真流量达量预警 | `/asset-management/export-task-management/export-package-traffic-alert` | `export_task:package_traffic_alert_page` | `export_task:package_traffic_alert_detail` | `/asset-management/export-task-management/export-task-detail?id=:id` |
|
||||||
|
| 临期资产 | `/asset-management/export-task-management/export-expiring-asset` | `export_task:expiring_asset_page` | `export_task:expiring_asset_detail` | `/asset-management/export-task-management/export-task-detail?id=:id` |
|
||||||
|
| 设备激活报表 | `/asset-management/export-task-management/export-operations-activation` | `export_task:operations_activation_page` | `export_task:operations_activation_detail` | `/asset-management/export-task-management/export-task-detail?id=:id` |
|
||||||
|
| 套餐续费报表 | `/asset-management/export-task-management/export-operations-renewal` | `export_task:operations_renewal_page` | `export_task:operations_renewal_detail` | `/asset-management/export-task-management/export-task-detail?id=:id` |
|
||||||
|
|
||||||
|
## 财务管理:退款管理
|
||||||
|
|
||||||
|
| 页面/操作 | URL | 权限名称 | 权限编码 |
|
||||||
|
| --------- | ---------------------------- | ----------------- | ------------------------- |
|
||||||
|
| 退款列表 | `/finance/refund` | `page` | `refund:page` |
|
||||||
|
| 退款详情 | `/finance/refund/detail/:id` | `detailPage` | `refund:detail_page` |
|
||||||
|
| 恢复审批 | — | `recoverApproval` | `refund:recover_approval` |
|
||||||
|
|
||||||
|
## 财务管理:员工代收款账单
|
||||||
|
|
||||||
|
| 页面/操作 | URL | 权限名称 | 权限编码 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 账单列表 | `/finance/employee-collection/bills` | `billPage` | `employee_collection:bill_view` |
|
||||||
|
| 账单详情 | `/finance/employee-collection/bills/detail/:id` | `billDetail` | `employee_collection:bill_detail` |
|
||||||
|
| 创建核销申请 | — | `applicationCreate` | `employee_collection:application_create` |
|
||||||
|
| 关闭账单 | — | `billClose` | `employee_collection:bill_close` |
|
||||||
|
|
||||||
|
## 财务管理:核销申请
|
||||||
|
|
||||||
|
| 页面/操作 | URL | 权限名称 | 权限编码 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 申请列表 | `/finance/employee-collection/applications` | `applicationPage` | `employee_collection:application_view` |
|
||||||
|
| 申请详情 | `/finance/employee-collection/applications/detail/:id` | `applicationDetail` | `employee_collection:application_detail` |
|
||||||
|
| 修改并重新提交 | — | `applicationUpdate` | `employee_collection:application_update` |
|
||||||
|
| 查看凭证 | — | `applicationViewVoucher` | `employee_collection:application_view_voucher` |
|
||||||
|
| 恢复审批 | — | `applicationRecoverApproval` | `employee_collection:application_recover_approval` |
|
||||||
|
|
||||||
|
## 财务管理:收款方式管理
|
||||||
|
|
||||||
|
页面 URL:`/finance/employee-collection/payment-methods`
|
||||||
|
|
||||||
|
| 类型 | 权限名称 | 权限编码 |
|
||||||
|
| -------- | --------------------- | ------------------------------------------- |
|
||||||
|
| 页面查看 | `paymentMethodPage` | `employee_collection:payment_method_view` |
|
||||||
|
| 新增 | `paymentMethodCreate` | `employee_collection:payment_method_create` |
|
||||||
|
| 编辑 | `paymentMethodEdit` | `employee_collection:payment_method_edit` |
|
||||||
|
| 删除 | `paymentMethodDelete` | `employee_collection:payment_method_delete` |
|
||||||
|
|
||||||
|
## 财务管理:代理商资金概况
|
||||||
|
|
||||||
|
页面 URL:`/finance/agent-fund-overview`
|
||||||
|
|
||||||
|
| 类型 | 权限名称 | 权限编码 |
|
||||||
|
| ------------ | ------------------ | --------------------------------------- |
|
||||||
|
| 页面查看 | `page` | `agent_fund_overview:page` |
|
||||||
|
| 佣金明细导出 | `commissionExport` | `agent_fund_overview:commission_export` |
|
||||||
|
|
||||||
|
## 设置:商户池管理
|
||||||
|
|
||||||
|
| 页面/操作 | URL | 权限名称 | 权限编码 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 管理页面 | `/settings/payment-merchant-pools` | `page` | `payment_merchant_pool:page` |
|
||||||
|
| 商户详情 | `/settings/payment-merchant-pools/detail/:id` | `merchantDetail` | `payment_merchant_pool:merchant_detail` |
|
||||||
|
| 商户池详情 | `/settings/payment-merchant-pools/pool-detail/:id` | `poolDetail` | `payment_merchant_pool:pool_detail` |
|
||||||
|
| 新增/编辑/启停/删除商户 | — | — | `payment_merchant_pool:merchant_create` / `merchant_edit` / `merchant_toggle` / `merchant_delete` |
|
||||||
|
| 新增/编辑/启停商户池 | — | — | `payment_merchant_pool:pool_create` / `pool_edit` / `pool_toggle` |
|
||||||
|
| 保存微信授权配置 | — | `wechatAuthEdit` | `payment_merchant_pool:wechat_auth_edit` |
|
||||||
|
|
||||||
|
## 设置:H5运营弹窗配置
|
||||||
|
|
||||||
|
| 页面/操作 | URL | 权限名称 | 权限编码 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 配置列表 | `/settings/h5-popup-configuration` | `list` | `h5_popup_configuration:list` |
|
||||||
|
| 配置详情 | `/settings/h5-popup-configuration/detail/:id` | `detail` | `h5_popup_configuration:detail` |
|
||||||
|
| 新增/编辑/启用/停用 | — | — | `h5_popup_configuration:create` / `update` / `enable` / `disable` |
|
||||||
|
|
||||||
|
## 设置:资产钱包自动续费
|
||||||
|
|
||||||
|
| 页面/操作 | URL | 权限名称 | 权限编码 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 页面查看 | `/settings/asset-wallet-auto-renewal` | `page` | `asset_wallet_auto_renewal:page` |
|
||||||
|
| 保存配置 | — | `update` | `asset_wallet_auto_renewal:update` |
|
||||||
|
|
||||||
|
## 轮询管理:优先队列
|
||||||
|
|
||||||
|
页面 URL:`/polling-management/priority-queue`
|
||||||
|
|
||||||
|
| 类型 | 权限名称 | 权限编码 |
|
||||||
|
| ------------ | -------- | ------------------------------- |
|
||||||
|
| 页面查看 | `page` | `polling_priority_queue:page` |
|
||||||
|
| 人工优先入队 | `create` | `polling_priority_queue:create` |
|
||||||
|
| 查看详情 | `detail` | `polling_priority_queue:detail` |
|
||||||
|
|
||||||
|
## 运营报表:设备激活报表
|
||||||
|
|
||||||
|
页面 URL:`/operations-reports/activation`
|
||||||
|
|
||||||
|
| 类型 | 权限名称 | 权限编码 |
|
||||||
|
| -------- | ------------------ | -------------------------------------- |
|
||||||
|
| 页面查看 | `activationPage` | `operations_reports:activation_page` |
|
||||||
|
| 导出 | `activationExport` | `operations_reports:activation_export` |
|
||||||
|
|
||||||
|
## 运营报表:套餐续费报表
|
||||||
|
|
||||||
|
页面 URL:`/operations-reports/renewal`
|
||||||
|
|
||||||
|
| 类型 | 权限名称 | 权限编码 |
|
||||||
|
| -------- | --------------- | ----------------------------------- |
|
||||||
|
| 页面查看 | `renewalPage` | `operations_reports:renewal_page` |
|
||||||
|
| 导出 | `renewalExport` | `operations_reports:renewal_export` |
|
||||||
|
|
||||||
|
## 通用:导出任务详情
|
||||||
|
|
||||||
|
页面 URL:`/asset-management/export-task-management/export-task-detail`
|
||||||
|
|
||||||
|
- 页面权限:`export_task:detail_page`
|
||||||
|
- 各场景详情权限:`export_task:<scene>_detail`
|
||||||
|
- 各场景下载权限:`export_task:<scene>_download`
|
||||||
|
|
||||||
|
所有权限编码必须保持唯一;页面 URL 权限与按钮权限应分别定义。
|
||||||
|
|
||||||
|
## 轮询管理:网关限流
|
||||||
|
|
||||||
|
以下仅列普通账号需要配置的项。父菜单为已有「轮询管理」`/polling-management`,无需新增一级菜单。
|
||||||
|
|
||||||
|
| 菜单名称 | URL | 父菜单 | 菜单权限编码 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 停复机记录 | `/polling-management/stop-resume-records` | 轮询管理 | `card_stop_resume_record:page` |
|
||||||
|
| 上游错误分类 | `/polling-management/error-classifications` | 轮询管理 | `gateway_error_classification:page` |
|
||||||
|
| 网关限流组 | `/polling-management/rate-limit-groups` | 轮询管理 | `gateway_rate_limit_group:page` |
|
||||||
|
| 网关调用统计 | `/polling-management/gateway-stats` | 轮询管理 | `gateway_call_stats:page` |
|
||||||
|
| 网关限流组详情(隐藏) | `/polling-management/rate-limit-groups/detail/:id` | 轮询管理 | `gateway_rate_limit_group:detail_page` |
|
||||||
|
|
||||||
|
详情为轮询管理下的同级隐藏路由,不挂在列表组件下。`:id` 保留路由参数形式;普通账号需同时获得该隐藏菜单与「查看详情」按钮授权。
|
||||||
|
|
||||||
|
| 按钮名称 | 所属菜单/位置 | 按钮权限编码 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 测试分类 / 草稿测试 | 上游错误分类 | `gateway_error_classification:test` |
|
||||||
|
| 查看详情 | 网关限流组 | `gateway_rate_limit_group:detail` |
|
||||||
|
| 查询趋势 | 网关调用统计 | `gateway_call_stats:trend` |
|
||||||
|
| 停复机记录 | 资产管理 → 单卡信息,卡信息头部 | `iot_info:stop_resume_records` |
|
||||||
|
| 停复机记录 | 资产管理 → 单卡信息,设备绑定卡操作区 | `device_info:stop_resume_records` |
|
||||||
|
|
||||||
|
查询、重置、分页与刷新使用页面权限,无需另配按钮。运营商名称搜索下拉需要当前账号能读取 `/api/admin/carriers`;这些前端编码不替代后端独立鉴权。
|
||||||
|
|
||||||
|
## 轮询管理:轮询配置预览与统计
|
||||||
|
|
||||||
|
本次只需新增一个菜单;已有「轮询配置」`/polling-management/config` 保留,不改旧 CRUD 权限。以下仅列普通账号需要配置的项。
|
||||||
|
|
||||||
|
| 菜单名称 | URL | 父菜单 | 菜单权限编码 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 轮询配置统计 | `/polling-management/config-stats` | 轮询管理 `/polling-management` | `polling_config_stats:page` |
|
||||||
|
|
||||||
|
| 按钮名称 | 所属菜单 | 按钮权限编码 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 匹配预览 / 草稿预览 / 预览未保存修改 | 轮询配置 `/polling-management/config` | `polling_config:match_preview` |
|
||||||
|
| 查询重算进度 | 轮询配置 `/polling-management/config` | `polling_config:recalculate_progress` |
|
||||||
|
| 查看重置日前加密查流量效果统计 | 轮询配置统计 | `polling_config_stats:pre_reset` |
|
||||||
|
| 查看分层轮询统计 | 轮询配置统计 | `polling_config_stats:tiers` |
|
||||||
|
|
||||||
|
统计菜单权限和区域权限需同时授权;若仅授权其中一个统计区域,另一区域不会请求接口。进度查询权限只允许查询已有任务,不授予创建任务的能力。上述编码是前端配置约定,后端独立鉴权。
|
||||||
|
|
||||||
|
### 接入说明
|
||||||
|
|
||||||
|
- 当前配置预览使用 GET;草稿预览使用 POST,并在 Query 和 Body 同时传入同一 ICCID。多条草稿可覆盖已有配置或以 id=0 新增,预览不调用持久化 CRUD。
|
||||||
|
- 草稿中实名、流量、套餐、卡状态检查区分继承(null)、禁止且不再继承(0)、指定秒数(正数)。保护期已下线,表单和请求均移除。重置日前加密需明确开启,窗口和窗口内流量间隔成对设置。
|
||||||
|
- 以 2026-10-26 完整接口文档为准:资产状态、套餐状态、重置日前窗口字段现已支持创建/编辑保存;编辑清空通过 `clear_fields`,保存成功展示 `warnings`。
|
||||||
|
- 时间使用与店铺列表相同的 `formatDateTime`。运营商账户按名称远程搜索,仍提交数字 ID;搜索条件 >=4 时才显示展开按钮。
|
||||||
|
- 任务进度每 3 秒查询一次,终态、失败、关闭、路由离开和卸载后停止;保留真实 task_id、任务状态及 string 类型的响应账户 ID。
|
||||||
|
- 统计周期为 null 时显示「无周期数据」,真实 0 保留。分层统计标明 5 分钟缓存,未匹配配置的在库卡和已销售无套餐卡突出告警;刷新不宣称清除服务器缓存。
|
||||||
|
|
||||||
|
### 本地验证
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
node --test scripts/tests/pollingConfigExtensions.test.mjs
|
||||||
|
.\node_modules\.bin\vue-tsc.cmd --noEmit
|
||||||
|
node scripts/tests/verifyBuild.mjs
|
||||||
|
node scripts/tests/verifyBuild.mjs --serve --polling
|
||||||
|
```
|
||||||
|
|
||||||
|
最后一条命令启动 `http://127.0.0.1:5190` 的本地模拟接口页面;所有 `/api` 请求被拦截,不会对真实后端保存配置或创建任务。当前未进行真实后端联调、菜单数据写入、Git 推送或生产部署。
|
||||||
|
|
||||||
|
2026-10-26 验证:新增轮询配置测试 20 项、全量回归 174 项通过;类型、生产构建、针对性 lint / 格式 / 编码检查通过。浏览器验证了当前预览、草稿控件、异步进度、空周期/零值统计、普通账号入口及小屏布局。生产构建仍有项目既有循环依赖、其他页面常量绑定与大 chunk 警告。
|
||||||
|
|
||||||
|
## 轮询管理:运营商账户限流与调度(2026-10-26 增量)
|
||||||
|
|
||||||
|
本节在前两次配置的基础上新增,旧菜单和旧权限不必重建。仅列非超级管理员专属的菜单/按钮;标注“平台”的项只允许 user_type=1/2,权限码不能突破身份限制。前端编码是本项目约定,后端仍需独立授权。
|
||||||
|
|
||||||
|
### 新增可见菜单
|
||||||
|
|
||||||
|
| 菜单名称 | URL | 父菜单 | 菜单权限 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 运营商账户调度参数 | `/polling-management/carrier-params` | 轮询管理 `/polling-management` | `polling_carrier_params:page` |
|
||||||
|
| 请求检查场景 | `/polling-management/check-scenes` | 轮询管理 | `polling_check_scene:page` |
|
||||||
|
| 失败告警 | `/polling-management/failure-alerts` | 轮询管理 | `polling_failure_alert:page` |
|
||||||
|
| 账户队列监控 | `/polling-management/carrier-queues` | 轮询管理 | `polling_carrier_queue:page` |
|
||||||
|
| 停复机规则演练(平台) | `/polling-management/stop-resume-dry-run` | 轮询管理 | `stop_resume_dry_run:page` |
|
||||||
|
| 不轮询清单(平台) | `/polling-management/polling-pauses` | 轮询管理 | `polling_pause:page` |
|
||||||
|
| 轮询开关导入(平台) | `/polling-management/polling-status-imports` | 轮询管理 | `polling_status_import:page` |
|
||||||
|
| 导出不轮询清单(平台) | `/asset-management/export-task-management/export-polling-pause` | 导出管理 `/asset-management/export-task-management` | `export_task:polling_pause_page` |
|
||||||
|
| 导出停机被拒告警(平台) | `/asset-management/export-task-management/export-polling-stop-refused-alert` | 导出管理 | `export_task:polling_stop_refused_alert_page` |
|
||||||
|
| 导出停复机规则演练(平台) | `/asset-management/export-task-management/export-stop-resume-rule-dry-run` | 导出管理 | `export_task:stop_resume_rule_dry_run_page` |
|
||||||
|
|
||||||
|
### 新增隐藏详情菜单
|
||||||
|
|
||||||
|
这些是独立页面,不是按钮编码,需配置隐藏路由;URL 参数保留,不替换为具体 ID。
|
||||||
|
|
||||||
|
| 菜单名称 | URL | 父菜单 | 菜单权限 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 运营商账户调度参数详情 | `/polling-management/carrier-params/detail/:carrier_id` | 轮询管理 | `polling_carrier_params:detail_page` |
|
||||||
|
| 失败告警详情 | `/polling-management/failure-alerts/detail/:id` | 轮询管理 | `polling_failure_alert:detail_page` |
|
||||||
|
| 轮询开关导入详情(平台) | `/polling-management/polling-status-imports/detail/:id` | 轮询管理 | `polling_status_import:detail_page` |
|
||||||
|
|
||||||
|
三个导出场景共用已有隐藏详情 `/asset-management/export-task-management/export-task-detail?id=任务ID`,沿用 `export_task:detail_page`,不再新增详情路由。
|
||||||
|
|
||||||
|
### 新增按钮权限编码
|
||||||
|
|
||||||
|
| 所属页面 | 按钮/能力 | 编码 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 运营商账户调度参数 | 查看详情 | `polling_carrier_params:detail` |
|
||||||
|
| 失败告警 | 查看详情 | `polling_failure_alert:detail` |
|
||||||
|
| 失败告警 | 账户汇总 | `polling_failure_alert:summary` |
|
||||||
|
| 失败告警 | 标记已处理(仅未处理状态) | `polling_failure_alert:handle` |
|
||||||
|
| 失败告警 | 批量关闭卡轮询(平台) | `polling_failure_alert:close_polling` |
|
||||||
|
| 失败告警 | 导出停机被拒(平台) | `polling_failure_alert:export` |
|
||||||
|
| 停复机规则演练 | 导出演练明细(平台) | `stop_resume_dry_run:export` |
|
||||||
|
| 不轮询清单 | 批量开启轮询(平台) | `polling_pause:restore` |
|
||||||
|
| 不轮询清单 | 创建导出任务(平台) | `polling_pause:export` |
|
||||||
|
| 轮询开关导入 | 上传并创建任务(平台) | `polling_status_import:create` |
|
||||||
|
| 轮询开关导入 | 查看任务与逐行结果(平台) | `polling_status_import:detail` |
|
||||||
|
| IoT 卡列表 | 批量开关轮询(平台/代理) | `iot_card:batch_polling` |
|
||||||
|
| 设备列表 | 批量开关轮询(平台/代理) | `device:batch_polling` |
|
||||||
|
| 单卡资产详情 / 卡级告警详情 | 查询单卡轮询状态 | `iot_info:polling_state` |
|
||||||
|
| 设备资产详情的绑定卡 | 查询该绑定卡轮询状态 | `device_info:polling_state` |
|
||||||
|
| 导出不轮询清单 | 查看详情 / 下载 | `export_task:polling_pause_detail` / `export_task:polling_pause_download` |
|
||||||
|
| 导出停机被拒告警 | 查看详情 / 下载 | `export_task:polling_stop_refused_alert_detail` / `export_task:polling_stop_refused_alert_download` |
|
||||||
|
| 导出停复机规则演练 | 查看详情 / 下载 | `export_task:stop_resume_rule_dry_run_detail` / `export_task:stop_resume_rule_dry_run_download` |
|
||||||
|
|
||||||
|
“详情”按钮及对应隐藏详情菜单需同时授权。告警详情内查看停复机记录复用已有 `iot_info:stop_resume_records`;资产单项轮询开关复用 `iot_info:auto_polling` / `device_info:auto_polling`,无需新编码。请求检查场景、队列监控无新增普通写按钮。系统配置沿用旧菜单与权限,仅新增 polling 模块选项。
|
||||||
|
|
||||||
|
### 操作边界
|
||||||
|
|
||||||
|
- 批量只提交当前勾选 ID,最多 500 条,不扩展成全量筛选;原因必填,先读 impact 再确认。四类逐项结果完整保留,部分成功不回滚。
|
||||||
|
- 企业账号不开放批量;代理资产范围由后端校验。风险停机、已销户不提供“强制开启”。
|
||||||
|
- 账户级告警 card_id=0 不请求单卡接口、不允许勾选关闭卡轮询;停机被拒视图隐藏并剔除不支持的筛选。
|
||||||
|
- 导入仅 CSV,首行为表头,首列保留文本,最多 50000 数据行;上传成功后才创建任务。任务终态/请求失败停止自动刷新。
|
||||||
|
- 演练仅判断不执行;明细 result 不改变汇总,导出也不带 result;演练允许每页 500,其他列表最大 100。
|
||||||
|
- 调度、限流、指令队列开关不会因本次前端接入自动修改。旧并发配置仅 legacy 模式有效。
|
||||||
|
|
||||||
|
C 端同步项和接口覆盖/验证见 [本次接入交付说明](./2026-10-26-轮询账户限流-后台接入交付.md)。
|
||||||
|
|
||||||
|
本次验证:191 项回归通过;类型、生产构建、代码/样式/格式与 UTF-8 检查通过。仅本地 mock 验收,没有写入菜单数据、推送或部署;生产构建仍有项目既有循环依赖与大 chunk 警告。
|
||||||
|
|
||||||
|
## 订单分类与沉默期(2026-10-28)
|
||||||
|
|
||||||
|
后台实现已按 Apifox 定义补齐。以下为实际路由和前端权限约定;后端仍需创建真实菜单/按钮记录并独立校验权限与数据范围。未推送、部署或写入服务器菜单,真实支付/审批/退款/导出需测试环境联调。准确范围见 [执行记录](../openspec/changes/add-order-segmentation-and-package-silence/implementation.md)。
|
||||||
|
|
||||||
|
### 新增可见菜单
|
||||||
|
|
||||||
|
| 菜单名称 | URL | 父菜单 | 菜单权限 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 平台订单 | `/order-management/platform-orders` | 订单管理 `/order-management` | `orders:platform_page` |
|
||||||
|
| 代理商订单 | `/order-management/agent-orders` | 订单管理 | `orders:agent_page` |
|
||||||
|
| 在线支付订单 | `/order-management/online-orders` | 订单管理 | `orders:online_page` |
|
||||||
|
| 延期订单 | `/package-management/silence-orders` | 套餐管理 `/package-management` | `package_silence:orders_page` |
|
||||||
|
| 延期批次与异常 | `/package-management/silence-batches` | 套餐管理 | `package_silence:batches_page` |
|
||||||
|
| 沉默期临期/过期套餐 | `/package-management/silence-usages` | 套餐管理 | `package_silence:usages_page` |
|
||||||
|
| 延期政策 | `/package-management/silence-policies` | 套餐管理 | `package_silence:policies_page`(并需 `package_silence:policy`) |
|
||||||
|
| 导出平台订单 | `/asset-management/export-task-management/export-order-platform` | 导出管理 `/asset-management/export-task-management` | `export_task:order_platform_page` |
|
||||||
|
| 导出代理商订单 | `/asset-management/export-task-management/export-order-agent` | 导出管理 | `export_task:order_agent_page` |
|
||||||
|
| 导出在线支付订单 | `/asset-management/export-task-management/export-order-online` | 导出管理 | `export_task:order_online_page` |
|
||||||
|
| 导出延期订单 | `/asset-management/export-task-management/export-silence-order` | 导出管理 | `export_task:package_silence_order_page` |
|
||||||
|
| 导出沉默期套餐 | `/asset-management/export-task-management/export-silence-usage` | 导出管理 | `export_task:package_silence_usage_page` |
|
||||||
|
|
||||||
|
代理账号仅可配置平台/代理商普通订单及其导出;在线普通订单及导出只允许 user_type=1/2。企业不得配置普通订单菜单。旧普通订单列表/详情保留。沉默期模块没有额外虚构身份范围,按后端真实授权及数据范围工作。
|
||||||
|
|
||||||
|
### 新增隐藏详情菜单
|
||||||
|
|
||||||
|
| 菜单名称 | URL | 父菜单 | 菜单权限 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 延期订单详情 | `/package-management/silence-orders/detail/:id` | 套餐管理 | `package_silence:order_detail_page` |
|
||||||
|
| 延期批次详情 | `/package-management/silence-batches/detail/:id` | 套餐管理 | `package_silence:batch_detail_page` |
|
||||||
|
|
||||||
|
直接访问详情同时要求对应列表页权限、隐藏详情菜单权限和下表详情按钮权限;不能只配隐藏详情菜单。导出详情沿用已有隐藏 `export_task:detail_page` 与已有导出详情 URL。仅超管专属配置不列入普通菜单清单。
|
||||||
|
|
||||||
|
### 新增及沿用按钮权限
|
||||||
|
|
||||||
|
| 操作 | 权限编码 |
|
||||||
|
| --- | --- |
|
||||||
|
| 下单时调整本次沉默期(两个单项购买入口) | `package_silence:override` |
|
||||||
|
| 扫码付费延期、单项特殊延期 | `package_silence:extend` |
|
||||||
|
| 批量特殊延期(含 CSV 导入) | 同时需要 `package_silence:extend`、`package_silence:extend_batch` |
|
||||||
|
| 登记线下付费延期 | `package_silence:offline` |
|
||||||
|
| 异常明细重试/关闭 | `package_silence:exception` |
|
||||||
|
| 政策查询/新增/编辑/启停/匹配 | `package_silence:policy` |
|
||||||
|
| 查看延期订单详情 | `package_silence:order_detail` |
|
||||||
|
| 查看延期批次详情 | `package_silence:batch_detail` |
|
||||||
|
| 创建延期订单导出 | `package_silence:order_export` |
|
||||||
|
| 创建沉默期套餐清单导出 | `package_silence:usage_export` |
|
||||||
|
| 创建普通订单/查看详情/导出 | 沿用 `orders:add` / `orders:view_detail` / `orders:export` |
|
||||||
|
| 平台普通订单导出详情/下载 | `export_task:order_platform_detail` / `export_task:order_platform_download` |
|
||||||
|
| 代理商普通订单导出详情/下载 | `export_task:order_agent_detail` / `export_task:order_agent_download` |
|
||||||
|
| 在线普通订单导出详情/下载 | `export_task:order_online_detail` / `export_task:order_online_download` |
|
||||||
|
| 延期订单导出详情/下载 | `export_task:package_silence_order_detail` / `export_task:package_silence_order_download` |
|
||||||
|
| 沉默期套餐导出详情/下载 | `export_task:package_silence_usage_detail` / `export_task:package_silence_usage_download` |
|
||||||
|
|
||||||
|
沉默期流水、首次购买记录没有在后端文档声明独立按钮权限,继承所属资产/列表页的读取范围,不虚构按钮编码。角色配置继续使用后端真实权限树,需后端提供权限记录和 ID,前端不伪造记录。
|
||||||
|
|
||||||
|
### 操作边界与验证
|
||||||
|
|
||||||
|
- 默认商品沉默期 1–90 天,购买覆盖天数仅最小 1;付费延期天数/金额由资格和试算决定,不复制算法。
|
||||||
|
- 特殊延期 CSV 为前端解析:表头 `package_usage_id,days`,每行两个整数,转换为文档 items[];不假设后端导入文件格式。
|
||||||
|
- 政策免审批完整枚举未在 OpenAPI 给出;已有值原样保留,提供明确的 offline_paid/batch,其他值需填写后端精确编码。政策接口没有 DELETE,不提供删除。
|
||||||
|
- 二维码/线下同一快照重试复用幂等键;特殊请求结果不明时提示核对批次并阻止重复提交。待审批、已支付和已完成严格区分。
|
||||||
|
- 异常关闭必须填写原因并确认,提示在线订单可能原路退款;不直接修改套餐截止时间。
|
||||||
|
- 企业资产五项限制保持;首次购买为只读事实,不回填绑定卡或换货资产;对象缺失隐藏沉默期入口。
|
||||||
|
- 236 项测试、类型与生产构建通过;仅本地 mock 验收,没有真实支付、审批、退款、开关切换、导出、推送或部署。
|
||||||
|
|
||||||
|
### C 端同步(本仓库未修改)
|
||||||
|
|
||||||
|
独立 C 端需接入可选 silence、状态/格式化截止日及 extendable 入口;`/api/c/v1/package-silence` 下的资格、报价、自助下单/qr_content、订单状态刷新、我的延期订单/详情、流水。对象缺失或总开关关闭时隐藏入口;金额单位分、结果取后端,不能复制计费/审批算法,不调用后台 URL。资产归属由后端校验。
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
## Context
|
||||||
|
|
||||||
|
临期结果由后端根据资产当前套餐及排队套餐计算。管理端需要在独立列表、普通资产列表、代理首页和通知中心保持相同的临期语义。本变更只覆盖管理端,C 端资产和续费能力不纳入实现范围。
|
||||||
|
|
||||||
|
## Goals / Non-Goals
|
||||||
|
|
||||||
|
- Goals: 统一消费 `estimated_final_expires_at`、`days_until_final_expiry`、`expiry_level`、`expiry_level_name` 和 `can_renew`;提供临期查询、排序、高亮、统计、通知跳转和管理端续费入口。
|
||||||
|
- Goals: 由后端负责临期边界、预计到期结果和通知触发,前端只负责展示和路由。
|
||||||
|
- Non-Goals: 不计算套餐接续到期时间,不修改历史订单或已购套餐,不实现 C 端入口,不展示企微临期消息。
|
||||||
|
|
||||||
|
## Decisions
|
||||||
|
|
||||||
|
- Decision: 临期独立列表使用 `GET /api/admin/expiring-assets`,查询参数保持文档约定的 `asset_type`、`keyword`、`shop_id`、`package_id`、`days_min`、`days_max`、`expires_from`、`expires_to`、`page`、`size`。
|
||||||
|
- Decision: 临期接口负责跨分页排序,返回结果按 0-3 天优先、其余按 `estimated_final_expires_at` 升序排列;前端只保留接口顺序,不改变普通资产列表原始接口排序。
|
||||||
|
- Decision: 颜色只按剩余天数映射:8-15 天粉红、4-7 天紫色、0-3 天红色。已过期和不可预计记录由接口排除,前端不把它们补入临期列表。
|
||||||
|
- Decision: 续费入口由 `can_renew` 控制,具体续费动作复用现有管理端续费/充值路由和接口,不新增 C 端逻辑。
|
||||||
|
- Decision: 通知中心继续复用现有通知接口和目标跳转协议;临期通知由后端按 15 天、7 天、3 天生成,前端按通知目标跳转到临期列表或对应资产详情。
|
||||||
|
- Alternatives considered: 前端从普通资产列表筛选临期记录。Rejected because it无法保证全量、统一排序和后端预计最终到期结果的一致性。
|
||||||
|
|
||||||
|
## Risks / Trade-offs
|
||||||
|
|
||||||
|
- 风险:代理首页当前概览接口未必已有临期计数字段。Mitigation:在现有首页/概览响应中增加 `expiring_card_count` 和 `expiring_device_count`,避免前端分页统计。
|
||||||
|
- 风险:不同资产列表的字段结构不完全一致。Mitigation:在各自 API 类型中复用同一组临期字段语义,并通过统一展示格式处理空值和等级。
|
||||||
|
- 风险:续费入口的现有路由可能依赖资产类型。Mitigation:由 `asset_type` 和 `asset_id` 选择对应管理端续费入口,按钮仅在 `can_renew=true` 时展示。
|
||||||
|
|
||||||
|
## Migration Plan
|
||||||
|
|
||||||
|
1. 先扩展管理端 API 类型和服务,确认列表、首页统计和通知目标字段。
|
||||||
|
2. 上线临期列表及普通列表高亮,再接入首页统计和续费入口。
|
||||||
|
3. 最后验证通知中心过滤、已读和跳转,不修改 C 端功能。
|
||||||
|
|
||||||
|
## Open Questions
|
||||||
|
|
||||||
|
- 代理首页现有概览接口的具体路径和响应字段名称,需要以后端接口实现为准确认。
|
||||||
|
- 管理端卡/设备续费入口的现有路由是否统一,需实现时复用当前权限和路由定义。
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
# Change: 增加管理端临期资产高亮、通知与续费入口
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
管理端目前缺少统一的临期资产查询入口,运营人员需要在普通资产列表中自行识别临近到期资产,且无法从临期记录快速进入续费操作。需要基于后端统一计算的预计最终到期结果,在管理端集中展示临期资产、标记普通列表并接入站内通知。
|
||||||
|
|
||||||
|
## What Changes
|
||||||
|
|
||||||
|
- 新增管理端临期资产列表,支持资产类型、关键字、店铺、套餐、剩余天数和预计到期时间筛选。
|
||||||
|
- 临期列表按 0-3 天固定置顶,其余按预计最终到期时间升序;已过期和不可预计资产不进入列表。
|
||||||
|
- 在卡列表、设备列表和资产相关列表中增加临期颜色高亮,但不改变普通列表原有排序。
|
||||||
|
- 在代理首页增加临期卡数量和临期设备数量展示,并可跳转临期列表。
|
||||||
|
- 在临期列表提供后端返回 `can_renew` 控制的续费入口,复用现有管理端续费/充值流程。
|
||||||
|
- 接入通知中心中的 15 天、7 天、3 天临期提醒及通知跳转;管理端不展示企微临期消息。
|
||||||
|
- 所有页面直接使用后端返回的预计最终到期字段和临期等级,不在前端重新计算最终到期时间。
|
||||||
|
|
||||||
|
## Impact
|
||||||
|
|
||||||
|
- Affected specs:
|
||||||
|
- `admin-expiring-assets`
|
||||||
|
- Affected code:
|
||||||
|
- `src/api/modules` 和 `src/types/api` 中的临期资产接口及类型
|
||||||
|
- 管理端临期资产列表页面和路由
|
||||||
|
- 网卡列表、设备列表及资产信息展示组件
|
||||||
|
- 代理首页统计组件
|
||||||
|
- 通知中心跳转处理
|
||||||
|
- API contracts:
|
||||||
|
- `GET /api/admin/expiring-assets`
|
||||||
|
- 现有代理首页/概览接口增加临期卡、设备数量字段,或提供等价的管理端统计响应
|
||||||
|
- 复用现有通知查询、已读和目标跳转接口
|
||||||
|
- Out of scope:
|
||||||
|
- C 端资产页临期展示
|
||||||
|
- C 端续费按钮和 C 端续费流程
|
||||||
|
- 企微临期消息展示或企微通知改造
|
||||||
|
- 前端根据套餐明细自行推导预计最终到期时间
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: Admin Expiring Asset Query
|
||||||
|
|
||||||
|
The admin frontend SHALL provide an expiring asset list backed by `GET /api/admin/expiring-assets`. The query SHALL support `asset_type`, `keyword`, `shop_id`, `package_id`, `days_min`, `days_max`, `expires_from`, `expires_to`, `page`, and `size`.
|
||||||
|
|
||||||
|
#### Scenario: Filter expiring assets
|
||||||
|
|
||||||
|
- **WHEN** 管理端用户打开临期资产列表并提交筛选条件
|
||||||
|
- **THEN** 前端 MUST send the documented query parameters to `GET /api/admin/expiring-assets`
|
||||||
|
- **AND** 页面 MUST display the paginated response items
|
||||||
|
|
||||||
|
#### Scenario: Exclude unavailable assets
|
||||||
|
|
||||||
|
- **WHEN** 接口返回临期列表
|
||||||
|
- **THEN** 页面 MUST not add expired assets or assets without an estimable final expiry to the list on the client side
|
||||||
|
|
||||||
|
### Requirement: Expiring Asset Fields
|
||||||
|
|
||||||
|
Each expiring asset item SHALL preserve and display the backend fields `asset_type`, `asset_id`, `identifier`, `shop_name`, `package_name`, `estimated_final_expires_at`, `days_until_final_expiry`, `expiry_level`, `expiry_level_name`, and `can_renew`. The frontend MUST use backend-provided expiry results and MUST NOT calculate the estimated final expiry from package details.
|
||||||
|
|
||||||
|
#### Scenario: Display an estimable asset
|
||||||
|
|
||||||
|
- **WHEN** 临期接口返回资产及 `estimated_final_expires_at`
|
||||||
|
- **THEN** 页面 MUST display the asset identifier, shop, package, estimated final expiry, remaining days, and backend expiry level name
|
||||||
|
|
||||||
|
#### Scenario: Preserve backend result
|
||||||
|
|
||||||
|
- **WHEN** 临期接口返回 `estimated_final_expires_at` 或 `days_until_final_expiry`
|
||||||
|
- **THEN** 前端 MUST display the returned values
|
||||||
|
- **AND** 前端 MUST NOT derive or replace them from current or queued package data
|
||||||
|
|
||||||
|
### Requirement: Expiring List Ordering And Highlighting
|
||||||
|
|
||||||
|
The expiring asset API and standalone admin list SHALL return and preserve records with 0-3 remaining days first, then order the remaining records by `estimated_final_expires_at` ascending. The list SHALL apply pink highlighting to 8-15 days, purple highlighting to 4-7 days, and red highlighting to 0-3 days.
|
||||||
|
|
||||||
|
#### Scenario: Order critical assets first
|
||||||
|
|
||||||
|
- **GIVEN** the response contains assets in multiple expiry ranges
|
||||||
|
- **WHEN** 页面渲染临期列表
|
||||||
|
- **THEN** the API response MUST place assets with 0-3 remaining days before assets with more remaining days
|
||||||
|
- **AND** the API response MUST order records in the remaining ranges by estimated final expiry ascending
|
||||||
|
- **AND** the frontend MUST preserve that cross-page ordering
|
||||||
|
|
||||||
|
#### Scenario: Highlight by remaining days
|
||||||
|
|
||||||
|
- **WHEN** 页面渲染临期资产
|
||||||
|
- **THEN** 8-15 days MUST use the pink visual treatment
|
||||||
|
- **AND** 4-7 days MUST use the purple visual treatment
|
||||||
|
- **AND** 0-3 days MUST use the red visual treatment
|
||||||
|
|
||||||
|
### Requirement: Ordinary Admin Asset List Highlighting
|
||||||
|
|
||||||
|
The admin card and device lists SHALL apply the same expiry color treatment to returned expiring asset fields without changing their existing server or client sort order.
|
||||||
|
|
||||||
|
#### Scenario: Highlight ordinary asset rows
|
||||||
|
|
||||||
|
- **WHEN** 卡列表或设备列表返回临期字段
|
||||||
|
- **THEN** 页面 MUST apply the matching expiry color treatment
|
||||||
|
- **AND** 页面 MUST preserve the list's existing ordering
|
||||||
|
|
||||||
|
### Requirement: Admin Expiring Asset Renewal Entry
|
||||||
|
|
||||||
|
The admin expiring asset list SHALL display a renewal action only when the backend item has `can_renew=true`. The action SHALL navigate to the existing management-side renewal or recharge flow for the asset type.
|
||||||
|
|
||||||
|
#### Scenario: Renewable asset
|
||||||
|
|
||||||
|
- **GIVEN** 临期资产项返回 `can_renew=true`
|
||||||
|
- **WHEN** 用户查看临期列表
|
||||||
|
- **THEN** 页面 MUST provide the management-side renewal entry
|
||||||
|
- **AND** the entry MUST target the corresponding asset and preserve asset type context
|
||||||
|
|
||||||
|
#### Scenario: Non-renewable asset
|
||||||
|
|
||||||
|
- **GIVEN** 临期资产项返回 `can_renew=false`
|
||||||
|
- **WHEN** 用户查看临期列表
|
||||||
|
- **THEN** 页面 MUST NOT display an enabled renewal action
|
||||||
|
|
||||||
|
### Requirement: Agent Dashboard Expiry Counts
|
||||||
|
|
||||||
|
The agent-facing admin home SHALL display the number of expiring cards and expiring devices using backend-provided summary fields and SHALL provide navigation to the standalone expiring asset list.
|
||||||
|
|
||||||
|
#### Scenario: Display expiry counts
|
||||||
|
|
||||||
|
- **WHEN** 代理首页概览数据返回临期卡和设备数量
|
||||||
|
- **THEN** 页面 MUST display the expiring card count and expiring device count
|
||||||
|
- **AND** 页面 MUST not calculate the counts from a paginated asset list
|
||||||
|
|
||||||
|
### Requirement: Admin Expiry Notifications
|
||||||
|
|
||||||
|
The notification center SHALL display backend-generated admin expiry reminders for 15 days, 7 days, and 3 days through the existing notification API and target navigation. The admin frontend SHALL not display WeCom expiry messages.
|
||||||
|
|
||||||
|
#### Scenario: Display expiry reminder
|
||||||
|
|
||||||
|
- **WHEN** 通知接口返回 15 天、7 天或 3 天的临期提醒
|
||||||
|
- **THEN** 通知中心 MUST classify it as a 临期提醒
|
||||||
|
- **AND** 用户点击通知后 MUST navigate to the returned management-side target
|
||||||
|
|
||||||
|
#### Scenario: Exclude WeCom expiry message
|
||||||
|
|
||||||
|
- **WHEN** 管理端加载通知中心
|
||||||
|
- **THEN** 页面 MUST not add or render a separate WeCom expiry message channel
|
||||||
|
|
||||||
|
### Requirement: Admin-Only Scope
|
||||||
|
|
||||||
|
This capability SHALL be limited to the management frontend. It SHALL NOT add or modify C-end asset expiry display, C-end renewal buttons, C-end renewal APIs, or C-end notification behavior.
|
||||||
|
|
||||||
|
#### Scenario: Keep C-end unchanged
|
||||||
|
|
||||||
|
- **WHEN** this change is implemented
|
||||||
|
- **THEN** C-end asset pages and renewal flows MUST remain outside the change scope
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
## 1. API Contract
|
||||||
|
|
||||||
|
- [x] 1.1 增加 `GET /api/admin/expiring-assets` 的查询参数、分页响应和临期资产项类型。
|
||||||
|
- [x] 1.2 为卡列表、设备列表、资产信息和首页概览类型补充统一临期字段及临期计数字段。
|
||||||
|
- [x] 1.3 增加临期资产 API 服务方法,并确认续费入口复用现有管理端服务和权限。
|
||||||
|
|
||||||
|
## 2. Expiring Asset List
|
||||||
|
|
||||||
|
- [x] 2.1 增加或接入 `/operations/expiring-assets` 管理端路由和页面。
|
||||||
|
- [x] 2.2 实现资产类型、关键字、店铺、套餐、剩余天数和预计到期时间筛选。
|
||||||
|
- [x] 2.3 展示资产、店铺、当前套餐、预计最终到期、剩余天数和后端临期等级名称。
|
||||||
|
- [x] 2.4 实现 0-3 天置顶、其余按预计到期时间升序,并排除已过期和不可预计记录。
|
||||||
|
- [x] 2.5 按 8-15 天粉红、4-7 天紫色、0-3 天红色实现行或到期字段高亮。
|
||||||
|
- [x] 2.6 根据 `can_renew` 展示管理端续费入口,并跳转现有续费/充值流程。
|
||||||
|
|
||||||
|
## 3. Existing Admin Pages
|
||||||
|
|
||||||
|
- [x] 3.1 在网卡普通列表增加临期字段展示和颜色高亮,不改变原排序。
|
||||||
|
- [x] 3.2 在设备普通列表增加临期字段展示和颜色高亮,不改变原排序。
|
||||||
|
- [x] 3.3 在资产信息详情复用同一临期展示规则,禁止前端重新计算预计最终到期时间。
|
||||||
|
- [x] 3.4 在代理首页展示临期卡数量和临期设备数量,并支持跳转临期列表。
|
||||||
|
|
||||||
|
## 4. Notifications
|
||||||
|
|
||||||
|
- [x] 4.1 在通知中心复用临期分类,展示后端生成的 15 天、7 天、3 天临期提醒。
|
||||||
|
- [x] 4.2 使用现有通知目标跳转到临期列表或对应管理端资产详情。
|
||||||
|
- [x] 4.3 确认管理端不展示企微临期消息,不新增 C 端通知入口。
|
||||||
|
|
||||||
|
## 5. Verification
|
||||||
|
|
||||||
|
- [x] 5.1 验证临期字段直接使用后端值,前端不根据套餐明细推导最终到期时间。
|
||||||
|
- [x] 5.2 验证 0-3 天置顶、日期升序、颜色映射和普通列表原排序保持不变。
|
||||||
|
- [x] 5.3 验证 `can_renew=false` 不展示续费入口,且各资产类型使用正确管理端入口。
|
||||||
|
- [x] 5.4 验证通知中心临期分类、已读状态和跳转行为。
|
||||||
|
- [x] 5.5 运行类型检查、相关 ESLint/Stylelint、构建和 `openspec validate add-admin-expiring-assets-notifications --strict`。
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Change: 代理扫码分销注册与提现资料资格前端对接
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
新增强代理扫码分销注册与提现资料资格能力:代理可通过 H5 注册页扫码注册,审批通过后登录后台;代理本人可维护提现资料资格并发起/重提提现,超管可作废资格。后端契约已按 `docs/产品迭代8月份/frontend-api-simple.md` 落地,后台管理端当前缺少对应接口封装、独立注册页与资格管理入口。
|
||||||
|
|
||||||
|
本次前端按后端实际契约对齐:注册验码 `POST /api/c/v1/auth/send-code`(`scene` 为 `bind_phone`,返回 `cooldown_seconds`);扫码注册 `POST /api/c/v1/agent-distribution-registrations`(成功仅返回「待审批」);店铺列表/详情/更新响应新增 `distribution_code`;提现资料资格提交/查询/作废与提现申请重提/详情按新文档补齐。
|
||||||
|
|
||||||
|
## What Changes
|
||||||
|
|
||||||
|
- 新增 `agent-distribution-registration` 能力:独立注册页挂在后台项目内、静态路由免登录访问(H5 与 PC 同一套表单),支持分销码自动填、短信验证码 60s 倒计时、密码掩码与强度提示、省市区级联;提交成功进入「待审批」结束页,失败统一提示「分销码不可用」且不复用同一验证码。
|
||||||
|
- 新增公开 API 封装:`sendCode()` 与 `registerAgent()`,请求不带登录态(`requestOptions.withToken: false`)。
|
||||||
|
- 店铺模块补充 `distribution_code` 字段类型,店铺详情页展示分销码与注册二维码。
|
||||||
|
- 佣金模块新增:提现资料资格提交/替换、资格查询(证件号脱敏、含审批与作废信息)、资格作废(超管,`reason` 必填)、重提被驳回的提现、提现申请详情(含尝试记录与异常标记)。
|
||||||
|
- 扩展企微审批场景业务类型:`agent_distribution_approval`、`withdrawal_qualification_approval`、`commission_withdrawal_approval`。
|
||||||
|
- 提现交互约束:资格替换合同/法人身份证后旧资格失效需重新审批;提现仅在有效资格且余额充足时可提交,否则不冻结、不建单。
|
||||||
|
- 不实现后端接口、数据库、企微回调;不实现 C 端(客户)登录体系。
|
||||||
|
|
||||||
|
## Impact
|
||||||
|
|
||||||
|
- Affected specs: `agent-distribution-registration`、`shop-management`、`commission-management`、`wecom-scenes`
|
||||||
|
- Affected code: `src/api/modules/agentDistribution.ts`、`src/api/modules/commission.ts`、`src/types/api/shop.ts`、`src/types/api/commission.ts`、`src/types/api/wecom.ts`、`src/router/routes/staticRoutes.ts`、`src/router/guards/permission.ts`、`src/views/agent-registration/index.vue`、`src/views/shop-management/detail/index.vue`、`src/views/commission-management/my-commission/index.vue`、`src/views/settings/wecom/scenes/index.vue`
|
||||||
|
- Dependencies: `docs/产品迭代8月份/frontend-api-simple.md`
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: 独立代理注册页免登录访问
|
||||||
|
代理扫码分销注册页 MUST 独立于登录态提供,未登录可访问,且挂在后台项目内(H5 与 PC 共用同一套表单);注册流程 MUST NOT 复用当前登录态。
|
||||||
|
|
||||||
|
#### Scenario: 未登录访问注册页
|
||||||
|
- **GIVEN** 用户未登录并通过扫码或直接访问注册入口
|
||||||
|
- **WHEN** 其打开注册页面
|
||||||
|
- **THEN** 页面 MUST 正常渲染注册表单
|
||||||
|
- **AND** MUST NOT 跳转到登录页
|
||||||
|
|
||||||
|
#### Scenario: 已登录用户访问注册页
|
||||||
|
- **GIVEN** 用户已登录后台
|
||||||
|
- **WHEN** 其打开注册页面
|
||||||
|
- **THEN** 注册流程 MUST 不携带登录态
|
||||||
|
|
||||||
|
### Requirement: 发送短信验证码
|
||||||
|
注册页 MUST 调用 `POST /api/c/v1/auth/send-code` 发送验证码,请求体 `{ phone, scene }`(`scene` 为 `bind_phone`),响应 `data.cooldown_seconds` MUST 用于 60 秒倒计时;请求 MUST 不携带 Token。
|
||||||
|
|
||||||
|
#### Scenario: 发送验证码并倒计时
|
||||||
|
- **GIVEN** 用户输入手机号
|
||||||
|
- **WHEN** 其点击获取验证码
|
||||||
|
- **THEN** 系统 MUST 调用发送验证码接口
|
||||||
|
- **AND** 按钮 MUST 进入 60 秒倒计时且不可重复点击
|
||||||
|
|
||||||
|
#### Scenario: 注册失败后不复用验证码
|
||||||
|
- **GIVEN** 一次注册提交失败
|
||||||
|
- **WHEN** 用户再次尝试注册
|
||||||
|
- **THEN** 页面 MUST 提示重新获取验证码
|
||||||
|
- **AND** MUST NOT 复用已消费的验证码
|
||||||
|
|
||||||
|
### Requirement: 代理扫码注册提交
|
||||||
|
注册页 MUST 调用 `POST /api/c/v1/agent-distribution-registrations` 提交注册,必填 `distribution_code`(扫码自动带)、`phone`、`code`、`password`、`shop_name`、`shop_code`、`username`,选填 `contact_name`、`province`、`city`、`district`、`address`;成功响应为「待审批」,前端 MUST 展示待审批结束页且不自动登录。
|
||||||
|
|
||||||
|
#### Scenario: 注册成功进入待审批
|
||||||
|
- **GIVEN** 用户填写完整表单并通过校验
|
||||||
|
- **WHEN** 其提交注册
|
||||||
|
- **THEN** 系统 MUST 调用注册接口
|
||||||
|
- **AND** 成功时 MUST 展示「待审批,审核结果将通知你」结束页
|
||||||
|
- **AND** MUST NOT 发放账号凭证或自动登录
|
||||||
|
|
||||||
|
#### Scenario: 注册失败统一提示
|
||||||
|
- **GIVEN** 注册提交失败(无效分销码、上级停用、验证码无效或已消费等)
|
||||||
|
- **WHEN** 注册接口返回失败
|
||||||
|
- **THEN** 页面 MUST 统一提示「分销码不可用」
|
||||||
|
- **AND** MUST NOT 根据错误文案区分原因
|
||||||
|
|
||||||
|
### Requirement: 表单适配与敏感项处理
|
||||||
|
注册表单 MUST 同时适配手机 H5 与 PC:H5 单列、大触控区、软键盘友好、地址使用级联选择器;PC 使用居中卡片或两列布局且字段一致。密码输入 MUST 掩码并展示强度提示;页面 MUST NOT 展示除手机号外的完整个人敏感信息。
|
||||||
|
|
||||||
|
#### Scenario: H5 与 PC 同一表单
|
||||||
|
- **GIVEN** 用户分别在手机与 PC 打开注册页
|
||||||
|
- **WHEN** 其填写注册信息
|
||||||
|
- **THEN** 两端的字段集合 MUST 一致
|
||||||
|
- **AND** 布局 MUST 按端侧自适应
|
||||||
|
|
||||||
|
#### Scenario: 密码强度与掩码
|
||||||
|
- **GIVEN** 用户在密码输入框输入
|
||||||
|
- **WHEN** 其提交表单
|
||||||
|
- **THEN** 输入 MUST 为掩码展示
|
||||||
|
- **AND** MUST 展示密码强度提示
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: 提交/替换提现资料资格
|
||||||
|
代理本人 MUST 能提交或替换提现资料资格,调用 `POST /api/admin/shops/{shop_id}/withdrawal-qualifications`,请求体包含 `subject_type`、`subject_code`、`legal_person_id_card` 与合同、身份证正反面、营业执照、门头照、发票等 `*_file_key`,以及 `invoice_title`、`invoice_subject_code`;附件 MUST 先通过对象存储上传接口取得 `file_key` 再提交。
|
||||||
|
|
||||||
|
#### Scenario: 提交资格成功
|
||||||
|
- **GIVEN** 代理本人已登录并选好主体类型
|
||||||
|
- **WHEN** 其上传资料并提交
|
||||||
|
- **THEN** 前端 MUST 先取得全部附件 `file_key`
|
||||||
|
- **AND** 再调用提交接口并在成功后刷新资格列表
|
||||||
|
|
||||||
|
#### Scenario: 替换资格使旧资格失效
|
||||||
|
- **GIVEN** 已存在通过审批的资格
|
||||||
|
- **WHEN** 代理提交合同或法人身份证变更
|
||||||
|
- **THEN** 旧资格 MUST 立即失效
|
||||||
|
- **AND** 新资格 MUST 重新审批通过后方可提现
|
||||||
|
|
||||||
|
### Requirement: 查询提现资料资格
|
||||||
|
代理本人 MUST 能分页查询提现资料资格,调用 `GET /api/admin/shops/{shop_id}/withdrawal-qualifications`(`page` / `page_size` / `status`);响应 MUST 展示脱敏的 `subject_code_masked` 与 `legal_person_id_card_masked`,并展示 `status`、`approval_status`、`invalid_reason`、`invalidated_at` 与各附件 `file_key` 预览。
|
||||||
|
|
||||||
|
#### Scenario: 查看资格版本与审批状态
|
||||||
|
- **GIVEN** 代理本人打开提现资料资格列表
|
||||||
|
- **WHEN** 接口返回资格记录
|
||||||
|
- **THEN** 列表 MUST 展示脱敏证件号与审批状态
|
||||||
|
- **AND** 证件号 MUST NOT 以明文展示
|
||||||
|
|
||||||
|
### Requirement: 作废提现资料资格
|
||||||
|
超级管理员 MUST 能作废提现资料资格,调用 `POST /api/admin/withdrawal-qualifications/{id}/void`,`reason` 必填。
|
||||||
|
|
||||||
|
#### Scenario: 作废资格须填原因
|
||||||
|
- **GIVEN** 超级管理员打开作废弹窗
|
||||||
|
- **WHEN** 其未填写原因直接提交
|
||||||
|
- **THEN** 前端 MUST 阻止提交并提示填写原因
|
||||||
|
|
||||||
|
#### Scenario: 超管作废资格
|
||||||
|
- **GIVEN** 超级管理员选择一条资格
|
||||||
|
- **WHEN** 其填写原因并确认作废
|
||||||
|
- **THEN** 系统 MUST 调用作废接口并在成功后刷新列表
|
||||||
|
|
||||||
|
### Requirement: 重提被驳回的提现
|
||||||
|
代理本人 MUST 能重提被驳回的提现,调用 `PUT /api/admin/shops/{shop_id}/withdrawal-requests/{id}`,请求体包含 `account_name`、`account_number`、`amount`、`withdrawal_method` 与 `invoice_keys`;成功响应返回新提现单(`withdrawal_no`、`actual_amount`、`fee`、`fee_rate`、`status`)。
|
||||||
|
|
||||||
|
#### Scenario: 重提被驳回的提现
|
||||||
|
- **GIVEN** 代理本人的提现申请被驳回
|
||||||
|
- **WHEN** 其修改信息并重新提交
|
||||||
|
- **THEN** 系统 MUST 调用重提接口
|
||||||
|
- **AND** 成功后 MUST 刷新提现记录并展示新单号
|
||||||
|
|
||||||
|
#### Scenario: 非驳回状态不可重提
|
||||||
|
- **GIVEN** 提现申请不是被驳回状态
|
||||||
|
- **WHEN** 代理尝试重提
|
||||||
|
- **THEN** 重提入口 MUST 不可用或不展示
|
||||||
|
|
||||||
|
### Requirement: 提现申请详情
|
||||||
|
代理本人 MUST 能查看提现申请详情,调用 `GET /api/admin/shops/{shop_id}/withdrawal-requests/{id}`;响应包含 `reject_reason`、`anomaly_flag`、`anomaly_name`、`anomaly_reason` 与 `attempts` 尝试记录,前端 MUST 展示这些字段。
|
||||||
|
|
||||||
|
#### Scenario: 查看提现详情
|
||||||
|
- **GIVEN** 代理本人点击提现记录
|
||||||
|
- **WHEN** 详情返回
|
||||||
|
- **THEN** 页面 MUST 展示提现金额、实际到账、手续费、状态
|
||||||
|
- **AND** 展示驳回原因、异常标记与尝试记录
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: 店铺数据返回分销码
|
||||||
|
店铺列表、详情与更新接口响应 MUST 包含 `distribution_code` 字段,前端类型 MUST 覆盖该字段并在列表/详情中展示。
|
||||||
|
|
||||||
|
#### Scenario: 店铺详情展示分销码
|
||||||
|
- **GIVEN** 用户打开店铺详情页
|
||||||
|
- **WHEN** 店铺存在 `distribution_code`
|
||||||
|
- **THEN** 页面 MUST 展示分销码
|
||||||
|
- **AND** MUST 以该码生成注册入口二维码
|
||||||
|
|
||||||
|
#### Scenario: 分销码为空
|
||||||
|
- **GIVEN** 店铺尚未分配分销码
|
||||||
|
- **WHEN** 页面展示店铺信息
|
||||||
|
- **THEN** 分销码与二维码区域 MUST 展示空态(`-` 或「未分配」)
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: 企微审批场景业务类型扩展
|
||||||
|
企微审批场景的 `business_type` MUST 支持以下枚举:`refund_approval`(退款审批)、`offline_recharge_approval`(员工线下代充值审批)、`employee_collection_approval`(员工代收款核销审批)、`agent_distribution_approval`(代理扫码分销注册审批)、`withdrawal_qualification_approval`(提现资料资格审批)、`commission_withdrawal_approval`(佣金提现终审)。前端类型与场景配置页选项 MUST 与后端枚举一致;`GET /api/admin/wecom/scenes/{business_type}/fields` 允许查询上述任一类型。
|
||||||
|
|
||||||
|
#### Scenario: 场景配置页可选新业务类型
|
||||||
|
- **GIVEN** 超级管理员打开企微审批场景配置页
|
||||||
|
- **WHEN** 其新建场景并选择业务类型
|
||||||
|
- **THEN** 下拉选项 MUST 包含全部六个业务类型
|
||||||
|
- **AND** 新增三个业务类型 MUST 与后端枚举一致
|
||||||
|
|
||||||
|
#### Scenario: 查询新增场景业务字段
|
||||||
|
- **GIVEN** 已选择 `agent_distribution_approval`、`withdrawal_qualification_approval` 或 `commission_withdrawal_approval`
|
||||||
|
- **WHEN** 页面加载业务字段
|
||||||
|
- **THEN** 前端 MUST 调用对应 `business_type` 的字段查询接口
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
## 1. 提案与 API 层
|
||||||
|
- [x] 1.1 新增 `src/api/modules/agentDistribution.ts`:`sendCode()` 与 `registerAgent()`,公开请求不带 Token
|
||||||
|
- [x] 1.2 扩展 `src/types/api/shop.ts`:`ShopResponse` 增加 `distribution_code`
|
||||||
|
- [x] 1.3 扩展 `src/types/api/commission.ts`:提现资料资格提交/查询、作废、重提、详情的请求与响应类型
|
||||||
|
- [x] 1.4 扩展 `src/api/modules/commission.ts`:`submitWithdrawalQualification` / `getWithdrawalQualifications` / `voidWithdrawalQualification` / `resubmitWithdrawalRequest` / `getWithdrawalRequestDetail`
|
||||||
|
- [x] 1.5 扩展 `src/types/api/wecom.ts`:`WecomBusinessType` 增加三个业务类型
|
||||||
|
- [x] 1.6 汇总导出新增类型
|
||||||
|
|
||||||
|
## 2. 企微审批场景
|
||||||
|
- [x] 2.1 场景配置页新增三个业务类型选项(`agent_distribution_approval` / `withdrawal_qualification_approval` / `commission_withdrawal_approval`)
|
||||||
|
|
||||||
|
## 3. 独立注册页
|
||||||
|
- [x] 3.1 `staticRoutes.ts` 新增 `/agent-registration` 静态路由
|
||||||
|
- [x] 3.2 `LOGIN_WHITE_LIST` 增加注册页路径
|
||||||
|
- [x] 3.3 新增 `src/views/agent-registration/index.vue`:表单、验证码倒计时、密码强度、省市区级联、提交与结束页、H5/PC 响应式
|
||||||
|
|
||||||
|
## 4. 店铺详情
|
||||||
|
- [x] 4.1 店铺详情页展示 `distribution_code` 与注册二维码
|
||||||
|
|
||||||
|
## 5. 我的佣金(代理侧)
|
||||||
|
- [x] 5.1 新增「提现资料资格」Tab:资格列表(脱敏展示)+ 提交/替换弹窗(附件走上传接口)
|
||||||
|
- [x] 5.2 提现记录新增「详情」抽屉:展示明细、驳回原因、异常标记与尝试记录
|
||||||
|
- [x] 5.3 被驳回记录新增「重新提交」弹窗(PUT 重提)
|
||||||
|
- [x] 5.4 超管可见「作废资格」操作(reason 必填)
|
||||||
|
|
||||||
|
## 6. 验证
|
||||||
|
- [x] 6.1 运行 `npm run build`(含 `vue-tsc --noEmit`)
|
||||||
|
- [x] 6.2 运行 `npm run check:encoding`
|
||||||
|
- [x] 6.3 运行 `openspec.cmd validate add-agent-distribution-registration-and-withdrawal --strict`
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
## Context
|
||||||
|
|
||||||
|
代理注册申请由公开注册接口创建,后台需要按数据范围查询申请并展示审批提交状态。恢复审批只恢复原企业微信审批提交,不创建新的注册申请或审批实例。
|
||||||
|
|
||||||
|
## Decisions
|
||||||
|
|
||||||
|
- 使用列表页 + 独立详情页,详情页 URL 为 `/shop-management/agent-distribution-registrations/detail/:id`。
|
||||||
|
- 列表和详情均使用后端返回的 `status`、`approval_status`、`submission_status` 和名称字段,不在前端推导状态。
|
||||||
|
- 恢复按钮仅由后端返回的 `recoverable` 控制,并使用独立 `agent_distribution_registration:recover_approval` 权限。
|
||||||
|
- 详情响应直接消费后端完整手机号和注册地址,不展示密码或内部审批字段。
|
||||||
|
|
||||||
|
## Risks / Mitigations
|
||||||
|
|
||||||
|
- 状态可能在列表与详情之间发生变化 → 详情和恢复成功/失败后重新加载后端数据。
|
||||||
|
- 恢复请求并发冲突 → 后端返回错误时提示并刷新详情,不做乐观更新。
|
||||||
|
- 手机号属于敏感业务数据 → 页面仅受注册申请列表/详情权限和后端数据范围控制。
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# Change: 增加代理注册申请后台管理
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
后台目前无法查看代理扫码注册申请,也无法处理企业微信审批提交失败或结果未知的注册申请。根据 `docs/产品迭代8月份/代理注册管理.md`,需要提供申请列表、详情和恢复原审批提交入口。
|
||||||
|
|
||||||
|
## What Changes
|
||||||
|
|
||||||
|
- 新增后台代理注册申请列表页,支持状态、申请/决定时间、手机号、关键字、直接上级店铺和提交异常筛选。
|
||||||
|
- 新增注册申请详情页,展示完整手机号、注册地址、申请店铺、分销码、业务状态、审批状态和企微提交状态。
|
||||||
|
- 当 `recoverable = true` 时显示“恢复审批”,调用 `POST /api/admin/agent-distribution-registrations/{id}/recover-approval`,成功后刷新详情。
|
||||||
|
- 新增代理注册申请 API、类型、路由和权限编码。
|
||||||
|
- 权限编码:列表 `agent_distribution_registration:list`、详情 `agent_distribution_registration:detail`、恢复审批 `agent_distribution_registration:recover_approval`。
|
||||||
|
|
||||||
|
## Impact
|
||||||
|
|
||||||
|
- Affected specs: `agent-distribution-registration`
|
||||||
|
- Affected code:
|
||||||
|
- `src/api/modules/agentDistribution.ts`
|
||||||
|
- `src/types/api/agentDistribution.ts`
|
||||||
|
- `src/config/constants/augustIteration.ts`
|
||||||
|
- `src/router/routesAlias.ts`
|
||||||
|
- `src/router/routes/asyncRoutes.ts`
|
||||||
|
- `src/views/shop-management/agent-distribution-registrations/index.vue`
|
||||||
|
- `src/views/shop-management/agent-distribution-registrations/detail.vue`
|
||||||
|
- `src/locales/langs/zh.json`
|
||||||
|
- `docs/权限.md`
|
||||||
|
- Out of scope:
|
||||||
|
- C 端注册流程和代理登录流程。
|
||||||
|
- 后端审批、数据库和企业微信回调实现。
|
||||||
|
- 修改注册申请业务资料或审批结果。
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: Agent Registration Application List
|
||||||
|
|
||||||
|
The admin frontend SHALL provide a paginated agent registration application list with the documented filters and backend response statuses.
|
||||||
|
|
||||||
|
#### Scenario: Filter registration applications
|
||||||
|
|
||||||
|
- **WHEN** an authorized user selects status, time, phone, keyword, parent shop, or submission anomaly filters
|
||||||
|
- **THEN** the frontend MUST send those filters to `GET /api/admin/agent-distribution-registrations`
|
||||||
|
- **AND** the list MUST display business, approval, and submission status names from the response
|
||||||
|
|
||||||
|
### Requirement: Agent Registration Application Detail
|
||||||
|
|
||||||
|
The admin frontend SHALL provide a detail page for `GET /api/admin/agent-distribution-registrations/{id}` and display the complete registration information returned by the backend.
|
||||||
|
|
||||||
|
#### Scenario: Open registration detail
|
||||||
|
|
||||||
|
- **WHEN** an authorized user opens a registration application
|
||||||
|
- **THEN** the frontend MUST request the application detail by ID
|
||||||
|
- **AND** MUST display the phone, address, shop, distribution code, business status, approval status, and submission status
|
||||||
|
- **AND** MUST NOT display password or internal approval fields not present in the response
|
||||||
|
|
||||||
|
### Requirement: Recover Agent Registration Approval
|
||||||
|
|
||||||
|
The frontend SHALL expose `POST /api/admin/agent-distribution-registrations/{id}/recover-approval` only when `recoverable = true` and the user has the recovery permission.
|
||||||
|
|
||||||
|
#### Scenario: Recover approval
|
||||||
|
|
||||||
|
- **GIVEN** a registration response has `recoverable = true`
|
||||||
|
- **WHEN** the user confirms “恢复审批”
|
||||||
|
- **THEN** the frontend MUST call the recovery endpoint with only the registration ID
|
||||||
|
- **AND** MUST refresh the detail after success or a state conflict
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
## 1. API And Types
|
||||||
|
|
||||||
|
- [x] 1.1 增加代理注册申请列表、详情和恢复审批 TypeScript 类型。
|
||||||
|
- [x] 1.2 扩展 `AgentDistributionService`:列表、详情、恢复审批接口。
|
||||||
|
- [x] 1.3 增加唯一权限常量 `list`、`detail`、`recoverApproval`。
|
||||||
|
|
||||||
|
## 2. Pages And Routes
|
||||||
|
|
||||||
|
- [x] 2.1 新增注册申请列表页和筛选条件。
|
||||||
|
- [x] 2.2 新增详情页和审批/提交状态展示。
|
||||||
|
- [x] 2.3 接入“恢复审批”按钮、确认、错误提示和刷新。
|
||||||
|
- [x] 2.4 增加店铺管理下的列表/详情路由与中英文菜单文案。
|
||||||
|
|
||||||
|
## 3. Documentation And Verification
|
||||||
|
|
||||||
|
- [x] 3.1 将页面、详情和恢复审批权限写入 `docs/权限.md`。
|
||||||
|
- [x] 3.2 运行类型检查、lint、编码检查、构建和 OpenSpec 校验。
|
||||||
33
openspec/changes/add-asset-batch-realname-policy/proposal.md
Normal file
33
openspec/changes/add-asset-batch-realname-policy/proposal.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# Change: 新增资产批量实名认证策略配置
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
运营需要一次性为多个卡或设备配置实名认证顺序。现有后台仅支持单资产设置实名认证策略,无法满足列表多选后的批量配置需求。
|
||||||
|
|
||||||
|
## What Changes
|
||||||
|
|
||||||
|
- 在后台卡列表和设备列表分别增加“批量修改实名顺序”入口,基于当前勾选资产执行配置。
|
||||||
|
- 批量配置弹框展示已选资产数量,并提供“无需实名”“先实名后购买”“先购买后实名”三种互斥策略。
|
||||||
|
- 卡列表调用 `POST /api/admin/iot-cards/batch-update-realname-policy`;设备列表调用 `POST /api/admin/devices/batch-update-realname-policy`。
|
||||||
|
- 批量请求传递 `asset_ids` 和 `realname_policy`;前端限制单次提交至多 500 条,并在超限时阻止提交并明确提示。
|
||||||
|
- 设备批量配置弹框提示“实际H5流程由设备策略决定”。
|
||||||
|
- 后端批量接口按全成全败处理;前端在失败时展示明确的后端业务错误,成功后刷新当前列表。
|
||||||
|
- 前端不根据资产类型、卡类型或其他字段自行覆盖或推导实名认证策略。
|
||||||
|
- 本提案不包含任何 H5 初始化、购买流程或 `effective_realname_policy` 的处理。
|
||||||
|
|
||||||
|
## Impact
|
||||||
|
|
||||||
|
- Affected specs:
|
||||||
|
- `iot-card-management`
|
||||||
|
- `device-management`
|
||||||
|
- Affected code:
|
||||||
|
- `src/api/modules/asset.ts` 或对应卡、设备 API 模块
|
||||||
|
- `src/types/api/asset.ts` 或对应卡、设备 API 类型
|
||||||
|
- `src/views/asset-management/iot-card-management/index.vue`
|
||||||
|
- `src/views/asset-management/device-list/index.vue`
|
||||||
|
- API contracts:
|
||||||
|
- `POST /api/admin/iot-cards/batch-update-realname-policy`
|
||||||
|
- `POST /api/admin/devices/batch-update-realname-policy`
|
||||||
|
- Out of scope:
|
||||||
|
- H5 初始化返回字段和购买流程
|
||||||
|
- 单资产实名认证策略设置接口 `PATCH /api/admin/assets/{identifier}/realname-mode`
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: Device Batch Realname Policy Configuration
|
||||||
|
|
||||||
|
The device management list SHALL provide a `批量修改实名顺序` action for selected devices. The action SHALL submit the selected device IDs and exactly one realname policy to `POST /api/admin/devices/batch-update-realname-policy`.
|
||||||
|
|
||||||
|
#### Scenario: Open batch realname policy dialog for selected devices
|
||||||
|
|
||||||
|
- **GIVEN** 用户在设备列表勾选了一台或多台设备
|
||||||
|
- **WHEN** 用户点击“批量修改实名顺序”
|
||||||
|
- **THEN** 页面 MUST open a dialog that displays the selected device count
|
||||||
|
- **AND** 页面 MUST provide mutually exclusive options `无需实名`、`先实名后购买` 和 `先购买后实名`
|
||||||
|
- **AND** 页面 MUST display `实际H5流程由设备策略决定` 提示
|
||||||
|
|
||||||
|
#### Scenario: Submit selected device policy
|
||||||
|
|
||||||
|
- **GIVEN** 用户已选择一项实名认证策略
|
||||||
|
- **WHEN** 用户确认批量修改
|
||||||
|
- **THEN** 系统 MUST call `POST /api/admin/devices/batch-update-realname-policy`
|
||||||
|
- **AND** 请求 MUST contain the selected device IDs as `asset_ids`
|
||||||
|
- **AND** 请求 MUST contain the selected `realname_policy` as `none`、`before_order` 或 `after_order`
|
||||||
|
|
||||||
|
#### Scenario: Refresh devices after all-or-nothing success
|
||||||
|
|
||||||
|
- **WHEN** 设备批量实名认证策略接口成功返回
|
||||||
|
- **THEN** 页面 MUST close the dialog
|
||||||
|
- **AND** 页面 MUST refresh the current device list
|
||||||
|
|
||||||
|
#### Scenario: Show failed batch update reason
|
||||||
|
|
||||||
|
- **WHEN** 设备批量实名认证策略接口返回业务失败或请求失败
|
||||||
|
- **THEN** 页面 MUST display the backend business reason when provided
|
||||||
|
- **AND** 页面 MUST NOT refresh the list as a partial-success result
|
||||||
|
|
||||||
|
### Requirement: Device Batch Realname Policy Limit
|
||||||
|
|
||||||
|
The device management list MUST limit each realname policy batch submission to 500 selected devices.
|
||||||
|
|
||||||
|
#### Scenario: Prevent device batch submission over the limit
|
||||||
|
|
||||||
|
- **GIVEN** 用户在设备列表选择超过 500 台设备
|
||||||
|
- **WHEN** 用户尝试确认批量修改实名认证策略
|
||||||
|
- **THEN** 页面 MUST prevent the request from being sent
|
||||||
|
- **AND** 页面 MUST display an explicit maximum-500-items error
|
||||||
|
|
||||||
|
### Requirement: Device Batch Policy Is User Selected
|
||||||
|
|
||||||
|
The device management list MUST submit the policy explicitly selected by the user and MUST NOT infer, override, or transform it from asset type, card type, or other asset fields.
|
||||||
|
|
||||||
|
#### Scenario: Preserve selected device policy value
|
||||||
|
|
||||||
|
- **GIVEN** 用户在批量配置弹框选择任一实名认证策略
|
||||||
|
- **WHEN** 用户确认提交
|
||||||
|
- **THEN** 请求中的 `realname_policy` MUST equal the selected option
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: IoT Card Batch Realname Policy Configuration
|
||||||
|
|
||||||
|
The IoT card management list SHALL provide a `批量修改实名顺序` action for selected cards. The action SHALL submit the selected card IDs and exactly one realname policy to `POST /api/admin/iot-cards/batch-update-realname-policy`.
|
||||||
|
|
||||||
|
#### Scenario: Open batch realname policy dialog for selected cards
|
||||||
|
|
||||||
|
- **GIVEN** 用户在卡列表勾选了一张或多张卡
|
||||||
|
- **WHEN** 用户点击“批量修改实名顺序”
|
||||||
|
- **THEN** 页面 MUST open a dialog that displays the selected card count
|
||||||
|
- **AND** 页面 MUST provide mutually exclusive options `无需实名`、`先实名后购买` 和 `先购买后实名`
|
||||||
|
|
||||||
|
#### Scenario: Submit selected card policy
|
||||||
|
|
||||||
|
- **GIVEN** 用户已选择一项实名认证策略
|
||||||
|
- **WHEN** 用户确认批量修改
|
||||||
|
- **THEN** 系统 MUST call `POST /api/admin/iot-cards/batch-update-realname-policy`
|
||||||
|
- **AND** 请求 MUST contain the selected card IDs as `asset_ids`
|
||||||
|
- **AND** 请求 MUST contain the selected `realname_policy` as `none`、`before_order` 或 `after_order`
|
||||||
|
|
||||||
|
#### Scenario: Refresh cards after all-or-nothing success
|
||||||
|
|
||||||
|
- **WHEN** 卡批量实名认证策略接口成功返回
|
||||||
|
- **THEN** 页面 MUST close the dialog
|
||||||
|
- **AND** 页面 MUST refresh the current card list
|
||||||
|
|
||||||
|
#### Scenario: Show failed batch update reason
|
||||||
|
|
||||||
|
- **WHEN** 卡批量实名认证策略接口返回业务失败或请求失败
|
||||||
|
- **THEN** 页面 MUST display the backend business reason when provided
|
||||||
|
- **AND** 页面 MUST NOT refresh the list as a partial-success result
|
||||||
|
|
||||||
|
### Requirement: IoT Card Batch Realname Policy Limit
|
||||||
|
|
||||||
|
The IoT card management list MUST limit each realname policy batch submission to 500 selected cards.
|
||||||
|
|
||||||
|
#### Scenario: Prevent card batch submission over the limit
|
||||||
|
|
||||||
|
- **GIVEN** 用户在卡列表选择超过 500 张卡
|
||||||
|
- **WHEN** 用户尝试确认批量修改实名认证策略
|
||||||
|
- **THEN** 页面 MUST prevent the request from being sent
|
||||||
|
- **AND** 页面 MUST display an explicit maximum-500-items error
|
||||||
|
|
||||||
|
### Requirement: IoT Card Batch Policy Is User Selected
|
||||||
|
|
||||||
|
The IoT card management list MUST submit the policy explicitly selected by the user and MUST NOT infer, override, or transform it from asset type, card type, or other asset fields.
|
||||||
|
|
||||||
|
#### Scenario: Preserve selected card policy value
|
||||||
|
|
||||||
|
- **GIVEN** 用户在批量配置弹框选择任一实名认证策略
|
||||||
|
- **WHEN** 用户确认提交
|
||||||
|
- **THEN** 请求中的 `realname_policy` MUST equal the selected option
|
||||||
28
openspec/changes/add-asset-batch-realname-policy/tasks.md
Normal file
28
openspec/changes/add-asset-batch-realname-policy/tasks.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
## 1. API Contract
|
||||||
|
|
||||||
|
- [x] 1.1 定义批量实名认证策略请求类型,包含 `asset_ids:int64[]` 与 `realname_policy:none|before_order|after_order`。
|
||||||
|
- [x] 1.2 接入卡批量更新接口 `POST /api/admin/iot-cards/batch-update-realname-policy`。
|
||||||
|
- [x] 1.3 接入设备批量更新接口 `POST /api/admin/devices/batch-update-realname-policy`。
|
||||||
|
|
||||||
|
## 2. IoT Card Batch Configuration
|
||||||
|
|
||||||
|
- [x] 2.1 在卡列表多选操作区增加“批量修改实名顺序”入口。
|
||||||
|
- [x] 2.2 弹框展示已选卡数量并提供三种互斥实名认证策略。
|
||||||
|
- [x] 2.3 超过 500 张卡时阻止提交并显示明确提示。
|
||||||
|
- [x] 2.4 成功后关闭弹框并刷新卡列表;失败时保留选择并展示后端业务原因。
|
||||||
|
|
||||||
|
## 3. Device Batch Configuration
|
||||||
|
|
||||||
|
- [x] 3.1 在设备列表多选操作区增加“批量修改实名顺序”入口。
|
||||||
|
- [x] 3.2 弹框展示已选设备数量并提供三种互斥实名认证策略。
|
||||||
|
- [x] 3.3 展示“实际H5流程由设备策略决定”提示。
|
||||||
|
- [x] 3.4 超过 500 台设备时阻止提交并显示明确提示。
|
||||||
|
- [x] 3.5 成功后关闭弹框并刷新设备列表;失败时保留选择并展示后端业务原因。
|
||||||
|
|
||||||
|
## 4. Policy Integrity and Verification
|
||||||
|
|
||||||
|
- [x] 4.1 前端不根据资产类型、卡类型或其他字段覆盖或推导提交策略。
|
||||||
|
- [ ] 4.2 验证卡和设备三种策略均按所选值提交,且单次 500 条以内成功。
|
||||||
|
- [ ] 4.3 验证超过 500 条、后端全成全败失败和网络失败均显示明确错误且不部分刷新列表。
|
||||||
|
- [ ] 4.4 验证设备弹框显示 H5 流程归属提示。
|
||||||
|
- [x] 4.5 运行相关前端校验,并执行 `openspec validate add-asset-batch-realname-policy --strict`。
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
## Context
|
||||||
|
|
||||||
|
运营需要在资产层查看当前主套餐及所有排队主套餐顺序接续后的预计最终到期时间。该结果依赖后端套餐队列、激活条件与计时规则,前端只负责展示接口结果。
|
||||||
|
|
||||||
|
## Goals / Non-Goals
|
||||||
|
|
||||||
|
- Goals:
|
||||||
|
- 在资产详情、IoT 卡列表和设备列表统一展示“预计套餐到期时间”。
|
||||||
|
- 区分可精确预计与待激活后才可计算的状态。
|
||||||
|
- 对临期资产提供基于后端剩余天数的视觉提示。
|
||||||
|
- Non-Goals:
|
||||||
|
- 不修改单个套餐明细的“到期时间”展示或套餐队列顺序。
|
||||||
|
- 不新增预计到期时间筛选、排序或前端日期计算。
|
||||||
|
- 不改变套餐续费、激活或到期规则。
|
||||||
|
|
||||||
|
## Decisions
|
||||||
|
|
||||||
|
- Decision: 统一使用以下五个后台响应字段:`estimated_final_expires_at`、`days_until_final_expiry`、`expiry_estimate_status`、`expiry_estimate_status_name`、`is_expiring`,不调用额外计算接口。
|
||||||
|
- Decision: `expiry_estimate_status` 仅使用 `exact`、`waiting_activation`、`none`、`invalid_data`。除 `exact` 外,`estimated_final_expires_at` 和 `days_until_final_expiry` 必须为 `null`;已过期的 `exact` 资产允许返回负数剩余天数。
|
||||||
|
- Decision: 仅当 `expiry_estimate_status=exact` 且存在 `estimated_final_expires_at` 时格式化展示日期;不可预计状态展示“待激活后起算”。
|
||||||
|
- Decision: `is_expiring=true` 是临期样式的唯一触发条件,`days_until_final_expiry` 只作为剩余天数展示或样式辅助信息,前端不自行判定临期阈值。
|
||||||
|
- Decision: 普通卡和设备列表保持既有服务端返回顺序与前端排序行为,不因临期字段重排。
|
||||||
|
- Alternatives considered: 前端根据当前套餐到期时间、排队套餐时长和计时基准计算最终日期。未采用,因为等待激活和后端队列规则会导致结果不准确。
|
||||||
|
|
||||||
|
## Risks / Trade-offs
|
||||||
|
|
||||||
|
- 后端缺少预计字段时无法显示最终日期 -> 对空值显示稳定占位,不以当前套餐日期替代。
|
||||||
|
- 未知 `expiry_estimate_status` 可能导致错误日期展示 -> 仅 `exact` 可显示日期,其他状态显示稳定占位或后端约定的不可预计提示。
|
||||||
|
- 列表增加时间列会占用宽度 -> 作为可配置动态列,沿用现有横向滚动与列选择能力。
|
||||||
|
|
||||||
|
## Migration Plan
|
||||||
|
|
||||||
|
1. 扩展资产详情及卡、设备列表类型以保留预计最终到期字段。
|
||||||
|
2. 将资产详情响应字段映射到页面状态,并在基础信息区域展示。
|
||||||
|
3. 在卡和设备列表增加预计套餐到期时间列及临期样式。
|
||||||
|
4. 验证无套餐、仅当前套餐、多个排队套餐和待激活后起算四类响应。
|
||||||
|
5. 如需回滚,移除新增展示字段和列表列;不涉及数据迁移。
|
||||||
|
|
||||||
|
## Open Questions
|
||||||
|
|
||||||
|
- 后端若返回未约定的状态值,前端不得按 `estimated_final_expires_at` 是否为空展示日期,应按不可预计状态处理。
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
# Change: 新增资产预计套餐到期时间展示
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
当前页面只能在套餐明细中查看单个套餐的到期时间,运营无法快速了解当前主套餐与全部排队主套餐接续后的资产最终到期时间。前端也不能可靠地自行叠加套餐时长,尤其当套餐需要激活后才开始计时时。
|
||||||
|
|
||||||
|
## What Changes
|
||||||
|
|
||||||
|
- 在资产详情、IoT 卡列表和设备列表增加统一的 `预计套餐到期时间` 展示。
|
||||||
|
- 资产详情接口和资产列表响应支持统一的 5 个字段:`estimated_final_expires_at`、`days_until_final_expiry`、`expiry_estimate_status`、`expiry_estimate_status_name` 和 `is_expiring`。
|
||||||
|
- `expiry_estimate_status` 使用 `exact`、`waiting_activation`、`none`、`invalid_data` 四种状态;非 `exact` 状态下日期和剩余天数字段必须为 `null`。
|
||||||
|
- 当 `expiry_estimate_status=exact` 时,展示后端返回的 `estimated_final_expires_at`。
|
||||||
|
- 当套餐尚待激活等无法预计最终日期时,展示“待激活后起算”,不得伪造日期。
|
||||||
|
- 当 `is_expiring=true` 时,按后端返回的剩余天数使用临期颜色提示;普通资产列表不得因临期状态改变既有排序。
|
||||||
|
- 当前套餐自身的到期时间继续仅在套餐明细中展示;前端不得叠加套餐时长计算预计最终到期时间。
|
||||||
|
- 本次仅覆盖后台资产详情、IoT 卡列表和设备列表,不处理 C 端资产信息接口或页面。
|
||||||
|
|
||||||
|
## Impact
|
||||||
|
|
||||||
|
- Affected specs:
|
||||||
|
- `asset-information`
|
||||||
|
- `iot-card-management`
|
||||||
|
- `device-management`
|
||||||
|
- Affected code:
|
||||||
|
- `src/types/api/asset.ts`
|
||||||
|
- `src/types/api/card.ts`
|
||||||
|
- `src/types/api/device.ts`
|
||||||
|
- `src/views/asset-management/asset-information/types.ts`
|
||||||
|
- `src/views/asset-management/asset-information/composables/useAssetInfo.ts`
|
||||||
|
- `src/views/asset-management/asset-information/components/BasicInfoCard.vue`
|
||||||
|
- `src/views/asset-management/iot-card-management/index.vue`
|
||||||
|
- `src/views/asset-management/device-list/index.vue`
|
||||||
|
- API contracts:
|
||||||
|
- `GET /api/admin/assets/resolve/{identifier}`
|
||||||
|
- `GET /api/admin/iot-cards/standalone`
|
||||||
|
- `GET /api/admin/devices`
|
||||||
|
- Dependencies:
|
||||||
|
- 后端在资产详情与资产列表响应中返回预计最终到期字段。
|
||||||
|
- Out of scope:
|
||||||
|
- `GET /api/c/v1/asset/info` 及 C 端资产信息页面
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: Asset Estimated Final Expiry Contract
|
||||||
|
|
||||||
|
The admin asset information integration SHALL preserve the five backend fields `estimated_final_expires_at`, `days_until_final_expiry`, `expiry_estimate_status`, `expiry_estimate_status_name`, and `is_expiring` returned by `GET /api/admin/assets/resolve/{identifier}`. `estimated_final_expires_at` SHALL be an RFC3339 string or `null`, `days_until_final_expiry` SHALL be an integer or `null`, and `expiry_estimate_status` SHALL be one of `exact`, `waiting_activation`, `none`, or `invalid_data`. This requirement applies only to the admin frontend and excludes C-end asset information.
|
||||||
|
|
||||||
|
#### Scenario: Preserve an exact final expiry estimate
|
||||||
|
|
||||||
|
- **GIVEN** 用户查询后台资产详情
|
||||||
|
- **WHEN** `GET /api/admin/assets/resolve/{identifier}` returns `expiry_estimate_status=exact`
|
||||||
|
- **THEN** 前端状态 MUST preserve `estimated_final_expires_at` as `string | null`
|
||||||
|
- **AND** 前端状态 MUST preserve `days_until_final_expiry` as `number | null`
|
||||||
|
- **AND** 前端状态 MUST preserve `is_expiring` as a boolean
|
||||||
|
- **AND** 前端状态 MUST preserve `expiry_estimate_status_name` as the backend-provided status name
|
||||||
|
|
||||||
|
#### Scenario: Preserve null fields for non-exact estimates
|
||||||
|
|
||||||
|
- **GIVEN** 用户查询后台资产详情
|
||||||
|
- **WHEN** `expiry_estimate_status` is `waiting_activation`, `none`, or `invalid_data`
|
||||||
|
- **THEN** `estimated_final_expires_at` MUST be preserved as `null`
|
||||||
|
- **AND** `days_until_final_expiry` MUST be preserved as `null`
|
||||||
|
- **AND** 前端 MUST NOT calculate either field
|
||||||
|
|
||||||
|
#### Scenario: Preserve an unavailable final expiry estimate
|
||||||
|
|
||||||
|
- **GIVEN** 用户查询后台资产详情
|
||||||
|
- **WHEN** 接口返回待激活或其他不可预计的 `expiry_estimate_status`
|
||||||
|
- **THEN** 前端状态 MUST preserve `expiry_estimate_status`
|
||||||
|
- **AND** 前端 MUST NOT derive `estimated_final_expires_at` from current-package or package-detail fields
|
||||||
|
- **AND** 前端 MUST NOT use `expiry_estimate_status_name` as a substitute for the status enum when choosing the display rule
|
||||||
|
|
||||||
|
### Requirement: Asset Estimated Final Expiry Display
|
||||||
|
|
||||||
|
The admin asset information view SHALL display one asset-level field labeled `预计套餐到期时间` for the current primary package and all queued primary packages, without replacing individual package expiry dates in package details.
|
||||||
|
|
||||||
|
#### Scenario: Display an exact final expiry date
|
||||||
|
|
||||||
|
- **GIVEN** 资产详情返回 `expiry_estimate_status=exact`
|
||||||
|
- **AND** `estimated_final_expires_at` has a value
|
||||||
|
- **WHEN** 页面渲染卡资产或设备资产基础信息
|
||||||
|
- **THEN** 页面 MUST display `预计套餐到期时间`
|
||||||
|
- **AND** 页面 MUST format and display `estimated_final_expires_at`
|
||||||
|
|
||||||
|
#### Scenario: Display activation-pending final expiry
|
||||||
|
|
||||||
|
- **GIVEN** 资产详情返回 `expiry_estimate_status=waiting_activation`
|
||||||
|
- **WHEN** 页面渲染卡资产或设备资产基础信息
|
||||||
|
- **THEN** `预计套餐到期时间` MUST display `待激活后起算`
|
||||||
|
- **AND** 页面 MUST NOT display a fabricated date
|
||||||
|
|
||||||
|
#### Scenario: Handle an unknown estimate status safely
|
||||||
|
|
||||||
|
- **GIVEN** 资产详情返回未约定的 `expiry_estimate_status`
|
||||||
|
- **WHEN** 页面渲染资产基础信息
|
||||||
|
- **THEN** 页面 MUST treat the estimate as unavailable
|
||||||
|
- **AND** 页面 MUST NOT display `estimated_final_expires_at` as a date
|
||||||
|
|
||||||
|
#### Scenario: Display no-package placeholder
|
||||||
|
|
||||||
|
- **GIVEN** 资产没有当前或排队主套餐
|
||||||
|
- **AND** `estimated_final_expires_at` is null or absent
|
||||||
|
- **WHEN** 页面渲染资产基础信息
|
||||||
|
- **THEN** `预计套餐到期时间` MUST display a stable placeholder
|
||||||
|
- **AND** 页面 MUST NOT substitute the current package detail expiry date
|
||||||
|
|
||||||
|
#### Scenario: Highlight backend-designated expiring asset
|
||||||
|
|
||||||
|
- **GIVEN** 资产详情返回 `is_expiring=true`
|
||||||
|
- **WHEN** 页面渲染 `预计套餐到期时间`
|
||||||
|
- **THEN** 页面 MUST apply the expiring visual treatment using `days_until_final_expiry`
|
||||||
|
- **AND** 页面 MUST NOT derive whether the asset is expiring from a locally calculated date difference
|
||||||
|
|
||||||
|
#### Scenario: Preserve package detail expiry semantics
|
||||||
|
|
||||||
|
- **GIVEN** 用户查看资产详情中的套餐明细
|
||||||
|
- **WHEN** 页面渲染单个套餐的到期时间
|
||||||
|
- **THEN** 页面 MUST continue to display that package's own expiry field in the package detail context
|
||||||
|
- **AND** 页面 MUST NOT replace it with `estimated_final_expires_at`
|
||||||
|
|
||||||
|
#### Scenario: Display no-package and invalid-data statuses
|
||||||
|
|
||||||
|
- **GIVEN** 资产详情返回 `expiry_estimate_status=none` 或 `expiry_estimate_status=invalid_data`
|
||||||
|
- **WHEN** 页面渲染资产基础信息
|
||||||
|
- **THEN** `none` MUST display a stable empty placeholder
|
||||||
|
- **AND** `invalid_data` MUST display `数据异常`
|
||||||
|
- **AND** 页面 MUST NOT display a fabricated date
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: Device Estimated Final Expiry Display
|
||||||
|
|
||||||
|
The device management list integration SHALL preserve and display the five backend device-level estimated final package expiry fields `estimated_final_expires_at`, `days_until_final_expiry`, `expiry_estimate_status`, `expiry_estimate_status_name`, and `is_expiring` returned in `data.items[]` by `GET /api/admin/devices`. The status SHALL be one of `exact`, `waiting_activation`, `none`, or `invalid_data`; non-`exact` records SHALL have `estimated_final_expires_at=null` and `days_until_final_expiry=null`. The frontend SHALL NOT traverse bound cards or calculate package continuation dates. This requirement applies only to the admin device list.
|
||||||
|
|
||||||
|
#### Scenario: Display exact device final expiry estimate
|
||||||
|
|
||||||
|
- **GIVEN** 设备列表接口返回 `expiry_estimate_status=exact` and `estimated_final_expires_at`
|
||||||
|
- **WHEN** 页面渲染设备列表行
|
||||||
|
- **THEN** 页面 MUST display a column labeled `预计套餐到期时间`
|
||||||
|
- **AND** 该列 MUST format and display `estimated_final_expires_at`
|
||||||
|
|
||||||
|
#### Scenario: Display activation-pending device final expiry
|
||||||
|
|
||||||
|
- **GIVEN** 设备列表接口返回 `expiry_estimate_status=waiting_activation`
|
||||||
|
- **WHEN** 页面渲染设备列表行
|
||||||
|
- **THEN** `预计套餐到期时间` MUST display `待激活后起算`
|
||||||
|
- **AND** 页面 MUST NOT traverse bound cards or display a fabricated date
|
||||||
|
|
||||||
|
#### Scenario: Display device estimate status names for non-exact states
|
||||||
|
|
||||||
|
- **GIVEN** 设备列表接口返回 `expiry_estimate_status=none` 或 `expiry_estimate_status=invalid_data`
|
||||||
|
- **WHEN** 页面渲染设备列表行
|
||||||
|
- **THEN** `none` MUST display a stable empty placeholder
|
||||||
|
- **AND** `invalid_data` MUST display `数据异常`
|
||||||
|
- **AND** 页面 MUST use the status enum to choose the display rule
|
||||||
|
|
||||||
|
#### Scenario: Preserve null fields for non-exact device estimates
|
||||||
|
|
||||||
|
- **GIVEN** 设备列表接口返回 `expiry_estimate_status=none` 或 `expiry_estimate_status=invalid_data`
|
||||||
|
- **THEN** `estimated_final_expires_at` MUST be `null`
|
||||||
|
- **AND** `days_until_final_expiry` MUST be `null`
|
||||||
|
- **AND** 页面 MUST NOT derive either field from绑定卡或套餐数据
|
||||||
|
|
||||||
|
#### Scenario: Highlight expiring device without reordering
|
||||||
|
|
||||||
|
- **GIVEN** 设备列表接口返回 `is_expiring=true` and `days_until_final_expiry`
|
||||||
|
- **WHEN** 页面渲染该设备的预计套餐到期时间
|
||||||
|
- **THEN** 页面 MUST apply the expiring visual treatment based on the backend fields
|
||||||
|
- **AND** 页面 MUST NOT change the ordinary device list sort order because of `is_expiring`
|
||||||
|
|
||||||
|
#### Scenario: Display no-package device placeholder
|
||||||
|
|
||||||
|
- **GIVEN** 设备列表记录没有可预计的最终到期时间
|
||||||
|
- **WHEN** 页面渲染预计套餐到期时间列
|
||||||
|
- **THEN** 页面 MUST display a stable placeholder
|
||||||
|
- **AND** 页面 MUST NOT use an individual package expiry as a substitute
|
||||||
|
|
||||||
|
#### Scenario: Preserve device status name without using it for business calculation
|
||||||
|
|
||||||
|
- **WHEN** 设备列表接口返回 `expiry_estimate_status_name`
|
||||||
|
- **THEN** 前端类型 MUST preserve the field
|
||||||
|
- **AND** 页面 MUST NOT calculate or replace the backend status name
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: IoT Card Estimated Final Expiry Display
|
||||||
|
|
||||||
|
The IoT card management list integration SHALL preserve and display the five backend asset-level estimated final package expiry fields `estimated_final_expires_at`, `days_until_final_expiry`, `expiry_estimate_status`, `expiry_estimate_status_name`, and `is_expiring` returned in `data.items[]` by `GET /api/admin/iot-cards/standalone`. The status SHALL be one of `exact`, `waiting_activation`, `none`, or `invalid_data`; non-`exact` records SHALL have `estimated_final_expires_at=null` and `days_until_final_expiry=null`. The frontend SHALL NOT calculate package continuation dates. This requirement applies only to the admin IoT card list.
|
||||||
|
|
||||||
|
#### Scenario: Display exact card final expiry estimate
|
||||||
|
|
||||||
|
- **GIVEN** 卡列表接口返回 `expiry_estimate_status=exact` and `estimated_final_expires_at`
|
||||||
|
- **WHEN** 页面渲染卡列表行
|
||||||
|
- **THEN** 页面 MUST display a column labeled `预计套餐到期时间`
|
||||||
|
- **AND** 该列 MUST format and display `estimated_final_expires_at`
|
||||||
|
|
||||||
|
#### Scenario: Display activation-pending card final expiry
|
||||||
|
|
||||||
|
- **GIVEN** 卡列表接口返回 `expiry_estimate_status=waiting_activation`
|
||||||
|
- **WHEN** 页面渲染卡列表行
|
||||||
|
- **THEN** `预计套餐到期时间` MUST display `待激活后起算`
|
||||||
|
- **AND** 页面 MUST NOT calculate or display a fabricated date
|
||||||
|
|
||||||
|
#### Scenario: Display card estimate status names for non-exact states
|
||||||
|
|
||||||
|
- **GIVEN** 卡列表接口返回 `expiry_estimate_status=none` 或 `expiry_estimate_status=invalid_data`
|
||||||
|
- **WHEN** 页面渲染卡列表行
|
||||||
|
- **THEN** `none` MUST display a stable empty placeholder
|
||||||
|
- **AND** `invalid_data` MUST display `数据异常`
|
||||||
|
- **AND** 页面 MUST use the status enum to choose the display rule
|
||||||
|
|
||||||
|
#### Scenario: Preserve null fields for non-exact card estimates
|
||||||
|
|
||||||
|
- **GIVEN** 卡列表接口返回 `expiry_estimate_status=none` 或 `expiry_estimate_status=invalid_data`
|
||||||
|
- **THEN** `estimated_final_expires_at` MUST be `null`
|
||||||
|
- **AND** `days_until_final_expiry` MUST be `null`
|
||||||
|
- **AND** 页面 MUST NOT derive either field from套餐数据
|
||||||
|
|
||||||
|
#### Scenario: Highlight expiring card without reordering
|
||||||
|
|
||||||
|
- **GIVEN** 卡列表接口返回 `is_expiring=true` and `days_until_final_expiry`
|
||||||
|
- **WHEN** 页面渲染该卡的预计套餐到期时间
|
||||||
|
- **THEN** 页面 MUST apply the expiring visual treatment based on the backend fields
|
||||||
|
- **AND** 页面 MUST NOT change the ordinary card list sort order because of `is_expiring`
|
||||||
|
|
||||||
|
#### Scenario: Display no-package card placeholder
|
||||||
|
|
||||||
|
- **GIVEN** 卡列表记录没有可预计的最终到期时间
|
||||||
|
- **WHEN** 页面渲染预计套餐到期时间列
|
||||||
|
- **THEN** 页面 MUST display a stable placeholder
|
||||||
|
- **AND** 页面 MUST NOT use an individual package expiry as a substitute
|
||||||
|
|
||||||
|
#### Scenario: Preserve card status name without using it for business calculation
|
||||||
|
|
||||||
|
- **WHEN** 卡列表接口返回 `expiry_estimate_status_name`
|
||||||
|
- **THEN** 前端类型 MUST preserve the field
|
||||||
|
- **AND** 页面 MUST NOT calculate or replace the backend status name
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
## 1. API Contracts And Types
|
||||||
|
|
||||||
|
- [x] 1.1 扩展资产详情响应和资产信息页面状态,支持 5 个预计最终到期字段:`estimated_final_expires_at`、`days_until_final_expiry`、`expiry_estimate_status`、`expiry_estimate_status_name`、`is_expiring`。
|
||||||
|
- [x] 1.2 扩展 IoT 卡和设备列表项类型,支持 5 个预计最终到期字段;不处理 C 端字段。
|
||||||
|
- [x] 1.3 校验四种状态及字段约束:`exact` 可返回日期和剩余天数,其他状态的 `estimated_final_expires_at` 与 `days_until_final_expiry` 必须为 `null`。
|
||||||
|
|
||||||
|
## 2. Asset Information
|
||||||
|
|
||||||
|
- [x] 2.1 将资产解析接口返回的预计最终到期字段映射到资产详情页面状态。
|
||||||
|
- [x] 2.2 在资产详情卡和设备基础信息中展示“预计套餐到期时间”。
|
||||||
|
- [x] 2.3 按 `expiry_estimate_status` 展示:`exact` 显示日期,`waiting_activation` 显示“待激活后起算”,`none` 显示占位,`invalid_data` 显示“数据异常”。
|
||||||
|
- [x] 2.4 `is_expiring=true` 时按 `days_until_final_expiry` 应用临期样式,不根据日期或天数自行推导临期状态。
|
||||||
|
|
||||||
|
## 3. Asset Lists
|
||||||
|
|
||||||
|
- [x] 3.1 在 IoT 卡列表新增“预计套餐到期时间”可配置列,显示接口返回的预计日期或“待激活后起算”。
|
||||||
|
- [x] 3.2 在设备列表新增“预计套餐到期时间”可配置列,显示接口返回的预计日期或“待激活后起算”。
|
||||||
|
- [x] 3.3 在两个列表对 `is_expiring=true` 的预计到期时间使用临期样式,且不改变现有列表排序。
|
||||||
|
|
||||||
|
## 4. Verification
|
||||||
|
|
||||||
|
- [x] 4.1 验证无套餐时不伪造预计日期并显示稳定占位内容。
|
||||||
|
- [x] 4.2 验证仅当前套餐和存在多个排队主套餐时,资产详情和两个列表均显示后端 `estimated_final_expires_at`。
|
||||||
|
- [x] 4.3 验证等待激活等不可预计状态显示“待激活后起算”,不显示计算出的日期。
|
||||||
|
- [x] 4.4 验证 `is_expiring=true` 时使用临期样式,且卡、设备列表顺序不变。
|
||||||
|
- [x] 4.5 运行相关类型检查、lint 或构建验证。
|
||||||
37
openspec/changes/add-asset-realname-status-filter/design.md
Normal file
37
openspec/changes/add-asset-realname-status-filter/design.md
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
## Context
|
||||||
|
|
||||||
|
卡和设备列表需要新增统一的实名状态筛选与展示能力。设备的实名状态由设备列表接口直接返回,不能通过关联卡在前端二次计算,以避免多卡设备或卡绑定关系变化时出现不一致。
|
||||||
|
|
||||||
|
## Goals / Non-Goals
|
||||||
|
|
||||||
|
- Goals:
|
||||||
|
- 支持按“全部”“已实名”“未实名”筛选卡和设备。
|
||||||
|
- 直接展示后端返回的实名状态名称。
|
||||||
|
- 在搜索、刷新、分页和导出查询中保留当前筛选条件。
|
||||||
|
- Non-Goals:
|
||||||
|
- 不新增或修改实名认证流程、策略配置或状态更新操作。
|
||||||
|
- 不在前端推导设备实名状态。
|
||||||
|
- 不变更其他资产详情页的实名状态取值规则。
|
||||||
|
|
||||||
|
## Decisions
|
||||||
|
|
||||||
|
- Decision: 使用可选数值查询参数 `real_name_status`,其中 `0` 表示未实名、`1` 表示已实名;“全部”对应不传该参数。
|
||||||
|
- Decision: 列表展示优先使用每条记录的 `real_name_status_name`,而非根据 `real_name_status` 写死文案。
|
||||||
|
- Decision: 设备列表把接口响应中的 `real_name_status` 与 `real_name_status_name` 作为唯一状态来源,不读取或遍历绑定卡数据。
|
||||||
|
- Alternatives considered: 前端将 `0` 和 `1` 映射为固定文案。未采用,因为后端已提供标准显示名称,直接使用可避免展示口径分叉。
|
||||||
|
|
||||||
|
## Risks / Trade-offs
|
||||||
|
|
||||||
|
- 后端未返回 `real_name_status_name` 时无法满足状态名称展示契约 -> 联调时校验列表响应字段,并将该字段设为必需的列表类型字段。
|
||||||
|
- 卡列表实名认证筛选依赖单卡列表接口 -> 实施时确保筛选参数发往 `GET /api/admin/iot-cards/standalone`。
|
||||||
|
|
||||||
|
## Migration Plan
|
||||||
|
|
||||||
|
1. 扩展卡与设备列表 API 类型和查询参数。
|
||||||
|
2. 接入筛选控件、查询参数及状态列。
|
||||||
|
3. 验证全部、已实名、未实名筛选以及分页和重置行为。
|
||||||
|
4. 如需回滚,移除前端筛选控件、查询参数和状态列;不涉及数据迁移。
|
||||||
|
|
||||||
|
## Open Questions
|
||||||
|
|
||||||
|
- 无。
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
# Change: 新增卡和设备实名状态筛选
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
运营人员需要在卡列表和设备列表中快速识别并筛选已实名或未实名的资产。当前页面未完整接入实名状态筛选和后端返回的实名状态名称,设备列表尤其不能依赖前端遍历绑定卡来推导状态。
|
||||||
|
|
||||||
|
## What Changes
|
||||||
|
|
||||||
|
- 卡列表和设备列表的筛选区新增“实名状态”,提供“全部”“已实名”“未实名”选项。
|
||||||
|
- 卡列表查询使用 `GET /api/admin/iot-cards/standalone`,设备列表查询使用 `GET /api/admin/devices`;选择状态后分别传递 `real_name_status=0|1`,未选择时不传该参数。
|
||||||
|
- 卡和设备列表项的类型契约支持 `real_name_status: int` 与 `real_name_status_name: string`。
|
||||||
|
- 两个列表表格新增“实名状态”列,直接展示接口返回的 `real_name_status_name`。
|
||||||
|
- 设备列表直接使用设备列表接口的实名状态字段,不遍历或关联绑定卡计算设备实名状态。
|
||||||
|
- 搜索、刷新和分页切换必须保留当前实名状态筛选;重置搜索时清空该筛选。
|
||||||
|
|
||||||
|
## Impact
|
||||||
|
|
||||||
|
- Affected specs:
|
||||||
|
- `iot-card-management`
|
||||||
|
- `device-management`
|
||||||
|
- Affected code:
|
||||||
|
- `src/api/modules/card.ts`
|
||||||
|
- `src/api/modules/device.ts`
|
||||||
|
- `src/types/api/card.ts`
|
||||||
|
- `src/types/api/device.ts`
|
||||||
|
- `src/views/asset-management/iot-card-management/index.vue`
|
||||||
|
- `src/views/asset-management/device-list/index.vue`
|
||||||
|
- API contracts:
|
||||||
|
- `GET /api/admin/iot-cards/standalone?real_name_status=0|1`
|
||||||
|
- `GET /api/admin/devices?real_name_status=0|1`
|
||||||
|
- List items return `real_name_status: int` and `real_name_status_name: string`
|
||||||
|
- Dependencies:
|
||||||
|
- 后端列表接口必须支持实名状态查询并返回实名状态名称。
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: Device Realname Status Query Contract
|
||||||
|
|
||||||
|
The device management list integration SHALL support an optional numeric `real_name_status` parameter on `GET /api/admin/devices`. The list-item contract SHALL include `real_name_status` and `real_name_status_name` returned by the device list API.
|
||||||
|
|
||||||
|
#### Scenario: Query devices by realname status
|
||||||
|
|
||||||
|
- **GIVEN** 用户正在后台设备列表使用实名状态筛选
|
||||||
|
- **WHEN** 用户选择“已实名”并执行搜索
|
||||||
|
- **THEN** 系统 MUST call `GET /api/admin/devices` with `real_name_status=1`
|
||||||
|
|
||||||
|
#### Scenario: Query unverified devices
|
||||||
|
|
||||||
|
- **GIVEN** 用户正在后台设备列表使用实名状态筛选
|
||||||
|
- **WHEN** 用户选择“未实名”并执行搜索
|
||||||
|
- **THEN** 系统 MUST call `GET /api/admin/devices` with `real_name_status=0`
|
||||||
|
- **AND** 前端 MUST NOT 因为该值为 `0` 而省略此参数
|
||||||
|
|
||||||
|
#### Scenario: Query all devices without status restriction
|
||||||
|
|
||||||
|
- **GIVEN** 用户未选择实名状态或选择“全部”
|
||||||
|
- **WHEN** 用户查询、刷新或切换设备列表分页
|
||||||
|
- **THEN** 请求 MUST NOT 携带 `real_name_status`
|
||||||
|
|
||||||
|
#### Scenario: Receive device realname status fields
|
||||||
|
|
||||||
|
- **GIVEN** 设备列表接口返回设备记录
|
||||||
|
- **WHEN** 前端解析列表响应
|
||||||
|
- **THEN** 列表项类型 MUST 支持 `real_name_status: int`
|
||||||
|
- **AND** 列表项类型 MUST 支持 `real_name_status_name: string`
|
||||||
|
|
||||||
|
### Requirement: Device Realname Status Filter And Display
|
||||||
|
|
||||||
|
The device management page SHALL provide a `实名状态` filter with `全部`、`已实名`、`未实名` options and display the backend device realname status name in the device table.
|
||||||
|
|
||||||
|
#### Scenario: Display device realname status filter
|
||||||
|
|
||||||
|
- **GIVEN** 用户打开后台设备列表
|
||||||
|
- **WHEN** 页面渲染筛选区
|
||||||
|
- **THEN** 页面 MUST display a `实名状态` filter
|
||||||
|
- **AND** 筛选项 MUST provide `全部`、`已实名`、`未实名` options
|
||||||
|
|
||||||
|
#### Scenario: Display backend device realname status name
|
||||||
|
|
||||||
|
- **GIVEN** 设备列表接口返回某条记录的 `real_name_status_name`
|
||||||
|
- **WHEN** 页面渲染该设备的表格行
|
||||||
|
- **THEN** 页面 MUST 在“实名状态”列显示该字段值
|
||||||
|
|
||||||
|
#### Scenario: Use the device API as the status source
|
||||||
|
|
||||||
|
- **GIVEN** 设备列表接口返回设备的实名状态字段
|
||||||
|
- **WHEN** 页面渲染设备实名状态
|
||||||
|
- **THEN** 页面 MUST directly use the record's `real_name_status` and `real_name_status_name`
|
||||||
|
- **AND** 页面 MUST NOT 遍历、绑定或计算关联卡的实名状态
|
||||||
|
|
||||||
|
#### Scenario: Preserve device realname status while paginating
|
||||||
|
|
||||||
|
- **GIVEN** 用户已选择“已实名”或“未实名”并获得筛选结果
|
||||||
|
- **WHEN** 用户切换设备列表页码或每页条数
|
||||||
|
- **THEN** 后续列表请求 MUST 保留当前的 `real_name_status` 参数
|
||||||
|
|
||||||
|
#### Scenario: Reset device realname status filter
|
||||||
|
|
||||||
|
- **GIVEN** 用户已选择实名状态
|
||||||
|
- **WHEN** 用户重置设备列表搜索条件
|
||||||
|
- **THEN** 页面 MUST 清空实名状态筛选
|
||||||
|
- **AND** 后续列表请求 MUST NOT 携带 `real_name_status`
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: IoT Card Realname Status Query Contract
|
||||||
|
|
||||||
|
The IoT card management list integration SHALL query `GET /api/admin/iot-cards/standalone` and support an optional numeric `real_name_status` parameter. The list-item contract SHALL include `real_name_status` and `real_name_status_name`.
|
||||||
|
|
||||||
|
#### Scenario: Query cards by realname status
|
||||||
|
|
||||||
|
- **GIVEN** 用户正在后台卡列表使用实名状态筛选
|
||||||
|
- **WHEN** 用户选择“已实名”并执行搜索
|
||||||
|
- **THEN** 系统 MUST call `GET /api/admin/iot-cards/standalone` with `real_name_status=1`
|
||||||
|
|
||||||
|
#### Scenario: Query unverified cards
|
||||||
|
|
||||||
|
- **GIVEN** 用户正在后台卡列表使用实名状态筛选
|
||||||
|
- **WHEN** 用户选择“未实名”并执行搜索
|
||||||
|
- **THEN** 系统 MUST call `GET /api/admin/iot-cards/standalone` with `real_name_status=0`
|
||||||
|
- **AND** 前端 MUST NOT 因为该值为 `0` 而省略此参数
|
||||||
|
|
||||||
|
#### Scenario: Query all cards without status restriction
|
||||||
|
|
||||||
|
- **GIVEN** 用户未选择实名状态或选择“全部”
|
||||||
|
- **WHEN** 用户查询、刷新或切换卡列表分页
|
||||||
|
- **THEN** 请求 MUST NOT 携带 `real_name_status`
|
||||||
|
|
||||||
|
#### Scenario: Receive card realname status fields
|
||||||
|
|
||||||
|
- **GIVEN** 卡列表接口返回资产记录
|
||||||
|
- **WHEN** 前端解析列表响应
|
||||||
|
- **THEN** 列表项类型 MUST 支持 `real_name_status: int`
|
||||||
|
- **AND** 列表项类型 MUST 支持 `real_name_status_name: string`
|
||||||
|
|
||||||
|
### Requirement: IoT Card Realname Status Filter And Display
|
||||||
|
|
||||||
|
The IoT card management page SHALL provide a `实名状态` filter with `全部`、`已实名`、`未实名` options and display the backend realname status name in the card table.
|
||||||
|
|
||||||
|
#### Scenario: Display card realname status filter
|
||||||
|
|
||||||
|
- **GIVEN** 用户打开后台卡列表
|
||||||
|
- **WHEN** 页面渲染筛选区
|
||||||
|
- **THEN** 页面 MUST display a `实名状态` filter
|
||||||
|
- **AND** 筛选项 MUST provide `全部`、`已实名`、`未实名` options
|
||||||
|
|
||||||
|
#### Scenario: Display backend card realname status name
|
||||||
|
|
||||||
|
- **GIVEN** 卡列表接口返回某条记录的 `real_name_status_name`
|
||||||
|
- **WHEN** 页面渲染该卡的表格行
|
||||||
|
- **THEN** 页面 MUST 在“实名状态”列显示该字段值
|
||||||
|
|
||||||
|
#### Scenario: Preserve card realname status while paginating
|
||||||
|
|
||||||
|
- **GIVEN** 用户已选择“已实名”或“未实名”并获得筛选结果
|
||||||
|
- **WHEN** 用户切换卡列表页码或每页条数
|
||||||
|
- **THEN** 后续列表请求 MUST 保留当前的 `real_name_status` 参数
|
||||||
|
|
||||||
|
#### Scenario: Reset card realname status filter
|
||||||
|
|
||||||
|
- **GIVEN** 用户已选择实名状态
|
||||||
|
- **WHEN** 用户重置卡列表搜索条件
|
||||||
|
- **THEN** 页面 MUST 清空实名状态筛选
|
||||||
|
- **AND** 后续列表请求 MUST NOT 携带 `real_name_status`
|
||||||
26
openspec/changes/add-asset-realname-status-filter/tasks.md
Normal file
26
openspec/changes/add-asset-realname-status-filter/tasks.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
## 1. API Contracts And Types
|
||||||
|
|
||||||
|
- [x] 1.1 扩展卡列表查询参数和列表项类型,支持可选 `real_name_status` 以及必需的 `real_name_status_name`。
|
||||||
|
- [x] 1.2 扩展设备列表查询参数和列表项类型,支持可选 `real_name_status` 以及必需的 `real_name_status_name`。
|
||||||
|
- [x] 1.3 将卡列表查询接入 `GET /api/admin/iot-cards/standalone` 并传递实名状态筛选参数。
|
||||||
|
|
||||||
|
## 2. Card List
|
||||||
|
|
||||||
|
- [x] 2.1 在卡列表筛选区新增“实名状态”的全部、已实名、未实名选项。
|
||||||
|
- [x] 2.2 将选中的实名状态传递给卡列表查询,并在搜索、刷新、分页、导出中保留该条件。
|
||||||
|
- [x] 2.3 在卡列表表格新增“实名状态”列,展示接口返回的 `real_name_status_name`。
|
||||||
|
- [x] 2.4 重置卡列表搜索时清空实名状态筛选。
|
||||||
|
|
||||||
|
## 3. Device List
|
||||||
|
|
||||||
|
- [x] 3.1 在设备列表筛选区新增“实名状态”的全部、已实名、未实名选项。
|
||||||
|
- [x] 3.2 将选中的实名状态传递给 `GET /api/admin/devices`,并在搜索、刷新、分页、导出中保留该条件。
|
||||||
|
- [x] 3.3 在设备列表表格新增“实名状态”列,直接展示接口返回的 `real_name_status_name`,不遍历绑定卡计算状态。
|
||||||
|
- [x] 3.4 重置设备列表搜索时清空实名状态筛选。
|
||||||
|
|
||||||
|
## 4. Verification
|
||||||
|
|
||||||
|
- [ ] 4.1 验证卡列表“全部”“已实名”“未实名”分别不传、传 `1`、传 `0`,且状态列显示接口名称。
|
||||||
|
- [ ] 4.2 验证设备列表“全部”“已实名”“未实名”分别不传、传 `1`、传 `0`,且状态列直接显示设备接口名称。
|
||||||
|
- [ ] 4.3 验证两个列表在分页切换、刷新和导出时保留实名状态筛选,重置后清空该条件。
|
||||||
|
- [x] 4.4 运行相关类型检查、lint 或构建验证。
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
# Change: 新增资产钱包自动续费配置(后台查询/保存 + 自动续费失败通知适配)
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
根据 `docs/产品迭代8月份/资产钱包.md`。后端测试环境(`https://cmp-api.boss160.cn`,`Authorization: Bearer <token>`)已提供资产钱包自动续费全局配置能力,仅有 2 个后台接口,H5 侧零新增:
|
||||||
|
|
||||||
|
- 查询资产钱包自动续费配置:`GET /api/admin/asset-auto-renewal-config`
|
||||||
|
- 保存资产钱包自动续费配置:`PUT /api/admin/asset-auto-renewal-config`
|
||||||
|
|
||||||
|
后台需要提供配置页面承载总开关、适用范围、指定主套餐、到期前天数等配置;同时新增通知类型 `asset.auto_renewal.failed` 会复用既有通知接口产生新数据,需要适配展示与跳转。
|
||||||
|
|
||||||
|
## What Changes
|
||||||
|
|
||||||
|
- 新增能力 `asset-wallet-auto-renewal`:
|
||||||
|
- 配置读取:`GET /api/admin/asset-auto-renewal-config`,返回唯一一份全局配置的 `enabled`+`enabled_name`、`scope`+`scope_name`、`package_ids`、`days_before_expiry`、`config_version`、`updater`、`updated_at`。
|
||||||
|
- 配置保存:`PUT /api/admin/asset-auto-renewal-config`:
|
||||||
|
- 请求体 `{ enabled(0/1,必填), scope(all|specified,必填), package_ids(uint[],仅 specified 时非空且只能选当前可售主套餐), days_before_expiry(1–90,必填) }`。
|
||||||
|
- 语义:单行配置、无新增/删除;保存即递增 `config_version`,记录操作者与前后值快照;配置变更只影响后续扫描,历史记录不重算。
|
||||||
|
- 权限:仅超级管理员与平台账号可访问;其他身份(代理/企业/个人客户)`403`,提示「无权限操作该资源或资源不存在」,无权限与不存在不区分。
|
||||||
|
- 通知适配(复用既有接口,不算新接口):
|
||||||
|
- 后台站内通知:新增通知类型 `asset.auto_renewal.failed`(类别 `expiry`、级别 `warning`),接收人是业务员/店铺账号。走既有 `GET /api/admin/notifications` + `GET /api/admin/notifications/{id}/target`;确认 `target_type` 的 `iot_card` / `device` 在导航白名单;`available=false` 时只显示正文不跳转;计入未读数。
|
||||||
|
- H5 个人客户通知:同一类型已由后端加入客户可见白名单,出现在既有 `GET /api/c/v1/notifications` 与 `unread-count`,客户侧只有文案(资产标识、套餐、原因、到期日),无跳转接口、无需新页面,本仓库无需改动。该类型属 `expiry` 类别,展示期以业务到期时间为准,套餐到期后从列表消失(既有类别行为)。
|
||||||
|
- 明确不做(避免前端空等):无自动续费记录页/异常记录页接口、无尝试记录查询接口、无「有余额就不停机」开关、无 H5 客户侧新接口。
|
||||||
|
|
||||||
|
## Impact
|
||||||
|
|
||||||
|
- Affected specs:
|
||||||
|
- `asset-wallet-auto-renewal` — 新增能力
|
||||||
|
- Affected code:
|
||||||
|
- `src/types/api/assetWallet.ts`(新增)
|
||||||
|
- `src/types/api/index.ts`
|
||||||
|
- `src/api/modules/assetWallet.ts`(新增)
|
||||||
|
- `src/api/modules/index.ts`
|
||||||
|
- `src/views/settings/asset-wallet-auto-renewal/index.vue`(新增)
|
||||||
|
- `src/router/routesAlias.ts`
|
||||||
|
- `src/router/routes/asyncRoutes.ts`
|
||||||
|
- `src/utils/business/notificationNavigation.ts`(确认/补充 `iot_card`、`device` 白名单)
|
||||||
|
- `src/components/core/layouts/art-notification/index.vue`(确认 `expiry` 分类覆盖新类型)
|
||||||
|
- `src/locales/langs/zh.json`、`src/locales/langs/en.json`
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: 自动续费配置查询
|
||||||
|
|
||||||
|
The admin frontend SHALL load the single global asset wallet auto-renewal configuration through `GET /api/admin/asset-auto-renewal-config`. 响应字段 SHALL 包含并展示 `enabled`+`enabled_name`、`scope`+`scope_name`、`package_ids`、`days_before_expiry`、`config_version`、`updater`、`updated_at`。
|
||||||
|
|
||||||
|
#### Scenario: 读取全局自动续费配置
|
||||||
|
|
||||||
|
- **WHEN** 用户进入资产钱包自动续费配置页面
|
||||||
|
- **THEN** 前端 MUST 调用 `GET /api/admin/asset-auto-renewal-config`
|
||||||
|
- **AND** 页面 MUST 展示总开关及中文名称、适用范围及中文名称、指定主套餐集合、统一到期前天数、配置版本、最近保存操作者与最近保存时间
|
||||||
|
|
||||||
|
### Requirement: 自动续费配置保存
|
||||||
|
|
||||||
|
The admin frontend SHALL save the configuration through `PUT /api/admin/asset-auto-renewal-config` with request body `{ enabled, scope, package_ids, days_before_expiry }`。`enabled` SHALL 取值 0/1 且必填;`scope` SHALL 取值 `all`(全部主套餐)或 `specified`(指定主套餐)且必填;`package_ids` 仅在 `scope=specified` 时必填非空且只能选择当前可售主套餐;`days_before_expiry` SHALL 取值 1 至 90 且必填。配置为单行、无新增/删除;保存 SHALL 递增 `config_version` 并记录操作者与前后值快照;配置变更 SHALL 只影响后续扫描,历史记录不重算。
|
||||||
|
|
||||||
|
#### Scenario: 保存全部主套餐范围配置
|
||||||
|
|
||||||
|
- **WHEN** 用户设置适用范围为「全部主套餐」并提交
|
||||||
|
- **THEN** 前端 MUST 调用 `PUT /api/admin/asset-auto-renewal-config`
|
||||||
|
- **AND** 请求体携带 `enabled`、`scope=all`、`days_before_expiry`
|
||||||
|
- **AND** `package_ids` 以空数组提交
|
||||||
|
- **AND** 保存成功后页面 MUST 以响应中的 `config_version`、`updater`、`updated_at` 刷新展示
|
||||||
|
|
||||||
|
#### Scenario: 保存指定主套餐范围配置
|
||||||
|
|
||||||
|
- **WHEN** 用户设置适用范围为「指定主套餐」并选择若干当前可售主套餐后提交
|
||||||
|
- **THEN** `package_ids` MUST 非空且只包含当前可售主套餐
|
||||||
|
- **AND** 前端 MUST 携带 `scope=specified` 与非空 `package_ids` 提交
|
||||||
|
|
||||||
|
#### Scenario: 参数校验
|
||||||
|
|
||||||
|
- **WHEN** `enabled` 缺失、`scope` 非法、`scope=specified` 时 `package_ids` 为空或包含不可售套餐,或 `days_before_expiry` 超出 1–90
|
||||||
|
- **THEN** 前端 MUST 阻止提交并给出校验提示
|
||||||
|
|
||||||
|
#### Scenario: 仅影响后续扫描
|
||||||
|
|
||||||
|
- **WHEN** 用户修改并保存配置
|
||||||
|
- **THEN** 历史自动续费记录 MUST NOT 被重算
|
||||||
|
- **AND** 新配置 MUST 只对保存后的扫描生效
|
||||||
|
|
||||||
|
### Requirement: 自动续费配置访问权限
|
||||||
|
|
||||||
|
Only super admin and platform accounts SHALL be allowed to query or save the asset wallet auto-renewal configuration. 代理、企业与个人客户等身份访问时 SHALL 返回 `403` 并提示「无权限操作该资源或资源不存在」;无权限与不存在的表现 MUST NOT 可区分。
|
||||||
|
|
||||||
|
#### Scenario: 授权访问
|
||||||
|
|
||||||
|
- **WHEN** 超级管理员或平台账号访问配置接口
|
||||||
|
- **THEN** 页面 MUST 正常查询与保存配置
|
||||||
|
|
||||||
|
#### Scenario: 无权限访问
|
||||||
|
|
||||||
|
- **WHEN** 代理、企业或个人客户账号访问配置接口
|
||||||
|
- **THEN** 页面 MUST 按 `403` 无权限处理并展示统一提示
|
||||||
|
- **AND** 前端 MUST NOT 通过响应区分无权限与资源不存在
|
||||||
|
|
||||||
|
### Requirement: 自动续费失败后台通知
|
||||||
|
|
||||||
|
The admin notification center SHALL display the new notification type `asset.auto_renewal.failed`(类别 `expiry`、级别 `warning`)through the existing notification APIs,接收人为业务员/店铺账号。目标 `target_type` 的 `iot_card` 与 `device` SHALL 位于通知导航白名单;当目标 `available=false` 时页面 SHALL 只展示正文且不跳转;该类型通知 SHALL 计入未读数。
|
||||||
|
|
||||||
|
#### Scenario: 展示并跳转自动续费失败通知
|
||||||
|
|
||||||
|
- **WHEN** 通知列表返回 `asset.auto_renewal.failed` 类型且目标可用
|
||||||
|
- **THEN** 通知中心 MUST 将该通知归入 `expiry` 类别展示
|
||||||
|
- **AND** 用户点击后 MUST 通过既有目标接口按 `iot_card` / `device` 跳转到对应资产详情
|
||||||
|
|
||||||
|
#### Scenario: 目标不可用
|
||||||
|
|
||||||
|
- **WHEN** 目标接口返回 `available=false`
|
||||||
|
- **THEN** 页面 MUST 只展示通知正文且不发起跳转
|
||||||
|
|
||||||
|
### Requirement: H5 客户侧通知边界
|
||||||
|
|
||||||
|
This capability SHALL NOT 新增或修改 H5 客户侧接口与页面。`asset.auto_renewal.failed` 类型已由后端加入客户可见白名单,通过既有 `GET /api/c/v1/notifications` 与 `unread-count` 返回;客户侧仅展示文案(资产标识、套餐、原因、到期日),无跳转接口、无需新页面。该类型属 `expiry` 类别,展示期以业务到期时间为准,套餐到期后从列表消失(既有类别行为)。
|
||||||
|
|
||||||
|
#### Scenario: H5 复用既有接口
|
||||||
|
|
||||||
|
- **WHEN** 客户侧通知接口返回该类型
|
||||||
|
- **THEN** 客户侧 MUST 仅展示文案且不提供跳转
|
||||||
|
- **AND** 本次变更 MUST NOT 新增 H5 客户侧接口或页面
|
||||||
|
|
||||||
|
#### Scenario: 到期展示期
|
||||||
|
|
||||||
|
- **WHEN** 对应套餐业务到期
|
||||||
|
- **THEN** 该通知按 `expiry` 类别既有行为从客户侧列表消失
|
||||||
|
|
||||||
|
### Requirement: 功能范围边界
|
||||||
|
|
||||||
|
This capability SHALL NOT 包含以下内容:自动续费记录页/异常记录页、尝试记录查询、「有余额就不停机」开关、H5 客户侧新接口。
|
||||||
|
|
||||||
|
#### Scenario: 明确不提供的功能
|
||||||
|
|
||||||
|
- **WHEN** 前端对接本次资产钱包自动续费能力
|
||||||
|
- **THEN** 页面 MUST NOT 提供或依赖自动续费记录页、异常记录页、尝试记录查询接口与「有余额就不停机」开关
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
# Tasks: 资产钱包自动续费配置
|
||||||
|
|
||||||
|
## 1. 类型与 API
|
||||||
|
- [x] 1.1 新增 `src/types/api/assetWallet.ts`:`AssetAutoRenewalConfig`(`enabled`/`enabled_name`/`scope`/`scope_name`/`package_ids`/`days_before_expiry`/`config_version`/`updater`/`updated_at`)、`UpdateAssetAutoRenewalConfigRequest`(`enabled`/`scope`/`package_ids`/`days_before_expiry`)等类型
|
||||||
|
- [x] 1.2 `src/types/api/index.ts` 导出新类型
|
||||||
|
- [x] 1.3 新增 `src/api/modules/assetWallet.ts`:
|
||||||
|
- `getAutoRenewalConfig`:`GET /api/admin/asset-auto-renewal-config`
|
||||||
|
- `saveAutoRenewalConfig`:`PUT /api/admin/asset-auto-renewal-config`
|
||||||
|
- [x] 1.4 `src/api/modules/index.ts` 导出新服务
|
||||||
|
|
||||||
|
## 2. 配置页面
|
||||||
|
- [x] 2.1 `src/router/routesAlias.ts` 新增资产钱包自动续费配置路由别名,`src/router/routes/asyncRoutes.ts` 在设置下注册路由与菜单(仅超级管理员与平台账号可见)
|
||||||
|
- [x] 2.2 新增 `src/views/settings/asset-wallet-auto-renewal/index.vue`:读取配置并展示总开关、适用范围、指定主套餐、统一到期前天数、配置版本、最近保存操作者与时间(含 `enabled_name`/`scope_name`)
|
||||||
|
- [x] 2.3 实现保存表单:总开关(0/1)、适用范围(all/specified)、到期前天数(1–90 校验);指定范围时主套餐多选仅支持当前可售主套餐且非空
|
||||||
|
- [x] 2.4 保存成功后使用响应刷新 `config_version`、`updater`、`updated_at`,不做新增/删除记录操作
|
||||||
|
|
||||||
|
## 3. 通知适配
|
||||||
|
- [x] 3.1 确认 `src/utils/business/notificationNavigation.ts` 白名单包含 `iot_card` 与 `device`,目标可用时跳转资产详情
|
||||||
|
- [x] 3.2 确认 `src/components/core/layouts/art-notification/index.vue` 的 `expiry` 分类可展示 `asset.auto_renewal.failed`,`available=false` 时只显示正文不跳转
|
||||||
|
- [x] 3.3 确认该类型通知计入未读数与分类汇总
|
||||||
|
|
||||||
|
## 4. Verification
|
||||||
|
- [x] 4.1 验证 GET/PUT 字段传递与参数校验(enabled、scope、package_ids、days_before_expiry)
|
||||||
|
- [x] 4.2 验证指定范围时 package_ids 非空且仅可售主套餐
|
||||||
|
- [x] 4.3 验证通知类型展示、目标跳转与不可用目标处理
|
||||||
|
- [x] 4.4 验证非超级管理员/平台账号访问的 403 处理
|
||||||
|
- [x] 4.5 运行 lint、类型检查与构建
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
## Context
|
||||||
|
|
||||||
|
本次变更横跨平台、代理和企业三类主体以及资产、订单、退款、钱包、通知等多个业务页面。OpenAPI 将关联关系明确建模为 `investigation_refs`、`linkage` 和稳定资源引用,并区分平台内部 ID 与代理/企业可见的业务标识。前端必须保持这些边界,不能为了补齐跳转而从名称、时间或摘要推断关联关系。
|
||||||
|
|
||||||
|
仓库目前没有已归档的基线 specs,但存在通知中心和旧资产操作日志的活跃变更。本提案建立独立的审计链路能力,通过明确的依赖点与它们集成,不复制或覆盖其已有要求。
|
||||||
|
|
||||||
|
## Goals / Non-Goals
|
||||||
|
|
||||||
|
- Goals: 按 OpenAPI 实现 16 个只读接口的类型、查询、页面和跨视角跳转契约。
|
||||||
|
- Goals: 为平台、代理和企业提供符合各自权限与数据投影的业务审计入口。
|
||||||
|
- Goals: 统一分页、RFC3339 时间范围、枚举展示、在线保留窗口和错误处理。
|
||||||
|
- Non-Goals: 不修改后端接口、数据库、日志采集或保留策略。
|
||||||
|
- Non-Goals: 不提供恢复、重试、修改、删除、处置、封禁、任意全文搜索或导出。
|
||||||
|
- Non-Goals: 不替换现有资产操作日志组件,也不修改 C/H5 端。
|
||||||
|
|
||||||
|
## Decisions
|
||||||
|
|
||||||
|
- Decision: 新增独立审计 API 模块和共享类型,按平台审计、主体活动、资金、风险、Integration、链路时间线分组暴露查询函数;统一保留服务端响应包装和 nullable 字段。
|
||||||
|
- Decision: 平台业务入口使用响应中的内部稳定 ID。卡、设备、店铺、企业、订单和退款分别使用对应 `resource_type` 与 `response.data.id`;钱包通过资金时间线的 `wallet_id` 进入。
|
||||||
|
- Decision: 代理与企业入口使用响应中的稳定业务标识。卡使用 `iccid`,设备使用 `virtual_no`;代理的分配、换货、店铺和企业使用接口文档指定的业务编号。缺少稳定标识时隐藏入口。
|
||||||
|
- Decision: 前端只转发后端返回的调查引用。事件的 `event_id`、`actor_ref`、`resource_refs`、`request_id`、`correlation_id`、`integration_refs`,以及 Integration 的 `linkage`/`resource` 是跨视角导航的唯一数据来源。
|
||||||
|
- Decision: `request_id` 可以来自调查引用、Integration、或用户从 Access Log 明确粘贴;`correlation_id` 和 `integration_id` 只能来自接口返回的稳定字段。前端不使用 UUID 或其他方式生成这些 ID。
|
||||||
|
- Decision: 对不存在、为空或 `fidelity=false` 的引用隐藏对应跳转,禁止按名称、时间、摘要或相邻记录猜测缺失关系。
|
||||||
|
- Decision: 资源搜索严格使用 `resource_type + keyword` 精确查询,并把选中项的 `resource_type/resource_id` 原样传给资源时间线。`historical=true` 只作为历史快照命中提示。
|
||||||
|
- Decision: 列表和时间线统一消费 `page`、`page_size`、`total` 并保留 `retention` 语义。时间筛选发送含时区的 RFC3339 值,`created_to` 按接口定义为不包含该时刻;页面不展示全局在线窗口提示,也不提供归档查询假入口。
|
||||||
|
- Decision: 所有枚举筛选提交稳定 code,并优先展示后端 `*_name`。`action`、Integration `operation` 等开放编码必须直接来自响应,不能从中文文案反推。
|
||||||
|
- Decision: 资金金额按分展示转换,权威性只认 `amount_authority.authoritative=true` 指向的业务字段;前端不得合并冲突金额或自行计算余额。
|
||||||
|
- Decision: 代理与企业活动共用展示外壳但使用独立 API。企业页面只展示主体安全投影,不引入平台操作者、风险、内部原因或 before/after 字段。
|
||||||
|
- Decision: 通知目标仅在 `available=true`、`target_type=integration_log` 且 `target_key` 非空时跳转,并将 `target_key` 原样作为 Integration 详情的 `integration_id`。其他情况保留通知正文并提示目标不可用。
|
||||||
|
- Decision: 权限以最终菜单/按钮权限编码和服务端鉴权共同控制。平台、代理、企业不展示不属于其主体的审计入口,`401/403` 继续走共享认证与无权处理。
|
||||||
|
|
||||||
|
## Risks / Trade-offs
|
||||||
|
|
||||||
|
- 最终菜单与按钮权限编码尚未体现在 OpenAPI 中;实施前必须确认,否则只能依赖服务端 `403`,无法做到准确的入口隐藏。
|
||||||
|
- 审计事件和 Integration 模型字段较多;通过共享详情/时间线组件和严格类型避免各业务页重复实现,但不抽象为可以执行任意端点的动态页面。
|
||||||
|
- 在线保留窗口外的数据不可由这些接口查询;空状态使用“当前查询无记录”的中性表达,避免将空数据误报为无历史事件。
|
||||||
|
- 活跃通知中心变更也会修改通知导航;实施时需在其最新状态上追加 `integration_log` 规则,避免覆盖既有白名单映射。
|
||||||
|
- 旧资产操作日志与新审计中心含义相邻但数据源不同;两个入口并存并清晰命名,避免误将旧日志能力删除。
|
||||||
|
|
||||||
|
## Migration Plan
|
||||||
|
|
||||||
|
1. 确认平台、代理、企业的菜单和按钮权限编码,以及审计中心路由归属。
|
||||||
|
2. 建立 OpenAPI 对齐的类型、API 模块和共享只读展示组件。
|
||||||
|
3. 按平台审计、资金、风险、Integration、主体活动顺序接入页面。
|
||||||
|
4. 在业务页面与通知导航中增加稳定引用入口。
|
||||||
|
5. 完成角色、数据隔离、空引用、保留窗口、错误和跨视角跳转验收。
|
||||||
|
6. 若上线异常,隐藏新增路由与入口;现有业务接口和旧操作日志不受影响。
|
||||||
|
|
||||||
|
## Open Questions
|
||||||
|
|
||||||
|
- 平台审计中心、风险中心、Integration、代理资源活动和企业资源活动的最终菜单及按钮权限编码分别是什么?
|
||||||
|
- 审计中心是作为一级菜单,还是归入现有系统管理/运维菜单?
|
||||||
|
- OpenAPI 未包含 `GET /api/admin/notifications/{id}/target` 的完整响应 schema;是否继续以活跃通知中心变更定义的 `available/target_type/target_id/target_key` 为最终契约?
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
# Change: 新增审计链路前端接入能力
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
八月迭代新增了审计事件、请求与业务链路、资金调查、风险调查、外部集成交互以及代理/企业资源活动共 16 个只读接口。当前前端尚无统一的审计调查页面、接口类型和业务入口,无法可靠消费后端返回的稳定调查引用,也容易错误地由名称、时间或页面数据自行拼接链路标识。
|
||||||
|
|
||||||
|
## What Changes
|
||||||
|
|
||||||
|
- 新增平台审计事件列表、详情、操作者时间线、资源精确搜索和资源时间线能力。
|
||||||
|
- 新增请求链路与业务关联链路时间线,并只使用接口返回或用户从 Access Log 粘贴的稳定 `request_id`、`correlation_id`。
|
||||||
|
- 新增资金调查时间线、风险总览与明细、Integration 总览/列表/详情页面。
|
||||||
|
- 新增代理和企业资源活动入口,并按主体支持范围使用稳定业务标识和后端安全投影。
|
||||||
|
- 在卡、设备、店铺、企业、订单、退款和钱包相关列表/详情页增加角色匹配的「审计记录」入口。
|
||||||
|
- 接入通知目标到 Integration 详情的受控跳转:仅接受可用的 `integration_log` 目标。
|
||||||
|
- 统一使用后端返回的名称、状态、保留窗口语义和调查引用;禁止前端猜测或生成 `request_id`、`correlation_id`、`integration_id`。
|
||||||
|
- 所有新增能力均为只读调查能力,不增加恢复、修改、删除、处置、封禁或导出操作。
|
||||||
|
|
||||||
|
## Impact
|
||||||
|
|
||||||
|
- Affected specs: `audit-chain-frontend-integration`
|
||||||
|
- Affected code:
|
||||||
|
- `src/api/modules/` 下新增审计接口模块
|
||||||
|
- `src/types/api/` 下新增审计接口类型
|
||||||
|
- `src/views/` 下审计中心、风险中心、Integration 和时间线页面
|
||||||
|
- 卡、设备、店铺、企业、订单、退款、钱包相关列表/详情页
|
||||||
|
- 路由、菜单、权限控制及通知目标导航
|
||||||
|
- API contracts:
|
||||||
|
- `GET /api/admin/audit/*`
|
||||||
|
- `GET /api/admin/agent/resource-activities/{resource_type}/{identifier}`
|
||||||
|
- `GET /api/admin/enterprise/resource-activities/{resource_type}/{identifier}`
|
||||||
|
- `GET /api/admin/notifications/{id}/target`
|
||||||
|
- Dependencies:
|
||||||
|
- 与活跃变更 `update-admin-notification-center-api` 的受控通知目标协议保持一致
|
||||||
|
- 与活跃变更 `update-admin-asset-device-signal-and-audit-logs` 的旧资产操作日志展示并存;本变更不替换旧日志接口
|
||||||
|
- Source of truth:
|
||||||
|
- `docs/产品迭代8月份/审计链路接口变更整理文档.md`
|
||||||
|
- `docs/产品迭代8月份/默认模块.openapi.json`
|
||||||
|
- Breaking changes: 无;现有业务接口路径保持不变
|
||||||
@@ -0,0 +1,207 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: Platform Audit Event Investigation
|
||||||
|
|
||||||
|
The admin frontend SHALL provide platform audit event list and detail views using `GET /api/admin/audit/events` and `GET /api/admin/audit/events/{event_id}`. It SHALL preserve the documented event, actor, scope, resource, result, risk, request and investigation-reference fields, use stable codes for filters, and prefer backend display names.
|
||||||
|
|
||||||
|
#### Scenario: Filter and inspect audit events
|
||||||
|
|
||||||
|
- **WHEN** an authorized platform user filters audit events by documented time, action, category, actor, source, result, risk, scope, resource or linkage parameters
|
||||||
|
- **THEN** the frontend MUST send the documented parameter names and stable code values
|
||||||
|
- **AND** it MUST render the paginated `items`, `total`, `page`, `page_size` and `retention` response
|
||||||
|
|
||||||
|
#### Scenario: Open an event detail
|
||||||
|
|
||||||
|
- **WHEN** the user opens an event returned by the list or another investigation reference
|
||||||
|
- **THEN** the frontend MUST pass its `event_id` unchanged to the detail endpoint
|
||||||
|
- **AND** it MUST display backend snapshots and names without replacing historical values with current account or resource names
|
||||||
|
|
||||||
|
### Requirement: Stable Investigation Reference Navigation
|
||||||
|
|
||||||
|
The frontend SHALL navigate between audit views only through stable identifiers returned by the APIs. `investigation_refs.actor_ref`, `resource_refs`, `request_id`, `correlation_id`, `integration_refs`, Integration `linkage`, and stable Integration `resource` references SHALL be the authoritative navigation sources.
|
||||||
|
|
||||||
|
#### Scenario: Navigate through a returned reference
|
||||||
|
|
||||||
|
- **WHEN** an audit or Integration response contains a non-empty supported investigation reference
|
||||||
|
- **THEN** the frontend MUST pass the returned identifier and type unchanged to the corresponding actor, resource, request, correlation or Integration view
|
||||||
|
|
||||||
|
#### Scenario: A reference is unavailable or unreliable
|
||||||
|
|
||||||
|
- **WHEN** the required reference is empty, absent, unsupported, or its linkage `fidelity` indicates that a relationship is unavailable
|
||||||
|
- **THEN** the frontend MUST hide or disable the related navigation action
|
||||||
|
- **AND** it MUST NOT infer a relationship from names, timestamps, summaries, adjacent rows or resource text
|
||||||
|
|
||||||
|
#### Scenario: Link identifiers are not generated by the frontend
|
||||||
|
|
||||||
|
- **WHEN** the frontend needs a `correlation_id` or `integration_id`
|
||||||
|
- **THEN** it MUST use a value returned by an API
|
||||||
|
- **AND** it MUST NOT generate, concatenate or guess the identifier
|
||||||
|
|
||||||
|
### Requirement: Actor, Resource, and Link Timelines
|
||||||
|
|
||||||
|
The admin frontend SHALL provide actor-event, resource-event, request-link and correlation-link timelines through the documented endpoints. It SHALL support an explicitly pasted Access Log `request_id`, while all other navigation values SHALL come from returned stable references.
|
||||||
|
|
||||||
|
#### Scenario: Inspect actor behavior
|
||||||
|
|
||||||
|
- **WHEN** a user follows `actor_ref.kind/id` or opens an account by its stable ID
|
||||||
|
- **THEN** the frontend MUST call `/api/admin/audit/actors/{kind}/{id}/events`
|
||||||
|
- **AND** action and resource filters MUST use stable values returned by audit data
|
||||||
|
|
||||||
|
#### Scenario: Select an exact resource result
|
||||||
|
|
||||||
|
- **WHEN** a user searches with a supported `resource_type` and exact `keyword` and selects a result
|
||||||
|
- **THEN** the frontend MUST pass `items[].resource_type/resource_id` unchanged to the resource timeline
|
||||||
|
- **AND** it MUST identify `historical=true` as a historical-snapshot match
|
||||||
|
|
||||||
|
#### Scenario: Query a request copied from Access Log
|
||||||
|
|
||||||
|
- **WHEN** a platform user explicitly pastes a request ID from Access Log
|
||||||
|
- **THEN** the frontend MAY query `/api/admin/audit/requests/{request_id}/timeline` with that exact value
|
||||||
|
- **AND** it MUST NOT claim that the endpoint scans Access Log or archived object storage
|
||||||
|
|
||||||
|
### Requirement: Retention, Pagination, and Time Semantics
|
||||||
|
|
||||||
|
All audit list and timeline views SHALL use the documented pagination and `retention` contract. Time filters SHALL be RFC3339 timestamps with timezone information, and `created_to` SHALL be treated as an exclusive upper bound.
|
||||||
|
|
||||||
|
#### Scenario: Respect the online retention window without a global prompt
|
||||||
|
|
||||||
|
- **WHEN** a response contains `retention.online_from`, `archived_before` and `timezone`
|
||||||
|
- **THEN** the frontend MUST preserve the retention semantics in its data contract without displaying a global online-window banner
|
||||||
|
- **AND** it MUST NOT interpret an empty online result as proof that no historical event exists
|
||||||
|
|
||||||
|
#### Scenario: Page through a timeline
|
||||||
|
|
||||||
|
- **WHEN** the user changes page or page size
|
||||||
|
- **THEN** the frontend MUST use `page` and `page_size`, respect the maximum page size of 100, and preserve the active filters
|
||||||
|
|
||||||
|
### Requirement: Finance Investigation Timeline
|
||||||
|
|
||||||
|
The admin frontend SHALL query `GET /api/admin/audit/finance/timeline` with any documented stable finance condition, including shop, wallet, order, payment, refund, recharge, approval, third-party trade, actor or correlation identifiers. Monetary values SHALL remain integer fen in application data, and authority SHALL follow `amount_authority`.
|
||||||
|
|
||||||
|
#### Scenario: Open finance history from a business record
|
||||||
|
|
||||||
|
- **WHEN** a user opens finance history from an order, refund, recharge, wallet or shop with a stable backend ID
|
||||||
|
- **THEN** the frontend MUST send the matching documented query parameter
|
||||||
|
- **AND** it MUST allow the server to complete related facts instead of assembling a local timeline
|
||||||
|
|
||||||
|
#### Scenario: Display an authoritative amount
|
||||||
|
|
||||||
|
- **WHEN** a finance node returns an amount and `amount_authority.authoritative=true`
|
||||||
|
- **THEN** the frontend MUST treat the referenced table and field as authoritative
|
||||||
|
- **AND** it MUST only convert integer fen for presentation and MUST NOT reconcile conflicting facts locally
|
||||||
|
|
||||||
|
### Requirement: Risk Investigation
|
||||||
|
|
||||||
|
The admin frontend SHALL provide risk overview and event-detail views using `/api/admin/audit/risks/overview` and `/api/admin/audit/risks/events`. Filters SHALL use codes returned in overview collections, and the selected time range SHALL not exceed 31 days.
|
||||||
|
|
||||||
|
#### Scenario: Drill down from a risk summary
|
||||||
|
|
||||||
|
- **WHEN** a user selects a risk, result, action, source or signal represented by the overview
|
||||||
|
- **THEN** the frontend MUST use the returned stable code for the supported event-list filter
|
||||||
|
- **AND** backend `name` values MUST be used only for display
|
||||||
|
|
||||||
|
#### Scenario: Select a range longer than 31 days
|
||||||
|
|
||||||
|
- **WHEN** the user attempts to query more than 31 days
|
||||||
|
- **THEN** the frontend MUST prevent submission and explain the maximum range
|
||||||
|
|
||||||
|
### Requirement: External Integration Investigation
|
||||||
|
|
||||||
|
The admin frontend SHALL provide Integration overview, list and detail views through the documented endpoints. It SHALL preserve provider, direction, operation, raw result, derived result category, duration, state-change, trigger, resource, linkage, attempt, content-summary, fidelity and retention fields.
|
||||||
|
|
||||||
|
#### Scenario: Apply overview filters to the list
|
||||||
|
|
||||||
|
- **WHEN** a user selects an overview provider, direction or result
|
||||||
|
- **THEN** the frontend MUST map `providers[].code` to `provider`, `directions[].code` to `direction`, `results[].code` to `result`, and `results[].category` to `result_category`
|
||||||
|
- **AND** it MUST use `name` only as display text
|
||||||
|
|
||||||
|
#### Scenario: Display Integration trend categories
|
||||||
|
|
||||||
|
- **WHEN** the overview returns trend points
|
||||||
|
- **THEN** the frontend MUST preserve the five categories `processing`, `succeeded`, `indeterminate`, `failed` and `not_sent`
|
||||||
|
- **AND** it MUST use only the documented `hour` or `day` bucket
|
||||||
|
|
||||||
|
#### Scenario: Inspect an Integration detail
|
||||||
|
|
||||||
|
- **WHEN** a user opens an `integration_id` returned by a list, event reference or notification target
|
||||||
|
- **THEN** the frontend MUST query the detail with that value unchanged
|
||||||
|
- **AND** it MUST present the capability as read-only without recovery, modification, deletion or export actions
|
||||||
|
|
||||||
|
### Requirement: Role-Specific Resource Activity
|
||||||
|
|
||||||
|
The frontend SHALL use the agent and enterprise resource-activity endpoints according to the authenticated subject. Agent activity SHALL support `iot_card`, `device`, `asset_allocation_record`, `exchange_order`, `shop` and `enterprise`; enterprise activity SHALL support only authorized `iot_card` and `device` resources.
|
||||||
|
|
||||||
|
#### Scenario: Open an agent resource activity
|
||||||
|
|
||||||
|
- **WHEN** an agent opens activity for a supported resource
|
||||||
|
- **THEN** the frontend MUST use ICCID for a card, VirtualNo for a device, or the documented stable business number for another supported resource
|
||||||
|
- **AND** it MUST NOT send or infer the agent identity or shop scope as query data
|
||||||
|
|
||||||
|
#### Scenario: Open enterprise asset activity
|
||||||
|
|
||||||
|
- **WHEN** an enterprise user opens an authorized card or device activity
|
||||||
|
- **THEN** the frontend MUST use ICCID or VirtualNo with the enterprise endpoint
|
||||||
|
- **AND** it MUST render only the subject-safe projection without platform actor, risk, internal reason or before/after fields
|
||||||
|
|
||||||
|
#### Scenario: A stable subject identifier is missing
|
||||||
|
|
||||||
|
- **WHEN** a business response does not contain the required ICCID, VirtualNo or stable business number
|
||||||
|
- **THEN** the frontend MUST hide the activity entry
|
||||||
|
- **AND** it MUST NOT substitute a display name or internal identifier intended for another subject
|
||||||
|
|
||||||
|
### Requirement: Business Audit Entries
|
||||||
|
|
||||||
|
The frontend SHALL add role-appropriate audit entries to card, device, shop, enterprise, order, refund and wallet list/detail contexts without changing existing business API URLs. Platform entries SHALL use backend internal IDs; agent and enterprise entries SHALL use their documented stable business identifiers.
|
||||||
|
|
||||||
|
#### Scenario: Open platform asset or business history
|
||||||
|
|
||||||
|
- **WHEN** a platform user opens audit history from a card, device, shop, enterprise, order or refund record
|
||||||
|
- **THEN** the frontend MUST use the corresponding `resource_type` and backend `response.data.id` with the resource timeline
|
||||||
|
|
||||||
|
#### Scenario: Open wallet or transaction history
|
||||||
|
|
||||||
|
- **WHEN** a user opens audit history for a wallet, order or refund with a stable ID
|
||||||
|
- **THEN** the frontend MUST offer the applicable finance timeline query
|
||||||
|
- **AND** the resource timeline MAY also be offered only when a stable resource reference is available
|
||||||
|
|
||||||
|
#### Scenario: Preserve existing operation logs
|
||||||
|
|
||||||
|
- **WHEN** new audit entries are introduced on asset pages
|
||||||
|
- **THEN** existing asset operation-log features MUST remain available
|
||||||
|
- **AND** the UI MUST distinguish the existing operation logs from the new cross-system audit investigation
|
||||||
|
|
||||||
|
### Requirement: Controlled Notification Integration Target
|
||||||
|
|
||||||
|
The frontend SHALL resolve a notification through `GET /api/admin/notifications/{id}/target` before opening an Integration detail. It SHALL open the detail only when the target is available, has `target_type=integration_log`, and contains a non-empty `target_key`.
|
||||||
|
|
||||||
|
#### Scenario: Open an Integration notification
|
||||||
|
|
||||||
|
- **WHEN** target resolution returns `available=true`, `target_type=integration_log`, and a non-empty `target_key`
|
||||||
|
- **THEN** the frontend MUST pass `target_key` unchanged as the Integration `integration_id`
|
||||||
|
- **AND** it MUST open the controlled internal Integration detail route
|
||||||
|
|
||||||
|
#### Scenario: Notification target cannot be used
|
||||||
|
|
||||||
|
- **WHEN** the target is unavailable, has another type, lacks `target_key`, or maps to no registered route
|
||||||
|
- **THEN** the frontend MUST not navigate or execute an arbitrary URL
|
||||||
|
- **AND** it MUST preserve the notification content and show a safe unavailable-target message
|
||||||
|
|
||||||
|
### Requirement: Audit Authorization and Read-Only Boundary
|
||||||
|
|
||||||
|
The frontend SHALL enforce the final platform, agent and enterprise route and action permissions, while preserving backend authentication, authorization and data-isolation enforcement. All capabilities in this change SHALL remain read-only.
|
||||||
|
|
||||||
|
#### Scenario: A subject lacks audit permission
|
||||||
|
|
||||||
|
- **WHEN** the current subject lacks the configured permission for an audit page or business entry
|
||||||
|
- **THEN** the frontend MUST hide or disable that page or entry and MUST NOT call the endpoint as a fallback
|
||||||
|
|
||||||
|
#### Scenario: An audit request is rejected
|
||||||
|
|
||||||
|
- **WHEN** an endpoint returns `400`, `401`, `403` or `500`
|
||||||
|
- **THEN** the frontend MUST use shared validation, authentication, authorization and server-error handling
|
||||||
|
- **AND** it MUST preserve the current investigation state when retrying would be unsafe or misleading
|
||||||
|
|
||||||
|
#### Scenario: A user inspects an audit record
|
||||||
|
|
||||||
|
- **WHEN** any audit, risk, finance, Integration or subject-activity view is displayed
|
||||||
|
- **THEN** the UI MUST NOT provide mutation, recovery, deletion, risk-disposition, blocking or export actions
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
## 1. Contract and Shared Infrastructure
|
||||||
|
|
||||||
|
- [x] 1.1 根据 `默认模块.openapi.json` 建立审计事件、调查引用、资源、保留窗口、链路节点、资金节点、风险和 Integration 的 TypeScript 类型。
|
||||||
|
- [x] 1.2 新增平台审计、主体资源活动、资金、风险、Integration 和链路时间线 API 方法,保持文档参数名、枚举和 nullable 语义。
|
||||||
|
- [x] 1.3 建立共享的分页、RFC3339 时间范围、保留窗口、枚举名称和 API 错误展示能力。
|
||||||
|
- [x] 1.4 建立只读事件详情、资源摘要、调查引用和时间线节点组件,不提供写操作或导出能力。
|
||||||
|
|
||||||
|
## 2. Platform Audit Center
|
||||||
|
|
||||||
|
- [x] 2.1 实现审计事件列表及文档定义的时间、动作、类别、操作者、来源、结果、风险、范围、资源和链路筛选。
|
||||||
|
- [x] 2.2 实现事件详情,展示事件、操作者、资源快照、结果、风险和元数据,并按非空 `investigation_refs` 提供跳转。
|
||||||
|
- [x] 2.3 实现操作者行为时间线,使用 `actor_ref.kind/id` 和稳定 code 筛选。
|
||||||
|
- [x] 2.4 实现资源精确搜索及资源时间线,原样使用选中项的 `resource_type/resource_id` 并提示历史快照命中。
|
||||||
|
- [x] 2.5 实现请求和业务关联时间线,支持从返回引用进入,以及明确粘贴 Access Log `request_id` 的查询入口。
|
||||||
|
|
||||||
|
## 3. Specialized Investigations
|
||||||
|
|
||||||
|
- [x] 3.1 实现资金调查时间线和全部文档筛选条件,以分为数据单位并展示金额权威来源。
|
||||||
|
- [x] 3.2 实现风险总览和风险事件明细,按总览返回的稳定 code 回填筛选,并限制最长 31 天时间范围。
|
||||||
|
- [x] 3.3 实现 Integration 总览、列表和详情,覆盖 provider、direction、result、result_category、趋势、尝试、内容摘要、保真度和关联字段。
|
||||||
|
- [x] 3.4 实现各调查视角之间基于 `investigation_refs`、`linkage` 和稳定资源引用的受控跳转。
|
||||||
|
|
||||||
|
## 4. Subject Activity and Business Entries
|
||||||
|
|
||||||
|
- [x] 4.1 实现代理资源活动页面,支持卡、设备、资产分配记录、换货单、店铺和企业的稳定业务标识。
|
||||||
|
- [x] 4.2 实现企业资源活动页面,仅支持当前授权卡和设备并只渲染主体安全投影。
|
||||||
|
- [x] 4.3 在卡、设备、店铺、企业、订单、退款和钱包列表/详情增加角色匹配的「审计记录」入口。
|
||||||
|
- [x] 4.4 缺少内部 ID、ICCID、VirtualNo 或业务编号时隐藏入口,不使用页面文本或其他字段推断。
|
||||||
|
- [x] 4.5 保留现有资产操作日志入口,并通过命名与说明区分旧操作日志和新审计调查能力。
|
||||||
|
|
||||||
|
## 5. Notification, Routes, and Permissions
|
||||||
|
|
||||||
|
- [x] 5.1 增加审计中心、风险中心、Integration 和共享时间线的路由与菜单配置。
|
||||||
|
- [x] 5.2 接入最终确认的平台、代理、企业菜单/按钮权限编码,隐藏越权页面和业务入口。
|
||||||
|
- [x] 5.3 在通知目标导航中仅对可用 `integration_log` 目标开放 Integration 详情,并原样使用 `target_key`。
|
||||||
|
- [x] 5.4 对未知、不可用或缺失目标保留安全提示,不执行任意 URL 或推测跳转。
|
||||||
|
|
||||||
|
## 6. Verification
|
||||||
|
|
||||||
|
- [ ] 6.1 为 API 参数序列化、枚举、nullable 字段、分页和 RFC3339 时间范围增加单元测试。
|
||||||
|
- [ ] 6.2 为稳定引用跳转、空引用隐藏、`fidelity=false`、通知 Integration 目标和禁止生成链路 ID 增加测试。
|
||||||
|
- [ ] 6.3 验证平台、代理、企业角色可见性、服务端数据隔离、企业安全投影以及 `401/403/400/500` 处理。
|
||||||
|
- [ ] 6.4 验证保留窗口、空数据、最长 31 天风险查询、资金金额单位和 Integration 五类趋势状态。
|
||||||
|
- [ ] 6.5 完成 16 个接口的联调回归,并确认现有业务 URL、通知中心和旧资产操作日志未被破坏。
|
||||||
65
openspec/changes/add-bulk-purchase-upload-task/design.md
Normal file
65
openspec/changes/add-bulk-purchase-upload-task/design.md
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
## Context
|
||||||
|
|
||||||
|
批量订购包含文件上传、异步任务处理、任务恢复和逐行失败查看四个阶段。任务创建需要绑定一个代理商和一种支付方式,线下支付还需要上传整批凭证;任务处理过程中可能出现部分成功和钱包余额不足,前端必须展示后端结果而不能把整批操作当成原子事务。
|
||||||
|
|
||||||
|
## Goals / Non-Goals
|
||||||
|
|
||||||
|
- Goals: 提供批量订单 Excel 上传、支付方式选择、任务进度展示、任务恢复和逐行失败明细。
|
||||||
|
- Goals: 使用 `request_id` 防止重复提交,并按任务 ID 查询服务端真实状态。
|
||||||
|
- Goals: 复用公共异步任务的五态语义和终态规则。
|
||||||
|
- Non-Goals: 不在前端解析 Excel 业务行、不执行订单创建、不计算订单金额、不回滚已成功订单。
|
||||||
|
- Non-Goals: 不改造现有单笔订单创建和单笔支付凭证上传流程。
|
||||||
|
- Non-Goals: 不新增后端模板下载接口。
|
||||||
|
|
||||||
|
## Decisions
|
||||||
|
|
||||||
|
- Decision: 批量订购页面使用独立任务视图,订单列表只提供入口,不把逐行结果嵌入订单列表表格。
|
||||||
|
- Rationale: 批量任务有独立生命周期和大量逐行结果,独立页面更适合恢复、轮询和分页查看。
|
||||||
|
|
||||||
|
- Decision: `payment_method` 在创建表单中为单选值,并在请求中对整批固定;线下支付时才允许提交 `voucher_file`。
|
||||||
|
- Rationale: 产品明确一个批次不能混合支付方式,前端应避免生成含混请求。
|
||||||
|
|
||||||
|
- Decision: 使用前端静态 Excel 模板资源。
|
||||||
|
- Rationale: 产品明确模板下载不依赖后端动态生成,减少接口依赖。
|
||||||
|
|
||||||
|
- Decision: 使用 `request_id` 作为客户端幂等键,并在创建前生成一次、提交重试时复用同一值。
|
||||||
|
- Rationale: 防止网络重试或重复点击创建多个相同批次。
|
||||||
|
|
||||||
|
- Decision: 部分成功、钱包余额不足和逐行业务失败均由后端任务结果表达;前端只展示计数和失败明细,不自行推断或回滚。
|
||||||
|
- Rationale: 钱包扣款和订单事务边界属于后端职责,前端不能可靠重建。
|
||||||
|
|
||||||
|
## Data Model
|
||||||
|
|
||||||
|
- Create request: `shop_id`、`payment_method`、`file`、可选 `voucher_file`、`request_id`。
|
||||||
|
- Task identity: `task_id`、`task_no`。
|
||||||
|
- Task status: `1=待处理`、`2=处理中`、`3=已完成`、`4=已失败`、`5=已取消`;部分成功仍属于已完成终态。
|
||||||
|
- Task summary: status, total count, success count, failed count, amount summary, timestamps and safe error summary when returned.
|
||||||
|
- Item result: row number, asset identifier, package code, row status and safe error reason.
|
||||||
|
- Item query: task ID, page, size and optional row status filter.
|
||||||
|
|
||||||
|
## Risks / Trade-offs
|
||||||
|
|
||||||
|
- Risk: 后端金额字段名称或单位未在产品文档中明确。
|
||||||
|
- Mitigation: API 类型和页面以接口实际返回字段为准,统一标注金额单位;实施前补齐字段契约,前端不自行计算汇总。
|
||||||
|
|
||||||
|
- Risk: 文件或凭证上传成功但任务创建请求失败,可能留下孤立对象。
|
||||||
|
- Mitigation: 创建失败时保留用户选择和错误提示;对象清理策略由后端存储生命周期或接口约定处理。
|
||||||
|
|
||||||
|
- Risk: 任务详情恢复时任务已过期、删除或用户失去权限。
|
||||||
|
- Mitigation: 按页面权限和接口错误处理展示对应状态,不重复创建原任务。
|
||||||
|
|
||||||
|
## Migration Plan
|
||||||
|
|
||||||
|
1. 确认批量订购任务摘要、金额和逐行结果字段契约。
|
||||||
|
2. 新增 API、类型、权限和静态模板资源。
|
||||||
|
3. 实现批量订购入口、文件上传、线下凭证上传和幂等提交。
|
||||||
|
4. 实现任务详情、公共状态展示、轮询和 `task_id` 恢复。
|
||||||
|
5. 实现逐行结果分页、状态筛选和失败明细展示。
|
||||||
|
6. 验证钱包余额不足、部分成功、重复提交、刷新恢复和权限组合。
|
||||||
|
|
||||||
|
## Open Questions
|
||||||
|
|
||||||
|
- 批量订购任务摘要中的金额字段名称、金额单位和金额分类需要以后端接口文档确认。
|
||||||
|
- 失败明细中的资产字段是统一 `asset_identifier`,还是按资产类型返回 `iccid` / `virtual_no`,需要以后端确认。
|
||||||
|
- `voucher_file` 是单文件、文件数组还是已上传对象存储 key,需要与 multipart 接口契约确认。
|
||||||
|
- 批量订购入口的最终路由、菜单名称和权限编码需要产品/后端确认。
|
||||||
38
openspec/changes/add-bulk-purchase-upload-task/proposal.md
Normal file
38
openspec/changes/add-bulk-purchase-upload-task/proposal.md
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# Change: 新增批量订购任务与逐行结果
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
运营需要为同一个代理商批量导入套餐订单,并统一指定整批支付方式。当前订单页面只支持单笔创建,无法上传批量订单文件、跟踪处理进度或定位逐行失败原因,批量操作也无法安全处理线下支付凭证和钱包余额不足场景。
|
||||||
|
|
||||||
|
## What Changes
|
||||||
|
|
||||||
|
- 新增批量订购套餐入口,支持选择代理商、整批支付方式和上传 Excel 文件。
|
||||||
|
- 支持线下支付时上传整批支付凭证;一个批次禁止混合支付方式。
|
||||||
|
- 模板下载使用前端静态文件,不依赖后端模板接口。
|
||||||
|
- 新增批量订购任务 API,提交 multipart 字段 `shop_id`、`payment_method`、`file`、`voucher_file` 和 `request_id`。
|
||||||
|
- 创建成功后展示任务号、任务状态、总数、成功数、失败数和金额汇总。
|
||||||
|
- 支持按 `task_id` 恢复任务详情,并轮询进行中的任务。
|
||||||
|
- 新增逐行结果查询,支持分页和状态筛选。
|
||||||
|
- 失败明细展示行号、资产、套餐编码和错误原因。
|
||||||
|
- 部分成功作为任务终态;钱包余额不足只影响对应行或后续行,不回滚已经成功的订单。
|
||||||
|
- 接入现有 RBAC 权限体系,批量订购创建、任务详情、逐行结果和模板下载权限独立控制。
|
||||||
|
|
||||||
|
## Impact
|
||||||
|
|
||||||
|
- Affected specs:
|
||||||
|
- `bulk-purchase-task`
|
||||||
|
- `order-management`
|
||||||
|
- `async-task-interaction`(复用现有公共异步任务状态与恢复规则)
|
||||||
|
- Affected code:
|
||||||
|
- `src/api/modules/bulkPurchase.ts`
|
||||||
|
- `src/types/api/bulkPurchase.ts`
|
||||||
|
- `src/views/order-management/bulk-purchase/index.vue`
|
||||||
|
- `src/components/business/BulkPurchaseCreateDialog.vue`(如采用独立弹窗)
|
||||||
|
- `src/views/order-management/order-list/index.vue`(批量入口)
|
||||||
|
- 静态 Excel 模板资源、路由、菜单、权限和国际化配置
|
||||||
|
- Dependencies:
|
||||||
|
- 后端提供三个批量订购接口及 multipart 鉴权契约。
|
||||||
|
- 对象存储上传能力支持批量订单文件和线下支付凭证上传。
|
||||||
|
- 需要确认批量订购任务的完整响应字段和并发轮询策略与公共异步任务规范一致。
|
||||||
|
- Breaking changes:
|
||||||
|
- 无。新增 API、页面、权限和任务能力,不修改单笔订单创建接口。
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: Bulk Purchase Creation Form
|
||||||
|
|
||||||
|
The admin frontend SHALL provide a bulk purchase form that binds one uploaded batch to one shop and one payment method.
|
||||||
|
|
||||||
|
#### Scenario: Select batch purchase inputs
|
||||||
|
|
||||||
|
- **GIVEN** 用户打开批量订购入口
|
||||||
|
- **WHEN** 用户填写批量订购表单
|
||||||
|
- **THEN** 页面 MUST require a target shop, one payment method, and an Excel file
|
||||||
|
- **AND** 页面 MUST NOT provide a way to mix payment methods within the same batch
|
||||||
|
|
||||||
|
#### Scenario: Show voucher upload for offline payment
|
||||||
|
|
||||||
|
- **GIVEN** 用户选择线下支付
|
||||||
|
- **WHEN** 页面渲染批量订购表单
|
||||||
|
- **THEN** 页面 MUST show the batch voucher upload control
|
||||||
|
- **AND** 页面 MUST require a completed voucher upload before task creation
|
||||||
|
|
||||||
|
#### Scenario: Hide voucher upload for wallet payment
|
||||||
|
|
||||||
|
- **GIVEN** 用户选择代理预存款支付
|
||||||
|
- **WHEN** 页面渲染或提交批量订购表单
|
||||||
|
- **THEN** 页面 MUST NOT submit a voucher file
|
||||||
|
- **AND** 页面 MUST clear or ignore a voucher selected before switching to wallet payment
|
||||||
|
|
||||||
|
### Requirement: Bulk Purchase File Upload And Creation
|
||||||
|
|
||||||
|
The admin frontend SHALL create a bulk purchase task through `POST /api/admin/bulk-purchases` using multipart form data.
|
||||||
|
|
||||||
|
#### Scenario: Create bulk purchase task
|
||||||
|
|
||||||
|
- **GIVEN** 用户已选择代理商、支付方式并完成文件上传
|
||||||
|
- **WHEN** 用户确认创建批量订购任务
|
||||||
|
- **THEN** 系统 MUST submit multipart fields `shop_id`, `payment_method`, `file`, and `request_id`
|
||||||
|
- **AND** 系统 MUST submit `voucher_file` when the payment method is offline
|
||||||
|
- **AND** 系统 MUST save the returned `task_id` and `task_no`
|
||||||
|
|
||||||
|
#### Scenario: Prevent creation during upload
|
||||||
|
|
||||||
|
- **GIVEN** Excel 文件或线下支付凭证仍在上传
|
||||||
|
- **WHEN** 用户点击创建任务
|
||||||
|
- **THEN** 页面 MUST prevent task creation
|
||||||
|
- **AND** 页面 MUST show the upload-in-progress state until all required uploads finish
|
||||||
|
|
||||||
|
#### Scenario: Download static template
|
||||||
|
|
||||||
|
- **GIVEN** 用户打开批量订购表单
|
||||||
|
- **WHEN** 用户点击模板下载
|
||||||
|
- **THEN** 页面 MUST download the packaged frontend static Excel template
|
||||||
|
- **AND** 页面 MUST NOT require a template-generation API request
|
||||||
|
|
||||||
|
### Requirement: Bulk Purchase Task Summary And Status
|
||||||
|
|
||||||
|
The admin frontend SHALL display the server-provided bulk purchase task summary and use the shared five-state async task semantics.
|
||||||
|
|
||||||
|
#### Scenario: Display task summary
|
||||||
|
|
||||||
|
- **GIVEN** 批量订购任务创建成功或详情接口返回任务
|
||||||
|
- **WHEN** 页面展示任务详情
|
||||||
|
- **THEN** 页面 MUST display task ID or task number, status, total count, success count, failed count, and returned amount summaries
|
||||||
|
- **AND** 页面 MUST use server-provided values without recalculating amounts or counts from the uploaded file
|
||||||
|
|
||||||
|
#### Scenario: Treat partial success as terminal completion
|
||||||
|
|
||||||
|
- **GIVEN** 任务已处理完成且同时存在成功行和失败行
|
||||||
|
- **WHEN** 页面展示任务状态
|
||||||
|
- **THEN** 页面 MUST display the task as a completed terminal task
|
||||||
|
- **AND** 页面 MUST display success and failed counts separately
|
||||||
|
- **AND** 页面 MUST NOT introduce a separate partial-success status
|
||||||
|
|
||||||
|
#### Scenario: Handle wallet insufficiency without rollback
|
||||||
|
|
||||||
|
- **GIVEN** 代理钱包余额不足导致部分或后续行无法创建订单
|
||||||
|
- **WHEN** 页面展示任务结果
|
||||||
|
- **THEN** 页面 MUST show the affected rows as failed with their returned reasons
|
||||||
|
- **AND** 页面 MUST preserve and display rows that were already successful
|
||||||
|
- **AND** 页面 MUST NOT attempt a frontend rollback
|
||||||
|
|
||||||
|
### Requirement: Bulk Purchase Task Recovery And Polling
|
||||||
|
|
||||||
|
The admin frontend SHALL recover a bulk purchase task by `task_id` and poll its summary while it is active.
|
||||||
|
|
||||||
|
#### Scenario: Query task summary
|
||||||
|
|
||||||
|
- **GIVEN** 用户需要加载批量订购任务
|
||||||
|
- **WHEN** 页面查询任务摘要
|
||||||
|
- **THEN** 系统 MUST call `GET /api/admin/bulk-purchases/{task_id}`
|
||||||
|
- **AND** 页面 MUST update the task summary from the response
|
||||||
|
|
||||||
|
#### Scenario: Recover task after refresh
|
||||||
|
|
||||||
|
- **GIVEN** 页面存在已保存的 active `task_id`
|
||||||
|
- **WHEN** 用户刷新页面或重新进入批量订购任务页
|
||||||
|
- **THEN** 页面 MUST query the existing task by `task_id`
|
||||||
|
- **AND** 页面 MUST NOT create another bulk purchase task
|
||||||
|
|
||||||
|
#### Scenario: Stop polling at terminal state
|
||||||
|
|
||||||
|
- **GIVEN** 批量订购任务状态为已完成、已失败或已取消
|
||||||
|
- **WHEN** 页面收到任务摘要
|
||||||
|
- **THEN** 页面 MUST stop automatic polling
|
||||||
|
- **AND** 页面 MUST retain the terminal summary and failure counts for viewing
|
||||||
|
|
||||||
|
### Requirement: Bulk Purchase Item Results
|
||||||
|
|
||||||
|
The admin frontend SHALL provide paginated and status-filterable row results for a bulk purchase task.
|
||||||
|
|
||||||
|
#### Scenario: Query item results
|
||||||
|
|
||||||
|
- **GIVEN** 用户打开批量订购任务结果
|
||||||
|
- **WHEN** 页面加载逐行结果
|
||||||
|
- **THEN** 系统 MUST call `GET /api/admin/bulk-purchases/{task_id}/items`
|
||||||
|
- **AND** 系统 MUST support `page`, `size`, and optional `status` query parameters
|
||||||
|
|
||||||
|
#### Scenario: Display failed item details
|
||||||
|
|
||||||
|
- **GIVEN** 逐行结果接口返回失败行
|
||||||
|
- **WHEN** 页面渲染结果表格
|
||||||
|
- **THEN** 页面 MUST display row number, asset identifier, package code, and safe error reason
|
||||||
|
- **AND** 页面 MUST NOT expose raw backend stack traces or technical error details
|
||||||
|
|
||||||
|
### Requirement: Bulk Purchase Permissions
|
||||||
|
|
||||||
|
The admin frontend SHALL gate bulk purchase creation, task viewing, item-result viewing, and template download with explicit permissions.
|
||||||
|
|
||||||
|
#### Scenario: Hide unauthorized bulk purchase operations
|
||||||
|
|
||||||
|
- **GIVEN** 当前用户缺少某项批量订购权限
|
||||||
|
- **WHEN** 页面渲染对应入口或操作
|
||||||
|
- **THEN** 页面 MUST NOT display or enable that operation
|
||||||
|
- **AND** direct API failure MUST NOT be treated as permission to continue
|
||||||
46
openspec/changes/add-bulk-purchase-upload-task/tasks.md
Normal file
46
openspec/changes/add-bulk-purchase-upload-task/tasks.md
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
## 1. Contract And Types
|
||||||
|
|
||||||
|
- [ ] 1.1 确认 `POST /api/admin/bulk-purchases` 的 multipart 字段类型、文件字段格式和响应结构。
|
||||||
|
- [ ] 1.2 确认 `GET /api/admin/bulk-purchases/{task_id}` 的任务摘要字段、状态值、金额字段和错误字段。
|
||||||
|
- [ ] 1.3 确认 `GET /api/admin/bulk-purchases/{task_id}/items` 的逐行字段、分页结构和状态筛选参数。
|
||||||
|
- [x] 1.4 新增批量订购 API service、请求类型、任务摘要类型和逐行结果类型。
|
||||||
|
- [x] 1.5 明确 `request_id` 的生成、保存和重复提交响应处理规则。
|
||||||
|
|
||||||
|
## 2. Upload And Create
|
||||||
|
|
||||||
|
- [x] 2.1 新增批量订购入口和表单,支持选择代理商、支付方式和 Excel 文件。
|
||||||
|
- [x] 2.2 提供前端静态 Excel 模板下载,并限制上传文件类型和必要的文件状态。
|
||||||
|
- [x] 2.3 线下支付时显示整批支付凭证上传,预存款支付时隐藏或清理凭证字段。
|
||||||
|
- [x] 2.4 复用订单列表已有 `VoucherUpload` 组件展示凭证上传进度,上传未完成时禁止创建任务。
|
||||||
|
- [x] 2.5 创建请求携带 `shop_id`、`payment_method`、`file`、必要的 `voucher_file` 和 `request_id`。
|
||||||
|
- [x] 2.6 防止重复点击和重复提交,创建成功后保存 `task_id` 并进入任务详情。
|
||||||
|
|
||||||
|
## 3. Task Progress And Recovery
|
||||||
|
|
||||||
|
- [x] 3.1 展示任务号、状态、总数、成功数、失败数、金额汇总和安全错误摘要。
|
||||||
|
- [x] 3.2 按公共异步任务规则轮询待处理和处理中的任务,并在终态停止。
|
||||||
|
- [x] 3.3 页面刷新或通过任务 ID 重新进入时恢复任务详情,不重复创建批次。
|
||||||
|
- [x] 3.4 将部分成功展示为已完成终态,并同时展示成功数和失败数。
|
||||||
|
- [x] 3.5 展示钱包余额不足导致的逐行或后续行失败,不回滚已成功订单。
|
||||||
|
|
||||||
|
## 4. Item Results
|
||||||
|
|
||||||
|
- [x] 4.1 新增逐行结果表格,展示行号、资产、套餐编码、状态和错误原因。
|
||||||
|
- [x] 4.2 支持按逐行状态筛选和分页查询。
|
||||||
|
- [x] 4.3 失败原因优先展示后端安全错误文案,不直接展示底层技术错误。
|
||||||
|
- [x] 4.4 任务详情和逐行结果保持当前任务 ID、筛选条件和分页状态。
|
||||||
|
|
||||||
|
## 5. Permissions And Verification
|
||||||
|
|
||||||
|
- [x] 5.1 为批量订购创建、任务详情、逐行结果和模板下载配置独立权限。
|
||||||
|
- [ ] 5.2 验证一个批次只能提交一种支付方式,线下支付缺少凭证时不能提交。
|
||||||
|
- [ ] 5.3 验证重复提交复用 `request_id`,不会创建重复任务。
|
||||||
|
- [ ] 5.4 验证空文件、上传失败、任务失败、部分成功和钱包余额不足场景。
|
||||||
|
- [ ] 5.5 验证页面刷新恢复、任务终态停止轮询和逐行失败筛选。
|
||||||
|
- [x] 5.6 运行 `openspec validate add-bulk-purchase-upload-task --strict`、类型检查、lint 和构建。
|
||||||
|
|
||||||
|
## Implementation Notes
|
||||||
|
|
||||||
|
- 后端接口文档未随仓库提供,1.1、1.2、1.3 仍需联调确认精确金额字段、逐行字段和 multipart 文件格式;当前类型使用可选兼容字段。
|
||||||
|
- 5.2 至 5.5 需要接入真实后端后进行手工回归,当前已完成前端校验、权限、幂等键、恢复、轮询和筛选逻辑。
|
||||||
|
- 支付凭证复用 `src/components/business/VoucherUpload.vue`,提交 `voucher_file` 时使用该组件上传后返回的文件 key。
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
## Context
|
||||||
|
|
||||||
|
三个后台业务列表都需要展示相同的审批摘要,但各自保留既有退款、充值或换货操作。审批来源和业务处理状态均由后端列表接口返回,前端不请求单条审批详情来填充表格。
|
||||||
|
|
||||||
|
## Goals / Non-Goals
|
||||||
|
|
||||||
|
- Goals:
|
||||||
|
- 统一展示提交人、审批状态、当前审批人摘要和业务处理状态。
|
||||||
|
- 正确区分无审批、历史本地审批和企微审批。
|
||||||
|
- 在不增加逐行请求的前提下支持长摘要完整查看。
|
||||||
|
- Non-Goals:
|
||||||
|
- 不创建、修改或撤回审批流程。
|
||||||
|
- 不增加历史本地审批操作按钮。
|
||||||
|
- 不以 `approval_status` 推断 `processing_status`,或反向推断。
|
||||||
|
|
||||||
|
## Decisions
|
||||||
|
|
||||||
|
- Decision: 三个列表项模型复用相同名称和语义的审批摘要字段,字段由各自的列表接口直接返回。
|
||||||
|
- Decision: `approval_source=none` 时审批状态与当前审批人摘要均显示 `-`;`legacy` 时审批状态固定显示“历史审批”,当前审批人摘要显示 `-`;`wecom` 时直接展示 `approval_status_name` 和 `current_approver_summary`。
|
||||||
|
- Decision: 审批人摘要仅负责展示,使用表格溢出省略与 tooltip 呈现完整文本。
|
||||||
|
- Decision: 业务处理状态单独读取 `processing_status_name`,不与审批状态混合或映射。
|
||||||
|
- Decision: 列表分页和刷新仅调用现有列表 API,禁止为每条记录请求审批详情。
|
||||||
|
- Alternatives considered: 从单条详情或企微审批 API 批量补齐摘要。未采用,因为会引入 N+1 请求并与列表响应已提供的摘要字段重复。
|
||||||
|
|
||||||
|
## Risks / Trade-offs
|
||||||
|
|
||||||
|
- 后端遗漏摘要字段时信息不可用 -> 统一显示稳定占位,不影响原有列表和业务操作。
|
||||||
|
- 审批状态名称可能为空 -> 企微来源显示稳定占位,不自行翻译状态码。
|
||||||
|
- 审批人摘要长度不受控 -> 表格列使用溢出省略和 hover 完整文本。
|
||||||
|
|
||||||
|
## Migration Plan
|
||||||
|
|
||||||
|
1. 扩展三个列表项类型以保留审批摘要字段。
|
||||||
|
2. 在三个列表中添加四个展示列并遵循审批来源规则。
|
||||||
|
3. 验证 `none`、`legacy`、`wecom` 和处理状态为空的响应。
|
||||||
|
4. 验证刷新、分页未出现逐行审批详情请求。
|
||||||
|
5. 如需回滚,移除列表列与附加类型字段;不涉及数据迁移。
|
||||||
|
|
||||||
|
## Open Questions
|
||||||
|
|
||||||
|
- 无。
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
# Change: 新增业务列表提交人与审批摘要
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
退款、代理充值和换货列表当前无法直接显示提交人、企微审批进度及业务处理进度。运营人员需要进入详情或依赖额外沟通才能判断记录由谁发起、审批进行到哪一步以及后续业务是否完成。
|
||||||
|
|
||||||
|
## What Changes
|
||||||
|
|
||||||
|
- 在退款列表、代理充值列表和换货列表增加“提交人”“审批状态”“当前审批人摘要”“业务处理状态”四列。
|
||||||
|
- 三个列表接口项统一支持 `submitter_name`、`approval_source`、`approval_status`、`approval_status_name`、`current_approver_summary`、`processing_status`、`processing_status_name`。
|
||||||
|
- `approval_source=none` 时审批状态和当前审批人摘要显示 `-`。
|
||||||
|
- `approval_source=legacy` 时审批状态显示“历史审批”,作为只读历史信息,不新增审批操作按钮。
|
||||||
|
- `approval_source=wecom` 时显示后端返回的企微审批状态及当前审批人摘要;超长审批人摘要使用省略显示并在悬浮时展示完整文本。
|
||||||
|
- 业务处理状态直接展示后端 `processing_status_name`,与审批状态分列展示。
|
||||||
|
- 列表仅使用列表响应中的审批摘要字段,翻页和刷新时不得为每行额外请求审批详情。
|
||||||
|
|
||||||
|
## Impact
|
||||||
|
|
||||||
|
- Affected specs:
|
||||||
|
- `order-management`
|
||||||
|
- `agent-recharge`
|
||||||
|
- `exchange-management`
|
||||||
|
- Affected code:
|
||||||
|
- `src/types/api/refund.ts`
|
||||||
|
- `src/types/api/agentRecharge.ts`
|
||||||
|
- `src/api/modules/exchange.ts`
|
||||||
|
- `src/views/finance/refund/index.vue`
|
||||||
|
- `src/views/finance/agent-recharge/index.vue`
|
||||||
|
- `src/views/asset-management/exchange-management/index.vue`
|
||||||
|
- API contracts:
|
||||||
|
- `GET /api/admin/refunds`
|
||||||
|
- `GET /api/admin/agent-recharges`
|
||||||
|
- `GET /api/admin/exchanges`
|
||||||
|
- Out of scope:
|
||||||
|
- 审批发起、撤回、审批操作或企微审批详情页。
|
||||||
|
- 前端根据业务状态或审批步骤推导审批结果和业务处理状态。
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: Agent Recharge List Approval Summary Contract
|
||||||
|
|
||||||
|
The `GET /api/admin/agent-recharges` list-item contract SHALL support `submitter_name`, `approval_source`, `approval_status`, `approval_status_name`, `current_approver_summary`, `processing_status`, and `processing_status_name`.
|
||||||
|
|
||||||
|
#### Scenario: Receive agent recharge approval summary fields
|
||||||
|
|
||||||
|
- **GIVEN** 后台代理充值列表接口返回充值记录
|
||||||
|
- **WHEN** 前端解析列表响应
|
||||||
|
- **THEN** 代理充值列表项类型 MUST preserve all approval and processing summary fields
|
||||||
|
- **AND** 页面 MUST NOT request an individual approval-detail API to populate the row
|
||||||
|
|
||||||
|
### Requirement: Agent Recharge List Approval And Processing Display
|
||||||
|
|
||||||
|
The agent recharge list SHALL display `提交人`, `审批状态`, `当前审批人摘要`, and `业务处理状态` as distinct columns based on backend summary fields.
|
||||||
|
|
||||||
|
#### Scenario: Display recharge with no approval source
|
||||||
|
|
||||||
|
- **GIVEN** 代理充值记录的 `approval_source=none`
|
||||||
|
- **WHEN** 页面渲染代理充值列表行
|
||||||
|
- **THEN** `审批状态` MUST display `-`
|
||||||
|
- **AND** `当前审批人摘要` MUST display `-`
|
||||||
|
|
||||||
|
#### Scenario: Display legacy recharge approval read-only
|
||||||
|
|
||||||
|
- **GIVEN** 代理充值记录的 `approval_source=legacy`
|
||||||
|
- **WHEN** 页面渲染代理充值列表行
|
||||||
|
- **THEN** `审批状态` MUST display `历史审批`
|
||||||
|
- **AND** 页面 MUST NOT add an approval operation button for that historical approval
|
||||||
|
|
||||||
|
#### Scenario: Display WeCom recharge approval summary
|
||||||
|
|
||||||
|
- **GIVEN** 代理充值记录的 `approval_source=wecom`
|
||||||
|
- **WHEN** 页面渲染代理充值列表行
|
||||||
|
- **THEN** `审批状态` MUST display backend `approval_status_name`
|
||||||
|
- **AND** `当前审批人摘要` MUST display backend `current_approver_summary`
|
||||||
|
- **AND** `业务处理状态` MUST independently display backend `processing_status_name`
|
||||||
|
|
||||||
|
#### Scenario: View long recharge approver summary
|
||||||
|
|
||||||
|
- **GIVEN** 代理充值记录的 `current_approver_summary` exceeds its table cell width
|
||||||
|
- **WHEN** 页面渲染当前审批人摘要列
|
||||||
|
- **THEN** 摘要 MUST be visually truncated in the cell
|
||||||
|
- **AND** 用户 MUST be able to view the complete backend text on hover
|
||||||
|
|
||||||
|
#### Scenario: Paginate recharges without per-row approval requests
|
||||||
|
|
||||||
|
- **WHEN** 用户切换代理充值列表页码或刷新列表
|
||||||
|
- **THEN** 页面 MUST use the agent recharge list API response for approval summaries
|
||||||
|
- **AND** 页面 MUST NOT issue approval-detail requests per recharge row
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: Exchange List Approval Summary Contract
|
||||||
|
|
||||||
|
The `GET /api/admin/exchanges` list-item contract SHALL support `submitter_name`, `approval_source`, `approval_status`, `approval_status_name`, `current_approver_summary`, `processing_status`, and `processing_status_name`.
|
||||||
|
|
||||||
|
#### Scenario: Receive exchange approval summary fields
|
||||||
|
|
||||||
|
- **GIVEN** 后台换货列表接口返回换货记录
|
||||||
|
- **WHEN** 前端解析列表响应
|
||||||
|
- **THEN** 换货列表项类型 MUST preserve all approval and processing summary fields
|
||||||
|
- **AND** 页面 MUST NOT request an individual approval-detail API to populate the row
|
||||||
|
|
||||||
|
### Requirement: Exchange List Approval And Processing Display
|
||||||
|
|
||||||
|
The exchange management list SHALL display `提交人`, `审批状态`, `当前审批人摘要`, and `业务处理状态` as distinct columns based on backend summary fields.
|
||||||
|
|
||||||
|
#### Scenario: Display exchange with no approval source
|
||||||
|
|
||||||
|
- **GIVEN** 换货记录的 `approval_source=none`
|
||||||
|
- **WHEN** 页面渲染换货列表行
|
||||||
|
- **THEN** `审批状态` MUST display `-`
|
||||||
|
- **AND** `当前审批人摘要` MUST display `-`
|
||||||
|
|
||||||
|
#### Scenario: Display legacy exchange approval read-only
|
||||||
|
|
||||||
|
- **GIVEN** 换货记录的 `approval_source=legacy`
|
||||||
|
- **WHEN** 页面渲染换货列表行
|
||||||
|
- **THEN** `审批状态` MUST display `历史审批`
|
||||||
|
- **AND** 页面 MUST NOT add an approval operation button for that historical approval
|
||||||
|
|
||||||
|
#### Scenario: Display WeCom exchange approval summary
|
||||||
|
|
||||||
|
- **GIVEN** 换货记录的 `approval_source=wecom`
|
||||||
|
- **WHEN** 页面渲染换货列表行
|
||||||
|
- **THEN** `审批状态` MUST display backend `approval_status_name`
|
||||||
|
- **AND** `当前审批人摘要` MUST display backend `current_approver_summary`
|
||||||
|
- **AND** `业务处理状态` MUST independently display backend `processing_status_name`
|
||||||
|
|
||||||
|
#### Scenario: View long exchange approver summary
|
||||||
|
|
||||||
|
- **GIVEN** 换货记录的 `current_approver_summary` exceeds its table cell width
|
||||||
|
- **WHEN** 页面渲染当前审批人摘要列
|
||||||
|
- **THEN** 摘要 MUST be visually truncated in the cell
|
||||||
|
- **AND** 用户 MUST be able to view the complete backend text on hover
|
||||||
|
|
||||||
|
#### Scenario: Paginate exchanges without per-row approval requests
|
||||||
|
|
||||||
|
- **WHEN** 用户切换换货列表页码或刷新列表
|
||||||
|
- **THEN** 页面 MUST use the exchange list API response for approval summaries
|
||||||
|
- **AND** 页面 MUST NOT issue approval-detail requests per exchange row
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: Refund List Approval Summary Contract
|
||||||
|
|
||||||
|
The `GET /api/admin/refunds` list-item contract SHALL support `submitter_name`, `approval_source`, `approval_status`, `approval_status_name`, `current_approver_summary`, `processing_status`, and `processing_status_name`.
|
||||||
|
|
||||||
|
#### Scenario: Receive refund approval summary fields
|
||||||
|
|
||||||
|
- **GIVEN** 后台退款列表接口返回退款记录
|
||||||
|
- **WHEN** 前端解析列表响应
|
||||||
|
- **THEN** 退款列表项类型 MUST preserve all approval and processing summary fields
|
||||||
|
- **AND** 页面 MUST NOT request an individual approval-detail API to populate the row
|
||||||
|
|
||||||
|
### Requirement: Refund List Approval And Processing Display
|
||||||
|
|
||||||
|
The refund management list SHALL display `提交人`, `审批状态`, `当前审批人摘要`, and `业务处理状态` as distinct columns based on backend summary fields.
|
||||||
|
|
||||||
|
#### Scenario: Display refund with no approval source
|
||||||
|
|
||||||
|
- **GIVEN** 退款记录的 `approval_source=none`
|
||||||
|
- **WHEN** 页面渲染退款列表行
|
||||||
|
- **THEN** `审批状态` MUST display `-`
|
||||||
|
- **AND** `当前审批人摘要` MUST display `-`
|
||||||
|
|
||||||
|
#### Scenario: Display legacy refund approval read-only
|
||||||
|
|
||||||
|
- **GIVEN** 退款记录的 `approval_source=legacy`
|
||||||
|
- **WHEN** 页面渲染退款列表行
|
||||||
|
- **THEN** `审批状态` MUST display `历史审批`
|
||||||
|
- **AND** 页面 MUST NOT add an approval operation button for that historical approval
|
||||||
|
|
||||||
|
#### Scenario: Display WeCom refund approval summary
|
||||||
|
|
||||||
|
- **GIVEN** 退款记录的 `approval_source=wecom`
|
||||||
|
- **WHEN** 页面渲染退款列表行
|
||||||
|
- **THEN** `审批状态` MUST display backend `approval_status_name`
|
||||||
|
- **AND** `当前审批人摘要` MUST display backend `current_approver_summary`
|
||||||
|
- **AND** `业务处理状态` MUST independently display backend `processing_status_name`
|
||||||
|
|
||||||
|
#### Scenario: View long refund approver summary
|
||||||
|
|
||||||
|
- **GIVEN** 退款记录的 `current_approver_summary` exceeds its table cell width
|
||||||
|
- **WHEN** 页面渲染当前审批人摘要列
|
||||||
|
- **THEN** 摘要 MUST be visually truncated in the cell
|
||||||
|
- **AND** 用户 MUST be able to view the complete backend text on hover
|
||||||
|
|
||||||
|
#### Scenario: Paginate refunds without per-row approval requests
|
||||||
|
|
||||||
|
- **WHEN** 用户切换退款列表页码或刷新列表
|
||||||
|
- **THEN** 页面 MUST use the refund list API response for approval summaries
|
||||||
|
- **AND** 页面 MUST NOT issue approval-detail requests per refund row
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
## 1. List Contracts
|
||||||
|
|
||||||
|
- [x] 1.1 扩展退款、代理充值和换货列表项类型,支持 `submitter_name`、`approval_source`、`approval_status`、`approval_status_name`、`current_approver_summary`、`processing_status`、`processing_status_name`。
|
||||||
|
- [x] 1.2 确认三个列表 API 使用列表响应直接提供上述字段,不新增逐条审批详情查询。
|
||||||
|
|
||||||
|
## 2. Shared Summary Behavior
|
||||||
|
|
||||||
|
- [x] 2.1 实现审批来源展示规则:`none` 显示 `-`,`legacy` 显示“历史审批”且只读,`wecom` 显示后端审批状态名称。
|
||||||
|
- [x] 2.2 将当前审批人摘要限制为单行省略,并提供完整文本悬浮提示。
|
||||||
|
- [x] 2.3 将业务处理状态独立显示为后端 `processing_status_name`,缺失时显示稳定占位内容。
|
||||||
|
|
||||||
|
## 3. Refund List
|
||||||
|
|
||||||
|
- [x] 3.1 在退款列表增加提交人、审批状态、当前审批人摘要、业务处理状态列。
|
||||||
|
- [x] 3.2 保留退款既有审批与业务操作,不为历史审批记录增加新操作按钮。
|
||||||
|
|
||||||
|
## 4. Agent Recharge List
|
||||||
|
|
||||||
|
- [x] 4.1 在代理充值列表增加提交人、审批状态、当前审批人摘要、业务处理状态列。
|
||||||
|
- [x] 4.2 保留代理充值既有确认支付、拒绝等操作,不为历史审批记录增加新操作按钮。
|
||||||
|
|
||||||
|
## 5. Exchange List
|
||||||
|
|
||||||
|
- [x] 5.1 在换货列表增加提交人、审批状态、当前审批人摘要、业务处理状态列。
|
||||||
|
- [x] 5.2 保留换货既有流程和资产筛选逻辑,不为历史审批记录增加新操作按钮。
|
||||||
|
|
||||||
|
## 6. Verification
|
||||||
|
|
||||||
|
- [x] 6.1 验证三类列表在 `approval_source=none` 时审批状态和当前审批人摘要均显示 `-`。
|
||||||
|
- [x] 6.2 验证 `approval_source=legacy` 时显示“历史审批”且没有新增审批操作,`wecom` 时显示后端审批状态和当前审批人摘要。
|
||||||
|
- [x] 6.3 验证长当前审批人摘要会省略显示并能通过悬浮查看完整文本。
|
||||||
|
- [x] 6.4 验证三个列表的业务处理状态独立显示,分页和刷新不触发逐行审批详情请求。
|
||||||
|
- [x] 6.5 运行相关类型检查、lint 或构建验证。
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
# Change: 业务用户组管理与店铺批量交接/导入(AUG26-003)
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
后台需要把平台用户账号按业务线归入"业务用户组",并基于组对店铺做筛选、批量交接负责人与 CSV 导入负责人。当前前端只有单个店铺设置平台业务员的能力,缺少业务用户组维护、成员归属、按组筛选、批量交接与导入入口;且现有 11 个新端点仅超管与平台账号可访问。
|
||||||
|
|
||||||
|
## What Changes
|
||||||
|
|
||||||
|
- 新增业务用户组管理模块(API 层 + 维护页面 + 成员管理):
|
||||||
|
- GET/POST /api/admin/business-user-groups、GET/PUT/DELETE /api/admin/business-user-groups/{id}
|
||||||
|
- PUT /api/admin/business-user-groups/{id}/members、DELETE /api/admin/business-user-groups/members
|
||||||
|
- 编码创建后不可改;删除需 {"confirm": true} 且仅无成员组可删;更新支持部分字段,business_line 三态(缺省=不改 / ""=清空 / 枚举=设置)。
|
||||||
|
- 成员归属整批校验(全部启用平台用户 + 目标组启用),任一无效整批不生效;一账号至多一组。
|
||||||
|
- 店铺列表/详情读取侧扩展:
|
||||||
|
- GET /api/admin/shops 新增 business_user_group_id / business_line / ungrouped 筛选。
|
||||||
|
- 列表/详情响应新增 5 个只读推导字段(组 ID/编码/名称/启用/业务线);组停用仍返回组且 enabled=false(不算未分组);前端不缓存、不回写,改组后重新拉列表。
|
||||||
|
- 勾选批量交接:
|
||||||
|
- PUT /api/admin/shops/business-owner/batch:shop_ids(1-500,去重)+ business_owner_account_id;字段缺失=400,null=清空,ID=换绑;任一店铺无效或目标非启用业务员 -> 整批不写入,统一按 1005 提示。
|
||||||
|
- CSV 导入:
|
||||||
|
- 复用 StorageService.getUploadUrl + 预签名 PUT 直传(FilePurpose 增加 shop_import)。
|
||||||
|
- POST /api/admin/shops/business-owner-imports 创建异步任务,轮询详情、展示行级结果;前端自带模板(表头 店铺编码,操作类型,业务员登录账号,备注,换绑/清空)。
|
||||||
|
- 入口与权限(代理/企业不渲染入口):
|
||||||
|
- 路由 meta roles ['R_SUPER', 'R_ADMIN'];按钮权限码:
|
||||||
|
- business_user_group:page / business_user_group:create / business_user_group:update / business_user_group:delete / business_user_group:members
|
||||||
|
- shop:business_owner_batch
|
||||||
|
- shop:business_owner_import
|
||||||
|
|
||||||
|
## Not In Scope
|
||||||
|
|
||||||
|
- 不实现后端接口、不改数据库。
|
||||||
|
- 业务用户组不承载角色权限/数据范围语义;前端不引入组层级与组管理员概念。
|
||||||
|
- 导入结果不支持导出,仅在页面展示行级明细。
|
||||||
|
|
||||||
|
## Impact
|
||||||
|
|
||||||
|
- Affected specs: business-user-group-management(新增)、shop-management(扩展)
|
||||||
|
- Affected code:
|
||||||
|
- src/types/api/businessUserGroup.ts(新增)
|
||||||
|
- src/api/modules/businessUserGroup.ts(新增)
|
||||||
|
- src/types/api/shop.ts、src/api/modules/shop.ts
|
||||||
|
- src/api/modules/storage.ts(FilePurpose 增加 shop_import)
|
||||||
|
- src/views/shop-management/business-user-groups/index.vue(新增页面)
|
||||||
|
- src/views/shop-management/list/index.vue
|
||||||
|
- src/router/routes/asyncRoutes.ts、src/router/routesAlias.ts、src/locales/langs/{zh,en}.json
|
||||||
|
- src/template/批量换绑业务员模板.csv(前端自带模板)
|
||||||
|
- API contracts: 11 个端点(7 个业务用户组 + 店铺筛选/字段 + 批量交接 + 导入三步)
|
||||||
|
- Dependencies:
|
||||||
|
- docs/产品迭代8月份/业务用户组.md(7 个组端点 OpenAPI)
|
||||||
|
- AUG26-003 前端对接说明(店铺侧端点)
|
||||||
|
|
||||||
|
## 待确认
|
||||||
|
|
||||||
|
- 成员选择器复用 GET /api/admin/shops/business-owner-candidates(启用平台账号);若组成员可包含非业务员平台账号,需后端补充平台账号列表端点。
|
||||||
|
- 导入任务与行级结果字段名(file_key、status、items[] 等)以生成文档为准,提案按对接说明先行对齐。
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: 业务用户组维护
|
||||||
|
|
||||||
|
后台 MUST 提供业务用户组列表、详情、创建、更新与删除能力(GET/POST /api/admin/business-user-groups、GET/PUT/DELETE /api/admin/business-user-groups/{id})。列表 MUST 支持 page/page_size/enabled/keyword/business_line 筛选,且每项 MUST 返回 business_line_name。创建时 code(1-64)与 name 必填,编码未删除组内唯一且创建后不可修改;business_line 可空(standard/smart/other),sort/enabled/remark 可选。更新 MUST 仅允许名称、业务线、排序、启停与备注,且 business_line 支持三态:字段缺失不修改、传 "" 清空、传枚举设置;删除 MUST 携带 {"confirm": true},仅无成员组可删除。
|
||||||
|
|
||||||
|
#### Scenario: 查询业务用户组列表
|
||||||
|
|
||||||
|
- **GIVEN** 用户进入业务用户组维护页
|
||||||
|
- **WHEN** 前端以 page/page_size/enabled/keyword/business_line 发起列表查询
|
||||||
|
- **THEN** 前端 MUST 展示分页结果且每项显示 business_line_name
|
||||||
|
- **AND** 下拉数据源复用该列表接口
|
||||||
|
|
||||||
|
#### Scenario: 创建时编码不可变
|
||||||
|
|
||||||
|
- **GIVEN** 用户填写名称与稳定编码创建用户组
|
||||||
|
- **WHEN** 提交成功或编码重复被后端拒绝
|
||||||
|
- **THEN** 编码在创建后 MUST NOT 出现在编辑表单中
|
||||||
|
- **AND** 编码重复时 MUST 展示后端返回的"业务用户组编码已存在"
|
||||||
|
|
||||||
|
#### Scenario: 业务线三态更新
|
||||||
|
|
||||||
|
- **GIVEN** 用户编辑某组的业务线
|
||||||
|
- **WHEN** 表单传 ""、传枚举或省略该字段
|
||||||
|
- **THEN** 前端 MUST 分别按"清空 / 设置 / 不修改"构造请求体
|
||||||
|
|
||||||
|
#### Scenario: 删除需二次确认
|
||||||
|
|
||||||
|
- **GIVEN** 用户点击删除某组
|
||||||
|
- **WHEN** 确认弹窗提交
|
||||||
|
- **THEN** 前端 MUST 携带 {"confirm": true}
|
||||||
|
- **AND** 有成员时 MUST 提示"用户组仍有成员,只能停用或先移走成员"且不做物理删除
|
||||||
|
- **AND** 无成员时删除成功并刷新列表
|
||||||
|
|
||||||
|
### Requirement: 成员归属批量维护
|
||||||
|
|
||||||
|
后台 MUST 支持按平台用户账号把成员批量设置进组(PUT /api/admin/business-user-groups/{id}/members)与批量清空(DELETE /api/admin/business-user-groups/members,携带 body account_ids)。两种操作 MUST 复用同一校验:所有账号必须是启用平台用户且目标组启用,任一账号无效则整批不生效;清空后账号回到未分组;一账号至多一组。
|
||||||
|
|
||||||
|
#### Scenario: 批量设置成员
|
||||||
|
|
||||||
|
- **GIVEN** 用户在成员管理中选择多个启用平台账号
|
||||||
|
- **WHEN** 保存成员归属
|
||||||
|
- **THEN** 前端 MUST 以 account_ids 数组整体替换每个账号原归属
|
||||||
|
- **AND** 刷新后成员关系与最新分组一致
|
||||||
|
|
||||||
|
#### Scenario: 批量清空成员
|
||||||
|
|
||||||
|
- **GIVEN** 用户选择若干账号执行清空
|
||||||
|
- **WHEN** 提交清空
|
||||||
|
- **THEN** 前端 MUST 调用 DELETE /api/admin/business-user-groups/members 并携带 account_ids body
|
||||||
|
- **AND** 清空成功的账号回到未分组
|
||||||
|
|
||||||
|
#### Scenario: 停用组的成员展示
|
||||||
|
|
||||||
|
- **GIVEN** 某组被停用但仍有成员
|
||||||
|
- **WHEN** 用户在成员管理或店铺列表看到该组
|
||||||
|
- **THEN** 前端 MUST 展示"已停用"标记并提供改组/清空入口
|
||||||
|
|
||||||
|
### Requirement: 访问控制与入口
|
||||||
|
|
||||||
|
业务用户组维护入口 MUST 仅对超级管理员与平台账号可见,代理/企业账号 MUST NOT 渲染入口;所有按钮 MUST 受权限码控制。
|
||||||
|
|
||||||
|
#### Scenario: 菜单按角色隐藏
|
||||||
|
|
||||||
|
- **GIVEN** 代理或企业账号登录
|
||||||
|
- **WHEN** 系统渲染菜单
|
||||||
|
- **THEN** MUST NOT 展示业务用户组菜单项
|
||||||
|
|
||||||
|
#### Scenario: 按钮权限控制
|
||||||
|
|
||||||
|
- **GIVEN** 平台账号具备部分业务用户组权限
|
||||||
|
- **WHEN** 渲染操作按钮
|
||||||
|
- **THEN** 前端 MUST 按 business_user_group:create/update/delete/members 控制显隐
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: 店铺列表/详情业务用户组字段与筛选
|
||||||
|
|
||||||
|
店铺列表查询 MUST 支持 business_user_group_id、business_line、ungrouped 三个新筛选;列表与详情响应 MUST 提供 5 个只读推导字段:business_user_group_id(可空)、business_user_group_code、business_user_group_name、business_user_group_enabled、business_user_group_business_line。组停用仍返回组且 enabled=false(不算未分组);店铺不存组,字段实时推导,前端 MUST NOT 缓存或回写,改动组成员后重新拉取列表。
|
||||||
|
|
||||||
|
#### Scenario: 按业务用户组筛选
|
||||||
|
|
||||||
|
- **GIVEN** 用户在店铺列表选择业务用户组、业务线或勾选"未分组"
|
||||||
|
- **WHEN** 发起列表查询
|
||||||
|
- **THEN** 前端 MUST 提交 business_user_group_id/business_line/ungrouped 参数
|
||||||
|
- **AND** ungrouped=true 表示无负责人或负责人无分组
|
||||||
|
|
||||||
|
#### Scenario: 展示组字段
|
||||||
|
|
||||||
|
- **GIVEN** 店铺属于某启用或停用的业务用户组
|
||||||
|
- **WHEN** 渲染列表或详情
|
||||||
|
- **THEN** 前端 MUST 展示组名称/编码/业务线
|
||||||
|
- **AND** 组停用时 MUST 标记"已停用"且仍展示组归属
|
||||||
|
|
||||||
|
### Requirement: 勾选批量交接平台业务员
|
||||||
|
|
||||||
|
店铺列表 MUST 支持勾选店铺批量交接平台业务员(PUT /api/admin/shops/business-owner/batch,body shop_ids 1-500 去重 + business_owner_account_id)。字段缺失 MUST 按参数错误处理(400);传 null 表示清空负责人;传 ID 表示换绑。任一店铺不存在/已删除/越权或目标非启用业务员时整批不写入,前端 MUST 统一提示"无权限操作该资源或资源不存在";成功响应含 batch_key/shop_count/cleared。
|
||||||
|
|
||||||
|
#### Scenario: 批量换绑
|
||||||
|
|
||||||
|
- **GIVEN** 用户勾选 1-500 家店铺并选择启用业务员
|
||||||
|
- **WHEN** 提交批量交接
|
||||||
|
- **THEN** 前端 MUST 提交 shop_ids(去重)与 business_owner_account_id
|
||||||
|
- **AND** 成功后展示 shop_count 并刷新列表
|
||||||
|
|
||||||
|
#### Scenario: 批量清空负责人
|
||||||
|
|
||||||
|
- **GIVEN** 用户勾选店铺并选择"清空负责人"
|
||||||
|
- **WHEN** 提交批量交接
|
||||||
|
- **THEN** 前端 MUST 显式提交 business_owner_account_id: null
|
||||||
|
- **AND** MUST NOT 省略该字段
|
||||||
|
|
||||||
|
#### Scenario: 整批失败统一提示
|
||||||
|
|
||||||
|
- **GIVEN** 批量交接请求因任一店铺或目标账号不满足条件而被后端拒绝
|
||||||
|
- **WHEN** 前端收到 1005
|
||||||
|
- **THEN** 前端 MUST 展示统一文案且不写入任何店铺
|
||||||
|
|
||||||
|
### Requirement: 业务负责人 CSV 导入
|
||||||
|
|
||||||
|
店铺列表 MUST 支持通过 CSV 导入批量交接/清空业务负责人。流程 MUST 为:前端自带模板(表头 店铺编码,操作类型,业务员登录账号,备注,操作类型仅"换绑"或"清空")-> POST /api/admin/storage/upload-url(purpose=shop_import)拿预签名 URL 直传(15 分钟有效)-> POST /api/admin/shops/business-owner-imports(file_key)创建异步任务 -> 轮询 GET /api/admin/shops/business-owner-imports/{id} 展示结果。行级失败不等于任务失败:任务 status=3 也可能有失败行,MUST 按 items[] 展示明细;表头/编码不符为任务级失败,items 为空数组,只展示 error_message。
|
||||||
|
|
||||||
|
#### Scenario: 下载模板并上传
|
||||||
|
|
||||||
|
- **GIVEN** 用户进入导入界面
|
||||||
|
- **WHEN** 点击下载模板或选择文件
|
||||||
|
- **THEN** 前端 MUST 提供表头完全一致的模板文件
|
||||||
|
- **AND** 上传后 MUST 以 purpose=shop_import 获取上传地址并直传
|
||||||
|
|
||||||
|
#### Scenario: 创建任务并轮询
|
||||||
|
|
||||||
|
- **GIVEN** 文件上传成功拿到 file_key
|
||||||
|
- **WHEN** 提交创建导入任务
|
||||||
|
- **THEN** 前端 MUST 携带 file_key 调用创建接口
|
||||||
|
- **AND** MUST 轮询任务详情直到 status 为已完成(3)或失败(4)
|
||||||
|
|
||||||
|
#### Scenario: 展示行级失败明细
|
||||||
|
|
||||||
|
- **GIVEN** 任务完成但存在失败行
|
||||||
|
- **WHEN** 前端渲染结果
|
||||||
|
- **THEN** 前端 MUST 展示 total_count/success_count/fail_count
|
||||||
|
- **AND** MUST 按 items[] 展示各行的 line/shop_code/operation_type/status/reason
|
||||||
|
- **AND** 失败行保留原负责人
|
||||||
|
|
||||||
|
#### Scenario: 任务级失败提示
|
||||||
|
|
||||||
|
- **GIVEN** 表头或编码不符导致任务级失败
|
||||||
|
- **WHEN** 前端渲染结果
|
||||||
|
- **THEN** 前端 MUST 只展示 error_message 且明细为空
|
||||||
34
openspec/changes/add-business-user-group-management/tasks.md
Normal file
34
openspec/changes/add-business-user-group-management/tasks.md
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
## 1. API Contract 层
|
||||||
|
|
||||||
|
- [x] 1.1 新增 src/types/api/businessUserGroup.ts:组项/分页/创建/更新/删除/成员设置与结果类型
|
||||||
|
- [x] 1.2 新增 src/api/modules/businessUserGroup.ts:封装 7 个组端点(DELETE 带 body,需请求层支持)
|
||||||
|
- [x] 1.3 扩展 src/types/api/shop.ts:列表筛选 business_user_group_id/business_line/ungrouped,响应只读组字段,批量交接与导入任务/行级结果类型
|
||||||
|
- [x] 1.4 扩展 src/api/modules/shop.ts:batchUpdateBusinessOwner、createBusinessOwnerImport、getBusinessOwnerImportDetail、getBusinessOwnerImportList
|
||||||
|
- [x] 1.5 扩展 src/api/modules/storage.ts:FilePurpose 增加 shop_import
|
||||||
|
|
||||||
|
## 2. 业务用户组页面
|
||||||
|
|
||||||
|
- [x] 2.1 新增 src/views/shop-management/business-user-groups/index.vue:列表(筛选/分页/启停/业务线)
|
||||||
|
- [x] 2.2 新建/编辑弹窗:code 创建后不可改、business_line 三态、名称/排序/备注/启停
|
||||||
|
- [x] 2.3 删除:二次确认(confirm=true),有成员时按后端提示处理
|
||||||
|
- [x] 2.4 成员管理(对话框/抽屉):成员选择器(复用 business-owner-candidates)+ 批量设置 + 批量清空;停用组保留成员并标记"已停用"
|
||||||
|
|
||||||
|
## 3. 店铺列表扩展
|
||||||
|
|
||||||
|
- [x] 3.1 列表搜索区新增业务用户组下拉与业务线筛选、ungrouped 勾选(数据源来自组列表接口)
|
||||||
|
- [x] 3.2 列表/详情展示组字段(停用组标记,不缓存不回写)
|
||||||
|
- [x] 3.3 批量交接弹窗:勾选店铺 + 选择业务员/清空(显式 null),整批失败统一 1005 文案
|
||||||
|
- [x] 3.4 导入入口:模板下载、文件校验/上传(purpose=shop_import)、创建任务、轮询并展示行级明细
|
||||||
|
- [x] 3.5 导入任务列表(状态筛选)
|
||||||
|
|
||||||
|
## 4. 路由/菜单/权限/i18n
|
||||||
|
|
||||||
|
- [x] 4.1 新增 /shop-management/business-user-groups 路由与菜单,roles ['R_SUPER', 'R_ADMIN']
|
||||||
|
- [x] 4.2 按钮权限编码落地(business_user_group*/shop:business_owner_batch/shop:business_owner_import)
|
||||||
|
- [x] 4.3 中英文案 menus.shopManagement.businessUserGroups 等
|
||||||
|
|
||||||
|
## 5. 验证
|
||||||
|
|
||||||
|
- [x] 5.1 运行 npm run build(含 vue-tsc --noEmit)
|
||||||
|
- [x] 5.2 运行 npm run check:encoding
|
||||||
|
- [x] 5.3 运行 openspec validate add-business-user-group-management --strict
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
## Context
|
||||||
|
|
||||||
|
现有前端没有运营商通道阈值命中记录页面或对应 API 类型。后端已提供只读分页查询接口,页面需忠实呈现不可变的命中时快照和周期恢复状态。
|
||||||
|
|
||||||
|
## Goals / Non-Goals
|
||||||
|
|
||||||
|
- Goals: 提供受限于平台账号的筛选、分页和证据查询;不丢失空值的历史语义。
|
||||||
|
- Non-Goals: 修改通道阈值、发起停复机、导出记录、查看卡片详情,或查询上游响应。
|
||||||
|
|
||||||
|
## Decisions
|
||||||
|
|
||||||
|
- Decision: 在系统管理路径下新增独立隐藏查询页,由运营商管理页提供入口;路由使用 `allowedUserTypes: [1, 2]`,页面自身也在请求前检查平台账号。
|
||||||
|
- Rationale: 接口只允许超级管理员和平台账号。前端隐藏/保护页面入口,后端仍是最终授权及卡数据范围过滤边界。
|
||||||
|
- Decision: 精确 ID 筛选使用数值输入,计费周期起点使用日期时间选择器,判定时间使用日期时间范围选择器;时间序列化为带时区 RFC3339 秒级字符串。
|
||||||
|
- Rationale: 与接口的精确匹配和闭区间语义一致,避免按日期截断或丢失时区。
|
||||||
|
- Decision: 页面仅展示响应快照,不再查询通道配置或根据当前阈值重算历史值。
|
||||||
|
- Rationale: 命中值冻结于判定时;历史缺失值必须保留接口规定的空值含义。
|
||||||
|
|
||||||
|
## Risks / Trade-offs
|
||||||
|
|
||||||
|
- 查询页不依赖后端菜单节点;前端入口仅对平台账号显示,页面路由限制用户类型,API 仍执行最终授权和数据范围过滤。
|
||||||
|
- 表格包含多列证据字段,采用现有可横向滚动的管理台表格以保持信息完整。
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# Change: 新增运营商通道阈值命中记录查询
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
达量停机与周期恢复需要可追溯的数字证据。运营人员需要查询每次停机判定时冻结的累计流量、实际阈值、计费周期、触发来源,以及周期解锁和复机结果;通道阈值后续变更不能影响历史记录。
|
||||||
|
|
||||||
|
## What Changes
|
||||||
|
|
||||||
|
- 在运营商管理页提供“通道阈值命中记录”入口,打开独立只读查询页并接入 `GET /api/admin/carrier-traffic-threshold-hits`。
|
||||||
|
- 支持按运营商通道 ID、IoT 卡 ID、计费周期起点精确匹配,并按判定时间闭区间筛选。
|
||||||
|
- 展示命中时的流量和阈值快照、判定/触发信息、锁状态、解锁时间、复机结果及安全失败原因。
|
||||||
|
- 仅超级管理员与平台账号可访问;数据范围过滤及越权资源不可区分由后端强制执行,前端不替代后端授权。
|
||||||
|
- 对接口定义的空历史值使用明确的“无”或“未处理/历史记录”展示,不发起额外的通道阈值或上游接口查询。
|
||||||
|
|
||||||
|
## Impact
|
||||||
|
|
||||||
|
- Affected specs: `carrier-traffic-threshold-hits`
|
||||||
|
- Affected code:
|
||||||
|
- `src/api/modules/carrierTrafficThresholdHit.ts`
|
||||||
|
- `src/types/api/carrierTrafficThresholdHit.ts`
|
||||||
|
- `src/views/system/carrier-traffic-threshold-hits/index.vue`
|
||||||
|
- `src/router/routesAlias.ts`, `src/router/routes/staticRoutes.ts`, `src/views/system/carrier-management/index.vue`
|
||||||
|
- `src/locales/langs/zh.json`, `src/locales/langs/en.json`
|
||||||
|
- Breaking changes: 无;仅新增只读查询接口消费与页面入口。
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: Carrier Traffic Threshold Hit Record Query
|
||||||
|
|
||||||
|
The admin frontend SHALL provide a read-only paginated view of carrier traffic threshold hit records using `GET /api/admin/carrier-traffic-threshold-hits`.
|
||||||
|
|
||||||
|
#### Scenario: Restrict page access to platform accounts
|
||||||
|
|
||||||
|
- **GIVEN** a user is not a super administrator or platform account
|
||||||
|
- **WHEN** the user navigates to the carrier traffic threshold hit page
|
||||||
|
- **THEN** the frontend MUST deny access and MUST NOT issue the hit-record query
|
||||||
|
- **AND** backend authorization and card data-scope filtering MUST remain authoritative
|
||||||
|
|
||||||
|
#### Scenario: Filter hit records
|
||||||
|
|
||||||
|
- **GIVEN** an authorized platform user opens the hit-record page
|
||||||
|
- **WHEN** the user searches by optional carrier ID, card ID, billing period start, or judged-at time range
|
||||||
|
- **THEN** the frontend MUST send `carrier_id`, `card_id`, `period_start`, `start_time`, and `end_time` only when provided
|
||||||
|
- **AND** period and judged-at timestamps MUST be timezone-qualified RFC3339 values with second precision
|
||||||
|
- **AND** `start_time` and `end_time` MUST represent the API's inclusive time interval
|
||||||
|
|
||||||
|
#### Scenario: Display immutable hit evidence and recovery result
|
||||||
|
|
||||||
|
- **GIVEN** the query returns threshold-hit records
|
||||||
|
- **WHEN** the frontend renders the table
|
||||||
|
- **THEN** it MUST display record/card/carrier IDs, hit traffic, frozen threshold value and unit, billing period start, judged time, trigger source, lock status, unlock time, resume result, failure reason, and creation time
|
||||||
|
- **AND** it MUST NOT recompute hit traffic or threshold from current channel configuration
|
||||||
|
- **AND** it MUST display nullable historical traffic/threshold values as “无”, blank resume results as “未处理或历史记录”, and missing unlock/failure details as “无”
|
||||||
|
|
||||||
|
#### Scenario: Preserve server ordering and pagination
|
||||||
|
|
||||||
|
- **GIVEN** the user queries hit records
|
||||||
|
- **WHEN** the frontend loads or changes the page
|
||||||
|
- **THEN** it MUST send `page` and `page_size` (never exceeding 100)
|
||||||
|
- **AND** it MUST render the server-provided page, size, total, and item order without client-side re-sorting
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
## 1. API Contract
|
||||||
|
|
||||||
|
- [x] 1.1 增加命中记录查询参数、记录项及分页响应类型。
|
||||||
|
- [x] 1.2 增加 `GET /api/admin/carrier-traffic-threshold-hits` 服务方法并统一导出。
|
||||||
|
|
||||||
|
## 2. Admin UI
|
||||||
|
|
||||||
|
- [x] 2.1 新增超级管理员/平台账号可访问的隐藏路由、运营商管理页入口及中英文标题。
|
||||||
|
- [x] 2.2 实现筛选、分页和命中/周期恢复快照表格,按接口约定展示空值。
|
||||||
|
- [x] 2.3 运行 OpenSpec 校验、ESLint 与生产构建。
|
||||||
60
openspec/changes/add-commission-clawback-records/proposal.md
Normal file
60
openspec/changes/add-commission-clawback-records/proposal.md
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
# Change: 退款佣金回扣改为独立回溯明细(前端适配)
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
后端调整了退款佣金回扣口径:退款不再把原佣金整单置为「已失效」,而是原佣金行保持「已发放」不变,另新增一条独立负数、不可提现的「回溯明细」行。对应前端接口说明(简短版)要求:
|
||||||
|
|
||||||
|
- 佣金记录列表新增 `status` 查询参数(含 5 回溯)与行级 `source` 字段(`original` / `clawback`)。
|
||||||
|
- 新增佣金记录详情接口 `GET /api/admin/shops/{shop_id}/commission-records/{id}?source=clawback`。
|
||||||
|
- 新增导出场景 `scene=commission_record`(后端已进白名单)。
|
||||||
|
- 两个必改点:列表行 key 必须用 `source + ':' + id`(原佣金与回溯 ID 空间独立,同一页会重复);渲染需支持负数金额(标红)与「不可提现」标识。
|
||||||
|
|
||||||
|
前端当前实现基于旧语义(`ShopCommissionRecordItem` 无 `source`,列表行 key 直接用 `id`,退款后原行被视为已失效),需按新口径适配。
|
||||||
|
|
||||||
|
## What Changes
|
||||||
|
|
||||||
|
- 类型层:`ShopCommissionRecordItem` 新增 `source`、`original_commission_id`、`refund_id`、`refund_no`、`withdrawable`、`clawback_records`、`clawback_total_amount`;新增回溯摘要与详情类型;`CommissionRecordQueryParams.status` 支持 5(回溯)。
|
||||||
|
- API 层:新增 `getShopCommissionRecordDetail(shopId, id, source?)`,`source` 省略时按原佣金处理。
|
||||||
|
- 列表页(代理侧「我的佣金」与管理侧「代理资金概览 > 佣金明细」):行 key 改为 `source + ':' + id`;回溯行展示「回溯」状态与「不可提现」标识;负数金额与可为负的 `balance_after` 标红;`status` 筛选项新增「回溯」;详情入口必须携带该行 `source`。
|
||||||
|
- 详情展示:原佣金详情展示 `clawback_records` 摘要与 `clawback_total_amount`;回溯详情展示来源 `original_commission`;越权/不存在统一提示「佣金明细不存在」,不做存在性判断。
|
||||||
|
- 导出:`ExportTaskScene` 增加 `commission_record`;新增导出佣金记录场景页、路由、菜单与 i18n;佣金记录列表导出入口只提交受支持的筛选 key(`shop_id` / `status` / `commission_source` / `order_no`)。
|
||||||
|
- 字段兜底:后端新增字段为 `omitempty`,前端取 `?? []` / `?? 0`,金额单位为分。
|
||||||
|
|
||||||
|
## Not In Scope
|
||||||
|
|
||||||
|
- 不实现后端接口、不改数据库、不改审批实例数据。
|
||||||
|
- 既有字段无改名/改类型;`commission-stats`、`commission-daily-stats` 口径未变,本次不动。
|
||||||
|
- 时间筛选属另一 Change(`add-export-time-filter-standards`),本次不涉及。
|
||||||
|
- 语义提醒:退款不再写 `status=4`,旧假设「退款后原行变已失效」已失效,需在文案/注释体现。
|
||||||
|
|
||||||
|
## Impact
|
||||||
|
|
||||||
|
- Affected specs: `commission-management`、`export-task-management`
|
||||||
|
- Affected code:
|
||||||
|
- `src/types/api/commission.ts`
|
||||||
|
- `src/api/modules/commission.ts`
|
||||||
|
- `src/views/commission-management/my-commission/index.vue`
|
||||||
|
- `src/views/commission-management/agent-fund-overview/index.vue`
|
||||||
|
- `src/types/api/exportTask.ts`
|
||||||
|
- `src/config/constants/exportTask.ts`
|
||||||
|
- `src/views/asset-management/export-task-management/export-commission-record/index.vue`
|
||||||
|
- `src/router/routes/asyncRoutes.ts`、`src/router/routesAlias.ts`、`src/locales/langs/{zh,en}.json`
|
||||||
|
- Dependencies:
|
||||||
|
- `docs/产品迭代8月份/frontend-api-simple.md`(后端契约)
|
||||||
|
- 后端已把 `scene=commission_record` 加入导出场景白名单
|
||||||
|
- 需确认导出场景权限编码与场景页是否必需(见 Open Questions)
|
||||||
|
- Breaking changes:
|
||||||
|
- 列表行 key 由 `id` 改为 `source + ':' + id`;未携带 `source` 的详情请求会命中原佣金行。
|
||||||
|
|
||||||
|
## 接口确认结果(来自 OpenAPI)
|
||||||
|
|
||||||
|
- 详情响应 `DtoShopCommissionRecordDetailResp`:`source`、`record`(`DtoShopCommissionRecordItem`)、`clawback_records`(仅原佣金返回)、`original_commission`(仅回溯详情返回)。
|
||||||
|
- `DtoShopCommissionRecordItem` 新增 `source`、`released_at`、`withdrawable`(boolean,nullable,仅回溯行返回且恒 false)、`original_commission_id`、`refund_id`、`refund_no`、`clawback_records`、`clawback_total_amount`。
|
||||||
|
- `DtoShopCommissionClawbackItem`:`id`、`amount`(恒负)、`balance_after`(可为负)、`original_commission_id`、`refund_id`、`refund_no`、`status`(5 回溯)、`status_name`、`withdrawable`、`created_at`。
|
||||||
|
- 详情接口越权与不存在返回同一结果,前端统一提示「佣金明细不存在」。
|
||||||
|
- 已确认需要新增「导出佣金记录」菜单页。
|
||||||
|
|
||||||
|
## 待确认(已按仓库既有约定实现,如需调整请告知)
|
||||||
|
|
||||||
|
1. 导出场景权限编码:按既有约定实现为 `export_task:commission_record_detail` / `export_task:commission_record_download`。
|
||||||
|
2. 佣金记录列表导出按钮权限:按 `agent_wallet_transaction:export` 的同级约定实现为 `commission_record:export`。
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: 佣金记录列表回溯行与状态筛选
|
||||||
|
佣金记录列表(`GET /api/admin/shops/{shop_id}/commission-records`)MUST 支持 `status` 查询参数(1 已冻结 / 2 解冻中 / 3 已发放 / 4 已失效 / 5 回溯 / 99 待人工修正),且 MUST NOT 提供 `source` 查询参数;`status=5` 即等价于只看回溯行。
|
||||||
|
|
||||||
|
#### Scenario: 只看回溯行
|
||||||
|
- **GIVEN** 用户在佣金记录列表选择状态「回溯」
|
||||||
|
- **WHEN** 前端发起列表查询
|
||||||
|
- **THEN** 前端 MUST 只传 `status=5`
|
||||||
|
- **AND** 前端 MUST NOT 传 `source` 参数
|
||||||
|
|
||||||
|
### Requirement: 佣金记录行新增字段与兜底
|
||||||
|
列表响应的每一行 MUST 支持 `source`(`original` / `clawback`);回溯行 MUST 支持 `original_commission_id`、`refund_id`、`refund_no`、`withdrawable`(恒 `false`)与可为负数的 `amount`、`balance_after`;原佣金行 MUST 支持 `clawback_records` 摘要与 `clawback_total_amount`(负值)。后端 `omitempty` 缺省字段前端 MUST 以 `?? []` / `?? 0` 兜底,金额单位为分。
|
||||||
|
|
||||||
|
#### Scenario: 缺省字段兜底
|
||||||
|
- **GIVEN** 列表响应中的原佣金行未返回 `clawback_records`
|
||||||
|
- **WHEN** 前端渲染该行
|
||||||
|
- **THEN** 前端 MUST 按空数组处理并正常渲染
|
||||||
|
- **AND** 前端 MUST NOT 因缺省字段报错或渲染 `undefined`
|
||||||
|
|
||||||
|
### Requirement: 列表行标识与负数渲染
|
||||||
|
列表 MUST 使用 `source + ':' + id` 作为行 key(原佣金与回溯 ID 空间独立,同一页可能出现相同 `id`);回溯行 MUST 展示「不可提现」标识;负数 `amount` 与 `balance_after` MUST 标红显示;任何跳转详情的入口 MUST 携带该行的 `source`,缺省按原佣金处理。
|
||||||
|
|
||||||
|
#### Scenario: 同一页出现重复 id
|
||||||
|
- **GIVEN** 同一页列表中同时存在原佣金行与回溯行且 `id` 相同
|
||||||
|
- **WHEN** 前端渲染表格
|
||||||
|
- **THEN** 前端 MUST 以 `source + ':' + id` 区分两行
|
||||||
|
- **AND** 前端 MUST NOT 出现行复用或渲染错位
|
||||||
|
|
||||||
|
#### Scenario: 负数金额标红
|
||||||
|
- **GIVEN** 某回溯行 `amount` 为负值
|
||||||
|
- **WHEN** 前端渲染金额列
|
||||||
|
- **THEN** 前端 MUST 标红展示该负值
|
||||||
|
|
||||||
|
### Requirement: 佣金记录详情接口封装
|
||||||
|
前端 MUST 提供 `GET /api/admin/shops/{shop_id}/commission-records/{id}` 的详情封装,并支持可选 `source`:`source=clawback` 时返回回溯详情,`source` 省略时按原佣金处理。原佣金详情 MUST 返回 `clawback_records`;回溯详情 MUST 返回 `original_commission`;越权与不存在 MUST 返回同一结果(佣金明细不存在),前端 MUST NOT 用该接口做存在性判断。
|
||||||
|
|
||||||
|
#### Scenario: 打开回溯行详情
|
||||||
|
- **GIVEN** 用户在列表点击某条回溯行
|
||||||
|
- **WHEN** 前端请求详情
|
||||||
|
- **THEN** 前端 MUST 携带 `source=clawback` 与该行 `id`
|
||||||
|
- **AND** 详情 MUST 展示来源 `original_commission`
|
||||||
|
|
||||||
|
#### Scenario: 越权统一提示
|
||||||
|
- **GIVEN** 详情接口返回「佣金明细不存在」
|
||||||
|
- **WHEN** 前端渲染详情
|
||||||
|
- **THEN** 前端 MUST 展示统一不存在提示
|
||||||
|
- **AND** 前端 MUST NOT 区分越权与不存在两种原因
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: 佣金记录导出场景
|
||||||
|
前端 MUST 支持导出场景 `scene=commission_record`(后端已进白名单),并在导出管理中提供该场景的任务列表入口;创建导出任务时 MUST 提交固定 `scene=commission_record`。导出粒度为佣金记录:原佣金与回溯各占一行,金额与余额同样按分转元、负数带 `-` 展示。
|
||||||
|
|
||||||
|
#### Scenario: 场景页固定查询
|
||||||
|
- **GIVEN** 用户打开导出佣金记录页面
|
||||||
|
- **WHEN** 页面查询导出任务列表
|
||||||
|
- **THEN** 前端 MUST 调用 `GET /api/admin/export-tasks` 且带 `scene=commission_record`
|
||||||
|
- **AND** 用户 MUST NOT 能在该页面切换到其他场景
|
||||||
|
|
||||||
|
### Requirement: 佣金记录导出筛选受限
|
||||||
|
佣金记录列表发起导出时,`query` MUST 只包含后端支持的筛选 key:`shop_id`、`status`、`commission_source`、`order_no`;MUST NOT 提交 `iccid`、`virtual_no` 及时间筛选,导出弹窗 MUST NOT 直接复用列表全部条件。
|
||||||
|
|
||||||
|
#### Scenario: 列表筛选含不支持的 key
|
||||||
|
- **GIVEN** 佣金记录列表当前筛选包含 `iccid` 与时间范围
|
||||||
|
- **WHEN** 用户确认创建导出任务
|
||||||
|
- **THEN** 提交的 `query` MUST NOT 包含 `iccid`、`virtual_no` 或时间字段
|
||||||
|
- **AND** 提交的 `query` MUST 仅保留 `shop_id`、`status`、`commission_source`、`order_no` 中已填写的项
|
||||||
27
openspec/changes/add-commission-clawback-records/tasks.md
Normal file
27
openspec/changes/add-commission-clawback-records/tasks.md
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
## 1. 类型与 API 层(commission-api)
|
||||||
|
- [x] 1.1 `CommissionStatus` 补充 5(回溯);修正 `CommissionRecordQueryParams.status` 过期注释并支持回溯值
|
||||||
|
- [x] 1.2 `ShopCommissionRecordItem` 新增 `source`、`original_commission_id`、`refund_id`、`refund_no`、`withdrawable`、`clawback_records`、`clawback_total_amount`
|
||||||
|
- [x] 1.3 新增回溯摘要与佣金记录详情类型(原佣金详情含 `clawback_records`,回溯详情含 `original_commission`)
|
||||||
|
- [x] 1.4 `CommissionService` 新增 `getShopCommissionRecordDetail(shopId, id, source?)`
|
||||||
|
|
||||||
|
## 2. 列表页(commission-records-list)
|
||||||
|
- [x] 2.1 行 key 改为 `source + ':' + id`(`my-commission` 与 `agent-fund-overview` 佣金明细)
|
||||||
|
- [x] 2.2 回溯行展示「回溯」状态与「不可提现」标识
|
||||||
|
- [x] 2.3 负数金额与可为负的 `balance_after` 标红渲染
|
||||||
|
- [x] 2.4 `status` 筛选项新增「回溯」
|
||||||
|
- [x] 2.5 列表新增详情入口,且请求必须携带该行 `source`
|
||||||
|
|
||||||
|
## 3. 详情展示(commission-record-detail)
|
||||||
|
- [x] 3.1 原佣金详情展示 `clawback_records` 摘要与 `clawback_total_amount`
|
||||||
|
- [x] 3.2 回溯详情展示来源 `original_commission`
|
||||||
|
- [x] 3.3 越权/不存在统一提示「佣金明细不存在」,不作为存在性判断依据
|
||||||
|
|
||||||
|
## 4. 导出(commission-record-export)
|
||||||
|
- [x] 4.1 `ExportTaskScene` 增加 `commission_record` 并补场景配置
|
||||||
|
- [x] 4.2 新增导出佣金记录场景页、路由、菜单与中英文案
|
||||||
|
- [x] 4.3 佣金记录列表新增导出入口,`query` 仅提交 `shop_id` / `status` / `commission_source` / `order_no`
|
||||||
|
|
||||||
|
## 5. 验证
|
||||||
|
- [x] 5.1 运行 `npm run build`(含 `vue-tsc --noEmit`)
|
||||||
|
- [x] 5.2 运行 `npm run check:encoding`
|
||||||
|
- [x] 5.3 运行 `openspec.cmd validate add-commission-clawback-records --strict`
|
||||||
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`,确保类型与编码通过。
|
||||||
|
- [x] 7.2 校验普通员工与超管的菜单、列与操作可见性差异。 — 已核验:应用/账单/收款方式页 v-permission 按钮、bills 关闭操作 hasAuth(billClose)+canCloseBill、表单 isActing=isSuperAdmin 控制代办字段
|
||||||
|
- [x] 7.3 校验金额分/元转换、附件预签名展示与 503 错误兜底。 — 已核验:ApplicationFormDialog 用 fenToYuan/yuanToFen;detail.vue 用 PaymentVoucherDialog 预览凭证;getErrorMessage 提取后端 msg(含 503 未配置场景)兜底
|
||||||
41
openspec/changes/add-gateway-rate-limit-management/design.md
Normal file
41
openspec/changes/add-gateway-rate-limit-management/design.md
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
## Context
|
||||||
|
|
||||||
|
项目使用 Vue 3、TypeScript、Element Plus 和 BaseService。后端控制菜单模式下,超级管理员直接使用全部静态路由,普通用户使用授权菜单;按钮控制复用现有 `useAuth`,身份复用 `userStore.isSuperAdmin`。
|
||||||
|
|
||||||
|
## Goals / Non-Goals
|
||||||
|
|
||||||
|
- Goals: 完整接入文档声明的 API、可操作的管理页面、可靠表单校验、清晰权限配置交付。
|
||||||
|
- Non-Goals: 不实现后端限流,不改变旧轮询/停复机行为,不部署,不猜测统计指标字段。
|
||||||
|
|
||||||
|
## Decisions
|
||||||
|
|
||||||
|
- 四页统一归属「轮询管理」,不新增一级菜单:
|
||||||
|
|
||||||
|
| 页面 | URL | 父菜单 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 停复机记录 | `/polling-management/stop-resume-records` | 轮询管理 `/polling-management` |
|
||||||
|
| 上游错误分类 | `/polling-management/error-classifications` | 轮询管理 `/polling-management` |
|
||||||
|
| 网关限流组 | `/polling-management/rate-limit-groups` | 轮询管理 `/polling-management` |
|
||||||
|
| 网关调用统计 | `/polling-management/gateway-stats` | 轮询管理 `/polling-management` |
|
||||||
|
| 网关限流组详情(隐藏路由) | `/polling-management/rate-limit-groups/detail/:id` | 轮询管理 `/polling-management` |
|
||||||
|
|
||||||
|
- 页面权限分别为 `card_stop_resume_record:page`、`gateway_error_classification:page`、`gateway_rate_limit_group:page`、`gateway_call_stats:page`,隐藏详情路由使用 `gateway_rate_limit_group:detail_page`。普通操作权限为 `gateway_error_classification:test`、`gateway_rate_limit_group:detail`、`gateway_call_stats:trend`;单卡入口按资产类型使用 `iot_info:stop_resume_records` / `device_info:stop_resume_records`。这些是前端配置约定,不声称来自后端接口文档;详情页与按钮使用独立编码,避免菜单与按钮编码冲突。
|
||||||
|
- 超级管理员维护入口不定义供普通账号分配的增删改权限;UI 与事件处理双重身份检查,后端继续独立鉴权。
|
||||||
|
- 提取专用新模块承载网关契约,避免覆盖旧 `/api/cards/{iccid}/suspend-resume-records` 接口及其不同 DTO。
|
||||||
|
- 枚举请求失败显式展示错误和重试,不把不可用枚举误报为空;未知值在只读展示中保留原值。
|
||||||
|
- 时间统一转换 RFC3339;全局记录查询必须有完整区间,单卡可使用后端默认;分页最大 100。
|
||||||
|
- 统计内部字段使用 `unknown`/记录值承载,只展示实际返回字段,空值不转成业务零;不从不明确字段推导图表或指标。
|
||||||
|
- 界面复用项目现有表格、搜索区、分页、弹窗、主题变量及状态标签;参考 UI/UX skill 的加载反馈、可访问标签、键盘焦点与响应式原则,不更换全站字体、颜色或新增表单依赖。
|
||||||
|
- 用户补充要求:列表严格复用店铺列表的 ArtSearchBar / ArtTableHeader / ArtTable / ArtTableFullScreen;详情使用店铺详情的返回、标题和双列描述表。时间展示复用同一个 `formatDateTime`,不改变请求与数据源;展开按钮仅在搜索条件数 >= 4 时出现。
|
||||||
|
- 运营商账户一律名称搜索下拉,复用 `CarrierService.getCarriers({ page: 1, page_size: 20, carrier_name })`,保留原账户名称回显,选中后仍提交 ID;趋势额外保留「无法解析账户的卡」的值 0。
|
||||||
|
|
||||||
|
## Risks / Trade-offs
|
||||||
|
|
||||||
|
- 统计契约缺字段 → 接口和数据可查看,但正式业务趋势图需后端样例或完整 DTO 后再确定。
|
||||||
|
- 前端权限编码未在 API 文档定义 → 交付明确为菜单按钮配置编码,不替代后端鉴权。
|
||||||
|
- 31 天日期窗口和不同时区 → 按实际时间戳差值校验,测试边界与非法值。
|
||||||
|
- 用户已有未提交改动 → 不碰部署文件及 package 配置,不引入新依赖。
|
||||||
|
|
||||||
|
## Validation
|
||||||
|
|
||||||
|
服务契约测试覆盖所有 17 个接口;业务测试覆盖时间范围、QPS、优先级操作、超级管理员门禁、枚举值和统计未知字段。执行 `vue-tsc --noEmit`、Vite 构建、针对性 lint/格式/编码检查。没有真实后端响应时,明确区分本地 mock 验证与线上联调。
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
# Change: 网关限流管理前端接入
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
`docs/网关限流.md` 新增 17 个管理端接口,当前前端缺少网关限流组、上游错误分类、全局停复机记录及按运营商统计的入口。需要完整接入已定义契约,并在交付时提供普通账号需要配置的菜单与按钮权限,不列出仅超级管理员的操作。
|
||||||
|
|
||||||
|
## What Changes
|
||||||
|
|
||||||
|
- 在现有「轮询管理」下新增「停复机记录」「上游错误分类」「网关限流组」「网关调用统计」四个页面。
|
||||||
|
- 接入全部 17 个接口及类型;枚举通过 `GET /api/admin/polling-options` 获取,不把可配置枚举仅写死在前端。
|
||||||
|
- 停复机记录支持文档内筛选、分页、必填时间范围和 31 天跨度校验;单卡信息及设备绑定卡提供单卡历史入口,使用卡 ID 请求新接口。
|
||||||
|
- 分类规则支持分页筛选、测试现有规则和草稿;限流组支持分页筛选和详情。新建、修改、启停、删除均仅向超级管理员开放,并在操作函数中再次检查身份。
|
||||||
|
- 限流组表单校验 QPS、预留额度与高优先级操作的关系,删除和启停提供确认与防重复提交。
|
||||||
|
- 网关统计支持账户汇总及账户趋势查询,校验各接口时间参数。
|
||||||
|
- 接入路由别名、静态路由和现有后端菜单模式;使用 `xxx:xxx` 格式前端权限常量控制普通用户操作。
|
||||||
|
- 新增契约、参数校验、权限分支和交互回归测试,运行类型检查、构建及编码检查。
|
||||||
|
- 完工后输出菜单配置清单(名称、URL、父菜单)与按钮权限编码;清单仅保留非超级管理员专属项。
|
||||||
|
|
||||||
|
## Impact
|
||||||
|
|
||||||
|
- Affected specs: `gateway-rate-limit-management`(新增)。当前 `openspec list --specs` 无已归档规范;现有 `add-polling-priority-queue` 已完成,与本次新增页面并列,不修改其行为。
|
||||||
|
- Affected code: `src/types/api/`、`src/api/modules/`、`src/config/constants/`、`src/views/polling-management/`、`src/views/asset-management/asset-information/`、`src/router/routesAlias.ts`、`src/router/routes/asyncRoutes.ts`、`scripts/tests/`。
|
||||||
|
- 不修改网关后端限流算法、既有轮询调度、停复机执行动作;不自动创建数据库菜单,不推送 Git,不执行生产部署。
|
||||||
|
- 保留用户在 `.gitea/workflows/deploy.yaml` 与 `package.json` 的现有修改。
|
||||||
|
|
||||||
|
## Contract boundary
|
||||||
|
|
||||||
|
文档未提供统计接口 `carriers[]`、`points[]` 内部字段,仓库当前也没有 `docs/admin-openapi.yaml` 可补全。实现不得假定次数、失败率、时间戳等字段:先按实际响应提供可查看的动态字段表格/原始数据,并清楚提示契约未展开;有真实字段样例后才绘制业务趋势图。不得用虚构字段或零值冒充统计结果。
|
||||||
|
|
||||||
|
权限编码是前端配置约定,并非接口文档声明的后端权限;实际授权仍由后端控制。仅超级管理员限制必须依据现有 `userStore.isSuperAdmin`,不能通过配置普通按钮权限绕过。
|
||||||
|
|
||||||
|
用户于 2026-10-24 回复「直接执行」,已批准按此范围实施。
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: 停复机记录查询
|
||||||
|
|
||||||
|
The frontend SHALL provide global stop/resume records and single-card history using the two documented admin APIs. Global queries MUST include RFC3339 `start_time` and `end_time` with an ordered range no greater than 31 days, all documented optional filters and pagination of at most 100 rows. Single-card history MUST use the card ID rather than ICCID or device ID.
|
||||||
|
|
||||||
|
#### Scenario: 查询全局记录
|
||||||
|
|
||||||
|
- **WHEN** 用户进入页面或修改筛选、页码
|
||||||
|
- **THEN** 前端 MUST 请求 `/api/admin/card-stop-resume-records`,展示记录字段及 `items/page/size/total`
|
||||||
|
- **AND** 不合法或缺失的时间区间 MUST 阻止请求并显示明确提示。
|
||||||
|
|
||||||
|
#### Scenario: 查看单卡历史
|
||||||
|
|
||||||
|
- **WHEN** 获授权用户从单卡或设备绑定卡打开历史
|
||||||
|
- **THEN** 前端 MUST 请求 `/api/admin/iot-cards/{id}/stop-resume-records`
|
||||||
|
- **AND** 无卡 ID 或无入口权限时 MUST 不请求接口,切换卡后不得残留另一张卡的结果。
|
||||||
|
|
||||||
|
### Requirement: 上游错误分类规则
|
||||||
|
|
||||||
|
The frontend SHALL implement rule listing, creation, modification, status change, deletion and non-persistent testing according to the documented fields. Rule maintenance MUST be restricted to super administrators. Testing SHALL support the current rule set and an optional valid draft, and display `matched/rule_id/category/category_name/keyword/maybe_accepted`.
|
||||||
|
|
||||||
|
#### Scenario: 普通账号测试分类
|
||||||
|
|
||||||
|
- **WHEN** 具有测试权限的用户提交操作与上游原始信息
|
||||||
|
- **THEN** 前端 MUST 调用 `/api/admin/gateway-error-classifications/test` 并展示实际命中结果
|
||||||
|
- **AND** 空信息或超过 1000 字符 MUST 不得提交,不通过增删改接口测试草稿。
|
||||||
|
|
||||||
|
#### Scenario: 超级管理员维护
|
||||||
|
|
||||||
|
- **WHEN** 超级管理员提交合法规则或确认启停、删除
|
||||||
|
- **THEN** 前端 MUST 使用对应 CRUD 或 status 接口,成功后刷新列表
|
||||||
|
- **AND** 普通账号 MUST 不显示维护入口且无法从处理函数发起维护请求。
|
||||||
|
|
||||||
|
### Requirement: 网关限流组
|
||||||
|
|
||||||
|
The frontend SHALL implement group listing, details, creation, modification, status change and deletion, including carrier/global and status filters. Maintenance MUST be restricted to super administrators. `max_qps` MUST be an integer in 1–10000, `reserved_qps` MUST be a nonnegative integer less than `max_qps`, operations MUST be nonempty, high-priority operations MUST be a subset and MUST be nonempty when reserved QPS is positive.
|
||||||
|
|
||||||
|
#### Scenario: 维护限流组
|
||||||
|
|
||||||
|
- **WHEN** 超级管理员提交限流组
|
||||||
|
- **THEN** 前端 MUST 校验文档的必填、长度、范围及操作关联约束后调用 POST 或 PUT
|
||||||
|
- **AND** 全局组 MUST 使用空账户值,不得错误提交为具体账户。
|
||||||
|
|
||||||
|
#### Scenario: 查询限流组
|
||||||
|
|
||||||
|
- **WHEN** 获授权用户查询列表或详情
|
||||||
|
- **THEN** 前端 MUST 分别调用 `/api/admin/polling-rate-limit-groups` 或 `/{id}` 并展示真实字段
|
||||||
|
- **AND** 普通账号 MUST 不能通过详情页进入维护操作。
|
||||||
|
|
||||||
|
### Requirement: 动态枚举与统计
|
||||||
|
|
||||||
|
The frontend SHALL load all seven enum collections from `/api/admin/polling-options`, and SHALL implement carrier summary and trend requests with documented parameter bounds. Undefined inner fields in `carriers` and `points` MUST be presented transparently from actual response data without invented metrics, silently substituted zeros or assumed chart series.
|
||||||
|
|
||||||
|
#### Scenario: 加载枚举
|
||||||
|
|
||||||
|
- **WHEN** 页面需要筛选、编辑或显示网关枚举
|
||||||
|
- **THEN** 前端 MUST 使用接口的 label/value,失败时提供错误反馈及重试
|
||||||
|
- **AND** 未知只读枚举值 MUST 保留原始值,不被显示为另一个已知状态。
|
||||||
|
|
||||||
|
#### Scenario: 查询汇总与趋势
|
||||||
|
|
||||||
|
- **WHEN** 用户选择合法的统计区间、运营商和聚合粒度
|
||||||
|
- **THEN** 前端 MUST 请求对应 `/api/admin/polling-stats/carriers` 或 `/{carrier_id}/trend`
|
||||||
|
- **AND** 汇总 minutes 为 1–60,趋势 minutes 不超过 10080,粒度为有效正整数,账户 0 MUST 可用
|
||||||
|
- **AND** 契约缺失的内部字段 MUST 以实际字段或原始数据展示并说明限制。
|
||||||
|
|
||||||
|
### Requirement: 菜单权限与交付
|
||||||
|
|
||||||
|
The frontend SHALL register four pages under existing polling management and honor the existing static/superadmin and backend-menu routing modes. Normal actions MUST use explicit `xxx:xxx` permissions. The handoff SHALL list menu name, URL, parent menu and button permission codes only for non-superadmin-exclusive configuration.
|
||||||
|
|
||||||
|
#### Scenario: 普通账号访问
|
||||||
|
|
||||||
|
- **WHEN** 普通账号获得相应菜单和按钮权限
|
||||||
|
- **THEN** 对应页面和普通查询、测试操作 MUST 可用
|
||||||
|
- **AND** 未授权按钮和请求 MUST 不可用,超级管理员专属维护能力 MUST 不被普通按钮权限开启。
|
||||||
|
|
||||||
|
#### Scenario: 交付配置清单
|
||||||
|
|
||||||
|
- **WHEN** 实现和验证结束
|
||||||
|
- **THEN** 交付 MUST 列出实际实现的普通菜单与按钮权限,不列出仅超级管理员专属配置
|
||||||
|
- **AND** MUST 披露未进行真实后端联调或统计字段不完整等验证限制。
|
||||||
|
|
||||||
|
### Requirement: 店铺页面一致性
|
||||||
|
|
||||||
|
The frontend SHALL reuse the shop list search, table header, column settings, fullscreen and pagination components, and the shop detail back button, title and responsive description layout. All displayed business timestamps MUST use the same `formatDateTime` formatter as the shop list. Search expansion MUST be enabled if and only if there are at least four search fields. Carrier selection MUST be a remote dropdown searched by carrier name using `/api/admin/carriers?page=1&page_size=20&carrier_name=...` while requests keep numeric IDs.
|
||||||
|
|
||||||
|
#### Scenario: 展开与时间显示
|
||||||
|
|
||||||
|
- **WHEN** 页面有少于 4 个搜索条件
|
||||||
|
- **THEN** `show-expand` MUST 为 false;4 个及以上 MUST 为 true
|
||||||
|
- **AND** 已知列表、详情及统计数据中的业务时间 MUST 展示为店铺列表相同格式,不直接显示 RFC3339 字符串。
|
||||||
|
|
||||||
|
#### Scenario: 按名称搜索运营商
|
||||||
|
|
||||||
|
- **WHEN** 用户在运营商账户下拉输入名称
|
||||||
|
- **THEN** 前端 MUST 请求 carriers 列表并携带 page=1、page_size=20、carrier_name
|
||||||
|
- **AND** 编辑回显 MUST 保留原账户名称,筛选/保存 MUST 提交所选 numeric carrier_id,趋势未解析账户 MUST 仍可选择值 0。
|
||||||
29
openspec/changes/add-gateway-rate-limit-management/tasks.md
Normal file
29
openspec/changes/add-gateway-rate-limit-management/tasks.md
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
## 1. 契约和公共能力
|
||||||
|
|
||||||
|
- [x] 1.1 确认提案并记录审批。
|
||||||
|
- [x] 1.2 新增全部接口请求、响应类型和服务方法,统一导出,复用现有认证及错误处理。
|
||||||
|
- [x] 1.3 接入动态枚举、权限常量、分页与日期/限流参数校验工具。
|
||||||
|
|
||||||
|
## 2. 页面与入口
|
||||||
|
|
||||||
|
- [x] 2.1 新增停复机记录列表,支持全部筛选字段、分页、默认最近时间段和 31 天校验。
|
||||||
|
- [x] 2.2 单卡及设备绑定卡新增停复机历史入口,使用真实卡 ID,处理权限及卡切换状态。
|
||||||
|
- [x] 2.3 新增上游错误分类页,支持列表筛选、超级管理员维护及现有规则/草稿测试结果展示。
|
||||||
|
- [x] 2.4 新增网关限流组页,支持列表、详情、超级管理员维护及关联字段校验。
|
||||||
|
- [x] 2.5 新增网关调用统计页,支持汇总、趋势参数和未定义内部字段的透明展示。
|
||||||
|
- [x] 2.6 注册路由别名、四个菜单路由及隐藏详情路由、页面权限;复用现有后端菜单解析模式。
|
||||||
|
|
||||||
|
## 3. 验证与交付
|
||||||
|
|
||||||
|
- [x] 3.1 覆盖全部服务 URL、HTTP 方法、参数和响应的契约测试。
|
||||||
|
- [x] 3.2 覆盖时间、QPS、高优先级操作子集、权限和动态枚举回归测试。
|
||||||
|
- [x] 3.3 检查加载、错误、空数据、确认、重复提交和响应式显示。
|
||||||
|
- [x] 3.4 执行类型检查、构建、相关回归测试、格式与编码检查,记录实际结果。
|
||||||
|
- [x] 3.5 交付菜单名称/URL/父菜单和按钮权限编码,仅列非超级管理员专属配置。
|
||||||
|
|
||||||
|
## 验证结果
|
||||||
|
|
||||||
|
- 全量 Node 回归 153/153 通过,其中网关新增 23 项;`vue-tsc --noEmit`、生产构建、针对性 ESLint/Stylelint、格式和 UTF-8 检查通过。
|
||||||
|
- 本地 mock 浏览器验证:列表与详情、规则测试、按运营商名称搜索、账户 0 趋势、普通账号无维护按钮及授权隐藏详情路由;375px / 768px / 1024px / 1440px 检查与局部截图复核。
|
||||||
|
- 菜单与按钮清单写入 `docs/权限.md`,本地详细接入说明位于 `docs/网关限流-前端接入说明.md`(仓库默认忽略其他 docs 文件)。
|
||||||
|
- 未进行真实后端联调、Git 推送或生产部署;统计内部字段缺失时按实际响应展示。构建仍有项目既有常量绑定、循环依赖和大 chunk 警告。
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
# Design: H5 运营弹窗配置管理(管理后台)
|
||||||
|
|
||||||
|
## 页面结构
|
||||||
|
|
||||||
|
- 设置管理下新增「H5运营弹窗配置」入口(仅超管/平台):
|
||||||
|
- 列表页 `src/views/settings/h5-popup-configuration/index.vue`
|
||||||
|
- 创建/编辑表单弹窗(复用 ArtForm + ArtSearchBar/ArtTable 模式)
|
||||||
|
- 详情以弹窗/抽屉展示完整配置
|
||||||
|
- 分页、筛选、表格沿用 ArtTable / ArtSearchBar / ArtTableHeader 与统一响应结构(`code/msg/timestamp/data`、分页 `items/page/size/total`)。
|
||||||
|
|
||||||
|
## 接口与类型
|
||||||
|
|
||||||
|
- 新增 `src/api/modules/h5PopupConfiguration.ts` 与 `src/types/api/h5PopupConfiguration.ts`:
|
||||||
|
- `GET /api/admin/h5-popup-configurations`(page/page_size/enabled,倒序分页)
|
||||||
|
- `POST /api/admin/h5-popup-configurations`(创建)
|
||||||
|
- `GET /api/admin/h5-popup-configurations/{id}`(详情)
|
||||||
|
- `PUT /api/admin/h5-popup-configurations/{id}`(更新,整表提交,版本 +1)
|
||||||
|
- `POST /api/admin/h5-popup-configurations/{id}/enable`、`{id}/disable`(请求体 `{ id }`,返回更新后配置)
|
||||||
|
- 枚举映射常量集中放置:`pages`(home/asset_detail/package_purchase/asset_wallet_recharge)、`frequency`(once/daily)、`action_type`(package_purchase/asset_wallet_recharge,空字符串 = 无)、`card_types`(CMCC/CUCC/CTCC/CBN)。
|
||||||
|
|
||||||
|
## 表单约定
|
||||||
|
|
||||||
|
- `pages` 多选必填(空数组非法);`title`(1–100)/`content`(1–2000)/`frequency`/起止时间必填。
|
||||||
|
- 范围三选器(店铺/设备类型/卡类型)空数组 = 全量,回显「全部」。
|
||||||
|
- 起止时间用 datetimerange,提交转 ISO 8601(`starts_at`/`ends_at`),`ends_at` 不得早于 `starts_at`。
|
||||||
|
- `priority` 数字输入(0–1000000);`enabled` 开关;`action_type` 下拉(含「无」选项,提交空字符串清除受控动作)。
|
||||||
|
- 编辑表单整表提交;编辑保存成功后提示「每次更新版本递增,旧版本通知保留原快照,新版本可向原命中客户按频率重新投放一次」。
|
||||||
|
- 启用/停用为行操作(停用需二次确认),以接口返回的更新后配置刷新当前行。
|
||||||
|
|
||||||
|
## 权限与可见性
|
||||||
|
|
||||||
|
- 权限码:`h5_popup_configuration:list`(菜单/列表)、`:create`、`:update`、`:enable`、`:disable`。
|
||||||
|
- 路由 `meta.permissions` + 按钮 `v-permission`/`usePermission`,仅超管/平台可见;代理/企业/个人由后端 403 兜底并原文透传失败文案。
|
||||||
|
- 不提供删除入口(文档无 DELETE 接口)。
|
||||||
|
|
||||||
|
## 待确认
|
||||||
|
|
||||||
|
- 权限编码以后端菜单配置为准(前端默认 `h5_popup_configuration:list/create/update/enable/disable`)。
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
# Change: 新增 H5 运营弹窗配置管理(管理后台)
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
H5 端(个人客户)需要在首页、资产详情、套餐购买、资产钱包充值等页面投放运营/风险弹窗,弹窗文案、命中页面、投放范围与生效规则需要后台配置。当前后台没有任何弹窗配置入口,运营只能走数据库操作。
|
||||||
|
|
||||||
|
本 Change 为管理后台新增「H5 运营弹窗配置」管理能力:配置标题与正文、命中页面、投放范围(店铺/设备类型/卡类型)、优先级、投放频率、生效时间与启停。
|
||||||
|
|
||||||
|
H5 端契约(`GET /api/c/v1/popup-candidates`、`POST /api/c/v1/risk-exchanges/{asset_id}/address`、通知列表/未读/已读接口)不在本 Change 范围,需求方已明确不处理 C 端。
|
||||||
|
|
||||||
|
## What Changes
|
||||||
|
|
||||||
|
- 新增 6 个后台接口(仅超管/平台,代理/企业/个人 403):
|
||||||
|
- `GET /api/admin/h5-popup-configurations`:配置列表,`page`(1–10000)/ `page_size`(1–100)/ `enabled` 筛选,按最近更新时间倒序分页返回 `items/page/size/total`。
|
||||||
|
- `POST /api/admin/h5-popup-configurations`:创建;`title`/`content`/`pages`/`frequency`/`starts_at`/`ends_at` 必填;`priority`/`enabled`/`action_type`/`shop_ids`/`device_types`/`card_types` 可选(范围集合空数组 = 全量)。
|
||||||
|
- `GET /api/admin/h5-popup-configurations/{id}`:详情(含 `version`、`frequency_text`、`enabled_text`、`creator`/`updater`)。
|
||||||
|
- `PUT /api/admin/h5-popup-configurations/{id}`:更新;成功即版本 +1,新版本可向原命中客户按频率重新投放一次,旧版本已投放通知的内容与快照不被改写;除 `id` 外全部字段可选,**不传保持原值**;`action_type` 传空字符串 = 清除受控动作;`shop_ids`/`device_types`/`card_types` 传空数组 = 改为全量;`pages` 传空数组非法(页面必选);`enabled` 不传保持原值(启停刷新最近更新时间);`ends_at` 不得早于 `starts_at`;`content` 1–2000 字符、`title` 1–100 字符、`priority` 0–1000000。
|
||||||
|
- `POST /api/admin/h5-popup-configurations/{id}/enable`:启用,参与候选匹配,刷新 `updated_at`(影响同优先级排序),返回更新后的配置。
|
||||||
|
- `POST /api/admin/h5-popup-configurations/{id}/disable`:停用,停止新投放,历史通知在展示期内仍可见;刷新 `updated_at`,返回更新后的配置。
|
||||||
|
- 新增「H5 运营弹窗配置」管理页(设置管理下,仅超管/平台可见):分页列表 + 创建/编辑表单 + 详情 + 行操作启用/停用。
|
||||||
|
- 前端契约约定:
|
||||||
|
- 范围集合 `shop_ids` / `device_types` / `card_types` 空数组 = 全量,列表与编辑回显「全部」。
|
||||||
|
- 枚举:`pages` = home / asset_detail / package_purchase / asset_wallet_recharge;`frequency` = once / daily;`action_type` = package_purchase / asset_wallet_recharge(空字符串 = 无受控动作);`card_types` = CMCC / CUCC / CTCC / CBN。
|
||||||
|
- 无「删除」接口,页面不提供删除入口;停用不清数据,列表保留历史配置。
|
||||||
|
- 编辑表单整表提交(所有字段都传,未传语义仅在部分更新时生效);范围清空传空数组、动作清除传空字符串、页面集合不可为空。
|
||||||
|
- 权限编码由前端确定:`h5_popup_configuration:list` / `:create` / `:update` / `:enable` / `:disable`。
|
||||||
|
|
||||||
|
## Impact
|
||||||
|
|
||||||
|
- Affected specs:
|
||||||
|
- `h5-popup-configuration-management`
|
||||||
|
- Affected code:
|
||||||
|
- `src/api/modules/h5PopupConfiguration.ts`(新增)
|
||||||
|
- `src/types/api/h5PopupConfiguration.ts`(新增)
|
||||||
|
- `src/api/modules/index.ts`、`src/types/api/index.ts`
|
||||||
|
- `src/config/constants/`(权限码常量)
|
||||||
|
- `src/router/routesAlias.ts`、`src/router/routes/asyncRoutes.ts`(设置管理下新增菜单与路由)
|
||||||
|
- `src/locales/langs/zh.json`、`src/locales/langs/en.json`
|
||||||
|
- `src/views/settings/h5-popup-configuration/`(列表、表单弹窗、详情)
|
||||||
|
- Dependencies:
|
||||||
|
- 后端按 `docs/产品迭代8月份/通知.md` 提供上述 6 接口,Bearer JWT 鉴权,代理/企业/个人 403。
|
||||||
|
- Breaking changes:
|
||||||
|
- 无;全部为新增页面、接口模块与类型。
|
||||||
|
- 待确认:
|
||||||
|
- 权限编码(前端默认 `h5_popup_configuration:list/create/update/enable/disable`)以后端菜单配置为准。
|
||||||
|
- 列表分页上限与「按最近更新时间倒序」以文档为准,联调核对后端行为。
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: H5 运营弹窗配置列表
|
||||||
|
|
||||||
|
后台 MUST 提供 H5 运营弹窗配置的分页列表(GET /api/admin/h5-popup-configurations),支持 `page`(1–10000)/ `page_size`(1–100)/ `enabled` 筛选,按最近更新时间倒序返回 `items/page/size/total`;列表项 MUST 包含标题、命中页面、范围(店铺/设备类型/卡类型)、优先级、频率(`frequency_text`)、启停(`enabled_text`)、受控动作、生效起止时间、版本、创建/更新人与时间。
|
||||||
|
|
||||||
|
#### Scenario: 按启停状态筛选并分页
|
||||||
|
|
||||||
|
- **GIVEN** 超管/平台账号进入「H5运营弹窗配置」列表
|
||||||
|
- **WHEN** 以 page/page_size/enabled 发起查询
|
||||||
|
- **THEN** 前端 MUST 展示分页结果(后端按最近更新时间倒序)
|
||||||
|
- **AND** 切换 enabled 筛选后按新条件重新请求
|
||||||
|
|
||||||
|
#### Scenario: 范围空数组显示全部
|
||||||
|
|
||||||
|
- **GIVEN** 某条配置的 shop_ids/device_types/card_types 为空数组
|
||||||
|
- **THEN** 列表 MUST 在范围列展示「全部」
|
||||||
|
|
||||||
|
#### Scenario: 越权访问
|
||||||
|
|
||||||
|
- **GIVEN** 代理/企业/个人账号访问列表接口或直达路由
|
||||||
|
- **THEN** 后端 MUST 返回 403,前端 MUST NOT 渲染入口
|
||||||
|
- **AND** 失败文案 MUST 按后端返回原文透传
|
||||||
|
|
||||||
|
### Requirement: 创建弹窗配置
|
||||||
|
|
||||||
|
后台 MUST 支持创建 H5 运营弹窗配置(POST /api/admin/h5-popup-configurations),`title`/`content`/`pages`/`frequency`/`starts_at`/`ends_at` 必填;`priority`/`enabled`/`action_type`/`shop_ids`/`device_types`/`card_types` 可选,范围集合空数组 = 全量。
|
||||||
|
|
||||||
|
#### Scenario: 必填校验
|
||||||
|
|
||||||
|
- **GIVEN** 用户提交创建表单
|
||||||
|
- **WHEN** title/content/pages/frequency/starts_at/ends_at 任一缺失
|
||||||
|
- **THEN** 前端 MUST 拦截并提示必填,MUST NOT 发送请求
|
||||||
|
|
||||||
|
#### Scenario: 范围集合为空数组表示全量
|
||||||
|
|
||||||
|
- **GIVEN** 用户未选择店铺/设备类型/卡类型范围
|
||||||
|
- **THEN** 请求体对应数组 MUST 传空数组,后端按全量投放处理
|
||||||
|
|
||||||
|
### Requirement: 弹窗配置详情
|
||||||
|
|
||||||
|
后台 MUST 提供弹窗配置详情(GET /api/admin/h5-popup-configurations/{id}),返回完整配置含 `version`、`frequency_text`、`enabled_text`、`creator`/`updater`。
|
||||||
|
|
||||||
|
#### Scenario: 查看详情
|
||||||
|
|
||||||
|
- **GIVEN** 用户点击列表行「详情」
|
||||||
|
- **WHEN** 请求详情成功
|
||||||
|
- **THEN** 前端 MUST 展示完整配置要素(含版本与启停/频率中文名)
|
||||||
|
|
||||||
|
### Requirement: 更新弹窗配置
|
||||||
|
|
||||||
|
后台 MUST 支持更新弹窗配置(PUT /api/admin/h5-popup-configurations/{id}),成功即版本 +1;新版本可向原命中客户按频率重新投放一次,旧版本已投放通知的内容与快照不被改写。除 `id` 外所有字段均可选,**不传保持原值**;`action_type` 传空字符串 = 清除受控动作;`shop_ids`/`device_types`/`card_types` 传空数组 = 改为全量;`pages` 传空数组非法(页面必选);`enabled` 不传保持原值(启停刷新最近更新时间);`ends_at` 不得早于 `starts_at`;`content` 1–2000 字符、`title` 1–100 字符、`priority` 0–1000000。
|
||||||
|
|
||||||
|
#### Scenario: 更新成功版本递增并重新投放
|
||||||
|
|
||||||
|
- **GIVEN** 用户保存编辑
|
||||||
|
- **WHEN** 更新成功
|
||||||
|
- **THEN** 前端 MUST 提示「每次更新版本递增,旧版本通知保留原快照,新版本可向原命中客户按频率重新投放一次」并刷新列表
|
||||||
|
- **AND** 列表/详情版本号较更新前 +1,旧版本已投放通知内容不被改写
|
||||||
|
|
||||||
|
#### Scenario: 范围清空表示改为全量
|
||||||
|
|
||||||
|
- **GIVEN** 编辑时清空某范围集合
|
||||||
|
- **THEN** 提交对应数组 MUST 为空数组,后端按全量处理
|
||||||
|
|
||||||
|
#### Scenario: 受控动作清除
|
||||||
|
|
||||||
|
- **GIVEN** 编辑时把 action_type 从 package_purchase 切换为「无」
|
||||||
|
- **THEN** 请求体 action_type MUST 传空字符串,后端清除受控动作
|
||||||
|
|
||||||
|
#### Scenario: 页面集合不得为空
|
||||||
|
|
||||||
|
- **GIVEN** 编辑时清空全部命中页面
|
||||||
|
- **THEN** 前端 MUST 拦截提示命中页面必选,MUST NOT 传空 pages 数组
|
||||||
|
|
||||||
|
#### Scenario: 未传字段保持原值
|
||||||
|
|
||||||
|
- **GIVEN** 请求体省略某字段(如 enabled)
|
||||||
|
- **THEN** 后端 MUST 保持原值;前端编辑表单整表提交,范围清空按空数组、动作清除按空字符串处理
|
||||||
|
|
||||||
|
### Requirement: 启用与停用弹窗配置
|
||||||
|
|
||||||
|
后台 MUST 支持启用/停用弹窗配置(POST /api/admin/h5-popup-configurations/{id}/enable、/{id}/disable,请求体 `{ id }`,返回更新后的配置),停用停止新投放且历史通知在展示期内仍可见,启用参与候选匹配;两者均刷新最近更新时间(影响同优先级排序)且不递增版本。
|
||||||
|
|
||||||
|
#### Scenario: 停用需二次确认
|
||||||
|
|
||||||
|
- **GIVEN** 用户点击某启用的配置「停用」
|
||||||
|
- **WHEN** 二次确认提交
|
||||||
|
- **THEN** 前端 MUST 调用 disable 并提示「停用后停止新投放,历史通知在展示期内仍可见」
|
||||||
|
- **AND** 以返回的更新后配置刷新当前行(状态为停用、最近更新时间更新、版本不变)
|
||||||
|
|
||||||
|
#### Scenario: 启用
|
||||||
|
|
||||||
|
- **GIVEN** 用户点击某停用的配置「启用」
|
||||||
|
- **THEN** 前端 MUST 调用 enable 并提示「启用后参与候选匹配」
|
||||||
|
- **AND** 以返回的更新后配置刷新当前行(状态为启用、最近更新时间更新、版本不变)
|
||||||
|
|
||||||
|
### Requirement: 角色权限与交互约定
|
||||||
|
|
||||||
|
弹窗配置入口 MUST 仅对超级管理员与平台账号可见;前端权限码固定为 `h5_popup_configuration:list`(菜单/列表)、`:create`、`:update`、`:enable`、`:disable`;页面 MUST NOT 提供删除入口(文档无 DELETE 接口);停用不清数据,列表保留历史配置。
|
||||||
|
|
||||||
|
#### Scenario: 入口按角色隐藏
|
||||||
|
|
||||||
|
- **GIVEN** 代理/企业/个人账号登录
|
||||||
|
- **WHEN** 系统渲染菜单
|
||||||
|
- **THEN** MUST NOT 展示「H5运营弹窗配置」菜单项
|
||||||
|
|
||||||
|
#### Scenario: 按钮权限码控制
|
||||||
|
|
||||||
|
- **GIVEN** 账号具备列表权限但缺 enable/disable 权限
|
||||||
|
- **THEN** 前端 MUST 只渲染具备权限的操作按钮
|
||||||
|
|
||||||
|
#### Scenario: 不提供删除入口
|
||||||
|
|
||||||
|
- **GIVEN** 用户查看列表或详情
|
||||||
|
- **THEN** 页面 MUST NOT 出现删除操作,仅提供启用/停用
|
||||||
|
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
## 1. Contract Confirmation
|
||||||
|
|
||||||
|
- [x] 1.1 权限编码前端确定:`h5_popup_configuration:list` / `:create` / `:update` / `:enable` / `:disable`(以后端菜单配置为准)。
|
||||||
|
- [x] 1.2 更新接口语义按文档:不传保持原值;`action_type` 空串 = 清除;范围空数组 = 改全量;`pages` 空数组非法;`enabled` 不传保持原值;`ends_at` 不得早于 `starts_at`;`content` 1–2000、`title` 1–100、`priority` 0–1000000;更新成功版本 +1 且旧版本通知不被改写。
|
||||||
|
- [x] 1.3 `enable`/`disable` 请求体 `{ id }`,返回更新后的 DtoH5PopupConfigurationResponse。
|
||||||
|
- [x] 1.4 列表 `page` 1–10000、`page_size` 1–100、`enabled` 筛选,按最近更新时间倒序分页。
|
||||||
|
|
||||||
|
## 2. API And Types
|
||||||
|
|
||||||
|
- [ ] 2.1 新增 `src/api/modules/h5PopupConfiguration.ts`:列表、创建、详情、更新、启用、停用 6 个接口。
|
||||||
|
- [ ] 2.2 新增 `src/types/api/h5PopupConfiguration.ts`:请求/响应 DTO(含 pages/frequency/action_type/card_types 枚举、范围集合、version、creator/updater 等;更新语义按「不传保持原值/空数组=全量/空串=清除」注释)。
|
||||||
|
- [ ] 2.3 在 `src/api/modules/index.ts`、`src/types/api/index.ts` 导出新模块/类型。
|
||||||
|
- [ ] 2.4 对齐统一响应 `code/msg/timestamp/data` 与分页 `items/page/size/total`。
|
||||||
|
|
||||||
|
## 3. List Page
|
||||||
|
|
||||||
|
- [ ] 3.1 设置管理下新增「H5运营弹窗配置」菜单与路由(仅超管/平台可见,权限码 `h5_popup_configuration:list`)。
|
||||||
|
- [ ] 3.2 列表:`page`/`page_size`/`enabled` 筛选,分页展示,按后端倒序。
|
||||||
|
- [ ] 3.3 列:标题、命中页面、范围(店铺/设备类型/卡类型,空数组显示「全部」)、优先级、频率、启停状态、受控动作、生效起止、版本、创建/更新人与时间。
|
||||||
|
- [ ] 3.4 行操作:详情、编辑、启用/停用(停用需二次确认);无删除入口。
|
||||||
|
|
||||||
|
## 4. Create / Edit / Detail
|
||||||
|
|
||||||
|
- [ ] 4.1 创建表单:`title`/`content`/`pages` 多选/`frequency`/起止时间必填校验(pages 非空);`priority`/`enabled`/`action_type`/范围可选。
|
||||||
|
- [ ] 4.2 范围集合 `shop_ids`/`device_types`/`card_types` 空数组 = 全量;编辑读回空数组显示「全部」。
|
||||||
|
- [ ] 4.3 编辑表单整表提交;保存成功提示「每次更新版本递增,旧版本通知保留原快照,新版本可向原命中客户按频率重新投放一次」。
|
||||||
|
- [ ] 4.4 编辑支持 `action_type` 清空(「无」→ 空字符串)与 `ends_at` 不早于 `starts_at` 的前端校验。
|
||||||
|
- [ ] 4.5 详情(弹窗/抽屉)展示完整配置(含 version、frequency_text、enabled_text、creator/updater)。
|
||||||
|
|
||||||
|
## 5. Permissions And UX
|
||||||
|
|
||||||
|
- [ ] 5.1 按钮/入口按 `h5_popup_configuration:list/create/update/enable/disable` 接入 `usePermission`/`v-permission`,无权限不渲染。
|
||||||
|
- [ ] 5.2 固定提示:停用「停用后停止新投放,历史通知在展示期内仍可见」;启用「启用后参与候选匹配」;403 文案原文透传。
|
||||||
|
- [ ] 5.3 表单校验与请求失败提示稳定,不破坏列表渲染。
|
||||||
|
|
||||||
|
## 6. Verification
|
||||||
|
|
||||||
|
- [ ] 6.1 `vue-tsc --noEmit` 与新增文件 eslint 通过。
|
||||||
|
- [ ] 6.2 列表筛选/分页/倒序展示正确。
|
||||||
|
- [ ] 6.3 创建必填校验、范围全量语义、编辑版本 +1 提示正确。
|
||||||
|
- [ ] 6.4 启用/停用流程与提示正确;停用不清数据;启停不递增版本、刷新最近更新时间。
|
||||||
|
- [ ] 6.5 代理/企业/个人看不到入口;直达路由 403 文案透传。
|
||||||
|
- [ ] 6.6 联调:编辑整表提交后版本 +1、启停返回完整配置并刷新行;`ends_at` 早于 `starts_at` 被后端拒绝。
|
||||||
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 手工验证有/无审批实例、线上/线下充值、权限开关等场景
|
||||||
70
openspec/changes/add-notification-center/design.md
Normal file
70
openspec/changes/add-notification-center/design.md
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
## Context
|
||||||
|
|
||||||
|
系统已经存在 `ArtNotification` 顶部通知组件,但组件中的通知、消息和待办列表都是静态数据,顶部通知按钮处于注释状态。新的通知能力需要同时服务顶部快速查看和完整通知中心,并确保用户在任一入口执行已读操作后未读数与列表状态一致。
|
||||||
|
|
||||||
|
## Goals / Non-Goals
|
||||||
|
|
||||||
|
- Goals: 提供余额预警、临期提醒、审批结果和系统告警统一的站内通知入口。
|
||||||
|
- Goals: 在顶部快速查看最近 10 条通知,并提供进入通知中心的入口。
|
||||||
|
- Goals: 支持通知分类、类型、严重级别和已读状态筛选。
|
||||||
|
- Goals: 将通知点击导航限制在前端认可的业务目标内,禁止任意 URL 跳转。
|
||||||
|
- Goals: 单条已读、全部已读、抽屉和通知中心共享同一份未读状态。
|
||||||
|
- Non-Goals: 不实现 C 端通知页面。
|
||||||
|
- Non-Goals: 不实现推送通道或服务端通知生成规则。
|
||||||
|
- Non-Goals: 不让前端根据通知正文推断跳转地址。
|
||||||
|
|
||||||
|
## Decisions
|
||||||
|
|
||||||
|
- Decision: 通知铃铛放在顶部全局导航的设置按钮和用户头像菜单附近。
|
||||||
|
- Rationale: 该区域已承载全局设置和用户级入口,适合放置跨页面可访问的通知入口,也符合产品指定位置。
|
||||||
|
|
||||||
|
- Decision: 顶部抽屉只加载最近 10 条,完整通知中心使用独立路由 `/notifications`。
|
||||||
|
- Rationale: 顶部入口保持轻量,筛选和完整历史查询放在独立页面,避免挤占全局导航空间。
|
||||||
|
|
||||||
|
- Decision: 未读数使用独立接口获取,单条通知和全部已读成功后立即更新本地共享状态,并以接口返回值为最终结果。
|
||||||
|
- Rationale: 未读数是全局状态,不能依赖当前抽屉或列表的局部数量推导。
|
||||||
|
|
||||||
|
- Decision: 点击通知先调用单条已读接口,再调用目标接口,根据返回的受控 route name/route params 跳转。
|
||||||
|
- Rationale: 已读状态必须在导航前落库,目标由后端业务引用解析,前端不执行通知携带的任意 URL。
|
||||||
|
|
||||||
|
- Decision: 未知 `ref_type` 或目标接口无可用目标时只展示通知正文和状态,不跳转。
|
||||||
|
- Rationale: 保证安全,同时让无法关联页面的系统通知仍然可读。
|
||||||
|
|
||||||
|
- Decision: `unread-summary` 为顶部抽屉分类提供数据,`notifications` 为通知中心筛选列表提供数据。
|
||||||
|
- Rationale: 顶部快速查看与完整列表的数据量和筛选职责不同,避免顶部加载完整历史数据。
|
||||||
|
|
||||||
|
## Data Contract
|
||||||
|
|
||||||
|
- Notification item: id, title, content, category, type, severity, read status, created time and optional `ref_type`/reference ID.
|
||||||
|
- Unread count: non-negative integer; frontend formats it as `0`, `1`-`99` or `99+`.
|
||||||
|
- Unread summary: category counts and recent notification items, limited to the latest 10 items for the drawer.
|
||||||
|
- Notification list: paginated items plus total count, with category, type, severity and read-state filters.
|
||||||
|
- Target response: controlled internal route information, such as route name/path and route params; no arbitrary executable URL.
|
||||||
|
|
||||||
|
## Risks / Trade-offs
|
||||||
|
|
||||||
|
- Risk: 后端通知字段或枚举名称与文档不一致。
|
||||||
|
- Mitigation: 在任务阶段先确认字段契约,类型层保留稳定的可选字段和未知值占位展示。
|
||||||
|
|
||||||
|
- Risk: 用户在多个标签页同时读通知,单页本地未读数短暂不一致。
|
||||||
|
- Mitigation: 操作成功后刷新未读数和当前列表;跨标签实时同步不作为本期强制目标。
|
||||||
|
|
||||||
|
- Risk: 目标记录已删除或用户权限发生变化。
|
||||||
|
- Mitigation: 目标接口返回不可跳转时只展示正文,并处理权限/不存在状态,不回退到任意 URL。
|
||||||
|
|
||||||
|
## Migration Plan
|
||||||
|
|
||||||
|
1. 确认通知列表、摘要、未读数和目标接口字段及枚举。
|
||||||
|
2. 新增通知 API service、类型和共享状态。
|
||||||
|
3. 将顶部通知按钮放入设置/头像区域,接入未读数和最近通知抽屉。
|
||||||
|
4. 新增 `/notifications` 路由及通知中心页面。
|
||||||
|
5. 实现筛选、单条已读、全部已读和受控目标跳转。
|
||||||
|
6. 删除或替换 `ArtNotification` 中的静态 mock 数据,并验证四类通知展示一致。
|
||||||
|
|
||||||
|
## Open Questions
|
||||||
|
|
||||||
|
- 通知中心是否需要分页参数名称 `page/page_size`,以及默认每页数量需要后端确认。
|
||||||
|
- `category`、`type`、`severity` 和 `read_status` 的枚举值及展示名称需要后端确认。
|
||||||
|
- 目标接口返回 route name、path 还是 route key + params,需要与路由菜单契约确认。
|
||||||
|
- 未读数是否需要页面进入时定时刷新或仅在打开抽屉/完成操作时刷新,本期默认按接口调用时机刷新。
|
||||||
|
- 通知中心菜单权限和按钮权限编码需要后端权限表确认。
|
||||||
46
openspec/changes/add-notification-center/proposal.md
Normal file
46
openspec/changes/add-notification-center/proposal.md
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
# Change: 顶部通知铃铛与站内通知中心
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
当前顶部通知组件仍使用硬编码 mock 数据,通知按钮也未启用,运营人员无法统一查看余额预警、临期提醒、审批结果和系统告警。需要建立真实的站内通知数据链路,并在全局导航和通知中心之间保持未读状态同步。
|
||||||
|
|
||||||
|
## What Changes
|
||||||
|
|
||||||
|
- 在顶部全局导航的设置按钮与用户头像入口区域增加通知铃铛。
|
||||||
|
- 铃铛展示未读数量,统一格式为 `0`、`1`~`99` 或 `99+`。
|
||||||
|
- 点击铃铛展示最近 10 条通知抽屉,支持全部、审批、临期、同步/系统分类。
|
||||||
|
- 抽屉提供进入 `/notifications` 通知中心的入口。
|
||||||
|
- 新增通知中心页面,支持分类、通知类型、严重级别、已读状态筛选和全部已读。
|
||||||
|
- 点击通知时先调用标记已读接口,再根据受控 `ref_type` 获取目标并跳转;未知目标只展示通知正文,不执行任意 URL 跳转。
|
||||||
|
- 接入未读数、未读摘要、通知列表、单条已读和全部已读接口。
|
||||||
|
- 替换现有 `ArtNotification` 硬编码 mock 数据实现,并复用现有顶部布局和设置/头像区域的视觉位置。
|
||||||
|
|
||||||
|
## Impact
|
||||||
|
|
||||||
|
- Affected specs:
|
||||||
|
- `notification-center`
|
||||||
|
- Affected code:
|
||||||
|
- `src/components/core/layouts/art-header-bar/index.vue`
|
||||||
|
- `src/components/core/layouts/art-notification/index.vue`
|
||||||
|
- `src/components/core/layouts/art-notification/style.scss`
|
||||||
|
- `src/views/notifications/index.vue`
|
||||||
|
- `src/api/modules/notification.ts`
|
||||||
|
- `src/types/api/notification.ts`
|
||||||
|
- 路由、菜单和通知相关权限配置
|
||||||
|
- API contracts:
|
||||||
|
- `GET /api/admin/notifications/unread-count`
|
||||||
|
- `GET /api/admin/notifications/unread-summary`
|
||||||
|
- `GET /api/admin/notifications`
|
||||||
|
- `PUT /api/admin/notifications/{id}/read`
|
||||||
|
- `PUT /api/admin/notifications/read-all`
|
||||||
|
- `GET /api/admin/notifications/{id}/target`
|
||||||
|
- Dependencies:
|
||||||
|
- 后端按当前用户返回通知数据、未读统计和受控跳转目标。
|
||||||
|
- 后端明确通知分类、类型、严重级别、已读状态和 `ref_type` 枚举。
|
||||||
|
- 目标接口不得返回可被前端直接执行的任意外部 URL。
|
||||||
|
- Out of scope:
|
||||||
|
- C 端 `/api/c/v1/notifications` 接口和页面。
|
||||||
|
- 前端创建、编辑或删除通知。
|
||||||
|
- 浏览器推送、WebSocket 或轮询之外的实时推送机制。
|
||||||
|
- Breaking changes:
|
||||||
|
- 现有 `ArtNotification` mock 通知数据和无效的空操作按钮将被真实通知数据及接口行为替换。
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
## ADDED 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 recent notification drawer
|
||||||
|
|
||||||
|
- **WHEN** 用户点击顶部通知铃铛
|
||||||
|
- **THEN** 页面 MUST display the latest 10 notifications from the unread summary contract
|
||||||
|
- **AND** 抽屉 MUST provide 全部、审批、临期、同步/系统分类
|
||||||
|
- **AND** 抽屉 MUST provide an entry to `/notifications`
|
||||||
|
|
||||||
|
### Requirement: Notification Center Filtering
|
||||||
|
|
||||||
|
The admin frontend SHALL provide a `/notifications` notification center with server-backed filtering.
|
||||||
|
|
||||||
|
#### Scenario: Filter notifications
|
||||||
|
|
||||||
|
- **WHEN** 用户打开通知中心或调整筛选条件
|
||||||
|
- **THEN** 页面 MUST support category, notification type, severity and read-state filters
|
||||||
|
- **AND** 页面 MUST load results from `GET /api/admin/notifications`
|
||||||
|
- **AND** 页面 MUST display notification title, content, category, severity, read state and created time
|
||||||
|
|
||||||
|
#### Scenario: Mark all notifications read
|
||||||
|
|
||||||
|
- **WHEN** 用户点击全部已读
|
||||||
|
- **THEN** 页面 MUST call `PUT /api/admin/notifications/read-all`
|
||||||
|
- **AND** 页面 MUST refresh the unread count and visible notification read states after success
|
||||||
|
|
||||||
|
### Requirement: Notification Read State Synchronization
|
||||||
|
|
||||||
|
The notification drawer and notification center SHALL keep read state and unread count synchronized with the backend.
|
||||||
|
|
||||||
|
#### Scenario: Mark a notification read
|
||||||
|
|
||||||
|
- **WHEN** 用户点击一条未读通知
|
||||||
|
- **THEN** 页面 MUST call `PUT /api/admin/notifications/{id}/read` before navigation
|
||||||
|
- **AND** 页面 MUST refresh or update the shared unread count after the read request succeeds
|
||||||
|
|
||||||
|
#### Scenario: Preserve read state after refresh
|
||||||
|
|
||||||
|
- **GIVEN** 用户已完成单条已读或全部已读操作
|
||||||
|
- **WHEN** 用户关闭抽屉、切换页面或刷新通知中心
|
||||||
|
- **THEN** 页面 MUST use the latest backend response rather than restoring stale local unread state
|
||||||
|
|
||||||
|
### Requirement: Controlled Notification Navigation
|
||||||
|
|
||||||
|
The admin frontend SHALL navigate from notifications only through controlled internal targets.
|
||||||
|
|
||||||
|
#### Scenario: Navigate to a valid notification target
|
||||||
|
|
||||||
|
- **GIVEN** 通知包含受支持的 `ref_type` 或业务引用
|
||||||
|
- **WHEN** 单条已读成功后页面请求 `GET /api/admin/notifications/{id}/target`
|
||||||
|
- **THEN** 页面 MUST navigate only to a target recognized by the frontend route table
|
||||||
|
- **AND** 页面 MUST preserve the target route parameters returned by the backend
|
||||||
|
|
||||||
|
#### Scenario: Handle an unknown target safely
|
||||||
|
|
||||||
|
- **GIVEN** 通知的 `ref_type` 未知、目标已删除或目标无权限
|
||||||
|
- **WHEN** 页面处理通知点击
|
||||||
|
- **THEN** 页面 MUST not navigate to an arbitrary URL
|
||||||
|
- **AND** 页面 MUST still display the notification content and a stable unavailable-target state
|
||||||
|
|
||||||
|
### Requirement: Consistent Notification Categories
|
||||||
|
|
||||||
|
The notification drawer and notification center SHALL present balance warnings, expiry reminders, approval results and system alerts through the same notification data contract.
|
||||||
|
|
||||||
|
#### Scenario: Display supported notification types
|
||||||
|
|
||||||
|
- **GIVEN** 后端返回余额预警、临期提醒、审批结果或系统告警
|
||||||
|
- **WHEN** 用户查看抽屉或通知中心
|
||||||
|
- **THEN** 页面 MUST display each item using its backend category, type and severity
|
||||||
|
- **AND** 页面 MUST not replace the item with hardcoded mock notification content
|
||||||
39
openspec/changes/add-notification-center/tasks.md
Normal file
39
openspec/changes/add-notification-center/tasks.md
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
## 1. Contract And Types
|
||||||
|
|
||||||
|
- [x] 1.1 按产品文档落地通知项、未读统计、未读摘要、分页列表和受控目标响应字段。
|
||||||
|
- [x] 1.2 按产品文档落地分类、通知类型、严重级别、已读状态和 `ref_type` 兼容类型。
|
||||||
|
- [x] 1.3 新增通知中心菜单权限 `notifications:view`、单条已读权限 `notifications:read`、全部已读权限 `notifications:read_all`。
|
||||||
|
- [x] 1.4 新增 `notification.ts` API service,覆盖未读数、摘要、列表、单条已读、全部已读和目标接口。
|
||||||
|
- [x] 1.5 新增通知实体、筛选参数、分页响应和目标响应类型。
|
||||||
|
|
||||||
|
## 2. Global Header And Drawer
|
||||||
|
|
||||||
|
- [x] 2.1 在顶部设置按钮与用户头像入口区域增加通知铃铛。
|
||||||
|
- [x] 2.2 实现未读数量格式化为 `0`、`1`~`99` 或 `99+`。
|
||||||
|
- [x] 2.3 顶部抽屉加载最近 10 条通知,并按全部、审批、临期、同步/系统分类展示。
|
||||||
|
- [x] 2.4 替换 `ArtNotification` 静态 mock 数据,接入真实摘要接口。
|
||||||
|
- [x] 2.5 提供进入 `/notifications` 通知中心的入口,并保证桌面端和移动端布局可用。
|
||||||
|
|
||||||
|
## 3. Notification Center
|
||||||
|
|
||||||
|
- [x] 3.1 新增 `/notifications` 路由和通知中心页面。
|
||||||
|
- [x] 3.2 支持分类、通知类型、严重级别和已读状态筛选。
|
||||||
|
- [x] 3.3 展示通知标题、正文、严重级别、分类、时间和已读状态。
|
||||||
|
- [x] 3.4 实现全部已读,并在成功后同步未读数和列表状态。
|
||||||
|
- [x] 3.5 处理空列表、加载失败、权限失败和未知枚举值的稳定展示。
|
||||||
|
|
||||||
|
## 4. Read And Controlled Navigation
|
||||||
|
|
||||||
|
- [x] 4.1 点击通知时先调用 `PUT /api/admin/notifications/{id}/read`。
|
||||||
|
- [x] 4.2 已读成功后调用 `GET /api/admin/notifications/{id}/target` 获取受控目标。
|
||||||
|
- [x] 4.3 仅允许跳转到后端返回且前端路由表认可的内部目标。
|
||||||
|
- [x] 4.4 未知 `ref_type`、目标不存在或无权限时只展示正文,不执行任意 URL 跳转。
|
||||||
|
- [x] 4.5 抽屉和通知中心的已读操作后刷新共享未读数。
|
||||||
|
|
||||||
|
## 5. Verification
|
||||||
|
|
||||||
|
- [x] 5.1 验证余额、临期、审批和系统通知在抽屉及通知中心展示一致。
|
||||||
|
- [x] 5.2 验证未读数在单条已读、全部已读、抽屉关闭和页面刷新后与接口结果一致。
|
||||||
|
- [x] 5.3 验证通知点击不会跳转到任意外部或未注册 URL。
|
||||||
|
- [x] 5.4 验证未知目标通知仍可查看正文且不会阻塞其他通知操作。
|
||||||
|
- [x] 5.5 运行类型检查、lint、相关测试和构建。
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
# Design: 新增运营报表模块并迁移时间筛选参数
|
||||||
|
|
||||||
|
## Context
|
||||||
|
|
||||||
|
- 接口文档 `docs/产品迭代8月份/前端接口简版汇总.md` 只给出指标中文名,未给出 JSON 字段名;`默认模块.openapi.json` 不包含 `operations-reports`。
|
||||||
|
- 项目已有 ECharts 封装(`useChart` / `ArtLineChart` / `ArtBarChart`)与导出任务轮询(`useAsyncTaskPolling` + `ExportTaskService`),应复用而非新建。
|
||||||
|
- 其余列表的时间参数迁移属于参数重命名,不改变页面交互。
|
||||||
|
|
||||||
|
## Goals / Non-Goals
|
||||||
|
|
||||||
|
- Goals: 报表页可用、参数迁移后筛选生效、导出复用既有异步任务链路。
|
||||||
|
- Non-Goals: 不改动后端、不新增后端字段定义;不重构既有导出任务中心。
|
||||||
|
|
||||||
|
## Decisions
|
||||||
|
|
||||||
|
### 指标字段以「防御性可选类型 + 集中列配置」实现
|
||||||
|
|
||||||
|
由于接口未提供字段名,`operationsReport.ts` 的指标字段统一声明为可选,并保留 `[key: string]: unknown` 索引签名;所有列定义集中在 `src/views/operations-reports/constants.ts`。后端字段名如与推断不同,只需改一处常量即可,不改模板与请求逻辑。
|
||||||
|
|
||||||
|
- 比率/卡均类指标:`number | null`,`null` 渲染为 `-`,否则固定两位小数。
|
||||||
|
- 汇总响应的 `totals` 用于「全部」分组与合计行;`has_snapshot=false` 时展示空态。
|
||||||
|
|
||||||
|
### 趋势图使用项目既有 ECharts 体系
|
||||||
|
|
||||||
|
`OperationsTrendChart.vue` 基于 `useChart` 初始化,props 接收 `categories` 与多 `series`(含 `type`/`yAxisIndex` 以支持比率走次坐标轴),`watch` 深度监听后 `setOption`,卸载时 dispose。
|
||||||
|
|
||||||
|
### 导出复用异步任务轮询
|
||||||
|
|
||||||
|
导出接口仅返回任务信息(`task_id/task_no/status/...`)。页面调用 `useAsyncTaskPolling`(`fetchTask` = `ExportTaskService.getExportTaskDetail`)轮询,终态后提供下载;403 透传为无权限提示。每个页面使用独立 `storageKey` 避免互相串扰。
|
||||||
|
|
||||||
|
### 路由与访问控制
|
||||||
|
|
||||||
|
在 `asyncRoutes` 新增顶层 `/operations-reports`(`component: RoutesAlias.Home`)与两个子路由;`meta.allowedUserTypes` 限制为超管/平台(沿用现有权限门禁机制)。菜单标题使用中文字面量,与现有静态业务页保持一致。
|
||||||
|
|
||||||
|
## Risks / Trade-offs
|
||||||
|
|
||||||
|
- 指标字段名未经后端确认 → 通过集中常量降低风险,联调时单点修正。
|
||||||
|
- 报表页可能返回大量行 → 首版不做虚拟滚动,依赖后端分页/汇总;后续按需优化。
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
# Change: 新增运营报表模块并迁移时间筛选参数
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
后端新增「运营报表」接口(设备激活汇总/趋势/导出、套餐续费汇总/趋势/导出),前端目前既没有对应 API 封装也没有任何页面。同时,多个列表接口的时间筛选参数统一变更为 `start_time`/`end_time`(RFC3339 带时区、闭区间),旧参数(`created_at_start/end`、`expires_from/to`、`start_date/end_date`)将返回 `1001`,前端必须同步迁移,否则相关页面筛选会失效。
|
||||||
|
|
||||||
|
## What Changes
|
||||||
|
|
||||||
|
- 新增 `OperationsReportsService` API 模块及对应类型定义,封装 4 个查询接口与 2 个导出接口。
|
||||||
|
- 新增顶层菜单「运营报表」,含「设备激活报表」「套餐续费报表」两个子页;每页提供时间/分组筛选、汇总表格、趋势图与异步导出。
|
||||||
|
- 运营报表仅超级管理员/平台账号可访问,其他账号返回 `403`。
|
||||||
|
- 换货单列表、资产分配记录、代理充值订单、临期资产列表时间筛选参数迁移为 `start_time`/`end_time`。
|
||||||
|
- 新增临期资产导出接口 `POST /api/admin/expiring-assets/export`(复用列表筛选参数 + `format: 'xlsx'`,异步任务)。
|
||||||
|
- 汇总比率、卡均保留两位小数,分母为零或无快照时显示 `-`;无快照时展示空态。
|
||||||
|
|
||||||
|
## Impact
|
||||||
|
|
||||||
|
- Affected specs: `operations-reports`(新增)、`time-filter-conventions`(新增)
|
||||||
|
- Affected code:
|
||||||
|
- `src/api/modules/operationsReports.ts`(新增)、`src/api/modules/index.ts`
|
||||||
|
- `src/types/api/operationsReport.ts`(新增)、`src/types/api/index.ts`
|
||||||
|
- `src/views/operations-reports/activation/index.vue`、`src/views/operations-reports/renewal/index.vue`、`src/views/operations-reports/components/OperationsTrendChart.vue`、`src/views/operations-reports/constants.ts`(新增)
|
||||||
|
- `src/router/routesAlias.ts`、`src/router/routes/asyncRoutes.ts`
|
||||||
|
- `src/api/modules/exchange.ts`、`src/views/asset-management/exchange-management/index.vue`
|
||||||
|
- `src/types/api/card.ts`、`src/views/asset-management/record-management/asset-assign/index.vue`
|
||||||
|
- `src/types/api/agentRecharge.ts`、`src/views/finance/agent-recharge/index.vue`
|
||||||
|
- `src/types/api/asset.ts`、`src/api/modules/asset.ts`、`src/views/asset-management/expiring-assets/index.vue`
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: 运营报表 API 服务
|
||||||
|
|
||||||
|
系统 SHALL 提供 `OperationsReportsService` 封装运营报表 6 个接口:
|
||||||
|
|
||||||
|
- 查询设备激活汇总 `GET /api/admin/operations-reports/activation-summary`
|
||||||
|
- 查询设备激活趋势 `GET /api/admin/operations-reports/activation-trend`
|
||||||
|
- 导出设备激活汇总 `POST /api/admin/operations-reports/activation-summary/export`
|
||||||
|
- 查询套餐续费汇总 `GET /api/admin/operations-reports/package-renewal-summary`
|
||||||
|
- 查询套餐续费趋势 `GET /api/admin/operations-reports/package-renewal-trend`
|
||||||
|
- 导出套餐续费汇总 `POST /api/admin/operations-reports/package-renewal-summary/export`
|
||||||
|
|
||||||
|
查询参数 SHALL 使用 `start_time`/`end_time`(RFC3339 秒级带时区)与 `group_by`;趋势查询额外支持 `granularity`(`day|month`,默认 `day`)。导出请求 SHALL 携带 `format`(`xlsx`)。
|
||||||
|
|
||||||
|
#### Scenario: 查询设备激活汇总
|
||||||
|
|
||||||
|
- **WHEN** 调用 `OperationsReportsService.getActivationSummary({ start_time, end_time, group_by })`
|
||||||
|
- **THEN** 返回包含 `group_by`、`group_name`、`has_snapshot`、`snapshot_dates`、`items`、`totals` 的响应
|
||||||
|
|
||||||
|
#### Scenario: 导出设备激活汇总
|
||||||
|
|
||||||
|
- **WHEN** 调用 `OperationsReportsService.exportActivationSummary({ format: 'xlsx', start_time, end_time, group_by })`
|
||||||
|
- **THEN** 返回包含 `task_id`、`task_no`、`status`、`status_name`、`message` 的异步任务信息
|
||||||
|
|
||||||
|
### Requirement: 运营报表页面
|
||||||
|
|
||||||
|
系统 SHALL 提供顶层菜单「运营报表」及两个子页「设备激活报表」「套餐续费报表」。每页 SHALL 包含时间范围与分组筛选、汇总表格、趋势图和导出按钮。
|
||||||
|
|
||||||
|
#### Scenario: 查询汇总并渲染表格
|
||||||
|
|
||||||
|
- **WHEN** 用户选择时间范围与分组后点击查询
|
||||||
|
- **THEN** 请求对应汇总接口并以表格展示各分组指标与合计行
|
||||||
|
|
||||||
|
#### Scenario: 渲染趋势图
|
||||||
|
|
||||||
|
- **WHEN** 汇总数据加载成功
|
||||||
|
- **THEN** 趋势图按 `granularity`(日/月)以时间点为横轴展示关键指标曲线
|
||||||
|
|
||||||
|
#### Scenario: 导出报表
|
||||||
|
|
||||||
|
- **WHEN** 用户点击导出并成功创建异步任务
|
||||||
|
- **THEN** 前端轮询任务状态,任务完成后可下载文件
|
||||||
|
|
||||||
|
### Requirement: 运营报表访问控制与空态
|
||||||
|
|
||||||
|
运营报表 SHALL 仅对超级管理员/平台账号开放,其他账号访问 SHALL 返回 `403`。比率与卡均指标 SHALL 保留两位小数;分母为零时返回 `null`,页面显示 `-`。无快照时 `has_snapshot=false`、`totals=null`、`items=[]`,页面 SHALL 展示空态而非报错。
|
||||||
|
|
||||||
|
#### Scenario: 无快照
|
||||||
|
|
||||||
|
- **WHEN** 汇总响应 `has_snapshot` 为 `false`
|
||||||
|
- **THEN** 页面展示空态
|
||||||
|
|
||||||
|
#### Scenario: 比率分母为零
|
||||||
|
|
||||||
|
- **WHEN** `activation_rate` 或 `renewal_rate` 为 `null`
|
||||||
|
- **THEN** 表格对应单元格显示 `-`
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: 列表时间筛选参数统一
|
||||||
|
|
||||||
|
以下列表接口的时间筛选参数 SHALL 统一为 `start_time`/`end_time`(RFC3339 秒级、闭区间),前端不得再发送旧参数:
|
||||||
|
|
||||||
|
- 换货单列表 `GET /api/admin/exchanges`(由 `created_at_start`/`created_at_end` 迁移)
|
||||||
|
- 资产分配记录 `GET /api/admin/asset-allocation-records`(由 `created_at_start`/`created_at_end` 迁移)
|
||||||
|
- 代理充值订单 `GET /api/admin/agent-recharges`(由 `start_date`/`end_date` 迁移,取消按日自动补齐首尾秒)
|
||||||
|
- 临期资产列表 `GET /api/admin/expiring-assets`(由 `expires_from`/`expires_to` 迁移)
|
||||||
|
|
||||||
|
#### Scenario: 换货单列表时间筛选
|
||||||
|
|
||||||
|
- **WHEN** 用户选择创建时间范围并搜索
|
||||||
|
- **THEN** 请求参数为 `start_time`/`end_time`,且不包含 `created_at_start`/`created_at_end`
|
||||||
|
|
||||||
|
#### Scenario: 代理充值订单时间筛选
|
||||||
|
|
||||||
|
- **WHEN** 用户选择时间范围并搜索或导出
|
||||||
|
- **THEN** 请求参数为 `start_time`/`end_time`,且不包含 `start_date`/`end_date`
|
||||||
|
|
||||||
|
#### Scenario: 临期资产列表时间筛选
|
||||||
|
|
||||||
|
- **WHEN** 用户选择预计到期时间范围并搜索
|
||||||
|
- **THEN** 请求参数为 `start_time`/`end_time`,且不包含 `expires_from`/`expires_to`
|
||||||
|
|
||||||
|
### Requirement: 临期资产导出
|
||||||
|
|
||||||
|
系统 SHALL 提供 `POST /api/admin/expiring-assets/export`,复用临期资产列表筛选参数并携带 `format: 'xlsx'`,返回异步导出任务信息;前端 SHALL 通过现有导出任务接口轮询并在完成后下载。
|
||||||
|
|
||||||
|
#### Scenario: 导出临期资产
|
||||||
|
|
||||||
|
- **WHEN** 用户在临期资产页面点击导出
|
||||||
|
- **THEN** 创建异步导出任务并轮询状态,完成后可下载 xlsx 文件
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
## 1. 运营报表 API 与类型
|
||||||
|
|
||||||
|
- [x] 1.1 新增 `src/types/api/operationsReport.ts`(查询、汇总、趋势、导出任务类型)
|
||||||
|
- [x] 1.2 在 `src/types/api/index.ts` 导出新类型
|
||||||
|
- [x] 1.3 新增 `src/api/modules/operationsReports.ts`(6 个接口方法)
|
||||||
|
- [x] 1.4 在 `src/api/modules/index.ts` 注册 `OperationsReportsService`
|
||||||
|
|
||||||
|
## 2. 运营报表页面
|
||||||
|
|
||||||
|
- [x] 2.1 新增 `src/views/operations-reports/constants.ts`(分组选项与指标列配置)
|
||||||
|
- [x] 2.2 新增 `src/views/operations-reports/components/OperationsTrendChart.vue`(多系列趋势图)
|
||||||
|
- [x] 2.3 新增「设备激活报表」页面(筛选 + 汇总表格 + 趋势图 + 导出)
|
||||||
|
- [x] 2.4 新增「套餐续费报表」页面(筛选 + 汇总表格 + 趋势图 + 导出)
|
||||||
|
|
||||||
|
## 3. 路由与菜单
|
||||||
|
|
||||||
|
- [x] 3.1 `routesAlias.ts` 新增两个页面别名
|
||||||
|
- [x] 3.2 `asyncRoutes.ts` 新增顶层「运营报表」菜单(含权限限制)
|
||||||
|
|
||||||
|
## 4. 时间筛选参数迁移
|
||||||
|
|
||||||
|
- [x] 4.1 换货单列表 `created_at_start/end` -> `start_time/end_time`(类型 + 页面)
|
||||||
|
- [x] 4.2 资产分配记录 `created_at_start/end` -> `start_time/end_time`(类型 + 页面)
|
||||||
|
- [x] 4.3 代理充值订单 `start_date/end_date` -> `start_time/end_time`(类型 + 页面,含导出参数)
|
||||||
|
- [x] 4.4 临期资产列表 `expires_from/to` -> `start_time/end_time`(类型 + 页面)
|
||||||
|
|
||||||
|
## 5. 临期资产导出
|
||||||
|
|
||||||
|
- [x] 5.1 `AssetService.exportExpiringAssets`(POST /api/admin/expiring-assets/export)
|
||||||
|
- [x] 5.2 临期资产页面新增「导出」按钮(筛选参数 + `format: 'xlsx'` + 异步任务轮询下载)
|
||||||
|
|
||||||
|
## 6. 验证
|
||||||
|
|
||||||
|
- [x] 6.1 运行 `eslint`、`stylelint`、`vue-tsc --noEmit`、`vite build --mode production` 均通过
|
||||||
|
- [x] 6.2 运行 `openspec validate add-operations-reports-and-time-filters --strict` 通过
|
||||||
@@ -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,26 @@
|
|||||||
|
## Context
|
||||||
|
|
||||||
|
Vue 3 / Element Plus 后台已有订单列表与详情、两处单项购买、套餐创建/分配/系列授权、资产当前/历史套餐、统一导出、企微审批与角色权限树。本次复用现有能力,延续店铺列表/详情标准、时间格式、条件 >=4 才展开和响应式。
|
||||||
|
|
||||||
|
## Decisions
|
||||||
|
|
||||||
|
- 原订单列表接收受控分类 props,三个薄路由入口使用独立名称缓存,按分类选择服务与导出场景,不在 query 注入 category。旧列表继续 all;企业路由门禁与请求/处理函数都限制,代理 online 严格禁止,后端继续鉴权。
|
||||||
|
- 企业操作限制使用公共账号类型判断;不能仅改一个 v-if:覆盖基础信息、绑定卡、当前套餐、历史套餐及父页处理函数,保留 start/stop、历史与只读数据。
|
||||||
|
- 套餐商品默认天数、单次购买覆盖天数、延期天数分别校验,不能共享错误的 90 天上限;null/空与 0 区分;加油包白名单剔除沉默期字段。原实名生效条件保存为只读基线,禁止转换为购买生效。
|
||||||
|
- 下单前冻结目标、表单字段和幂等标识;权限取消或资产/套餐切换不发送旧覆盖值。后端决定实际是否适用及是否审批,不靠前端成功提示推定立即生效。
|
||||||
|
- silence 可选且不可从其他套餐复用。当前/历史套餐分别展示各自响应;后端不返回对象时不猜测未启用与不适用的区别,不请求资格接口。
|
||||||
|
- 首次购买显示使用 formatDateTime;查询与导出共享同一范围转换,ICCID/IMEI 保持字符串。世代与结束原因由服务端返回,记录 DTO 不明时仅完成字段/筛选,记录弹窗保持待补契约。
|
||||||
|
- 使用现有预签名上传、凭证、二维码与审批组件,不引入依赖。延期付款金额必须取 quote,不能在浏览器自行按 30 天计费;未知的金额单位与 evidence_refs 结构是实现前置条件。
|
||||||
|
- 对文档只列 URL、未列 DTO 的延期页面,先列覆盖清单与契约缺口,不擅自制作可写空壳或推断财务模型。
|
||||||
|
|
||||||
|
## Validation
|
||||||
|
|
||||||
|
2026-10-28 契约补齐:保存 Apifox 的 21 个后台操作为 `docs/api/package-silence.openapi.json`;全部金额为整数分,前端元输入精确转换。首次购买记录使用 `/api/admin/assets/{asset_type}/{id}/first-purchase-records`,流水/首次购买记录为数组;政策列表也为数组但支持 page/page_size,因此显示上一页/下一页而不伪造总数。政策适用系列/套餐使用既有名称搜索接口。
|
||||||
|
|
||||||
|
特殊延期 CSV 在前端按 `package_usage_id,days` 两列解析,再以明确的 items[] 提交,不猜后端 import_file_key 的未说明文件格式。二维码/线下订单同一快照重试复用 request_id;特殊接口不定义幂等字段,结果不确定时阻止重复提交并提示核对批次。免审批场景保留真实返回的字符串,提供文档明确的 offline_paid/batch;其他编码需后端提供,不猜完整枚举。
|
||||||
|
|
||||||
|
先记录当前 198 项基线与 dirty worktree;新增精确请求/角色/字段校验及组件行为测试,覆盖企业 5 项操作但保留停复机、三分类服务、导出 false/0、套餐天数边界、购买覆盖与原因、无权限不发字段、加油包剔除、首次购买时间与空值、未知错误和 0 元退款。运行全量 Node 测试、vue-tsc、受影响文件 lint/format/encoding、生产构建与针对性本地 mock;不把不完整 DTO 的自造响应作为后端验收。
|
||||||
|
|
||||||
|
## Rollout and risks
|
||||||
|
|
||||||
|
无数据库迁移,不自动开沉默期总开关,旧订单路由/导出与现有菜单配置保留。新菜单是否可见仍需后端菜单数据授权;清单在实施后按实际 URL/权限交付。真实支付与审批、资产范围和文件内容需测试环境联调。C 端为独立工程,仅提供同步清单。
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
# 执行记录:订单分类与沉默期
|
||||||
|
|
||||||
|
## 当前结论
|
||||||
|
|
||||||
|
本后台代码已按汇总文档及用户授权的 Apifox 定义补齐,原先因缺少 DTO 挂起的延期办理、政策、批次异常和记录弹窗已实现。未修改独立 C 端,未推送、部署或调用真实业务写入;不能把本地 mock 验证等同于线上验收。
|
||||||
|
|
||||||
|
## 契约来源与差异
|
||||||
|
|
||||||
|
21 个后台操作读取自用户授权的 Apifox 分享文档,留存无密码快照 [package-silence.openapi.json](../../../docs/api/package-silence.openapi.json)。本会话通过官方 Apifox MCP Server 0.0.18 的 --oas 模式验证文档读取,不代表直接实时连接整个私有项目;线上变更后需重新读取快照。
|
||||||
|
|
||||||
|
- 所有延期金额、单价均为整数分;元输入做精确整数转换,不能使用浮点金额直接提交。
|
||||||
|
- 首次购买记录真实路径为 `GET /api/admin/assets/{asset_type}/{id}/first-purchase-records`,不是汇总里带 package-silence 前缀的路径。
|
||||||
|
- 首次购买记录、沉默期流水为数组;政策列表也是数组且有 page/page_size,因此政策页不伪造 total。
|
||||||
|
- 更新政策与启停请求含 id;特殊收款时间是 offline_paid_at,线下订单是 paid_at。
|
||||||
|
- 两个沉默期导出场景依据 orders/usages 各自文档启用,filters 与列表同范围;通用导出接口对 query 的类型为字符串值,沿用 JSON 字符串 filters。之前三类普通订单仍保留汇总明确要求的对象 filters。
|
||||||
|
|
||||||
|
## 实现覆盖
|
||||||
|
|
||||||
|
| 范围 | 已实现 |
|
||||||
|
| --- | --- |
|
||||||
|
| 分类订单 | 平台/代理/在线三页、独立精确路径与 scene、旧列表详情及历史导出保留;代理禁止 online、企业禁止普通订单 |
|
||||||
|
| 企业资产限制 | 有效期、已用量、停用、轮询、实名状态五类入口和处理函数限制;授权资产停复机保持;未找到仍为普通未找到 |
|
||||||
|
| 套餐与购买 | 商品默认 1–90 天、加油包剔除、生效条件限制;单项/批量/系列分配写前校验;两处下单覆盖无 90 天上限并有权限及原因校验 |
|
||||||
|
| 资产沉默期 | 按可选 silence 展示真实状态/截止/累计;真实 usage ID 打开延期与流水;对象缺失隐藏 |
|
||||||
|
| 扫码延期 | 资格、后端报价、wechat/alipay 二维码、确认后创建、订单刷新;终态/错误/关闭停止刷新;不复制计价算法 |
|
||||||
|
| 线下登记 | 实收元转分、与报价一致、收款方式字典、交易单号、RFC3339 付款时间、1–5 张凭证、申请依据;待审批不显示已生效 |
|
||||||
|
| 特殊与批量 | 五类特殊延期、原因/依据、优惠价收款;CSV 两列转 items[],校验表头/整数/重复 ID;批量需 extend 和 extend_batch;展示真实批次与错误行 |
|
||||||
|
| 订单与批次 | 列表/详情/筛选、订单导出;批次详情逐行异常;重试/关闭需原因及确认,关闭提示可能原路退款 |
|
||||||
|
| 临期与过期 | expiring/expired/all 视图、默认 7 天、资产/店铺/套餐/截止范围及导出;延期与流水入口 |
|
||||||
|
| 延期政策 | 列表、详情加载、新增/全量编辑、启停、匹配、重叠错误;系列/套餐名称搜索;无 DELETE 不提供删除 |
|
||||||
|
| 首次购买 | 卡/设备时间列、RFC3339 筛选/导出、资产详情;列表记录入口和只读世代历史,展示来源/订单/结束原因;不伪造绑定卡或换货时间 |
|
||||||
|
| 配置与兼容 | 专用总开关/precheck/failed_items、通用配置只读、企微审批类型、六项真实权限识别、1260–1275 提示及零元退款 |
|
||||||
|
|
||||||
|
同一二维码/线下请求快照重试使用相同 request_id,不自动重发写请求。特殊延期没有文档定义的幂等参数,传输结果不确定时阻止再次提交并提示先核对批次;不得直接修改截止时间替代异常处理。
|
||||||
|
|
||||||
|
CSV 为本地解析的 `package_usage_id,days` 两列格式,经文档 items[] 提交,未猜测后端 import_file_key 的文件格式。政策免审批场景完整枚举未在 OpenAPI 列出:提供明确的 offline_paid、batch,并保留服务端现有值;其他编码由后端提供后填写,不根据中文自行造值。批次及明细未知状态原样显示,不推断“已完成”。
|
||||||
|
|
||||||
|
## 验证
|
||||||
|
|
||||||
|
当前全量 **236 项测试通过**(保留原 198 项,上一阶段 18 项,本阶段 20 项)。覆盖 21 个精确 HTTP 操作、金额精度与 0、CSV、报价失效、权限撤销/确认取消、幂等重试、迟到响应、线下凭证与审批、特殊结果不确定防重复、政策完整提交、异常 ID/原因、导出白名单与模板编译。
|
||||||
|
|
||||||
|
类型检查、生产构建、受影响代码 ESLint/Prettier/Stylelint、UTF-8 检查通过。生产构建仍有项目既有常量 v-model、API 循环依赖及大 chunk 警告,未在本轮扩大重构。
|
||||||
|
|
||||||
|
本地浏览器使用 `127.0.0.1:5190` 全 /api 拦截 mock,核验临期状态与格式化截止时间、31 天后端试算为 60 天、提交确认及订单刷新、政策编辑与 390px 窄屏、批次异常原因确认。上一阶段三类订单/角色门禁/套餐配置/总开关 mock 检查仍保留。没有请求真实支付或审批接口。
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
$tests = @(rg --files scripts/tests -g '*.test.mjs')
|
||||||
|
node --import ./scripts/tests/register-esbuild.mjs --test --test-reporter=spec $tests
|
||||||
|
.\node_modules\.bin\vue-tsc.cmd --noEmit
|
||||||
|
node scripts/tests/verifyBuild.mjs
|
||||||
|
node scripts/tests/verifyBuild.mjs --serve --order-silence
|
||||||
|
openspec validate add-order-segmentation-and-package-silence --strict
|
||||||
|
```
|
||||||
|
|
||||||
|
## 菜单、权限和 C 端
|
||||||
|
|
||||||
|
完整菜单/URL/父菜单与普通按钮编码见 [权限清单](../../../docs/权限.md#订单分类与沉默期2026-10-28)。不列仅超管专属设置,不写入服务器菜单或伪造权限 ID。
|
||||||
|
|
||||||
|
C 端需要另行接入:可选 silence 状态/截止与 extendable 入口;资格、后端报价、自助订单/qr_content、订单状态刷新、我的延期订单和流水;总开关关闭或对象缺失隐藏入口;金额为分、不能复制计费/审批规则。对应 `/api/c/v1/package-silence`,不复用后台 URL;资产归属鉴权交给后端。本仓库未修改 C 端代码。
|
||||||
|
|
||||||
|
真实测试环境仍需验收:数据范围与权限、实际商户支付及查单、企微通过/驳回、异常关闭退款、上传文件和导出下载内容。全部检查只证明前端实现及本地契约行为,不证明后端已部署兼容。
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
# Change: 订单分类拆页与套餐沉默期后台接入
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
依据 `docs/2026-10-27-订单拆分至沉默期-前端修改汇总(1).md`,后台尚未接入订单分类列表、企业账号操作限制、套餐沉默期及延期、首次购买套餐时间。需要保留既有订单详情、付款/审批、套餐分配与资产功能,并区分前端实现和真实后端联调。
|
||||||
|
|
||||||
|
用户于 2026-10-28 明确要求“根据文档来写提案,然后执行”,本提案完成严格校验后按该授权实施。延续只修改本后台仓库的范围,不修改独立 H5/C 端,不推送或部署。工作区已有四个轮询修复文件必须保留。
|
||||||
|
|
||||||
|
## What Changes
|
||||||
|
|
||||||
|
- 订单管理新增平台、代理商、在线支付三页,复用原列表及详情、筛选、创建能力;各自请求 `/orders/platform|agent|online`,不提交类别参数,导出分别使用 `order_platform|order_agent|order_online`。保留旧列表及历史 `order` 导出。代理隐藏在线支付页,企业隐藏订单菜单并阻止页面请求;不改变后端数据范围。
|
||||||
|
- 企业账号隐藏并在处理函数阻止资产改有效期、改已用量、停用、开关轮询、改实名状态五项操作,保留授权资产的停复机及读取。未找到不改写为无权限。
|
||||||
|
- 正式套餐新增默认沉默期(1–90 天)与付费延期开关;实名即生效必填,新建默认 30 天;购买即生效可选;加油包不显示、不提交。新增未配置筛选与导出参数、详情展示;明确生效条件不可从实名改成购买,购买改实名需同请求带天数。
|
||||||
|
- 后台两处单项下单入口增加有权限才可填写的 `silence_period_days`、`silence_reason`;购买覆盖天数仅最小 1、不套用套餐配置 90 天上限,天数存在时原因必填。保留后端审批结果,不将待审批说成已延期。
|
||||||
|
- 资产当前套餐、历史套餐按可选 `silence` 对象展示状态、截止日、累计与审批信息;对象缺失时隐藏,入口按 `extendable` 与权限控制。流水使用真实 usage ID。
|
||||||
|
- 卡/设备新增首次购买时间列、RFC3339 范围筛选、导出参数、详情与只读记录弹窗;绑定卡不伪造首次购买时间,换货历史以服务端世代与结束原因展示,不在前端推算或回填。
|
||||||
|
- 新增沉默期专用开关页(仅超管),展示 `precheck` 与 1275 的 `failed_items`;通用系统配置不写此开关。增加沉默期审批业务类型与六个权限点的前端识别;角色权限树沿用服务器数据,不伪造权限 ID。
|
||||||
|
- 完整目标包含延期资格/试算/二维码、线下付款、特殊单项/批量延期、延期订单/批次异常、临期/过期清单、延期政策以及两个沉默期导出场景;金额、审批与状态均以服务端事实为准,不复制后端计费规则。
|
||||||
|
- 错误码 1260–1275 保留服务端具体原因、限制与异常行;零元退款允许提交,后台线下购买未实名套餐仍按后端待生效状态展示。
|
||||||
|
|
||||||
|
## Contract gaps and execution boundary
|
||||||
|
|
||||||
|
首次执行时,`docs/admin-openapi.yaml`、被引用的沉默期技术方案与后端规范未提供,因此对应可写业务未实施。2026-10-28 用户补充并授权带密码的 Apifox 分享文档访问后,已取得 21 个后台操作,保存为 `docs/api/package-silence.openapi.json`(不含密码)。下面四组缺口现已按该权威定义补齐,任务第 3 节已执行;真实环境支付/审批/导出仍需联调验收。
|
||||||
|
|
||||||
|
初次记录的缺口(现已由 Apifox 补齐):
|
||||||
|
|
||||||
|
1. 延期政策 POST/PUT 字段、字段类型、级别/范围/重叠规则、列表/详情响应与状态枚举。
|
||||||
|
2. 资格 options、quote、二维码及线下订单响应的字段结构、金额单位、订单 ID/状态/支付状态;超时重试的 request_id 复用约定。
|
||||||
|
3. 特殊延期优惠收款字段名、amount 与 paid_amount 单位、evidence_refs 元素结构、批量部分成功/异常响应完整结构。
|
||||||
|
4. 流水、延期订单、批次/明细、usage 清单、首次购买记录的分页结构、筛选、时间与状态字段;未定义处不得擅自命名。
|
||||||
|
|
||||||
|
执行顺序:先完成本文可确定的订单、企业限制、套餐/下单字段、首次购买字段/筛选、审批类型和错误提示;契约缺口独立保持未完成。若执行期间补齐规范,再继续完成相应延期业务。不得以全部接口存在或本地测试通过代替完整业务验收。
|
||||||
|
|
||||||
|
## Impact
|
||||||
|
|
||||||
|
- Affected specs: 新增 `order-segmentation-and-package-silence` 接入约束;当前无已发布 specs,以 ADDED 记录,不伪造 MODIFIED 基线。
|
||||||
|
- Affected code: order、packageManage、shopPackageAllocation、asset、card、device、wecom、systemConfig、exportTask 的类型/服务/界面、路由与权限、相关工具及回归测试。
|
||||||
|
- 与 `update-october-batch-one-admin-integration` 的订单支付信息、退款审批状态,以及 `update-package-allocation-expiry-base-override` 的分配覆盖保持兼容;不重置此前轮询修复。
|
||||||
|
- 不产生真实支付、审批、资产写入、导出、开关切换或 CSV 导入;写操作验证仅本地 mock。
|
||||||
|
|
||||||
|
## Delivery
|
||||||
|
|
||||||
|
交付提案、实际改动与测试证据;菜单清单给出名称、URL、父菜单、普通按钮编码,不重复列仅超管专属项;单列 C 端同步要求和确实因契约缺失未完成的工作。
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
## ADDED Requirements
|
||||||
|
|
||||||
|
### Requirement: 订单分类与角色边界
|
||||||
|
|
||||||
|
The admin frontend SHALL expose independent platform, agent and online order pages using the corresponding documented endpoints and export scenes without category query parameters. It MUST preserve legacy order history and the shared detail contract. Enterprise accounts MUST not query or mutate orders, and agents MUST not access online orders.
|
||||||
|
|
||||||
|
#### Scenario: 分类查询和导出
|
||||||
|
|
||||||
|
- **WHEN** 平台账号打开某类订单或创建该类导出
|
||||||
|
- **THEN** 请求 MUST 使用对应路径和 scene,保留原筛选,不改变订单详情接口。
|
||||||
|
|
||||||
|
#### Scenario: 不允许的账号
|
||||||
|
|
||||||
|
- **WHEN** 企业账号尝试进入订单页,或代理进入在线订单
|
||||||
|
- **THEN** 菜单和页面请求 MUST 被限制,不以按钮授权覆盖身份限制。
|
||||||
|
|
||||||
|
### Requirement: 企业资产操作限制
|
||||||
|
|
||||||
|
The frontend SHALL hide and block expiry adjustment, used-data adjustment, deactivation, polling toggle and realname-status adjustment for enterprise accounts across all existing asset entrypoints while preserving authorized start/stop and reads. A not-found asset response MUST remain ordinary not-found feedback.
|
||||||
|
|
||||||
|
#### Scenario: 已授权企业资产
|
||||||
|
|
||||||
|
- **WHEN** 企业账号查看已授权卡或设备
|
||||||
|
- **THEN** 五项禁止操作 MUST 不可见且处理函数不能提交,停复机仍按原权限可用。
|
||||||
|
|
||||||
|
### Requirement: 套餐默认沉默期与购买覆盖
|
||||||
|
|
||||||
|
The frontend SHALL distinguish package defaults (1–90 days), purchase overrides (minimum 1, no documented upper bound) and backend-priced extensions. Formal activation-based packages MUST require defaults with 30 days prefilled only for creation; addons MUST omit silence fields. Forbidden expiry-base transitions MUST be prevented where source data is known and backend rejection preserved otherwise.
|
||||||
|
|
||||||
|
#### Scenario: 默认配置
|
||||||
|
|
||||||
|
- **WHEN** 新建实名即生效正式套餐或将购买生效改为实名生效
|
||||||
|
- **THEN** 保存 MUST 携带有效 silence_period_days,不能从实名改为购买生效。
|
||||||
|
|
||||||
|
#### Scenario: 单次购买覆盖
|
||||||
|
|
||||||
|
- **WHEN** 有 override 权限的用户填写本次沉默期
|
||||||
|
- **THEN** 请求 MUST 同时包含有效天数与原因;无权限或未填写时不发覆盖字段,等待审批不能显示为已延期。
|
||||||
|
|
||||||
|
### Requirement: 可选沉默期与首次购买事实展示
|
||||||
|
|
||||||
|
The frontend SHALL show silence status and timestamps only when the server returns the applicable silence object. First-purchase timestamps SHALL remain read-only server facts with shared range filtering/export and generation history, never synthesized for bound cards or exchanges.
|
||||||
|
|
||||||
|
#### Scenario: 总开关关闭
|
||||||
|
|
||||||
|
- **WHEN** 套餐响应不包含 silence
|
||||||
|
- **THEN** 沉默期状态及延期入口 MUST 隐藏,不推算默认截止时间。
|
||||||
|
|
||||||
|
#### Scenario: 首次购买范围
|
||||||
|
|
||||||
|
- **WHEN** 用户按首次购买时间查询卡或设备并导出
|
||||||
|
- **THEN** 列表和导出 MUST 使用相同 RFC3339 范围,空时间仍显示为空且不开放修改。
|
||||||
|
|
||||||
|
### Requirement: 延期与审批使用真实后端契约
|
||||||
|
|
||||||
|
The frontend SHALL use documented eligibility, quote, payment, special extension, policy, batch and history contracts. Amounts and state transitions MUST remain backend facts. Undefined DTO fields or money units MUST be reported as missing prerequisites rather than implemented through guessed writes or arbitrary JSON forms.
|
||||||
|
|
||||||
|
#### Scenario: 缺少财务契约
|
||||||
|
|
||||||
|
- **WHEN** 汇总未定义政策保存字段、金额单位或收款结构且权威文档不可用
|
||||||
|
- **THEN** 对应实现项 MUST 保持未完成,交付说明准确列出需要补充的契约。
|
||||||
|
|
||||||
|
#### Scenario: 专用总开关与错误反馈
|
||||||
|
|
||||||
|
- **WHEN** 超管切换总开关或后端拒绝延期
|
||||||
|
- **THEN** 前端 MUST 走专用开关接口并展示 precheck/failed_items 或具体错误;不得用通用系统配置绕过检查。
|
||||||
|
|
||||||
|
### Requirement: 交付与验证边界
|
||||||
|
|
||||||
|
The change SHALL preserve existing routes, permissions, worktree edits and successful payment/approval behaviors. It MUST include targeted regression tests and an actual menu/permission handoff, excluding superadmin-only configuration from ordinary-user setup. H5/C-end work and real-backend validation MUST be disclosed separately.
|
||||||
|
|
||||||
|
#### Scenario: 执行交付
|
||||||
|
|
||||||
|
- **WHEN** 本轮工作停止或完成
|
||||||
|
- **THEN** 交付 MUST 区分已实现、已本地验证、真实联调待办与缺契约未实现项,不以 mock 或服务数量宣称全部完成。
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user