Commit 4cbac5993af970c3a004b4753ddfd9b274667600

Authored by vking
1 parent 98706661

search

@@ -101,6 +101,9 @@ Page({ @@ -101,6 +101,9 @@ Page({
101 if(data.fun=='caixiActive'){ 101 if(data.fun=='caixiActive'){
102 this.caixiActive(data.e); 102 this.caixiActive(data.e);
103 } 103 }
  104 + if(data.fun=='setSuggestion'){
  105 + this.setSuggestion(data.suggestion);
  106 + }
104 } 107 }
105 ) 108 )
106 PubSub.on( 109 PubSub.on(
@@ -881,7 +884,8 @@ Page({ @@ -881,7 +884,8 @@ Page({
881 multiIndex:this.data.multiIndex, 884 multiIndex:this.data.multiIndex,
882 tags:this.param.tags, 885 tags:this.param.tags,
883 centre_pos:this.param.centre_pos, 886 centre_pos:this.param.centre_pos,
884 - hasSuggestion:this.data.hasSuggestion?1:'' 887 + hasSuggestion:this.data.hasSuggestion?1:'',
  888 + keyword:this.data.suggestion?this.data.suggestion.title:'',
885 },'./indexList'), 889 },'./indexList'),
886 success: res=> { 890 success: res=> {
887 // 通过eventChannel向被打开页面传送数据 891 // 通过eventChannel向被打开页面传送数据
@@ -22,6 +22,7 @@ Page({ @@ -22,6 +22,7 @@ Page({
22 hasDisabled:true, 22 hasDisabled:true,
23 hasSuggestion:false, 23 hasSuggestion:false,
24 placeholder:'您好,几位,什么时候', 24 placeholder:'您好,几位,什么时候',
  25 + search_placeholder:"搜索餐厅/位置,快速订包间",
25 hasLoading:true, 26 hasLoading:true,
26 }, 27 },
27 28
@@ -69,6 +70,7 @@ Page({ @@ -69,6 +70,7 @@ Page({
69 }) 70 })
70 }catch(e){} 71 }catch(e){}
71 setTimeout(()=>{this.getList()},300) 72 setTimeout(()=>{this.getList()},300)
  73 +
72 }, 74 },
73 75
74 /** 76 /**
@@ -82,7 +84,15 @@ Page({ @@ -82,7 +84,15 @@ Page({
82 * 生命周期函数--监听页面显示 84 * 生命周期函数--监听页面显示
83 */ 85 */
84 onShow: function () { 86 onShow: function () {
85 - 87 + PubSub.on(
  88 + 'searchParamList',
  89 + data=>{
  90 + console.log('searchParamList.msg',data)
  91 + if(data.fun=='setSuggestion'){
  92 + this.setSuggestion(data.suggestion);
  93 + }
  94 + }
  95 + )
86 }, 96 },
87 97
88 /** 98 /**
@@ -96,7 +106,7 @@ Page({ @@ -96,7 +106,7 @@ Page({
96 * 生命周期函数--监听页面卸载 106 * 生命周期函数--监听页面卸载
97 */ 107 */
98 onUnload: function () { 108 onUnload: function () {
99 - 109 + PubSub.off('searchParamList')
100 }, 110 },
101 111
102 /** 112 /**
@@ -117,6 +127,9 @@ Page({ @@ -117,6 +127,9 @@ Page({
117 let mapParam=this.options 127 let mapParam=this.options
118 this.offset=1 //page 128 this.offset=1 //page
119 this.size=20 //page size 129 this.size=20 //page size
  130 + this.setData({
  131 + keyword:mapParam.keyword||'',
  132 + })
120 if(mapParam.keyword){ 133 if(mapParam.keyword){
121 this.param={ 134 this.param={
122 lat_extend:mapParam.lat, 135 lat_extend:mapParam.lat,
@@ -134,9 +147,18 @@ Page({ @@ -134,9 +147,18 @@ Page({
134 } 147 }
135 }else{ 148 }else{
136 //计算视窗中心 149 //计算视窗中心
137 - let map=JSON.parse(mapParam.map);  
138 - let lat=map.northeast.latitude-(map.northeast.latitude-map.southwest.latitude)/2;  
139 - let lng=map.northeast.longitude-(map.northeast.longitude-map.southwest.longitude)/2; 150 + let lat,lng
  151 + if(this.suggestion){
  152 + lat=this.suggestion.latitude
  153 + lng=this.suggestion.longitude
  154 + this.setData({
  155 + keyword:this.suggestion.title,
  156 + })
  157 + }else{
  158 + let map=JSON.parse(mapParam.map);
  159 + lat=map.northeast.latitude-(map.northeast.latitude-map.southwest.latitude)/2;
  160 + lng=map.northeast.longitude-(map.northeast.longitude-map.southwest.longitude)/2;
  161 + }
140 this.param={ 162 this.param={
141 lat:lat, 163 lat:lat,
142 lng:lng, 164 lng:lng,
@@ -146,8 +168,12 @@ Page({ @@ -146,8 +168,12 @@ Page({
146 size:this.size, 168 size:this.size,
147 distance:50, 169 distance:50,
148 }; 170 };
149 - if(mapParam.centre_pos){  
150 - this.param.centre_pos=mapParam.centre_pos 171 + if(this.suggestion){
  172 + this.param.centre_pos=`${lat},${lng}`
  173 + }else{
  174 + if(mapParam.centre_pos){
  175 + this.param.centre_pos=mapParam.centre_pos
  176 + }
151 } 177 }
152 } 178 }
153 179
@@ -350,4 +376,25 @@ Page({ @@ -350,4 +376,25 @@ Page({
350 this.selectComponent('#as').show(e.detail.seller); 376 this.selectComponent('#as').show(e.detail.seller);
351 } 377 }
352 }, 378 },
  379 + gotoSearch(e){
  380 + let pages = getCurrentPages();
  381 + if(pages.length>1){
  382 + let p = pages[pages.length - 2];
  383 + if(p.route=='pages/reserve/search'){
  384 + return wx.navigateBack();
  385 + }
  386 + }
  387 + wx.navigateTo({
  388 + url:'/pages/reserve/search',
  389 + })
  390 + },
  391 + suggestion:null,
  392 + setSuggestion(suggestion){
  393 + this.suggestion=suggestion
  394 + this.setData({
  395 + suggestion:suggestion,
  396 + hasSuggestion:true,
  397 + })
  398 + this.getList()
  399 + },
353 }) 400 })
@@ -11,6 +11,14 @@ @@ -11,6 +11,14 @@
11 </view> 11 </view>
12 </view> 12 </view>
13 --> 13 -->
  14 + <view class="searchAddrView searchKeyword" bindtap="gotoSearch">
  15 + <view class="searchAddr flex-ll">
  16 + <image class="icon" src="http://nosqn.colorcun.com/custom/lite-online/image/search26.png"></image>
  17 + <input style="width: 100%;" placeholder="{{search_placeholder}}"
  18 + type="text" disabled placeholder-class="placeholder"
  19 + value="{{keyword}}"/>
  20 + </view>
  21 + </view>
14 <view class="transverse-search flex-ll {{hasDisabled?'disabled':''}}"> 22 <view class="transverse-search flex-ll {{hasDisabled?'disabled':''}}">
15 <view 23 <view
16 bindtap="caixiShow" 24 bindtap="caixiShow"
@@ -84,7 +92,7 @@ @@ -84,7 +92,7 @@
84 previous-margin="{{10}}px" next-margin="{{10}}px" style="height: 330rpx;" 92 previous-margin="{{10}}px" next-margin="{{10}}px" style="height: 330rpx;"
85 current="{{current}}" bindchange="bindtransition" bindanimationfinish="bindtransition"> 93 current="{{current}}" bindchange="bindtransition" bindanimationfinish="bindtransition">
86 <block wx:for="{{rsl}}" wx:key="rsl.key"> 94 <block wx:for="{{rsl}}" wx:key="rsl.key">
87 - <swiper-item bindtap="gotoSellerDetail" id="{{item.id}}"> 95 + <swiper-item bindtap="gotoDetail" data-sid="{{item.id}}">
88 <view class="seller" id="seller-{{item.id}}"> 96 <view class="seller" id="seller-{{item.id}}">
89 <sb-tr seller="{{item}}" 97 <sb-tr seller="{{item}}"
90 hasInSwiper bindevent="sbtrEvent" 98 hasInSwiper bindevent="sbtrEvent"
@@ -58,7 +58,7 @@ @@ -58,7 +58,7 @@
58 } 58 }
59 .pages{ 59 .pages{
60 width: 100%; 60 width: 100%;
61 - margin: 81rpx auto 0; 61 + margin: 160rpx auto 0;
62 color:#fff; 62 color:#fff;
63 font-size: 28rpx; 63 font-size: 28rpx;
64 } 64 }
@@ -74,6 +74,9 @@ @@ -74,6 +74,9 @@
74 .follow .seller:last-child{ 74 .follow .seller:last-child{
75 border-bottom: 20rpx solid #ffffff; 75 border-bottom: 20rpx solid #ffffff;
76 } 76 }
  77 +.follow .seller:first-child{
  78 + border-top:2rpx solid #f5f5f5;
  79 +}
77 .nomore{ 80 .nomore{
78 color: #999; 81 color: #999;
79 font-size: 28rpx; 82 font-size: 28rpx;
@@ -167,4 +170,31 @@ @@ -167,4 +170,31 @@
167 color:rgba(53,53,53,1); 170 color:rgba(53,53,53,1);
168 line-height:40rpx; 171 line-height:40rpx;
169 margin-top: 30rpx; 172 margin-top: 30rpx;
  173 +}
  174 +
  175 +.searchKeyword{
  176 + height: 64rpx;
  177 + line-height: 64rpx;
  178 + margin-bottom: 15rpx;
  179 +}
  180 +.searchKeyword .searchAddr{
  181 + height:64rpx;
  182 + background:rgba(254,254,254,1);
  183 + border-radius:32rpx;
  184 + border:2rpx solid rgba(204,204,204,1);
  185 + box-sizing: border-box;
  186 + line-height:64rpx;
  187 +}
  188 +.placeholder{
  189 + font-size:28rpx;
  190 + font-family:PingFangSC-Regular,PingFang SC;
  191 + font-weight:400;
  192 + color:rgba(153,153,153,1);
  193 +
  194 +}
  195 +.searchKeyword .searchAddr .icon{
  196 + min-width: 22rpx;
  197 + width:22rpx;
  198 + height: 22rpx;
  199 + margin: 0 10rpx 0 40rpx;
170 } 200 }
@@ -8,6 +8,7 @@ var qqmapsdk = new QQMapWX({ @@ -8,6 +8,7 @@ var qqmapsdk = new QQMapWX({
8 }); 8 });
9 import util from '../../utils/util'; 9 import util from '../../utils/util';
10 import App from '../../utils/api'; 10 import App from '../../utils/api';
  11 +import PubSub from '../../utils/PubSub'
11 Page({ 12 Page({
12 13
13 /** 14 /**
@@ -87,13 +88,15 @@ Page({ @@ -87,13 +88,15 @@ Page({
87 for (var i = 0; i < this.data.suggestion.length; i++) { 88 for (var i = 0; i < this.data.suggestion.length; i++) {
88 if (i == id) { 89 if (i == id) {
89 console.log('backfill,this.data.suggestion[i]:',this.data.suggestion[i]) 90 console.log('backfill,this.data.suggestion[i]:',this.data.suggestion[i])
90 - let pages = getCurrentPages();  
91 - let p = pages[pages.length - 2];  
92 - p.setSuggestion(this.data.suggestion[i]) 91 + // let pages = getCurrentPages();
  92 + // let p = pages[pages.length - 2];
  93 + // p.setSuggestion(this.data.suggestion[i])
93 //util.cache('suggestion',this.data.suggestion[i]); 94 //util.cache('suggestion',this.data.suggestion[i]);
94 this.setData({ 95 this.setData({
95 backfill: this.data.suggestion[i].title 96 backfill: this.data.suggestion[i].title
96 }); 97 });
  98 + PubSub.emit('searchParam',{fun:'setSuggestion',suggestion:this.data.suggestion[i]})
  99 + PubSub.emit('searchParamList',{fun:'setSuggestion',suggestion:this.data.suggestion[i]})
97 wx.navigateBack(); 100 wx.navigateBack();
98 } 101 }
99 } 102 }
@@ -224,9 +227,11 @@ Page({ @@ -224,9 +227,11 @@ Page({
224 },'./detail') 227 },'./detail')
225 }) 228 })
226 }else{ 229 }else{
227 - let pages = getCurrentPages();  
228 - let p = pages[pages.length - 2];  
229 - p.setSuggestion(item) 230 + //let pages = getCurrentPages();
  231 + //let p = pages[pages.length - 2];
  232 + //p.setSuggestion(item)
  233 + PubSub.emit('searchParam',{fun:'setSuggestion',suggestion:item})
  234 + PubSub.emit('searchParamList',{fun:'setSuggestion',suggestion:item})
230 this.setData({ 235 this.setData({
231 backfill: item.title 236 backfill: item.title
232 }); 237 });