Browse Source

添加筛选条件:销售价为空且没有联系人信息的货源不显示在主页上

pull/11/head
Default User 2 months ago
parent
commit
7f735577be
  1. 14
      pages/index/index.js

14
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))

Loading…
Cancel
Save