feat: 店铺列表新增条件
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 6m47s

This commit is contained in:
luo
2026-07-21 18:20:35 +08:00
parent 830476d49d
commit 5079f97326
5 changed files with 126 additions and 0 deletions

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

View File

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

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