From 4386878535cebe6700fb3676ce67eb2e6e83324e Mon Sep 17 00:00:00 2001 From: Devil Date: Tue, 12 Jan 2021 17:23:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/service/SearchService.php | 8 +++-- sourcecode/weixin/default/app.js | 2 +- sourcecode/weixin/default/app.json | 4 +-- .../pages/goods-search/goods-search.js | 32 ++++++++++++++++--- .../pages/goods-search/goods-search.wxml | 1 + .../pages/goods-search/goods-search.wxss | 4 +++ 6 files changed, 41 insertions(+), 10 deletions(-) diff --git a/application/service/SearchService.php b/application/service/SearchService.php index 927b1dc71..ca3263c60 100755 --- a/application/service/SearchService.php +++ b/application/service/SearchService.php @@ -167,9 +167,11 @@ class SearchService { $params['category_ids'] = (substr($params['category_ids'], 0, 1) == '{') ? json_decode(htmlspecialchars_decode($params['category_ids']), true) : explode(',', $params['category_ids']); } - $ids = GoodsService::GoodsCategoryItemsIds($params['category_ids'], 1); - $ids[] = $params['category_id']; - $category_ids = array_merge($category_ids, $ids); + if(!empty($params['category_ids'])) + { + $ids = GoodsService::GoodsCategoryItemsIds($params['category_ids'], 1); + $category_ids = array_merge($category_ids, $ids); + } } if(!empty($category_ids)) { diff --git a/sourcecode/weixin/default/app.js b/sourcecode/weixin/default/app.js index f185dd768..78df5902f 100755 --- a/sourcecode/weixin/default/app.js +++ b/sourcecode/weixin/default/app.js @@ -74,7 +74,7 @@ App({ // 请求地址 request_url: "{{request_url}}", request_url: 'http://shopxo.com/', - // request_url: 'https://dev.shopxo.net/', + request_url: 'https://dev.shopxo.net/', // 基础信息 application_title: "{{application_title}}", diff --git a/sourcecode/weixin/default/app.json b/sourcecode/weixin/default/app.json index 5e592ee45..95f3e6ea2 100755 --- a/sourcecode/weixin/default/app.json +++ b/sourcecode/weixin/default/app.json @@ -1,5 +1,5 @@ { - "pages": [ + "pages": ["pages/goods-search/goods-search", "pages/index/index", "pages/goods-category/goods-category", "pages/cart/cart", @@ -8,7 +8,7 @@ "pages/web-view/web-view", "pages/login/login", "pages/paytips/paytips", - "pages/goods-search/goods-search", + "pages/goods-detail/goods-detail", "pages/goods-comment/goods-comment", "pages/user-address/user-address", diff --git a/sourcecode/weixin/default/pages/goods-search/goods-search.js b/sourcecode/weixin/default/pages/goods-search/goods-search.js index 485c12ae8..ec48dc908 100755 --- a/sourcecode/weixin/default/pages/goods-search/goods-search.js +++ b/sourcecode/weixin/default/pages/goods-search/goods-search.js @@ -230,10 +230,7 @@ Page({ index++; } } - if(app.get_length(temp) > 0) - { - post_data[data.map_fields_list[i]['form_key']] = JSON.stringify(temp); - } + post_data[data.map_fields_list[i]['form_key']] = (app.get_length(temp) > 0) ? JSON.stringify(temp) : ''; } } @@ -323,6 +320,33 @@ Page({ this.setData(data); } }, + + // 条件-清空 + map_remove_event(e) { + var data = this.data; + // 关键字 + data['post_data']['wd'] = ''; + + // 品牌、分类、价格、属性、规格 + for(var i in data.map_fields_list) + { + if((data[i] != null) != null && data[i].length > 0) + { + for(var k in data[i]) + { + data[i][k]['active'] = 0; + } + } + } + + // 关闭条件弹层 + this.popup_form_event_close(); + + // 分页恢复1页、重新获取数据 + data['data_page'] = 1; + this.setData(data); + this.get_data_list(1); + }, // 自定义分享 onShareAppMessage() { diff --git a/sourcecode/weixin/default/pages/goods-search/goods-search.wxml b/sourcecode/weixin/default/pages/goods-search/goods-search.wxml index a106c41e1..be1fb1ee3 100755 --- a/sourcecode/weixin/default/pages/goods-search/goods-search.wxml +++ b/sourcecode/weixin/default/pages/goods-search/goods-search.wxml @@ -44,6 +44,7 @@ 筛选出 {{data_total}} 条数据 + 清除 diff --git a/sourcecode/weixin/default/pages/goods-search/goods-search.wxss b/sourcecode/weixin/default/pages/goods-search/goods-search.wxss index 2ac9d2c25..cb06e52a4 100755 --- a/sourcecode/weixin/default/pages/goods-search/goods-search.wxss +++ b/sourcecode/weixin/default/pages/goods-search/goods-search.wxss @@ -133,6 +133,10 @@ bottom: 0; border-radius: 0; } +.map-remove-submit { + color: #e23f36; + cursor: pointer; +} /** * 品牌基础信息 -- GitLab