From 9de1df84cac3bd23add96542b476f3d63965e66c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Tue, 11 Aug 2026 10:55:51 +0800 Subject: [PATCH] =?UTF-8?q?fix(shop):=20=E4=BF=AE=E5=A4=8D=E5=A4=9A?= =?UTF-8?q?=E8=A7=84=E6=A0=BCSKU=E4=BC=9A=E5=91=98=E4=BB=B7=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 后端 ShopGoodsSku 实体类添加 buyingPrice 字段,解决数据丢失 - 前端接口定义增加 buyingPrice,保证数据完整同步 - mp-java 后端模块同步添加 buyingPrice 字段实现数据一致 - 需手动执行 SQL 新增数据库表 shop_goods_sku 的 buying_price 列 --- .workbuddy/memory/2026-08-11.md | 8 ++++++++ src/api/shop/shopGoodsSku/model/index.ts | 2 ++ 2 files changed, 10 insertions(+) diff --git a/.workbuddy/memory/2026-08-11.md b/.workbuddy/memory/2026-08-11.md index eca1df6..6ef4e90 100644 --- a/.workbuddy/memory/2026-08-11.md +++ b/.workbuddy/memory/2026-08-11.md @@ -51,3 +51,11 @@ - 问题:后端有校验规则——`canExpress=1` 时要求 `expressTemplateId` 必填,但前端无对应校验,用户开启快递配送后直接提交被后端拦住,报错"运费模板必选"。 - 修复:在 `save()` 的 validate 通过后、请求前增加前端拦截:`canExpress=1 && !expressTemplateId` → `message.error('请选择运费模板')`。 - UI 优化:运费模板 `` 加 `:required="form.canExpress === 1"` 动态必填标记 + placeholder 提示文字。 + +## 修复:多规格SKU会员价(buyingPrice)保存失败 +- **根因**:后端 `ShopGoodsSku` 实体类(guilixu-java + mp-java)和数据库表 `shop_goods_sku` 均无 `buying_price` 字段。前端提交的 buyingPrice 被 MyBatis-Plus 忽略 → 保存后丢失。 +- **改动(三端同步)**: + 1. **guilixu-java** `entity/ShopGoodsSku.java`:加 `private BigDecimal buyingPrice;` + 2. **mp-java** `entity/ShopGoodsSku.java`:同上(shop 模块两端同步) + 3. **前端 TS 接口** `api/shop/shopGoodsSku/model/index.ts`:加 `buyingPrice?: string;` +- **需手动执行 SQL**:`ALTER TABLE shop_goods_sku ADD COLUMN buying_price DECIMAL(10,2) DEFAULT NULL COMMENT '会员价' AFTER cost;` diff --git a/src/api/shop/shopGoodsSku/model/index.ts b/src/api/shop/shopGoodsSku/model/index.ts index c82ca60..8289d78 100644 --- a/src/api/shop/shopGoodsSku/model/index.ts +++ b/src/api/shop/shopGoodsSku/model/index.ts @@ -18,6 +18,8 @@ export interface ShopGoodsSku { salePrice?: string; // 成本价 cost?: string; + // 会员价 + buyingPrice?: string; // 库存 stock?: number; // sku编码