修改商品详情页购物车数量和购物车页面数量不一致的bug
This commit is contained in:
parent
6033edcd50
commit
50a3660621
@ -460,11 +460,11 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
//获取购物车数量
|
//获取购物车数量
|
||||||
getShopCar() {
|
// getShopCar() {
|
||||||
request(apiArr.getCarCount, "POST", {}).then((res) => {
|
// request(apiArr.getCarCount, "POST", {}).then((res) => {
|
||||||
this.prevCarNum = res.total;
|
// this.prevCarNum = res.total;
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
|
|
||||||
getShopCarList() {
|
getShopCarList() {
|
||||||
return request(apiArr.getCar, "POST", {}).then((res) => {
|
return request(apiArr.getCar, "POST", {}).then((res) => {
|
||||||
@ -472,6 +472,7 @@ export default {
|
|||||||
this.carOrderList = [].concat(res.same_day_cart_list, res.normal_cart_list)
|
this.carOrderList = [].concat(res.same_day_cart_list, res.normal_cart_list)
|
||||||
.flatMap(supplier => supplier.commodity_cart_and_goods_model);
|
.flatMap(supplier => supplier.commodity_cart_and_goods_model);
|
||||||
this.carNum = res.total;
|
this.carNum = res.total;
|
||||||
|
this.prevCarNum = res.total;
|
||||||
return res;
|
return res;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -510,7 +511,7 @@ export default {
|
|||||||
|
|
||||||
//因为是当前商品没有 调用update就是增加商品。增加商品之后再获取购物车数量
|
//因为是当前商品没有 调用update就是增加商品。增加商品之后再获取购物车数量
|
||||||
request(apiArr.updateCar, "POST", params).then((res) => {
|
request(apiArr.updateCar, "POST", params).then((res) => {
|
||||||
that.getShopCar();
|
// that.getShopCar();
|
||||||
that.getShopCarList();
|
that.getShopCarList();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -548,7 +549,7 @@ export default {
|
|||||||
request(apiArr.updateCar, "POST", params).then((res) => {
|
request(apiArr.updateCar, "POST", params).then((res) => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
this.getShopCarList();
|
this.getShopCarList();
|
||||||
this.getShopCar();
|
// this.getShopCar();
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "操作成功!",
|
title: "操作成功!",
|
||||||
success() { },
|
success() { },
|
||||||
@ -598,7 +599,7 @@ export default {
|
|||||||
onShow() {
|
onShow() {
|
||||||
this.getShopCarList().then(() => {
|
this.getShopCarList().then(() => {
|
||||||
this.getGoodsInfo();
|
this.getGoodsInfo();
|
||||||
this.getShopCar();
|
// this.getShopCar();
|
||||||
this.getComment();
|
this.getComment();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@ -515,11 +515,11 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
//获取购物车数量
|
//获取购物车数量
|
||||||
getShopCar() {
|
// getShopCar() {
|
||||||
request(apiArr.getCarCount, "POST", {}).then((res) => {
|
// request(apiArr.getCarCount, "POST", {}).then((res) => {
|
||||||
this.prevCarNum = res.total;
|
// this.prevCarNum = res.total;
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
|
|
||||||
getShopCarList() {
|
getShopCarList() {
|
||||||
return request(apiArr.getCar, "POST", {}).then((res) => {
|
return request(apiArr.getCar, "POST", {}).then((res) => {
|
||||||
@ -527,6 +527,7 @@ export default {
|
|||||||
this.carOrderList = [].concat(res.same_day_cart_list, res.normal_cart_list)
|
this.carOrderList = [].concat(res.same_day_cart_list, res.normal_cart_list)
|
||||||
.flatMap(supplier => supplier.commodity_cart_and_goods_model);
|
.flatMap(supplier => supplier.commodity_cart_and_goods_model);
|
||||||
this.carNum = res.total;
|
this.carNum = res.total;
|
||||||
|
this.prevCarNum = res.total;
|
||||||
return res;
|
return res;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -565,7 +566,7 @@ export default {
|
|||||||
|
|
||||||
//因为是当前商品没有 调用update就是增加商品。增加商品之后再获取购物车数量
|
//因为是当前商品没有 调用update就是增加商品。增加商品之后再获取购物车数量
|
||||||
request(apiArr.updateCar, "POST", params).then((res) => {
|
request(apiArr.updateCar, "POST", params).then((res) => {
|
||||||
that.getShopCar();
|
// that.getShopCar();
|
||||||
that.getShopCarList();
|
that.getShopCarList();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -603,7 +604,7 @@ export default {
|
|||||||
request(apiArr.updateCar, "POST", params).then((res) => {
|
request(apiArr.updateCar, "POST", params).then((res) => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
this.getShopCarList();
|
this.getShopCarList();
|
||||||
this.getShopCar();
|
// this.getShopCar();
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "操作成功!",
|
title: "操作成功!",
|
||||||
success() { },
|
success() { },
|
||||||
@ -660,7 +661,7 @@ export default {
|
|||||||
onShow() {
|
onShow() {
|
||||||
this.getShopCarList().then(() => {
|
this.getShopCarList().then(() => {
|
||||||
this.getGoodsInfo();
|
this.getGoodsInfo();
|
||||||
this.getShopCar();
|
// this.getShopCar();
|
||||||
this.getComment();
|
this.getComment();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@ -174,7 +174,6 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="cars" @click="car">
|
<view class="cars" @click="car">
|
||||||
<u-badge numberType="limit" :type="type" max="99" :value="carNum"></u-badge>
|
<u-badge numberType="limit" :type="type" max="99" :value="carNum"></u-badge>
|
||||||
|
|
||||||
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/shop_car.png"
|
<image src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/property-img-file/shop_car.png"
|
||||||
mode="widthFix"></image>
|
mode="widthFix"></image>
|
||||||
购物车
|
购物车
|
||||||
@ -1089,12 +1088,12 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
//获取购物车数量
|
//获取购物车数量
|
||||||
getShopCar() {
|
// getShopCar() {
|
||||||
request(apiArr.getCarCount, "POST", {}).then((res) => {
|
// request(apiArr.getCarCount, "POST", {}).then((res) => {
|
||||||
this.carNum = res.total;
|
// this.carNum = res.total;
|
||||||
this.prevCarNum = res.total;
|
// this.prevCarNum = res.total;
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
|
|
||||||
getShopCarList() {
|
getShopCarList() {
|
||||||
const params = {
|
const params = {
|
||||||
@ -1104,6 +1103,7 @@ export default {
|
|||||||
// 合并当日达和普通商品数据
|
// 合并当日达和普通商品数据
|
||||||
this.carOrderList = [].concat(res.same_day_cart_list, res.normal_cart_list)
|
this.carOrderList = [].concat(res.same_day_cart_list, res.normal_cart_list)
|
||||||
.flatMap(supplier => supplier.commodity_cart_and_goods_model);
|
.flatMap(supplier => supplier.commodity_cart_and_goods_model);
|
||||||
|
this.carNum = res.total;
|
||||||
return res;
|
return res;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -1134,7 +1134,7 @@ export default {
|
|||||||
group_buy_id: this.info.commodity_goods_info_list[this.currentGGIndex].group_buy_activity_id,
|
group_buy_id: this.info.commodity_goods_info_list[this.currentGGIndex].group_buy_activity_id,
|
||||||
}
|
}
|
||||||
request(apiArr.updateCar, "POST", params).then((res) => {
|
request(apiArr.updateCar, "POST", params).then((res) => {
|
||||||
that.getShopCar();
|
// that.getShopCar();
|
||||||
that.getShopCarList();
|
that.getShopCarList();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -1163,7 +1163,7 @@ export default {
|
|||||||
title: "操作成功!",
|
title: "操作成功!",
|
||||||
success() { },
|
success() { },
|
||||||
});
|
});
|
||||||
this.getShopCar();
|
// this.getShopCar();
|
||||||
this.getGoodsInfo();
|
this.getGoodsInfo();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -1282,7 +1282,7 @@ export default {
|
|||||||
this.getShopCarList().then(() => {
|
this.getShopCarList().then(() => {
|
||||||
this.getGoodsInfo();
|
this.getGoodsInfo();
|
||||||
});
|
});
|
||||||
this.getShopCar();
|
// this.getShopCar();
|
||||||
this.getZTAddress()
|
this.getZTAddress()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user