Commit b31d30ef4286f4c6e7c50bdabae4a5ec6436968e
1 parent
8f83d623
积分的搜索功能完成
Showing
3 changed files
with
146 additions
and
9 deletions
packageA/pages/jfbuy/jfbuy.js
| ... | ... | @@ -35,6 +35,7 @@ Page({ |
| 35 | 35 | key_str:'', |
| 36 | 36 | pattern:0, //分成的方式 |
| 37 | 37 | pageSize:10, |
| 38 | + curr:10, | |
| 38 | 39 | currentPage:1, //当前的页码 |
| 39 | 40 | |
| 40 | 41 | // canvasHidden: 1, //-- 隐藏画布 -- |
| ... | ... | @@ -57,8 +58,12 @@ Page({ |
| 57 | 58 | |
| 58 | 59 | triggered: false, |
| 59 | 60 | isPullDownRefresh: false, |
| 60 | - | |
| 61 | - | |
| 61 | + | |
| 62 | + //-- 和搜索框相关的 -- | |
| 63 | + search_ing:0, | |
| 64 | + hiddenClear:1, | |
| 65 | + focus:false, | |
| 66 | + keyword:'' | |
| 62 | 67 | }, |
| 63 | 68 | |
| 64 | 69 | /** |
| ... | ... | @@ -353,9 +358,44 @@ Page({ |
| 353 | 358 | |
| 354 | 359 | this.request_list(data); |
| 355 | 360 | }, |
| 356 | - | |
| 357 | 361 | |
| 358 | - | |
| 362 | + sear_list(){ | |
| 363 | + var th=this; | |
| 364 | + var psize=th.data.curr; | |
| 365 | + | |
| 366 | + this.setData({ | |
| 367 | + is_no_data2:0, | |
| 368 | + is_no_more2:0, | |
| 369 | + list2:[], | |
| 370 | + is_load2: 0, | |
| 371 | + currentPage2:1, | |
| 372 | + pageSize:psize | |
| 373 | + }); | |
| 374 | + | |
| 375 | + var data = { | |
| 376 | + store_id:oo.stoid, | |
| 377 | + stype: this.data.requestData.stype, | |
| 378 | + stypeup:1, | |
| 379 | + page:1, | |
| 380 | + pageSize:psize | |
| 381 | + }; | |
| 382 | + | |
| 383 | + if(this.data.isUp) { | |
| 384 | + data.stypeup = 0; | |
| 385 | + } else { | |
| 386 | + data.stypeup = 1; | |
| 387 | + }; | |
| 388 | + | |
| 389 | + data.keyword=this.data.keyword | |
| 390 | + | |
| 391 | + // this.data.requestData = data; | |
| 392 | + this.setData({ | |
| 393 | + requestData: data | |
| 394 | + }) | |
| 395 | + | |
| 396 | + this.request_list(data); | |
| 397 | + }, | |
| 398 | + | |
| 359 | 399 | |
| 360 | 400 | request_list: function(data, callback){ |
| 361 | 401 | // console.log('触发上拉刷新'); |
| ... | ... | @@ -421,9 +461,6 @@ Page({ |
| 421 | 461 | this.request_list(data); |
| 422 | 462 | |
| 423 | 463 | }, |
| 424 | - | |
| 425 | - | |
| 426 | - | |
| 427 | 464 | |
| 428 | 465 | //---图片失败,默认图片--- |
| 429 | 466 | bind_bnerr2: function (e) { |
| ... | ... | @@ -491,6 +528,51 @@ Page({ |
| 491 | 528 | var viewHeight = this.data.clientWidth / ratio; |
| 492 | 529 | var con_heihgt=this.data.clientHeight-viewHeight; |
| 493 | 530 | this.setData({con_heihgt:con_heihgt,isshow:1}) |
| 494 | - | |
| 531 | + }, | |
| 532 | + | |
| 533 | + | |
| 534 | + /*-- 和搜索相关 --*/ | |
| 535 | + show_search(){ | |
| 536 | + this.setData({ | |
| 537 | + search_ing:1, | |
| 538 | + hiddenClear:1, | |
| 539 | + keyword:'', | |
| 540 | + focus:true | |
| 541 | + }) | |
| 542 | + }, | |
| 543 | + | |
| 544 | + getInput(e) { | |
| 545 | + let val = e.detail.value; | |
| 546 | + if (val) { | |
| 547 | + this.setData({ | |
| 548 | + keyword: e.detail.value, | |
| 549 | + hiddenClear: false, | |
| 550 | + }); | |
| 551 | + } else { | |
| 552 | + this.setData({ | |
| 553 | + hiddenClear: true, | |
| 554 | + }); | |
| 555 | + } | |
| 556 | + }, | |
| 557 | + | |
| 558 | + clearInput() { | |
| 559 | + this.setData({ | |
| 560 | + keyword: '', | |
| 561 | + hiddenClear: true, | |
| 562 | + }); | |
| 563 | + }, | |
| 564 | + | |
| 565 | + close_layer:function (){ | |
| 566 | + this.setData({ | |
| 567 | + search_ing:0, | |
| 568 | + hiddenClear:1, | |
| 569 | + }) | |
| 570 | + }, | |
| 571 | + | |
| 572 | + //开始搜索 | |
| 573 | + submitSearch(){ | |
| 574 | + this.sear_list(); | |
| 575 | + this.close_layer(); | |
| 495 | 576 | } |
| 577 | + | |
| 496 | 578 | }) |
| 497 | 579 | \ No newline at end of file | ... | ... |
packageA/pages/jfbuy/jfbuy.wxml
| ... | ... | @@ -23,6 +23,11 @@ |
| 23 | 23 | <block wx:for="{{tab}}"> |
| 24 | 24 | <view class="title-item {{currentIndex == (index+1) ? 'active' + (isUp?' active1':''):''}}" data-index="{{index+1}}" bindtap="clickTab">{{item}}</view> |
| 25 | 25 | </block> |
| 26 | + | |
| 27 | + <view catchtap="show_search" class="flex ai-center" style="height:80rpx; width:80rpx"> | |
| 28 | + <text class="iconfont icon-search_fd" style="font-size:30rpx; " ></text> | |
| 29 | + </view> | |
| 30 | + | |
| 26 | 31 | </view> |
| 27 | 32 | |
| 28 | 33 | <!-- <view> --> |
| ... | ... | @@ -69,3 +74,19 @@ |
| 69 | 74 | |
| 70 | 75 | </view> |
| 71 | 76 | </view> |
| 77 | + | |
| 78 | +<!-- 和搜索相关 --> | |
| 79 | +<view wx:if="{{search_ing}}"> | |
| 80 | + <view class="cover-layer"></view> | |
| 81 | + <view class="s_box"> | |
| 82 | + <view class="s_p_box"> | |
| 83 | + <view class="input-box"> | |
| 84 | + <text class="before iconfont icon-search_fd" catchtap="submitSearch"></text> | |
| 85 | + <input class="input-search" name="word" placeholder="请输入商品关键字" focus="focus" | |
| 86 | + bindconfirm="submitSearch" bindinput="getInput" bindfocus="inputFocus" value="{{keyword}}" /> | |
| 87 | + <text class="iconfont icon-guan" hidden="{{hiddenClear}}" catchtap="clearInput"></text> | |
| 88 | + </view> | |
| 89 | + <button catchtap="close_layer" style="margin-left:26rpx">取消</button> | |
| 90 | + </view> | |
| 91 | + </view> | |
| 92 | +</view> | |
| 72 | 93 | \ No newline at end of file | ... | ... |
packageA/pages/jfbuy/jfbuy.wxss
| ... | ... | @@ -63,6 +63,7 @@ page { |
| 63 | 63 | width: 100%; |
| 64 | 64 | top: 0; |
| 65 | 65 | z-index: 3; |
| 66 | + align-items: center; | |
| 66 | 67 | } |
| 67 | 68 | .title .iconfont { |
| 68 | 69 | color: #ccc; |
| ... | ... | @@ -429,4 +430,37 @@ radio .wx-radio-input.wx-radio-input-checked::before{ |
| 429 | 430 | margin-left:25rpx; |
| 430 | 431 | margin-right:25rpx; |
| 431 | 432 | margin-top: 30rpx; |
| 432 | -} | |
| 433 | 433 | \ No newline at end of file |
| 434 | +} | |
| 435 | + | |
| 436 | + | |
| 437 | +/*-- 搜索相关 --*/ | |
| 438 | +.s_box{ position: fixed;top:0;left: 0;background-color: #fff; width: 100%; z-index: 111111} | |
| 439 | +.s_p_box{ | |
| 440 | + padding:30rpx 40rpx;display: flex; align-items: center; | |
| 441 | +} | |
| 442 | +.input-box { | |
| 443 | + position: relative; | |
| 444 | + flex: 1; | |
| 445 | + padding-left: 30rpx; | |
| 446 | + padding-right: 70rpx; | |
| 447 | + background-color: #f0f0f0; | |
| 448 | + display: flex; | |
| 449 | + align-items: center; | |
| 450 | +} | |
| 451 | + | |
| 452 | +.input-search { | |
| 453 | + position: relative; | |
| 454 | + padding: 10rpx; | |
| 455 | + ont-size: 28rpx; | |
| 456 | + width: 100%; | |
| 457 | +} | |
| 458 | + | |
| 459 | +.icon-guan { | |
| 460 | + font-size: 20rpx; | |
| 461 | + padding: 10rpx; | |
| 462 | + position: absolute; | |
| 463 | + right: 20rpx; | |
| 464 | + top: 50%; | |
| 465 | + transform: translateY(-50%); | |
| 466 | +} | |
| 467 | + | ... | ... |