From e1a6ec749034a06fd3f0f2e85e1044678c76eb20 Mon Sep 17 00:00:00 2001 From: Agent Date: Mon, 30 Mar 2026 15:00:36 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20saveProductAttributes=E4=BC=A0=E9=80=92?= =?UTF-8?q?categoryId=E4=BB=A5=E4=BE=BF=E8=87=AA=E5=8A=A8=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E5=85=AC=E5=BC=8F=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/product.js | 4 ++-- src/pages/product/manage.vue | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/api/product.js b/src/api/product.js index 51f1430..ef907f3 100644 --- a/src/api/product.js +++ b/src/api/product.js @@ -124,13 +124,13 @@ export default { /** * 保存商品的属性值 */ - saveProductAttributes(productId, attrs) { + saveProductAttributes(productId, categoryId, attrs) { const token = uni.getStorageSync('token') return new Promise((resolve, reject) => { uni.request({ url: `${import.meta.env.VITE_API_BASE_URL}/products/${productId}/attributes`, method: 'POST', - data: attrs, + data: { categoryId: categoryId, attributes: attrs }, header: { 'Content-Type': 'application/json', 'Authorization': token ? `Bearer ${token}` : '' diff --git a/src/pages/product/manage.vue b/src/pages/product/manage.vue index f13989b..f91b1c4 100644 --- a/src/pages/product/manage.vue +++ b/src/pages/product/manage.vue @@ -253,7 +253,7 @@ export default { uni.showToast({ title: '创建成功', icon: 'success' }) } - // 保存商品属性值 + // 保存商品属性值(包含公式自动计算) if (productId && this.categoryAttributes.length > 0) { const attrs = this.categoryAttributes.map((attr, idx) => ({ attrId: attr.attrId, @@ -262,7 +262,7 @@ export default { })).filter(a => a.attrValue) if (attrs.length > 0) { - await productApi.saveProductAttributes(productId, attrs) + await productApi.saveProductAttributes(productId, this.form.categoryId, attrs) } }