商品属性添加

master
2812875475 2024-03-22 09:46:12 +08:00
parent 4fca053825
commit 8f4035206e
1 changed files with 92 additions and 40 deletions

View File

@ -125,9 +125,9 @@
<el-steps :active="active" finish-status="success">
<el-step title="商品信息"></el-step>
<el-step title="商品备注"></el-step>
<el-step title="商品规格"></el-step>
<el-step title="商品品类"></el-step>
<el-step title="商品备注"></el-step>
</el-steps>
@ -360,11 +360,8 @@
</div>
</el-card>
</div>
<div v-if="active==4">
<el-form-item label="商品备注">
<editor v-model="form.remark" :min-height="192"/>
@ -475,44 +472,51 @@ export default {
ruleId: null,
brandId: null,
},
skuList1 : [],
//
form: {
ruleId:[],
skuList:[],
templateAttributeGroupList:[],
attributeCheckedList:[],
templateAttributeList:[],
sku:"",
mianType:'',
parentType:'',
type:'',
specification:"",
groupList:"",
attributeList:"",
persionList:"",
},
//
rules: {
name: [
{required: true, message: "商品名称不能为空", trigger: "blur"}
// {required: true, message: "", trigger: "blur"}
// ],
// introduction: [
// {required: true, message: "", trigger: "blur"}
// ],
// mainType: [
// {required: true, message: "", trigger: "change"}
// ],
// parentType: [
// {required: true, message: "", trigger: "change"}
// ],
// type: [
// {required: true, message: "", trigger: "change"}
// ],
// image: [
// {required: true, message: "", trigger: "blur"}
// ],
// carouselImages: [
// {required: true, message: "", trigger: "blur"}
// ],
// status: [
// {required: true, message: "", trigger: "change"}
// ],
// remark: [
// {required: true, message: "", trigger: "blur"}
],
introduction: [
{required: true, message: "商品描述不能为空", trigger: "blur"}
],
mainType: [
{required: true, message: "主类型不能为空", trigger: "change"}
],
parentType: [
{required: true, message: "父类型不能为空", trigger: "change"}
],
type: [
{required: true, message: "商品类型不能为空", trigger: "change"}
],
image: [
{required: true, message: "商品图片不能为空", trigger: "blur"}
],
carouselImages: [
{required: true, message: "商品轮播图不能为空", trigger: "blur"}
],
status: [
{required: true, message: "商品状态不能为空", trigger: "change"}
],
remark: [
{required: true, message: "备注不能为空", trigger: "blur"}
],
}
},
a:[],
b:[],
c:[],
};
},
watch: {
@ -606,12 +610,35 @@ export default {
ruleList.forEach(value => {
for (let continuousIndex = 0; continuousIndex < continuousSize; continuousIndex++) {
this.skuList[counter++]["prop" + currentIndex] = value;
console.log(value)
}
})
}
}
// SKU
const generateSkuCombinations = (currentIndex, currentCombination) => {
if (currentIndex === ruleAttrList.length) {
// skuList
this.skuList1.push(currentCombination);
return;
}
const { ruleList } = ruleAttrList[currentIndex];
for (let value of ruleList) {
generateSkuCombinations(currentIndex + 1, currentCombination + value);
}
};
//
generateSkuCombinations(0, '');
//
this.skuList1.forEach(sku => {
console.log(sku);
});
},
handleCheckedCitiesChange() {
let attributeId = this.attributeIdCheckedList
@ -753,11 +780,36 @@ export default {
this.getList();
});
} else {
this.form.templateAttributeGroupList=this.categoryCommonElement.templateAttributeGroupList
this.form.attributeCheckedList=this.attributeCheckedList
this.form.skuList=this.skuList
this.form.templateAttributeList=this.categoryCommonElement.templateAttributeList
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)
addInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;