From 9b8343c054e73c15749abf96d15cd1c8d69ed285 Mon Sep 17 00:00:00 2001 From: wangdong <1551135706@qq.com> Date: Thu, 27 Jun 2024 10:47:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96sku=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=BB=84=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/model/goods/MultiSpec.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/common/model/goods/MultiSpec.js b/src/common/model/goods/MultiSpec.js index b3b9530..059e05c 100644 --- a/src/common/model/goods/MultiSpec.js +++ b/src/common/model/goods/MultiSpec.js @@ -132,7 +132,8 @@ export default class MultiSpec { } // 生成并获取多规格数据 - getData (specList = [], skuList = []) { + getData(specList = [], skuList = []) { + console.log(specList, skuList, 136) if (specList.length) { this.multiSpecData.specList = _.cloneDeep(specList) this.multiSpecData.skuList = _.cloneDeep(skuList) @@ -219,13 +220,18 @@ export default class MultiSpec { if (!oldSkuList.length || !newSkuList.length) { return newSkuList } + console.log(oldSkuList, newSkuList) for (const index in newSkuList) { // 查找符合的旧记录 let oldSkuItem = {} // if (oldSkuList.length === newSkuList.length) { - // oldSkuItem = _.cloneDeep(oldSkuList[index]) + // oldSkuItem = _.cloneDeep(oldSkuList[index]) // } else { - oldSkuItem = oldSkuList.find(item => newSkuList[index].tempId === item.goods_props.map(v => v.value.name).join('_')) + oldSkuItem = oldSkuList.find( + (item) => + newSkuList[index].tempId === + (item.goods_props && item.goods_props.length > 0) ? item.goods_props.map((v) => v.value.name).join('_') : item.tempId + ) // } const item = newSkuList[index]