master
20300 2024-03-23 13:00:41 +08:00
parent 3cf0ffd590
commit 139177be42
1 changed files with 40 additions and 11 deletions

View File

@ -232,7 +232,7 @@
<div style="height: 200px; width: 100%;"> <div style="height: 200px; width: 100%;">
<el-form ref="templateAttributeGroupForm" label-width="80px"> <el-form ref="templateAttributeGroupForm" label-width="80px">
<el-form-item :label="attribute.name" v-for="attribute in templateAttributeGroup.attributeList"> <el-form-item :label="attribute.name" v-for="attribute in templateAttributeGroup.attributeList">
<el-input v-model="attribute.value"></el-input> <el-input v-model="attribute.value" :key="attribute.id"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@ -333,6 +333,7 @@
<el-button type="primary" @click="oneSetting"></el-button> <el-button type="primary" @click="oneSetting"></el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
{{skuList}}
<el-table <el-table
:data="skuList" :data="skuList"
border border
@ -480,8 +481,9 @@ export default {
"stock": null, "stock": null,
"price": null "price": null
}, },
parentObj: [], fifObj: [],
bigParentObj: [] respSkuList: [],
}; };
}, },
watch: { watch: {
@ -503,21 +505,19 @@ export default {
console.log(value) console.log(value)
if (value != null){ if (value != null){
getTemplateAttribute(value).then(res => { getTemplateAttribute(value).then(res => {
console.log("res",res)
this.categoryCommonElement.templateAttributeGroupList = res.data.templateAttributeGroupList; this.categoryCommonElement.templateAttributeGroupList = res.data.templateAttributeGroupList;
this.categoryCommonElement.templateAttributeList = res.data.templateAttributeList; this.categoryCommonElement.templateAttributeList = res.data.templateAttributeList;
this.categoryCommonElement.attributeList = res.data.attributeList; this.categoryCommonElement.attributeList = res.data.attributeList;
console.log(this.respData) console.log(this.respData)
if (this.respData!= null && this.respData != [] && this.respData != undefined && this.respData.length>0){ if (this.respData!= null && this.respData != [] && this.respData != undefined && this.respData.length>0){
console.log("llll")
console.log("qian",this.categoryCommonElement)
this.categoryCommonElement.templateAttributeGroupList.forEach(template =>{ this.categoryCommonElement.templateAttributeGroupList.forEach(template =>{
console.log("template",template)
template.attributeList.forEach(te => { template.attributeList.forEach(te => {
this.respData.forEach( this.respData.forEach(
asPro => { asPro => {
if (te.id === asPro.attributeId){ if (te.id === asPro.attributeId){
te.value = asPro.value this.$set(te, 'value', asPro.value)
this.fifObj.push(asPro)
} }
} }
) )
@ -534,15 +534,28 @@ export default {
tem => { tem => {
this.respData.forEach( this.respData.forEach(
asPro => { asPro => {
if (tem.id = asPro.attributeId){ if (tem.id === asPro.attributeId){
tem.value = asPro.value this.$set(tem, 'value', asPro.value);
this.fifObj.push(asPro)
} }
} }
) )
} }
) )
this.attributeCheckedList = []
this.respData.forEach(asPro => { this.respData.forEach(asPro => {
if (!this.fifObj.includes(asPro)){
this.attributeCheckedList.push(asPro)
}
})
this.attributeIdCheckedList = []
this.categoryCommonElement.attributeList.forEach(attr => {
this.attributeCheckedList.forEach(attri => {
if (attr.id == attri.attributeId){
attri.name = attr.name
this.attributeIdCheckedList.push(attr.id)
}
})
}) })
} }
}) })
@ -563,6 +576,7 @@ export default {
}, },
changeRule(ruleId){ changeRule(ruleId){
this.titleList = [] this.titleList = []
console.log("list",this.ruleList)
let ruleInfo = this.ruleList.find(ruleInfo => ruleInfo.id === ruleId); let ruleInfo = this.ruleList.find(ruleInfo => ruleInfo.id === ruleId);
const {ruleAttrList} = ruleInfo; const {ruleAttrList} = ruleInfo;
let skuTotal = 1; let skuTotal = 1;
@ -608,6 +622,13 @@ export default {
}) })
} }
} }
if (this.respSkuList != null && this.respSkuList != [] && this.respSkuList.length>0){
for (let i = 0; i < this.respSkuList.length; i++) {
this.skuList[i].stock = this.respSkuList[i].stock
this.skuList[i].price = this.respSkuList[i].price
this.skuList[i].image = this.respSkuList[i].image
}
}
}, },
saveCustomAttribute(){ saveCustomAttribute(){
addAttribute({"code": this.customAttributeForm.code, "name": this.customAttributeForm.name}).then(response => { addAttribute({"code": this.customAttributeForm.code, "name": this.customAttributeForm.name}).then(response => {
@ -756,6 +777,7 @@ export default {
const id = row.id || this.ids const id = row.id || this.ids
getInfo(id).then(response => { getInfo(id).then(response => {
// this.form = response.data; // this.form = response.data;
console.log("response",response)
this.form = response.data.projectInfo this.form = response.data.projectInfo
// this.categoryOptionValue[0] = response.data.projectInfo.mianType // this.categoryOptionValue[0] = response.data.projectInfo.mianType
@ -766,6 +788,8 @@ export default {
// this.form.parentType = response.data.projectInfo.parentType; // this.form.parentType = response.data.projectInfo.parentType;
// this.form.type = response.data.projectInfo.type; // this.form.type = response.data.projectInfo.type;
this.respData = response.data.asProductAttributeInfoList this.respData = response.data.asProductAttributeInfoList
this.respSkuList = response.data.projectSkuInfoList
this.categoryOptionValue = [ this.categoryOptionValue = [
Number(response.data.projectInfo.mianType), Number(response.data.projectInfo.mianType),
Number(response.data.projectInfo.parentType), Number(response.data.projectInfo.parentType),
@ -834,6 +858,8 @@ export default {
// console.log(response) // console.log(response)
this.open = true; this.open = true;
this.title = "修改商品信息"; this.title = "修改商品信息";
console.log("id",response.data.projectInfo.ruleId)
this.changeRule(response.data.projectInfo.ruleId)
}); });
}, },
@ -936,6 +962,9 @@ export default {
productSkuList: productSkuList productSkuList: productSkuList
}; };
console.log(productAddReq) console.log(productAddReq)
if (productAddReq.projectAddModel.id != undefined && productAddReq.projectAddModel.id != null){
productAddReq.id = productAddReq.projectAddModel.id
}
if (this.form.id != null) { if (this.form.id != null) {
updateInfo(productAddReq).then(response => { updateInfo(productAddReq).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");