Commit 763c4721af7a93e7cee92d2b113e43f56c630ed3
1 parent
fae48d13
上下架商品默认降序排列,搜索框无法搜索问题修改
Showing
2 changed files
with
19 additions
and
10 deletions
packageA/pages/distribution/goods/goods.js
... | ... | @@ -102,6 +102,7 @@ Page({ |
102 | 102 | // url = '/api/weshop/goods/page?dis_type=1'; |
103 | 103 | // this.getData(true, '/api/weshop/goods/page?dis_type=1', this.data.currentQuery); |
104 | 104 | }; |
105 | + currentQuery.orderType = 'desc'; | |
105 | 106 | currentQuery.dis_type = 1; |
106 | 107 | this.getData(true, url, currentQuery); |
107 | 108 | |
... | ... | @@ -325,7 +326,7 @@ Page({ |
325 | 326 | if(data.orderField) delete data.orderField; |
326 | 327 | if(data.orderType) delete data.orderType; |
327 | 328 | if(this.data.inputVal) { |
328 | - data.key = this.data.inputVal; | |
329 | + data.key_str = this.data.inputVal; | |
329 | 330 | }; |
330 | 331 | if(this.data.isHiddenDropdown) { |
331 | 332 | if(data.nation_id) delete data.nation_id; |
... | ... | @@ -347,8 +348,8 @@ Page({ |
347 | 348 | url = '/api/weshop/goods/page?searchtype=1'; |
348 | 349 | }; |
349 | 350 | this.getData(true, url, data) |
350 | - .then(function() { | |
351 | - callback(); | |
351 | + .then(function(callback) { | |
352 | + if(callback) callback(); | |
352 | 353 | }); |
353 | 354 | }, |
354 | 355 | |
... | ... | @@ -357,6 +358,7 @@ Page({ |
357 | 358 | */ |
358 | 359 | clickSort() { |
359 | 360 | let data = this.data.currentQuery; |
361 | + // if(data.orderType == 'desc') delete data.orderType; | |
360 | 362 | if(!this.data.isSort) { |
361 | 363 | this.setData({ |
362 | 364 | isSort: true, |
... | ... | @@ -401,8 +403,11 @@ Page({ |
401 | 403 | isDescending = false; |
402 | 404 | }; |
403 | 405 | }; |
406 | + | |
404 | 407 | if(data.page) delete data.page; |
405 | 408 | if(data.key) delete data.key; |
409 | + | |
410 | + // data.orderType = 'desc'; | |
406 | 411 | // if(data.nation_id) delete data.nation_id; |
407 | 412 | // if(data.brand_id) delete data.brand_id; |
408 | 413 | // if(data.startprice) delete data.startprice; |
... | ... | @@ -421,7 +426,8 @@ Page({ |
421 | 426 | switch(currentIndex) { |
422 | 427 | case 0: { |
423 | 428 | if(data.orderField) delete data.orderField; |
424 | - if(data.orderType) delete data.orderType; | |
429 | + // if(data.orderType) delete data.orderType; | |
430 | + data.orderType = 'desc'; | |
425 | 431 | if(options.index == 1) {//下架:已选 |
426 | 432 | data.searchtype = 1; |
427 | 433 | data.dis_type = 1; |
... | ... | @@ -430,29 +436,32 @@ Page({ |
430 | 436 | }; |
431 | 437 | case 1: { |
432 | 438 | if(options.index == 0) {//上架:销量排序 |
433 | - if(data.orderType) delete data.orderType; | |
439 | + // if(data.orderType) delete data.orderType; | |
434 | 440 | data.orderField = 'sales_sum'; |
435 | 441 | } else {//下架:必营 |
436 | 442 | if(data.searchtype) delete data.searchtype; |
437 | 443 | if(data.orderField) delete data.orderField; |
438 | - if(data.orderType) delete data.orderType; | |
444 | + // if(data.orderType) delete data.orderType; | |
439 | 445 | data.dis_type = 0; |
440 | 446 | }; |
447 | + data.orderType = 'desc'; | |
441 | 448 | break; |
442 | 449 | }; |
443 | 450 | case 2: { |
444 | 451 | if(options.index == 0) {//上架:评论排序 |
445 | - if(data.orderType) delete data.orderType; | |
452 | + // if(data.orderType) delete data.orderType; | |
446 | 453 | data.orderField = 'comment_count'; |
447 | 454 | } else {//下架:销量排序 |
448 | - if(data.orderType) delete data.orderType; | |
455 | + // if(data.orderType) delete data.orderType; | |
449 | 456 | data.orderField = 'sales_sum'; |
450 | 457 | data.dis_type = 1; |
451 | 458 | data.searchtype = 1; |
452 | 459 | }; |
460 | + data.orderType = 'desc'; | |
453 | 461 | break; |
454 | 462 | }; |
455 | 463 | case 3: { |
464 | + // if(data.orderType) delete data.orderType; | |
456 | 465 | data.orderField = 'shop_price'; |
457 | 466 | data.dis_type = 1; |
458 | 467 | break; | ... | ... |
packageA/pages/distribution/goods/goods.wxml
... | ... | @@ -13,13 +13,13 @@ |
13 | 13 | |
14 | 14 | <view class="dropdown {{isHiddenDropdown ? '':'show'}}" hidden="{{isHiddenDropdown}}"> |
15 | 15 | <view class="dropdown-wrapper"> |
16 | - <view class="pd20 bsbb"> | |
16 | + <view class="pd20 bsbb" wx:if="{{nationList.length != 0}}"> | |
17 | 17 | <view class="pdb20">国家</view> |
18 | 18 | <view class="flex wrap t-c" bindtap="select"> |
19 | 19 | <view class="w25 pdt20" wx:for="{{nationList}}"><text class="label {{nationIndex == index ? 'selected':''}}" data-id="{{item.nation_id}}" data-name="nation" data-index="{{index}}">{{item.name}}</text></view> |
20 | 20 | </view> |
21 | 21 | </view> |
22 | - <view class="pd20 bsbb" > | |
22 | + <view class="pd20 bsbb" wx:if="{{brandList.length != 0}}"> | |
23 | 23 | <view class="pdb20">品牌</view> |
24 | 24 | <view class="flex wrap t-c" bindtap="select"> |
25 | 25 | <view class="w25 pdt20" wx:for="{{brandList}}"><text class="label {{brandIndex == index ? 'selected':''}}" data-id="{{item.brand_id}}" data-name="brand" data-index="{{index}}">{{item.name}}</text></view> | ... | ... |