Commit e13661559bc7f486922b0e2197ab1100d14aea6e

Authored by vking
1 parent 36ff860e

search page map

... ... @@ -21,11 +21,13 @@ Page({
hasMore:true,
hasDisabled:true,
hasSuggestion:false,
placeholder:'您好,几位,什么时候',
},
/**
* 生命周期函数--监听页面加载
*/
eventChannel:null,
onLoad: async function (options) {
//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
this.options=options;
... ... @@ -52,7 +54,18 @@ Page({
multiIndex:[options.multiIndex],
tags:tags,
})
setTimeout(()=>{this.getList()},0)
this.eventChannel = this.getOpenerEventChannel()
// 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
this.eventChannel.on('acceptDataFromMapPage', findSellerData=> {
if(findSellerData){
this.findSellerData=findSellerData
console.log('findSellerData',findSellerData)
this.setData({
findSellerData:findSellerData,
})
}
})
setTimeout(()=>{this.getList()},300)
},
/**
... ... @@ -143,6 +156,22 @@ Page({
if(tags.length>0){
this.param.tags=tags;
}
let placeholder='您好,几位,什么时候';
if(this.findSellerData){
console.log(this.findSellerData)
this.param=Object.assign(this.param,this.findSellerData.paramObj)
//4位 今天 午餐
let sp=this.findSellerData.params
placeholder=
sp.pnum.val+' 位 '
+util.unixtoTime(sp.date.val,' `DAY/MM-DD` ')
if(sp.dur){
placeholder+=' '+['','早餐','午餐','晚餐','夜宵'][sp.dur.val]
}
}
this.setData({
placeholder:placeholder,
})
App.Customer.SellerLists(this.param).then(res=>{
this.setData({
hasMore:res.data.length==this.size,
... ... @@ -243,5 +272,14 @@ Page({
},
dispalySearchHow(){
this.selectComponent('#search-how').show();
}
},
howEvent(e){
this.eventChannel.emit('findSellerData',e.detail)
this.findSellerData=e.detail
this.setData({
findSellerData:e.detail
})
setTimeout(()=>{this.getList();},0)
this.selectComponent('#search-how').hide();
},
})
\ No newline at end of file
... ...
... ... @@ -4,7 +4,7 @@
<view class="searchAddrView" bindtap="dispalySearchHow">
<view class="searchAddr flex-ll">
<image class="icon" src="http://qn.colorcun.com/reserve/images/find-black.png"></image>
<input style="width: 100%;" placeholder="您好,几位,什么时候"
<input style="width: 100%;" placeholder="{{placeholder}}"
type="text"
value="{{keyword}}"/>
</view>
... ... @@ -61,4 +61,4 @@
<caixi multiArray="{{multiArray}}" multiIndex="{{multiIndex}}"
bindactive="caixiActive" id="caixi"
></caixi>
<search-how id="search-how"></search-how>
<search-how id="search-how" findSellerData="{{findSellerData}}" bindevent="howEvent"></search-how>
... ...