From 26c10de00bd0255fa4e0603d85ef72297b70cf63 Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Wed, 26 Mar 2025 13:42:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BB=A3=E5=AE=A2=E4=B8=8B=E5=8D=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=AA=E6=89=BE=E5=88=B0=E7=9A=84=E5=95=86?= =?UTF-8?q?=E5=93=81=E4=B8=8D=E5=86=8D=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/carts.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/store/modules/carts.ts b/src/store/modules/carts.ts index dd75209..c66aa78 100644 --- a/src/store/modules/carts.ts +++ b/src/store/modules/carts.ts @@ -606,7 +606,7 @@ export const useCartsStore = defineStore("carts", () => { v[key] = skuData[key]; }); } else { - del({ id: v.id }) + // del({ id: v.id }) return false } return !v.is_gift @@ -636,10 +636,13 @@ export const useCartsStore = defineStore("carts", () => { return ElMessage.warning(msg.message || '该商品已存在') } const skuData = getProductDetails({ product_id: msg.data.product_id, sku_id: msg.data.sku_id }) - const newGoods = { ...skuData, ...msg.data } - console.log('newGoods', newGoods) - list.value.push(newGoods) - return ElMessage.success(msg.message || '添加成功') + if (skuData) { + const newGoods = { ...skuData, ...msg.data } + console.log('newGoods', newGoods) + list.value.push(newGoods) + return ElMessage.success(msg.message || '添加成功') + } + } if (msg.operate_type === "manage_edit") {