商品信息修改回显
parent
c24b09d95a
commit
cc8f437a06
|
@ -332,6 +332,7 @@
|
|||
<el-button type="primary" @click="oneSetting">一键设置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
{{skuList}}
|
||||
<el-table
|
||||
:data="skuList"
|
||||
border
|
||||
|
@ -374,7 +375,7 @@ import {addAttribute} from "@/api/product/attribute";
|
|||
|
||||
export default {
|
||||
name: "Info",
|
||||
dicts: ['sys_yes_no'],
|
||||
dicts: {type:{'sys_yes_no':[]}},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
|
@ -419,6 +420,7 @@ export default {
|
|||
price: '',
|
||||
stock: ''
|
||||
},
|
||||
fufObj: [],
|
||||
// 表单校验
|
||||
rules: {
|
||||
name: [
|
||||
|
@ -484,7 +486,9 @@ export default {
|
|||
"image": null,
|
||||
"stock": null,
|
||||
"price": null
|
||||
}
|
||||
},
|
||||
respData:[],
|
||||
fifObj: []
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
|
@ -505,14 +509,54 @@ export default {
|
|||
handler(value) {
|
||||
if (value != null){
|
||||
getTemplateAttribute(value).then(response => {
|
||||
console.log("res",response)
|
||||
const {data} = response;
|
||||
const {templateAttributeGroupList,templateAttributeList,attributeList} = data;
|
||||
this.categoryCommonElement.templateAttributeGroupList = templateAttributeGroupList;
|
||||
this.categoryCommonElement.templateAttributeList = templateAttributeList;
|
||||
this.categoryCommonElement.attributeList = attributeList;
|
||||
})
|
||||
}
|
||||
|
||||
console.log("resData",this.respData);
|
||||
if (this.respData != null && this.respData.length !== 0){
|
||||
this.categoryCommonElement.templateAttributeGroupList.forEach(template => {
|
||||
template.attributeList.forEach(te => {
|
||||
this.respData.forEach(asPro => {
|
||||
if (te.id == asPro.attributeId){
|
||||
console.log("value",asPro.value)
|
||||
te.value = asPro.value;
|
||||
this.fufObj.push(asPro);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
this.categoryCommonElement.templateAttributeList.forEach(tem => {
|
||||
this.respData.forEach(asPro => {
|
||||
console.log(asPro)
|
||||
if (tem.id === asPro.attributeId){
|
||||
tem.value = asPro.value;
|
||||
this.fufObj.push(asPro);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
this.respData.forEach(asPro => {
|
||||
if (!this.fufObj.includes(asPro)){
|
||||
this.attributeCheckedList.push(asPro);
|
||||
}
|
||||
});
|
||||
|
||||
this.categoryCommonElement.attributeList.forEach(attr => {
|
||||
this.attributeCheckedList.forEach(attri => {
|
||||
if (attr.id == attri.attributeId){
|
||||
attri.name = attr.name;
|
||||
this.attributeIdCheckedList.push(Number(attr.id));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -685,13 +729,16 @@ export default {
|
|||
image: null,
|
||||
carouselImages: null,
|
||||
status: null,
|
||||
ruleId: null,
|
||||
brandId: null,
|
||||
remark: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
updateTime: null,
|
||||
skuList: [],
|
||||
titleList: [],
|
||||
categoryCommonElement: [],
|
||||
oneSettingForm: {}
|
||||
};
|
||||
this.resetForm("form");
|
||||
this.initCategoryTree();
|
||||
|
@ -716,7 +763,11 @@ export default {
|
|||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.initCategoryTree()
|
||||
this.open = true;
|
||||
this.skuList=[]
|
||||
this.titleList= []
|
||||
this.oneSettingForm = {}
|
||||
this.title = "添加商品信息";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
|
@ -725,20 +776,24 @@ export default {
|
|||
const id = row.id || this.ids
|
||||
|
||||
getInfo(id).then(response => {
|
||||
|
||||
console.log(response)
|
||||
console.log("response",response)
|
||||
this.respData = response.data.asProductAttributeInfos
|
||||
this.form = response.data;
|
||||
|
||||
this.initCategoryTree()
|
||||
this.form.mianType=parseInt(response.data.mianType)
|
||||
this.form.type=parseInt(response.data.type)
|
||||
|
||||
this.oneSettingForm = response.data.productSkuModel
|
||||
this.oneSettingForm = response.data.projectSkuInfos
|
||||
this.categoryOptionValue = [Number(response.data.mianType),Number(response.data.parentType),Number(response.data.type)]
|
||||
this.changeRule(response.data.ruleId)
|
||||
this.oneSetting()
|
||||
console.log("sku",this.skuList)
|
||||
console.log("skuu",response.data.projectSkuInfos)
|
||||
for (var i = 0; i < this.skuList.length; i++) {
|
||||
this.$set(this.skuList[i], 'image', response.data.projectSkuInfos[i].image);
|
||||
this.$set(this.skuList[i], 'price', response.data.projectSkuInfos[i].price);
|
||||
this.$set(this.skuList[i], 'stock', response.data.projectSkuInfos[i].stock);
|
||||
console.log(this.skuList[i].price, response.data.projectSkuInfos[i].price);
|
||||
}
|
||||
console.log("sfdf",this.skuList)
|
||||
this.open = true;
|
||||
this.title = "修改商品信息";
|
||||
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
|
|
Loading…
Reference in New Issue