修改活动商品详情页加入购物车数量不实时更新的问题
This commit is contained in:
parent
042ce47b28
commit
56e0d60f34
@ -649,9 +649,8 @@ export default {
|
|||||||
addCar() {
|
addCar() {
|
||||||
let that = this;
|
let that = this;
|
||||||
this.info.commodity_goods_info_list[this.currentGGIndex].cart_count = {
|
this.info.commodity_goods_info_list[this.currentGGIndex].cart_count = {
|
||||||
count: 1,
|
count: this.itemObj.one_one === 1 ? 2 : 1,
|
||||||
};
|
};
|
||||||
console.log("🚀 ~ this.info.commodity_goods_info_list[this.currentGGIndex]:", this.info.commodity_goods_info_list[this.currentGGIndex])
|
|
||||||
// this.info.commodity_goods_info_list.forEach((item) => {
|
// this.info.commodity_goods_info_list.forEach((item) => {
|
||||||
// console.log(item.cart_count);
|
// console.log(item.cart_count);
|
||||||
// goods_id_and_count.push({
|
// goods_id_and_count.push({
|
||||||
@ -660,7 +659,7 @@ export default {
|
|||||||
// });
|
// });
|
||||||
// });
|
// });
|
||||||
|
|
||||||
let countVal = 1
|
let countVal = this.itemObj.one_one === 1 ? 2 : 1;
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
goods_id_and_count: [
|
goods_id_and_count: [
|
||||||
@ -684,7 +683,7 @@ export default {
|
|||||||
// 获取当前商品的购物车数量,如果不存在则设为0
|
// 获取当前商品的购物车数量,如果不存在则设为0
|
||||||
const currentCount = this.info.commodity_goods_info_list[this.currentGGIndex].cart_count?.count;
|
const currentCount = this.info.commodity_goods_info_list[this.currentGGIndex].cart_count?.count;
|
||||||
// 新的数量为当前数量加一
|
// 新的数量为当前数量加一
|
||||||
const newCount = currentCount + 1;
|
const newCount = this.itemObj.one_one === 1 ? currentCount + 2 : currentCount + 1;
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
user_id: uni.getStorageSync("userId"),
|
user_id: uni.getStorageSync("userId"),
|
||||||
@ -699,7 +698,8 @@ export default {
|
|||||||
};
|
};
|
||||||
|
|
||||||
request(apiArr.updateCar, "POST", params).then((res) => {
|
request(apiArr.updateCar, "POST", params).then((res) => {
|
||||||
this.getShopCarList();
|
return this.getShopCarList();
|
||||||
|
}).then(() => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "操作成功!",
|
title: "操作成功!",
|
||||||
success() { },
|
success() { },
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user