商品属性添加

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-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-step title="商品品类"></el-step> <el-step title="商品品类"></el-step>
<el-step title="商品备注"></el-step>
</el-steps> </el-steps>
@ -360,11 +360,8 @@
</div> </div>
</el-card> </el-card>
</div> </div>
<div v-if="active==4"> <div v-if="active==4">
<el-form-item label="商品备注"> <el-form-item label="商品备注">
<editor v-model="form.remark" :min-height="192"/> <editor v-model="form.remark" :min-height="192"/>
@ -475,44 +472,51 @@ export default {
ruleId: null, ruleId: null,
brandId: null, brandId: null,
}, },
skuList1 : [],
// //
form: { form: {
ruleId:[], sku:"",
skuList:[], mianType:'',
templateAttributeGroupList:[], parentType:'',
attributeCheckedList:[], type:'',
templateAttributeList:[], specification:"",
groupList:"",
attributeList:"",
persionList:"",
}, },
// //
rules: { rules: {
name: [ 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"} a:[],
], b:[],
mainType: [ c:[],
{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"}
],
}
}; };
}, },
watch: { watch: {
@ -606,12 +610,35 @@ 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)
} }
}) })
} }
} }
// 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() { handleCheckedCitiesChange() {
let attributeId = this.attributeIdCheckedList let attributeId = this.attributeIdCheckedList
@ -753,11 +780,36 @@ export default {
this.getList(); this.getList();
}); });
} else { } else {
this.form.templateAttributeGroupList=this.categoryCommonElement.templateAttributeGroupList console.log(this.categoryCommonElement)
this.form.attributeCheckedList=this.attributeCheckedList this.categoryCommonElement.templateAttributeGroupList.forEach(
this.form.skuList=this.skuList templateAttributeGroup=>{
this.form.templateAttributeList=this.categoryCommonElement.templateAttributeList 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 => { addInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;