diff --git a/packages/shop/search/index.vue b/packages/shop/search/index.vue index 68840013..27376f50 100644 --- a/packages/shop/search/index.vue +++ b/packages/shop/search/index.vue @@ -185,7 +185,7 @@ export default { }, // 获取购物车数据 getShopCarList() { - request(apiArr.getCar, "POST").then((res) => { + return request(apiArr.getCar, "POST").then((res) => { this.value = res.total; // 合并当日达和普通商品数据 this.goodsDetail = [].concat(res.same_day_cart_list || [], res.normal_cart_list || []) @@ -408,7 +408,12 @@ export default { this.isSearched = false; }, onShow() { - this.getShopCarList(); + this.getShopCarList().then(() => { + // 延迟一小段时间确保购物车数据已完全更新,然后同步商品数量 + setTimeout(() => { + this.syncGoodsQuantities(); + }, 100); + }); }, onReachBottom() { if (this.flag) {