+
{{value[0]}}:
{{item}}、
+
可选:
+
选择属性
@@ -611,6 +613,14 @@
};
},
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) {
this.shopId = v.id
this.searchForm.shopId = v.id
@@ -777,7 +787,7 @@
if(this.attrValueArr.length>0){
let index1 = false
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
this.categorySonData[i].checked = true
}
@@ -857,20 +867,27 @@
},
guigeSubmit(){
if(this.modalclassType == 'shuxing'){
+ // 先保存旧的canbuy值
+ let oldCanbuyMap = {}
+ this.addGoodsForm.attributeList1.forEach((value, key) => {
+ oldCanbuyMap[key] = value.canbuy || 1
+ })
for(let i=0;i {
+ if(value.canbuy === undefined || value.canbuy === null){
+ value.canbuy = 1
+ }
+ });
this.addGoodsForm.attributeListPrice = JSON.parse(this.addGoodsForm.attributeListPrice)
this.addGoodsForm.attributeList1.forEach((value, key) => {