From 85bc5bc36fe7b96777f079d913c7ae826772ba6a Mon Sep 17 00:00:00 2001 From: Default User Date: Tue, 30 Dec 2025 13:16:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BA=86=E6=94=B6=E8=97=8F?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=8A=B6=E6=80=81=E9=80=BB=E8=BE=91=E5=92=8C?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E7=9B=B8=E5=85=B3=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4f2598a54eddf72b7d1fa.jpg => 招商图片.jpg} | Bin pages/cooperation/index.wxml | 2 +- pages/favorites/index.js | 14 ++++++++++++++ pages/goods-detail/goods-detail.wxml | 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) rename images/{9e590639954f2598a54eddf72b7d1fa.jpg => 招商图片.jpg} (100%) diff --git a/images/9e590639954f2598a54eddf72b7d1fa.jpg b/images/招商图片.jpg similarity index 100% rename from images/9e590639954f2598a54eddf72b7d1fa.jpg rename to images/招商图片.jpg diff --git a/pages/cooperation/index.wxml b/pages/cooperation/index.wxml index 82a49d3..925fc94 100644 --- a/pages/cooperation/index.wxml +++ b/pages/cooperation/index.wxml @@ -6,7 +6,7 @@ - + diff --git a/pages/favorites/index.js b/pages/favorites/index.js index 0106417..841eb9d 100644 --- a/pages/favorites/index.js +++ b/pages/favorites/index.js @@ -227,6 +227,7 @@ Page({ let contact_phone = ''; let fullRegion = ''; let province = ''; + let status = 'pending_review'; // 默认状态 // 优先从商品列表中获取联系人信息和地区信息 if (matchingProduct) { @@ -236,6 +237,8 @@ Page({ fullRegion = matchingProduct.fullRegion || matchingProduct.region || ''; // 提取省份 province = extractProvince(fullRegion); + // 获取商品状态 + status = matchingProduct.status || 'pending_review'; } // 然后尝试从收藏数据中获取 else if (item.Product) { @@ -245,6 +248,8 @@ Page({ fullRegion = item.Product.region || ''; // 提取省份 province = extractProvince(fullRegion); + // 获取商品状态 + status = item.Product.status || 'pending_review'; } // 更新item对象,确保联系人信息和地区信息同时存在于顶层和Product对象中 @@ -252,16 +257,25 @@ Page({ item.contact_phone = contact_phone; item.fullRegion = fullRegion; item.region = province; + item.status = status; if (item.Product) { item.Product.product_contact = product_contact; item.Product.contact_phone = contact_phone; item.Product.fullRegion = fullRegion; item.Product.region = province; + item.Product.status = status; } return item; }); + // 过滤掉已下架或软删除的商品,只保留已发布状态的货源 + favorites = favorites.filter(item => { + const status = item.status || item.Product?.status || 'pending_review'; + // 只保留已发布状态的商品 + return status === 'published'; + }); + console.log('更新后的收藏列表:', favorites); this.setData({ favoritesList: favorites, diff --git a/pages/goods-detail/goods-detail.wxml b/pages/goods-detail/goods-detail.wxml index 16efdbe..aab45ee 100644 --- a/pages/goods-detail/goods-detail.wxml +++ b/pages/goods-detail/goods-detail.wxml @@ -54,7 +54,7 @@ bindtap="onFavoriteClick" style="display: flex; align-items: center;" > - {{isFavorite ? '❤️' : '🤍'}} + {{isFavorite ? '❤️' : '🤍'}}