From ecfc615f9f6fb616860d54f92955efe2bf6fbb22 Mon Sep 17 00:00:00 2001 From: 2812875475 <2812875475@qq.com> Date: Fri, 22 Mar 2024 19:42:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E5=B1=9E=E6=80=A7=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/product/productInfo/index.vue | 100 +++++++++++++----------- 1 file changed, 56 insertions(+), 44 deletions(-) diff --git a/src/views/product/productInfo/index.vue b/src/views/product/productInfo/index.vue index ae202e5..ddb4fe5 100644 --- a/src/views/product/productInfo/index.vue +++ b/src/views/product/productInfo/index.vue @@ -175,7 +175,8 @@ v-for="brand in brandList" :key="brand.id" :label="brand.nam" - :value="brand.id"> + :value="brand.id" + >
{{ brand.nam }}----------------- @@ -277,6 +278,7 @@
+ {{e}} @@ -287,7 +289,7 @@
- +
@@ -367,8 +369,6 @@
- - @@ -434,7 +434,6 @@ export default { templateAttributeGroupList: [], templateAttributeList: [], attributeList: [] - }, ruleAddFormStatus: false, addRulePropertyValue: null, @@ -483,6 +482,7 @@ export default { groupList:"", attributeList:"", persionList:"", + remark:'', }, // 表单校验 rules: { @@ -517,6 +517,13 @@ export default { a:[], b:[], c:[], + d:[], + e:[ + { + "name":null, + "value":null + } + ], }; }, watch: { @@ -546,7 +553,7 @@ export default { }) } } - } + }, }, created() { this.getList(); @@ -602,7 +609,6 @@ export default { for (let forIndex = parseInt(currentIndex) - 1; forIndex >= 0; forIndex--) { forSize = forSize * ruleAttrList[forIndex].ruleList.length } - console.log(`${ruleAttrInfo.name} 规格连续出现的次数 :${continuousSize} 循环出现的次数: ${forSize}`) let counter = 0; for (let forIndex = 0; forIndex < forSize; forIndex++) { @@ -610,7 +616,7 @@ export default { ruleList.forEach(value => { for (let continuousIndex = 0; continuousIndex < continuousSize; continuousIndex++) { this.skuList[counter++]["prop" + currentIndex] = value; - console.log(value) + } }) } @@ -634,10 +640,7 @@ export default { // 从第一个属性开始生成组合 generateSkuCombinations(0, ''); - // 打印结果 - this.skuList1.forEach(sku => { - console.log(sku); - }); + }, handleCheckedCitiesChange() { @@ -758,15 +761,20 @@ export default { this.reset(); const id = row.id || this.ids getInfo(id).then(response => { - console.log(response) this.form = response.data; + this.oneSettingValue=response.data.specification + this.e=[] + this.e=response.data.asProductAttributeInfo + console.log(this.e) this.changeRule(response.data.ruleId) + this.onSubmit() this.form.type=parseInt(response.data.type) this.form.mianType=parseInt(response.data.mianType) this.form.parentType=parseInt(response.data.parentType) this.CategoryTree() this.open = true; this.title = "修改商品信息"; + }); }, /** 提交按钮 */ @@ -774,51 +782,55 @@ export default { this.$refs["form"].validate(valid => { if (valid) { if (this.form.id != null) { + this.selectAttribut() + console.log(this.form) updateInfo(this.form).then(response => { this.$modal.msgSuccess("修改成功"); this.open = false; this.getList(); + this.form="" }); } else { - console.log(this.categoryCommonElement) - this.categoryCommonElement.templateAttributeGroupList.forEach( - templateAttributeGroup=>{ - templateAttributeGroup.attributeList.forEach( - attribute=>{ - this.a+=(attribute.id+"-"+attribute.name+"-"+attribute.value+",") - } - ) - } - ) - this.categoryCommonElement.templateAttributeList.forEach( - templateAttributeGroup=>{ - this.b+=(templateAttributeGroup.id+"-"+templateAttributeGroup.name+"-"+templateAttributeGroup.value+",") - } - ) - this.attributeCheckedList.forEach( - attributeChecked=>{ - this.c+=(attributeChecked.id+"-"+attributeChecked.name+"-"+attributeChecked.value) - } - ) - console.log(this.a) - console.log(this.b) - console.log(this.c) - this.form.sku=this.skuList1 - this.form.specification=this.oneSettingValue - // this.form.categoryList=this.a.concat(this.b).concat(this.c) - this.form.groupList=this.a - this.form.attributeList=this.b - this.form.persionList=this.c - console.log(this.form) + this.selectAttribut() addInfo(this.form).then(response => { this.$modal.msgSuccess("新增成功"); this.open = false; this.getList(); + this.form="" }); } } }); }, + selectAttribut(){ + this.a=[] + this.b=[] + this.c=[] + this.categoryCommonElement.templateAttributeGroupList.forEach( + templateAttributeGroup=>{ + templateAttributeGroup.attributeList.forEach( + attribute=>{ + this.a+=(attribute.id+"-"+attribute.name+"-"+attribute.value+",") + } + ) + } + ) + this.categoryCommonElement.templateAttributeList.forEach( + templateAttributeGroup=>{ + this.b+=(templateAttributeGroup.id+"-"+templateAttributeGroup.name+"-"+templateAttributeGroup.value+",") + } + ) + this.attributeCheckedList.forEach( + attributeChecked=>{ + this.c+=(attributeChecked.id+"-"+attributeChecked.name+"-"+attributeChecked.value) + } + ) + this.form.sku=this.skuList1 + this.form.specification=this.oneSettingValue + this.form.groupList=this.a + this.form.attributeList=this.b + this.form.persionList=this.c + }, /** 删除按钮操作 */ handleDelete(row) { const ids = row.id || this.ids; @@ -835,7 +847,7 @@ export default { this.download('product/info/export', { ...this.queryParams }, `info_${new Date().getTime()}.xlsx`) - } + }, } };