修改首页搜索商品的数量不实时更新的bug

This commit is contained in:
赵毅 2025-10-24 17:26:58 +08:00
parent a139ec38c9
commit 884b7e5b38

View File

@ -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) {