diff --git a/pages/index/index.js b/pages/index/index.js index d7feeb9..1f8a728 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -1300,6 +1300,20 @@ Page({ console.log('applyFilters - 开始过滤,原始商品数量:', goods.length, '关键词:', this.data.searchKeyword); + // 筛选条件:销售价为空并且没有联系人信息的不显示在主页上 + filtered = filtered.filter(item => { + // 广告位不受影响 + if (item.isAd) { + return true; + } + // 销售价为空 + const hasEmptyPrice = !item.price || item.price === '' || parseFloat(item.price) === 0; + // 没有联系人信息 + const hasNoContact = !item.product_contact || item.product_contact === '' || !item.contact_phone || item.contact_phone === ''; + // 只保留:销售价不为空 或 有联系人信息 的商品 + return !(hasEmptyPrice && hasNoContact); + }); + if (this.data.selectedCategory !== '全部') { const category = this.data.selectedCategory filtered = filtered.filter(item => item.isAd || (item.category === category))