From edfe379848de5b5febbcc482f52b57acd3b836bb Mon Sep 17 00:00:00 2001 From: luowenfeng <1092164058@qq.com> Date: Tue, 23 Aug 2022 21:06:59 +0800 Subject: [PATCH] =?UTF-8?q?feature(uniapp=E5=95=86=E5=93=81):=20=E5=A4=9A?= =?UTF-8?q?=E8=A7=84=E6=A0=BC=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/mall/product/spu/save.vue | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/yudao-ui-admin/src/views/mall/product/spu/save.vue b/yudao-ui-admin/src/views/mall/product/spu/save.vue index 632c00744..2cd3eeaf6 100644 --- a/yudao-ui-admin/src/views/mall/product/spu/save.vue +++ b/yudao-ui-admin/src/views/mall/product/spu/save.vue @@ -52,9 +52,8 @@ icon="el-icon-delete" circle class="spec-delete" - @click="dynamicSpec.splice(index, 1)" + @click="removeSpec(index)" > -
规格项: @@ -286,10 +285,15 @@ export default { }, created() { + this.getListCategory(); this.getPropertyPageList(); }, methods: { + removeSpec(index){ + this.dynamicSpec.splice(index, 1); + this.changeRadio() + }, async confirmLeave(active, old){ await this.$refs[old].validate((valid) => { console.log(valid) @@ -306,12 +310,13 @@ export default { ]; }, changeRadio() { - this.$refs.ratesTable.doLayout() + this.$refs.ratesTable.doLayout(); if (this.ratesForm.spec == 1) { this.ratesForm.rates = [{}] } else { this.ratesForm.rates = [] if (this.dynamicSpec.length > 0) { + console.log( this.dynamicSpec) this.buildRatesFormRates() } } @@ -360,12 +365,16 @@ export default { if (this.ratesForm.spec == 2) { rates.forEach(r => { let properties = [] - Array.of(r.spec).forEach((v, i) => { - let specValue = this.dynamicSpec[i].specValue.find(o => o.name == v); - let propertie = {}; - propertie.propertyId = this.dynamicSpec[i].specId; - propertie.valueId = specValue.id; - properties.push(propertie); + Array.of(r.spec).forEach(s => { + Array.of(s).forEach((v, i) => { + console.log(this.dynamicSpec, r, s, v, i) + let specValue = this.dynamicSpec[i].specValue.find(o => o.name == v); + console.log(specValue) + let propertie = {}; + propertie.propertyId = this.dynamicSpec[i].specId; + propertie.valueId = specValue.id; + properties.push(propertie); + }) }) r.properties = properties; })