# 门店管理新增字段 Implementation Plan > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers-subagent-driven-development (recommended) or superpowers-executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. **Goal:** 在 admin-ui 门店管理模块中适配后端新增的 9 个字段,修改表单弹窗和列表页,所有变更在现有 `useApiForm` + `ApiFormDialog` + `RuiTable` 框架内完成。 **Architecture:** 修改 2 个现有文件。`StoreFormDialog.vue` 新增 7 个可编辑字段(useApiForm fields 数组)、2 个只读字段(custom-fields 插槽)、数据双向转换逻辑(amenities JSON 序列化、serviceFeeRate 百分比转换)。`Index.vue` 新增 3 列(门店类型 Tag、包间信息、设施标签)、1 个筛选条件(门店类型下拉)、`parseAmenities` 工具函数。 **Tech Stack:** Vue 3 (Composition API / `` 标签之前),添加 `parseAmenities` 工具函数** **Old string:** ```ts async function handleStatusChange(row: any, status: number) { if (!row?.id) return try { await storeService.changeStatus(row.id, status) ElMessage.success(status === 1 ? '启用成功' : '禁用成功') } catch { row.status = status === 1 ? 0 : 1 } } ``` **New string:** ```ts async function handleStatusChange(row: any, status: number) { if (!row?.id) return try { await storeService.changeStatus(row.id, status) ElMessage.success(status === 1 ? '启用成功' : '禁用成功') } catch { row.status = status === 1 ? 0 : 1 } } /** * 解析设施标签(兼容 JSON 字符串和数组) */ function parseAmenities(val: any): string[] { if (Array.isArray(val)) return val if (typeof val === 'string' && val) { try { return JSON.parse(val) } catch { return [] } } return [] } ``` - [ ] **Step 4: Commit** ```bash git add admin-ui/src/views/cashier/store/Index.vue git commit -m "feat(store): queryParams 增加 storeType 筛选、handleReset 补充重置、新增 parseAmenities 工具函数" ``` --- ## Task 7: Index.vue — 在 columns 数组中追加 3 列配置 **Files:** - Modify: `admin-ui/src/views/cashier/store/Index.vue` (lines 12–28, columns 数组) - [ ] **Step 1: 在 address 列之后追加 storeType、roomInfo、amenities 3 列** **Old string:** ```ts { prop: 'address', label: '地址', minWidth: 200, tooltip: true }, { prop: 'businessHours', label: '营业时间', width: 120 }, ``` **New string:** ```ts { prop: 'address', label: '地址', minWidth: 200, tooltip: true }, { prop: 'storeType', label: '门店类型', width: 100, align: 'center', slot: true }, { prop: 'roomInfo', label: '包间', width: 120, align: 'center', slot: true }, { prop: 'amenities', label: '设施标签', minWidth: 200, slot: true }, { prop: 'businessHours', label: '营业时间', width: 120 }, ``` - [ ] **Step 2: Commit** ```bash git add admin-ui/src/views/cashier/store/Index.vue git commit -m "feat(store): columns 增加 storeType/roomInfo/amenities 3 列配置" ``` --- ## Task 8: Index.vue — 模板添加门店类型筛选和 3 个列 slot **Files:** - Modify: `admin-ui/src/views/cashier/store/Index.vue` (template 部分) - [ ] **Step 1: 在状态筛选的 `` 之后、查询按钮的 `` 之前,插入门店类型筛选** **Old string:** ```vue ``` **New string:** ```vue ``` - [ ] **Step 2: 在状态列 slot(`#column-status`)的 `` 之后、操作列 slot 之前,插入 3 个列 slot 模板** **Old string:** ```vue ``` **New string:** ```vue ``` - [ ] **Step 3: Commit** ```bash git add admin-ui/src/views/cashier/store/Index.vue git commit -m "feat(store): 模板新增门店类型筛选条件和 storeType/roomInfo/amenities 列 slot" ``` --- ## Task 9: 构建验证 + 最终提交 - [ ] **Step 1: 运行 TypeScript 类型检查** Run: `pnpm --filter admin-ui type-check` Expected: 0 errors, 命令退出码 0 - [ ] **Step 2: 运行 ESLint 检查** Run: `pnpm --filter admin-ui lint` Expected: 0 errors, 0 warnings(或仅有与本次修改无关的已存在 warnings) - [ ] **Step 3: 运行 Vite 构建** Run: `pnpm --filter admin-ui build` Expected: 构建成功,无编译错误,输出 dist 目录 - [ ] **Step 4: 启动开发服务器进行手动验证** Run: `pnpm --filter admin-ui dev` Expected: 开发服务器正常启动,浏览器打开后: 1. 门店管理列表页正确展示新增 3 列 2. 门店类型下拉筛选功能正常 3. 点击新增门店,弹窗宽度 720px,7 个新字段正确渲染 4. 新增模式下不显示包间总数/空闲包间数 5. 点击编辑门店,所有新字段正确回填,包间字段只读展示 6. 提交表单无报错 验证完毕后按 `Ctrl+C` 停止开发服务器。 --- ## Verification Checklist - [ ] `pnpm --filter admin-ui type-check` 通过 - [ ] `pnpm --filter admin-ui lint` 通过 - [ ] `pnpm --filter admin-ui build` 成功 - [ ] 列表新增 3 列正确展示(门店类型 Tag、包间 X/Y、设施多 Tag) - [ ] 门店类型筛选功能正常(筛选 + 重置) - [ ] 新增门店:7 个新字段可正常填写和提交 - [ ] 编辑门店:所有新字段正确回填,只读字段不可编辑 - [ ] amenities 数据双向转换正确(JSON 字符串 ↔ 数组) - [ ] serviceFeeRate 数据双向转换正确(小数 ↔ 百分比) - [ ] 新增模式下 roomCount/freeRoomCount 区域不显示 - [ ] 无数据时各列正确降级显示 `-`