|
@@ -238,12 +238,13 @@ export default {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
that.$set(that, `list`, list)
|
|
that.$set(that, `list`, list)
|
|
- that.goodsAllChange(value);
|
|
|
|
|
|
+ that.goodsAllChange();
|
|
// 计算总额
|
|
// 计算总额
|
|
that.countMoney();
|
|
that.countMoney();
|
|
},
|
|
},
|
|
//商品全部选择true,店铺自动选择,
|
|
//商品全部选择true,店铺自动选择,
|
|
- goodsAllChange(value) {
|
|
|
|
|
|
+ // 所有店铺为true,则全选为true
|
|
|
|
+ goodsAllChange() {
|
|
const that = this;
|
|
const that = this;
|
|
let list = that.list;
|
|
let list = that.list;
|
|
list = list.map(i => {
|
|
list = list.map(i => {
|
|
@@ -252,6 +253,9 @@ export default {
|
|
else i.check = false;
|
|
else i.check = false;
|
|
return i;
|
|
return i;
|
|
})
|
|
})
|
|
|
|
+ const allSelect = list.every(e => e.check)
|
|
|
|
+ if (allSelect) this.$set(this, `isAll`, true)
|
|
|
|
+ else this.$set(this, `isAll`, false)
|
|
// 计算总额
|
|
// 计算总额
|
|
that.countMoney();
|
|
that.countMoney();
|
|
},
|
|
},
|
|
@@ -279,36 +283,24 @@ export default {
|
|
that.countMoney();
|
|
that.countMoney();
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- // 删除
|
|
|
|
- toDel(e) {
|
|
|
|
- const that = this;
|
|
|
|
- const list = that.list;
|
|
|
|
- let shop = list.find(f => f.goods.find(i => i.check == true))
|
|
|
|
- if (shop) {
|
|
|
|
- uni.showModal({
|
|
|
|
- title: '提示',
|
|
|
|
- content: '确认要删除这些商品吗?',
|
|
|
|
- success: async function (res) {
|
|
|
|
- if (res.confirm) { }
|
|
|
|
|
|
+ // 删除, 接口,购物车删除,然后将该数据移除
|
|
|
|
+ async toDel(e) {
|
|
|
|
+ let list = this.list;
|
|
|
|
+ uni.showModal({
|
|
|
|
+ title: '提示',
|
|
|
|
+ content: '请选择要删除的商品',
|
|
|
|
+ success: async (res) => {
|
|
|
|
+ if (!res.confirm) return
|
|
|
|
+ const result = await this.$api(`/cart/${e.cart_id}`, 'Delete');
|
|
|
|
+ if (result.errcode === 0) {
|
|
|
|
+ list = list.map(i => ({ ...i, goods: i.goods.filter(f => f.cart_id !== e.cart_id) }))
|
|
|
|
+ this.$set(this, `list`, list);
|
|
|
|
+ // 计算总额
|
|
|
|
+ this.countMoney();
|
|
}
|
|
}
|
|
- });
|
|
|
|
- } else if (e.id) {
|
|
|
|
- uni.showModal({
|
|
|
|
- title: '提示',
|
|
|
|
- content: '是否确认删除该商品',
|
|
|
|
- success: async function (res) {
|
|
|
|
- if (res.confirm) { }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- } else {
|
|
|
|
- uni.showModal({
|
|
|
|
- title: '提示',
|
|
|
|
- content: '请选择要删除的商品',
|
|
|
|
- success: async function (res) {
|
|
|
|
- if (res.confirm) { }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
},
|
|
},
|
|
// 计算总额
|
|
// 计算总额
|
|
countMoney() {
|
|
countMoney() {
|