From bfdcaca15ad6587f00cbb6d6195bad2346996fc1 Mon Sep 17 00:00:00 2001 From: abson Date: Tue, 21 Dec 2021 10:55:53 +0800 Subject: [PATCH] 阶梯购商品搜索优化 --- pages/goods/goodsList/goodsList.js | 7 ++++++- pages/goods/goodsList/goodsList.wxml | 2 +- pages/goods/search/search.js | 53 +++++++++++++++++++++++++++++++++++++++-------------- 3 files changed, 46 insertions(+), 16 deletions(-) diff --git a/pages/goods/goodsList/goodsList.js b/pages/goods/goodsList/goodsList.js index 4bd71dd..7cc8bb1 100644 --- a/pages/goods/goodsList/goodsList.js +++ b/pages/goods/goodsList/goodsList.js @@ -69,7 +69,12 @@ Page({ if (0 != t.is_new && t.is_new != undefined) { url += "&is_new=" + t.is_new; } if (0 != t.is_hot && t.is_hot != undefined) { url += "&is_hot=" + t.is_hot; } - if (0 != t.ladder_id && t.ladder_id != undefined) { url += "&ladder_id=" + t.ladder_id; } + if (0 != t.ladder_id && t.ladder_id != undefined) { + url += "&ladder_id=" + t.ladder_id; + this.setData({ + ladder_id:t.ladder_id, + }) + } var user_id=getApp().globalData.user_id; if(!user_id) user_id=0; diff --git a/pages/goods/goodsList/goodsList.wxml b/pages/goods/goodsList/goodsList.wxml index d8011d4..d42e021 100644 --- a/pages/goods/goodsList/goodsList.wxml +++ b/pages/goods/goodsList/goodsList.wxml @@ -19,7 +19,7 @@ - 搜索店铺商品 + 搜索店铺商品 diff --git a/pages/goods/search/search.js b/pages/goods/search/search.js index ae5119f..63833ef 100644 --- a/pages/goods/search/search.js +++ b/pages/goods/search/search.js @@ -108,7 +108,13 @@ Page({ if (0 != t.brand_id && t.brand_id!=undefined){ url += "&brand_id=" + t.brand_id;} if (0 != t.nation_id && t.nation_id!=undefined) { url += "&nation_id=" + t.nation_id;} if (0 != t.max_price && t.max_price!=undefined) { url += "&min_pirce=" + t.min_pirce + "&max_price=" + t.max_price;} - + if (0 != t.ladder_id && t.ladder_id != undefined) { + url += "&ladder_id=" + t.ladder_id; + this.setData({ + baseUrl:url, + + }) + } if (url != this.data.baseUrl) return this.requestSearch(url); this.openSearchModal(); // 获取历史搜索记录 @@ -200,20 +206,39 @@ Page({ break } if(url!=null && url!=''){ - await getApp().request.promiseGet(url, {}).then(res => { + await getApp().request.promiseGet(url, {}).then(async res => { var prom =null; - if(res && res.data) prom=res.data.data; - if (prom != null && prom.is_end==0 && prom.end_time>now && (prom.start_time{ + let pd_list=pd.data.data.pageData; + if(res.data.code==0 && pd_list.length>0){ + flag =pd_list.some(pd=>{ + return pd.goods_id==item.goods_id + }) + } + if (prom != null && prom.is_end==0 && prom.end_time>now && flag && (prom.start_time