feat:代理现金余额不足100元展示、店铺业务员选择展示与筛选
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 5m34s

This commit is contained in:
luo
2026-07-20 12:17:02 +08:00
parent ca338dd345
commit e95dc8e4f5
12 changed files with 334 additions and 49 deletions

View File

@@ -8,9 +8,8 @@
- 在代理资金概况中展示现金余额、冻结金额和基于后端 `low_balance_warning` 的“现金余额不足100元”红色状态。
- 复用 `GET /api/admin/shops/fund-summary`,读取 `balance``frozen_balance``cash_available``low_balance_warning` 字段,金额统一按分转元展示。
- 复用通知列表与通知目标解析接口,实现低余额通知跳转到对应店铺资金页。
- 明确前端不得自行计算 100 元阈值,也不得展示阈值输入框。
- 不包含公共站内通知中心页面的实现改造。
- 不包含任何公共站内通知相关功能的实现改造。
## Impact
@@ -18,7 +17,6 @@
- Affected code:
- `src/types/api/commission.ts`
- `src/views/commission-management/agent-fund-overview/index.vue`
- 顶部通知抽屉相关通知跳转逻辑
- Out of scope:
- 公共站内通知中心页面的开发或改造
- 顶部通知抽屉、站内通知中心及其他公共站内通知功能的开发或改造
- 任意余额预警阈值配置能力

View File

@@ -36,25 +36,12 @@ The frontend SHALL read the low-balance display state exclusively from the `GET
- **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: Low Balance Notification Target Navigation
### Requirement: Public Notification Features Are Out Of Scope
The system SHALL allow users to navigate from low-balance notifications in the top notification drawer to the corresponding shop's fund overview page by reusing the notification list and notification target resolution APIs. Unauthorized targets SHALL follow the shared error-page behavior.
This change SHALL NOT add or modify top notification drawer, notification center, or any other public in-app notification feature.
#### Scenario: Navigate from low balance notification to shop fund overview
- **GIVEN** 用户在顶部通知抽屉中看到低余额通知
- **WHEN** 用户点击该通知
- **THEN** 前端 MUST 复用 `GET /api/admin/notifications/{id}/target` 解析跳转目标
- **AND** 系统 MUST 导航到对应店铺的资金页
#### Scenario: Handle unauthorized notification target
- **GIVEN** 用户点击低余额通知
- **WHEN** 通知目标页无权限访问或目标不可访问
- **THEN** 系统 MUST 按统一错误页处理
#### Scenario: Public notification center is out of scope
#### Scenario: Deliver low balance overview without notification changes
- **WHEN** 本次变更落地
- **THEN** 公共站内通知中心页面 MUST NOT be required for this change to be considered complete
- **AND** 顶部通知抽屉跳转能力仍 MUST be supported
- **THEN** 代理资金概况的低余额展示 MUST be available
- **AND** 顶部通知抽屉、站内通知中心及其他公共站内通知功能 MUST NOT be changed by this proposal

View File

@@ -1,22 +1,15 @@
## 1. API Contract
- [ ] 1.1 更新代理资金概况相关数据模型,补充 `balance``frozen_balance``cash_available``low_balance_warning` 字段读取。
- [ ] 1.2 复用 `GET /api/admin/notifications``GET /api/admin/notifications/{id}/target` 的既有通知接口,不新增站内通知中心专用接口。
- [x] 1.1 更新代理资金概况相关数据模型,补充 `balance``frozen_balance``cash_available``low_balance_warning` 字段读取。
## 2. Agent Fund Overview UI
- [ ] 2.1 在代理资金概况中展示现金余额、冻结金额,并统一按分转元格式化。
- [ ] 2.2 当 `low_balance_warning=true` 时展示“现金余额不足100元”红色状态。
- [ ] 2.3 不展示阈值输入框,不把信用额度计入预警文案,也不由前端自行计算余额阈值。
- [x] 2.1 在代理资金概况中展示现金余额、冻结金额,并统一按分转元格式化。
- [x] 2.2 当 `low_balance_warning=true` 时展示“现金余额不足100元”红色状态。
- [x] 2.3 不展示阈值输入框,不把信用额度计入预警文案,也不由前端自行计算余额阈值。
## 3. Notification Navigation
## 3. Verification
- [ ] 3.1 在顶部通知抽屉中支持低余额通知跳转到对应店铺资金页
- [ ] 3.2 当用户无目标页面权限或目标不可访问时,按统一错误页处理
- [ ] 3.3 明确公共站内通知中心页面不在本次实现范围内。
## 4. Verification
- [ ] 4.1 验证现金可用余额高于、等于、低于100元三种情况下的状态展示正确且仅由 `low_balance_warning` 控制。
- [ ] 4.2 验证通知跳转到对应店铺资金页成功,无权限时进入统一错误处理。
- [ ] 4.3 运行相关前端校验,并执行 `openspec validate update-agent-fund-low-balance-warning --strict`
- [ ] 3.1 验证现金可用余额高于、等于、低于100元三种情况下的状态展示正确且仅由 `low_balance_warning` 控制
- [x] 3.2 验证本次改动未引入公共站内通知相关功能
- [x] 3.3 运行相关前端校验,并执行 `openspec validate update-agent-fund-low-balance-warning --strict`

View File

@@ -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`

View File

@@ -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 将平台业务员描述为分销关系、佣金关系或发展层级

View 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`