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;