diff --git a/src/constants/app.config.js b/src/constants/app.config.js index 8c2f940..4546295 100644 --- a/src/constants/app.config.js +++ b/src/constants/app.config.js @@ -3,8 +3,8 @@ export default { appName: "Wagoo", appShareName: "Wagoo", appId: "wx00e2dcdc7c02b23a", - apiBaseUrl: "https://api.wagoo.me/api/v1", // 服务端测试地址 - // apiBaseUrl: "https://api.wagoo.pet/api/v1", // 服务端生产地址 + // apiBaseUrl: "https://api.wagoo.me/api/v1", // 服务端测试地址 + apiBaseUrl: "https://api.wagoo.pet/api/v1", // 服务端生产地址 // apiBaseUrl: "http:192.168.30.79", //本地接口 tencentMapKey: "WSBBZ-7OXK4-46QUC-KFB7B-4N3W7-M2BXM", tencentSecret: "vb7D0PGj7xUvmOLuJz2Jd7ykTMpjiWRJ", diff --git a/src/pages/client/home/index.vue b/src/pages/client/home/index.vue index 51b3ab2..90d6d5a 100644 --- a/src/pages/client/home/index.vue +++ b/src/pages/client/home/index.vue @@ -200,6 +200,31 @@ export default { type: 0, cursor: this.nextCursor } + + // 加载更多时直接请求,不使用缓存 + if (this.goodPage > 1) { + getGoodsListData(params) + .then((res) => { + const list = res?.data.data?.products || res?.data || []; + const hasMore = res?.data.data?.has_more; + const nextCursor = res?.data.data?.next_cursor || ''; + + this.goodsList = [...this.goodsList, ...list]; + this.hasMore = hasMore; + this.nextCursor = nextCursor; + this.goodsTotal = res?.count || 0; + }) + .catch((err) => { + console.error('获取商品列表失败', err); + }) + .finally(() => { + this.isLoadingGoods = false; + this.refreshTriggered = false; + }); + return; + } + + // 第一页使用缓存 getHomeGoodsWithCache(params, forceRefresh) .then((res) => { const list = res?.data.data?.products || res?.data.data || []; @@ -207,12 +232,8 @@ export default { const nextCursor = res?.data.data?.next_cursor || ''; // 只有当数据有变化时才更新商品列表,避免不必要的刷新 - if (this.goodPage === 1) { - if (res.hasChanged !== false || this.goodsList.length === 0) { - this.goodsList = list; - } - } else { - this.goodsList = [...this.goodsList, ...list]; + if (res.hasChanged !== false || this.goodsList.length === 0) { + this.goodsList = list; } this.hasMore = hasMore; diff --git a/src/pages/client/order/components/GoodInfo.vue b/src/pages/client/order/components/GoodInfo.vue index 72091cc..66572e2 100644 --- a/src/pages/client/order/components/GoodInfo.vue +++ b/src/pages/client/order/components/GoodInfo.vue @@ -1,19 +1,15 @@