商品属性修改

master
2812875475 2024-03-22 19:42:00 +08:00
parent 8f4035206e
commit ecfc615f9f
1 changed files with 56 additions and 44 deletions

View File

@ -175,7 +175,8 @@
v-for="brand in brandList" v-for="brand in brandList"
:key="brand.id" :key="brand.id"
:label="brand.nam" :label="brand.nam"
:value="brand.id"> :value="brand.id"
>
<el-row> <el-row>
<div style="display: inline-flex; align-items: center;"> <div style="display: inline-flex; align-items: center;">
{{ brand.nam }}----------------- {{ brand.nam }}-----------------
@ -277,6 +278,7 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<el-tabs v-model="activeName"> <el-tabs v-model="activeName">
<el-tab-pane label="商品属性组" name="first"> <el-tab-pane label="商品属性组" name="first">
{{e}}
<el-row> <el-row>
<el-col :span="6" <el-col :span="6"
v-for="templateAttributeGroup in categoryCommonElement.templateAttributeGroupList"> v-for="templateAttributeGroup in categoryCommonElement.templateAttributeGroupList">
@ -367,8 +369,6 @@
<editor v-model="form.remark" :min-height="192"/> <editor v-model="form.remark" :min-height="192"/>
</el-form-item> </el-form-item>
</div> </div>
</el-form> </el-form>
@ -434,7 +434,6 @@ export default {
templateAttributeGroupList: [], templateAttributeGroupList: [],
templateAttributeList: [], templateAttributeList: [],
attributeList: [] attributeList: []
}, },
ruleAddFormStatus: false, ruleAddFormStatus: false,
addRulePropertyValue: null, addRulePropertyValue: null,
@ -483,6 +482,7 @@ export default {
groupList:"", groupList:"",
attributeList:"", attributeList:"",
persionList:"", persionList:"",
remark:'',
}, },
// //
rules: { rules: {
@ -517,6 +517,13 @@ export default {
a:[], a:[],
b:[], b:[],
c:[], c:[],
d:[],
e:[
{
"name":null,
"value":null
}
],
}; };
}, },
watch: { watch: {
@ -546,7 +553,7 @@ export default {
}) })
} }
} }
} },
}, },
created() { created() {
this.getList(); this.getList();
@ -602,7 +609,6 @@ export default {
for (let forIndex = parseInt(currentIndex) - 1; forIndex >= 0; forIndex--) { for (let forIndex = parseInt(currentIndex) - 1; forIndex >= 0; forIndex--) {
forSize = forSize * ruleAttrList[forIndex].ruleList.length forSize = forSize * ruleAttrList[forIndex].ruleList.length
} }
console.log(`${ruleAttrInfo.name} 规格连续出现的次数 ${continuousSize} 循环出现的次数: ${forSize}`)
let counter = 0; let counter = 0;
for (let forIndex = 0; forIndex < forSize; forIndex++) { for (let forIndex = 0; forIndex < forSize; forIndex++) {
@ -610,7 +616,7 @@ export default {
ruleList.forEach(value => { ruleList.forEach(value => {
for (let continuousIndex = 0; continuousIndex < continuousSize; continuousIndex++) { for (let continuousIndex = 0; continuousIndex < continuousSize; continuousIndex++) {
this.skuList[counter++]["prop" + currentIndex] = value; this.skuList[counter++]["prop" + currentIndex] = value;
console.log(value)
} }
}) })
} }
@ -634,10 +640,7 @@ export default {
// //
generateSkuCombinations(0, ''); generateSkuCombinations(0, '');
//
this.skuList1.forEach(sku => {
console.log(sku);
});
}, },
handleCheckedCitiesChange() { handleCheckedCitiesChange() {
@ -758,15 +761,20 @@ export default {
this.reset(); this.reset();
const id = row.id || this.ids const id = row.id || this.ids
getInfo(id).then(response => { getInfo(id).then(response => {
console.log(response)
this.form = response.data; 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.changeRule(response.data.ruleId)
this.onSubmit()
this.form.type=parseInt(response.data.type) this.form.type=parseInt(response.data.type)
this.form.mianType=parseInt(response.data.mianType) this.form.mianType=parseInt(response.data.mianType)
this.form.parentType=parseInt(response.data.parentType) this.form.parentType=parseInt(response.data.parentType)
this.CategoryTree() this.CategoryTree()
this.open = true; this.open = true;
this.title = "修改商品信息"; this.title = "修改商品信息";
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
@ -774,13 +782,30 @@ export default {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.id != null) { if (this.form.id != null) {
this.selectAttribut()
console.log(this.form)
updateInfo(this.form).then(response => { updateInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
this.form=""
}); });
} else { } else {
console.log(this.categoryCommonElement) 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( this.categoryCommonElement.templateAttributeGroupList.forEach(
templateAttributeGroup=>{ templateAttributeGroup=>{
templateAttributeGroup.attributeList.forEach( templateAttributeGroup.attributeList.forEach(
@ -800,24 +825,11 @@ export default {
this.c+=(attributeChecked.id+"-"+attributeChecked.name+"-"+attributeChecked.value) 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.sku=this.skuList1
this.form.specification=this.oneSettingValue this.form.specification=this.oneSettingValue
// this.form.categoryList=this.a.concat(this.b).concat(this.c)
this.form.groupList=this.a this.form.groupList=this.a
this.form.attributeList=this.b this.form.attributeList=this.b
this.form.persionList=this.c this.form.persionList=this.c
console.log(this.form)
addInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
@ -835,7 +847,7 @@ export default {
this.download('product/info/export', { this.download('product/info/export', {
...this.queryParams ...this.queryParams
}, `info_${new Date().getTime()}.xlsx`) }, `info_${new Date().getTime()}.xlsx`)
} },
} }
}; };
</script> </script>