|
@@ -215,20 +215,32 @@
|
|
|
async changeValue(value) {
|
|
|
const that = this;
|
|
|
let user = that.user;
|
|
|
+ let list = that.list;
|
|
|
+ let goodsList = [];
|
|
|
if (user && user._id) {
|
|
|
this.$nextTick(async () => {
|
|
|
let res;
|
|
|
const obj = {
|
|
|
num: value.num,
|
|
|
- money: that.$multiply(value.specs.money, value.num)
|
|
|
+ total_money: that.$multiply(value.specs.money, value.num)
|
|
|
}
|
|
|
res = await that.$api(`/Cart/${value.cart_id}`, 'POST', obj)
|
|
|
if (res.errcode == '0') {
|
|
|
+ goodsList = list.map(i => ({
|
|
|
+ ...i,
|
|
|
+ list: i.list.map(f => {
|
|
|
+ if (f.cart_id == value.cart_id) {
|
|
|
+ f.num = obj.num
|
|
|
+ f.total_money = obj.total_money
|
|
|
+ }
|
|
|
+ return f
|
|
|
+ })
|
|
|
+ }))
|
|
|
+ that.$set(that, `list`, goodsList)
|
|
|
uni.showToast({
|
|
|
title: `加入购物车成功`,
|
|
|
icon: 'none'
|
|
|
})
|
|
|
- that.searchMarket();
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: res.errmsg,
|
|
@@ -248,7 +260,6 @@
|
|
|
async toDel(e) {
|
|
|
const that = this;
|
|
|
let list = that.list;
|
|
|
- let goodsList = [];
|
|
|
uni.showModal({
|
|
|
title: '提示',
|
|
|
content: '请选择要删除的商品',
|