Commit e13661559bc7f486922b0e2197ab1100d14aea6e

Authored by vking
1 parent 36ff860e

search page map

@@ -21,11 +21,13 @@ Page({ @@ -21,11 +21,13 @@ Page({
21 hasMore:true, 21 hasMore:true,
22 hasDisabled:true, 22 hasDisabled:true,
23 hasSuggestion:false, 23 hasSuggestion:false,
  24 + placeholder:'您好,几位,什么时候',
24 }, 25 },
25 26
26 /** 27 /**
27 * 生命周期函数--监听页面加载 28 * 生命周期函数--监听页面加载
28 */ 29 */
  30 + eventChannel:null,
29 onLoad: async function (options) { 31 onLoad: async function (options) {
30 //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 32 //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
31 this.options=options; 33 this.options=options;
@@ -52,7 +54,18 @@ Page({ @@ -52,7 +54,18 @@ Page({
52 multiIndex:[options.multiIndex], 54 multiIndex:[options.multiIndex],
53 tags:tags, 55 tags:tags,
54 }) 56 })
55 - setTimeout(()=>{this.getList()},0) 57 + this.eventChannel = this.getOpenerEventChannel()
  58 + // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
  59 + this.eventChannel.on('acceptDataFromMapPage', findSellerData=> {
  60 + if(findSellerData){
  61 + this.findSellerData=findSellerData
  62 + console.log('findSellerData',findSellerData)
  63 + this.setData({
  64 + findSellerData:findSellerData,
  65 + })
  66 + }
  67 + })
  68 + setTimeout(()=>{this.getList()},300)
56 }, 69 },
57 70
58 /** 71 /**
@@ -143,6 +156,22 @@ Page({ @@ -143,6 +156,22 @@ Page({
143 if(tags.length>0){ 156 if(tags.length>0){
144 this.param.tags=tags; 157 this.param.tags=tags;
145 } 158 }
  159 + let placeholder='您好,几位,什么时候';
  160 + if(this.findSellerData){
  161 + console.log(this.findSellerData)
  162 + this.param=Object.assign(this.param,this.findSellerData.paramObj)
  163 + //4位 今天 午餐
  164 + let sp=this.findSellerData.params
  165 + placeholder=
  166 + sp.pnum.val+' 位 '
  167 + +util.unixtoTime(sp.date.val,' `DAY/MM-DD` ')
  168 + if(sp.dur){
  169 + placeholder+=' '+['','早餐','午餐','晚餐','夜宵'][sp.dur.val]
  170 + }
  171 + }
  172 + this.setData({
  173 + placeholder:placeholder,
  174 + })
146 App.Customer.SellerLists(this.param).then(res=>{ 175 App.Customer.SellerLists(this.param).then(res=>{
147 this.setData({ 176 this.setData({
148 hasMore:res.data.length==this.size, 177 hasMore:res.data.length==this.size,
@@ -243,5 +272,14 @@ Page({ @@ -243,5 +272,14 @@ Page({
243 }, 272 },
244 dispalySearchHow(){ 273 dispalySearchHow(){
245 this.selectComponent('#search-how').show(); 274 this.selectComponent('#search-how').show();
246 - } 275 + },
  276 + howEvent(e){
  277 + this.eventChannel.emit('findSellerData',e.detail)
  278 + this.findSellerData=e.detail
  279 + this.setData({
  280 + findSellerData:e.detail
  281 + })
  282 + setTimeout(()=>{this.getList();},0)
  283 + this.selectComponent('#search-how').hide();
  284 + },
247 }) 285 })
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <view class="searchAddrView" bindtap="dispalySearchHow"> 4 <view class="searchAddrView" bindtap="dispalySearchHow">
5 <view class="searchAddr flex-ll"> 5 <view class="searchAddr flex-ll">
6 <image class="icon" src="http://qn.colorcun.com/reserve/images/find-black.png"></image> 6 <image class="icon" src="http://qn.colorcun.com/reserve/images/find-black.png"></image>
7 - <input style="width: 100%;" placeholder="您好,几位,什么时候" 7 + <input style="width: 100%;" placeholder="{{placeholder}}"
8 type="text" 8 type="text"
9 value="{{keyword}}"/> 9 value="{{keyword}}"/>
10 </view> 10 </view>
@@ -61,4 +61,4 @@ @@ -61,4 +61,4 @@
61 <caixi multiArray="{{multiArray}}" multiIndex="{{multiIndex}}" 61 <caixi multiArray="{{multiArray}}" multiIndex="{{multiIndex}}"
62 bindactive="caixiActive" id="caixi" 62 bindactive="caixiActive" id="caixi"
63 ></caixi> 63 ></caixi>
64 -<search-how id="search-how"></search-how> 64 +<search-how id="search-how" findSellerData="{{findSellerData}}" bindevent="howEvent"></search-how>