修复组件选择商品后再次修改数量不变的bug
This commit is contained in:
parent
fb50530bb3
commit
d0a0275d2e
|
@ -173,27 +173,23 @@
|
||||||
//价格
|
//价格
|
||||||
producrprice(e, i, item) {
|
producrprice(e, i, item) {
|
||||||
this.bought[i].price = e.detail.value
|
this.bought[i].price = e.detail.value
|
||||||
this.$set(item, 'check', false);
|
// this.$set(item, 'check', false);
|
||||||
for (let i in this.checkedArr) {
|
// for (let i in this.checkedArr) {
|
||||||
if (this.checkedArr[i].product_id == item.product_id) {
|
// if (this.checkedArr[i].product_id == item.product_id) {
|
||||||
this.checkedArr.splice(i, 1)
|
// this.checkedArr.splice(i, 1)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
incrementTotal(e, i, item) {
|
incrementTotal(e, i, item) {
|
||||||
this.$set(item, 'check', false);
|
// this.$set(item, 'check', false);
|
||||||
for (let i in this.checkedArr) {
|
// for (let i in this.checkedArr) {
|
||||||
if (this.checkedArr[i].product_id == item.product_id) {
|
// if (this.checkedArr[i].product_id == item.product_id) {
|
||||||
this.checkedArr.splice(i, 1)
|
// this.checkedArr.splice(i, 1)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
// picker修改事件
|
// picker修改事件
|
||||||
|
@ -216,8 +212,10 @@
|
||||||
},
|
},
|
||||||
numberChange(data, i) {
|
numberChange(data, i) {
|
||||||
this.peicenumber = data.number;
|
this.peicenumber = data.number;
|
||||||
this.bought[i].number = data.number
|
this.bought[i].number = data.number;
|
||||||
|
// 处理数据回显时, 调整数量, 选中的数据不改变的问题
|
||||||
|
let obj = this.checkedArr.find((item)=>item.product_id==this.bought[i].product_id);
|
||||||
|
obj ? obj.number = data.number:null;
|
||||||
},
|
},
|
||||||
|
|
||||||
tabs(index) {
|
tabs(index) {
|
||||||
|
@ -300,7 +298,6 @@
|
||||||
this.checkedArr.forEach((item, index) => {
|
this.checkedArr.forEach((item, index) => {
|
||||||
this.checkedArr.push(item)
|
this.checkedArr.push(item)
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/*点击选中与否*/
|
/*点击选中与否*/
|
||||||
|
@ -330,7 +327,7 @@
|
||||||
}
|
}
|
||||||
acc.push(cru)
|
acc.push(cru)
|
||||||
} else {
|
} else {
|
||||||
console.log(acc, hash[cru[name]])
|
// console.log(acc, hash[cru[name]])
|
||||||
acc.splice(hash[cru[name]]['index'], 1, cru)
|
acc.splice(hash[cru[name]]['index'], 1, cru)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,7 +341,7 @@
|
||||||
},
|
},
|
||||||
/*确定提交*/
|
/*确定提交*/
|
||||||
submit() {
|
submit() {
|
||||||
|
console.log(this.checkedArr);
|
||||||
this.$emit('getProduct', this.checkedArr);
|
this.$emit('getProduct', this.checkedArr);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
|
@ -209,7 +209,9 @@
|
||||||
numberChange(data, i) {
|
numberChange(data, i) {
|
||||||
this.peicenumber = data.number;
|
this.peicenumber = data.number;
|
||||||
this.bought[i].number = data.number
|
this.bought[i].number = data.number
|
||||||
|
// 处理数据回显时, 调整数量, 选中的数据不改变的问题
|
||||||
|
let obj = this.checkedArr.find((item)=>item.product_id==this.bought[i].product_id);
|
||||||
|
obj ? obj.number = data.number:null;
|
||||||
},
|
},
|
||||||
|
|
||||||
tabs(index) {
|
tabs(index) {
|
||||||
|
|
Loading…
Reference in New Issue