From ef5941de00de6985c013728886f9a8e66ffd58d3 Mon Sep 17 00:00:00 2001 From: mabo Date: Wed, 30 Jun 2021 18:25:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E8=AF=A6=E6=83=85=E8=A7=84?= =?UTF-8?q?=E5=88=99=E9=80=89=E6=8B=A9=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/product/goods.vue | 10 +++++++--- pages/product/product/popup/goods.vue | 16 ++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pages/product/goods.vue b/pages/product/goods.vue index ebb1de2..6cddd8f 100644 --- a/pages/product/goods.vue +++ b/pages/product/goods.vue @@ -219,7 +219,7 @@ + v-if="goodsDetail.id " :pointDetail="pointDetail" @handleClickSku="selectSku" :buyMask="buyMask" /> @@ -499,11 +499,15 @@ export default { return true; } }, - + selectSku (idObj) { + console.log(idObj) + this.init(idObj.skuId,idObj.goodsId) + }, /** * 初始化信息 */ - async init(id, goodsId, distributionId) { + async init(id, goodsId, distributionId) { + console.log(id, goodsId) this.isGroup = false; //初始化拼团 this.productId = id; // skuId // 这里请求获取到页面数据 解析数据 diff --git a/pages/product/product/popup/goods.vue b/pages/product/product/popup/goods.vue index bcb9e72..4bf8ab9 100644 --- a/pages/product/product/popup/goods.vue +++ b/pages/product/product/popup/goods.vue @@ -56,7 +56,7 @@ {{ spec.name }} - {{ spec_val.value }} @@ -145,12 +145,12 @@ export default { /**点击规格 */ handleClickSpec(val, index, specValue) { - this.$set(this.currentSelceted, index, specValue.id); + this.$set(this.currentSelceted, index, specValue.value); let selectedSkuId = this.goodsSpec.find((i) => { let matched = true; let specValues = i.specValues.filter((j) => j.specName !== "images"); for (let n = 0; n < specValues.length; n++) { - if (specValues[n].specValueId !== this.currentSelceted[n]) { + if (specValues[n].specValue !== this.currentSelceted[n]) { matched = false; return; } @@ -159,7 +159,6 @@ export default { return i; } }); - this.selectSkuList = { spec: { specName: val.name, @@ -169,7 +168,7 @@ export default { }; this.selectName = specValue.value; - this.$emit("handleClickSku", selectedSkuId.skuId, this.goodsDetail.id); + this.$emit("handleClickSku", {skuId: selectedSkuId.skuId, goodsId: this.goodsDetail.goodsId}); }, /** @@ -231,10 +230,8 @@ export default { let arr = [{}]; list.forEach((item, index) => { item.specValues.forEach((spec, specIndex) => { - let id = spec.specNameId; let name = spec.specName; let values = { - id: spec.specValueId, value: spec.specValue, quantity: item.quantity, }; @@ -246,7 +243,7 @@ export default { if ( arrItem.name == name && arrItem.values && - !arrItem.values.find((i) => i.id === values.id) + !arrItem.values.find((i) => i.value === values.value) ) { arrItem.values.push(values); } @@ -256,7 +253,6 @@ export default { }); if (!keys.includes(name)) { arr.push({ - id: id, name: name, values: [values], }); @@ -273,7 +269,7 @@ export default { item.specValues .filter((i) => i.specName !== "images") .forEach((value, _index) => { - this.currentSelceted[_index] = value.specValueId; + this.currentSelceted[_index] = value.specValue; this.selectName = value.specValue;