|
|
@ -208,11 +208,13 @@ |
|
|
<Col span="6"> |
|
|
<Col span="6"> |
|
|
<FormItem label="商品属性" class="form-noheight"> |
|
|
<FormItem label="商品属性" class="form-noheight"> |
|
|
<div style="display: flex;flex-direction: column;"> |
|
|
<div style="display: flex;flex-direction: column;"> |
|
|
<div v-for="(value,key) in Array.from(addGoodsForm.attributeList1)" style="display: flex;"> |
|
|
<div v-for="(value,key) in Array.from(addGoodsForm.attributeList1)" style="display: flex;align-items:center;margin-bottom:5px;"> |
|
|
{{value[0]}}: |
|
|
{{value[0]}}: |
|
|
<div v-for="(item,index) in value[1].title"> |
|
|
<div v-for="(item,index) in value[1].title"> |
|
|
{{item}}、 |
|
|
{{item}}、 |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<span style="margin-left:8px;color:#888;">可选:</span> |
|
|
|
|
|
<Input v-model="value[1].canbuy" type="number" style="width:60px;margin-left:4px;" placeholder="1" @on-change="onCanbuyChange(value[0], value[1].canbuy)" /> |
|
|
</div> |
|
|
</div> |
|
|
<div @click="checkSpec('shuxing')" style="width: 80px;height: 30px;text-align: center;line-height: 30px;background: #008ba0;color:#fff;"> |
|
|
<div @click="checkSpec('shuxing')" style="width: 80px;height: 30px;text-align: center;line-height: 30px;background: #008ba0;color:#fff;"> |
|
|
选择属性 |
|
|
选择属性 |
|
|
@ -611,6 +613,14 @@ |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
onCanbuyChange(categoryName, value){ |
|
|
|
|
|
// 更新Map中对应分类的canbuy值 |
|
|
|
|
|
let entry = this.addGoodsForm.attributeList1.get(categoryName) |
|
|
|
|
|
if(entry){ |
|
|
|
|
|
entry.canbuy = parseInt(value) || 1 |
|
|
|
|
|
this.addGoodsForm.attributeList1.set(categoryName, entry) |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
init(v) { |
|
|
init(v) { |
|
|
this.shopId = v.id |
|
|
this.shopId = v.id |
|
|
this.searchForm.shopId = v.id |
|
|
this.searchForm.shopId = v.id |
|
|
@ -777,7 +787,7 @@ |
|
|
if(this.attrValueArr.length>0){ |
|
|
if(this.attrValueArr.length>0){ |
|
|
let index1 = false |
|
|
let index1 = false |
|
|
for (var m = 0; m < this.attrValueArr.length; m++) { |
|
|
for (var m = 0; m < this.attrValueArr.length; m++) { |
|
|
if(this.attrValueArr[m].title == this.categorySonData[i].title){ |
|
|
if(this.attrValueArr[m].title == this.categorySonData[i].title && this.attrValueArr[m].parentName == this.typeToAttrName){ |
|
|
index1 = true |
|
|
index1 = true |
|
|
this.categorySonData[i].checked = true |
|
|
this.categorySonData[i].checked = true |
|
|
} |
|
|
} |
|
|
@ -857,20 +867,27 @@ |
|
|
}, |
|
|
}, |
|
|
guigeSubmit(){ |
|
|
guigeSubmit(){ |
|
|
if(this.modalclassType == 'shuxing'){ |
|
|
if(this.modalclassType == 'shuxing'){ |
|
|
|
|
|
// 先保存旧的canbuy值 |
|
|
|
|
|
let oldCanbuyMap = {} |
|
|
|
|
|
this.addGoodsForm.attributeList1.forEach((value, key) => { |
|
|
|
|
|
oldCanbuyMap[key] = value.canbuy || 1 |
|
|
|
|
|
}) |
|
|
for(let i=0;i<this.attrValueArr.length;i++){ |
|
|
for(let i=0;i<this.attrValueArr.length;i++){ |
|
|
if(this.addGoodsForm.attributeList1.size == 0){ |
|
|
if(this.addGoodsForm.attributeList1.size == 0){ |
|
|
//set has get |
|
|
//set has get |
|
|
let data = { |
|
|
let data = { |
|
|
title:[] |
|
|
title:[], |
|
|
|
|
|
canbuy: oldCanbuyMap[this.attrValueArr[i].parentName] || 1 |
|
|
} |
|
|
} |
|
|
data.title.push(this.attrValueArr[i].title) |
|
|
data.title.push(this.attrValueArr[i].title) |
|
|
this.addGoodsForm.attributeList1.set(this.attrValueArr[i].parentName,data) |
|
|
this.addGoodsForm.attributeList1.set(this.attrValueArr[i].parentName,data) |
|
|
}else{ |
|
|
}else{ |
|
|
if(this.addGoodsForm.attributeList1.has(this.attrValueArr[i].parentName) && this.addGoodsForm.attributeList1.get(this.attrValueArr[i].parentName).title.indexOf(this.attrValueArr[i].title) == -1){ |
|
|
if(this.addGoodsForm.attributeList1.has(this.attrValueArr[i].parentName) && this.addGoodsForm.attributeList1.get(this.attrValueArr[i].parentName).title.indexOf(this.attrValueArr[i].title) == -1){ |
|
|
this.addGoodsForm.attributeList1.get(this.attrValueArr[i].parentName).title.push(this.attrValueArr[i].title) |
|
|
this.addGoodsForm.attributeList1.get(this.attrValueArr[i].parentName).title.push(this.attrValueArr[i].title) |
|
|
}else{ |
|
|
}else if(!this.addGoodsForm.attributeList1.has(this.attrValueArr[i].parentName)){ |
|
|
let data = { |
|
|
let data = { |
|
|
title:[] |
|
|
title:[], |
|
|
|
|
|
canbuy: oldCanbuyMap[this.attrValueArr[i].parentName] || 1 |
|
|
} |
|
|
} |
|
|
data.title.push(this.attrValueArr[i].title) |
|
|
data.title.push(this.attrValueArr[i].title) |
|
|
this.addGoodsForm.attributeList1.set(this.attrValueArr[i].parentName,data) |
|
|
this.addGoodsForm.attributeList1.set(this.attrValueArr[i].parentName,data) |
|
|
@ -1140,6 +1157,12 @@ |
|
|
} |
|
|
} |
|
|
this.addGoodsForm.attributeList1 = JSON.parse(this.addGoodsForm.attributeList) |
|
|
this.addGoodsForm.attributeList1 = JSON.parse(this.addGoodsForm.attributeList) |
|
|
this.addGoodsForm.attributeList1 = new Map(Object.entries(this.addGoodsForm.attributeList1)); |
|
|
this.addGoodsForm.attributeList1 = new Map(Object.entries(this.addGoodsForm.attributeList1)); |
|
|
|
|
|
// 兼容历史数据:如果没有canbuy字段,默认设为1 |
|
|
|
|
|
this.addGoodsForm.attributeList1.forEach((value, key) => { |
|
|
|
|
|
if(value.canbuy === undefined || value.canbuy === null){ |
|
|
|
|
|
value.canbuy = 1 |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
this.addGoodsForm.attributeListPrice = JSON.parse(this.addGoodsForm.attributeListPrice) |
|
|
this.addGoodsForm.attributeListPrice = JSON.parse(this.addGoodsForm.attributeListPrice) |
|
|
|
|
|
|
|
|
this.addGoodsForm.attributeList1.forEach((value, key) => { |
|
|
this.addGoodsForm.attributeList1.forEach((value, key) => { |
|
|
|