Compare commits
20 Commits
a036b10641
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5fd8ac564 | ||
|
|
7d3352038a | ||
|
|
8faa2ea2ef | ||
|
|
8de4339505 | ||
|
|
68aa03b538 | ||
|
|
fbfdd01eec | ||
|
|
5079f97326 | ||
|
|
830476d49d | ||
|
|
47a2d88c9d | ||
|
|
6febc66eca | ||
|
|
45d255cabf | ||
|
|
eddfd157ad | ||
| 09225dd8bc | |||
| 563804f67f | |||
|
|
e95dc8e4f5 | ||
|
|
ca338dd345 | ||
|
|
fac05db39a | ||
|
|
2c8524485b | ||
|
|
4c0207c6e6 | ||
|
|
5b8d6610ab |
@@ -3,7 +3,7 @@ name: 构建并部署前端到测试环境
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
- dev
|
||||
- test
|
||||
|
||||
@@ -27,7 +27,7 @@ jobs:
|
||||
- name: 设置镜像标签
|
||||
id: tag
|
||||
run: |
|
||||
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
|
||||
if [ "${{ github.ref }}" = "refs/heads/develop" ]; then
|
||||
echo "tag=latest" >> $GITHUB_OUTPUT
|
||||
elif [ "${{ github.ref }}" = "refs/heads/dev" ]; then
|
||||
echo "tag=dev" >> $GITHUB_OUTPUT
|
||||
@@ -51,8 +51,8 @@ jobs:
|
||||
docker push ${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }}
|
||||
docker push ${{ env.IMAGE_NAME }}:${{ github.sha }}
|
||||
|
||||
- name: 部署到本地(仅 main 分支)
|
||||
if: github.ref == 'refs/heads/main'
|
||||
- name: 部署到本地(仅 develop 分支)
|
||||
if: github.ref == 'refs/heads/develop'
|
||||
run: |
|
||||
# 确保部署目录存在
|
||||
mkdir -p ${{ env.DEPLOY_DIR }}
|
||||
|
||||
@@ -30,7 +30,7 @@ RUN pnpm run nd
|
||||
# ================================
|
||||
# 阶段 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
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
web:
|
||||
image: registry.boss160.cn/junhong/cmp-admin-web:latest
|
||||
@@ -9,12 +8,19 @@ services:
|
||||
- '3001:80'
|
||||
networks:
|
||||
- junhong-network
|
||||
|
||||
# === 以下是新增的修复内容 ===
|
||||
tmpfs:
|
||||
- /run:rw
|
||||
- /tmp:rw
|
||||
|
||||
healthcheck:
|
||||
test: ['CMD', 'wget', '--no-verbose', '--tries=1', '--spider', 'http://127.0.0.1:80/health']
|
||||
interval: 30s
|
||||
timeout: 3s
|
||||
retries: 3
|
||||
start_period: 5s
|
||||
|
||||
logging:
|
||||
driver: 'json-file'
|
||||
options:
|
||||
@@ -23,4 +29,4 @@ services:
|
||||
|
||||
networks:
|
||||
junhong-network:
|
||||
driver: bridge
|
||||
driver: bridge
|
||||
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,40 @@
|
||||
## Context
|
||||
|
||||
运营需要在资产层查看当前主套餐及所有排队主套餐顺序接续后的预计最终到期时间。该结果依赖后端套餐队列、激活条件与计时规则,前端只负责展示接口结果。
|
||||
|
||||
## Goals / Non-Goals
|
||||
|
||||
- Goals:
|
||||
- 在资产详情、IoT 卡列表和设备列表统一展示“预计套餐到期时间”。
|
||||
- 区分可精确预计与待激活后才可计算的状态。
|
||||
- 对临期资产提供基于后端剩余天数的视觉提示。
|
||||
- Non-Goals:
|
||||
- 不修改单个套餐明细的“到期时间”展示或套餐队列顺序。
|
||||
- 不新增预计到期时间筛选、排序或前端日期计算。
|
||||
- 不改变套餐续费、激活或到期规则。
|
||||
|
||||
## Decisions
|
||||
|
||||
- Decision: 统一使用资产详情和资产列表响应中的 `estimated_final_expires_at`、`days_until_final_expiry`、`expiry_estimate_status`、`is_expiring`,不调用额外计算接口。
|
||||
- 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
|
||||
|
||||
- `expiry_estimate_status` 除 `exact` 和待激活状态外的完整枚举及对应文案由后端接口文档确认;本提案要求未知状态不得伪造日期。
|
||||
@@ -0,0 +1,35 @@
|
||||
# Change: 新增资产预计套餐到期时间展示
|
||||
|
||||
## Why
|
||||
|
||||
当前页面只能在套餐明细中查看单个套餐的到期时间,运营无法快速了解当前主套餐与全部排队主套餐接续后的资产最终到期时间。前端也不能可靠地自行叠加套餐时长,尤其当套餐需要激活后才开始计时时。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 在资产详情、IoT 卡列表和设备列表增加统一的 `预计套餐到期时间` 展示。
|
||||
- 资产详情接口和资产列表响应支持 `estimated_final_expires_at`、`days_until_final_expiry`、`expiry_estimate_status` 和 `is_expiring` 字段。
|
||||
- 当 `expiry_estimate_status=exact` 时,展示后端返回的 `estimated_final_expires_at`。
|
||||
- 当套餐尚待激活等无法预计最终日期时,展示“待激活后起算”,不得伪造日期。
|
||||
- 当 `is_expiring=true` 时,按后端返回的剩余天数使用临期颜色提示;普通资产列表不得因临期状态改变既有排序。
|
||||
- 当前套餐自身的到期时间继续仅在套餐明细中展示;前端不得叠加套餐时长计算预计最终到期时间。
|
||||
|
||||
## 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}`
|
||||
- IoT 卡和设备资产列表接口
|
||||
- Dependencies:
|
||||
- 后端在资产详情与资产列表响应中返回预计最终到期字段。
|
||||
@@ -0,0 +1,61 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Asset Estimated Final Expiry Contract
|
||||
|
||||
The admin asset information integration SHALL preserve `estimated_final_expires_at`, `days_until_final_expiry`, `expiry_estimate_status`, and `is_expiring` returned by `GET /api/admin/assets/resolve/{identifier}`.
|
||||
|
||||
#### 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
|
||||
|
||||
#### 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
|
||||
|
||||
### 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`
|
||||
- **WHEN** 页面渲染卡资产或设备资产基础信息
|
||||
- **THEN** `预计套餐到期时间` MUST display `待激活后起算`
|
||||
- **AND** 页面 MUST NOT display a fabricated 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`
|
||||
@@ -0,0 +1,33 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Device Estimated Final Expiry Display
|
||||
|
||||
The device management list integration SHALL preserve and display the backend device-level estimated final package expiry fields without traversing bound cards or calculating package continuation dates in the frontend.
|
||||
|
||||
#### 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`
|
||||
- **WHEN** 页面渲染设备列表行
|
||||
- **THEN** `预计套餐到期时间` MUST display `待激活后起算`
|
||||
- **AND** 页面 MUST NOT traverse bound cards or display a fabricated date
|
||||
|
||||
#### 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
|
||||
@@ -0,0 +1,33 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: IoT Card Estimated Final Expiry Display
|
||||
|
||||
The IoT card management list integration SHALL preserve and display the backend asset-level estimated final package expiry fields without calculating package continuation dates in the frontend.
|
||||
|
||||
#### 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`
|
||||
- **WHEN** 页面渲染卡列表行
|
||||
- **THEN** `预计套餐到期时间` MUST display `待激活后起算`
|
||||
- **AND** 页面 MUST NOT calculate or display a fabricated date
|
||||
|
||||
#### 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
|
||||
@@ -0,0 +1,25 @@
|
||||
## 1. API Contracts And Types
|
||||
|
||||
- [ ] 1.1 扩展资产详情响应和资产信息页面状态,支持 `estimated_final_expires_at`、`days_until_final_expiry`、`expiry_estimate_status`、`is_expiring`。
|
||||
- [ ] 1.2 扩展 IoT 卡和设备列表项类型,支持预计最终到期字段。
|
||||
|
||||
## 2. Asset Information
|
||||
|
||||
- [ ] 2.1 将资产解析接口返回的预计最终到期字段映射到资产详情页面状态。
|
||||
- [ ] 2.2 在资产详情卡和设备基础信息中展示“预计套餐到期时间”。
|
||||
- [ ] 2.3 `expiry_estimate_status=exact` 时格式化显示 `estimated_final_expires_at`;待激活等不可预计状态显示“待激活后起算”。
|
||||
- [ ] 2.4 `is_expiring=true` 时按 `days_until_final_expiry` 应用临期样式,不根据日期或天数自行推导临期状态。
|
||||
|
||||
## 3. Asset Lists
|
||||
|
||||
- [ ] 3.1 在 IoT 卡列表新增“预计套餐到期时间”可配置列,显示接口返回的预计日期或“待激活后起算”。
|
||||
- [ ] 3.2 在设备列表新增“预计套餐到期时间”可配置列,显示接口返回的预计日期或“待激活后起算”。
|
||||
- [ ] 3.3 在两个列表对 `is_expiring=true` 的预计到期时间使用临期样式,且不改变现有列表排序。
|
||||
|
||||
## 4. Verification
|
||||
|
||||
- [ ] 4.1 验证无套餐时不伪造预计日期并显示稳定占位内容。
|
||||
- [ ] 4.2 验证仅当前套餐和存在多个排队主套餐时,资产详情和两个列表均显示后端 `estimated_final_expires_at`。
|
||||
- [ ] 4.3 验证等待激活等不可预计状态显示“待激活后起算”,不显示计算出的日期。
|
||||
- [ ] 4.4 验证 `is_expiring=true` 时使用临期样式,且卡、设备列表顺序不变。
|
||||
- [ ] 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
|
||||
|
||||
- [ ] 1.1 扩展卡列表查询参数和列表项类型,支持可选 `real_name_status` 以及必需的 `real_name_status_name`。
|
||||
- [ ] 1.2 扩展设备列表查询参数和列表项类型,支持可选 `real_name_status` 以及必需的 `real_name_status_name`。
|
||||
- [ ] 1.3 将卡列表查询接入 `GET /api/admin/iot-cards/standalone` 并传递实名状态筛选参数。
|
||||
|
||||
## 2. Card List
|
||||
|
||||
- [ ] 2.1 在卡列表筛选区新增“实名状态”的全部、已实名、未实名选项。
|
||||
- [ ] 2.2 将选中的实名状态传递给卡列表查询,并在搜索、刷新、分页、导出中保留该条件。
|
||||
- [ ] 2.3 在卡列表表格新增“实名状态”列,展示接口返回的 `real_name_status_name`。
|
||||
- [ ] 2.4 重置卡列表搜索时清空实名状态筛选。
|
||||
|
||||
## 3. Device List
|
||||
|
||||
- [ ] 3.1 在设备列表筛选区新增“实名状态”的全部、已实名、未实名选项。
|
||||
- [ ] 3.2 将选中的实名状态传递给 `GET /api/admin/devices`,并在搜索、刷新、分页、导出中保留该条件。
|
||||
- [ ] 3.3 在设备列表表格新增“实名状态”列,直接展示接口返回的 `real_name_status_name`,不遍历绑定卡计算状态。
|
||||
- [ ] 3.4 重置设备列表搜索时清空实名状态筛选。
|
||||
|
||||
## 4. Verification
|
||||
|
||||
- [ ] 4.1 验证卡列表“全部”“已实名”“未实名”分别不传、传 `1`、传 `0`,且状态列显示接口名称。
|
||||
- [ ] 4.2 验证设备列表“全部”“已实名”“未实名”分别不传、传 `1`、传 `0`,且状态列直接显示设备接口名称。
|
||||
- [ ] 4.3 验证两个列表在分页切换、刷新和导出时保留实名状态筛选,重置后清空该条件。
|
||||
- [ ] 4.4 运行相关类型检查、lint 或构建验证。
|
||||
@@ -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 或构建验证。
|
||||
23
openspec/changes/add-shop-contact-phone-search/proposal.md
Normal file
23
openspec/changes/add-shop-contact-phone-search/proposal.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Change: 新增店铺联系电话精确搜索
|
||||
|
||||
## Why
|
||||
|
||||
运营无法通过店铺联系电话快速定位目标店铺。店铺列表已支持名称、编号和层级等条件筛选,但缺少联系电话的精确检索入口。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 在店铺列表筛选区增加“联系电话”输入框,限制输入为 11 位数字。
|
||||
- 将有效联系电话以 `contact_phone` 参数传递给现有 `GET /api/admin/shops` 查询,保持原店铺分页响应结构。
|
||||
- 空联系电话不传 `contact_phone` 参数;非法号码不发起查询并显示输入错误提示。
|
||||
- 使用搜索栏现有查询和清空能力:查询从第一页加载;清空联系电话后保留其他筛选条件并恢复不带联系电话条件的店铺列表。
|
||||
- 保持有效联系电话精确匹配;支持加载中和空结果状态。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: `shop-management`
|
||||
- Affected code:
|
||||
- `src/types/api/shop.ts`
|
||||
- `src/api/modules/shop.ts`
|
||||
- `src/views/shop-management/list/index.vue`
|
||||
- API contract:
|
||||
- `GET /api/admin/shops?contact_phone=13800138000`
|
||||
@@ -0,0 +1,59 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Shop Contact Phone Search Input
|
||||
|
||||
The shop management list SHALL provide a `联系电话` search input in its filter area. The input MUST only accept an 11-digit numeric phone number for a contact phone search.
|
||||
|
||||
#### Scenario: Enter a valid contact phone
|
||||
|
||||
- **GIVEN** 用户正在查看店铺列表筛选区
|
||||
- **WHEN** 用户输入 11 位数字联系电话
|
||||
- **THEN** 页面 MUST retain the entered phone number as the `contact_phone` search value
|
||||
- **AND** 用户 MUST be able to use the existing query action to search
|
||||
|
||||
#### Scenario: Prevent invalid contact phone query
|
||||
|
||||
- **GIVEN** 用户输入的联系电话不是 11 位数字
|
||||
- **WHEN** 用户发起查询
|
||||
- **THEN** 页面 MUST NOT send a shop list request
|
||||
- **AND** 页面 MUST display an input validation error
|
||||
|
||||
### Requirement: Shop Contact Phone Query Contract
|
||||
|
||||
The shop management list SHALL use `contact_phone` as an optional exact-match query parameter of `GET /api/admin/shops` while preserving the existing shop pagination response structure.
|
||||
|
||||
#### Scenario: Query shops by exact contact phone
|
||||
|
||||
- **GIVEN** 用户输入有效的 11 位联系电话
|
||||
- **WHEN** 用户发起店铺列表查询
|
||||
- **THEN** 系统 MUST request `GET /api/admin/shops` with `contact_phone` equal to the entered value
|
||||
- **AND** 系统 MUST reset the list to the first page
|
||||
- **AND** 页面 MUST render the returned shop pagination result
|
||||
|
||||
#### Scenario: Omit empty contact phone from query
|
||||
|
||||
- **GIVEN** 联系电话筛选值为空
|
||||
- **WHEN** 系统加载店铺列表
|
||||
- **THEN** 请求 MUST NOT include `contact_phone`
|
||||
|
||||
### Requirement: Shop Contact Phone Search Reset and Result States
|
||||
|
||||
The shop management list SHALL clear the contact phone search through its existing reset or input clear interaction without affecting other selected filters. The page SHALL preserve existing loading and empty-result behavior.
|
||||
|
||||
#### Scenario: Clear contact phone while preserving other filters
|
||||
|
||||
- **GIVEN** 用户已按联系电话和其他店铺条件查询
|
||||
- **WHEN** 用户清空联系电话并重新查询
|
||||
- **THEN** 系统 MUST request the list without `contact_phone`
|
||||
- **AND** 系统 MUST retain the other selected filters
|
||||
|
||||
#### Scenario: Display no matching shop result
|
||||
|
||||
- **GIVEN** 用户输入有效的 11 位联系电话
|
||||
- **WHEN** 店铺接口返回空分页结果
|
||||
- **THEN** 页面 MUST render the existing empty table result state
|
||||
|
||||
#### Scenario: Display loading while querying contact phone
|
||||
|
||||
- **WHEN** 系统正在按有效联系电话请求店铺列表
|
||||
- **THEN** 页面 MUST render the existing list loading state until the request completes
|
||||
22
openspec/changes/add-shop-contact-phone-search/tasks.md
Normal file
22
openspec/changes/add-shop-contact-phone-search/tasks.md
Normal file
@@ -0,0 +1,22 @@
|
||||
## 1. Query Contract
|
||||
|
||||
- [x] 1.1 在店铺列表查询参数类型中增加可选 `contact_phone`。
|
||||
- [x] 1.2 保持调用 `GET /api/admin/shops` 和原店铺分页响应结构。
|
||||
|
||||
## 2. Shop List Search UI
|
||||
|
||||
- [x] 2.1 在店铺列表筛选区新增“联系电话”输入框,限制为 11 位数字。
|
||||
- [x] 2.2 通过现有查询按钮发起联系电话筛选,并在查询时重置至第一页。
|
||||
- [x] 2.3 通过现有清空能力移除联系电话筛选,保留其他筛选条件并恢复列表。
|
||||
|
||||
## 3. Validation and Results
|
||||
|
||||
- [x] 3.1 空联系电话不传 `contact_phone` 参数。
|
||||
- [x] 3.2 联系电话不是 11 位数字时不发起请求并提示错误。
|
||||
- [x] 3.3 有效联系电话按精确值传递 `contact_phone`,并支持加载中与空结果状态。
|
||||
|
||||
## 4. Verification
|
||||
|
||||
- [ ] 4.1 验证有效 11 位联系电话精确命中店铺。
|
||||
- [ ] 4.2 验证空值、清空、非法号码和无匹配结果行为正确。
|
||||
- [x] 4.3 运行相关前端校验,并执行 `openspec validate add-shop-contact-phone-search --strict`。
|
||||
@@ -0,0 +1,22 @@
|
||||
# Change: 代理现金余额不足100元展示
|
||||
|
||||
## Why
|
||||
|
||||
当前代理资金概况缺少对现金可用余额不足的明确提示,运营人员无法快速识别需要关注的店铺资金状态。业务要求以固定阈值 100 元展示预警,不开放阈值配置,也不把信用额度计入预警文案。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 在代理资金概况中展示现金余额、冻结金额和基于后端 `low_balance_warning` 的“现金余额不足100元”红色状态。
|
||||
- 复用 `GET /api/admin/shops/fund-summary`,读取 `balance`、`frozen_balance`、`cash_available`、`low_balance_warning` 字段,金额统一按分转元展示。
|
||||
- 明确前端不得自行计算 100 元阈值,也不得展示阈值输入框。
|
||||
- 不包含任何公共站内通知相关功能的实现或改造。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: `commission-management`
|
||||
- Affected code:
|
||||
- `src/types/api/commission.ts`
|
||||
- `src/views/commission-management/agent-fund-overview/index.vue`
|
||||
- Out of scope:
|
||||
- 顶部通知抽屉、站内通知中心及其他公共站内通知功能的开发或改造
|
||||
- 任意余额预警阈值配置能力
|
||||
@@ -0,0 +1,47 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Agent Cash Available Low Balance Warning
|
||||
|
||||
The agent fund overview SHALL display cash balance data and a fixed-threshold low balance warning using the backend-provided `low_balance_warning` flag from `GET /api/admin/shops/fund-summary`. The frontend MUST NOT calculate the threshold itself and MUST NOT expose any threshold configuration input.
|
||||
|
||||
#### Scenario: Display normal balance state above threshold
|
||||
|
||||
- **GIVEN** 用户进入代理资金概况页面
|
||||
- **WHEN** `GET /api/admin/shops/fund-summary` 返回 `balance`、`frozen_balance`、`cash_available`
|
||||
- **AND** `low_balance_warning=false`
|
||||
- **THEN** 页面 MUST 展示现金余额和冻结金额
|
||||
- **AND** 所有金额 MUST 按分转元展示
|
||||
- **AND** 页面 MUST NOT 展示“现金余额不足100元”红色状态
|
||||
|
||||
#### Scenario: Display warning state at or below threshold
|
||||
|
||||
- **GIVEN** 用户进入代理资金概况页面
|
||||
- **WHEN** `GET /api/admin/shops/fund-summary` 返回 `low_balance_warning=true`
|
||||
- **THEN** 页面 MUST 展示“现金余额不足100元”红色状态
|
||||
- **AND** 该提示 MUST NOT 将信用额度计入文案
|
||||
|
||||
#### Scenario: Frontend does not expose threshold configuration
|
||||
|
||||
- **WHEN** 用户查看代理资金概况页面
|
||||
- **THEN** 页面 MUST NOT 展示余额预警阈值输入框或配置控件
|
||||
- **AND** 前端 MUST NOT 依据 `cash_available` 自行计算是否低于 `100` 元
|
||||
|
||||
### Requirement: Agent Fund Summary Low Balance Response Fields
|
||||
|
||||
The frontend SHALL read the low-balance display state exclusively from the `GET /api/admin/shops/fund-summary` response fields `balance:int64`, `frozen_balance:int64`, `cash_available:int64`, and `low_balance_warning:bool`.
|
||||
|
||||
#### Scenario: Read low balance response contract
|
||||
|
||||
- **WHEN** 前端请求 `GET /api/admin/shops/fund-summary`
|
||||
- **THEN** 前端 MUST 读取 `balance`、`frozen_balance`、`cash_available`、`low_balance_warning`
|
||||
- **AND** `low_balance_warning` MUST be the only source of truth for whether the warning is shown
|
||||
|
||||
### Requirement: Public Notification Features Are Out Of Scope
|
||||
|
||||
This change SHALL NOT add or modify top notification drawer, notification center, or any other public in-app notification feature.
|
||||
|
||||
#### Scenario: Deliver low balance overview without notification changes
|
||||
|
||||
- **WHEN** 本次变更落地
|
||||
- **THEN** 代理资金概况的低余额展示 MUST be available
|
||||
- **AND** 顶部通知抽屉、站内通知中心及其他公共站内通知功能 MUST NOT be changed by this proposal
|
||||
@@ -0,0 +1,15 @@
|
||||
## 1. API Contract
|
||||
|
||||
- [x] 1.1 更新代理资金概况相关数据模型,补充 `balance`、`frozen_balance`、`cash_available`、`low_balance_warning` 字段读取。
|
||||
|
||||
## 2. Agent Fund Overview UI
|
||||
|
||||
- [x] 2.1 在代理资金概况中展示现金余额、冻结金额,并统一按分转元格式化。
|
||||
- [x] 2.2 当 `low_balance_warning=true` 时展示“现金余额不足100元”红色状态。
|
||||
- [x] 2.3 不展示阈值输入框,不把信用额度计入预警文案,也不由前端自行计算余额阈值。
|
||||
|
||||
## 3. Verification
|
||||
|
||||
- [ ] 3.1 验证现金可用余额高于、等于、低于100元三种情况下的状态展示正确,且仅由 `low_balance_warning` 控制。
|
||||
- [x] 3.2 验证本次改动未引入公共站内通知相关功能。
|
||||
- [x] 3.3 运行相关前端校验,并执行 `openspec validate update-agent-fund-low-balance-warning --strict`。
|
||||
@@ -0,0 +1,26 @@
|
||||
# Change: 资产详情前代后代换货标识
|
||||
|
||||
## Why
|
||||
|
||||
资产详情虽然可展示业务状态和世代编号,但运营无法判断当前资产在换货链中的位置,也无法在具备权限时快速前往关联资产。需要基于后端返回的换货链路数据明确展示前代和后代资产关系。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 扩展资产解析响应,读取 `exchange_trace.previous_asset` 和 `exchange_trace.next_asset`。
|
||||
- 前代资产存在时,在当前资产详情展示“换货新资产”标签与前代资产信息。
|
||||
- 后代资产存在时,在当前资产详情展示“已换出旧资产”标签与后代资产信息。
|
||||
- 中间资产同时展示前代和后代换货标识。
|
||||
- 当关联项 `can_view=true` 时允许跳转资产详情;为 `false` 时仅展示标识文本,不提供跳转操作。
|
||||
- 不由前端根据换货状态、世代编号或其他字段自行推导换货链;关联项为空时不展示对应区域。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: `asset-information`
|
||||
- Related active changes: `add-asset-status-generation-display`(共享资产世代和详情展示区域)
|
||||
- Affected code:
|
||||
- `src/types/api/asset.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`
|
||||
- API contract:
|
||||
- `GET /api/admin/assets/resolve/{identifier}`
|
||||
@@ -0,0 +1,60 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Asset Exchange Generation Trace Display
|
||||
|
||||
The asset information page SHALL display exchange generation relationships exclusively from `exchange_trace.previous_asset` and `exchange_trace.next_asset` returned by `GET /api/admin/assets/resolve/{identifier}`. The frontend MUST NOT infer the exchange chain from asset status, generation, or exchange status.
|
||||
|
||||
#### Scenario: Display previous asset for a replacement asset
|
||||
|
||||
- **GIVEN** 用户正在查看资产信息页
|
||||
- **WHEN** 解析响应包含非空的 `exchange_trace.previous_asset`
|
||||
- **THEN** 页面 MUST 显示“换货新资产”标签
|
||||
- **AND** 页面 MUST 展示前代资产的标识符和换货单号
|
||||
|
||||
#### Scenario: Display next asset for a replaced asset
|
||||
|
||||
- **GIVEN** 用户正在查看资产信息页
|
||||
- **WHEN** 解析响应包含非空的 `exchange_trace.next_asset`
|
||||
- **THEN** 页面 MUST 显示“已换出旧资产”标签
|
||||
- **AND** 页面 MUST 展示后代资产的标识符和换货单号
|
||||
|
||||
#### Scenario: Display both relationships for an intermediate asset
|
||||
|
||||
- **GIVEN** 用户正在查看位于换货链中间的资产
|
||||
- **WHEN** 解析响应同时包含非空的 `previous_asset` 和 `next_asset`
|
||||
- **THEN** 页面 MUST 同时展示“换货新资产”和“已换出旧资产”两个关联区域
|
||||
|
||||
#### Scenario: Hide absent exchange relationship
|
||||
|
||||
- **GIVEN** 用户正在查看资产信息页
|
||||
- **WHEN** `previous_asset` 或 `next_asset` 为 `null`、空值或未返回
|
||||
- **THEN** 页面 MUST NOT 展示对应的换货关联区域
|
||||
- **AND** 前端 MUST NOT 根据资产状态、世代编号、换货单状态或其他字段推导该区域
|
||||
|
||||
### Requirement: Exchange Related Asset Navigation Authorization
|
||||
|
||||
The asset information page SHALL allow navigation to a related exchange asset only when that relationship item has `can_view=true`.
|
||||
|
||||
#### Scenario: Navigate to authorized related asset
|
||||
|
||||
- **GIVEN** 换货关联资产项的 `can_view=true`
|
||||
- **WHEN** 用户点击关联资产标识符
|
||||
- **THEN** 系统 MUST 跳转到该关联资产的资产详情
|
||||
- **AND** 跳转 MUST 使用关联项返回的 `identifier`
|
||||
|
||||
#### Scenario: Render unauthorized related asset as text
|
||||
|
||||
- **GIVEN** 换货关联资产项的 `can_view=false`
|
||||
- **WHEN** 页面渲染换货关联区域
|
||||
- **THEN** 页面 MUST 展示关联资产标识符和换货单号
|
||||
- **AND** 页面 MUST NOT 将关联资产标识符渲染为可点击跳转操作
|
||||
|
||||
### Requirement: Exchange Trace Response Contract
|
||||
|
||||
The frontend asset resolve contract SHALL support optional `exchange_trace.previous_asset` and `exchange_trace.next_asset` items, each with `asset_type`, `asset_id`, `identifier`, `exchange_no`, and `can_view`.
|
||||
|
||||
#### Scenario: Read exchange trace response fields
|
||||
|
||||
- **WHEN** 前端解析 `GET /api/admin/assets/resolve/{identifier}` 响应
|
||||
- **THEN** 前端类型 MUST 支持 `exchange_trace.previous_asset` 和 `exchange_trace.next_asset`
|
||||
- **AND** 每个非空关联项 MUST 支持读取 `asset_type`、`asset_id`、`identifier`、`exchange_no`、`can_view`
|
||||
@@ -0,0 +1,22 @@
|
||||
## 1. API Contract
|
||||
|
||||
- [x] 1.1 更新资产解析响应类型,支持 `exchange_trace.previous_asset` 和 `exchange_trace.next_asset`。
|
||||
- [x] 1.2 定义换货关联资产类型,读取 `asset_type`、`asset_id`、`identifier`、`exchange_no`、`can_view`。
|
||||
|
||||
## 2. Asset Detail Exchange Trace UI
|
||||
|
||||
- [x] 2.1 `previous_asset` 存在时展示“换货新资产”标签和前代资产信息。
|
||||
- [x] 2.2 `next_asset` 存在时展示“已换出旧资产”标签和后代资产信息。
|
||||
- [x] 2.3 当前资产同时存在前代和后代时,同时展示两个关联区域。
|
||||
- [x] 2.4 关联资产为空时隐藏对应区域,不通过换货状态或世代编号推导关联链路。
|
||||
|
||||
## 3. Exchange Trace Navigation
|
||||
|
||||
- [x] 3.1 `can_view=true` 时允许点击关联资产标识跳转资产详情。
|
||||
- [x] 3.2 `can_view=false` 时仅展示关联资产标识文本,不渲染跳转操作。
|
||||
|
||||
## 4. Verification
|
||||
|
||||
- [ ] 4.1 验证旧资产、新资产、中间资产和无关联资产的展示正确。
|
||||
- [ ] 4.2 验证有权限和无权限关联资产的跳转行为正确。
|
||||
- [x] 4.3 运行相关前端校验,并执行 `openspec validate update-asset-exchange-generation-links --strict`。
|
||||
@@ -0,0 +1,25 @@
|
||||
# Change: 适配复机实名校验结果提示
|
||||
|
||||
## Why
|
||||
|
||||
复机是否允许取决于运营商的实名能力和后端实名规则,不能以行业卡类别作为前端放行依据。当前复机失败不会向运营清晰呈现后端返回的中文业务原因,无法区分同为行业卡但实名能力不同的放行或拦截结果。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 复用资产信息页现有复机入口和确认框,继续调用 `POST /api/admin/assets/{identifier}/start`。
|
||||
- 补齐复机成功响应类型,读取最新的 `status`、`status_name`、`real_name_status`、`real_name_status_name`。
|
||||
- 复机提交期间禁用入口,避免重复提交。
|
||||
- 复机被后端实名规则或其他业务规则拦截时,在当前复机操作上下文直接展示后端返回的中文业务原因,不以通用前端文案替代,也不只记录到控制台。
|
||||
- 复机成功后重新拉取资产详情,以最新资产数据更新页面。
|
||||
- 前端不得读取或根据 `card_category` 判断是否需要实名、是否允许复机,所有放行或拦截均以后端结果为准。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: `asset-information`
|
||||
- Affected code:
|
||||
- `src/types/api/asset.ts`
|
||||
- `src/api/modules/asset.ts`
|
||||
- `src/views/asset-management/asset-information/composables/useAssetOperations.ts`
|
||||
- `src/views/asset-management/asset-information/components/BasicInfoCard.vue`
|
||||
- API contract:
|
||||
- `POST /api/admin/assets/{identifier}/start`
|
||||
@@ -0,0 +1,71 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Asset Start Response Contract
|
||||
|
||||
The asset start API contract SHALL use `POST /api/admin/assets/{identifier}/start` and support a successful response containing the latest `status`, `status_name`, `real_name_status`, and `real_name_status_name` values.
|
||||
|
||||
#### Scenario: Read successful asset start result
|
||||
|
||||
- **WHEN** 用户对资产提交复机且后端成功处理请求
|
||||
- **THEN** 前端类型 MUST support `status`、`status_name`、`real_name_status` 和 `real_name_status_name`
|
||||
- **AND** 前端 MUST use the existing asset start endpoint
|
||||
|
||||
### Requirement: Asset Start Submission and Refresh
|
||||
|
||||
The asset information page SHALL retain the existing asset start entry and confirmation dialog. It MUST prevent duplicate submissions while the asset start request is pending and refresh the asset detail after a successful start.
|
||||
|
||||
#### Scenario: Keep existing asset start confirmation
|
||||
|
||||
- **GIVEN** 用户正在查看处于停机状态的资产信息页
|
||||
- **WHEN** 用户发起复机操作
|
||||
- **THEN** 页面 MUST display the existing start confirmation dialog
|
||||
- **AND** 页面 MUST NOT add a separate asset start entry
|
||||
|
||||
#### Scenario: Prevent duplicate asset start submissions
|
||||
|
||||
- **GIVEN** 用户已确认复机操作
|
||||
- **WHEN** 复机请求仍在提交中
|
||||
- **THEN** 复机按钮 MUST be disabled
|
||||
- **AND** 系统 MUST NOT send another asset start request for that interaction
|
||||
|
||||
#### Scenario: Refresh asset detail after a successful start
|
||||
|
||||
- **WHEN** 复机接口成功返回
|
||||
- **THEN** 页面 MUST reload the current asset detail
|
||||
- **AND** 页面 MUST render the refreshed asset status and real-name status data
|
||||
|
||||
### Requirement: Backend-Controlled Asset Start Realname Validation
|
||||
|
||||
The asset information page SHALL rely exclusively on the backend asset start result to decide whether an asset is allowed to start. The frontend MUST NOT read or use `card_category` to infer real-name requirements or to permit an asset start.
|
||||
|
||||
#### Scenario: Allow start based on backend result
|
||||
|
||||
- **GIVEN** 用户对行业卡资产发起复机
|
||||
- **WHEN** 后端允许复机
|
||||
- **THEN** 页面 MUST treat the operation as successful regardless of the asset `card_category`
|
||||
- **AND** 页面 MUST reload the asset detail
|
||||
|
||||
#### Scenario: Block start based on backend realname validation
|
||||
|
||||
- **GIVEN** 用户对行业卡资产发起复机
|
||||
- **WHEN** 后端因实名规则拒绝复机并返回中文业务原因
|
||||
- **THEN** 页面 MUST keep the asset start operation unsuccessful
|
||||
- **AND** 页面 MUST NOT use `card_category` to override or bypass the backend decision
|
||||
|
||||
### Requirement: Asset Start Business Failure Feedback
|
||||
|
||||
When the asset start API rejects an operation for real-name validation or another business rule, the asset information page SHALL show the backend-provided Chinese business reason in the current asset start operation context.
|
||||
|
||||
#### Scenario: Show backend realname rejection reason
|
||||
|
||||
- **GIVEN** 用户已在资产信息页确认复机
|
||||
- **WHEN** 后端返回实名校验失败及中文业务原因
|
||||
- **THEN** 页面 MUST display that backend Chinese business reason directly in the asset start operation context
|
||||
- **AND** 页面 MUST NOT replace it with a generic frontend failure message
|
||||
|
||||
#### Scenario: Show other backend business rejection reason
|
||||
|
||||
- **GIVEN** 用户已在资产信息页确认复机
|
||||
- **WHEN** 后端返回非实名相关的业务拦截及中文业务原因
|
||||
- **THEN** 页面 MUST display that backend Chinese business reason directly in the asset start operation context
|
||||
- **AND** 页面 MUST NOT only log the failure to the browser console
|
||||
@@ -0,0 +1,24 @@
|
||||
## 1. API Contract
|
||||
|
||||
- [x] 1.1 定义复机成功响应类型,支持 `status`、`status_name`、`real_name_status`、`real_name_status_name`。
|
||||
- [x] 1.2 更新复机接口返回类型,继续使用 `POST /api/admin/assets/{identifier}/start`。
|
||||
|
||||
## 2. Asset Start Interaction
|
||||
|
||||
- [x] 2.1 保持资产信息页现有复机入口和确认框。
|
||||
- [x] 2.2 复机请求提交期间禁用复机按钮,防止重复提交。
|
||||
- [x] 2.3 复机成功后重新拉取资产详情。
|
||||
|
||||
## 3. Backend Realname Validation Feedback
|
||||
|
||||
- [x] 3.1 后端返回实名或其他业务拦截结果时,在复机操作上下文显示后端中文业务原因。
|
||||
- [x] 3.2 不以通用前端错误文案覆盖后端中文业务原因,也不只将错误写入控制台。
|
||||
- [x] 3.3 不读取或根据 `card_category` 推断实名要求或复机放行结果。
|
||||
|
||||
## 4. Verification
|
||||
|
||||
- [ ] 4.1 验证复机成功后页面重新加载并展示最新资产详情。
|
||||
- [ ] 4.2 验证后端实名校验拦截时显示其中文业务原因。
|
||||
- [ ] 4.3 验证同为行业卡但运营商实名能力不同的资产,页面按后端结果分别放行或拦截。
|
||||
- [ ] 4.4 验证提交期间无法重复发起复机请求。
|
||||
- [x] 4.5 运行相关前端校验,并执行 `openspec validate update-asset-start-realname-validation-feedback --strict`。
|
||||
30
openspec/changes/update-asset-sync-status-trail/proposal.md
Normal file
30
openspec/changes/update-asset-sync-status-trail/proposal.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# Change: 调整资产同步状态与同步轨迹入口
|
||||
|
||||
## Why
|
||||
|
||||
运营需要通过统一审计查看资产业务事件、运营商回调和周期轮询的同步轨迹。新需求明确资产信息页只保留已有手动刷新和轮询展示,不新增用于推断轮询计划的状态字段。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 保留卡和设备资产信息页现有的手动刷新按钮、接口契约和轮询状态展示,不新增第二个同步或刷新按钮。
|
||||
- 不展示活跃级别、最后活跃场景或下次轮询时间,也不根据事件轨迹推算新的周期轮询时间。
|
||||
- 增加“查看同步轨迹”入口,跳转全局审计外部集成页并带入当前资产的 `resource_type` 和 `resource_key` 筛选参数。
|
||||
- 约定审计查询支持 `resource_type`、`resource_key`、`correlation_id`,以供目标页连续展示立即、3分钟、5分钟的同步结果,以及运营商回调和周期轮询的 Integration Log。
|
||||
- 对 `rate_limited` 手动刷新结果仅展示本次失败,不展示自动退避倒计时。
|
||||
- 全局审计外部集成页面自身暂不在本提案中开发或改造。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: `asset-information`
|
||||
- Related active changes: `update-asset-realtime-sync-timestamps-display`(共享资产同步信息展示)
|
||||
- Affected code:
|
||||
- `src/views/asset-management/asset-information/components/BasicInfoCard.vue`
|
||||
- `src/views/asset-management/asset-information/index.vue`
|
||||
- 资产信息页到全局审计外部集成页的路由跳转参数
|
||||
- API contracts:
|
||||
- `POST /api/admin/assets/{identifier}/refresh`(保持既有契约)
|
||||
- `GET /api/admin/audit/integrations`(复用 `resource_type`、`resource_key`、`correlation_id` 查询参数)
|
||||
- Out of scope:
|
||||
- 全局审计外部集成页面自身的开发或改造
|
||||
- 审计轨迹结果页的加载、空记录和失败状态界面实现
|
||||
- 新增轮询活跃级别、最后活跃场景、下次轮询时间或自动退避倒计时展示
|
||||
@@ -0,0 +1,73 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Existing Asset Sync Controls and Polling Display
|
||||
|
||||
The asset information page SHALL preserve the existing manual refresh control and existing polling status display for both card and device assets. The page MUST NOT add another synchronization or refresh control.
|
||||
|
||||
#### Scenario: Retain existing controls for a card asset
|
||||
|
||||
- **GIVEN** 用户正在查看卡资产信息页
|
||||
- **THEN** 页面 MUST 保留现有手动刷新按钮和现有轮询状态展示
|
||||
- **AND** 页面 MUST NOT 增加第二个同步或刷新按钮
|
||||
|
||||
#### Scenario: Retain existing controls for a device asset
|
||||
|
||||
- **GIVEN** 用户正在查看设备资产信息页
|
||||
- **THEN** 页面 MUST 保留现有手动刷新按钮和现有轮询状态展示
|
||||
- **AND** 页面 MUST NOT 增加第二个同步或刷新按钮
|
||||
|
||||
#### Scenario: Do not display new polling activity fields
|
||||
|
||||
- **GIVEN** 用户正在查看卡或设备资产信息页
|
||||
- **WHEN** 资产解析响应包含 `activity_level`、`last_activity_scene` 或 `next_poll_at`
|
||||
- **THEN** 页面 MUST NOT 展示活跃级别、最后活跃场景或下次轮询时间字段
|
||||
|
||||
### Requirement: Asset Manual Refresh Remains the Only Refresh Entry
|
||||
|
||||
The asset information page SHALL preserve the existing manual refresh button and interface contract as the only asset refresh entry. The frontend MUST NOT infer or display a future periodic polling time from refresh results or event traces.
|
||||
|
||||
#### Scenario: Preserve existing manual refresh behavior
|
||||
|
||||
- **WHEN** 用户在资产信息页发起手动刷新
|
||||
- **THEN** 系统 MUST 调用现有手动刷新接口
|
||||
- **AND** 页面 MUST NOT 新增第二个同步或刷新按钮
|
||||
|
||||
#### Scenario: Show rate limited result without countdown
|
||||
|
||||
- **WHEN** 手动刷新请求返回 `rate_limited` 或等价限流失败结果
|
||||
- **THEN** 系统 MUST 仅展示本次请求失败信息
|
||||
- **AND** 系统 MUST NOT 展示自动退避倒计时
|
||||
|
||||
#### Scenario: Do not infer a future polling schedule
|
||||
|
||||
- **WHEN** 用户查看刷新结果或同步事件轨迹
|
||||
- **THEN** 前端 MUST NOT 根据结果推算或展示新的周期轮询时间
|
||||
|
||||
### Requirement: Asset Sync Trail Navigation
|
||||
|
||||
The asset information page SHALL provide a `查看同步轨迹` entry that navigates to the global audit integration page with filters for the current asset. The target audit query contract SHALL support `resource_type`, `resource_key`, and `correlation_id` filters.
|
||||
|
||||
#### Scenario: Navigate to filtered sync trail from a card asset
|
||||
|
||||
- **GIVEN** 用户正在查看卡资产信息页
|
||||
- **WHEN** 用户点击“查看同步轨迹”
|
||||
- **THEN** 系统 MUST 跳转到全局审计外部集成页
|
||||
- **AND** 跳转参数 MUST 带入当前卡资产对应的 `resource_type` 和 `resource_key` 筛选信息
|
||||
|
||||
#### Scenario: Navigate to filtered sync trail from a device asset
|
||||
|
||||
- **GIVEN** 用户正在查看设备资产信息页
|
||||
- **WHEN** 用户点击“查看同步轨迹”
|
||||
- **THEN** 系统 MUST 跳转到全局审计外部集成页
|
||||
- **AND** 跳转参数 MUST 带入当前设备资产对应的 `resource_type` 和 `resource_key` 筛选信息
|
||||
|
||||
#### Scenario: Audit query filters a correlation group
|
||||
|
||||
- **WHEN** 全局审计外部集成页按一次业务事件的 `correlation_id` 查询同步轨迹
|
||||
- **THEN** 审计查询契约 MUST 支持该筛选参数
|
||||
|
||||
#### Scenario: Audit target page is outside this change
|
||||
|
||||
- **WHEN** 本次变更落地
|
||||
- **THEN** 资产信息页的同步轨迹跳转入口 MUST 可用
|
||||
- **AND** 全局审计外部集成页面的加载、空记录和失败状态界面 MUST NOT 被要求在本提案中开发或改造
|
||||
24
openspec/changes/update-asset-sync-status-trail/tasks.md
Normal file
24
openspec/changes/update-asset-sync-status-trail/tasks.md
Normal file
@@ -0,0 +1,24 @@
|
||||
## 1. Asset Sync Controls
|
||||
|
||||
- [x] 1.1 保留卡和设备资产信息页现有手动刷新按钮及其接口调用方式,不新增同步或刷新按钮。
|
||||
- [x] 1.2 保留现有轮询状态展示,移除活跃级别、最后活跃场景和下次轮询时间展示。
|
||||
- [x] 1.3 `rate_limited` 时仅展示本次刷新失败,不展示自动退避倒计时或新的轮询时间。
|
||||
|
||||
## 2. Sync Trail Navigation
|
||||
|
||||
- [x] 2.1 在卡和设备资产信息页增加“查看同步轨迹”入口,跳转全局审计外部集成页。
|
||||
- [x] 2.2 跳转时带入当前资产的 `resource_type` 和 `resource_key` 筛选参数。
|
||||
- [x] 2.3 前端不根据事件轨迹推算或展示新的周期轮询时间。
|
||||
|
||||
## 3. Audit Integration Contract
|
||||
|
||||
- [ ] 3.1 与审计接口确认并联调 `resource_type`、`resource_key`、`correlation_id` 查询参数。
|
||||
- [ ] 3.2 确认目标查询可覆盖立即、3分钟、5分钟的连续同步结果,以及运营商回调和周期轮询的 Integration Log。
|
||||
- [x] 3.3 不开发或改造全局审计外部集成页面的加载、空记录和失败状态界面。
|
||||
|
||||
## 4. Verification
|
||||
|
||||
- [ ] 4.1 验证卡和设备均保留既有手动刷新和轮询状态展示,且不显示新增轮询活跃字段。
|
||||
- [ ] 4.2 验证“查看同步轨迹”跳转携带当前资产筛选。
|
||||
- [ ] 4.3 待全局审计外部集成页就绪后,验证过滤后的轨迹加载、空记录、失败状态及连续同步结果完整。
|
||||
- [x] 4.4 运行相关前端校验,并执行 `openspec validate update-asset-sync-status-trail --strict`。
|
||||
@@ -0,0 +1,44 @@
|
||||
# Change: 更新资产信息账号类型字段可见性与运营商账户展示
|
||||
|
||||
## Why
|
||||
|
||||
资产信息页当前在卡/设备基础信息区域存在两类与最新业务口径不一致的问题:
|
||||
|
||||
- 卡资产“卡信息”中的 `实名认证策略` 仍会对 `user_type=3`(代理账号)和 `user_type=4`(企业账号)显示。
|
||||
- 设备资产“设备信息”中的 `实名认证策略` 和 `制造商` 仍会对 `user_type=3/4` 显示。
|
||||
- 卡资产“运营商账户”当前展示的是 `carrier_name`,而最新要求需要改为展示 `carrier_type`,并按运营商管理中的映射规则转成中文,例如 `CTCC -> 中国电信`。
|
||||
|
||||
如果不统一这些展示规则,不同账号在资产信息页会继续看到不应暴露的字段,同时“运营商账户”的显示口径也会与系统内其他模块不一致。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 更新卡资产“卡信息”区域:
|
||||
- 当当前登录账号 `user_type` 为 `3` 或 `4` 时,隐藏 `实名认证策略` 字段。
|
||||
- 当当前登录账号 `user_type` 为 `3` 或 `4` 时,`运营商账户` 字段改为展示 `carrier_type` 的中文映射值,而不是 `carrier_name`。
|
||||
- 当当前登录账号 `user_type` 不是 `3` 且不是 `4` 时,`运营商账户` 字段继续保持当前 `carrier_name` 展示口径。
|
||||
- 已知运营商类型映射沿用运营商管理口径:`CMCC -> 中国移动`、`CUCC -> 中国联通`、`CTCC -> 中国电信`、`CBN -> 中国广电`。
|
||||
- 当 `carrier_type` 为空时显示 `-`;若返回未知编码,则保留原编码展示,避免吞掉上游信息。
|
||||
- 更新设备资产“设备信息”区域:
|
||||
- 当当前登录账号 `user_type` 为 `3` 或 `4` 时,隐藏 `实名认证策略` 字段。
|
||||
- 当当前登录账号 `user_type` 为 `3` 或 `4` 时,隐藏 `制造商` 字段。
|
||||
- 范围约束:
|
||||
- 本提案仅调整资产信息基础描述区字段展示。
|
||||
- 本提案不改动实名认证策略相关操作按钮的权限和可见性。
|
||||
- 本提案不改动设备详情“绑定卡列表”中的列展示规则,除非后续另行提出变更。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs:
|
||||
- `asset-information`
|
||||
- Affected code:
|
||||
- `src/views/asset-management/asset-information/components/BasicInfoCard.vue`
|
||||
- `src/views/asset-management/asset-information/composables/useAssetFormatters.ts`
|
||||
- `src/views/asset-management/asset-information/types.ts`
|
||||
- `src/views/asset-management/asset-information/composables/useAssetInfo.ts`
|
||||
- `src/config/constants/carrierTypes.ts`
|
||||
- Dependencies:
|
||||
- 依赖当前登录账号 `user_type` 可从用户状态中稳定读取
|
||||
- 依赖资产详情接口继续返回 `carrier_type`
|
||||
- 运营商类型中文映射应与运营商管理模块保持一致
|
||||
- Breaking changes:
|
||||
- 无外部接口破坏性变更;本次仅调整后台页面展示契约和字段可见性
|
||||
@@ -0,0 +1,123 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Admin Card Asset Carrier Type Contract
|
||||
|
||||
The admin asset information integration SHALL accept and preserve `carrier_type` from `GET /api/admin/assets/resolve/:identifier` for card assets so the card information section can render the carrier account value from the carrier type code.
|
||||
|
||||
#### Scenario: Card asset detail preserves carrier_type from resolve response
|
||||
|
||||
- **GIVEN** 用户正在查看后台“资产信息”中的卡资产详情
|
||||
- **AND** `GET /api/admin/assets/resolve/:identifier` 返回了 `carrier_type`
|
||||
- **WHEN** 前端解析卡资产详情响应
|
||||
- **THEN** 页面状态 MUST 保留该 `carrier_type` 原始值
|
||||
- **AND** 后续“卡信息”区域的 `运营商账户` 展示 MUST 基于该状态值进行格式化
|
||||
|
||||
#### Scenario: Missing carrier_type does not break card asset detail parsing
|
||||
|
||||
- **GIVEN** 用户正在查看后台“资产信息”中的卡资产详情
|
||||
- **AND** `GET /api/admin/assets/resolve/:identifier` 未返回 `carrier_type` 或该字段为空
|
||||
- **WHEN** 前端解析卡资产详情响应
|
||||
- **THEN** 页面 MUST 继续保留其他卡资产字段的解析行为
|
||||
- **AND** MUST NOT 因 `carrier_type` 缺失导致“卡信息”区域渲染失败
|
||||
|
||||
### Requirement: Admin Card Asset Carrier Account Display
|
||||
|
||||
The admin asset information view SHALL render the card information field `运营商账户` according to the current logged-in account type.
|
||||
|
||||
For logged-in accounts whose `user_type` is `3` (代理账号) or `4` (企业账号), the field MUST use `carrier_type` and the same carrier-type-to-Chinese mapping used by carrier management.
|
||||
|
||||
Known mappings MUST include `CMCC -> 中国移动`, `CUCC -> 中国联通`, `CTCC -> 中国电信`, and `CBN -> 中国广电`.
|
||||
|
||||
For other logged-in account types, the field MUST keep the existing `carrier_name` display behavior.
|
||||
|
||||
If `carrier_type` is empty or missing, the page MUST display `-`. If `carrier_type` contains an unknown code, the page MUST preserve and display the original code.
|
||||
|
||||
#### Scenario: Show China Telecom label for CTCC in card information for agent or enterprise account
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 是 `3` 或 `4`
|
||||
- **AND** 用户正在查看后台“资产信息”中的卡资产详情
|
||||
- **AND** 当前卡资产详情状态中的 `carrier_type` 为 `CTCC`
|
||||
- **WHEN** 页面渲染“卡信息”区域中的 `运营商账户`
|
||||
- **THEN** 页面 MUST 显示 `中国电信`
|
||||
|
||||
#### Scenario: Show placeholder when carrier_type is empty for agent or enterprise account
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 是 `3` 或 `4`
|
||||
- **AND** 用户正在查看后台“资产信息”中的卡资产详情
|
||||
- **AND** 当前卡资产详情状态中的 `carrier_type` 为空、缺失或仅包含空白字符
|
||||
- **WHEN** 页面渲染“卡信息”区域中的 `运营商账户`
|
||||
- **THEN** 页面 MUST 显示 `-`
|
||||
|
||||
#### Scenario: Preserve unknown carrier_type code for agent or enterprise account
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 是 `3` 或 `4`
|
||||
- **AND** 用户正在查看后台“资产信息”中的卡资产详情
|
||||
- **AND** 当前卡资产详情状态中的 `carrier_type` 为未收录的编码
|
||||
- **WHEN** 页面渲染“卡信息”区域中的 `运营商账户`
|
||||
- **THEN** 页面 MUST 直接显示该原始编码
|
||||
- **AND** MUST NOT 错误映射为其他运营商中文名称
|
||||
|
||||
#### Scenario: Keep carrier_name display for non-agent non-enterprise account
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 不是 `3` 也不是 `4`
|
||||
- **AND** 用户正在查看后台“资产信息”中的卡资产详情
|
||||
- **AND** 当前卡资产详情状态中的 `carrier_name` 为有效值
|
||||
- **WHEN** 页面渲染“卡信息”区域中的 `运营商账户`
|
||||
- **THEN** 页面 MUST 显示该 `carrier_name`
|
||||
|
||||
### Requirement: Admin Card Realname Policy Visibility By Account Type
|
||||
|
||||
The admin asset information view SHALL hide the card information field `实名认证策略` for logged-in accounts whose `user_type` is `3` (代理账号) or `4` (企业账号).
|
||||
|
||||
For other logged-in account types, the page SHALL keep the existing card information field visibility behavior for `实名认证策略`.
|
||||
|
||||
#### Scenario: Hide card realname policy for agent account
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 是 `3`
|
||||
- **AND** 用户正在查看后台“资产信息”中的卡资产详情
|
||||
- **WHEN** 页面渲染“卡信息”区域
|
||||
- **THEN** 页面 MUST NOT 显示 `实名认证策略` 字段
|
||||
|
||||
#### Scenario: Hide card realname policy for enterprise account
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 是 `4`
|
||||
- **AND** 用户正在查看后台“资产信息”中的卡资产详情
|
||||
- **WHEN** 页面渲染“卡信息”区域
|
||||
- **THEN** 页面 MUST NOT 显示 `实名认证策略` 字段
|
||||
|
||||
#### Scenario: Keep card realname policy visible for non-agent non-enterprise account
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 不是 `3` 也不是 `4`
|
||||
- **AND** 用户正在查看后台“资产信息”中的卡资产详情
|
||||
- **WHEN** 页面渲染“卡信息”区域
|
||||
- **THEN** 页面 MUST 继续按现有规则渲染 `实名认证策略` 字段
|
||||
|
||||
### Requirement: Admin Device Sensitive Field Visibility By Account Type
|
||||
|
||||
The admin asset information view SHALL hide the device information fields `实名认证策略` and `制造商` for logged-in accounts whose `user_type` is `3` (代理账号) or `4` (企业账号).
|
||||
|
||||
For other logged-in account types, the page SHALL keep the existing device information field visibility behavior for both fields.
|
||||
|
||||
#### Scenario: Hide device realname policy and manufacturer for agent account
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 是 `3`
|
||||
- **AND** 用户正在查看后台“资产信息”中的设备资产详情
|
||||
- **WHEN** 页面渲染“设备信息”区域
|
||||
- **THEN** 页面 MUST NOT 显示 `实名认证策略` 字段
|
||||
- **AND** 页面 MUST NOT 显示 `制造商` 字段
|
||||
|
||||
#### Scenario: Hide device realname policy and manufacturer for enterprise account
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 是 `4`
|
||||
- **AND** 用户正在查看后台“资产信息”中的设备资产详情
|
||||
- **WHEN** 页面渲染“设备信息”区域
|
||||
- **THEN** 页面 MUST NOT 显示 `实名认证策略` 字段
|
||||
- **AND** 页面 MUST NOT 显示 `制造商` 字段
|
||||
|
||||
#### Scenario: Keep device realname policy and manufacturer visible for non-agent non-enterprise account
|
||||
|
||||
- **GIVEN** 当前登录账号的 `user_type` 不是 `3` 也不是 `4`
|
||||
- **AND** 用户正在查看后台“资产信息”中的设备资产详情
|
||||
- **WHEN** 页面渲染“设备信息”区域
|
||||
- **THEN** 页面 MUST 继续按现有规则渲染 `实名认证策略` 字段
|
||||
- **AND** 页面 MUST 继续按现有规则渲染 `制造商` 字段
|
||||
@@ -0,0 +1,20 @@
|
||||
## 1. Contract And Formatting
|
||||
|
||||
- [x] 1.1 补齐资产信息页面本地类型/状态中的 `carrier_type` 字段,确保卡资产详情可稳定保留该值。
|
||||
- [x] 1.2 复用运营商管理中的运营商类型映射规则,为资产信息页提供 `carrier_type` 到中文文案的格式化能力。
|
||||
|
||||
## 2. UI Visibility
|
||||
|
||||
- [x] 2.1 调整卡资产“卡信息”区域的 `运营商账户` 字段:`user_type=3/4` 展示 `carrier_type` 中文映射,其他账号继续展示原来的 `carrier_name`。
|
||||
- [x] 2.2 当当前登录账号 `user_type` 为 `3` 或 `4` 时,隐藏卡资产“卡信息”区域的 `实名认证策略` 字段。
|
||||
- [x] 2.3 当当前登录账号 `user_type` 为 `3` 或 `4` 时,隐藏设备资产“设备信息”区域的 `实名认证策略` 和 `制造商` 字段。
|
||||
- [x] 2.4 确认本次变更仅影响基础信息描述区,不改动实名认证策略操作按钮和设备绑定卡列表列。
|
||||
|
||||
## 3. Verification
|
||||
|
||||
- [ ] 3.1 验证 `user_type=3/4` 查看卡资产且返回 `carrier_type=CTCC` 时,“运营商账户”显示为 `中国电信`。
|
||||
- [ ] 3.2 验证 `user_type=3/4` 查看卡资产且返回 `carrier_type=CMCC/CUCC/CBN` 时,“运营商账户”分别显示与运营商管理一致的中文文案;空值显示 `-`。
|
||||
- [ ] 3.3 验证 `user_type=3/4` 查看卡资产且返回未知 `carrier_type` 编码时,“运营商账户”保留原编码展示。
|
||||
- [ ] 3.4 验证 `user_type=3` 和 `user_type=4` 查看卡资产时,不显示 `实名认证策略` 字段。
|
||||
- [ ] 3.5 验证 `user_type=3` 和 `user_type=4` 查看设备资产时,不显示 `实名认证策略` 和 `制造商` 字段。
|
||||
- [ ] 3.6 验证其他账号类型查看卡资产时,“运营商账户”继续显示原来的 `carrier_name`;其余上述字段继续按现有规则显示。
|
||||
@@ -0,0 +1,39 @@
|
||||
# Change: 允许企业账号登录后台管理系统
|
||||
|
||||
## Why
|
||||
|
||||
当前前端登录流程会在登录接口成功返回后,基于 `user_type=4` 对企业账号做前端拦截,并提示“企业账号无法登录后台管理系统,请使用平台/代理账号登录”。这与最新业务要求不一致,导致企业账号即使后端已返回有效 token、菜单和权限,也无法进入后台。
|
||||
|
||||
如果只保留现状,企业账号无法访问后台中已经按权限和菜单控制开放给它们的页面,也会与近期多项针对企业账号后台可见性和资产能力的变更方向相冲突。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 移除前端登录流程中对 `user_type=4` 企业账号的后台登录拦截。
|
||||
- 企业账号登录成功后,前端应与其他账号类型一致地:
|
||||
- 保存 token
|
||||
- 保存用户信息
|
||||
- 保存权限、菜单和按钮数据
|
||||
- 在存在可用后台菜单和权限时,继续进入后台默认首页/重定向目标页
|
||||
- 当登录接口成功但 `menus` 为空或 `permissions` 为空时:
|
||||
- 前端仅提示“当前账号暂无任何权限,请联系管理员分配角色和权限”
|
||||
- 不继续进入后台首页或动态路由注册流程
|
||||
- 不作为这条提示的后续动作调用退出登录接口
|
||||
- 登录成功后的页面访问边界继续由现有菜单、路由权限、按钮权限和后端接口权限共同控制。
|
||||
- 本提案不要求本次同步放开所有企业账号受限接口或页面;仅调整“企业账号能否进入后台”的前端准入逻辑。
|
||||
- 本提案不修改登录接口路径、请求参数或返回结构。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs:
|
||||
- `admin-authentication`
|
||||
- Affected code:
|
||||
- `src/composables/useLogin.ts`
|
||||
- `src/router/guards/beforeEach.ts`
|
||||
- `src/router/guards/permission.ts`
|
||||
- `src/App.vue`
|
||||
- 其他依赖当前登录态、菜单和权限进行页面准入的后台入口逻辑
|
||||
- Dependencies:
|
||||
- 后端登录接口继续允许企业账号返回有效 `access_token`、`user`、`permissions`、`menus`、`buttons`
|
||||
- 企业账号需要至少具备一部分后台菜单或权限,才能进入可访问页面
|
||||
- Breaking changes:
|
||||
- 无外部接口破坏性变更;本次为前端登录准入行为放宽
|
||||
@@ -0,0 +1,70 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Enterprise Account Admin Login Admission
|
||||
|
||||
The admin login flow SHALL allow enterprise accounts whose `user_type` is `4` to sign in to the admin system when the login API returns a successful response with valid authentication data.
|
||||
|
||||
The frontend MUST NOT reject admin login solely because `user_type` equals `4`.
|
||||
|
||||
#### Scenario: Enterprise account is allowed to complete admin login
|
||||
|
||||
- **GIVEN** 用户使用企业账号凭证登录后台管理系统
|
||||
- **AND** 登录接口返回成功状态
|
||||
- **AND** 返回数据包含有效 `access_token`
|
||||
- **AND** 返回数据中的 `user.user_type` 为 `4`
|
||||
- **WHEN** 前端处理登录成功响应
|
||||
- **THEN** 前端 MUST 继续执行后台登录成功流程
|
||||
- **AND** MUST NOT 弹出“企业账号无法登录后台管理系统,请使用平台/代理账号登录”提示
|
||||
|
||||
#### Scenario: Enterprise account login still fails when login API itself fails
|
||||
|
||||
- **GIVEN** 用户使用企业账号凭证登录后台管理系统
|
||||
- **AND** 登录接口返回失败状态,或未返回有效 `access_token`
|
||||
- **WHEN** 前端处理登录响应
|
||||
- **THEN** 前端 MUST 继续按现有登录失败流程处理
|
||||
- **AND** MUST NOT 将“允许企业账号登录后台”解释为绕过登录接口失败
|
||||
|
||||
### Requirement: Enterprise Account Login State Persistence
|
||||
|
||||
The admin login flow SHALL persist enterprise-account login state using the same token, user, permissions, menus, and buttons handling used for other successful admin logins only when the login response provides usable admin-access data.
|
||||
|
||||
#### Scenario: Enterprise account saves auth state after successful login with usable admin access data
|
||||
|
||||
- **GIVEN** 用户使用企业账号成功登录后台管理系统
|
||||
- **AND** 登录返回中包含 `access_token`、`refresh_token`、`user`、`permissions`、`menus`、`buttons`
|
||||
- **AND** `permissions` 非空
|
||||
- **AND** `menus` 非空
|
||||
- **WHEN** 前端写入登录态
|
||||
- **THEN** 前端 MUST 保存 token
|
||||
- **AND** MUST 保存用户信息
|
||||
- **AND** MUST 保存权限、菜单和按钮数据
|
||||
|
||||
#### Scenario: Enterprise account shows no-permission warning without logout follow-up
|
||||
|
||||
- **GIVEN** 用户使用企业账号成功登录后台管理系统
|
||||
- **AND** 登录返回中的 `permissions` 为空,或 `menus` 为空
|
||||
- **WHEN** 前端处理登录成功响应
|
||||
- **THEN** 前端 MUST 继续显示现有“当前账号暂无任何权限,请联系管理员分配角色和权限”提示
|
||||
- **AND** MUST NOT 因为空权限或空菜单回退为企业账号登录拦截
|
||||
- **AND** MUST NOT 继续进入后台首页或动态路由注册流程
|
||||
- **AND** MUST NOT 因这条无权限提示而调用退出登录接口
|
||||
|
||||
### Requirement: Enterprise Account Admin Entry Uses Existing Authorization Boundaries
|
||||
|
||||
Allowing enterprise accounts to sign in to the admin system SHALL NOT by itself grant additional page or API access beyond the existing menu, route-permission, button-permission, and backend authorization boundaries.
|
||||
|
||||
#### Scenario: Enterprise account enters admin and follows existing route registration flow
|
||||
|
||||
- **GIVEN** 用户使用企业账号成功登录后台管理系统
|
||||
- **AND** 登录返回中的 `permissions` 非空
|
||||
- **AND** 登录返回中的 `menus` 非空
|
||||
- **WHEN** 前端进入登录后的路由注册和首页跳转流程
|
||||
- **THEN** 前端 MUST 继续按现有菜单和动态路由注册逻辑处理
|
||||
- **AND** MUST NOT 因 `user_type=4` 在该阶段额外拒绝用户进入后台
|
||||
|
||||
#### Scenario: Enterprise account page access remains permission-controlled
|
||||
|
||||
- **GIVEN** 用户已使用企业账号登录后台管理系统
|
||||
- **WHEN** 用户尝试访问某个后台页面或触发某个后台操作
|
||||
- **THEN** 页面访问和操作可用性 MUST 继续由现有菜单、路由权限、按钮权限和后端接口鉴权决定
|
||||
- **AND** 允许登录后台本身 MUST NOT 被解释为默认拥有全部后台页面和操作权限
|
||||
@@ -0,0 +1,17 @@
|
||||
## 1. Login Flow
|
||||
|
||||
- [x] 1.1 移除登录成功后对 `user_type=4` 企业账号的前端拒绝逻辑和错误提示。
|
||||
- [x] 1.2 确保企业账号在登录成功后与其他账号一样完成 token、用户信息、权限、菜单、按钮的保存流程。
|
||||
- [x] 1.3 当登录成功但 `menus` 或 `permissions` 为空时,仅提示“当前账号暂无任何权限,请联系管理员分配角色和权限”并停止后续登录流程,不调用退出登录接口。
|
||||
|
||||
## 2. Navigation And Access
|
||||
|
||||
- [x] 2.1 确保企业账号在具备可用后台菜单和权限时,继续走现有后台首页跳转和路由注册流程,不因账号类型被额外拦截。
|
||||
- [x] 2.2 确认企业账号后台访问范围仍由现有菜单、路由权限和后端接口权限控制,而不是在登录阶段一刀切拒绝。
|
||||
|
||||
## 3. Verification
|
||||
|
||||
- [ ] 3.1 验证企业账号登录成功后不再出现“企业账号无法登录后台管理系统,请使用平台/代理账号登录”提示。
|
||||
- [ ] 3.2 验证企业账号在具备可用后台菜单和权限时,能正常保存登录态并进入后台首页或重定向目标页。
|
||||
- [ ] 3.3 验证企业账号在菜单为空或权限为空时,仅提示“暂无任何权限”,且不会继续调用退出登录接口。
|
||||
- [ ] 3.4 验证平台账号和代理账号登录流程不受影响。
|
||||
@@ -0,0 +1,22 @@
|
||||
# Change: 换货新资产归属继承提示
|
||||
|
||||
## Why
|
||||
|
||||
当前换货流程在选择新资产后,页面没有明确告知换货完成后的最终归属店铺,运营人员容易误以为可以手工选择目标店铺,进而对换货结果产生误判。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 在换货创建入口、发货确认入口、换货详情页补充旧资产所属店铺和新资产继承归属店铺的展示。
|
||||
- 保持现有换货创建、发货、确认完成接口和入参语义不变,不新增目标店铺选择控件或目标店铺提交字段。
|
||||
- 扩展换货响应数据,返回 `inherited_shop_id` 和 `inherited_shop_name` 供前端统一展示最终归属店铺。
|
||||
- 在创建、发货、确认完成流程中补充提交中禁用、防重复提交、后端归属校验失败提示,以及成功后的详情刷新。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: `exchange-management`
|
||||
- Related active changes: `update-exchange-flow-direct-type`(本提案建立在现有换货流程类型改造之上,需合并考虑)
|
||||
- Affected code:
|
||||
- `src/api/modules/exchange.ts`
|
||||
- `src/views/asset-management/exchange-management/index.vue`
|
||||
- `src/views/asset-management/exchange-management/detail.vue`
|
||||
- 相关旧资产/新资产搜索结果类型或映射逻辑(如需补充店铺名称展示数据)
|
||||
@@ -0,0 +1,88 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: 换货归属继承上下文展示
|
||||
|
||||
系统 SHALL 在换货创建和发货确认流程中展示旧资产当前所属店铺,并在用户选定新资产后以只读方式提示换货完成后的继承归属店铺,避免用户误认为可以手工指定目标店铺。
|
||||
|
||||
#### Scenario: 创建入口展示旧资产所属店铺
|
||||
|
||||
- **GIVEN** 用户进入现有换货创建入口
|
||||
- **WHEN** 用户选择旧资产
|
||||
- **THEN** 系统 MUST 显示该旧资产当前所属店铺名称
|
||||
- **AND** 该所属店铺信息 MUST be read-only
|
||||
|
||||
#### Scenario: 选择新资产后展示继承归属提示
|
||||
|
||||
- **GIVEN** 用户正在换货创建或发货确认流程中操作
|
||||
- **WHEN** 用户选择新资产
|
||||
- **THEN** 系统 MUST 显示只读提示 `换货完成后将归属:{店铺名称}`
|
||||
- **AND** `{店铺名称}` MUST 表示该新资产换货完成后的最终归属店铺
|
||||
|
||||
#### Scenario: 页面不提供目标店铺选择控件
|
||||
|
||||
- **WHEN** 用户查看换货创建或发货确认入口
|
||||
- **THEN** 系统 MUST NOT 渲染目标店铺选择控件
|
||||
- **AND** 用户 MUST NOT 能够手工覆盖继承归属店铺
|
||||
|
||||
### Requirement: 换货归属继承接口契约
|
||||
|
||||
系统 SHALL 复用现有换货创建、发货和确认完成接口,并在换货数据模型中返回继承后的店铺标识和店铺名称,供创建结果、发货结果、完成结果和详情页统一展示。
|
||||
|
||||
#### Scenario: 创建请求保持既有字段语义
|
||||
|
||||
- **WHEN** 前端调用 `POST /api/admin/exchanges`
|
||||
- **THEN** 请求体 MUST 继续沿用旧资产、新资产、换货类型和资料迁移字段
|
||||
- **AND** 请求体 MUST NOT 新增目标店铺字段
|
||||
|
||||
#### Scenario: 发货和完成请求不新增目标店铺字段
|
||||
|
||||
- **WHEN** 前端调用 `POST /api/admin/exchanges/{id}/ship` 或 `POST /api/admin/exchanges/{id}/complete`
|
||||
- **THEN** 请求体 MUST NOT 新增目标店铺字段
|
||||
- **AND** 后端 MUST 继续按现有换货流程处理归属继承
|
||||
|
||||
#### Scenario: 换货响应返回继承店铺字段
|
||||
|
||||
- **WHEN** 前端收到换货创建、发货、确认完成结果或读取换货详情
|
||||
- **THEN** 返回的 `data` MUST 包含 `inherited_shop_id:int64` 和 `inherited_shop_name:string`
|
||||
- **AND** `inherited_shop_name` MUST 表示换货完成后新资产最终归属的店铺名称
|
||||
|
||||
### Requirement: 换货详情继承归属展示
|
||||
|
||||
系统 SHALL 在换货详情页展示继承后的店铺名称,并在关键操作成功后刷新详情数据,保证页面展示的归属信息与后端一致。
|
||||
|
||||
#### Scenario: 详情页展示继承后的店铺名称
|
||||
|
||||
- **GIVEN** 用户进入换货详情页
|
||||
- **WHEN** 详情数据加载成功
|
||||
- **THEN** 页面 MUST 展示继承后的店铺名称
|
||||
- **AND** 页面 MUST NOT 隐藏该归属字段
|
||||
|
||||
#### Scenario: 发货或确认完成成功后刷新详情
|
||||
|
||||
- **GIVEN** 用户完成换货发货或确认完成操作
|
||||
- **WHEN** 接口返回成功
|
||||
- **THEN** 系统 MUST 重新拉取该换货单详情
|
||||
- **AND** 刷新后的详情 MUST 展示最新的继承归属店铺信息
|
||||
|
||||
### Requirement: 换货归属继承错误与提交状态处理
|
||||
|
||||
系统 SHALL 在新资产归属校验失败时直接展示后端错误,并在创建、发货、确认完成提交期间禁用操作按钮,防止重复提交,同时保证失败后可以重试。
|
||||
|
||||
#### Scenario: 新资产属于其他店铺时展示后端错误
|
||||
|
||||
- **GIVEN** 用户选择了不允许用于当前换货流程的新资产
|
||||
- **WHEN** 后端返回“新资产属于其他店铺”或等价归属校验错误
|
||||
- **THEN** 系统 MUST 直接展示后端错误信息
|
||||
- **AND** 系统 MUST NOT 提供手工修改目标店铺的替代入口
|
||||
|
||||
#### Scenario: 提交期间禁用按钮防止重复提交
|
||||
|
||||
- **WHEN** 用户提交创建、发货或确认完成操作
|
||||
- **THEN** 当前操作按钮 MUST 进入禁用或 loading 状态直到请求结束
|
||||
- **AND** 在请求完成前的重复点击 MUST NOT 触发第二次提交
|
||||
|
||||
#### Scenario: 请求失败后恢复可重试状态
|
||||
|
||||
- **WHEN** 创建、发货或确认完成请求失败
|
||||
- **THEN** 系统 MUST 恢复当前操作按钮可用状态
|
||||
- **AND** 页面 MUST 保留当前已展示的资产与归属提示,便于用户修正后重试
|
||||
@@ -0,0 +1,22 @@
|
||||
## 1. API Contract
|
||||
|
||||
- [x] 1.1 更新换货数据模型,补充 `inherited_shop_id` 和 `inherited_shop_name` 响应字段,并覆盖创建、发货、确认完成及详情读取场景。
|
||||
- [x] 1.2 保持 `POST /api/admin/exchanges`、`POST /api/admin/exchanges/{id}/ship`、`POST /api/admin/exchanges/{id}/complete` 的既有入参语义,不新增目标店铺字段。
|
||||
|
||||
## 2. Exchange Create And Ship UI
|
||||
|
||||
- [x] 2.1 在换货创建入口中,选择旧资产后展示旧资产所属店铺。
|
||||
- [x] 2.2 在换货创建入口和发货确认入口中,选择新资产后展示只读提示 `换货完成后将归属:{店铺名称}`。
|
||||
- [x] 2.3 确保上述页面不新增目标店铺选择控件,也不允许手工覆盖继承归属。
|
||||
|
||||
## 3. Exchange Detail And Submission States
|
||||
|
||||
- [x] 3.1 在换货详情页展示继承后的店铺名称,并在发货或确认完成成功后重新拉取详情。
|
||||
- [x] 3.2 在创建、发货、确认完成提交期间禁用操作按钮,防止重复提交。
|
||||
- [x] 3.3 在新资产归属校验失败时展示后端错误,并在失败后恢复可重试状态。
|
||||
|
||||
## 4. Verification
|
||||
|
||||
- [x] 4.1 验证创建、发货确认、详情三个入口均能正确展示旧资产所属店铺和继承归属店铺。
|
||||
- [x] 4.2 验证加载中、失败提示、重复提交防护和成功后详情刷新的交互状态。
|
||||
- [x] 4.3 运行相关前端校验,并执行 `openspec validate update-exchange-inherited-shop-hint --strict`。
|
||||
@@ -0,0 +1,26 @@
|
||||
# Change: 展示换货退款拦截错误
|
||||
|
||||
## Why
|
||||
|
||||
创建换货单时,后端会拦截存在活跃退款申请的资产,但当前创建页仅使用通用提示或控制台日志,运营无法直接知道资产因退款申请不能换货。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 复用 `POST /api/admin/exchanges` 的现有失败 `code`、`msg` 契约,不改变成功响应结构。
|
||||
- 创建换货单被退款拦截或其他后端业务规则拒绝时,在创建换货单表单顶部或旧资产行直接展示后端业务原因,例如“该资产存在退款申请”。
|
||||
- 创建失败后保留当前填写的表单、已选资产与流程类型,恢复提交按钮使用户可更换资产后重新提交。
|
||||
- 前端不新增退款状态查询、预检查区域或退款申请入口。
|
||||
- 前端不读取或推断退款审批、撤销、拒绝或处理完成状态;是否允许换货完全依据创建接口结果。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: `exchange-management`
|
||||
- Affected code:
|
||||
- `src/api/modules/exchange.ts`
|
||||
- `src/views/asset-management/exchange-management/index.vue`
|
||||
- API contract:
|
||||
- `POST /api/admin/exchanges`
|
||||
- Out of scope:
|
||||
- 退款状态查询和预检查
|
||||
- 退款审批、撤销、拒绝或处理功能
|
||||
- 换货创建成功响应结构调整
|
||||
@@ -0,0 +1,54 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Exchange Creation Refund Interception Feedback
|
||||
|
||||
The exchange creation page SHALL display the backend business reason when `POST /api/admin/exchanges` rejects the selected old asset because of an active refund application. The page MUST use the response `code` and `msg` contract without changing the successful exchange response structure.
|
||||
|
||||
#### Scenario: Display active refund interception reason
|
||||
|
||||
- **GIVEN** 用户已填写创建换货单表单并选择存在活跃退款申请的旧资产
|
||||
- **WHEN** `POST /api/admin/exchanges` 返回失败 `code` 和 `msg`
|
||||
- **THEN** 页面 MUST display the backend business reason in the create exchange form context
|
||||
- **AND** 当后端 `msg` 为“该资产存在退款申请”时,页面 MUST display that message directly
|
||||
- **AND** 系统 MUST NOT create a new exchange order
|
||||
|
||||
#### Scenario: Display other exchange creation business reason
|
||||
|
||||
- **GIVEN** 用户已填写创建换货单表单
|
||||
- **WHEN** 创建接口返回非退款相关的业务失败 `code` 和 `msg`
|
||||
- **THEN** 页面 MUST display the backend `msg` in the create exchange form context
|
||||
- **AND** 页面 MUST NOT replace the backend business reason with a generic frontend failure message
|
||||
|
||||
### Requirement: Exchange Creation Retry After Interception
|
||||
|
||||
The exchange creation page SHALL preserve the current form values after a backend rejection and allow the user to change assets and submit again after the request completes.
|
||||
|
||||
#### Scenario: Preserve form after refund interception
|
||||
|
||||
- **GIVEN** 创建换货单请求被后端退款规则拒绝
|
||||
- **WHEN** 页面展示后端业务原因
|
||||
- **THEN** 页面 MUST retain the selected old asset, new asset when applicable, flow type, reason, and other form values
|
||||
- **AND** 提交按钮 MUST leave its loading state after the request completes
|
||||
|
||||
#### Scenario: Retry with another asset
|
||||
|
||||
- **GIVEN** 用户已收到退款拦截错误
|
||||
- **WHEN** 用户更换旧资产并再次提交创建换货单
|
||||
- **THEN** 系统 MUST send a new `POST /api/admin/exchanges` request using the updated form values
|
||||
|
||||
### Requirement: Backend-Controlled Exchange Refund Eligibility
|
||||
|
||||
The exchange creation page MUST rely exclusively on the exchange creation response to determine refund-related eligibility. The frontend MUST NOT add a refund status lookup, a refund pre-check area, or infer eligibility from refund approval, rejection, withdrawal, or completion states.
|
||||
|
||||
#### Scenario: Do not pre-check refund eligibility
|
||||
|
||||
- **WHEN** 用户打开或填写创建换货单表单
|
||||
- **THEN** 页面 MUST NOT issue a refund status query solely to determine exchange eligibility
|
||||
- **AND** 页面 MUST NOT render a refund status pre-check area
|
||||
|
||||
#### Scenario: Permit assets according to backend decision
|
||||
|
||||
- **GIVEN** 用户选择曾有退款申请但后端允许换货的资产
|
||||
- **WHEN** 创建接口成功返回
|
||||
- **THEN** 页面 MUST treat the exchange creation as successful
|
||||
- **AND** 页面 MUST NOT block the operation based on a frontend interpretation of refund history
|
||||
@@ -0,0 +1,22 @@
|
||||
## 1. Exchange Creation Failure Contract
|
||||
|
||||
- [x] 1.1 保持 `POST /api/admin/exchanges` 及其成功响应结构不变。
|
||||
- [x] 1.2 读取创建失败响应的统一 `code` 和 `msg`,不将后端业务原因替换为通用前端文案。
|
||||
|
||||
## 2. Refund Interception Feedback
|
||||
|
||||
- [x] 2.1 在创建换货单表单顶部或旧资产行展示后端返回的退款拦截业务原因。
|
||||
- [x] 2.2 退款拦截失败后保留表单输入、已选资产和流程类型。
|
||||
- [x] 2.3 请求结束后恢复提交按钮,使用户能够更换资产并再次提交。
|
||||
|
||||
## 3. Backend-Controlled Eligibility
|
||||
|
||||
- [x] 3.1 不增加退款状态查询、预检查区域或退款申请入口。
|
||||
- [x] 3.2 不根据退款审批、撤销、拒绝或处理状态自行判断资产能否换货。
|
||||
|
||||
## 4. Verification
|
||||
|
||||
- [ ] 4.1 验证活跃退款资产创建换货时显示“该资产存在退款申请”或后端等价业务原因,且不创建换货单。
|
||||
- [ ] 4.2 验证已拒绝、撤销或处理完成退款的资产按后端结果可继续创建换货。
|
||||
- [ ] 4.3 验证失败后保留表单并可更换资产重新提交。
|
||||
- [x] 4.4 运行相关前端校验,并执行 `openspec validate update-exchange-refund-interception-feedback --strict`。
|
||||
@@ -0,0 +1,29 @@
|
||||
# Change: 更新换货列表的新旧资产展示与独立搜索
|
||||
|
||||
## Why
|
||||
|
||||
换货管理列表当前使用一个资产标识符条件同时匹配旧资产和新资产,且表格未完整区分两侧资产类型与标识。运营人员无法准确按换出资产或换入资产检索、识别换货单。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 将换货列表筛选区的单一“资产标识符”替换为“旧资产”和“新资产”两个独立输入框。
|
||||
- 列表查询使用 `old_asset_keyword` 和 `new_asset_keyword`;两个条件可独立或组合传递,空条件不传。
|
||||
- 停止在换货列表查询中使用旧的通用 `identifier` 参数。
|
||||
- 扩展换货列表项契约,支持旧资产和新资产各自的 `type`、`id`、`identifier`,以及 `status`、`status_name`。
|
||||
- 换货列表分别展示旧资产类型、旧资产标识、新资产类型、新资产标识四列,不能混列。
|
||||
- 物联网卡使用后端返回的 ICCID,设备使用后端返回的设备号;前端不转换接入号、虚拟号或其他输入标识。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs:
|
||||
- `exchange-management`
|
||||
- Related active changes:
|
||||
- `update-exchange-flow-direct-type`,本提案替换其换货列表通用资产标识符筛选口径,不改变流程类型筛选与换货操作。
|
||||
- `update-asset-exchange-generation-links`,仅共享换货领域概念,不修改资产详情换货链路展示。
|
||||
- Affected code:
|
||||
- `src/api/modules/exchange.ts`
|
||||
- `src/views/asset-management/exchange-management/index.vue`
|
||||
- API contract:
|
||||
- `GET /api/admin/exchanges?old_asset_keyword=&new_asset_keyword=`
|
||||
- Dependencies:
|
||||
- 后端列表接口支持分别按旧资产和新资产关键词查询,并返回新旧资产字段。
|
||||
@@ -0,0 +1,96 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Exchange List Separate Asset Query Contract
|
||||
|
||||
The exchange management list integration SHALL query `GET /api/admin/exchanges` with optional `old_asset_keyword` and `new_asset_keyword` parameters instead of the deprecated generic `identifier` parameter.
|
||||
|
||||
#### Scenario: Query by old asset only
|
||||
|
||||
- **GIVEN** 用户在换货管理列表的“旧资产”输入框中填写关键词
|
||||
- **AND** “新资产”输入框为空
|
||||
- **WHEN** 用户执行搜索
|
||||
- **THEN** 请求 MUST include `old_asset_keyword` with the entered value
|
||||
- **AND** 请求 MUST NOT include `new_asset_keyword`
|
||||
- **AND** 请求 MUST NOT include `identifier`
|
||||
|
||||
#### Scenario: Query by new asset only
|
||||
|
||||
- **GIVEN** 用户在换货管理列表的“新资产”输入框中填写关键词
|
||||
- **AND** “旧资产”输入框为空
|
||||
- **WHEN** 用户执行搜索
|
||||
- **THEN** 请求 MUST include `new_asset_keyword` with the entered value
|
||||
- **AND** 请求 MUST NOT include `old_asset_keyword`
|
||||
- **AND** 请求 MUST NOT include `identifier`
|
||||
|
||||
#### Scenario: Combine old and new asset keywords
|
||||
|
||||
- **GIVEN** 用户在“旧资产”和“新资产”输入框中均填写关键词
|
||||
- **WHEN** 用户执行搜索
|
||||
- **THEN** 请求 MUST include both `old_asset_keyword` and `new_asset_keyword`
|
||||
- **AND** 后端返回同时匹配两项条件的换货单
|
||||
|
||||
#### Scenario: Omit empty asset keywords
|
||||
|
||||
- **GIVEN** “旧资产”和“新资产”输入框均为空
|
||||
- **WHEN** 用户查询、刷新、切换分页或重置搜索条件
|
||||
- **THEN** 请求 MUST NOT include `old_asset_keyword`
|
||||
- **AND** 请求 MUST NOT include `new_asset_keyword`
|
||||
- **AND** 请求 MUST NOT include `identifier`
|
||||
|
||||
#### Scenario: Preserve raw asset keyword input
|
||||
|
||||
- **GIVEN** 用户输入 ICCID、接入号、虚拟号、IMEI 或 SN 作为旧资产或新资产关键词
|
||||
- **WHEN** 页面发送列表查询请求
|
||||
- **THEN** 页面 MUST pass the entered text unchanged in its corresponding keyword parameter
|
||||
- **AND** 页面 MUST NOT convert an access number, virtual number, or other identifier into another asset identifier
|
||||
|
||||
### Requirement: Exchange List Separate Asset Display Contract
|
||||
|
||||
The exchange list-item contract SHALL preserve `old_asset_type`, `old_asset_id`, `old_asset_identifier`, `new_asset_type`, `new_asset_id`, `new_asset_identifier`, `status`, and `status_name` from each `GET /api/admin/exchanges` item.
|
||||
|
||||
#### Scenario: Parse old and new asset fields
|
||||
|
||||
- **GIVEN** 换货列表接口返回一条换货单
|
||||
- **WHEN** 前端解析该列表项
|
||||
- **THEN** 前端类型 MUST support the old asset type, ID, and identifier fields independently from the new asset fields
|
||||
- **AND** 前端类型 MUST support `status` and `status_name`
|
||||
|
||||
### Requirement: Exchange List Separate Asset Columns
|
||||
|
||||
The exchange management list SHALL display distinct columns for `旧资产类型`, `旧资产标识`, `新资产类型`, and `新资产标识`.
|
||||
|
||||
#### Scenario: Display separate old and new IoT card assets
|
||||
|
||||
- **GIVEN** 换货列表项的 `old_asset_type` 和 `new_asset_type` 均为 `iot_card`
|
||||
- **WHEN** 页面渲染换货列表行
|
||||
- **THEN** 旧资产类型和新资产类型 MUST each display `物联网卡`
|
||||
- **AND** 旧资产标识 MUST display `old_asset_identifier` as the backend-returned ICCID
|
||||
- **AND** 新资产标识 MUST display `new_asset_identifier` as the backend-returned ICCID
|
||||
|
||||
#### Scenario: Display separate old and new device assets
|
||||
|
||||
- **GIVEN** 换货列表项的旧资产或新资产类型为 `device`
|
||||
- **WHEN** 页面渲染换货列表行
|
||||
- **THEN** 对应资产类型 MUST display `设备`
|
||||
- **AND** 对应资产标识 MUST display its backend-returned device number
|
||||
|
||||
#### Scenario: Keep old and new asset values separated
|
||||
|
||||
- **GIVEN** 换货列表接口返回新旧资产字段
|
||||
- **WHEN** 页面渲染换货列表行
|
||||
- **THEN** 旧资产列 MUST only read `old_asset_type` and `old_asset_identifier`
|
||||
- **AND** 新资产列 MUST only read `new_asset_type` and `new_asset_identifier`
|
||||
- **AND** 页面 MUST NOT substitute a missing new asset value with an old asset value
|
||||
|
||||
#### Scenario: Display unavailable new asset placeholder
|
||||
|
||||
- **GIVEN** 换货列表项尚未关联新资产,或新资产类型或标识为空
|
||||
- **WHEN** 页面渲染新资产列
|
||||
- **THEN** 页面 MUST display a stable placeholder for each unavailable value
|
||||
|
||||
#### Scenario: Display backend exchange status name
|
||||
|
||||
- **GIVEN** 换货列表项返回 `status_name`
|
||||
- **WHEN** 页面渲染状态列
|
||||
- **THEN** 页面 MUST display `status_name`
|
||||
- **AND** 当 `status_name` 缺失时页面 MUST display a stable placeholder
|
||||
@@ -0,0 +1,26 @@
|
||||
## 1. API Contract And Types
|
||||
|
||||
- [ ] 1.1 将换货列表查询类型中的通用 `identifier` 替换为可选的 `old_asset_keyword` 与 `new_asset_keyword`。
|
||||
- [ ] 1.2 扩展换货列表项类型,支持 `old_asset_type`、`old_asset_id`、`old_asset_identifier`、`new_asset_type`、`new_asset_id`、`new_asset_identifier`、`status` 和 `status_name`。
|
||||
|
||||
## 2. Exchange List Search
|
||||
|
||||
- [ ] 2.1 将换货管理列表筛选区的“资产标识符”替换为“旧资产”和“新资产”输入框。
|
||||
- [ ] 2.2 查询、刷新和分页时保留并传递非空的 `old_asset_keyword`、`new_asset_keyword`,不再发送 `identifier`。
|
||||
- [ ] 2.3 重置搜索条件时清空新旧资产关键词,后续请求不发送这两个参数。
|
||||
- [ ] 2.4 保留用户输入的 ICCID、接入号、虚拟号、IMEI 或 SN 原始值,不在前端转换后再传递给后端。
|
||||
|
||||
## 3. Exchange List Display
|
||||
|
||||
- [ ] 3.1 增加旧资产类型、旧资产标识、新资产类型、新资产标识四个独立列表列。
|
||||
- [ ] 3.2 根据后端资产类型显示“物联网卡”或“设备”,并原样显示对应后端资产标识。
|
||||
- [ ] 3.3 状态列优先展示后端 `status_name`,缺失时显示稳定占位内容。
|
||||
- [ ] 3.4 新资产字段在未分配时显示稳定占位内容,不与旧资产字段混用。
|
||||
|
||||
## 4. Verification
|
||||
|
||||
- [ ] 4.1 验证仅输入旧资产、仅输入新资产、同时输入新旧资产时,请求分别传递正确的关键词参数。
|
||||
- [ ] 4.2 验证两个资产关键词均为空时不传筛选参数,重置后保持相同行为。
|
||||
- [ ] 4.3 验证旧资产和新资产类型、标识符分别显示,IoT 卡显示 ICCID、设备显示设备号。
|
||||
- [ ] 4.4 验证卡的 ICCID、接入号或虚拟号关键词均由后端按输入所在的旧/新资产条件命中,前端不转换输入值。
|
||||
- [ ] 4.5 运行相关类型检查、lint 或构建验证。
|
||||
@@ -0,0 +1,32 @@
|
||||
# Change: 支持套餐分配生效条件覆盖
|
||||
|
||||
## Why
|
||||
|
||||
代理套餐分配目前只能使用套餐本身的默认生效条件,运营无法针对某个店铺套餐授权选择购买即生效或实名即生效。分配页也无法区分套餐默认值、分配覆盖值和最终实际生效值,容易误解后续订单的生效规则。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 在套餐授权/分配和已分配套餐编辑入口增加“生效条件”单选:跟随套餐默认、购买即生效、实名即生效。
|
||||
- 新建分配时调用 `POST /api/admin/shop-package-allocations`,明确传递 `expiry_base_override`;选择“跟随套餐默认”时 MUST 显式传递 `null`,不得省略字段。
|
||||
- 已分配套餐修改生效条件时调用 `PATCH /api/admin/shop-package-allocations/{id}/expiry-base`,请求体为 `expiry_base_override:null|from_purchase|from_realname`。
|
||||
- 在分配详情、编辑弹框和代理系列授权套餐列表展示后端返回的默认生效条件、覆盖生效条件和最终生效条件的中文名称。
|
||||
- 修改弹框提示“仅影响后续新订单,不影响已购买套餐”。
|
||||
- 前端不根据默认值和覆盖值自行计算最终生效条件,直接使用后端返回的 `effective_expiry_base` 及其名称字段。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs:
|
||||
- `shop-package-allocation`
|
||||
- `shop-series-grant-packages`
|
||||
- Affected code:
|
||||
- `src/types/api/packageManagement.ts`
|
||||
- 新增或扩展 `src/api/modules` 中的店铺套餐分配服务
|
||||
- `src/views/package-management/series-grants/index.vue`
|
||||
- `src/views/package-management/series-grants/packages.vue`
|
||||
- `src/views/package-management/series-grants/detail.vue`
|
||||
- API contracts:
|
||||
- `POST /api/admin/shop-package-allocations`
|
||||
- `PATCH /api/admin/shop-package-allocations/{id}/expiry-base`
|
||||
- Out of scope:
|
||||
- 已购买套餐或历史订单的生效条件迁移
|
||||
- 前端根据分配字段推导或覆盖实际生效条件
|
||||
@@ -0,0 +1,74 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Package Allocation Expiry Base Override Contract
|
||||
|
||||
The shop package allocation contract SHALL support an explicit `expiry_base_override` when creating or updating an allocation. The allowed request values MUST be `null`, `from_purchase`, and `from_realname`.
|
||||
|
||||
#### Scenario: Create allocation following the package default
|
||||
|
||||
- **GIVEN** 用户在套餐授权/分配弹框选择“跟随套餐默认”
|
||||
- **WHEN** 用户创建店铺套餐分配
|
||||
- **THEN** 系统 MUST call `POST /api/admin/shop-package-allocations`
|
||||
- **AND** 请求 MUST explicitly contain `expiry_base_override: null`
|
||||
- **AND** 系统 MUST NOT omit `expiry_base_override` to represent following the default
|
||||
|
||||
#### Scenario: Create allocation with purchase activation override
|
||||
|
||||
- **GIVEN** 用户在套餐授权/分配弹框选择“购买即生效”
|
||||
- **WHEN** 用户创建店铺套餐分配
|
||||
- **THEN** 请求 MUST contain `expiry_base_override: "from_purchase"`
|
||||
|
||||
#### Scenario: Create allocation with realname activation override
|
||||
|
||||
- **GIVEN** 用户在套餐授权/分配弹框选择“实名即生效”
|
||||
- **WHEN** 用户创建店铺套餐分配
|
||||
- **THEN** 请求 MUST contain `expiry_base_override: "from_realname"`
|
||||
|
||||
### Requirement: Package Allocation Expiry Base Update
|
||||
|
||||
The system SHALL update an existing package allocation's expiry-base override through `PATCH /api/admin/shop-package-allocations/{id}/expiry-base` with a body containing `expiry_base_override`.
|
||||
|
||||
#### Scenario: Update allocation expiry base override
|
||||
|
||||
- **GIVEN** 用户正在编辑已分配套餐的生效条件
|
||||
- **WHEN** 用户选择“购买即生效”或“实名即生效”并保存
|
||||
- **THEN** 系统 MUST call `PATCH /api/admin/shop-package-allocations/{id}/expiry-base`
|
||||
- **AND** 请求体 MUST contain the selected `expiry_base_override`
|
||||
|
||||
#### Scenario: Restore allocation to package default
|
||||
|
||||
- **GIVEN** 用户正在编辑已分配套餐的生效条件
|
||||
- **WHEN** 用户选择“跟随套餐默认”并保存
|
||||
- **THEN** 请求体 MUST explicitly contain `expiry_base_override: null`
|
||||
|
||||
### Requirement: Package Allocation Expiry Base Resolution Response
|
||||
|
||||
The package allocation response SHALL provide `default_expiry_base`, `expiry_base_override`, and `effective_expiry_base`, together with their corresponding Chinese name fields. The frontend MUST render the returned effective value and name without calculating it from other fields.
|
||||
|
||||
#### Scenario: Display distinct expiry base values
|
||||
|
||||
- **WHEN** 前端加载或更新店铺套餐分配记录
|
||||
- **THEN** 前端类型 MUST support `default_expiry_base`、`expiry_base_override`、`effective_expiry_base`
|
||||
- **AND** 前端类型 MUST support the corresponding Chinese name fields
|
||||
- **AND** 页面 MUST distinguish the default value, override value, and effective value
|
||||
|
||||
#### Scenario: Use backend effective expiry base
|
||||
|
||||
- **GIVEN** 分配响应同时返回默认值和覆盖值
|
||||
- **WHEN** 页面展示最终生效条件
|
||||
- **THEN** 页面 MUST display the backend returned `effective_expiry_base_name`
|
||||
- **AND** 前端 MUST NOT calculate or replace the effective value from the default value and override value
|
||||
|
||||
### Requirement: Package Allocation Expiry Base Applies Prospectively
|
||||
|
||||
The package allocation expiry-base override SHALL apply only to future new orders. The allocation creation and editing UI MUST inform the user that purchased packages are unaffected.
|
||||
|
||||
#### Scenario: Inform user before changing allocation expiry base
|
||||
|
||||
- **WHEN** 用户在已分配套餐编辑弹框查看或修改生效条件
|
||||
- **THEN** 页面 MUST display `仅影响后续新订单,不影响已购买套餐`
|
||||
|
||||
#### Scenario: Preserve purchased package behavior
|
||||
|
||||
- **WHEN** 用户创建、更新或恢复套餐分配的生效条件
|
||||
- **THEN** 前端 MUST NOT attempt to update existing purchased packages or historical orders
|
||||
@@ -0,0 +1,35 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Series Grant Package Expiry Base Visibility
|
||||
|
||||
The series grant package list and package edit context SHALL display the package allocation's default expiry base, override expiry base, and effective expiry base using the Chinese name fields returned by the backend.
|
||||
|
||||
#### Scenario: Display expiry bases in series grant package list
|
||||
|
||||
- **GIVEN** 用户进入代理系列授权套餐列表
|
||||
- **WHEN** 已授权套餐记录返回默认、覆盖和最终生效条件字段
|
||||
- **THEN** 页面 MUST display the default expiry base name, override expiry base name, and effective expiry base name for the package allocation
|
||||
|
||||
#### Scenario: Display expiry bases in package edit context
|
||||
|
||||
- **GIVEN** 用户打开代理系列授权中已授权套餐的编辑弹框
|
||||
- **WHEN** 套餐分配数据加载完成
|
||||
- **THEN** 页面 MUST display the default expiry base name, override expiry base name, and effective expiry base name
|
||||
- **AND** 页面 MUST display `仅影响后续新订单,不影响已购买套餐`
|
||||
|
||||
### Requirement: Series Grant Package Expiry Base Editing
|
||||
|
||||
The series grant package edit context SHALL provide `跟随套餐默认`, `购买即生效`, and `实名即生效` options, then update the corresponding package allocation record through the package allocation expiry-base API.
|
||||
|
||||
#### Scenario: Edit override from series grant package list
|
||||
|
||||
- **GIVEN** 用户正在代理系列授权套餐列表编辑已授权套餐
|
||||
- **WHEN** 用户选择生效条件并保存
|
||||
- **THEN** 系统 MUST use the corresponding package allocation record ID to call `PATCH /api/admin/shop-package-allocations/{id}/expiry-base`
|
||||
- **AND** 选择“跟随套餐默认”时请求 MUST explicitly contain `expiry_base_override: null`
|
||||
|
||||
#### Scenario: Refresh effective value after editing
|
||||
|
||||
- **WHEN** 代理系列授权套餐的生效条件更新成功
|
||||
- **THEN** 页面 MUST refresh the relevant package allocation data
|
||||
- **AND** 页面 MUST display the latest backend returned effective expiry base name
|
||||
@@ -0,0 +1,26 @@
|
||||
## 1. Allocation Contract
|
||||
|
||||
- [x] 1.1 扩展店铺套餐分配请求与响应类型,支持 `expiry_base_override`、`default_expiry_base`、`effective_expiry_base` 及对应中文名称字段。
|
||||
- [x] 1.2 接入创建分配接口 `POST /api/admin/shop-package-allocations` 的 `expiry_base_override` 参数。
|
||||
- [x] 1.3 接入修改生效条件接口 `PATCH /api/admin/shop-package-allocations/{id}/expiry-base`。
|
||||
|
||||
## 2. Allocation Expiry Condition UI
|
||||
|
||||
- [x] 2.1 在套餐授权/分配弹框提供“跟随套餐默认”“购买即生效”“实名即生效”三选一。
|
||||
- [x] 2.2 选择“跟随套餐默认”时显式提交 `expiry_base_override: null`。
|
||||
- [x] 2.3 在已分配套餐编辑弹框显示“仅影响后续新订单,不影响已购买套餐”提示。
|
||||
- [x] 2.4 在已分配套餐详情或编辑弹框显示默认值、覆盖值和最终值的后端中文名称。
|
||||
|
||||
## 3. Series Grant Package Visibility
|
||||
|
||||
- [x] 3.1 在代理系列授权套餐列表显示默认生效条件、覆盖生效条件和最终生效条件。
|
||||
- [x] 3.2 从代理系列授权套餐列表编辑生效条件时,使用对应套餐分配记录 ID 调用生效条件更新接口。
|
||||
- [x] 3.3 保存成功后刷新授权套餐列表或详情,展示后端返回的最新最终生效条件。
|
||||
|
||||
## 4. Policy Integrity and Verification
|
||||
|
||||
- [x] 4.1 前端不从默认值和覆盖值计算或修改 `effective_expiry_base`。
|
||||
- [x] 4.2 验证新建分配时三种选项分别提交 `null`、`from_purchase`、`from_realname`。
|
||||
- [x] 4.3 验证编辑覆盖值和恢复默认均只影响后续新订单,不影响已购买套餐。
|
||||
- [x] 4.4 验证页面可区分默认值、覆盖值和最终生效条件,并正确显示后端中文名称。
|
||||
- [x] 4.5 运行相关前端校验,并执行 `openspec validate update-package-allocation-expiry-base-override --strict`。
|
||||
@@ -0,0 +1,29 @@
|
||||
# Change: 店铺平台业务员选择、展示与筛选
|
||||
|
||||
## Why
|
||||
|
||||
当前店铺没有记录负责的平台业务员,运营无法在新建、编辑、列表和详情中维护或查看业务归属。需要为店铺绑定可选的平台业务员,该绑定仅用于业务归属和通知关系,不承载分销、佣金或发展层级语义。
|
||||
|
||||
## What Changes
|
||||
|
||||
- 在店铺新建和编辑表单新增可清空、可搜索的“平台业务员”选择器。
|
||||
- 候选业务员复用启用的平台账号查询接口,展示账号名和手机号摘要。
|
||||
- 扩展店铺创建、更新、列表查询、列表返回和详情返回的数据契约,支持 `business_owner_account_id` 及业务员展示字段。
|
||||
- 在店铺列表新增业务员列和按业务员筛选项,在店铺详情展示业务员名称和手机号摘要。
|
||||
- 已停用的已绑定业务员仅用于历史列表和详情展示,不能作为新建或编辑表单的候选项。
|
||||
- 不新增分销、佣金、发展层级或其他业务结算行为。
|
||||
|
||||
## Impact
|
||||
|
||||
- Affected specs: `shop-management`
|
||||
- Affected code:
|
||||
- `src/api/modules/shop.ts`
|
||||
- `src/types/api/shop.ts`
|
||||
- 平台账号查询 API 类型或服务模块
|
||||
- `src/views/shop-management/list/index.vue`
|
||||
- 店铺详情页或详情抽屉的展示配置
|
||||
- API contracts:
|
||||
- `POST /api/admin/shops`
|
||||
- `PUT /api/admin/shops/{id}`
|
||||
- `GET /api/admin/shops`
|
||||
- `GET /api/admin/accounts?account_type=platform&status=1`
|
||||
@@ -0,0 +1,80 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Shop Platform Salesperson Assignment
|
||||
|
||||
The system SHALL allow users to assign or clear an optional platform salesperson for a shop during shop creation and editing. The assignment SHALL represent only business ownership and notification relationship and MUST NOT create distribution, commission, or hierarchy behavior.
|
||||
|
||||
#### Scenario: Assign an enabled platform account during shop creation
|
||||
|
||||
- **GIVEN** 用户进入店铺新建表单
|
||||
- **WHEN** 用户在“平台业务员”可搜索下拉中选择一个启用的平台账号
|
||||
- **THEN** 系统 MUST 提交该账号的 `business_owner_account_id`
|
||||
- **AND** 候选项 MUST 展示账号名和手机号摘要
|
||||
|
||||
#### Scenario: Edit a shop salesperson assignment
|
||||
|
||||
- **GIVEN** 用户进入已存在店铺的编辑表单
|
||||
- **WHEN** 用户选择不同的启用平台账号
|
||||
- **THEN** 系统 MUST 在 `PUT /api/admin/shops/{id}` 请求中提交新的 `business_owner_account_id`
|
||||
|
||||
#### Scenario: Clear a shop salesperson assignment
|
||||
|
||||
- **GIVEN** 店铺已绑定平台业务员
|
||||
- **WHEN** 用户清空“平台业务员”选择器并提交编辑表单
|
||||
- **THEN** 系统 MUST 提交 `business_owner_account_id: null`
|
||||
- **AND** 店铺不再关联该业务员
|
||||
|
||||
#### Scenario: Do not expose disabled accounts as editable candidates
|
||||
|
||||
- **WHEN** 用户打开或搜索“平台业务员”选择器
|
||||
- **THEN** 系统 MUST 仅查询 `account_type=platform` 且 `status=1` 的账号
|
||||
- **AND** 已停用平台账号 MUST NOT 作为新建或编辑候选项显示
|
||||
|
||||
#### Scenario: No eligible salesperson exists
|
||||
|
||||
- **GIVEN** 不存在启用的平台账号
|
||||
- **WHEN** 用户打开“平台业务员”选择器
|
||||
- **THEN** 系统 MUST 显示无可选账号状态
|
||||
- **AND** 用户仍 MUST 能够不选择业务员完成表单提交
|
||||
|
||||
### Requirement: Shop Salesperson List Filtering And Display
|
||||
|
||||
The shop list SHALL display the assigned salesperson and support filtering by `business_owner_account_id`.
|
||||
|
||||
#### Scenario: Display salesperson in shop list
|
||||
|
||||
- **WHEN** 用户查看店铺列表
|
||||
- **THEN** 列表 MUST 显示业务员列
|
||||
- **AND** 已绑定业务员的行 MUST 展示 `business_owner_name` 和 `business_owner_phone_masked`
|
||||
|
||||
#### Scenario: Filter shops by salesperson
|
||||
|
||||
- **WHEN** 用户在店铺列表选择一个平台业务员作为筛选条件
|
||||
- **THEN** 前端 MUST 在 `GET /api/admin/shops` 请求中提交该账号的 `business_owner_account_id`
|
||||
- **AND** 列表 MUST 仅展示后端返回的匹配店铺
|
||||
|
||||
#### Scenario: Display historical disabled salesperson in list
|
||||
|
||||
- **GIVEN** 店铺历史上已绑定的平台业务员后来被停用
|
||||
- **WHEN** 用户查看店铺列表
|
||||
- **THEN** 列表 MUST 继续展示该店铺返回的 `business_owner_name` 和 `business_owner_phone_masked`
|
||||
|
||||
### Requirement: Shop Detail Salesperson Display
|
||||
|
||||
The shop detail SHALL display the assigned salesperson name and masked phone from the shop detail response, including historical assignments to disabled accounts.
|
||||
|
||||
#### Scenario: Display salesperson in shop detail
|
||||
|
||||
- **WHEN** 用户查看已绑定平台业务员的店铺详情
|
||||
- **THEN** 页面 MUST 展示业务员名称和手机号摘要
|
||||
|
||||
#### Scenario: Display historical disabled salesperson in detail
|
||||
|
||||
- **GIVEN** 店铺绑定的业务员已停用
|
||||
- **WHEN** 用户查看该店铺详情
|
||||
- **THEN** 页面 MUST 继续使用详情响应中的 `business_owner_name` 和 `business_owner_phone_masked` 展示历史业务员信息
|
||||
|
||||
#### Scenario: Do not add distribution or commission semantics
|
||||
|
||||
- **WHEN** 用户查看店铺新建、编辑、列表或详情页面
|
||||
- **THEN** 页面 MUST NOT 将平台业务员描述为分销关系、佣金关系或发展层级
|
||||
27
openspec/changes/update-shop-salesperson-selection/tasks.md
Normal file
27
openspec/changes/update-shop-salesperson-selection/tasks.md
Normal file
@@ -0,0 +1,27 @@
|
||||
## 1. API Contract
|
||||
|
||||
- [x] 1.1 更新店铺创建和编辑请求类型,支持可空的 `business_owner_account_id`。
|
||||
- [x] 1.2 更新店铺列表查询类型,支持 `business_owner_account_id` 筛选参数。
|
||||
- [x] 1.3 更新店铺列表和详情响应类型,读取业务员 ID、名称和脱敏手机号字段。
|
||||
- [x] 1.4 复用启用平台账号查询接口,读取 `account_id`、`account_name`、`phone_masked` 作为候选项。
|
||||
|
||||
## 2. Shop Form UI
|
||||
|
||||
- [x] 2.1 在店铺新建和编辑表单增加可搜索、可清空的“平台业务员”下拉选择。
|
||||
- [x] 2.2 候选项展示账号名和手机号摘要,仅查询并展示启用的平台账号。
|
||||
- [x] 2.3 支持清空已选择业务员,并按 `business_owner_account_id: null` 提交。
|
||||
- [x] 2.4 已停用业务员不出现在编辑候选项中。
|
||||
|
||||
## 3. Shop List And Detail UI
|
||||
|
||||
- [x] 3.1 在店铺列表增加业务员列,展示业务员名称和手机号摘要。
|
||||
- [x] 3.2 在店铺列表搜索区增加按业务员筛选项,并提交选中的 `business_owner_account_id`。
|
||||
- [x] 3.3 在店铺详情展示业务员名称和手机号摘要;已停用但历史绑定的业务员仍正常显示。
|
||||
|
||||
## 4. Verification
|
||||
|
||||
- [ ] 4.1 验证创建、编辑、清空业务员和无可选账号状态。
|
||||
- [ ] 4.2 验证列表业务员展示和按业务员筛选正确。
|
||||
- [ ] 4.3 验证详情对历史停用业务员仍能展示名称和手机号摘要。
|
||||
- [x] 4.4 确认页面不引入分销、佣金或发展层级文案。
|
||||
- [x] 4.5 运行相关前端校验,并执行 `openspec validate update-shop-salesperson-selection --strict`。
|
||||
@@ -6,6 +6,8 @@ import { BaseService } from '../BaseService'
|
||||
import type {
|
||||
PlatformAccount,
|
||||
AccountQueryParams,
|
||||
PlatformSalesperson,
|
||||
PlatformSalespersonQueryParams,
|
||||
CreatePlatformAccountParams,
|
||||
BaseResponse,
|
||||
PaginationResponse
|
||||
@@ -23,6 +25,16 @@ export class AccountService extends BaseService {
|
||||
return this.getPage<PlatformAccount>('/api/admin/accounts', params)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取启用的平台业务员候选
|
||||
* GET /api/admin/accounts?account_type=platform&status=1
|
||||
*/
|
||||
static getPlatformSalespeople(
|
||||
params: PlatformSalespersonQueryParams
|
||||
): Promise<PaginationResponse<PlatformSalesperson>> {
|
||||
return this.getPage<PlatformSalesperson>('/api/admin/accounts', params)
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建账号
|
||||
* POST /api/admin/accounts
|
||||
|
||||
@@ -19,6 +19,7 @@ import type {
|
||||
AssetPackageParams,
|
||||
AssetCurrentPackageResponse,
|
||||
DeviceStopResponse,
|
||||
AssetStartResponse,
|
||||
AssetWalletTransactionListResponse,
|
||||
AssetWalletTransactionParams,
|
||||
AssetWalletResponse,
|
||||
@@ -34,14 +35,13 @@ import type {
|
||||
} from '@/types/api'
|
||||
|
||||
const runRateLimitedAssetAction = async <T>(
|
||||
action: AssetRateLimitedAction,
|
||||
action: Exclude<AssetRateLimitedAction, 'refresh'>,
|
||||
identifier: string,
|
||||
request: () => Promise<T>
|
||||
): Promise<T> => {
|
||||
assertAssetActionAllowed(action, identifier)
|
||||
markAssetActionCalled(action, identifier)
|
||||
const response = await request()
|
||||
return response
|
||||
return request()
|
||||
}
|
||||
|
||||
export class AssetService extends BaseService {
|
||||
@@ -54,9 +54,14 @@ export class AssetService extends BaseService {
|
||||
*/
|
||||
static resolveAsset(
|
||||
identifier: string,
|
||||
params?: AssetResolveParams
|
||||
params?: AssetResolveParams,
|
||||
config?: Record<string, any>
|
||||
): Promise<BaseResponse<AssetResolveResponse>> {
|
||||
return this.getOne<AssetResolveResponse>(`/api/admin/assets/resolve/${identifier}`, params)
|
||||
return this.getOne<AssetResolveResponse>(
|
||||
`/api/admin/assets/resolve/${identifier}`,
|
||||
params,
|
||||
config
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,16 +84,13 @@ export class AssetService extends BaseService {
|
||||
/**
|
||||
* 主动调网关拉取最新数据后返回
|
||||
* POST /api/admin/assets/:identifier/refresh
|
||||
* 前端按资产标识限制 5 分钟内只能调用一次
|
||||
* @param identifier 资产标识符(ICCID 或 VirtualNo)
|
||||
*/
|
||||
static refreshAsset(identifier: string): Promise<BaseResponse<AssetRefreshResponse>> {
|
||||
return runRateLimitedAssetAction('refresh', identifier, () =>
|
||||
this.post<BaseResponse<AssetRefreshResponse>>(
|
||||
`/api/admin/assets/${identifier}/refresh`,
|
||||
{},
|
||||
{ timeout: 60000 }
|
||||
)
|
||||
return this.post<BaseResponse<AssetRefreshResponse>>(
|
||||
`/api/admin/assets/${identifier}/refresh`,
|
||||
{},
|
||||
{ timeout: 60000 }
|
||||
)
|
||||
}
|
||||
|
||||
@@ -181,9 +183,16 @@ export class AssetService extends BaseService {
|
||||
* 前端按资产标识限制 5 分钟内只能调用一次
|
||||
* @param identifier 资产标识符(ICCID 或 VirtualNo)
|
||||
*/
|
||||
static startAsset(identifier: string): Promise<BaseResponse<void>> {
|
||||
static startAsset(
|
||||
identifier: string,
|
||||
config?: Record<string, any>
|
||||
): Promise<BaseResponse<AssetStartResponse>> {
|
||||
return runRateLimitedAssetAction('start', identifier, () =>
|
||||
this.post<BaseResponse<void>>(`/api/admin/assets/${identifier}/start`, {})
|
||||
this.post<BaseResponse<AssetStartResponse>>(
|
||||
`/api/admin/assets/${identifier}/start`,
|
||||
{},
|
||||
config
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ import type {
|
||||
AssetAllocationRecord,
|
||||
AssetAllocationRecordDetail,
|
||||
BatchSetCardSeriesBindingRequest,
|
||||
BatchSetCardSeriesBindingResponse
|
||||
BatchSetCardSeriesBindingResponse,
|
||||
BatchUpdateAssetRealnamePolicyRequest
|
||||
} from '@/types/api'
|
||||
|
||||
type ApiQueryParams = PaginationParams & Record<string, unknown>
|
||||
@@ -411,6 +412,20 @@ export class CardService extends BaseService {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新卡实名认证策略
|
||||
*/
|
||||
static batchUpdateRealnamePolicy(
|
||||
data: BatchUpdateAssetRealnamePolicyRequest,
|
||||
config?: Record<string, any>
|
||||
): Promise<BaseResponse<void>> {
|
||||
return this.post<BaseResponse<void>>(
|
||||
'/api/admin/iot-cards/batch-update-realname-policy',
|
||||
data,
|
||||
config
|
||||
)
|
||||
}
|
||||
|
||||
// ========== IoT卡网关操作相关 ==========
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,6 +17,7 @@ import type {
|
||||
RecallDevicesResponse,
|
||||
BatchSetDeviceSeriesBindingRequest,
|
||||
BatchSetDeviceSeriesBindingResponse,
|
||||
BatchUpdateAssetRealnamePolicyRequest,
|
||||
ImportDeviceRequest,
|
||||
ImportDeviceResponse,
|
||||
DeviceImportTaskQueryParams,
|
||||
@@ -169,6 +170,20 @@ export class DeviceService extends BaseService {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新设备实名认证策略
|
||||
*/
|
||||
static batchUpdateRealnamePolicy(
|
||||
data: BatchUpdateAssetRealnamePolicyRequest,
|
||||
config?: Record<string, any>
|
||||
): Promise<BaseResponse<void>> {
|
||||
return this.post<BaseResponse<void>>(
|
||||
'/api/admin/devices/batch-update-realname-policy',
|
||||
data,
|
||||
config
|
||||
)
|
||||
}
|
||||
|
||||
// ========== 设备操作相关 ==========
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,8 @@ export interface ExchangeQueryParams {
|
||||
page_size?: number
|
||||
status?: number // 换货状态
|
||||
flow_type?: string // 流程类型(shipping/direct)
|
||||
identifier?: string // 资产标识符(模糊匹配,同时匹配旧资产、新资产)
|
||||
old_asset_keyword?: string // 旧资产关键词(ICCID、接入号、虚拟号、IMEI、SN)
|
||||
new_asset_keyword?: string // 新资产关键词(ICCID、接入号、虚拟号、IMEI、SN)
|
||||
created_at_start?: string // 创建时间起始
|
||||
created_at_end?: string // 创建时间结束
|
||||
}
|
||||
@@ -33,10 +34,13 @@ export interface ExchangeResponse {
|
||||
exchange_no: string
|
||||
exchange_reason: string
|
||||
old_asset_type: string
|
||||
old_asset_id: number
|
||||
old_asset_identifier: string
|
||||
new_asset_type: string
|
||||
new_asset_identifier: string
|
||||
new_asset_type?: string | null
|
||||
new_asset_id?: number | null
|
||||
new_asset_identifier?: string | null
|
||||
status: number // 换货状态(1:待填写信息, 2:待发货, 3:已发货待确认, 4:已完成, 5:已取消)
|
||||
status_name?: string
|
||||
status_text: string
|
||||
flow_type: string // 流程类型(shipping/direct)
|
||||
flow_type_name: string // 流程类型名称
|
||||
@@ -47,6 +51,15 @@ export interface ExchangeResponse {
|
||||
recipient_address?: string
|
||||
express_company?: string
|
||||
express_no?: string
|
||||
inherited_shop_id?: number | null
|
||||
inherited_shop_name?: string | null
|
||||
submitter_name?: string | null // 提交人名称
|
||||
approval_source?: 'none' | 'legacy' | 'wecom' | null // 审批来源
|
||||
approval_status?: string | null // 审批状态
|
||||
approval_status_name?: string | null // 审批状态名称
|
||||
current_approver_summary?: string | null // 当前审批人摘要
|
||||
processing_status?: string | null // 业务处理状态
|
||||
processing_status_name?: string | null // 业务处理状态名称
|
||||
remark?: string
|
||||
created_at: string
|
||||
updated_at: string
|
||||
@@ -86,8 +99,11 @@ export class ExchangeService extends BaseService {
|
||||
* POST /api/admin/exchanges
|
||||
* @param data 创建参数
|
||||
*/
|
||||
static createExchange(data: CreateExchangeRequest): Promise<BaseResponse<ExchangeResponse>> {
|
||||
return this.create<ExchangeResponse>('/api/admin/exchanges', data)
|
||||
static createExchange(
|
||||
data: CreateExchangeRequest,
|
||||
config?: Record<string, any>
|
||||
): Promise<BaseResponse<ExchangeResponse>> {
|
||||
return this.post<BaseResponse<ExchangeResponse>>('/api/admin/exchanges', data, config)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,8 +130,8 @@ export class ExchangeService extends BaseService {
|
||||
* POST /api/admin/exchanges/{id}/complete
|
||||
* @param id 换货单ID
|
||||
*/
|
||||
static completeExchange(id: number): Promise<BaseResponse> {
|
||||
return this.post<BaseResponse>(`/api/admin/exchanges/${id}/complete`, {})
|
||||
static completeExchange(id: number): Promise<BaseResponse<ExchangeResponse>> {
|
||||
return this.post<BaseResponse<ExchangeResponse>>(`/api/admin/exchanges/${id}/complete`, {})
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,10 +18,11 @@ export { CarrierService } from './carrier'
|
||||
export { PackageSeriesService } from './packageSeries'
|
||||
export { PackageManageService } from './packageManage'
|
||||
export { ShopSeriesGrantService } from './shopSeriesGrant'
|
||||
export { ShopPackageAllocationService } from './shopPackageAllocation'
|
||||
export { OrderService } from './order'
|
||||
export { AssetService } from './asset'
|
||||
export { AgentRechargeService } from './agentRecharge'
|
||||
export { WechatConfigService } from './wechatConfig'
|
||||
export { PaymentSettingsService } from './paymentSettings'
|
||||
export { ExchangeService } from './exchange'
|
||||
export { RefundService } from './refund'
|
||||
export { DataCleanupService } from './dataCleanup'
|
||||
|
||||
80
src/api/modules/paymentSettings.ts
Normal file
80
src/api/modules/paymentSettings.ts
Normal file
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* 支付配置管理 API
|
||||
*/
|
||||
|
||||
import { BaseService } from '../BaseService'
|
||||
import type { BaseResponse } from '@/types/api'
|
||||
import type {
|
||||
PaymentSettings,
|
||||
PaymentSettingsQueryParams,
|
||||
PaymentSettingsListResponse,
|
||||
CreatePaymentSettingsRequest,
|
||||
UpdatePaymentSettingsRequest
|
||||
} from '@/types/api/paymentSettings'
|
||||
|
||||
const PAYMENT_SETTINGS_BASE_URL = '/api/admin/wechat-configs'
|
||||
|
||||
export class PaymentSettingsService extends BaseService {
|
||||
/**
|
||||
* 获取支付配置列表
|
||||
*/
|
||||
static getPaymentSettings(
|
||||
params?: PaymentSettingsQueryParams
|
||||
): Promise<BaseResponse<PaymentSettingsListResponse>> {
|
||||
return this.get<BaseResponse<PaymentSettingsListResponse>>(PAYMENT_SETTINGS_BASE_URL, params)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支付配置详情
|
||||
*/
|
||||
static getPaymentSettingsById(id: number): Promise<BaseResponse<PaymentSettings>> {
|
||||
return this.get<BaseResponse<PaymentSettings>>(`${PAYMENT_SETTINGS_BASE_URL}/${id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建支付配置
|
||||
*/
|
||||
static createPaymentSettings(
|
||||
data: CreatePaymentSettingsRequest
|
||||
): Promise<BaseResponse<PaymentSettings>> {
|
||||
return this.post<BaseResponse<PaymentSettings>>(PAYMENT_SETTINGS_BASE_URL, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新支付配置
|
||||
*/
|
||||
static updatePaymentSettings(
|
||||
id: number,
|
||||
data: UpdatePaymentSettingsRequest
|
||||
): Promise<BaseResponse<PaymentSettings>> {
|
||||
return this.put<BaseResponse<PaymentSettings>>(`${PAYMENT_SETTINGS_BASE_URL}/${id}`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除支付配置
|
||||
*/
|
||||
static deletePaymentSettings(id: number): Promise<BaseResponse<void>> {
|
||||
return this.delete<BaseResponse<void>>(`${PAYMENT_SETTINGS_BASE_URL}/${id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 激活支付配置
|
||||
*/
|
||||
static activatePaymentSettings(id: number): Promise<BaseResponse<PaymentSettings>> {
|
||||
return this.post<BaseResponse<PaymentSettings>>(`${PAYMENT_SETTINGS_BASE_URL}/${id}/activate`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 停用支付配置
|
||||
*/
|
||||
static deactivatePaymentSettings(id: number): Promise<BaseResponse<PaymentSettings>> {
|
||||
return this.post<BaseResponse<PaymentSettings>>(`${PAYMENT_SETTINGS_BASE_URL}/${id}/deactivate`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前生效的支付配置
|
||||
*/
|
||||
static getActivePaymentSettings(): Promise<BaseResponse<PaymentSettings>> {
|
||||
return this.get<BaseResponse<PaymentSettings>>(`${PAYMENT_SETTINGS_BASE_URL}/active`)
|
||||
}
|
||||
}
|
||||
40
src/api/modules/shopPackageAllocation.ts
Normal file
40
src/api/modules/shopPackageAllocation.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* 店铺套餐分配 API 服务
|
||||
*/
|
||||
|
||||
import { BaseService } from '../BaseService'
|
||||
import type {
|
||||
BaseResponse,
|
||||
CreateShopPackageAllocationRequest,
|
||||
ShopPackageAllocationResponse,
|
||||
UpdateShopPackageAllocationExpiryBaseRequest
|
||||
} from '@/types/api'
|
||||
|
||||
export class ShopPackageAllocationService extends BaseService {
|
||||
/**
|
||||
* 创建店铺套餐分配
|
||||
* POST /api/admin/shop-package-allocations
|
||||
*/
|
||||
static createShopPackageAllocation(
|
||||
data: CreateShopPackageAllocationRequest
|
||||
): Promise<BaseResponse<ShopPackageAllocationResponse>> {
|
||||
return this.post<BaseResponse<ShopPackageAllocationResponse>>(
|
||||
'/api/admin/shop-package-allocations',
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新店铺套餐分配生效条件
|
||||
* PATCH /api/admin/shop-package-allocations/{id}/expiry-base
|
||||
*/
|
||||
static updateShopPackageAllocationExpiryBase(
|
||||
id: number,
|
||||
data: UpdateShopPackageAllocationExpiryBaseRequest
|
||||
): Promise<BaseResponse<ShopPackageAllocationResponse>> {
|
||||
return this.patch<BaseResponse<ShopPackageAllocationResponse>>(
|
||||
`/api/admin/shop-package-allocations/${id}/expiry-base`,
|
||||
data
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/**
|
||||
* 支付配置管理 API
|
||||
*/
|
||||
|
||||
import { BaseService } from '../BaseService'
|
||||
import type { BaseResponse } from '@/types/api'
|
||||
import type {
|
||||
WechatConfig,
|
||||
WechatConfigQueryParams,
|
||||
WechatConfigListResponse,
|
||||
CreateWechatConfigRequest,
|
||||
UpdateWechatConfigRequest
|
||||
} from '@/types/api/wechatConfig'
|
||||
|
||||
const PAYMENT_CONFIG_BASE_URL = '/api/admin/wechat-configs'
|
||||
|
||||
export class WechatConfigService extends BaseService {
|
||||
/**
|
||||
* 获取支付配置列表
|
||||
*/
|
||||
static getWechatConfigs(
|
||||
params?: WechatConfigQueryParams
|
||||
): Promise<BaseResponse<WechatConfigListResponse>> {
|
||||
return this.get<BaseResponse<WechatConfigListResponse>>(PAYMENT_CONFIG_BASE_URL, params)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支付配置详情
|
||||
*/
|
||||
static getWechatConfigById(id: number): Promise<BaseResponse<WechatConfig>> {
|
||||
return this.get<BaseResponse<WechatConfig>>(`${PAYMENT_CONFIG_BASE_URL}/${id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建支付配置
|
||||
*/
|
||||
static createWechatConfig(data: CreateWechatConfigRequest): Promise<BaseResponse<WechatConfig>> {
|
||||
return this.post<BaseResponse<WechatConfig>>(PAYMENT_CONFIG_BASE_URL, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新支付配置
|
||||
*/
|
||||
static updateWechatConfig(
|
||||
id: number,
|
||||
data: UpdateWechatConfigRequest
|
||||
): Promise<BaseResponse<WechatConfig>> {
|
||||
return this.put<BaseResponse<WechatConfig>>(`${PAYMENT_CONFIG_BASE_URL}/${id}`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除支付配置
|
||||
*/
|
||||
static deleteWechatConfig(id: number): Promise<BaseResponse<void>> {
|
||||
return this.delete<BaseResponse<void>>(`${PAYMENT_CONFIG_BASE_URL}/${id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 激活支付配置
|
||||
*/
|
||||
static activateWechatConfig(id: number): Promise<BaseResponse<WechatConfig>> {
|
||||
return this.post<BaseResponse<WechatConfig>>(`${PAYMENT_CONFIG_BASE_URL}/${id}/activate`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 停用支付配置
|
||||
*/
|
||||
static deactivateWechatConfig(id: number): Promise<BaseResponse<WechatConfig>> {
|
||||
return this.post<BaseResponse<WechatConfig>>(`${PAYMENT_CONFIG_BASE_URL}/${id}/deactivate`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前生效的支付配置
|
||||
*/
|
||||
static getActiveWechatConfig(): Promise<BaseResponse<WechatConfig>> {
|
||||
return this.get<BaseResponse<WechatConfig>>(`${PAYMENT_CONFIG_BASE_URL}/active`)
|
||||
}
|
||||
}
|
||||
93
src/components/business/BatchRealnamePolicyDialog.vue
Normal file
93
src/components/business/BatchRealnamePolicyDialog.vue
Normal file
@@ -0,0 +1,93 @@
|
||||
<template>
|
||||
<ElDialog v-model="visible" title="批量修改实名顺序" width="520px" @closed="resetPolicy">
|
||||
<ElForm label-width="110px">
|
||||
<ElFormItem label="已选数量">
|
||||
<span class="selected-count">{{ selectedCount }} {{ assetUnit }}</span>
|
||||
</ElFormItem>
|
||||
<ElFormItem label="实名认证策略">
|
||||
<ElRadioGroup v-model="policy" :disabled="loading">
|
||||
<ElRadio value="none">无需实名</ElRadio>
|
||||
<ElRadio value="before_order">先实名后购买</ElRadio>
|
||||
<ElRadio value="after_order">先购买后实名</ElRadio>
|
||||
</ElRadioGroup>
|
||||
</ElFormItem>
|
||||
<ElAlert
|
||||
v-if="devicePolicyHint"
|
||||
title="实际H5流程由设备策略决定"
|
||||
type="info"
|
||||
:closable="false"
|
||||
show-icon
|
||||
/>
|
||||
<ElAlert
|
||||
v-if="errorMessage"
|
||||
:title="errorMessage"
|
||||
type="error"
|
||||
:closable="false"
|
||||
show-icon
|
||||
class="error-alert"
|
||||
/>
|
||||
</ElForm>
|
||||
|
||||
<template #footer>
|
||||
<ElButton :disabled="loading" @click="visible = false">取消</ElButton>
|
||||
<ElButton type="primary" :loading="loading" @click="emit('confirm', policy)">
|
||||
确认修改
|
||||
</ElButton>
|
||||
</template>
|
||||
</ElDialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import {
|
||||
ElAlert,
|
||||
ElButton,
|
||||
ElDialog,
|
||||
ElForm,
|
||||
ElFormItem,
|
||||
ElRadio,
|
||||
ElRadioGroup
|
||||
} from 'element-plus'
|
||||
import type { AssetRealnamePolicy } from '@/types/api'
|
||||
|
||||
interface Props {
|
||||
modelValue: boolean
|
||||
selectedCount: number
|
||||
assetUnit: string
|
||||
loading?: boolean
|
||||
errorMessage?: string
|
||||
devicePolicyHint?: boolean
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
loading: false,
|
||||
errorMessage: '',
|
||||
devicePolicyHint: false
|
||||
})
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: boolean]
|
||||
confirm: [policy: AssetRealnamePolicy]
|
||||
}>()
|
||||
|
||||
const policy = ref<AssetRealnamePolicy>('none')
|
||||
const visible = computed({
|
||||
get: () => props.modelValue,
|
||||
set: (value) => emit('update:modelValue', value)
|
||||
})
|
||||
|
||||
const resetPolicy = () => {
|
||||
policy.value = 'none'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.selected-count {
|
||||
font-weight: 600;
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
|
||||
.error-alert {
|
||||
margin-top: 12px;
|
||||
}
|
||||
</style>
|
||||
@@ -3,18 +3,17 @@
|
||||
*/
|
||||
|
||||
import { ref, reactive, computed, onMounted } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { ElNotification, ElMessage } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { HOME_PAGE, RoutesAlias } from '@/router/routesAlias'
|
||||
import { RoutesAlias } from '@/router/routesAlias'
|
||||
import AppConfig from '@/config'
|
||||
import { AuthService } from '@/api/modules'
|
||||
import { ApiStatus } from '@/utils/http/status'
|
||||
import { saveCredentials, getRememberedCredentials } from '@/utils/auth/rememberPassword'
|
||||
import { usernameRules, passwordRules } from '@/utils/auth/loginValidation'
|
||||
import { getRedirectPath } from '@/router/guards/permission'
|
||||
|
||||
/**
|
||||
* 登录表单数据
|
||||
@@ -28,7 +27,6 @@ interface LoginForm {
|
||||
export function useLogin() {
|
||||
const { t } = useI18n()
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const userStore = useUserStore()
|
||||
|
||||
// 表单引用
|
||||
@@ -108,9 +106,24 @@ export function useLogin() {
|
||||
return
|
||||
}
|
||||
|
||||
// 检查用户类型 - 禁止企业账号登录
|
||||
if (response.data.user && response.data.user.user_type === 4) {
|
||||
ElMessage.error('企业账号无法登录后台管理系统,请使用平台/代理账号登录')
|
||||
if (!response.data.user) {
|
||||
ElMessage.error(t('login.error.getUserInfoFailed'))
|
||||
return
|
||||
}
|
||||
|
||||
// 登录成功但没有后台菜单或权限时,仅提示并停止后续流程。
|
||||
// 这里不保存登录态,也不触发后续跳转,避免进入路由守卫后再连续调用退出接口。
|
||||
const hasPermissions =
|
||||
Array.isArray(response.data.permissions) && response.data.permissions.length > 0
|
||||
const hasMenus = Array.isArray(response.data.menus) && response.data.menus.length > 0
|
||||
|
||||
if (!hasPermissions || !hasMenus) {
|
||||
ElMessage.warning({
|
||||
message: '当前账号暂无任何权限,请联系管理员分配角色和权限',
|
||||
duration: 4000,
|
||||
showClose: true
|
||||
})
|
||||
saveCredentials(formData.username, formData.password, formData.rememberPassword)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -118,13 +131,8 @@ export function useLogin() {
|
||||
userStore.setToken(response.data.access_token, response.data.refresh_token)
|
||||
|
||||
// 保存用户信息
|
||||
if (response.data.user) {
|
||||
userStore.setUserInfo(response.data.user)
|
||||
userStore.setLoginStatus(true)
|
||||
} else {
|
||||
ElMessage.error(t('login.error.getUserInfoFailed'))
|
||||
return
|
||||
}
|
||||
userStore.setUserInfo(response.data.user)
|
||||
userStore.setLoginStatus(true)
|
||||
|
||||
// 保存权限、菜单和按钮
|
||||
if (response.data.permissions) {
|
||||
@@ -137,19 +145,6 @@ export function useLogin() {
|
||||
userStore.setButtons(response.data.buttons)
|
||||
}
|
||||
|
||||
// 检查权限和菜单是否为空
|
||||
const hasPermissions = response.data.permissions && response.data.permissions.length > 0
|
||||
const hasMenus = response.data.menus && response.data.menus.length > 0
|
||||
|
||||
if (!hasPermissions || !hasMenus) {
|
||||
ElMessage.warning({
|
||||
message: '当前账号暂无任何权限,请联系管理员分配角色和权限',
|
||||
duration: 4000,
|
||||
showClose: true
|
||||
})
|
||||
// 虽然没有权限,但仍然允许登录,让用户看到空白页面而不是停留在登录页
|
||||
}
|
||||
|
||||
// 保存记住密码
|
||||
saveCredentials(formData.username, formData.password, formData.rememberPassword)
|
||||
|
||||
|
||||
@@ -458,6 +458,8 @@
|
||||
},
|
||||
"settings": {
|
||||
"title": "Settings Management",
|
||||
"paymentSettings": "Payment Settings",
|
||||
"detailsOfPaymentConfiguration": "Payment Configuration Details",
|
||||
"paymentMerchant": "Payment Merchant",
|
||||
"developerApi": "Developer API",
|
||||
"commissionTemplate": "Commission Template"
|
||||
|
||||
@@ -410,7 +410,7 @@
|
||||
},
|
||||
"settings": {
|
||||
"title": "设置管理",
|
||||
"wechatPayConfiguration": "微信配置",
|
||||
"paymentSettings": "支付设置",
|
||||
"detailsOfPaymentConfiguration": "支付配置详情",
|
||||
"withdrawalSettings": "提现配置",
|
||||
"passwordSettings": "密码设置"
|
||||
|
||||
@@ -640,13 +640,13 @@ export const asyncRoutes: AppRouteRecord[] = [
|
||||
icon: ''
|
||||
},
|
||||
children: [
|
||||
// 微信配置
|
||||
// 支付设置
|
||||
{
|
||||
path: 'wechat-config',
|
||||
name: 'WechatConfig',
|
||||
component: RoutesAlias.WechatConfig,
|
||||
path: 'payment-settings',
|
||||
name: 'PaymentSettings',
|
||||
component: RoutesAlias.PaymentSettings,
|
||||
meta: {
|
||||
title: 'menus.settings.wechatPayConfiguration',
|
||||
title: 'menus.settings.paymentSettings',
|
||||
keepAlive: true
|
||||
}
|
||||
},
|
||||
@@ -661,11 +661,11 @@ export const asyncRoutes: AppRouteRecord[] = [
|
||||
roles: ['R_SUPER', 'R_ADMIN']
|
||||
}
|
||||
},
|
||||
// 微信支付配置详情
|
||||
// 支付设置详情
|
||||
{
|
||||
path: 'wechat-config/detail/:id',
|
||||
name: 'WechatConfigDetailRoute',
|
||||
component: RoutesAlias.WechatConfigDetail,
|
||||
path: 'payment-settings/detail/:id',
|
||||
name: 'PaymentSettingsDetailRoute',
|
||||
component: RoutesAlias.PaymentSettingsDetail,
|
||||
meta: {
|
||||
title: 'menus.settings.detailsOfPaymentConfiguration',
|
||||
isHide: true,
|
||||
|
||||
@@ -82,8 +82,8 @@ export enum RoutesAlias {
|
||||
|
||||
// 设置管理
|
||||
WithdrawalSettings = '/settings/withdrawal-settings', // 提现配置
|
||||
WechatConfig = '/settings/wechat-config', // 微信配置
|
||||
WechatConfigDetail = '/settings/wechat-config/detail', // 微信支付配置详情
|
||||
PaymentSettings = '/settings/payment-settings', // 支付设置
|
||||
PaymentSettingsDetail = '/settings/payment-settings/detail', // 支付设置详情
|
||||
OperationPasswordSettings = '/settings/operation-password', // 操作密码设置
|
||||
|
||||
// 轮询管理
|
||||
|
||||
@@ -107,6 +107,20 @@ export interface AccountQueryParams extends PaginationParams {
|
||||
enterprise_id?: number // 按企业ID筛选
|
||||
}
|
||||
|
||||
// 平台业务员候选账号
|
||||
export interface PlatformSalesperson {
|
||||
account_id: number
|
||||
account_name: string
|
||||
phone_masked: string
|
||||
}
|
||||
|
||||
// 平台业务员候选查询参数
|
||||
export interface PlatformSalespersonQueryParams extends PaginationParams {
|
||||
account_type: 'platform'
|
||||
status: AccountStatus
|
||||
account_name?: string
|
||||
}
|
||||
|
||||
// 代理商查询参数
|
||||
export interface AgentQueryParams extends PaginationParams {
|
||||
keyword?: string
|
||||
|
||||
@@ -34,6 +34,13 @@ export interface AgentRecharge {
|
||||
payment_voucher_key?: string[] | string // 凭证附件列表;历史数据可能为单字符串或逗号字符串
|
||||
rejection_reason?: string | null // 拒绝原因
|
||||
remark?: string // 运营备注
|
||||
submitter_name?: string | null // 提交人名称
|
||||
approval_source?: 'none' | 'legacy' | 'wecom' | null // 审批来源
|
||||
approval_status?: string | null // 审批状态
|
||||
approval_status_name?: string | null // 审批状态名称
|
||||
current_approver_summary?: string | null // 当前审批人摘要
|
||||
processing_status?: string | null // 业务处理状态
|
||||
processing_status_name?: string | null // 业务处理状态名称
|
||||
created_at: string
|
||||
paid_at: string | null
|
||||
completed_at: string | null
|
||||
|
||||
@@ -46,6 +46,50 @@ export interface AssetResolveParams {
|
||||
include_usage_summary?: boolean // 是否返回当前世代流量汇总字段
|
||||
}
|
||||
|
||||
// 资产轮询状态
|
||||
export interface AssetPollingStatus {
|
||||
enabled: boolean // 是否启用轮询
|
||||
activity_level: string // 活跃级别
|
||||
last_activity_at?: string | null // 最后活跃时间
|
||||
last_activity_scene?: string | null // 最后活跃场景
|
||||
next_poll_at?: string | null // 下次轮询时间
|
||||
}
|
||||
|
||||
// 资产复机结果
|
||||
export interface AssetStartResponse {
|
||||
status: number // 最新资产状态
|
||||
status_name: string // 最新资产状态名称
|
||||
real_name_status: RealNameStatus // 最新实名状态
|
||||
real_name_status_name: string // 最新实名状态名称
|
||||
}
|
||||
|
||||
// 资产实名认证策略
|
||||
export type AssetRealnamePolicy = 'none' | 'before_order' | 'after_order'
|
||||
|
||||
// 预计最终到期时间状态
|
||||
export type ExpiryEstimateStatus = 'exact' | 'waiting_activation' | string
|
||||
|
||||
// 批量更新资产实名认证策略请求
|
||||
export interface BatchUpdateAssetRealnamePolicyRequest {
|
||||
asset_ids: number[]
|
||||
realname_policy: AssetRealnamePolicy
|
||||
}
|
||||
|
||||
// 换货关联资产
|
||||
export interface AssetExchangeTraceAsset {
|
||||
asset_type: AssetType
|
||||
asset_id: number | null
|
||||
identifier: string
|
||||
exchange_no: string
|
||||
can_view: boolean
|
||||
}
|
||||
|
||||
// 换货前后代链路
|
||||
export interface AssetExchangeTrace {
|
||||
previous_asset?: AssetExchangeTraceAsset | null
|
||||
next_asset?: AssetExchangeTraceAsset | null
|
||||
}
|
||||
|
||||
/**
|
||||
* 资产解析/详情响应
|
||||
* 对应接口:GET /api/admin/assets/resolve/:identifier
|
||||
@@ -73,6 +117,10 @@ export interface AssetResolveResponse {
|
||||
virtual_used_mb: number // 展示已用量
|
||||
total_virtual_used_mb?: number | null // 所有套餐已用量(MB),未请求时为 null
|
||||
total_virtual_remaining_mb?: number | null // 所有套餐剩余量(MB),未请求时为 null
|
||||
estimated_final_expires_at?: string | null // 当前及排队主套餐接续后的预计最终到期时间
|
||||
days_until_final_expiry?: number | null // 距预计最终到期的剩余天数
|
||||
expiry_estimate_status?: ExpiryEstimateStatus // 预计最终到期时间状态
|
||||
is_expiring?: boolean // 是否临期,由后端判断
|
||||
reduction_pct: number // 展示增幅比例(小数,如 0.428571)
|
||||
device_protect_status?: DeviceProtectStatus // 保护期状态:none / stop / start(仅 device)
|
||||
activated_at: string // 激活时间
|
||||
@@ -80,6 +128,8 @@ export interface AssetResolveResponse {
|
||||
updated_at: string // 更新时间
|
||||
accumulated_recharge?: number // 累计充值金额(分)
|
||||
first_commission_paid?: boolean // 一次性佣金是否已发放
|
||||
polling?: AssetPollingStatus | null // 资产轮询状态
|
||||
exchange_trace?: AssetExchangeTrace | null // 换货前后代链路
|
||||
|
||||
// ===== 卡专属字段 (asset_type === 'card' 时) =====
|
||||
iccid?: string // ICCID
|
||||
|
||||
@@ -346,6 +346,7 @@ export enum StandaloneCardStatus {
|
||||
export interface StandaloneCardQueryParams extends PaginationParams {
|
||||
keyword?: string // 通用关键字搜索
|
||||
has_active_package?: boolean // has active package filter
|
||||
real_name_status?: 0 | 1 // 实名状态:0 未实名 / 1 已实名
|
||||
carrier_name?: string // carrier name filter
|
||||
is_standalone?: boolean // standalone filter
|
||||
status?: StandaloneCardStatus // 状态
|
||||
@@ -384,7 +385,8 @@ export interface StandaloneIotCard {
|
||||
status: StandaloneCardStatus // 状态
|
||||
activation_status: number // 激活状态 (0:未激活, 1:已激活)
|
||||
network_status: number // 网络状态 (0:停机, 1:开机)
|
||||
real_name_status: number // 实名状态 (0:未实名, 1:已实名)
|
||||
real_name_status: 0 | 1 // 实名状态 (0:未实名, 1:已实名)
|
||||
real_name_status_name: string // 实名状态名称
|
||||
generation?: number // 资产世代编号(初始值1,每次换货转新后+1)
|
||||
asset_status?: AssetStatus // 业务状态 (1:在库, 2:已销售, 3:已换货, 4:已停用)
|
||||
asset_status_name?: string // 业务状态名称(中文)
|
||||
@@ -397,6 +399,10 @@ export interface StandaloneIotCard {
|
||||
data_usage_mb: number // 累计流量使用(MB)
|
||||
current_month_usage_mb?: number // 自然月累计流量(MB)
|
||||
current_month_start_date?: string | null // 本月开始日期
|
||||
estimated_final_expires_at?: string | null // 当前及排队主套餐接续后的预计最终到期时间
|
||||
days_until_final_expiry?: number | null // 距预计最终到期的剩余天数
|
||||
expiry_estimate_status?: string // 预计最终到期时间状态
|
||||
is_expiring?: boolean // 是否临期,由后端判断
|
||||
last_month_total_mb?: number // 上月流量总量(MB)
|
||||
last_data_check_at?: string | null // 最后流量检查时间
|
||||
last_real_name_check_at?: string | null // 最后实名检查时间
|
||||
|
||||
@@ -211,6 +211,10 @@ export interface ShopFundSummaryItem {
|
||||
phone?: string // 主账号手机号
|
||||
main_balance: number // 预充值余额(分)
|
||||
main_frozen_balance: number // 预充值冻结余额(分)
|
||||
balance: number // 现金余额(分)
|
||||
frozen_balance: number // 现金冻结金额(分)
|
||||
cash_available: number // 现金可用余额(分)
|
||||
low_balance_warning: boolean // 现金可用余额不足100元预警
|
||||
total_commission: number // 总佣金(分)
|
||||
available_commission: number // 可提现佣金(分)
|
||||
frozen_commission: number // 冻结中佣金(分)
|
||||
|
||||
@@ -65,6 +65,12 @@ export interface Device {
|
||||
imei?: string // IMEI(设备国际移动设备识别码)
|
||||
sn?: string // 设备序列号
|
||||
realname_policy?: string // 实名认证策略
|
||||
real_name_status: 0 | 1 // 实名状态 (0:未实名, 1:已实名)
|
||||
real_name_status_name: string // 实名状态名称
|
||||
estimated_final_expires_at?: string | null // 当前及排队主套餐接续后的预计最终到期时间
|
||||
days_until_final_expiry?: number | null // 距预计最终到期的剩余天数
|
||||
expiry_estimate_status?: string // 预计最终到期时间状态
|
||||
is_expiring?: boolean // 是否临期,由后端判断
|
||||
authorized_enterprise_id?: number | null // 当前有效授权企业ID
|
||||
authorized_enterprise_name?: string | null // 当前有效授权企业名称
|
||||
}
|
||||
@@ -72,6 +78,7 @@ export interface Device {
|
||||
// 设备查询参数
|
||||
export interface DeviceQueryParams extends PaginationParams {
|
||||
has_active_package?: boolean // has active package filter
|
||||
real_name_status?: 0 | 1 // 实名状态:0 未实名 / 1 已实名
|
||||
virtual_no?: string // 虚拟号(模糊查询,原 device_no)
|
||||
device_name?: string // 设备名称(模糊查询)
|
||||
status?: DeviceStatus // 状态
|
||||
|
||||
@@ -75,8 +75,8 @@ export * from './asset'
|
||||
// 代理充值相关
|
||||
export * from './agentRecharge'
|
||||
|
||||
// 微信支付配置相关
|
||||
export * from './wechatConfig'
|
||||
// 支付设置相关
|
||||
export * from './paymentSettings'
|
||||
|
||||
// 退款管理相关
|
||||
export * from './refund'
|
||||
|
||||
@@ -101,6 +101,40 @@ export interface CommissionTierInfo {
|
||||
*/
|
||||
export type ExpiryBase = 'from_activation' | 'from_purchase'
|
||||
|
||||
// 套餐分配生效条件覆盖值
|
||||
export type PackageAllocationExpiryBaseOverride = 'from_purchase' | 'from_realname'
|
||||
|
||||
// 店铺套餐分配生效条件字段
|
||||
export interface PackageAllocationExpiryBaseFields {
|
||||
default_expiry_base?: string | null
|
||||
default_expiry_base_name?: string | null
|
||||
expiry_base_override?: PackageAllocationExpiryBaseOverride | null
|
||||
expiry_base_override_name?: string | null
|
||||
effective_expiry_base?: string | null
|
||||
effective_expiry_base_name?: string | null
|
||||
}
|
||||
|
||||
// 创建店铺套餐分配请求
|
||||
export interface CreateShopPackageAllocationRequest {
|
||||
shop_id: number
|
||||
package_id: number
|
||||
cost_price: number
|
||||
expiry_base_override: PackageAllocationExpiryBaseOverride | null
|
||||
}
|
||||
|
||||
// 更新店铺套餐分配生效条件请求
|
||||
export interface UpdateShopPackageAllocationExpiryBaseRequest {
|
||||
expiry_base_override: PackageAllocationExpiryBaseOverride | null
|
||||
}
|
||||
|
||||
// 店铺套餐分配响应
|
||||
export interface ShopPackageAllocationResponse extends PackageAllocationExpiryBaseFields {
|
||||
id: number
|
||||
shop_id: number
|
||||
package_id: number
|
||||
cost_price: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 套餐响应
|
||||
*/
|
||||
@@ -234,7 +268,8 @@ export interface CommissionTier {
|
||||
/**
|
||||
* 套餐信息(用于系列授权)
|
||||
*/
|
||||
export interface GrantPackageInfo {
|
||||
export interface GrantPackageInfo extends PackageAllocationExpiryBaseFields {
|
||||
allocation_id?: number
|
||||
package_id: number
|
||||
package_name?: string
|
||||
package_code?: string
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* 微信支付配置管理相关类型定义
|
||||
* 支付设置相关类型定义
|
||||
*/
|
||||
|
||||
// 支付渠道类型
|
||||
@@ -66,8 +66,8 @@ type PaymentConfigWritableFields = Partial<
|
||||
FuiouConfigFields
|
||||
>
|
||||
|
||||
// 支付配置
|
||||
export interface WechatConfig
|
||||
// 支付设置
|
||||
export interface PaymentSettings
|
||||
extends PaymentConfigBase,
|
||||
MiniappConfigFields,
|
||||
OfficialAccountConfigFields,
|
||||
@@ -76,7 +76,7 @@ export interface WechatConfig
|
||||
FuiouConfigFields {}
|
||||
|
||||
// 查询参数
|
||||
export interface WechatConfigQueryParams {
|
||||
export interface PaymentSettingsQueryParams {
|
||||
page?: number
|
||||
page_size?: number
|
||||
provider_type?: PaymentProviderType
|
||||
@@ -84,23 +84,23 @@ export interface WechatConfigQueryParams {
|
||||
}
|
||||
|
||||
// 列表响应
|
||||
export interface WechatConfigListResponse {
|
||||
items: WechatConfig[]
|
||||
export interface PaymentSettingsListResponse {
|
||||
items: PaymentSettings[]
|
||||
page: number
|
||||
size: number
|
||||
total: number
|
||||
page_size?: number
|
||||
}
|
||||
|
||||
// 创建微信支付配置请求
|
||||
export interface CreateWechatConfigRequest extends PaymentConfigWritableFields {
|
||||
// 创建支付设置请求
|
||||
export interface CreatePaymentSettingsRequest extends PaymentConfigWritableFields {
|
||||
name: string
|
||||
provider_type: PaymentProviderType
|
||||
description?: string
|
||||
}
|
||||
|
||||
// 更新微信支付配置请求
|
||||
export interface UpdateWechatConfigRequest extends PaymentConfigWritableFields {
|
||||
// 更新支付设置请求
|
||||
export interface UpdatePaymentSettingsRequest extends PaymentConfigWritableFields {
|
||||
name?: string
|
||||
description?: string
|
||||
provider_type?: PaymentProviderType
|
||||
@@ -31,6 +31,13 @@ export interface Refund {
|
||||
remark: string
|
||||
asset_reset: boolean
|
||||
commission_deducted: boolean
|
||||
submitter_name?: string | null // 提交人名称
|
||||
approval_source?: 'none' | 'legacy' | 'wecom' | null // 审批来源
|
||||
approval_status?: string | null // 审批状态
|
||||
approval_status_name?: string | null // 审批状态名称
|
||||
current_approver_summary?: string | null // 当前审批人摘要
|
||||
processing_status?: string | null // 业务处理状态
|
||||
processing_status_name?: string | null // 业务处理状态名称
|
||||
creator: number
|
||||
processor_id: number | null
|
||||
processed_at: string | null
|
||||
|
||||
@@ -20,7 +20,7 @@ export interface PaymentMerchantSetting {
|
||||
publicKey: string
|
||||
notifyUrl?: string
|
||||
}
|
||||
// 微信配置
|
||||
// 微信支付配置
|
||||
wechat?: {
|
||||
enabled: boolean
|
||||
appId: string
|
||||
|
||||
@@ -21,6 +21,9 @@ export interface ShopResponse {
|
||||
contact_name: string // 联系人姓名
|
||||
contact_phone: string // 联系人电话
|
||||
status: number // 状态 (0:禁用, 1:启用)
|
||||
business_owner_account_id?: number | null // 平台业务员账号ID
|
||||
business_owner_name?: string // 平台业务员名称
|
||||
business_owner_phone_masked?: string // 平台业务员脱敏手机号
|
||||
}
|
||||
|
||||
// 店铺列表查询参数
|
||||
@@ -32,6 +35,8 @@ export interface ShopQueryParams extends PaginationParams {
|
||||
parent_id?: number | null // 上级店铺ID
|
||||
level?: number | null // 店铺层级 (1-7级)
|
||||
status?: number | null // 状态 (0:禁用, 1:启用)
|
||||
contact_phone?: string // 联系电话精确查询
|
||||
business_owner_account_id?: number | null // 平台业务员账号ID
|
||||
page?: number // 页码
|
||||
page_size?: number // 每页数量
|
||||
}
|
||||
@@ -50,6 +55,7 @@ export interface CreateShopParams {
|
||||
address?: string // 详细地址
|
||||
contact_name?: string // 联系人姓名
|
||||
contact_phone?: string // 联系人电话
|
||||
business_owner_account_id?: number | null // 平台业务员账号ID
|
||||
}
|
||||
|
||||
// 更新店铺参数
|
||||
@@ -62,6 +68,7 @@ export interface UpdateShopParams {
|
||||
address?: string // 详细地址
|
||||
contact_name?: string // 联系人姓名
|
||||
contact_phone?: string // 联系人电话
|
||||
business_owner_account_id?: number | null // 平台业务员账号ID
|
||||
}
|
||||
|
||||
// 店铺列表分页响应
|
||||
|
||||
1
src/types/auto-imports.d.ts
vendored
1
src/types/auto-imports.d.ts
vendored
@@ -8,6 +8,7 @@ export {}
|
||||
declare global {
|
||||
const EffectScope: typeof import('vue')['EffectScope']
|
||||
const ElButton: (typeof import('element-plus/es'))['ElButton']
|
||||
const ElMessage: typeof import('element-plus/es')['ElMessage']
|
||||
const ElMessageBox: typeof import('element-plus/es')['ElMessageBox']
|
||||
const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate']
|
||||
const asyncComputed: typeof import('@vueuse/core')['asyncComputed']
|
||||
|
||||
1
src/types/components.d.ts
vendored
1
src/types/components.d.ts
vendored
@@ -70,6 +70,7 @@ declare module 'vue' {
|
||||
ArtWorkTab: typeof import('./../components/core/layouts/art-work-tab/index.vue')['default']
|
||||
BasicSettings: typeof import('./../components/core/layouts/art-settings-panel/widget/BasicSettings.vue')['default']
|
||||
BatchOperationDialog: typeof import('./../components/business/BatchOperationDialog.vue')['default']
|
||||
BatchRealnamePolicyDialog: typeof import('./../components/business/BatchRealnamePolicyDialog.vue')['default']
|
||||
BoxStyleSettings: typeof import('./../components/core/layouts/art-settings-panel/widget/BoxStyleSettings.vue')['default']
|
||||
CardOperationDialog: typeof import('./../components/business/CardOperationDialog.vue')['default']
|
||||
CardStatusTag: typeof import('./../components/business/CardStatusTag.vue')['default']
|
||||
|
||||
22
src/utils/business/approvalSummary.ts
Normal file
22
src/utils/business/approvalSummary.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
export type ApprovalSource = 'none' | 'legacy' | 'wecom'
|
||||
|
||||
export interface ApprovalSummary {
|
||||
approval_source?: ApprovalSource | null
|
||||
approval_status_name?: string | null
|
||||
current_approver_summary?: string | null
|
||||
processing_status_name?: string | null
|
||||
}
|
||||
|
||||
export const getApprovalStatusText = (summary: ApprovalSummary): string => {
|
||||
if (summary.approval_source === 'legacy') return '历史审批'
|
||||
if (summary.approval_source === 'wecom') return summary.approval_status_name || '-'
|
||||
return '-'
|
||||
}
|
||||
|
||||
export const getCurrentApproverSummaryText = (summary: ApprovalSummary): string => {
|
||||
if (summary.approval_source !== 'wecom') return '-'
|
||||
return summary.current_approver_summary || '-'
|
||||
}
|
||||
|
||||
export const getProcessingStatusText = (summary: ApprovalSummary): string =>
|
||||
summary.processing_status_name || '-'
|
||||
23
src/utils/business/expiryEstimate.ts
Normal file
23
src/utils/business/expiryEstimate.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { formatDateTime } from './format'
|
||||
|
||||
export interface ExpiryEstimate {
|
||||
estimated_final_expires_at?: string | null
|
||||
days_until_final_expiry?: number | null
|
||||
expiry_estimate_status?: string | null
|
||||
is_expiring?: boolean
|
||||
}
|
||||
|
||||
export const getExpiryEstimateText = (estimate: ExpiryEstimate): string => {
|
||||
if (estimate.expiry_estimate_status === 'exact') {
|
||||
return estimate.estimated_final_expires_at
|
||||
? formatDateTime(estimate.estimated_final_expires_at)
|
||||
: '-'
|
||||
}
|
||||
|
||||
return estimate.expiry_estimate_status ? '待激活后起算' : '-'
|
||||
}
|
||||
|
||||
export const getExpiryEstimateTooltip = (estimate: ExpiryEstimate): string => {
|
||||
if (!estimate.is_expiring || estimate.days_until_final_expiry == null) return ''
|
||||
return `剩余${estimate.days_until_final_expiry}天`
|
||||
}
|
||||
@@ -7,3 +7,5 @@ export * from './validate'
|
||||
export * from './calculate'
|
||||
export * from './voucher'
|
||||
export * from './apiRateLimit'
|
||||
export * from './approvalSummary'
|
||||
export * from './expiryEstimate'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { PaymentProviderType, WechatConfig } from '@/types/api'
|
||||
import type { PaymentProviderType, PaymentSettings } from '@/types/api'
|
||||
|
||||
const PAYMENT_PROVIDER_LABELS: Record<PaymentProviderType, string> = {
|
||||
wechat: '微信直连',
|
||||
@@ -11,7 +11,7 @@ export const getPaymentProviderText = (type: PaymentProviderType): string => {
|
||||
}
|
||||
|
||||
export const getPaymentMerchantId = (
|
||||
config: Pick<WechatConfig, 'provider_type' | 'wx_mch_id' | 'fy_mchnt_cd'>
|
||||
config: Pick<PaymentSettings, 'provider_type' | 'wx_mch_id' | 'fy_mchnt_cd'>
|
||||
): string => {
|
||||
if (config.provider_type === 'wechat' || config.provider_type === 'wechat_v2') {
|
||||
return config.wx_mch_id || '-'
|
||||
@@ -25,7 +25,7 @@ export const getPaymentMerchantId = (
|
||||
}
|
||||
|
||||
export const getPaymentNotifyUrl = (
|
||||
config: Pick<WechatConfig, 'provider_type' | 'wx_notify_url' | 'fy_notify_url' | 'ali_notify_url'>
|
||||
config: Pick<PaymentSettings, 'provider_type' | 'wx_notify_url' | 'fy_notify_url' | 'ali_notify_url'>
|
||||
): string => {
|
||||
if (config.provider_type === 'wechat' || config.provider_type === 'wechat_v2') {
|
||||
return config.wx_notify_url || '-'
|
||||
|
||||
@@ -9,7 +9,7 @@ const axiosInstance = axios.create({
|
||||
baseURL: import.meta.env.DEV ? '' : import.meta.env.VITE_API_URL, // 开发服务器使用代理,其他模式使用完整URL
|
||||
withCredentials: false, // 异步请求携带cookie
|
||||
transformRequest: [
|
||||
(data, headers) => {
|
||||
(data) => {
|
||||
// 如果是 FormData,不进行转换
|
||||
if (data instanceof FormData) {
|
||||
return data
|
||||
@@ -72,6 +72,7 @@ let failedQueue: Array<{
|
||||
resolve: (value?: any) => void
|
||||
reject: (reason?: any) => void
|
||||
}> = [] // 失败队列,存储因 token 过期而失败的请求
|
||||
let isHandlingAuthExpiry = false
|
||||
|
||||
// 处理失败队列
|
||||
const processQueue = (error: any, token: string | null = null) => {
|
||||
@@ -222,6 +223,11 @@ function handleErrorMessage(
|
||||
const backendMessage = error.response?.data?.msg
|
||||
const httpStatus = error.response?.status
|
||||
|
||||
// 401 过期类错误由 clearLocalStateAndRedirect 统一提示,避免重复弹出后端报错。
|
||||
if (httpStatus === 401 || error.response?.data?.code === ApiStatus.unauthorized) {
|
||||
return
|
||||
}
|
||||
|
||||
// 如果是404错误,且未配置显示404错误,则不显示任何提示
|
||||
if (httpStatus === 404 && !show404Error) {
|
||||
return
|
||||
@@ -306,9 +312,13 @@ const api = {
|
||||
|
||||
// 仅清理本地状态(不调用接口)- 用于401等情况
|
||||
const clearLocalStateAndRedirect = () => {
|
||||
if (isHandlingAuthExpiry) return
|
||||
isHandlingAuthExpiry = true
|
||||
|
||||
ElMessage.error('登录已过期,请重新登录')
|
||||
setTimeout(() => {
|
||||
useUserStore().clearLocalState()
|
||||
isHandlingAuthExpiry = false
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
:icon="Refresh"
|
||||
:disabled="refreshDisabled"
|
||||
>
|
||||
{{ refreshButtonText }}
|
||||
同步
|
||||
</ElButton>
|
||||
</div>
|
||||
</div>
|
||||
@@ -48,7 +48,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { ref } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { ElCard, ElInput, ElButton } from 'element-plus'
|
||||
import { Search, Refresh } from '@element-plus/icons-vue'
|
||||
@@ -63,19 +63,13 @@
|
||||
interface Props {
|
||||
hasCardInfo?: boolean
|
||||
refreshDisabled?: boolean
|
||||
refreshRemainingText?: string
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
withDefaults(defineProps<Props>(), {
|
||||
hasCardInfo: false,
|
||||
refreshDisabled: false,
|
||||
refreshRemainingText: ''
|
||||
refreshDisabled: false
|
||||
})
|
||||
|
||||
const refreshButtonText = computed(() =>
|
||||
props.refreshRemainingText ? `同步(${props.refreshRemainingText})` : '同步'
|
||||
)
|
||||
|
||||
// Emits
|
||||
const emit = defineEmits<{
|
||||
search: [payload: { identifier: string }]
|
||||
|
||||
@@ -32,15 +32,13 @@
|
||||
<ElDescriptionsItem label="IMEI">{{
|
||||
cardInfo?.gateway_card_imei || '-'
|
||||
}}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="运营商账户">{{
|
||||
cardInfo?.carrier_name || '-'
|
||||
}}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="运营商账户">{{ carrierAccountDisplay }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="实名状态">
|
||||
<ElTag :type="getRealNameStatusType(cardInfo?.real_name_status)" size="small">
|
||||
{{ getRealNameStatusName(cardInfo?.real_name_status) }}
|
||||
</ElTag>
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="实名认证策略">
|
||||
<ElDescriptionsItem v-if="canShowSensitiveFields" label="实名认证策略">
|
||||
{{ getRealnamePolicyName(cardInfo?.realname_policy) }}
|
||||
</ElDescriptionsItem>
|
||||
|
||||
@@ -88,6 +86,14 @@
|
||||
<ElDescriptionsItem label="所有套餐剩余量">
|
||||
{{ formatUsageSummaryMb(cardInfo?.total_virtual_remaining_mb) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="预计套餐到期时间">
|
||||
<span
|
||||
:class="{ 'expiry-estimate--expiring': cardInfo?.is_expiring }"
|
||||
:title="getExpiryEstimateTooltip(cardInfo)"
|
||||
>
|
||||
{{ getExpiryEstimateText(cardInfo) }}
|
||||
</span>
|
||||
</ElDescriptionsItem>
|
||||
|
||||
<template v-if="cardInfo?.bound_device_id">
|
||||
<ElDescriptionsItem label="绑定设备号">
|
||||
@@ -157,11 +163,13 @@
|
||||
<ElDescriptionsItem label="最大卡槽数">{{
|
||||
cardInfo?.max_sim_slots || '-'
|
||||
}}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="实名认证策略">
|
||||
<ElDescriptionsItem v-if="canShowSensitiveFields" label="实名认证策略">
|
||||
{{ getRealnamePolicyName(cardInfo?.realname_policy) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="设备类型">{{ cardInfo?.device_type || '-' }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="制造商">{{ cardInfo?.manufacturer || '-' }}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem v-if="canShowSensitiveFields" label="制造商">{{
|
||||
cardInfo?.manufacturer || '-'
|
||||
}}</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="最后在线时间">{{
|
||||
formatDateTime(cardInfo?.last_online_time) || '-'
|
||||
}}</ElDescriptionsItem>
|
||||
@@ -172,12 +180,87 @@
|
||||
<ElDescriptionsItem label="所有套餐剩余量">
|
||||
{{ formatUsageSummaryMb(cardInfo?.total_virtual_remaining_mb) }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="预计套餐到期时间">
|
||||
<span
|
||||
:class="{ 'expiry-estimate--expiring': cardInfo?.is_expiring }"
|
||||
:title="getExpiryEstimateTooltip(cardInfo)"
|
||||
>
|
||||
{{ getExpiryEstimateText(cardInfo) }}
|
||||
</span>
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="最后同步时间">{{
|
||||
formatDateTime(deviceRealtime?.last_sync_time) || '-'
|
||||
}}</ElDescriptionsItem>
|
||||
</template>
|
||||
</ElDescriptions>
|
||||
|
||||
<ElDivider content-position="left">同步状态</ElDivider>
|
||||
<ElDescriptions :column="descriptionsColumn" border>
|
||||
<ElDescriptionsItem label="轮询状态">
|
||||
<ElTag
|
||||
v-if="cardInfo?.polling"
|
||||
:type="cardInfo.polling.enabled ? 'success' : 'info'"
|
||||
size="small"
|
||||
>
|
||||
{{ cardInfo.polling.enabled ? '已启用' : '未启用' }}
|
||||
</ElTag>
|
||||
<span v-else>-</span>
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="最后活跃时间">
|
||||
{{ formatDateTime(cardInfo?.polling?.last_activity_at) || '-' }}
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem label="同步轨迹">
|
||||
<ElButton
|
||||
v-permission="'asset_info:view_sync_trail'"
|
||||
type="primary"
|
||||
link
|
||||
@click="emit('viewSyncTrail')"
|
||||
>
|
||||
查看同步轨迹
|
||||
</ElButton>
|
||||
</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
|
||||
<template v-if="previousExchangeAsset || nextExchangeAsset">
|
||||
<ElDivider content-position="left">换货链路</ElDivider>
|
||||
<ElDescriptions :column="descriptionsColumn" border>
|
||||
<ElDescriptionsItem v-if="previousExchangeAsset" label="前代资产">
|
||||
<div class="exchange-asset">
|
||||
<ElTag type="success" size="small">换货新资产</ElTag>
|
||||
<ElButton
|
||||
v-if="previousExchangeAsset.can_view"
|
||||
type="primary"
|
||||
link
|
||||
@click="handleNavigateToExchangeAsset(previousExchangeAsset)"
|
||||
>
|
||||
{{ previousExchangeAsset.identifier }}
|
||||
</ElButton>
|
||||
<span v-else>{{ previousExchangeAsset.identifier }}</span>
|
||||
<span v-if="previousExchangeAsset.exchange_no" class="exchange-no">
|
||||
换货单:{{ previousExchangeAsset.exchange_no }}
|
||||
</span>
|
||||
</div>
|
||||
</ElDescriptionsItem>
|
||||
<ElDescriptionsItem v-if="nextExchangeAsset" label="后代资产">
|
||||
<div class="exchange-asset">
|
||||
<ElTag type="warning" size="small">已换出旧资产</ElTag>
|
||||
<ElButton
|
||||
v-if="nextExchangeAsset.can_view"
|
||||
type="primary"
|
||||
link
|
||||
@click="handleNavigateToExchangeAsset(nextExchangeAsset)"
|
||||
>
|
||||
{{ nextExchangeAsset.identifier }}
|
||||
</ElButton>
|
||||
<span v-else>{{ nextExchangeAsset.identifier }}</span>
|
||||
<span v-if="nextExchangeAsset.exchange_no" class="exchange-no">
|
||||
换货单:{{ nextExchangeAsset.exchange_no }}
|
||||
</span>
|
||||
</div>
|
||||
</ElDescriptionsItem>
|
||||
</ElDescriptions>
|
||||
</template>
|
||||
|
||||
<!-- 设备绑定卡列表 -->
|
||||
<template v-if="cardInfo?.asset_type === 'device'">
|
||||
<ElDivider content-position="left">绑定卡列表</ElDivider>
|
||||
@@ -402,6 +485,14 @@
|
||||
</template>
|
||||
|
||||
<!-- IoT卡操作按钮 -->
|
||||
<ElAlert
|
||||
v-if="startErrorMessage"
|
||||
:title="startErrorMessage"
|
||||
type="error"
|
||||
:closable="false"
|
||||
show-icon
|
||||
style="margin-top: 16px"
|
||||
/>
|
||||
<div
|
||||
v-if="cardInfo?.asset_type === 'card'"
|
||||
class="card-operations"
|
||||
@@ -491,15 +582,18 @@
|
||||
ElTable,
|
||||
ElTableColumn,
|
||||
ElButton,
|
||||
ElAlert,
|
||||
ElEmpty,
|
||||
ElMessageBox,
|
||||
ElMessage
|
||||
} from 'element-plus'
|
||||
import { CopyDocument } from '@element-plus/icons-vue'
|
||||
import type { AssetExchangeTrace, AssetExchangeTraceAsset, AssetPollingStatus } from '@/types/api'
|
||||
import { useAssetFormatters } from '../composables/useAssetFormatters'
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import { getExpiryEstimateText, getExpiryEstimateTooltip } from '@/utils/business/expiryEstimate'
|
||||
|
||||
// Props
|
||||
interface BindingCard {
|
||||
@@ -524,6 +618,7 @@
|
||||
iccid?: string
|
||||
imei?: string
|
||||
msisdn?: string
|
||||
carrier_type?: string
|
||||
carrier_name?: string
|
||||
real_name_status?: number
|
||||
activation_status_name?: string
|
||||
@@ -546,10 +641,16 @@
|
||||
gateway_extend?: string
|
||||
total_virtual_used_mb?: number | null
|
||||
total_virtual_remaining_mb?: number | null
|
||||
estimated_final_expires_at?: string | null
|
||||
days_until_final_expiry?: number | null
|
||||
expiry_estimate_status?: string
|
||||
is_expiring?: boolean
|
||||
last_sync_time?: string | null
|
||||
last_data_check_at?: string | null
|
||||
last_real_name_check_at?: string | null
|
||||
last_card_status_check_at?: string | null
|
||||
polling?: AssetPollingStatus | null
|
||||
exchange_trace?: AssetExchangeTrace | null
|
||||
bound_device_id?: number
|
||||
bound_device_no?: string
|
||||
bound_device_name?: string
|
||||
@@ -599,6 +700,7 @@
|
||||
pollingEnabled: boolean
|
||||
realtimeLoading?: boolean
|
||||
startDisabled?: boolean
|
||||
startErrorMessage?: string
|
||||
stopDisabled?: boolean
|
||||
startRemainingText?: string
|
||||
stopRemainingText?: string
|
||||
@@ -611,6 +713,7 @@
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
realtimeLoading: false,
|
||||
startDisabled: false,
|
||||
startErrorMessage: '',
|
||||
stopDisabled: false,
|
||||
startRemainingText: '',
|
||||
stopRemainingText: ''
|
||||
@@ -643,6 +746,22 @@
|
||||
return ![3, 4].includes(userType) && hasAuth(CARD_MONTH_USAGE_PERMISSION)
|
||||
})
|
||||
|
||||
const isAgentOrEnterpriseAccount = computed(() => {
|
||||
const userType = Number(userStore.info.user_type ?? 0)
|
||||
return [3, 4].includes(userType)
|
||||
})
|
||||
|
||||
const canShowSensitiveFields = computed(() => {
|
||||
return !isAgentOrEnterpriseAccount.value
|
||||
})
|
||||
|
||||
const carrierAccountDisplay = computed(() => {
|
||||
if (isAgentOrEnterpriseAccount.value) {
|
||||
return getCarrierTypeName(props.cardInfo?.carrier_type)
|
||||
}
|
||||
return props.cardInfo?.carrier_name || '-'
|
||||
})
|
||||
|
||||
const descriptionsColumn = computed(() => {
|
||||
if (width.value <= 640) return 1
|
||||
if (width.value <= 1024) return 2
|
||||
@@ -668,6 +787,7 @@
|
||||
(e: 'updateBindingCardRealnameStatus', payload: { card: BindingCard }): void
|
||||
(e: 'navigateToCard', iccid: string): void
|
||||
(e: 'navigateToDevice', deviceNo: string): void
|
||||
(e: 'viewSyncTrail'): void
|
||||
}
|
||||
|
||||
const emit = defineEmits<Emits>()
|
||||
@@ -679,6 +799,7 @@
|
||||
getRealNameStatusName,
|
||||
getRealNameStatusType,
|
||||
getRealnamePolicyName,
|
||||
getCarrierTypeName,
|
||||
getAssetStatusName,
|
||||
getAssetStatusType,
|
||||
getOnlineStatusName,
|
||||
@@ -702,6 +823,11 @@
|
||||
})
|
||||
})
|
||||
|
||||
const previousExchangeAsset = computed(
|
||||
() => props.cardInfo.exchange_trace?.previous_asset ?? null
|
||||
)
|
||||
const nextExchangeAsset = computed(() => props.cardInfo.exchange_trace?.next_asset ?? null)
|
||||
|
||||
// 设备详情里的实名状态和实名时间从选中的绑定卡取值:
|
||||
// 只有一张卡时直接取该卡,多张卡时仅取 is_current=true 的卡。
|
||||
const selectedDeviceStatusCard = computed(() => {
|
||||
@@ -740,6 +866,17 @@
|
||||
emit('navigateToCard', iccid)
|
||||
}
|
||||
|
||||
const handleNavigateToExchangeAsset = (asset: AssetExchangeTraceAsset) => {
|
||||
if (!asset.can_view) return
|
||||
|
||||
if (asset.asset_type === 'card') {
|
||||
emit('navigateToCard', asset.identifier)
|
||||
return
|
||||
}
|
||||
|
||||
emit('navigateToDevice', asset.identifier)
|
||||
}
|
||||
|
||||
// 复制ICCID
|
||||
const handleCopyICCID = async (iccid: string) => {
|
||||
try {
|
||||
@@ -849,6 +986,11 @@
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.expiry-estimate--expiring {
|
||||
font-weight: 500;
|
||||
color: var(--el-color-danger);
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
@@ -899,6 +1041,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
.exchange-asset {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
|
||||
.exchange-no {
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
}
|
||||
|
||||
@media (width <= 768px) {
|
||||
.card-header {
|
||||
flex-direction: column;
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
* 资产信息格式化工具函数
|
||||
*/
|
||||
|
||||
import { getCarrierTypeLabel } from '@/config/constants/carrierTypes'
|
||||
import type { CarrierType } from '@/types/api'
|
||||
|
||||
type TagType = 'primary' | 'success' | 'warning' | 'info' | 'danger'
|
||||
|
||||
export function useAssetFormatters() {
|
||||
@@ -76,6 +79,13 @@ export function useAssetFormatters() {
|
||||
return policyMap[policy] || '未知'
|
||||
}
|
||||
|
||||
// 获取运营商类型名称
|
||||
const getCarrierTypeName = (carrierType?: string | null) => {
|
||||
const normalizedCarrierType = carrierType?.trim()
|
||||
if (!normalizedCarrierType) return '-'
|
||||
return getCarrierTypeLabel(normalizedCarrierType as CarrierType)
|
||||
}
|
||||
|
||||
// 获取资产状态名称
|
||||
const getAssetStatusName = (status?: number) => {
|
||||
if (status === undefined || status === null) return '未知'
|
||||
@@ -252,6 +262,7 @@ export function useAssetFormatters() {
|
||||
getRealNameStatusName,
|
||||
getRealNameStatusType,
|
||||
getRealnamePolicyName,
|
||||
getCarrierTypeName,
|
||||
getAssetStatusName,
|
||||
getAssetStatusType,
|
||||
getOnlineStatusName,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { AssetService } from '@/api/modules'
|
||||
import { formatRemainingTime, FrontendRateLimitError } from '@/utils/business/apiRateLimit'
|
||||
import { FrontendRateLimitError } from '@/utils/business/apiRateLimit'
|
||||
import type {
|
||||
AssetBoundCard,
|
||||
AssetWalletResponse,
|
||||
@@ -123,6 +123,8 @@ export function useAssetInfo() {
|
||||
updated_at: data.updated_at,
|
||||
accumulated_recharge: data.accumulated_recharge,
|
||||
first_commission_paid: data.first_commission_paid,
|
||||
polling: data.polling ?? null,
|
||||
exchange_trace: data.exchange_trace ?? null,
|
||||
|
||||
// 卡专属字段 (asset_type === 'card')
|
||||
iccid: data.iccid || '',
|
||||
@@ -138,6 +140,10 @@ export function useAssetInfo() {
|
||||
gateway_extend: data.gateway_extend ?? '',
|
||||
total_virtual_used_mb: data.total_virtual_used_mb ?? null,
|
||||
total_virtual_remaining_mb: data.total_virtual_remaining_mb ?? null,
|
||||
estimated_final_expires_at: data.estimated_final_expires_at ?? null,
|
||||
days_until_final_expiry: data.days_until_final_expiry ?? null,
|
||||
expiry_estimate_status: data.expiry_estimate_status,
|
||||
is_expiring: data.is_expiring ?? false,
|
||||
bound_device_id: data.bound_device_id,
|
||||
bound_device_no: data.bound_device_no || '',
|
||||
bound_device_name: data.bound_device_name || '',
|
||||
@@ -430,11 +436,11 @@ export function useAssetInfo() {
|
||||
return true
|
||||
} catch (error: any) {
|
||||
if (error instanceof FrontendRateLimitError) {
|
||||
ElMessage.warning(`操作过于频繁,请${formatRemainingTime(error.remainingMs)}后再试`)
|
||||
ElMessage.warning('操作过于频繁,请稍后重试')
|
||||
return false
|
||||
}
|
||||
if (error?.response?.status === 429) {
|
||||
ElMessage.warning('操作过于频繁,请5分钟后再试')
|
||||
ElMessage.warning('操作过于频繁,请稍后重试')
|
||||
return false
|
||||
}
|
||||
return false
|
||||
|
||||
@@ -11,6 +11,7 @@ import { formatRemainingTime, FrontendRateLimitError } from '@/utils/business/ap
|
||||
export function useAssetOperations(cardInfo: Ref<any>, refreshAssetFn?: () => Promise<void>) {
|
||||
// Loading states
|
||||
const enableCardLoading = ref(false)
|
||||
const startFailureMessage = ref('')
|
||||
const disableCardLoading = ref(false)
|
||||
const manualDeactivateCardLoading = ref(false)
|
||||
const rebootDeviceLoading = ref(false)
|
||||
@@ -29,22 +30,33 @@ export function useAssetOperations(cardInfo: Ref<any>, refreshAssetFn?: () => Pr
|
||||
type: 'warning'
|
||||
})
|
||||
|
||||
startFailureMessage.value = ''
|
||||
enableCardLoading.value = true
|
||||
const res = await AssetService.startAsset(cardInfo.value.iccid)
|
||||
const res = await AssetService.startAsset(cardInfo.value.iccid, {
|
||||
requestOptions: { errorMessageMode: 'none' }
|
||||
})
|
||||
if (res.code === 0) {
|
||||
ElMessage.success('启用成功')
|
||||
if (refreshAssetFn) {
|
||||
await refreshAssetFn()
|
||||
}
|
||||
return true
|
||||
}
|
||||
startFailureMessage.value = res.msg || '复机失败,请稍后重试'
|
||||
return false
|
||||
} catch (error: any) {
|
||||
if (error !== 'cancel') {
|
||||
if (error instanceof FrontendRateLimitError) {
|
||||
ElMessage.warning(`操作过于频繁,请${formatRemainingTime(error.remainingMs)}后再试`)
|
||||
return
|
||||
return false
|
||||
}
|
||||
console.error('启用失败:', error)
|
||||
const backendMessage = error?.response?.data?.msg
|
||||
startFailureMessage.value =
|
||||
typeof backendMessage === 'string' && backendMessage.trim()
|
||||
? backendMessage
|
||||
: '复机失败,请稍后重试'
|
||||
}
|
||||
return false
|
||||
} finally {
|
||||
enableCardLoading.value = false
|
||||
}
|
||||
@@ -303,6 +315,7 @@ export function useAssetOperations(cardInfo: Ref<any>, refreshAssetFn?: () => Pr
|
||||
return {
|
||||
// Loading states
|
||||
enableCardLoading,
|
||||
startFailureMessage,
|
||||
disableCardLoading,
|
||||
manualDeactivateCardLoading,
|
||||
rebootDeviceLoading,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user