From cc8f437a06977b7d5839c6fdcab5d07d9d0eed97 Mon Sep 17 00:00:00 2001 From: rouchen <3133657697@qq.com> Date: Sun, 24 Mar 2024 10:53:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E4=BF=A1=E6=81=AF=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=9B=9E=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/product/info/index.vue | 85 ++++++++++++++++++++++++++------ 1 file changed, 70 insertions(+), 15 deletions(-) diff --git a/src/views/product/info/index.vue b/src/views/product/info/index.vue index fcc91d8..99a7857 100644 --- a/src/views/product/info/index.vue +++ b/src/views/product/info/index.vue @@ -332,6 +332,7 @@ 一键设置 + {{skuList}} { + console.log("res",response) const {data} = response; const {templateAttributeGroupList,templateAttributeList,attributeList} = data; this.categoryCommonElement.templateAttributeGroupList = templateAttributeGroupList; this.categoryCommonElement.templateAttributeList = templateAttributeList; this.categoryCommonElement.attributeList = attributeList; - }) - } + console.log("resData",this.respData); + if (this.respData != null && this.respData.length !== 0){ + this.categoryCommonElement.templateAttributeGroupList.forEach(template => { + template.attributeList.forEach(te => { + this.respData.forEach(asPro => { + if (te.id == asPro.attributeId){ + console.log("value",asPro.value) + te.value = asPro.value; + this.fufObj.push(asPro); + } + }); + }); + }); + + this.categoryCommonElement.templateAttributeList.forEach(tem => { + this.respData.forEach(asPro => { + console.log(asPro) + if (tem.id === asPro.attributeId){ + tem.value = asPro.value; + this.fufObj.push(asPro); + } + }); + }); + + this.respData.forEach(asPro => { + if (!this.fufObj.includes(asPro)){ + this.attributeCheckedList.push(asPro); + } + }); + + this.categoryCommonElement.attributeList.forEach(attr => { + this.attributeCheckedList.forEach(attri => { + if (attr.id == attri.attributeId){ + attri.name = attr.name; + this.attributeIdCheckedList.push(Number(attr.id)); + } + }); + }); + } + }); + } } } }, @@ -685,13 +729,16 @@ export default { image: null, carouselImages: null, status: null, - ruleId: null, brandId: null, remark: null, createBy: null, createTime: null, updateBy: null, - updateTime: null + updateTime: null, + skuList: [], + titleList: [], + categoryCommonElement: [], + oneSettingForm: {} }; this.resetForm("form"); this.initCategoryTree(); @@ -716,7 +763,11 @@ export default { /** 新增按钮操作 */ handleAdd() { this.reset(); + this.initCategoryTree() this.open = true; + this.skuList=[] + this.titleList= [] + this.oneSettingForm = {} this.title = "添加商品信息"; }, /** 修改按钮操作 */ @@ -725,20 +776,24 @@ export default { const id = row.id || this.ids getInfo(id).then(response => { - - console.log(response) + console.log("response",response) + this.respData = response.data.asProductAttributeInfos this.form = response.data; - this.initCategoryTree() - this.form.mianType=parseInt(response.data.mianType) - this.form.type=parseInt(response.data.type) - - this.oneSettingForm = response.data.productSkuModel + this.oneSettingForm = response.data.projectSkuInfos + this.categoryOptionValue = [Number(response.data.mianType),Number(response.data.parentType),Number(response.data.type)] this.changeRule(response.data.ruleId) - this.oneSetting() + console.log("sku",this.skuList) + console.log("skuu",response.data.projectSkuInfos) + for (var i = 0; i < this.skuList.length; i++) { + this.$set(this.skuList[i], 'image', response.data.projectSkuInfos[i].image); + this.$set(this.skuList[i], 'price', response.data.projectSkuInfos[i].price); + this.$set(this.skuList[i], 'stock', response.data.projectSkuInfos[i].stock); + console.log(this.skuList[i].price, response.data.projectSkuInfos[i].price); + } + console.log("sfdf",this.skuList) this.open = true; this.title = "修改商品信息"; - }); }, /** 提交按钮 */