Commit 5172557605a46feb3e4ebfc9291134c2287889dd
1 parent
1dce4b0a
搜索框优化
Showing
1 changed file
with
11 additions
and
5 deletions
pages/goods/search/search.js
| ... | ... | @@ -30,7 +30,10 @@ Page({ |
| 30 | 30 | |
| 31 | 31 | onLoad: function(t) { |
| 32 | 32 | this.data.rq_data=t; |
| 33 | - this.data.rq_data.o = JSON.parse(t.o); | |
| 33 | + if(t.o) { | |
| 34 | + this.data.rq_data.o = JSON.parse(t.o); | |
| 35 | + }; | |
| 36 | + | |
| 34 | 37 | |
| 35 | 38 | //接受有没有导购的参数 |
| 36 | 39 | var first_leader=t.first_leader; |
| ... | ... | @@ -177,10 +180,13 @@ Page({ |
| 177 | 180 | }; |
| 178 | 181 | |
| 179 | 182 | let o = this.data.rq_data.o; |
| 180 | - if(o.cat_id) data.cat_id = o.cat_id; | |
| 181 | - if(o.pid && o.pid != 'three') data.parent_id = o.pid; | |
| 182 | - if(o.nation_id) data.nation_id = o.nation_id; | |
| 183 | - if(o.brand_id) data.brand_id = o.brand_id; | |
| 183 | + if(o) { | |
| 184 | + if(o.cat_id) data.cat_id = o.cat_id; | |
| 185 | + if(o.pid && o.pid != 'three') data.parent_id = o.pid; | |
| 186 | + if(o.nation_id) data.nation_id = o.nation_id; | |
| 187 | + if(o.brand_id) data.brand_id = o.brand_id; | |
| 188 | + }; | |
| 189 | + | |
| 184 | 190 | |
| 185 | 191 | getApp().request.promiseGet(t, {data:data}).then(async res=>{ |
| 186 | 192 | th.data.loading=0; | ... | ... |