Commit 8e0a9f93e9360dd84638f0617e025638eff9a63f

Authored by vking
1 parent 7dce30c3

filter 人均

@@ -69,10 +69,22 @@ Component({ @@ -69,10 +69,22 @@ Component({
69 hasDisplay:false, 69 hasDisplay:false,
70 }) 70 })
71 }, 71 },
72 - show(){  
73 - this.setData({ 72 + show(filterParams=null){
  73 + let obj={
74 hasDisplay:true, 74 hasDisplay:true,
75 - }) 75 + }
  76 + if(filterParams){
  77 + if(filterParams.active){
  78 + obj.active=filterParams.active
  79 + }
  80 + this.min=filterParams.min
  81 + this.max=filterParams.max
  82 + obj.consumeStr=filterParams.consumeStr||''
  83 + }
  84 + this.setData(obj)
  85 + setTimeout(()=>{
  86 + this.selectComponent('#consume').changeVal(this.min,this.max);
  87 + },0)
76 }, 88 },
77 submit(){ 89 submit(){
78 this.triggerEvent('event',{ 90 this.triggerEvent('event',{
@@ -107,6 +107,9 @@ Page({ @@ -107,6 +107,9 @@ Page({
107 if(data.fun=='moveToLocation'){ 107 if(data.fun=='moveToLocation'){
108 this.moveToLocation(); 108 this.moveToLocation();
109 } 109 }
  110 + if(data.fun=='filterEvent'){
  111 + this.filterEvent(data.e)
  112 + }
110 } 113 }
111 ) 114 )
112 PubSub.on( 115 PubSub.on(
@@ -511,7 +514,7 @@ Page({ @@ -511,7 +514,7 @@ Page({
511 if(this.filterParams.min==this.filterParams.max && this.filterParams.min==300){ 514 if(this.filterParams.min==this.filterParams.max && this.filterParams.min==300){
512 filterParams=this.filterParams.min+','+parseInt(new Date()/1000) 515 filterParams=this.filterParams.min+','+parseInt(new Date()/1000)
513 } 516 }
514 - param.filterParams=filterParams 517 + param.average=filterParams
515 } 518 }
516 //this.selectComponent('#list').getList(param); 519 //this.selectComponent('#list').getList(param);
517 this.param=param; 520 this.param=param;
@@ -897,6 +900,7 @@ Page({ @@ -897,6 +900,7 @@ Page({
897 centre_pos:this.param.centre_pos, 900 centre_pos:this.param.centre_pos,
898 hasSuggestion:this.data.hasSuggestion?1:'', 901 hasSuggestion:this.data.hasSuggestion?1:'',
899 keyword:this.data.hasSuggestion?this.data.suggestion.title:'', 902 keyword:this.data.hasSuggestion?this.data.suggestion.title:'',
  903 + filterParams:this.filterParams?JSON.stringify(this.filterParams):null,
900 },'./indexList'), 904 },'./indexList'),
901 success: res=> { 905 success: res=> {
902 // 通过eventChannel向被打开页面传送数据 906 // 通过eventChannel向被打开页面传送数据
@@ -990,15 +994,21 @@ Page({ @@ -990,15 +994,21 @@ Page({
990 } 994 }
991 }, 995 },
992 filterShow(){ 996 filterShow(){
993 - this.selectComponent('#filter').show(); 997 + this.selectComponent('#filter').show(this.filterParams);
994 }, 998 },
995 filterParams:null, 999 filterParams:null,
996 filterEvent(e){ 1000 filterEvent(e){
997 console.log('filterEvent',e) 1001 console.log('filterEvent',e)
998 if(e.detail.type=='clean'){ 1002 if(e.detail.type=='clean'){
999 this.filterParams=null 1003 this.filterParams=null
  1004 + this.setData({
  1005 + filterParams:null,
  1006 + })
1000 }else{ 1007 }else{
1001 this.filterParams=e.detail.data 1008 this.filterParams=e.detail.data
  1009 + this.setData({
  1010 + filterParams:this.filterParams,
  1011 + })
1002 } 1012 }
1003 setTimeout(()=>{this.getMarkers();},0) 1013 setTimeout(()=>{this.getMarkers();},0)
1004 }, 1014 },
@@ -55,12 +55,11 @@ @@ -55,12 +55,11 @@
55 </block> 55 </block>
56 <view 56 <view
57 bindtap="filterShow" 57 bindtap="filterShow"
58 - class="tags {{multiIndex[0]>0?'active':''}}" 58 + class="tags {{filterParams.consumeStr?'active':''}}"
59 > 59 >
60 <view class="picker flex-lr"> 60 <view class="picker flex-lr">
61 <view class="input"> 61 <view class="input">
62 - <block wx:if="{{multiIndex[0]==0}}">筛选</block>  
63 - <block wx:else="">{{multiArray[0][multiIndex[0]]}}</block> 62 + {{filterParams.consumeStr?filterParams.consumeStr:'筛选'}}
64 </view> 63 </view>
65 <view class="more"></view> 64 <view class="more"></view>
66 </view> 65 </view>
@@ -31,8 +31,23 @@ Page({ @@ -31,8 +31,23 @@ Page({
31 */ 31 */
32 eventChannel:null, 32 eventChannel:null,
33 onLoad: async function (options) { 33 onLoad: async function (options) {
34 - //lat=34.21719&lng=108.89155&map={"errMsg":"getMapRegion:ok","southwest":{"longitude":108.87545674591064,"latitude":34.204520114013846},"northeast":{"longitude":108.90764325408935,"latitude":34.229857981005225},"scale":15}&multiIndex=1&tags=1,2  
35 - //lat=39.65273&lng=118.15813&map={"errMsg":"getMapRegion:ok","southwest":{"longitude":118.11012337295534,"latitude":39.61934377763755},"northeast":{"longitude":118.1262166270447,"latitude":39.63137569933196},"scale":15}&multiIndex=0&centre_pos=39.625360,118.118170&hasSuggestion=1&keywordTip=唐山站 34 + /**
  35 + * lat=39.65273
  36 + * &lng=118.15813
  37 + * &map={"errMsg":"getMapRegion:ok","southwest":{"longitude":118.15008337295534,"latitude":39.64671615783738},"northeast":{"longitude":118.16617662704469,"latitude":39.65874331903751},"scale":15}
  38 + * &multiIndex=0
  39 + * &centre_pos=39.65273,118.15813
  40 + * &hasSuggestion=
  41 + * &keyword=
  42 + * &filterParams={"consumeStr":"¥200-300","min":"200","max":"300","active":"200,300"}
  43 + */
  44 + this.filterParams=null
  45 + if(options.filterParams){
  46 + this.filterParams=JSON.parse(options.filterParams)
  47 + this.setData({
  48 + filterParams:this.filterParams,
  49 + })
  50 + }
36 this.options=options; 51 this.options=options;
37 if(options.hasSuggestion){ 52 if(options.hasSuggestion){
38 let pos=options.centre_pos.split(',') 53 let pos=options.centre_pos.split(',')
@@ -244,6 +259,13 @@ Page({ @@ -244,6 +259,13 @@ Page({
244 this.setData({ 259 this.setData({
245 placeholder:placeholder, 260 placeholder:placeholder,
246 }) 261 })
  262 + if(this.filterParams){//人均过滤
  263 + let filterParams=this.filterParams.min+','+this.filterParams.max
  264 + if(this.filterParams.min==this.filterParams.max && this.filterParams.min==300){
  265 + filterParams=this.filterParams.min+','+parseInt(new Date()/1000)
  266 + }
  267 + this.param.average=filterParams
  268 + }
247 App.Customer.SellerLists(this.param).then(res=>{ 269 App.Customer.SellerLists(this.param).then(res=>{
248 this.setData({ 270 this.setData({
249 rsl:[], 271 rsl:[],
@@ -453,4 +475,32 @@ Page({ @@ -453,4 +475,32 @@ Page({
453 //PubSub.emit('searchParam', {fun:'moveToLocation'}) 475 //PubSub.emit('searchParam', {fun:'moveToLocation'})
454 setTimeout(()=>{this.getList()},0) 476 setTimeout(()=>{this.getList()},0)
455 }, 477 },
  478 + filterShow(){
  479 + this.selectComponent('#filter').show(this.filterParams);
  480 + },
  481 + filterParams:null,
  482 + filterEvent(e){
  483 + console.log('filterEvent',e)
  484 + if(e.detail.type=='clean'){
  485 + this.filterParams=null
  486 + this.setData({
  487 + filterParams:null,
  488 + })
  489 + }else{
  490 + this.filterParams=e.detail.data
  491 + this.setData({
  492 + filterParams:this.filterParams,
  493 + })
  494 + }
  495 + setTimeout(()=>{this.getList();},0)
  496 + if(this.hasOneListPage()){
  497 + PubSub.emit(
  498 + 'searchParam',
  499 + {
  500 + fun:'filterEvent',
  501 + e:e,
  502 + }
  503 + )
  504 + }
  505 + },
456 }) 506 })
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 "caixi":"/components/reserve/caixi", 10 "caixi":"/components/reserve/caixi",
11 "search-how":"/components/reserve/search/how/index", 11 "search-how":"/components/reserve/search/how/index",
12 "as-phone":"/components/actionSheet/phone", 12 "as-phone":"/components/actionSheet/phone",
13 - "hr":"/components/hr" 13 + "hr":"/components/hr",
  14 + "filter":"/components/reserve/search/filter"
14 } 15 }
15 } 16 }
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 <view class="clean" catchtap="moveToLocation" wx:if="{{keyword && hasSuggestion}}"></view> 20 <view class="clean" catchtap="moveToLocation" wx:if="{{keyword && hasSuggestion}}"></view>
21 </view> 21 </view>
22 </view> 22 </view>
23 - <view class="transverse-search flex-ll {{hasDisabled?'disabled':''}}"> 23 + <view class="transverse-search {{hasDisabled?'disabled':''}}">
24 <view 24 <view
25 bindtap="caixiShow" 25 bindtap="caixiShow"
26 class="tags {{multiIndex[0]>0?'active':''}}" 26 class="tags {{multiIndex[0]>0?'active':''}}"
@@ -38,6 +38,17 @@ @@ -38,6 +38,17 @@
38 bindtap="tagsChange" 38 bindtap="tagsChange"
39 data-id="{{item.id}}">{{item.name}}</view> 39 data-id="{{item.id}}">{{item.name}}</view>
40 </block> 40 </block>
  41 + <view
  42 + bindtap="filterShow"
  43 + class="tags {{filterParams.consumeStr?'active':''}}"
  44 + >
  45 + <view class="picker flex-lr">
  46 + <view class="input">
  47 + {{filterParams.consumeStr?filterParams.consumeStr:'筛选'}}
  48 + </view>
  49 + <view class="more"></view>
  50 + </view>
  51 + </view>
41 </view> 52 </view>
42 </view> 53 </view>
43 <view class="pages" wx:if="{{hasLoading}}"> 54 <view class="pages" wx:if="{{hasLoading}}">
@@ -109,4 +120,5 @@ @@ -109,4 +120,5 @@
109 </view> 120 </view>
110 </block> 121 </block>
111 <getpos bindpos="onpos" id="getpos" hasAllowLoading="{{false}}"></getpos> 122 <getpos bindpos="onpos" id="getpos" hasAllowLoading="{{false}}"></getpos>
112 -<as-phone id="as"></as-phone>  
  123 +<as-phone id="as"></as-phone>
  124 +<filter id="filter" bindevent="filterEvent"></filter>
@@ -10,10 +10,16 @@ @@ -10,10 +10,16 @@
10 .transverse-search{ 10 .transverse-search{
11 background-color: #fefefe; 11 background-color: #fefefe;
12 height: 60rpx; 12 height: 60rpx;
13 - width: 100%;  
14 margin: 0 auto; 13 margin: 0 auto;
15 font-size: 24rpx; 14 font-size: 24rpx;
16 padding-left: 20rpx; 15 padding-left: 20rpx;
  16 +
  17 + width: calc(100% - 20rpx);
  18 + overflow-x: auto;
  19 + white-space:nowrap;
  20 +}
  21 +.transverse-search view{
  22 + display: inline-block;
17 } 23 }
18 .transverse-search .tags{ 24 .transverse-search .tags{
19 height: 50rpx; 25 height: 50rpx;