diff --git a/.workbuddy/memory/2026-08-11.md b/.workbuddy/memory/2026-08-11.md index f63ee31..eca1df6 100644 --- a/.workbuddy/memory/2026-08-11.md +++ b/.workbuddy/memory/2026-08-11.md @@ -40,3 +40,14 @@ 3. 编辑弹窗:城市选择变化 → `form.regionIds = 逗号串`、`form.regionMode = 1`(有选)或 `0`(全国);回显从 `form.regionIds` 拆出。 4. 列表页:customRender 读 `record.regionIds` 反查城市名。 - 结论:**本需求纯前端即可闭环,后端无需改**。城市编码(`regions-data.json` 的 city value,6位)与 `regionIds` 完全一致,下单校验 `DeliveryRegionChecker` 读 `regionIds` 直接生效。 + +## 修复:多规格SKU表格缺少库存列 +- 文件:`src/views/shop/shopGoods/components/shopGoodsEdit.vue` +- 问题:`columns` 数组缺少 `stock`(库存) 和 `salePrice`(划线价) 列定义,导致多规格SKU明细表不显示库存输入框(批量设置栏有,但表格列没有) +- 修复:在 columns 数组中补齐 `salePrice` 和 `stock` 两列(bodyCell 模板已有渲染逻辑,只需加列定义) + +## 修复:商品保存「快递配送时运费模板必选」前端校验缺失 +- 文件:`src/views/shop/shopGoods/components/shopGoodsEdit.vue` +- 问题:后端有校验规则——`canExpress=1` 时要求 `expressTemplateId` 必填,但前端无对应校验,用户开启快递配送后直接提交被后端拦住,报错"运费模板必选"。 +- 修复:在 `save()` 的 validate 通过后、请求前增加前端拦截:`canExpress=1 && !expressTemplateId` → `message.error('请选择运费模板')`。 +- UI 优化:运费模板 `` 加 `:required="form.canExpress === 1"` 动态必填标记 + placeholder 提示文字。 diff --git a/src/views/shop/shopGoods/components/shopGoodsEdit.vue b/src/views/shop/shopGoods/components/shopGoodsEdit.vue index 7f77205..01c2780 100644 --- a/src/views/shop/shopGoods/components/shopGoodsEdit.vue +++ b/src/views/shop/shopGoods/components/shopGoodsEdit.vue @@ -106,10 +106,11 @@ v-model:value="form.buyingPrice" /> - + { .validate() .then(() => { loading.value = true; + // 快递配送时运费模板必选(后端也有此校验,前端提前拦截给出友好提示) + if (form.canExpress === 1 && !form.expressTemplateId && !merchantId) { + loading.value = false; + return message.error('请选择运费模板'); + } if (form.priceGift && !form.priceGiftNum) return message.error('请输入会员赠品数量'); if (ensureTag.value.length) form.ensureTag = ensureTag.value.join();