diff --git a/.workbuddy/memory/2026-07-08.md b/.workbuddy/memory/2026-07-08.md new file mode 100644 index 0000000..9a89a20 --- /dev/null +++ b/.workbuddy/memory/2026-07-08.md @@ -0,0 +1,31 @@ +# 2026-07-08 工作日志 + +## 完善运费模板配送区域功能 + +### 改造内容 +1. **模板列表页** (`shopExpressTemplate/index.vue`) + - 操作列增加"配送区域"链接,点击跳转到 `shopExpressTemplateDetail?templateId=xxx&title=xxx&type=xxx` + - 操作列宽度从 140 调整为 200 + +2. **配送区域页面** (`shopExpressTemplateDetail/index.vue`) + - 读取路由参数 `templateId`/`title`/`type`,页面标题显示"模板名称 - 配送区域" + - 数据源自动按 `templateId` 过滤 + - 移除"所属模板ID"和"计费方式"列 + - 省份/城市列合并为"配送地区"列,显示地区名称(通过 regions-data.json 建立 ID→名称映射) + - 传 `templateId` 和 `templateType` 给编辑组件 + +3. **搜索组件** (`shopExpressTemplateDetail/components/search.vue`) + - 移除模板ID搜索框,仅保留添加/批量删除按钮 + +4. **编辑表单** (`shopExpressTemplateDetail/components/shopExpressTemplateDetailEdit.vue`) + - 用 `RegionsSelect` 级联选择器(provinceCity 模式)替换省份/城市的 `a-input-number` + - 移除"所属模板"下拉选择(由路由参数确定) + - 移除"计费方式"radio(从父模板继承) + - 标签根据 `templateType` 动态显示"首件数量"或"首重重量" + - 保存时自动填充 `templateId` 和 `type` + - 编辑回显时将 provinceId/cityId 数字转回字符串数组给级联选择器 + +### 技术要点 +- `RegionsSelect` 组件位于 `src/components/RegionsSelect/`,数据源为 `public/json/regions-data.json` +- 级联选择器 value 是字符串数组(如 `["110000", "110100"]`),需与 model 的 number 类型互转 +- 路由路径 `/shop/shopExpressTemplateDetail` 依赖后端菜单配置,如不一致需调整 diff --git a/src/views/shop/shopExpressTemplate/index.vue b/src/views/shop/shopExpressTemplate/index.vue index 9278cb4..423834c 100644 --- a/src/views/shop/shopExpressTemplate/index.vue +++ b/src/views/shop/shopExpressTemplate/index.vue @@ -33,6 +33,8 @@ 修改 + 配送区域 + import { createVNode, ref } from 'vue'; + import { useRouter } from 'vue-router'; import { message, Modal } from 'ant-design-vue'; import { ExclamationCircleOutlined } from '@ant-design/icons-vue'; import type { EleProTable } from 'ele-admin-pro'; @@ -79,6 +82,7 @@ // 表格实例 const tableRef = ref | null>(null); + const router = useRouter(); // 表格选中数据 const selection = ref([]); @@ -178,7 +182,7 @@ { title: '操作', key: 'action', - width: 140, + width: 200, fixed: 'right', align: 'center', hideInSetting: true @@ -197,6 +201,18 @@ showEdit.value = true; }; + /* 跳转到配送区域 */ + const goDetail = (row: ShopExpressTemplate) => { + router.push({ + path: '/shop/shopExpressTemplateDetail', + query: { + templateId: String(row.id), + title: row.title || '', + type: String(row.type) + } + }); + }; + /* 删除单个 */ const remove = (row: ShopExpressTemplate) => { const hide = message.loading('请求中..', 0); diff --git a/src/views/shop/shopExpressTemplateDetail/components/search.vue b/src/views/shop/shopExpressTemplateDetail/components/search.vue index ed82367..7838ccb 100644 --- a/src/views/shop/shopExpressTemplateDetail/components/search.vue +++ b/src/views/shop/shopExpressTemplateDetail/components/search.vue @@ -1,13 +1,6 @@