Commit 4cbac5993af970c3a004b4753ddfd9b274667600

Authored by vking
1 parent 98706661

search

... ... @@ -101,6 +101,9 @@ Page({
if(data.fun=='caixiActive'){
this.caixiActive(data.e);
}
if(data.fun=='setSuggestion'){
this.setSuggestion(data.suggestion);
}
}
)
PubSub.on(
... ... @@ -881,7 +884,8 @@ Page({
multiIndex:this.data.multiIndex,
tags:this.param.tags,
centre_pos:this.param.centre_pos,
hasSuggestion:this.data.hasSuggestion?1:''
hasSuggestion:this.data.hasSuggestion?1:'',
keyword:this.data.suggestion?this.data.suggestion.title:'',
},'./indexList'),
success: res=> {
// 通过eventChannel向被打开页面传送数据
... ...
... ... @@ -22,6 +22,7 @@ Page({
hasDisabled:true,
hasSuggestion:false,
placeholder:'您好,几位,什么时候',
search_placeholder:"搜索餐厅/位置,快速订包间",
hasLoading:true,
},
... ... @@ -69,6 +70,7 @@ Page({
})
}catch(e){}
setTimeout(()=>{this.getList()},300)
},
/**
... ... @@ -82,7 +84,15 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
PubSub.on(
'searchParamList',
data=>{
console.log('searchParamList.msg',data)
if(data.fun=='setSuggestion'){
this.setSuggestion(data.suggestion);
}
}
)
},
/**
... ... @@ -96,7 +106,7 @@ Page({
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
PubSub.off('searchParamList')
},
/**
... ... @@ -117,6 +127,9 @@ Page({
let mapParam=this.options
this.offset=1 //page
this.size=20 //page size
this.setData({
keyword:mapParam.keyword||'',
})
if(mapParam.keyword){
this.param={
lat_extend:mapParam.lat,
... ... @@ -134,9 +147,18 @@ Page({
}
}else{
//计算视窗中心
let map=JSON.parse(mapParam.map);
let lat=map.northeast.latitude-(map.northeast.latitude-map.southwest.latitude)/2;
let lng=map.northeast.longitude-(map.northeast.longitude-map.southwest.longitude)/2;
let lat,lng
if(this.suggestion){
lat=this.suggestion.latitude
lng=this.suggestion.longitude
this.setData({
keyword:this.suggestion.title,
})
}else{
let map=JSON.parse(mapParam.map);
lat=map.northeast.latitude-(map.northeast.latitude-map.southwest.latitude)/2;
lng=map.northeast.longitude-(map.northeast.longitude-map.southwest.longitude)/2;
}
this.param={
lat:lat,
lng:lng,
... ... @@ -146,8 +168,12 @@ Page({
size:this.size,
distance:50,
};
if(mapParam.centre_pos){
this.param.centre_pos=mapParam.centre_pos
if(this.suggestion){
this.param.centre_pos=`${lat},${lng}`
}else{
if(mapParam.centre_pos){
this.param.centre_pos=mapParam.centre_pos
}
}
}
... ... @@ -350,4 +376,25 @@ Page({
this.selectComponent('#as').show(e.detail.seller);
}
},
gotoSearch(e){
let pages = getCurrentPages();
if(pages.length>1){
let p = pages[pages.length - 2];
if(p.route=='pages/reserve/search'){
return wx.navigateBack();
}
}
wx.navigateTo({
url:'/pages/reserve/search',
})
},
suggestion:null,
setSuggestion(suggestion){
this.suggestion=suggestion
this.setData({
suggestion:suggestion,
hasSuggestion:true,
})
this.getList()
},
})
\ No newline at end of file
... ...
... ... @@ -11,6 +11,14 @@
</view>
</view>
-->
<view class="searchAddrView searchKeyword" bindtap="gotoSearch">
<view class="searchAddr flex-ll">
<image class="icon" src="http://nosqn.colorcun.com/custom/lite-online/image/search26.png"></image>
<input style="width: 100%;" placeholder="{{search_placeholder}}"
type="text" disabled placeholder-class="placeholder"
value="{{keyword}}"/>
</view>
</view>
<view class="transverse-search flex-ll {{hasDisabled?'disabled':''}}">
<view
bindtap="caixiShow"
... ... @@ -84,7 +92,7 @@
previous-margin="{{10}}px" next-margin="{{10}}px" style="height: 330rpx;"
current="{{current}}" bindchange="bindtransition" bindanimationfinish="bindtransition">
<block wx:for="{{rsl}}" wx:key="rsl.key">
<swiper-item bindtap="gotoSellerDetail" id="{{item.id}}">
<swiper-item bindtap="gotoDetail" data-sid="{{item.id}}">
<view class="seller" id="seller-{{item.id}}">
<sb-tr seller="{{item}}"
hasInSwiper bindevent="sbtrEvent"
... ...
... ... @@ -58,7 +58,7 @@
}
.pages{
width: 100%;
margin: 81rpx auto 0;
margin: 160rpx auto 0;
color:#fff;
font-size: 28rpx;
}
... ... @@ -74,6 +74,9 @@
.follow .seller:last-child{
border-bottom: 20rpx solid #ffffff;
}
.follow .seller:first-child{
border-top:2rpx solid #f5f5f5;
}
.nomore{
color: #999;
font-size: 28rpx;
... ... @@ -167,4 +170,31 @@
color:rgba(53,53,53,1);
line-height:40rpx;
margin-top: 30rpx;
}
.searchKeyword{
height: 64rpx;
line-height: 64rpx;
margin-bottom: 15rpx;
}
.searchKeyword .searchAddr{
height:64rpx;
background:rgba(254,254,254,1);
border-radius:32rpx;
border:2rpx solid rgba(204,204,204,1);
box-sizing: border-box;
line-height:64rpx;
}
.placeholder{
font-size:28rpx;
font-family:PingFangSC-Regular,PingFang SC;
font-weight:400;
color:rgba(153,153,153,1);
}
.searchKeyword .searchAddr .icon{
min-width: 22rpx;
width:22rpx;
height: 22rpx;
margin: 0 10rpx 0 40rpx;
}
\ No newline at end of file
... ...
... ... @@ -8,6 +8,7 @@ var qqmapsdk = new QQMapWX({
});
import util from '../../utils/util';
import App from '../../utils/api';
import PubSub from '../../utils/PubSub'
Page({
/**
... ... @@ -87,13 +88,15 @@ Page({
for (var i = 0; i < this.data.suggestion.length; i++) {
if (i == id) {
console.log('backfill,this.data.suggestion[i]:',this.data.suggestion[i])
let pages = getCurrentPages();
let p = pages[pages.length - 2];
p.setSuggestion(this.data.suggestion[i])
// let pages = getCurrentPages();
// let p = pages[pages.length - 2];
// p.setSuggestion(this.data.suggestion[i])
//util.cache('suggestion',this.data.suggestion[i]);
this.setData({
backfill: this.data.suggestion[i].title
});
PubSub.emit('searchParam',{fun:'setSuggestion',suggestion:this.data.suggestion[i]})
PubSub.emit('searchParamList',{fun:'setSuggestion',suggestion:this.data.suggestion[i]})
wx.navigateBack();
}
}
... ... @@ -224,9 +227,11 @@ Page({
},'./detail')
})
}else{
let pages = getCurrentPages();
let p = pages[pages.length - 2];
p.setSuggestion(item)
//let pages = getCurrentPages();
//let p = pages[pages.length - 2];
//p.setSuggestion(item)
PubSub.emit('searchParam',{fun:'setSuggestion',suggestion:item})
PubSub.emit('searchParamList',{fun:'setSuggestion',suggestion:item})
this.setData({
backfill: item.title
});
... ...