Commit 9c8e2f1b4e09bd2d19b3277096512dab493348a8

Authored by vking
2 parents 139f4d10 a68aae07

合并search

Showing 56 changed files with 1762 additions and 605 deletions
@@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
17 "pages/me/setting", 17 "pages/me/setting",
18 "pages/me/list", 18 "pages/me/list",
19 "pages/reserve/search", 19 "pages/reserve/search",
  20 + "pages/reserve/searchKeyword",
20 "pages/reserve/detail", 21 "pages/reserve/detail",
21 "pages/me/follow", 22 "pages/me/follow",
22 "pages/manager-invitation/index", 23 "pages/manager-invitation/index",
@@ -3882,7 +3882,9 @@ scroll-view.cu-steps .cu-item { @@ -3882,7 +3882,9 @@ scroll-view.cu-steps .cu-item {
3882 .text-df { 3882 .text-df {
3883 font-size: 28rpx; 3883 font-size: 28rpx;
3884 } 3884 }
3885 - 3885 +.text-30{
  3886 + font-size: 30rpx;
  3887 +}
3886 .text-lg { 3888 .text-lg {
3887 font-size: 32rpx; 3889 font-size: 32rpx;
3888 } 3890 }
@@ -55,12 +55,11 @@ Component({ @@ -55,12 +55,11 @@ Component({
55 }) 55 })
56 }, 56 },
57 tapButton(e) { 57 tapButton(e) {
58 - if(util.attr(e, 'type')=='confirm'){  
59 - this.triggerEvent('event', {type: util.attr(e, 'type')})  
60 - }  
61 - this.hide(); 58 + //this.triggerEvent('event', {type: util.attr(e, 'type')})
  59 + this.hide(util.attr(e, 'type'));
62 }, 60 },
63 - hide() { 61 + hide(type='') {
  62 + this.triggerEvent('event', {type: type})
64 this.setData({ 63 this.setData({
65 hasShow: false, 64 hasShow: false,
66 }) 65 })
@@ -8,6 +8,7 @@ Component({ @@ -8,6 +8,7 @@ Component({
8 properties: { 8 properties: {
9 height:Number, 9 height:Number,
10 disabled:Boolean, 10 disabled:Boolean,
  11 + filterParams:Object,//人均过滤初始值
11 }, 12 },
12 13
13 /** 14 /**
@@ -28,6 +29,14 @@ Component({ @@ -28,6 +29,14 @@ Component({
28 this.init() 29 this.init()
29 this.filterParams= null 30 this.filterParams= null
30 this.paramsData={}//过滤参数集合 31 this.paramsData={}//过滤参数集合
  32 + setTimeout(()=>{
  33 + if(this.data.filterParams){
  34 + this.filterEvent({detail:{
  35 + type:'set',
  36 + data:this.data.filterParams,
  37 + }})
  38 + }
  39 + },0)
31 }, 40 },
32 /** 41 /**
33 * 组件的方法列表 42 * 组件的方法列表
@@ -37,6 +46,7 @@ Component({ @@ -37,6 +46,7 @@ Component({
37 this.setData({ 46 this.setData({
38 multiArray: [['全部菜系'].concat(await DA.getCates())] 47 multiArray: [['全部菜系'].concat(await DA.getCates())]
39 }) 48 })
  49 + this.filterParams= this.data.filterParams
40 }, 50 },
41 caixiActive(e) { 51 caixiActive(e) {
42 console.log('caixiActive', e); 52 console.log('caixiActive', e);
@@ -5,7 +5,7 @@ Component({ @@ -5,7 +5,7 @@ Component({
5 * 组件的属性列表 5 * 组件的属性列表
6 */ 6 */
7 properties: { 7 properties: {
8 - 8 + cla:String,
9 }, 9 },
10 10
11 /** 11 /**
1 <!--components/reserve/search/filter.wxml--> 1 <!--components/reserve/search/filter.wxml-->
2 -<view class="filter {{hasDisplay?'animation-slide-top':''}}" catchtap="catchtap" wx:if="{{hasDisplay}}"> 2 +<view class="filter {{cla}} {{(hasDisplay && !cla)?'animation-slide-top':''}}" catchtap="catchtap" wx:if="{{hasDisplay}}">
3 <view class="part flex-ll"> 3 <view class="part flex-ll">
4 人均消费 4 人均消费
5 <view class="txt" wx:if="{{consumeStr}}">{{consumeStr}}</view> 5 <view class="txt" wx:if="{{consumeStr}}">{{consumeStr}}</view>
@@ -10,7 +10,9 @@ @@ -10,7 +10,9 @@
10 box-sizing: border-box; 10 box-sizing: border-box;
11 border-radius: 0px 0px 40rpx 40rpx; 11 border-radius: 0px 0px 40rpx 40rpx;
12 } 12 }
13 - 13 +.bottom-search{
  14 + border-radius: 40rpx 40rpx 0px 0px ;
  15 +}
14 .part{ 16 .part{
15 height: 48rpx; 17 height: 48rpx;
16 font-size: 34rpx; 18 font-size: 34rpx;
  1 +// components/reserve/search/how/hv/date.js
  2 +var myBehavior = require('hv_behavior')
  3 +const items=(function(){
  4 + let today=parseInt(new Date()/1000);
  5 + let ds=[]
  6 + for(let i=0;i<15;i++){
  7 + ds.push(today+86400*i)
  8 + }
  9 + return ds
  10 +})()
  11 +Component({
  12 + behaviors: [myBehavior],
  13 + data:{
  14 + items:items,
  15 + },
  16 + lifetimes: {
  17 + created: function () {
  18 + // 在组件实例进入页面节点树时执行
  19 + this.type='date'
  20 + },
  21 + detached: function () {
  22 + // 在组件实例被从页面节点树移除时执行
  23 + },
  24 + },
  25 + /**
  26 + * 组件的方法列表
  27 + */
  28 + methods: {
  29 +
  30 + }
  31 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +<!--components/reserve/search/how/hv/date.wxml-->
  2 +<wxs src="../../../../utils/util.wxs" module="util" />
  3 +<swiper previous-margin="35rpx" next-margin="45rpx"
  4 + class="tabs date" current="{{current}}"
  5 + display-multiple-items="4">
  6 + <swiper-item wx:for="{{items}}" wx:key="items">
  7 + <view class="item {{spi==index?'active':''}} flex-vc" bindtap="checked" data-index="{{index}}" data-val="{{item}}" data-type="date">
  8 + <view class="name">{{util.unixtoTime(item,'DAY')||util.unixtoTime(item,'周WW')}}</view>
  9 + <view class="mmdd">{{util.unixtoTime(item,'MM月DD日')}}</view>
  10 + </view>
  11 + </swiper-item>
  12 +</swiper>
  1 +/* components/reserve/search/how/hv/date.wxss */
  2 +@import "hv_behavior.wxss";
  3 +.date .item{
  4 + width: 140rpx;
  5 + height: 100rpx;
  6 +}
  7 +.item .name{
  8 + height: 36rpx;
  9 + font-size: 26rpx;
  10 + line-height: 36rpx;
  11 +}
  12 +.item .mmdd{
  13 + height: 40rpx;
  14 + font-size: 28rpx;
  15 + line-height: 40rpx;
  16 +}
  1 +// components/reserve/search/how/hv/pnum.js
  2 +/**
  3 + 早餐:7:00 —10:00
  4 + 午餐:11:00 — 14:30
  5 + 晚餐:16:00—22:00
  6 + 取最近未到的时段
  7 + 当天最后一个时段过了,那就第二天第一个时段
  8 + */
  9 +import util from '../../../../utils/util'
  10 +var myBehavior = require('hv_behavior')
  11 +const items=[
  12 + {id:1,label:'早餐',stime:'07:00',etime:'10:00'},
  13 + {id:2,label:'午餐',stime:'11:00',etime:'14:30'},
  14 + {id:3,label:'晚餐',stime:'16:00',etime:'22:00'},
  15 + {},
  16 + {},
  17 +]
  18 +Component({
  19 + behaviors: [myBehavior],
  20 + data:{
  21 + items:items,
  22 + },
  23 + created: function () {
  24 + // 在组件实例进入页面节点树时执行
  25 + this.type='dur'
  26 + setTimeout(()=>{
  27 + this.autoChecked()//自动选中
  28 + },0)
  29 + },
  30 +
  31 + /**
  32 + * 组件的方法列表
  33 + */
  34 + methods: {
  35 + autoChecked(){
  36 + if(this.data.ckdata) return;
  37 + //console.log('findSellerData',this.data.ckdata)
  38 + let now=parseInt(new Date()/1000);
  39 + let nowHHII=util.unixtoTime(now,'HH:II')
  40 + let activeIndex=0
  41 + if(nowHHII>items[0].etime && nowHHII<=items[2].etime){//有效时间内计算
  42 + activeIndex=1
  43 + if(nowHHII>items[1].etime){
  44 + activeIndex=2
  45 + }
  46 + }
  47 + let dataset={
  48 + index:activeIndex,
  49 + val:items[activeIndex].id,
  50 + type:'dur',
  51 + }
  52 + //console.log('dur-dataset',dataset)
  53 + setTimeout(()=>{
  54 + this.checked({currentTarget:{dataset:dataset}})
  55 + },0)
  56 +
  57 + }
  58 + }
  59 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +<!--components/reserve/search/how/dur.wxml-->
  2 +<swiper previous-margin="35rpx" next-margin="45rpx"
  3 + class="tabs"
  4 + display-multiple-items="5">
  5 + <swiper-item wx:for="{{items}}" wx:key="items">
  6 + <view class="item {{spi==index?'active':''}} flex-vc"
  7 + bindtap="{{index>2?'':'checked'}}"
  8 + data-index="{{index}}"
  9 + data-val="{{item.id}}"
  10 + data-type="dur">
  11 + <view class="name">{{item.label}}</view>
  12 + </view>
  13 + </swiper-item>
  14 +</swiper>
  1 +/* components/reserve/search/how/dur.wxss */
  2 +@import "hv_behavior.wxss";
  1 +// components/reserve/search/how/hv.js
  2 +import util from '../../../../utils/util'
  3 +module.exports = Behavior({
  4 + properties: {
  5 + ckdata:{
  6 + type:Object,
  7 + val:null,
  8 + },
  9 + },
  10 + data: {
  11 + spi:-1
  12 + },
  13 + observers: {
  14 + 'ckdata': function() {
  15 + this.checkedDefEvent()
  16 + }
  17 + },
  18 + methods: {
  19 + checked(e,hasCurrent=false){
  20 + let index=util.attr(e,'index')
  21 + let val=util.attr(e,'val')
  22 + let type=util.attr(e,'type')
  23 + let obj={
  24 + spi:index,
  25 + }
  26 + if(hasCurrent){
  27 + let current=index-2
  28 + if(type=='date'){
  29 + current=current>10?10:current
  30 + }else if(type=='pnum'){
  31 + current=current>26?26:current
  32 + }
  33 + obj.current=current>-1?current:0
  34 + }
  35 + this.setData(obj)
  36 + this.triggerEvent('event',{index,val,type})
  37 + },
  38 + checkedDefEvent(){
  39 + console.log('this.type',this.type)
  40 + let type=this.type
  41 + let ckdata = {}
  42 + if (!this.data.ckdata) {//初始化值
  43 + if(type == 'dur') return;
  44 + let index, val
  45 + if (type == 'pnum') {
  46 + index = 3
  47 + val = this.data.items[index]
  48 + } else if (type == 'date') {
  49 + index = 0
  50 + val = this.data.items[index]
  51 + }
  52 + ckdata = {index, val, type}
  53 + }else{
  54 + ckdata = this.data.ckdata
  55 + }
  56 + this.checked({currentTarget:{dataset:ckdata}},true)
  57 + },
  58 + }
  59 +})
  1 +/* components/reserve/search/how/hv.wxss */
  2 +@import "../../../../app.wxss";
  3 +.tabs {
  4 + height: 100rpx;
  5 +}
  6 +.tabs .item{
  7 + width:120rpx;
  8 + height:100rpx;
  9 + line-height: 100rpx;
  10 + border-radius:10rpx;
  11 + border:2rpx solid #fffff;
  12 + font-size:28rpx;
  13 + font-weight:400;
  14 + color:#353535;
  15 + text-align: center;
  16 + box-sizing: border-box;
  17 +}
  18 +.tabs .item.active{
  19 + border-radius:10rpx;
  20 + background:#E6F3FF;
  21 + border:#E6F3FF;
  22 + color:#42A5FF;
  23 +}
  1 +// components/reserve/search/how/index.js
  2 +import util from '../../../../utils/util'
  3 +Component({
  4 + /**
  5 + * 组件的属性列表
  6 + */
  7 + properties: {
  8 + hasPage:{
  9 + type:Boolean,
  10 + value:false,
  11 + },
  12 + findSellerData:{
  13 + type:Object,
  14 + value:null,
  15 + }
  16 + },
  17 +
  18 + /**
  19 + * 组件的初始数据
  20 + */
  21 + data: {
  22 + hidden:true,
  23 + },
  24 + created(){
  25 + this.params={}
  26 + },
  27 + attached(){
  28 + this.setData({
  29 + hidden:!this.data.hasPage
  30 + })
  31 + setTimeout(()=>{
  32 + if(!this.data.findSellerData){
  33 + this.submit()
  34 + }
  35 + },300)
  36 + },
  37 + observers: {
  38 + 'findSellerData': function(findSellerData) {
  39 + console.log('page=>findSellerData',findSellerData)
  40 + }
  41 + },
  42 + /**
  43 + * 组件的方法列表
  44 + */
  45 + methods: {
  46 + paramEvent(e){
  47 + console.log('paramEvent',e.detail.type,e.detail)
  48 + this.params[e.detail.type]=e.detail
  49 + },
  50 + submit(){
  51 + console.log('this.params',this.params)
  52 + let paramObj={}
  53 + if(this.params['date']){
  54 + paramObj.when_date=util.unixtoTime(this.params['date'].val,'YYYY-MM-DD')
  55 + }
  56 + if(this.params['pnum']){
  57 + paramObj.several=this.params['pnum'].val
  58 + }
  59 + if(this.params['dur'] && this.params['dur'].val>=0){
  60 + paramObj.daily=this.params['dur'].val
  61 + }
  62 + this.triggerEvent('event',{
  63 + params:this.params,
  64 + paramObj:paramObj,
  65 + paramStr:util.unixtoTime(this.params['date'].val,'MM月DD日(`DAY/周WW`)')
  66 + +' '+{1:'早餐',2:'午餐',3:'晚餐'}[this.params['dur'].val]
  67 + +' '+this.params['pnum'].val+'位',
  68 + })
  69 + },
  70 + show(){
  71 + this.setData({
  72 + hidden:false
  73 + })
  74 + },
  75 + hide(){
  76 + this.setData({
  77 + hidden:true
  78 + })
  79 + },
  80 + }
  81 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {
  4 + "date":"./date",
  5 + "pnum":"./pnum",
  6 + "dur":"./dur"
  7 + }
  8 +}
  1 +<!--components/reserve/search/how/index.wxml-->
  2 +<view hidden="{{hidden}}">
  3 + <view class="mask" wx:if="{{!hasPage}}" bindtap="hide"></view>
  4 + <view class="{{hasPage?'pages':'pages-window'}}">
  5 + <view class="title flex-lr">
  6 + <view class="title-name">您几位?什么时间用餐?</view>
  7 + <view class="close33" bindtap="hide"></view>
  8 + </view>
  9 + <view>
  10 + <pnum bindevent="paramEvent"
  11 + ckdata="{{findSellerData.params.pnum}}"></pnum>
  12 + <view style="margin: 40rpx 0">
  13 + <date bindevent="paramEvent" ckdata="{{findSellerData.params.date}}"></date>
  14 + </view>
  15 + <dur bindevent="paramEvent" ckdata="{{findSellerData.params.dur}}"></dur>
  16 + </view>
  17 + <view class="submit" bindtap="submit">查找餐厅</view>
  18 + </view>
  19 +</view>
  1 +/* components/reserve/search/how/index.wxss */
  2 +@import "../../../../app.wxss";
  3 +.mask{
  4 + z-index: 99999;
  5 +}
  6 +.pages{
  7 + padding: 20rpx 0;
  8 +}
  9 +.pages-window{
  10 + padding: 40rpx 0;
  11 + border-radius:40rpx 40rpx 0 0;
  12 + position: fixed;
  13 + bottom: 0;
  14 + background-color: #fff;
  15 + width: 100%;
  16 + z-index: 99999;
  17 + height: 708rpx;
  18 + box-sizing: border-box;
  19 +}
  20 +.pages .close{
  21 + display: none;
  22 +}
  23 +.title{
  24 + height:48rpx;
  25 + font-size:34rpx;
  26 + font-weight:bold;
  27 + color:rgba(53,53,53,1);
  28 + line-height:48rpx;
  29 + padding: 0 40rpx;
  30 + width: calc(100% - 80rpx);
  31 + margin-bottom: 40rpx;
  32 +}
  33 +.close{
  34 + background-image: url("http://nosqn.colorcun.com/reserve/images/close.png");
  35 + background-size: 100% 100%;
  36 + width: 32rpx;
  37 + height: 32rpx;
  38 +}
  39 +.submit{
  40 + height:80rpx;
  41 + background:#42A5FF;
  42 + border-radius:10rpx;
  43 + font-size:32rpx;
  44 + font-weight:500;
  45 + color:rgba(255,255,255,1);
  46 + line-height:80rpx;
  47 + text-align: center;
  48 + margin: 0 40rpx;
  49 + width: calc(100% - 80rpx);
  50 + position: fixed;
  51 + bottom: 40rpx;
  52 +}
  1 +// components/reserve/search/how/hv/pnum.js
  2 +var myBehavior = require('hv_behavior')
  3 +const items=(function(){
  4 + let today=1;
  5 + let ds=[]
  6 + for(let i=0;i<=30;i++){
  7 + ds.push(today+i)
  8 + }
  9 + return ds
  10 +})()
  11 +Component({
  12 + behaviors: [myBehavior],
  13 + data:{
  14 + items:items,
  15 + current:0,
  16 + },
  17 + lifetimes: {
  18 + created: function () {
  19 + // 在组件实例进入页面节点树时执行
  20 + this.type='pnum'
  21 + },
  22 + detached: function () {
  23 + // 在组件实例被从页面节点树移除时执行
  24 + },
  25 + },
  26 +
  27 + /**
  28 + * 组件的方法列表
  29 + */
  30 + methods: {
  31 +
  32 + }
  33 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +<!--components/reserve/search/how/hv/pnum.wxml-->
  2 +<swiper previous-margin="35rpx" next-margin="45rpx"
  3 + class="tabs" current="{{current}}"
  4 + display-multiple-items="5">
  5 + <swiper-item wx:for="{{items}}" wx:key="items">
  6 + <view class="item {{spi==index?'active':''}} flex-vc"
  7 + bindtap="checked" data-index="{{index}}"
  8 + data-val="{{item}}" data-type="pnum">
  9 + <view class="name">{{item>30?'30位以上':item+' 位'}}</view>
  10 + </view>
  11 + </swiper-item>
  12 +</swiper>
  1 +/* components/reserve/search/how/hv/pnum.wxss */
  2 +@import "hv_behavior.wxss";
  3 +.item .name{
  4 + font-size: 30rpx;
  5 + line-height: 40rpx;
  6 +}
  1 +// components/2.0/filter/location.js
  2 +import DA from '../../../pages/reserve/data'
  3 +import util from '../../../utils/util'
  4 +import QQMapWX from '../../../utils/qqmap-wx-jssdk.js'
  5 +const qqmapsdk = new QQMapWX({
  6 + key: 'SDEBZ-I74W4-QLGUX-XXYXU-HIR23-3QFBJ'
  7 +});
  8 +const CACHE_LOCALTION_KEY='CACHE_LOCALTION_KEY'
  9 +Component({
  10 + /**
  11 + * 组件的属性列表
  12 + */
  13 + properties: {
  14 + code:String,
  15 + },
  16 +
  17 + /**
  18 + * 组件的初始数据
  19 + */
  20 + data: {
  21 + address:'',
  22 + activeCity:{},
  23 + hasShow:false,
  24 + },
  25 + attached(){
  26 + this.init()
  27 +
  28 + },
  29 + /**
  30 + * 组件的方法列表
  31 + */
  32 + methods: {
  33 + async init(){
  34 + this.position={}
  35 + this.isAddr=false
  36 + this.useDefTS=false
  37 + this.citys=await DA.getCitys()
  38 + this.cacheCity=null
  39 + this.setData({
  40 + citys: this.citys
  41 + })
  42 + let cache=util.cache(CACHE_LOCALTION_KEY)
  43 + if(cache && cache.city){
  44 + this.cacheCity=cache.city
  45 + }
  46 + this.selectComponent('#getpos').getPos();
  47 + },
  48 + rePos(e){
  49 + this.cacheCity=null
  50 + this.isAddr=util.attr(e,'isAddr') && !this.useDefTS
  51 + this.selectComponent('#getpos').getPos();
  52 + },
  53 + hide(){
  54 + this.setData({
  55 + hasShow:false,
  56 + })
  57 + },
  58 + show(){
  59 + this.setData({
  60 + hasShow:true,
  61 + })
  62 + },
  63 + event(data){
  64 + data.position=this.position
  65 + this.triggerEvent('event',data)
  66 + util.cache('CACHE_LOCALTION_KEY',data)
  67 + },
  68 + checkedCity(e){
  69 + let activeCity=this.citys[util.attr(e,'index')]
  70 + this.setData({
  71 + activeCity:activeCity,
  72 + })
  73 + this.event({city:activeCity,address:this.position.address,isAddr:false})
  74 + this.hide()
  75 + },
  76 + onpos(e) {
  77 + let res = e.detail;
  78 + console.log('onpos.res', res);
  79 + let useDef=false
  80 + if(res.latitude==''){//默认使用唐山
  81 + this.useDefTS=true
  82 + res.latitude=39.684671
  83 + res.longitude=118.176300
  84 + }
  85 + this.position.latitude = res.latitude;
  86 + this.position.longitude = res.longitude;
  87 + qqmapsdk.reverseGeocoder({
  88 + location: {
  89 + latitude: res.latitude,
  90 + longitude: res.longitude
  91 + },
  92 + success:(res)=>{
  93 + if(res.status!=0) return;
  94 + console.log('qqmapsdk.reverseGeocoder',res.result)
  95 + this.position.address_component= res.result.address_component
  96 + this.position.address=this.useDefTS?'':res.result.address
  97 + let activeCity={}
  98 + if(this.cacheCity){
  99 + activeCity=this.cacheCity
  100 + }else if(!this.data.code){
  101 + this.citys.some(ci=>{
  102 + if(ci.name==this.position.address_component.city){
  103 + activeCity=ci
  104 + return true
  105 + }
  106 + })
  107 + }else{
  108 + this.citys.some(ci=>{
  109 + if(ci.code==this.data.code){
  110 + activeCity=ci
  111 + return true
  112 + }
  113 + })
  114 + }
  115 +
  116 + this.setData({
  117 + activeCity:activeCity,
  118 + address:this.position.address
  119 + })
  120 + this.event({city:activeCity,address:this.position.address,isAddr:this.isAddr})
  121 + if(this.isAddr){//点击地址
  122 + this.hide()
  123 + }
  124 + },
  125 + })
  126 +
  127 + },
  128 + }
  129 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {
  4 + "getpos":"/components/2.0/userinfo/getpos"
  5 + }
  6 +}
  1 +<!--components/2.0/filter/location.wxml-->
  2 +<view class="view cu-modal bottom-modal {{hasShow?'show':''}}" bindtap="hide">
  3 + <view class="cu-dialog confirm bg-white " catchtap="catchtap" style="border-radius: 40rpx 40rpx 0px 0px;">
  4 + <view class="padding-lg">
  5 + <view class="view txt-32-h">
  6 + 城市选择
  7 + </view>
  8 + <view class="flex margin-tb-lg">
  9 + <view class="flex-treble text-bold txt-34-h flex justify-start">我的位置</view>
  10 + <view class="flex justify-end align-center" bindtap="rePos">
  11 + <image src="http://nosqn.colorcun.com/search/s%20%289%29.png" style="width: 28rpx;height: 28rpx;"></image>
  12 + <view class="margin-left-sm text-blue txt-26-h">重新定位</view>
  13 + </view>
  14 + </view>
  15 + <view wx:if="{{address}}" class="flex justify-start align-start" bindtap="rePos" data-is-addr="{{true}}">
  16 + <image src="http://nosqn.colorcun.com/search/s%20%2810%29.png"
  17 + style="width: 26rpx;height: 30rpx;margin-top: 6rpx;"></image>
  18 + <view class="text-30 margin-left-sm flex-treble text-left">{{address}}</view>
  19 + </view>
  20 + <view wx:else="" class="text-30 flex-treble text-center">未获取到位置</view>
  21 + <view class="view margin-top-lg grid col-4 city-view">
  22 + <view class="view flex justify-center city-city"
  23 + bindtap="checkedCity" data-index="{{index}}"
  24 + wx:for="{{citys}}" wx:key="citys">
  25 + <view class="view city {{activeCity.code==item.code?'active':''}}">{{item.name}}</view>
  26 + </view>
  27 + </view>
  28 + <view class="txt-24-h text-gray margin-bottom-lg ">更多城市敬请期待…</view>
  29 + <view class="flex justify-center padding-top-lg">
  30 + <button class="view cu-btn round bg-ghostWhite txt-34-h"
  31 + style="width: 100%;color:#666666; height: 80rpx;"
  32 + bindtap="hide">
  33 + 取消
  34 + </button>
  35 + </view>
  36 + </view>
  37 + </view>
  38 +</view>
  39 +<getpos bindpos="onpos" id="getpos" hasFailPop></getpos>
  1 +/* components/2.0/filter/location.wxss */
  2 +@import "../../../colorui/main.wxss";
  3 +.city{
  4 + width: 148rpx;
  5 + height: 84rpx;
  6 + background: #F1F1F1;
  7 + border-radius: 10rpx;
  8 + text-align: center;
  9 +
  10 + font-size: 28rpx;
  11 + font-family: PingFangSC-Regular, PingFang SC;
  12 + font-weight: 400;
  13 + color: #666666;
  14 + line-height: 84rpx;
  15 + margin-bottom: 40rpx;
  16 +}
  17 +.city.active{
  18 + color: #42A5FF;
  19 + background: #E6F3FF;
  20 +}
@@ -97,12 +97,20 @@ Component({ @@ -97,12 +97,20 @@ Component({
97 }) 97 })
98 }, 98 },
99 confirmEvent(e){ 99 confirmEvent(e){
100 - wx.openSetting({  
101 - success:res=>{  
102 - console.log('getPos.openSetting',res)  
103 - this.getPos();  
104 - }  
105 - }) 100 + console.log('confirmEvent.type',e.detail.type)
  101 + if(e.detail.type=='confirm') {
  102 + wx.openSetting({
  103 + success: res => {
  104 + console.log('getPos.openSetting', res)
  105 + this.getPos();
  106 + }
  107 + })
  108 + }else{
  109 + this.triggerEvent("pos",{
  110 + latitude: '',
  111 + longitude: '',
  112 + });
  113 + }
106 }, 114 },
107 } 115 }
108 }) 116 })
@@ -4,7 +4,9 @@ @@ -4,7 +4,9 @@
4 <view class="nav" style="margin-top: {{statusBarHeight}}px;"> 4 <view class="nav" style="margin-top: {{statusBarHeight}}px;">
5 <view class="flex-lr part" style="height: {{titleBarHeight}}px; line-height: {{titleBarHeight}}px"> 5 <view class="flex-lr part" style="height: {{titleBarHeight}}px; line-height: {{titleBarHeight}}px">
6 <view class="opt flex-ll"> 6 <view class="opt flex-ll">
7 - <view class="back flex-vc" bindtap="back" wx:if="{{disBack}}"> 7 + <view class="back flex-vc"
  8 + style="height: {{titleBarHeight}}px; line-height: {{titleBarHeight}}px"
  9 + bindtap="back" wx:if="{{disBack}}">
8 <image class="back-image" 10 <image class="back-image"
9 src="http://nosqn.colorcun.com/custom/lite-yd/image/back{{backgroundColor!='#ffffff'?'-light':''}}.png"></image> 11 src="http://nosqn.colorcun.com/custom/lite-yd/image/back{{backgroundColor!='#ffffff'?'-light':''}}.png"></image>
10 </view> 12 </view>
@@ -135,7 +135,10 @@ Component({ @@ -135,7 +135,10 @@ Component({
135 }) 135 })
136 }, 136 },
137 confirmEvent(e){ 137 confirmEvent(e){
138 - wx.openSetting() 138 + console.log('confirmEvent.type',e.detail.type)
  139 + if(e.detail.type=='confirm') {
  140 + wx.openSetting()
  141 + }
139 }, 142 },
140 } 143 }
141 }) 144 })
@@ -11,7 +11,7 @@ Component({ @@ -11,7 +11,7 @@ Component({
11 * 组件的初始数据 11 * 组件的初始数据
12 */ 12 */
13 data: { 13 data: {
14 - url:'pages/reserve/index' 14 + url:'pages/reserve/search'
15 }, 15 },
16 pageLifetimes:{ 16 pageLifetimes:{
17 show(){ 17 show(){
@@ -57,9 +57,6 @@ Component({ @@ -57,9 +57,6 @@ Component({
57 }, 57 },
58 redirectTo(e){ 58 redirectTo(e){
59 let url= util.attr(e, 'url'); 59 let url= util.attr(e, 'url');
60 - this.setData({  
61 - url:url,  
62 - })  
63 wx.switchTab({ 60 wx.switchTab({
64 url: '/'+url, 61 url: '/'+url,
65 }) 62 })
@@ -26,8 +26,13 @@ @@ -26,8 +26,13 @@
26 .tabBar .checked .text{ 26 .tabBar .checked .text{
27 color: #5EB2FF; 27 color: #5EB2FF;
28 } 28 }
  29 +.tabBar .search.checked .icon{
  30 + width: 56rpx;
  31 + height: 56rpx;
  32 +}
29 .tabBar .search.checked .text{ 33 .tabBar .search.checked .text{
30 color: #FFFFFF; 34 color: #FFFFFF;
  35 + display: none;
31 } 36 }
32 .home .icon{ 37 .home .icon{
33 width: 40rpx; 38 width: 40rpx;
@@ -32,6 +32,7 @@ Component({ @@ -32,6 +32,7 @@ Component({
32 type: String, 32 type: String,
33 value: '', 33 value: '',
34 }, 34 },
  35 + seeAll:String,//只看标识
35 }, 36 },
36 37
37 /** 38 /**
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 </block> 14 </block>
15 </view> 15 </view>
16 <view class="price">¥ {{item.spec[0].price>0 ? item.spec[0].price : item.price}} 16 <view class="price">¥ {{item.spec[0].price>0 ? item.spec[0].price : item.price}}
17 - <view class="opt flex-cc"> 17 + <view class="opt flex-cc" wx:if="{{!seeAll}}">
18 <block wx:if="{{item_clear_num==0}}"> 18 <block wx:if="{{item_clear_num==0}}">
19 <image 19 <image
20 class="avater" 20 class="avater"
1 <!--cookbook/index.wxml--> 1 <!--cookbook/index.wxml-->
2 -<nav>{{order.seller.sellername||'提前点菜'}}</nav> 2 +<nav>{{options.seeAll||order.seller.sellername||'提前点菜'}}</nav>
3 <loading wx:if="{{isloading}}">数据加载中</loading> 3 <loading wx:if="{{isloading}}">数据加载中</loading>
4 <view class="{{hasListModel?'page-list flex-ll-top':'page'}}" wx:if="{{!isloading}}"> 4 <view class="{{hasListModel?'page-list flex-ll-top':'page'}}" wx:if="{{!isloading}}">
5 <!--第四部分 原始菜无图或有图展示--> 5 <!--第四部分 原始菜无图或有图展示-->
6 <scroll-view 6 <scroll-view
7 scroll-y class = "partfour list-model" 7 scroll-y class = "partfour list-model"
8 - style = "height:{{kindHeight-55}}px;width:100%;z-index:{{scrollZindex}}; position: fixed;" 8 + style = "height:{{kindHeight-(options.seeAll?0:55)}}px;width:100%;z-index:{{scrollZindex}}; position: fixed;"
9 scroll-into-view = "{{toView}}" 9 scroll-into-view = "{{toView}}"
10 scroll-with-animation 10 scroll-with-animation
11 bindscroll="bindscroll" 11 bindscroll="bindscroll"
@@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
19 <view class="list-model-column"> 19 <view class="list-model-column">
20 <block wx:for="{{item.cookbooklist[0]}}" wx:key="{{item.id}}" wx:for-index="itemIndex" > 20 <block wx:for="{{item.cookbooklist[0]}}" wx:key="{{item.id}}" wx:for-index="itemIndex" >
21 <view class="item"> 21 <view class="item">
22 - <foodCard item="{{item}}" 22 + <foodCard item="{{item}}" seeAll="{{options.seeAll}}"
23 sellerid="{{order.sellerid}}" orderid="{{order.id}}" 23 sellerid="{{order.sellerid}}" orderid="{{order.id}}"
24 identity="{{options.identity}}" 24 identity="{{options.identity}}"
25 bindfoodCardCallback="foodCardCallback" 25 bindfoodCardCallback="foodCardCallback"
@@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
32 <view style="height: 110rpx;width: 100%;"></view> 32 <view style="height: 110rpx;width: 100%;"></view>
33 </view> 33 </view>
34 </scroll-view> 34 </scroll-view>
35 - <view class="white flex-lr bottom-view"> 35 + <view class="white flex-lr bottom-view" wx:if="{{!options.seeAll}}">
36 <button class="share flex-vc button-none" open-type="share"> 36 <button class="share flex-vc button-none" open-type="share">
37 <view class="flex-vc"> 37 <view class="flex-vc">
38 <view class="icon"> 38 <view class="icon">
@@ -78,7 +78,7 @@ Page({ @@ -78,7 +78,7 @@ Page({
78 this.isInvitation = true; 78 this.isInvitation = true;
79 } 79 }
80 //console.log('this.enter_params',this.enter_params) 80 //console.log('this.enter_params',this.enter_params)
81 - let url = '/pages/reserve/index'; 81 + let url = '/pages/reserve/search';
82 if (opt.id > 0 || opt.sms_code) { 82 if (opt.id > 0 || opt.sms_code) {
83 if (opt.invite_name) { 83 if (opt.invite_name) {
84 let invite_names = wx.getStorageSync('invite_names') || {}; 84 let invite_names = wx.getStorageSync('invite_names') || {};
@@ -162,7 +162,7 @@ Page({ @@ -162,7 +162,7 @@ Page({
162 }, 162 },
163 redirectTo(red) { 163 redirectTo(red) {
164 console.log('this.redirectTo', red); 164 console.log('this.redirectTo', red);
165 - if (red.url.indexOf('list') > 0 || red.url.indexOf('reserve/index') > 0) { 165 + if (red.url.indexOf('list') > 0 || red.url.indexOf('reserve/search') > 0) {
166 wx.switchTab(red); 166 wx.switchTab(red);
167 } else { 167 } else {
168 wx.redirectTo(red); 168 wx.redirectTo(red);
@@ -18,8 +18,13 @@ let getCatesID=async function(index){ @@ -18,8 +18,13 @@ let getCatesID=async function(index){
18 let res=await App.Reserve.GetCustomerConfig(); 18 let res=await App.Reserve.GetCustomerConfig();
19 return res.data.cate[index].id; 19 return res.data.cate[index].id;
20 } 20 }
  21 +let getCitys=async function(){
  22 + let res=await App.Reserve.GetCustomerConfig();
  23 + return res.data.region_code;
  24 +}
21 export default { 25 export default {
22 getCates:getCates, 26 getCates:getCates,
23 getCatesID:getCatesID, 27 getCatesID:getCatesID,
  28 + getCitys:getCitys,
24 getLabels:getLabels, 29 getLabels:getLabels,
25 } 30 }
@@ -149,9 +149,11 @@ @@ -149,9 +149,11 @@
149 149
150 <view class="black20line"></view> 150 <view class="black20line"></view>
151 <view class="block" wx:if="{{seller.dishes.length>0}}"> 151 <view class="block" wx:if="{{seller.dishes.length>0}}">
152 - <view class="header flex-ll">  
153 - <view class="line"></view>  
154 - <view class="name">推荐菜品</view> 152 + <view class="header flex-lr">
  153 + <view class="flex-ll">
  154 + <view class="line"></view>
  155 + <view class="name">推荐菜品</view>
  156 + </view>
155 </view> 157 </view>
156 <scroll-view wx:if="{{hasDishesImage}}" 158 <scroll-view wx:if="{{hasDishesImage}}"
157 scroll-x 159 scroll-x
@@ -177,6 +179,22 @@ @@ -177,6 +179,22 @@
177 </block> 179 </block>
178 </view> 180 </view>
179 </view> 181 </view>
  182 + <block wx:if="{{seller.seller_config_info.is_display_dish==1}}">
  183 + <view class="black20line"></view>
  184 + <navigator url="/pack-cookbook/pages/index?rid=18599&oid=273&identity=1&seeAll={{seller.sellername}}&sid={{seller.id}}" hover-class="navigator-hover">
  185 + <view class="view padding-tb-lg">
  186 + <view class="view flex justify-between align-center">
  187 + <view class="view txt-40-h text-bold">查看菜单</view>
  188 + <view class="view flex justify-end align-center">
  189 + <view style="font-size: 28rpx;margin-right: 20rpx;">所有菜品</view>
  190 + <view class="more"></view>
  191 + </view>
  192 + </view>
  193 + </view>
  194 + </navigator>
  195 + <view class="black20line"></view>
  196 + <view class="black20line"></view>
  197 + </block>
180 </view> 198 </view>
181 </view> 199 </view>
182 <view class="footer flex-lr"> 200 <view class="footer flex-lr">
1 /* pages/reserve/detail.wxss */ 1 /* pages/reserve/detail.wxss */
2 @import "./detail.skeleton.wxss"; 2 @import "./detail.skeleton.wxss";
  3 +@import "../../colorui/main.wxss";
3 .pages{ 4 .pages{
4 width: 100%; 5 width: 100%;
5 margin: 0 auto; 6 margin: 0 auto;
@@ -94,9 +94,10 @@ Page({ @@ -94,9 +94,10 @@ Page({
94 size:10, 94 size:10,
95 hasMore:true, 95 hasMore:true,
96 GetCollectionSellerList(){ 96 GetCollectionSellerList(){
97 - App.Customer.GetActivitySellerList({  
98 - lat:this.options.latitude,  
99 - lng:this.options.longitude, 97 + this.city=JSON.parse(this.options.city)
  98 + App.Customer.GetActivitySellerListByFoods({
  99 + code:this.city.code,
  100 + pid:this.city.pid,
100 offset:this.offset, 101 offset:this.offset,
101 size:this.size, 102 size:this.size,
102 distance:50, 103 distance:50,
@@ -42,6 +42,13 @@ Page({ @@ -42,6 +42,13 @@ Page({
42 * &keyword= 42 * &keyword=
43 * &filterParams={"consumeStr":"¥200-300","min":"200","max":"300","active":"200,300"} 43 * &filterParams={"consumeStr":"¥200-300","min":"200","max":"300","active":"200,300"}
44 */ 44 */
  45 + /**
  46 + hasSuggestion=1&keyword=橡树湾&lat=39.662877&lng=118.130962&centre_pos=39.662877,118.130962&multiIndex=0&filter={"consumeStr":"¥200-300","min":"200","max":"300","active":"200,300"}&city={"code":"610100","pid":"610000","name":"西安市","status":"1","last_date":"1598949575"}&hows={"params":{"pnum":{"index":3,"val":4,"type":"pnum"},"date":{"index":0,"val":1606983211,"type":"date"},"dur":{"index":2,"val":3,"type":"dur"}},"paramObj":{"when_date":"2020-12-03","several":4,"daily":3},"paramStr":"12月03日(今天) 晚餐 4位"}
  47 +
  48 + lat=39.65157&lng=118.15044&keyword=1&multiIndex=0&city={"code":"130200","pid":"130000","name":"唐山市","status":"1","last_date":"1598949575"}&hows={"params":{"pnum":{"index":5,"val":6,"type":"pnum"},"date":{"index":1,"val":1607399207,"type":"date"},"dur":{"index":2,"val":3,"type":"dur"}},"paramObj":{"when_date":"2020-12-08","several":6,"daily":3},"paramStr":"12月08日(明天) 晚餐 6位"}&filter={"consumeStr":"¥101-220","min":"101","max":"220","active":"101,220"}
  49 +
  50 + city={"code":"130200","pid":"130000","name":"唐山市","status":"1","last_date":"1598949575"}&hows={"params":{"pnum":{"index":3,"val":4,"type":"pnum"},"date":{"index":0,"val":1606984766,"type":"date"},"dur":{"index":2,"val":3,"type":"dur"}},"paramObj":{"when_date":"2020-12-03","several":4,"daily":3},"paramStr":"12月03日(今天) 晚餐 4位"}
  51 + */
45 wx.getSystemInfo({ 52 wx.getSystemInfo({
46 success:res=>{ 53 success:res=>{
47 console.log('wx.getSystemInfo',res) 54 console.log('wx.getSystemInfo',res)
@@ -51,11 +58,28 @@ Page({ @@ -51,11 +58,28 @@ Page({
51 }, 58 },
52 }) 59 })
53 this.filterParams=null 60 this.filterParams=null
54 - if(options.filterParams){  
55 - this.filterParams=JSON.parse(options.filterParams) 61 + if(options.filter){
  62 + this.filterParams=JSON.parse(options.filter)
56 this.setData({ 63 this.setData({
57 filterParams:this.filterParams, 64 filterParams:this.filterParams,
58 }) 65 })
  66 + this.filterGroupData.average=this.filterParams.active
  67 + }
  68 + if(options.city){
  69 + this.city=JSON.parse(options.city)
  70 + }
  71 + this.findSellerData=null
  72 + if(options.hows){
  73 + this.findSellerData=JSON.parse(options.hows)
  74 + let paramStr=this.findSellerData.paramStr.split(" ");
  75 + this.setData({
  76 + findSellerData:this.findSellerData,
  77 + headerHows:[
  78 + paramStr[0].substr(0,6),
  79 + paramStr[1]+' '+paramStr[2],
  80 + ],
  81 +
  82 + })
59 } 83 }
60 this.options=options; 84 this.options=options;
61 if(options.hasSuggestion){ 85 if(options.hasSuggestion){
@@ -67,9 +91,14 @@ Page({ @@ -67,9 +91,14 @@ Page({
67 } 91 }
68 this.setData({ 92 this.setData({
69 hasSuggestion:true, 93 hasSuggestion:true,
70 - suggestion:this.suggestion 94 + suggestion:this.suggestion,
  95 + keyword:this.options.keyword,
71 }) 96 })
72 delete this.options.keyword 97 delete this.options.keyword
  98 + }else if(this.options.keyword){
  99 + this.setData({
  100 + keyword:options.keyword,
  101 + })
73 } 102 }
74 let tags=[ 103 let tags=[
75 {id:1,name:'环境好'}, 104 {id:1,name:'环境好'},
@@ -102,7 +131,7 @@ Page({ @@ -102,7 +131,7 @@ Page({
102 } 131 }
103 }) 132 })
104 }catch(e){} 133 }catch(e){}
105 - setTimeout(()=>{this.getList()},300) 134 + //setTimeout(()=>{this.getList()},300)
106 135
107 }, 136 },
108 137
@@ -127,6 +156,14 @@ Page({ @@ -127,6 +156,14 @@ Page({
127 } 156 }
128 } 157 }
129 ) 158 )
  159 + if(wx.getMenuButtonBoundingClientRect){
  160 + let rect=wx.getMenuButtonBoundingClientRect()
  161 + console.log(rect,getApp().system)
  162 + this.setData({
  163 + right:getApp().system.windowWidth - rect.right + rect.width + 10,
  164 + top:rect.top+(rect.height/2-20),
  165 + })
  166 + }
130 }, 167 },
131 168
132 /** 169 /**
@@ -182,69 +219,30 @@ Page({ @@ -182,69 +219,30 @@ Page({
182 this.setData({ 219 this.setData({
183 hasLoading:true, 220 hasLoading:true,
184 }) 221 })
185 - let mapParam=this.options  
186 this.offset=1 //page 222 this.offset=1 //page
187 this.size=20 //page size 223 this.size=20 //page size
188 - this.setData({  
189 - keyword:mapParam.keyword||'',  
190 - })  
191 -  
192 - if(mapParam.keyword){  
193 - this.param={  
194 - lat_extend:mapParam.lat,  
195 - lng_extend:mapParam.lng,  
196 - keyword:mapParam.keyword.trim(),  
197 - offset:this.offset,  
198 - size:this.size,  
199 - distance:500000,  
200 - };  
201 - if(mapParam.lat){  
202 - this.param.centre_pos=`${mapParam.lat},${mapParam.lng}`  
203 - }  
204 - if(mapParam.isopen_md){  
205 - this.param.isopen_md=1  
206 - }  
207 - }else{  
208 - //计算视窗中心  
209 - let lat,lng  
210 - if(this.suggestion){  
211 - lat=this.suggestion.latitude  
212 - lng=this.suggestion.longitude  
213 - this.setData({  
214 - keyword:this.suggestion.title,  
215 - })  
216 - }else if(this.hasCleanSuggestion){//清理地标使用人的位置  
217 - lat=this.location.latitude  
218 - lng=this.location.longitude  
219 - }  
220 - if(!lat || !lng){//不完整时,使用地图中心点  
221 - let map=JSON.parse(mapParam.map);  
222 - lat=map.northeast.latitude-(map.northeast.latitude-map.southwest.latitude)/2;  
223 - lng=map.northeast.longitude-(map.northeast.longitude-map.southwest.longitude)/2;  
224 - }  
225 - this.param={  
226 - lat:lat,  
227 - lng:lng,  
228 - lat_extend:mapParam.lat,  
229 - lng_extend:mapParam.lng,  
230 - offset:this.offset,  
231 - size:this.size,  
232 - distance:50,  
233 - };  
234 - if(this.suggestion || this.hasCleanSuggestion){  
235 - this.param.centre_pos=`${lat},${lng}`  
236 - }else{  
237 - if(mapParam.centre_pos){  
238 - this.param.centre_pos=mapParam.centre_pos  
239 - }  
240 - } 224 + this.param={
  225 + offset:this.offset,
  226 + size:this.size,
  227 + code:this.city.code,
  228 + pid:this.city.pid,
  229 + keyword:this.options.keyword||'',
  230 + ...this.findSellerData.paramObj,
  231 + }
  232 + console.log('this.location',this.location)
  233 + if(this.suggestion){
  234 + this.param.lat_extend=this.suggestion.latitude
  235 + this.param.lng_extend=this.suggestion.longitude
  236 + }else if(this.location){
  237 + this.param.lat_extend=this.location.latitude
  238 + this.param.lng_extend=this.location.longitude
241 } 239 }
242 -  
243 this.hasFilterData=false 240 this.hasFilterData=false
244 if(this.filterGroupData.tags){ 241 if(this.filterGroupData.tags){
245 this.param.tags = this.filterGroupData.tags; 242 this.param.tags = this.filterGroupData.tags;
246 this.hasFilterData=true 243 this.hasFilterData=true
247 } 244 }
  245 + console.log('this.filterGroupData',this.filterGroupData)
248 if (this.filterGroupData.cuisine) { 246 if (this.filterGroupData.cuisine) {
249 this.param.cuisine = this.filterGroupData.cuisine; 247 this.param.cuisine = this.filterGroupData.cuisine;
250 this.hasFilterData=true 248 this.hasFilterData=true
@@ -254,7 +252,7 @@ Page({ @@ -254,7 +252,7 @@ Page({
254 this.hasFilterData=true 252 this.hasFilterData=true
255 } 253 }
256 254
257 - App.Customer.SellerLists(this.param).then(res=>{ 255 + App.Customer.GetSellerListByFoods(this.param).then(res=>{
258 this.setData({ 256 this.setData({
259 rsl:[], 257 rsl:[],
260 hasMore:res.data.length==this.size, 258 hasMore:res.data.length==this.size,
@@ -265,9 +263,11 @@ Page({ @@ -265,9 +263,11 @@ Page({
265 }) 263 })
266 this.hasGetSellerEnd=true 264 this.hasGetSellerEnd=true
267 this.triggerEvent('event',{type:'getListEnd',total:res.data.length}) 265 this.triggerEvent('event',{type:'getListEnd',total:res.data.length})
  266 + /*
268 if(res.data.length==0 && this.offset==1 && this.location){ 267 if(res.data.length==0 && this.offset==1 && this.location){
269 - this.onpos({detail:this.location}) 268 + this.GetRecommendSellerList()
270 } 269 }
  270 + */
271 }) 271 })
272 }, 272 },
273 /** 273 /**
@@ -283,7 +283,7 @@ Page({ @@ -283,7 +283,7 @@ Page({
283 getListMore(){ 283 getListMore(){
284 this.param.offset+=1; 284 this.param.offset+=1;
285 let sellers=this.data.sellers; 285 let sellers=this.data.sellers;
286 - App.Customer.SellerLists(this.param).then(res=>{ 286 + App.Customer.GetSellerListByFoods(this.param).then(res=>{
287 this.setData({ 287 this.setData({
288 hasMore:res.data.length==this.size, 288 hasMore:res.data.length==this.size,
289 sellers:sellers.concat(this.sellerFormat(res.data)), 289 sellers:sellers.concat(this.sellerFormat(res.data)),
@@ -372,10 +372,15 @@ Page({ @@ -372,10 +372,15 @@ Page({
372 this.selectComponent('#search-how').show(); 372 this.selectComponent('#search-how').show();
373 }, 373 },
374 howEvent(e){ 374 howEvent(e){
375 - this.eventChannel.emit('findSellerData',e.detail) 375 + //this.eventChannel.emit('findSellerData',e.detail)
376 this.findSellerData=e.detail 376 this.findSellerData=e.detail
  377 + let paramStr=this.findSellerData.paramStr.split(" ");
377 this.setData({ 378 this.setData({
378 - findSellerData:e.detail 379 + findSellerData:e.detail,
  380 + headerHows:[
  381 + paramStr[0].substr(0,6),
  382 + paramStr[1]+' '+paramStr[2],
  383 + ],
379 }) 384 })
380 setTimeout(()=>{this.getList();},0) 385 setTimeout(()=>{this.getList();},0)
381 this.selectComponent('#search-how').hide(); 386 this.selectComponent('#search-how').hide();
@@ -384,11 +389,7 @@ Page({ @@ -384,11 +389,7 @@ Page({
384 onpos(e){ 389 onpos(e){
385 console.log('onpos',this.hasGetSellerEnd,e); 390 console.log('onpos',this.hasGetSellerEnd,e);
386 this.location=e.detail 391 this.location=e.detail
387 - if(!this.hasGetSellerEnd){  
388 - return setTimeout(()=>{  
389 - this.onpos(e)  
390 - },500)  
391 - } 392 + this.getList()
392 // if(this.data.sellers.length<1){ 393 // if(this.data.sellers.length<1){
393 // this.GetRecommendSellerList() 394 // this.GetRecommendSellerList()
394 // } 395 // }
@@ -450,19 +451,12 @@ Page({ @@ -450,19 +451,12 @@ Page({
450 this.getList() 451 this.getList()
451 }, 452 },
452 moveToLocation(){ 453 moveToLocation(){
453 - if(!this.location || !this.location.latitude || !this.location.longitude){  
454 - this.selectComponent('#getpos').getPos(true);  
455 - return;  
456 - } 454 + delete this.options.keyword
457 this.suggestion=null 455 this.suggestion=null
458 - this.hasCleanSuggestion=true  
459 this.setData({ 456 this.setData({
460 - suggestion:null,  
461 - hasSuggestion:false,  
462 keyword:'', 457 keyword:'',
463 }) 458 })
464 - //PubSub.emit('searchParam', {fun:'moveToLocation'})  
465 - setTimeout(()=>{this.getList()},0) 459 + this.selectComponent('#getpos').getPos();
466 }, 460 },
467 filterShow(){ 461 filterShow(){
468 this.selectComponent('#filter').show(this.filterParams); 462 this.selectComponent('#filter').show(this.filterParams);
@@ -513,4 +507,20 @@ Page({ @@ -513,4 +507,20 @@ Page({
513 this.selectComponent('#as').show(e.detail.seller); 507 this.selectComponent('#as').show(e.detail.seller);
514 } 508 }
515 }, 509 },
  510 + searchKeyword(){
  511 + let pages = getCurrentPages();
  512 + if(pages.length>=2){
  513 + let p = pages[pages.length - 2];
  514 + if(p.route=='pages/reserve/searchKeyword') {
  515 + return wx.navigateBack();
  516 + }
  517 + }
  518 + wx.navigateTo({
  519 + url:util.http_build_query({
  520 + filter:this.filterParams?JSON.stringify(this.filterParams):null,
  521 + city:JSON.stringify(this.city),
  522 + hows:JSON.stringify(this.findSellerData),
  523 + },'/pages/reserve/searchKeyword')
  524 + })
  525 + },
516 }) 526 })
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 "nav":"/components/nav/nav", 7 "nav":"/components/nav/nav",
8 "sb-tr":"/components/reserve/seller-box-transverse/seller-box", 8 "sb-tr":"/components/reserve/seller-box-transverse/seller-box",
9 "caixi":"/components/reserve/caixi", 9 "caixi":"/components/reserve/caixi",
10 - "search-how":"/components/reserve/search/how/index", 10 + "search-how":"/components/2.0/filter/how/index",
11 "hr":"/components/hr", 11 "hr":"/components/hr",
12 "filter":"/components/reserve/search/filter", 12 "filter":"/components/reserve/search/filter",
13 13
1 <!--pages/reserve/indexList.wxml--> 1 <!--pages/reserve/indexList.wxml-->
2 -<nav>周到安排</nav>  
3 -<view class="view content" style="height: calc(100vh - 65px);"> 2 +<nav>
  3 + <view class="view header flex align-center justify-center text-blue padding-left" style="right:{{right}}px;top:{{top}}px;" wx:if="{{right>0}}">
  4 + <view class="view flex flex-direction" bindtap="dispalySearchHow">
  5 + <view class="view txt-26-h">{{headerHows[0]}}</view>
  6 + <view class="view txt-26-h">{{headerHows[1]}}</view>
  7 + </view>
  8 + <view class="line margin-lr"></view>
  9 + <view class="flex justify-around align-center" bindtap="searchKeyword">
  10 + <image class="margin-right-sm" wx:if="{{!keyword}}"
  11 + style="width: 32rpx; height: 32rpx;" src="http://nosqn.colorcun.com/search/s%20%2811%29.png"></image>
  12 + <view class="view text-cut txt-34-h text-left margin-right-sm"
  13 + style="width: 170rpx;">{{keyword||'搜索餐厅…'}}</view>
  14 + <view class="margin-right-sm clean view"
  15 + wx:if="{{keyword}}" catchtap="moveToLocation"></view>
  16 + </view>
  17 + </view>
  18 +</nav>
  19 + <!--
4 <view class="searchAddrView searchKeyword bg-white" bindtap="gotoSearch"> 20 <view class="searchAddrView searchKeyword bg-white" bindtap="gotoSearch">
5 <view class="searchAddr flex-ll"> 21 <view class="searchAddr flex-ll">
6 <image class="icon" src="http://nosqn.colorcun.com/custom/lite-online/image/search26.png"></image> 22 <image class="icon" src="http://nosqn.colorcun.com/custom/lite-online/image/search26.png"></image>
@@ -10,8 +26,11 @@ @@ -10,8 +26,11 @@
10 <view class="clean" catchtap="moveToLocation" wx:if="{{keyword && hasSuggestion}}"></view> 26 <view class="clean" catchtap="moveToLocation" wx:if="{{keyword && hasSuggestion}}"></view>
11 </view> 27 </view>
12 </view> 28 </view>
  29 + -->
  30 +<view class="view content" style="height: calc(100vh - 65px);">
13 <filter-group height="{{height}}" 31 <filter-group height="{{height}}"
14 id="filter-group" 32 id="filter-group"
  33 + filterParams="{{filterParams}}"
15 bindevent="filterGroupEvent" 34 bindevent="filterGroupEvent"
16 disabled="{{(sellers.length<1 && !hasFilterData) || hasLoading}}"></filter-group> 35 disabled="{{(sellers.length<1 && !hasFilterData) || hasLoading}}"></filter-group>
17 <block wx:if="{{hasLoading}}"> 36 <block wx:if="{{hasLoading}}">
@@ -33,7 +52,7 @@ @@ -33,7 +52,7 @@
33 scroll-into-view="seller-{{scrollSellerID}}" 52 scroll-into-view="seller-{{scrollSellerID}}"
34 scroll-with-animation 53 scroll-with-animation
35 bindscrolltolower="getListMore" 54 bindscrolltolower="getListMore"
36 - style="width:100%;height: calc(100vh - 150px);"> 55 + style="width:100%;height: calc(100vh - 65px);">
37 <block wx:for="{{sellers}}" wx:key="sellers" > 56 <block wx:for="{{sellers}}" wx:key="sellers" >
38 <navigator url="/pages/reserve/detail?id={{item.id}}" hover-class="navigator-hover"> 57 <navigator url="/pages/reserve/detail?id={{item.id}}" hover-class="navigator-hover">
39 <seller-card class="seller-card" id="seller-{{item.id}}" 58 <seller-card class="seller-card" id="seller-{{item.id}}"
@@ -41,9 +60,10 @@ @@ -41,9 +60,10 @@
41 seller="{{item}}" bindevent="sellerCardEvent" ></seller-card> 60 seller="{{item}}" bindevent="sellerCardEvent" ></seller-card>
42 </navigator> 61 </navigator>
43 </block> 62 </block>
44 - <view class="view" style="height: 50rpx;"></view> 63 + <view class="view" style="height: 160rpx;"></view>
45 </scroll-view> 64 </scroll-view>
46 </block> 65 </block>
47 </view> 66 </view>
48 <getpos bindpos="onpos" id="getpos" hasAllowLoading="{{false}}"></getpos> 67 <getpos bindpos="onpos" id="getpos" hasAllowLoading="{{false}}"></getpos>
49 -<as-phone id="as"></as-phone>  
  68 +<as-phone id="as"></as-phone>
  69 +<search-how id="search-how" findSellerData="{{findSellerData}}" bindevent="howEvent"></search-how>
@@ -7,14 +7,6 @@ @@ -7,14 +7,6 @@
7 position: relative; 7 position: relative;
8 z-index: 99998; 8 z-index: 99998;
9 } 9 }
10 -.header{  
11 - height: 81rpx;  
12 - position: fixed;  
13 - width: 100%;  
14 - z-index: 10;  
15 - background-color: #fefefe;  
16 - border-bottom: 1rpx solid #F5F5F5;  
17 -}  
18 .transverse-search{ 10 .transverse-search{
19 background-color: #fefefe; 11 background-color: #fefefe;
20 height: 60rpx; 12 height: 60rpx;
@@ -227,4 +219,36 @@ @@ -227,4 +219,36 @@
227 position: absolute; 219 position: absolute;
228 top:16rpx; 220 top:16rpx;
229 left:32rpx; 221 left:32rpx;
  222 +}
  223 +
  224 +
  225 +
  226 +.header{
  227 + max-width: 468rpx;
  228 + height: 80rpx;
  229 + background: #F4FAFF;
  230 + border-radius: 48rpx;
  231 + border: 2rpx solid #4C91F8;
  232 + position: fixed;
  233 + font-weight: 500;
  234 +}
  235 +.header .line{
  236 + width: 2rpx;
  237 + height: 32rpx;
  238 + background: #42A5FF;
  239 +}
  240 +.header .clean{
  241 + position: relative;
  242 + background-image: url("http://nosqn.colorcun.com/clean.png");
  243 + width: 28rpx;
  244 + height: 28rpx;
  245 +}
  246 +.header .clean:after{
  247 + display: block;
  248 + content: "";
  249 + width:80rpx;
  250 + height:80rpx;
  251 + position: absolute;
  252 + top:-30rpx;
  253 + left:-30rpx;
230 } 254 }
1 -// pages/reserve/search.js\  
2 -const map_key='SDEBZ-I74W4-QLGUX-XXYXU-HIR23-3QFBJ'  
3 -// 引入SDK核心类  
4 -var QQMapWX = require('../../utils/qqmap-wx-jssdk');  
5 -// 实例化API核心类  
6 -var qqmapsdk = new QQMapWX({  
7 - key:map_key // 必填  
8 -});  
9 -import util from '../../utils/util'; 1 +// pages/reserve/home.js
10 import App from '../../utils/api'; 2 import App from '../../utils/api';
  3 +import util from '../../utils/util'
11 import PubSub from '../../utils/PubSub' 4 import PubSub from '../../utils/PubSub'
  5 +const {regeneratorRuntime} = global
12 Page({ 6 Page({
13 7
14 /** 8 /**
15 * 页面的初始数据 9 * 页面的初始数据
16 */ 10 */
17 data: { 11 data: {
18 - history:[],  
19 - suggestion:[],  
20 - hasSellerMore:false,  
21 - keyword:'',  
22 - sellerSplit:-1,  
23 - navHeight:100, 12 + location:'获取中...',
  13 + hasFilter:false,//
24 }, 14 },
25 15
26 /** 16 /**
27 * 生命周期函数--监听页面加载 17 * 生命周期函数--监听页面加载
28 */ 18 */
29 onLoad: function (options) { 19 onLoad: function (options) {
30 - this.selectComponent('#getpos').getPos(); 20 +
31 }, 21 },
32 22
33 /** 23 /**
@@ -42,11 +32,6 @@ Page({ @@ -42,11 +32,6 @@ Page({
42 */ 32 */
43 onShow: function () { 33 onShow: function () {
44 PubSub.emit('custom-tab-bar') 34 PubSub.emit('custom-tab-bar')
45 - this.getHistory();  
46 - this.setData({  
47 - navHeight:this.selectComponent('#nav').getHeight()  
48 - })  
49 -  
50 }, 35 },
51 36
52 /** 37 /**
@@ -62,266 +47,117 @@ Page({ @@ -62,266 +47,117 @@ Page({
62 onUnload: function () { 47 onUnload: function () {
63 48
64 }, 49 },
65 - getHistory(){  
66 - App.Customer.GetHistorySearch().then(res=>{  
67 - let mks=[]  
68 - res.data.forEach(h=>{  
69 - mks.push({ // 获取返回结果,放到mks数组中  
70 - title: h.name,  
71 - id: h.sid,  
72 - addr: '',  
73 - city: '',  
74 - district: 0,  
75 - latitude: h.latitude,  
76 - longitude: h.longitude,  
77 - type:h.type==1?-1:h.type,  
78 - })  
79 - })  
80 - this.setData({  
81 - history:mks  
82 - })  
83 - }) 50 +
  51 + /**
  52 + * 页面相关事件处理函数--监听用户下拉动作
  53 + */
  54 + onPullDownRefresh: function () {
  55 +
84 }, 56 },
85 - //在Page({})中使用下列代码  
86 - //数据回填方法  
87 - backfill: function (e) {  
88 - var id = e.currentTarget.id;  
89 - for (var i = 0; i < this.data.suggestion.length; i++) {  
90 - if (i == id) {  
91 - console.log('backfill,this.data.suggestion[i]:',this.data.suggestion[i])  
92 - // let pages = getCurrentPages();  
93 - // let p = pages[pages.length - 2];  
94 - // p.setSuggestion(this.data.suggestion[i])  
95 - //util.cache('suggestion',this.data.suggestion[i]);  
96 - this.setData({  
97 - backfill: this.data.suggestion[i].title  
98 - });  
99 - this.setSuggestion({fun:'setSuggestion',suggestion:this.data.suggestion[i]})  
100 - wx.navigateBack();  
101 - break;  
102 - }  
103 - } 57 +
  58 + /**
  59 + * 页面上拉触底事件的处理函数
  60 + */
  61 + onReachBottom: function () {
  62 +
104 }, 63 },
105 - inputVal:'',  
106 - //触发关键词输入提示事件  
107 - getsuggest: function (e) {  
108 - //调用关键词提示接口  
109 - this.inputVal=e.detail.value;  
110 - if(this.inputVal.length<1){  
111 - return this.setData({  
112 - suggestion: [],  
113 - keyword:''  
114 - })  
115 - }  
116 - let prarms={  
117 - keyword:this.inputVal,  
118 - region:this.location.city||'',  
119 - region_fix:0,  
120 - page_size:20,  
121 - page_index:1,  
122 - key:map_key,  
123 - }  
124 - if(this.location.latitude){  
125 - prarms.location=this.location.latitude+','+this.location.longitude 64 +
  65 + /**
  66 + * 用户点击右上角分享
  67 + */
  68 + onShareAppMessage: function () {
  69 + return{
  70 + title:'请客订包间,就上周到安排'
126 } 71 }
127 - App.Customer.KeywordTips(prarms).then(res=>{  
128 - if(this.inputVal.length<1){  
129 - return this.setData({  
130 - suggestion: []  
131 - })  
132 - }  
133 - var sug = [],hasSellerMore=false,sellerSplit=-1  
134 - try{  
135 - res.data=res.data.data  
136 - if(res.data instanceof Array){  
137 - for (var i = 0; i < res.data.length; i++) {  
138 - if(i==2 && res.data[i].type==-1){  
139 - hasSellerMore=true  
140 - continue;  
141 - }  
142 - if((i==1 || i==2) && res.data[i-1].type==-1 && res.data[i].type!=-1){  
143 - sellerSplit=i-1  
144 - }  
145 - let item=res.data[i]  
146 - item.latitude=item.location.lat  
147 - item.longitude=item.location.lng  
148 - item.addr=item.address  
149 - item.titles=item.title.match(new RegExp('(.*)('+this.inputVal+')(.*)'))  
150 - sug.push(item);  
151 - }  
152 - }  
153 - }catch(e){}  
154 - this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示  
155 - suggestion: sug,  
156 - hasSellerMore:hasSellerMore,  
157 - keyword:this.inputVal,  
158 - sellerSplit:sellerSplit,  
159 - });  
160 - })  
161 }, 72 },
162 - nearby_search: function () {  
163 - App.Customer.SearchMap({  
164 - boundary:'region('+this.location.city+',1)',  
165 - //boundary:'nearby('+this.location.latitude+','+this.location.longitude+',1000,1)',  
166 - location:this.location.latitude+','+this.location.longitude,  
167 - keyword:this.inputVal,  
168 - page_size:20,  
169 - page_index:1,  
170 - orderby:'_distance',  
171 - key:map_key,  
172 - }).then(res=>{  
173 - var mks = []  
174 - for (var i = 0; i < res.data.length; i++) {  
175 - mks.push({ // 获取返回结果,放到mks数组中  
176 - title: res.data[i].title,  
177 - id: res.data[i].id,  
178 - addr: res.data[i].address,  
179 - city: res.data[i].city,  
180 - district: res.data[i].district,  
181 - latitude: res.data[i].location.lat,  
182 - longitude: res.data[i].location.lng,  
183 - type:res.data[i].type,  
184 - category:res.data[i].category,  
185 - })  
186 - }  
187 - this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示  
188 - suggestion:mks,  
189 - });  
190 - })  
191 - },  
192 - location:'',  
193 - onpos(e){  
194 - console.log(e);  
195 - this.location=e.detail  
196 - this.GetRecommendSellerLists()  
197 - this.getCity() 73 + dispalySearchHow(){
  74 + this.selectComponent('#search-how').show();
198 }, 75 },
199 - getCity(){  
200 - qqmapsdk.reverseGeocoder({  
201 - location:this.location,  
202 - success:(res)=>{  
203 - this.location['city']='';  
204 - if(res.status==0){  
205 - this.location['city']=res.result.ad_info.city  
206 - }  
207 - },  
208 - })  
209 - },  
210 - gotoList(){  
211 - wx.navigateTo({  
212 - url:util.http_build_query({  
213 - lat:this.location.latitude,  
214 - lng:this.location.longitude,  
215 - keyword:this.inputVal,  
216 - multiIndex:0,  
217 - },'./indexList') 76 + howEvent(e){
  77 + console.log('howEvent',e.detail)
  78 + //this.eventChannel.emit('findSellerData',e.detail)
  79 + this.findSellerData=e.detail
  80 + this.setData({
  81 + findSellerData:e.detail
218 }) 82 })
219 - },  
220 - searchItemClick(e){  
221 - //console.log('searchItemClick',e)  
222 - let item=e.detail.data  
223 - if(e.detail.act=='detail'){  
224 - if(item.type==-1){  
225 - wx.navigateTo({  
226 - url:util.http_build_query({  
227 - id:item.id,  
228 - },'./detail')  
229 - })  
230 - }else{  
231 - //let pages = getCurrentPages();  
232 - //let p = pages[pages.length - 2];  
233 - //p.setSuggestion(item)  
234 - this.setSuggestion({fun:'setSuggestion',suggestion:item})  
235 - this.setData({  
236 - backfill: item.title  
237 - });  
238 - wx.navigateBack();  
239 - }  
240 - }else{  
241 - wx.navigateTo({  
242 - url:util.http_build_query({  
243 - id:item.id,  
244 - activeTab:'reserve',  
245 - },'./detail') 83 + //setTimeout(()=>{this.getList();},0)
  84 + this.selectComponent('#search-how').hide();
  85 + },
  86 + dispalyLocation(){
  87 + this.selectComponent('#location').show();
  88 + },
  89 + meLocation(){
  90 + this.selectComponent('#location').rePos({currentTarget:{dataset:{isAddr:true}}});
  91 + },
  92 + GetRecomList(){
  93 + App.Customer.GetRecomList({
  94 + pid:this.city.pid,
  95 + code:this.city.code,
  96 + lat:this.position.latitude,
  97 + lng:this.position.longitude,
  98 + offset:1,
  99 + size:100
  100 + }).then(res=>{
  101 + this.setData({
  102 + sellers:res.data,
246 }) 103 })
247 - } 104 + })
248 }, 105 },
249 - historyEmpty(){  
250 - App.Customer.DelHistorySearch().then(()=>{  
251 - App.Customer.GetHistorySearch({},'clear') 106 + locationEvent(e){
  107 + console.log('locationEvent',e.detail)
  108 + this.city=e.detail.city
  109 + this.position=e.detail.position
  110 + this.setData({
  111 + location:e.detail.isAddr?e.detail.address:e.detail.city.name,
  112 + IsSetActivityByFoods:false,
  113 + sellers:[],
  114 + })
  115 + App.Customer.IsSetActivityByFoods({
  116 + pid:this.city.pid,
  117 + code:this.city.code,
  118 + }).then(res=>{
252 this.setData({ 119 this.setData({
253 - history:[] 120 + IsSetActivityByFoods:res.data,
254 }) 121 })
255 }) 122 })
  123 + this.GetRecomList()
256 }, 124 },
257 - clearKeyword(){ 125 + filterParams:null,
  126 + displayFilter(){
  127 + this.selectComponent('#filter').show(this.filterParams);
258 this.setData({ 128 this.setData({
259 - keyword:'',  
260 - suggestion:[], 129 + hasFilter:true,
261 }) 130 })
262 }, 131 },
263 - GetRecommendSellerLists(){  
264 - if(!this.location.latitude) return;  
265 - let param={}  
266 - param={  
267 - lat:this.location.latitude,  
268 - lng:this.location.longitude  
269 - }  
270 - App.Customer.GetRecommendSellerLists(param).then(res=>{ 132 + filterEvent(e){
  133 + console.log('filterEvent',e.detail)
  134 + if(e.detail.type=='set'){
  135 + this.filterParams=e.detail.data
271 this.setData({ 136 this.setData({
272 - rsl:res.data 137 + hasFilter:false,
  138 + consumeStr:e.detail.data.consumeStr,
  139 + })
  140 + }else{
  141 + this.filterParams=null;
  142 + this.setData({
  143 + hasFilter:false,
  144 + consumeStr:'',
273 }) 145 })
274 - })  
275 - },  
276 - hasGoto:false,  
277 - bindtransition(e){  
278 - console.log(e)  
279 - if('change'==e.type){  
280 - this.hasGoto=false  
281 - }  
282 - if('animationfinish'==e.type){  
283 - if(this.hasGoto && (e.detail.current+1)==this.data.rsl.length){  
284 - wx.switchTab({  
285 - url: '/pages/reserve/index'  
286 - })  
287 - return;  
288 - }else{  
289 - this.hasGoto=true  
290 - }  
291 } 146 }
292 }, 147 },
293 - gotoSellerDetail(e){  
294 - let url='/pages/reserve/detail?id='+e.currentTarget.id 148 + goPath(e){
  149 + let path=util.attr(e,'path');
295 wx.navigateTo({ 150 wx.navigateTo({
296 - url:url, 151 + url:util.http_build_query({
  152 + filter:this.filterParams?JSON.stringify(this.filterParams):null,
  153 + city:JSON.stringify(this.city),
  154 + hows:JSON.stringify(this.findSellerData),
  155 + },path)
297 }) 156 })
298 }, 157 },
299 - sbtrEvent(e){  
300 - console.log(e);  
301 - if(e.detail.act=='oncall'){ 158 + sellerCardEvent(e){
  159 + if(e.detail.type=='phone'){
302 this.selectComponent('#as').show(e.detail.seller); 160 this.selectComponent('#as').show(e.detail.seller);
303 } 161 }
304 }, 162 },
305 - setSuggestion(data){//只通知前页变更数据  
306 - /*  
307 - let pages = getCurrentPages();  
308 - let p = pages[pages.length - 2];  
309 - if(p.route=='pages/reserve/index'){  
310 - PubSub.emit('searchParam',data)  
311 - }else{  
312 - PubSub.emit('searchParamList',data)  
313 - }  
314 - */  
315 - let suggestion=data.suggestion  
316 - wx.navigateTo({  
317 - url:util.http_build_query({  
318 - hasSuggestion:1,  
319 - keyword:suggestion.title,  
320 - lat:suggestion.latitude,  
321 - lng:suggestion.longitude,  
322 - centre_pos:`${suggestion.latitude},${suggestion.longitude}`,  
323 - multiIndex:0,  
324 - },'/pages/reserve/indexList')  
325 - })  
326 - },  
327 }) 163 })
1 { 1 {
2 "navigationBarBackgroundColor": "#ffffff", 2 "navigationBarBackgroundColor": "#ffffff",
3 - "navigationBarTextStyle": "black", 3 + "navigationBarTextStyle": "white",
4 "navigationBarTitleText":"周到安排", 4 "navigationBarTitleText":"周到安排",
5 "usingComponents": { 5 "usingComponents": {
6 - "formids":"/components/formids/formids",  
7 - "getpos":"/components/userinfo/getpos",  
8 - "nav":"/components/nav/nav",  
9 - "search-item":"/components/reserve/search/item",  
10 - "as-phone":"/components/actionSheet/phone",  
11 - "sb-tr":"/components/reserve/seller-box-transverse/seller-box" 6 + "search-how":"/components/2.0/filter/how/index",
  7 + "location":"/components/2.0/filter/location",
  8 + "filter":"/components/2.0/filter/filter",
  9 + "seller-card":"/components/2.0/seller/card",
  10 + "as-phone":"/components/2.0/dialog/phone"
12 } 11 }
13 } 12 }
1 -<!--pages/reserve/search.wxml-->  
2 -<nav id="nav">搜索</nav>  
3 -<view class="searchAddrView" style="height: {{navHeight+40}}px;">  
4 - <view class="searchAddr flex-ll" style="margin-top: {{navHeight+5}}px;">  
5 - <image class="icon" src="http://nosqn.colorcun.com/custom/lite-online/image/search26.png"></image>  
6 - <input style="width: 100%;" placeholder="输入餐厅名或地名,快速订包间"  
7 - type="text" confirm-type="done"  
8 - focus  
9 - bindinput="getsuggest" value="{{keyword}}"/>  
10 - <image class="icon icon-del" wx:if="{{keyword.length>0}}"  
11 - catchtap="clearKeyword"  
12 - src="http://nosqn.colorcun.com/reserve/images/del.png"></image>  
13 - </view>  
14 -</view>  
15 -<view class="pages">  
16 - <view class="res-view">  
17 - <!--绑定回填事件-->  
18 - <block wx:for="{{suggestion}}" wx:key="index"  
19 - bindtap="backfill" id="{{index}}">  
20 - <search-item item="{{item}}" keyword="{{keyword}}" bindclick="searchItemClick"></search-item>  
21 - <view wx:if="{{index==1 && hasSellerMore}}" class="see-more" bindtap="gotoList"></view>  
22 - <view wx:if="{{index==sellerSplit && sellerSplit>-1}}" class="see-split"></view>  
23 - </block>  
24 - <view class="see-more bottom" wx:if="{{suggestion.length>0}}"></view>  
25 - </view> 1 +<!--pages/reserve/home.wxml-->
  2 +<view class="view header">
  3 + <image src="http://nosqn.colorcun.com/search/s%20%281%29.png"
  4 + style="z-index: 1"
  5 + mode="widthFix" class="bg-img"></image>
26 </view> 6 </view>
27 -<view class="history" wx:if="{{suggestion.length<1}}">  
28 - <view wx:if="{{keyword.length>0}}">  
29 - <view class="flex-vc empty">  
30 - <block wx:if="{{!hasFirstShow}}">  
31 - <image src="http://nosqn.colorcun.com/custom/lite-online/image/follow-empty.png"></image>  
32 - <view class="empty-t1">抱歉,没有找到符合的内容</view>  
33 - <view class="empty-t2">试试搜搜别的</view>  
34 - </block> 7 +<view class="view search margin-lr padding-top-0 padding-lr-lg padding-bottom-lg">
  8 + <view class="view solid-bottom flex justify-around align-center" style="height: 110rpx;">
  9 + <view bindtap="dispalyLocation"
  10 + class="view flex-treble text-bold text-xl text-cut margin-right-lg">
  11 + {{location}}
35 </view> 12 </view>
36 - <view class="rsl-block" wx:if="{{rsl.length>0}}">  
37 - <view class="line-push">为你推荐</view>  
38 - <view class="transverse-list">  
39 - <swiper  
40 - indicator-dots="{{false}}" autoplay="{{false}}" circular="{{false}}" vertical="{{false}}"  
41 - interval="2000" duration="500"  
42 - previous-margin="{{15}}px" next-margin="{{15}}px" style="height: 350rpx;"  
43 - current="{{current}}" bindchange="bindtransition" bindanimationfinish="bindtransition">  
44 - <block wx:for="{{rsl}}" wx:key="rsl.key">  
45 - <swiper-item bindtap="gotoSellerDetail" id="{{item.id}}">  
46 - <view class="seller" id="seller-{{item.id}}">  
47 - <sb-tr seller="{{item}}"  
48 - hasInSwiper bindevent="sbtrEvent"  
49 - hasActivityTags="{{false}}"  
50 - hasActivityShort="{{true}}"  
51 - hasBrand="true" hasActivityTese="true"  
52 - hasSlogan="{{false}}"></sb-tr>  
53 - </view>  
54 - </swiper-item>  
55 - </block>  
56 - </swiper>  
57 - </view> 13 + <view class="view flex flex-direction align-center justify-center" bindtap="meLocation">
  14 + <view class="view posicon"></view>
  15 + <view class="view text-blue txt-24-h" style="margin-top: 4rpx;">我的位置</view>
58 </view> 16 </view>
59 </view> 17 </view>
60 - <view class="pages" wx:elif="{{history.length>0}}">  
61 - <view class="flex-lr">  
62 - <view class="history-title">最近搜索</view>  
63 - <view class="history-empty" bindtap="historyEmpty"></view>  
64 - </view>  
65 - <view class="history-list">  
66 - <block wx:for="{{history}}" wx:key="history.key">  
67 - <search-item item="{{item}}" hasHistory bindclick="searchItemClick"></search-item>  
68 - </block> 18 + <view class="view solid-bottom flex justify-around align-center" style="height: 110rpx;" bindtap="dispalySearchHow">
  19 + <view class="flex-treble txt-36-h text-bold">{{findSellerData.paramStr||'周到安排(今天) 晚餐 4位'}}</view>
  20 + <view class="more"></view>
  21 + </view>
  22 + <view class="view solid-bottom flex justify-around align-center"
  23 + bindtap="goPath" data-path="/pages/reserve/searchKeyword"
  24 + style="height: 110rpx;">
  25 + <view class="flex-treble txt-32-h text-gray">搜索餐厅/位置/关键词</view>
  26 + <view class="more"></view>
  27 + </view>
  28 + <view class="view flex justify-around align-center" style="height: 110rpx;" bindtap="displayFilter">
  29 + <view class="flex-treble txt-32-h {{consumeStr?'':'text-gray'}}">{{consumeStr||'人均消费'}}</view>
  30 + <view class="more"></view>
  31 + </view>
  32 + <view class="view flex justify-around align-center round bg-blue-blue text-bold"
  33 + bindtap="goPath" data-path="/pages/reserve/indexList"
  34 + style="height: 84rpx;">
  35 + 查找包间
  36 + </view>
  37 +</view>
  38 +<view wx:if="{{IsSetActivityByFoods}}" class="margin-top-lg padding-lr-lg padding-top-lg" bindtap="goPath"
  39 + data-path="/pages/reserve/discount">
  40 + <view class="txt-40-h text-bold margin-bottom">精选特惠</view>
  41 + <view class="flex justify-center align-center">
  42 + <view class="view youhui-image image1" style=""></view>
  43 + <view class="margin-left-xs">
  44 + <view class="view youhui-image image2"></view>
  45 + <view class="view youhui-image image3 margin-top-xs"></view>
69 </view> 46 </view>
70 </view> 47 </view>
71 </view> 48 </view>
72 -<getpos bindpos="onpos" id="getpos" hasAllowFail></getpos> 49 +<view wx:if="{{sellers.length>0}}" class="margin-tb-lg padding-tb-lg">
  50 + <view class="txt-40-h text-bold margin-bottom margin-lr-lg">为你推荐</view>
  51 + <view wx:for="{{sellers}}" wx:key="sellers" class="margin-lr-sm" >
  52 + <navigator url="/pages/reserve/detail?id={{item.id}}" hover-class="navigator-hover">
  53 + <seller-card class="seller-card" id="seller-{{item.id}}"
  54 + activeSellerID="{{activeSellerID}}"
  55 + seller="{{item}}" bindevent="sellerCardEvent" ></seller-card>
  56 + </navigator>
  57 + </view>
  58 +</view>
  59 +<view style="height: 150rpx;"></view>
  60 +<search-how id="search-how" findSellerData="{{findSellerData}}" bindevent="howEvent"></search-how>
  61 +<location id="location" bindevent="locationEvent"></location>
  62 +<view class="view filter-mask" hidden="{{!hasFilter}}">
  63 + <view class="view filter">
  64 + <filter id="filter" bindevent="filterEvent" cla="bottom-search"></filter>
  65 + </view>
  66 +</view>
73 <as-phone id="as"></as-phone> 67 <as-phone id="as"></as-phone>
1 -/* pages/reserve/search.wxss */  
2 -.pages{  
3 - width: 90%;  
4 - margin: 5% auto;  
5 - color:#353535;  
6 -}  
7 -.searchAddrView{  
8 - position: fixed;  
9 - top:0rpx;  
10 - width: 100%;  
11 - height: 240rpx;  
12 - background-color: #ffffff;  
13 - z-index: 9;  
14 -}  
15 -.searchAddr {  
16 - width: 90%;  
17 - height: 60rpx;  
18 - background-color: #F5F5F5;  
19 - border-radius: 30rpx;  
20 - line-height: 60rpx;  
21 - color:#999999;  
22 - line-height: 60rpx;  
23 - font-size: 28rpx;  
24 - margin:0 auto;  
25 -}  
26 -.searchAddr .icon{  
27 - min-width: 26rpx;  
28 - width:26rpx;  
29 - height: 26rpx;  
30 - margin: 0 20rpx;  
31 -}  
32 -.searchAddr .icon-del{  
33 - min-width: 28rpx;  
34 - width: 28rpx;  
35 - height: 28rpx;  
36 -}  
37 -.res-view{  
38 - margin-top: 120rpx; 1 +/* pages/reserve/home.wxss */
  2 +@import "../../colorui/main.wxss";
  3 +.header{
  4 + position: relative;
  5 + width: 100%;
  6 +}
  7 +.bg-img{
  8 + width: 100%;
  9 +}
  10 +.header:before{
  11 + width: calc(100% - 60rpx);
  12 + left:30rpx;
  13 + top:280rpx;
  14 + height: 558rpx;
  15 + background: #FFFFFF;
  16 + box-shadow: 0px 0px 30rpx 0px #E5E5E5;
  17 + border-radius: 20rpx;
  18 + display: block;
  19 + content: "";
  20 + position: absolute;
  21 +}
  22 +.header:after{
  23 + display: block;
  24 + content: "";
  25 + position: absolute;
  26 + width: 100%;
  27 + height: 286rpx;
  28 + top:60rpx;
  29 + background-image: url("http://nosqn.colorcun.com/search/s%20%282%29.png");
  30 + background-size: auto 100%;
  31 + background-position: center center;
  32 + background-repeat: no-repeat;
  33 + z-index: 1;
  34 +}
  35 +.search{
  36 + width: calc(100% - 60rpx);
  37 + height: 558rpx;
  38 + background: #fff;
  39 + border-radius: 20rpx;
  40 + position: relative;
  41 + z-index: 2;
  42 + margin-top: -330rpx;
  43 +}
  44 +.posicon{
  45 + background-image: url("http://nosqn.colorcun.com/search/s%20%283%29.png");
  46 + width: 36rpx;
  47 + height: 36rpx;
  48 +}
  49 +.filter-mask{
  50 + background-color: rgba(0,0,0,0.5);
  51 + width: 100%;
  52 + height: 100%;
  53 + position: fixed;
  54 + z-index: 99999;
  55 + bottom:0;
  56 + left:0;
  57 +}
  58 +.filter{
  59 + position: relative;
  60 + /*margin-top: calc(100% + 30rpx);*/
  61 + top:calc(100vh - 550rpx);
  62 +}
  63 +.image1{
  64 + background-image: url("http://nosqn.colorcun.com/search/s%20%285%29.png");
  65 + width: 330rpx;
  66 + height: 346rpx;
  67 +}
  68 +.image2{
  69 + background-image: url("http://nosqn.colorcun.com/search/s%20%286%29.png");
  70 + width: 330rpx;
  71 + height: 168rpx;
  72 +}
  73 +.image3{
  74 + background-image: url("http://nosqn.colorcun.com/search/s%20%287%29.png");
  75 + width: 330rpx;
  76 + height: 168rpx;
  77 +}
  78 +.youhui-image{
  79 + position: relative;
  80 +}
  81 +.youhui-image:before{
  82 + position: absolute;
  83 + height: 50rpx;
  84 + font-size: 36rpx;
  85 + font-family: PingFangSC-Semibold, PingFang SC;
  86 + font-weight: 600;
  87 + color: #FFFFFF;
  88 + line-height: 50rpx;
  89 + top:20rpx;
  90 + left: 20rpx;
  91 + content: "";
  92 + display: block;
  93 +}
  94 +.youhui-image:after{
  95 + position: absolute;
  96 + height: 34rpx;
  97 + font-size: 24rpx;
  98 + font-family: PingFangSC-Regular, PingFang SC;
  99 + font-weight: 400;
  100 + color: #FFFFFF;
  101 + line-height: 34rpx;
  102 + top:70rpx;
  103 + left: 20rpx;
  104 + content: "";
  105 + display: block;
  106 +}
  107 +.image1:before{
  108 + content: "预订买单更优惠";
  109 +}
  110 +.image1:after{
  111 + content: "100+优质餐厅";
39 } 112 }
40 113
41 -.search-but{  
42 - min-width: 140rpx;  
43 - color:#000000;  
44 - border-left: 2rpx solid #cccccc;  
45 - text-align: center;  
46 - height: 32rpx;  
47 - line-height: 32rpx;  
48 -  
49 -}  
50 -.history{  
51 - margin-top: 140rpx; 114 +.image2:before{
  115 + content: "百万补贴来袭";
52 } 116 }
53 -.history .history-title{  
54 - font-size: 28rpx;  
55 - color:#353535;  
56 - height: 40rpx;  
57 - line-height: 40rpx;  
58 - font-weight:600;  
59 - margin-bottom: 20rpx; 117 +.image2:after{
  118 + content: "限时特惠";
60 } 119 }
61 120
62 -.see-more{  
63 - width: 100%;  
64 - height: 34rpx;  
65 - position: relative;  
66 - margin-bottom: 40rpx;  
67 - margin-top: 40rpx;  
68 -}  
69 -.see-more:before{  
70 - content: "";  
71 - width: 100%;  
72 - height: 2rpx;  
73 - background-color: #F5F5F5;  
74 - position: absolute;  
75 - left: 0;  
76 - top:17rpx;  
77 -}  
78 -.see-more:after{  
79 - content: "查看更多";  
80 - width:136rpx;  
81 - height:34rpx;  
82 - font-size:24rpx;  
83 - color:rgba(153,153,153,1);  
84 - line-height:34rpx;  
85 - background-color: #fefefe;  
86 - position: absolute;  
87 - display: block;  
88 - left:calc(50% - 68rpx);  
89 - top:0;  
90 - text-align: center;  
91 -}  
92 -.see-more.bottom:after{  
93 - width:200rpx;  
94 - content: "我是有底线的";  
95 - left:calc(50% - 100rpx);  
96 -}  
97 -.see-more.bottom{  
98 - padding-bottom: 40rpx;  
99 -}  
100 -.see-split{  
101 - width: 100%;  
102 - height: 20rpx;  
103 -}  
104 -.history-empty{  
105 - width: 28rpx;  
106 - height: 28rpx;  
107 - background-image: url("http://nosqn.colorcun.com/reserve/images/empty.png");  
108 - background-size: 100% 100%; 121 +.image3:before{
  122 + content: "超值套餐";
109 } 123 }
110 -  
111 -.empty{margin-top: 150rpx; color: #353535}  
112 -.empty image{  
113 - width: 191px;  
114 - height: 158px;  
115 -}  
116 -.empty .empty-t1{  
117 - font-size: 28rpx;  
118 - margin-top: 60rpx;  
119 - height:40px;  
120 - line-height:40px;  
121 -}  
122 -.empty .empty-t2{  
123 - font-size: 28rpx;  
124 - margin-top: 20rpx;  
125 - height:40px;  
126 - line-height:40px;  
127 -}  
128 -  
129 -.line-push{  
130 - background-image: url("http://nosqn.colorcun.com/reserve/images/line-push.png");  
131 - width: 328rpx;  
132 - height: 42rpx;  
133 - background-size: 100% 24rpx;  
134 - margin: 0 auto;  
135 - font-size:30rpx;  
136 - color: #C0A369;  
137 - line-height: 24rpx;  
138 - background-repeat: no-repeat;  
139 - text-align: center;  
140 - margin-bottom: 60rpx;  
141 -}  
142 -.rsl-block{  
143 - position: fixed;  
144 - bottom: 0rpx;  
145 - width: 100%;  
146 -}  
147 -.transverse-list{  
148 - background-color: #fefefe;  
149 - width: 100%;  
150 -}  
151 -.transverse-list .seller{  
152 - width: 98%;  
153 - margin: 0 auto; 124 +.image3:after{
  125 + content: "包间可用";
154 } 126 }
  1 +// pages/reserve/search.js\
  2 +const map_key='SDEBZ-I74W4-QLGUX-XXYXU-HIR23-3QFBJ'
  3 +// 引入SDK核心类
  4 +var QQMapWX = require('../../utils/qqmap-wx-jssdk');
  5 +// 实例化API核心类
  6 +var qqmapsdk = new QQMapWX({
  7 + key:map_key // 必填
  8 +});
  9 +import util from '../../utils/util';
  10 +import App from '../../utils/api';
  11 +import PubSub from '../../utils/PubSub'
  12 +Page({
  13 +
  14 + /**
  15 + * 页面的初始数据
  16 + */
  17 + data: {
  18 + history:[],
  19 + suggestion:[],
  20 + hasSellerMore:false,
  21 + keyword:'',
  22 + sellerSplit:-1,
  23 + navHeight:100,
  24 + },
  25 +
  26 + /**
  27 + * 生命周期函数--监听页面加载
  28 + */
  29 + onLoad: function (options) {
  30 + //filter=null&city={"code":"610100","pid":"610000","name":"西安市","status":"1","last_date":"1598949575"}&hows={"params":{"pnum":{"index":3,"val":4,"type":"pnum"},"date":{"index":0,"val":1606979898,"type":"date"},"dur":{"index":2,"val":3,"type":"dur"}},"paramObj":{"when_date":"2020-12-03","several":4,"daily":3},"paramStr":"12月03日(今天)晚餐 4位"}
  31 + console.log('searchKeyword',options)
  32 + this.options=options
  33 + this.city=JSON.parse(options.city)
  34 + this.selectComponent('#getpos').getPos();
  35 + },
  36 +
  37 + /**
  38 + * 生命周期函数--监听页面初次渲染完成
  39 + */
  40 + onReady: function () {
  41 +
  42 + },
  43 +
  44 + /**
  45 + * 生命周期函数--监听页面显示
  46 + */
  47 + onShow: function () {
  48 + PubSub.emit('custom-tab-bar')
  49 + this.getHistory();
  50 + this.setData({
  51 + navHeight:this.selectComponent('#nav').getHeight()
  52 + })
  53 +
  54 + },
  55 +
  56 + /**
  57 + * 生命周期函数--监听页面隐藏
  58 + */
  59 + onHide: function () {
  60 +
  61 + },
  62 +
  63 + /**
  64 + * 生命周期函数--监听页面卸载
  65 + */
  66 + onUnload: function () {
  67 +
  68 + },
  69 + getHistory(){
  70 + //this.city=util.cache('CACHE_LOCALTION_KEY')
  71 + App.Customer.GetHistorySearch().then(res=>{
  72 + let mks=[]
  73 + res.data.forEach(h=>{
  74 + mks.push({ // 获取返回结果,放到mks数组中
  75 + title: h.name,
  76 + id: h.sid,
  77 + addr: '',
  78 + city: '',
  79 + district: 0,
  80 + latitude: h.latitude,
  81 + longitude: h.longitude,
  82 + type:h.type==1?-1:h.type,
  83 + })
  84 + })
  85 + this.setData({
  86 + history:mks
  87 + })
  88 + })
  89 + },
  90 + //在Page({})中使用下列代码
  91 + //数据回填方法
  92 + backfill: function (e) {
  93 + var id = e.currentTarget.id;
  94 + for (var i = 0; i < this.data.suggestion.length; i++) {
  95 + if (i == id) {
  96 + console.log('backfill,this.data.suggestion[i]:',this.data.suggestion[i])
  97 + // let pages = getCurrentPages();
  98 + // let p = pages[pages.length - 2];
  99 + // p.setSuggestion(this.data.suggestion[i])
  100 + //util.cache('suggestion',this.data.suggestion[i]);
  101 + this.setData({
  102 + backfill: this.data.suggestion[i].title
  103 + });
  104 + this.setSuggestion({fun:'setSuggestion',suggestion:this.data.suggestion[i]})
  105 + wx.navigateBack();
  106 + break;
  107 + }
  108 + }
  109 + },
  110 + inputVal:'',
  111 + //触发关键词输入提示事件
  112 + getsuggest: function (e) {
  113 + //调用关键词提示接口
  114 + this.inputVal=e.detail.value;
  115 + if(this.inputVal.length<1){
  116 + return this.setData({
  117 + suggestion: [],
  118 + keyword:''
  119 + })
  120 + }
  121 + let prarms={
  122 + keyword:this.inputVal,
  123 + region:this.location.city||'',
  124 + region_fix:1,
  125 + page_size:20,
  126 + page_index:1,
  127 + key:map_key,
  128 + }
  129 + if(this.city){
  130 + prarms.name=this.city.name
  131 + prarms.code=this.city.code
  132 + prarms.pid=this.city.pid
  133 + }
  134 + if(this.location.latitude){
  135 + prarms.location=this.location.latitude+','+this.location.longitude
  136 + }
  137 + App.Customer.KeywordTips(prarms).then(res=>{
  138 + if(this.inputVal.length<1){
  139 + return this.setData({
  140 + suggestion: []
  141 + })
  142 + }
  143 + var sug = [],hasSellerMore=false,sellerSplit=-1
  144 + try{
  145 + res.data=res.data.data
  146 + if(res.data instanceof Array){
  147 + for (var i = 0; i < res.data.length; i++) {
  148 + if(i==2 && res.data[i].type==-1){
  149 + hasSellerMore=true
  150 + continue;
  151 + }
  152 + if((i==1 || i==2) && res.data[i-1].type==-1 && res.data[i].type!=-1){
  153 + sellerSplit=i-1
  154 + }
  155 + let item=res.data[i]
  156 + item.latitude=item.location.lat
  157 + item.longitude=item.location.lng
  158 + item.addr=item.address
  159 + item.titles=item.title.match(new RegExp('(.*)('+this.inputVal+')(.*)'))
  160 + sug.push(item);
  161 + }
  162 + }
  163 + }catch(e){}
  164 + this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示
  165 + suggestion: sug,
  166 + hasSellerMore:hasSellerMore,
  167 + keyword:this.inputVal,
  168 + sellerSplit:sellerSplit,
  169 + });
  170 + })
  171 + },
  172 + nearby_search: function () {
  173 + App.Customer.SearchMap({
  174 + boundary:'region('+this.location.city+',1)',
  175 + //boundary:'nearby('+this.location.latitude+','+this.location.longitude+',1000,1)',
  176 + location:this.location.latitude+','+this.location.longitude,
  177 + keyword:this.inputVal,
  178 + page_size:20,
  179 + page_index:1,
  180 + orderby:'_distance',
  181 + key:map_key,
  182 + }).then(res=>{
  183 + var mks = []
  184 + for (var i = 0; i < res.data.length; i++) {
  185 + mks.push({ // 获取返回结果,放到mks数组中
  186 + title: res.data[i].title,
  187 + id: res.data[i].id,
  188 + addr: res.data[i].address,
  189 + city: res.data[i].city,
  190 + district: res.data[i].district,
  191 + latitude: res.data[i].location.lat,
  192 + longitude: res.data[i].location.lng,
  193 + type:res.data[i].type,
  194 + category:res.data[i].category,
  195 + })
  196 + }
  197 + this.setData({ //设置suggestion属性,将关键词搜索结果以列表形式展示
  198 + suggestion:mks,
  199 + });
  200 + })
  201 + },
  202 + location:'',
  203 + onpos(e){
  204 + console.log(e);
  205 + this.location=e.detail
  206 + this.GetRecommendSellerLists()
  207 + this.getCity()
  208 + },
  209 + getCity(){
  210 + qqmapsdk.reverseGeocoder({
  211 + location:this.location,
  212 + success:(res)=>{
  213 + this.location['city']='';
  214 + if(res.status==0){
  215 + this.location['city']=res.result.ad_info.city
  216 + }
  217 + },
  218 + })
  219 + },
  220 + gotoList(){
  221 + wx.navigateTo({
  222 + url:util.http_build_query({
  223 + lat:this.location.latitude,
  224 + lng:this.location.longitude,
  225 + keyword:this.inputVal,
  226 + multiIndex:0,
  227 + city:this.options.city,
  228 + hows:this.options.hows,
  229 + filter:this.options.filter,
  230 + },'./indexList')
  231 + })
  232 + },
  233 + searchItemClick(e){
  234 + //console.log('searchItemClick',e)
  235 + let item=e.detail.data
  236 + if(e.detail.act=='detail'){
  237 + if(item.type==-1){
  238 + wx.navigateTo({
  239 + url:util.http_build_query({
  240 + id:item.id,
  241 + },'./detail')
  242 + })
  243 + }else{
  244 + this.setSuggestion({fun:'setSuggestion',suggestion:item})
  245 + }
  246 + }else{
  247 + wx.navigateTo({
  248 + url:util.http_build_query({
  249 + id:item.id,
  250 + activeTab:'reserve',
  251 + },'./detail')
  252 + })
  253 + }
  254 + },
  255 + historyEmpty(){
  256 + App.Customer.DelHistorySearch().then(()=>{
  257 + App.Customer.GetHistorySearch({},'clear')
  258 + this.setData({
  259 + history:[]
  260 + })
  261 + })
  262 + },
  263 + clearKeyword(){
  264 + this.setData({
  265 + keyword:'',
  266 + suggestion:[],
  267 + })
  268 + },
  269 + GetRecommendSellerLists(){
  270 + if(!this.location.latitude) return;
  271 + let param={}
  272 + param={
  273 + lat:this.location.latitude,
  274 + lng:this.location.longitude
  275 + }
  276 + App.Customer.GetRecommendSellerLists(param).then(res=>{
  277 + this.setData({
  278 + rsl:res.data
  279 + })
  280 + })
  281 + },
  282 + hasGoto:false,
  283 + bindtransition(e){
  284 + console.log(e)
  285 + if('change'==e.type){
  286 + this.hasGoto=false
  287 + }
  288 + if('animationfinish'==e.type){
  289 + if(this.hasGoto && (e.detail.current+1)==this.data.rsl.length){
  290 + wx.switchTab({
  291 + url: '/pages/reserve/index'
  292 + })
  293 + return;
  294 + }else{
  295 + this.hasGoto=true
  296 + }
  297 + }
  298 + },
  299 + gotoSellerDetail(e){
  300 + let url='/pages/reserve/detail?id='+e.currentTarget.id
  301 + wx.navigateTo({
  302 + url:url,
  303 + })
  304 + },
  305 + sbtrEvent(e){
  306 + console.log(e);
  307 + if(e.detail.act=='oncall'){
  308 + this.selectComponent('#as').show(e.detail.seller);
  309 + }
  310 + },
  311 + async hasInCity(suggestion){
  312 + return new Promise((success,fail)=>{
  313 + if(this.city){
  314 + qqmapsdk.reverseGeocoder({
  315 + location: {
  316 + latitude: suggestion.latitude,
  317 + longitude: suggestion.longitude
  318 + },
  319 + success:(res)=>{
  320 + if(res.status!=0) return success({flag:true,'msg':'1001'})
  321 + console.log('qqmapsdk.reverseGeocoder',res.result.address_component.city,this.city.name)
  322 + if(res.result.address_component.city==this.city.name){
  323 + return success({flag:true,msg:''})
  324 + }
  325 + success({flag:false,msg:''})
  326 + },
  327 + fail:()=>{
  328 + success({flag:true,msg:'1002'})
  329 + },
  330 + })
  331 + }else{
  332 + success({flag:true,msg:'1003'})
  333 + }
  334 + })
  335 + },
  336 + async setSuggestion(data){//只通知前页变更数据
  337 + let suggestion=data.suggestion
  338 + //地址解析
  339 + wx.showLoading()
  340 + let hasInCity=await this.hasInCity(suggestion)
  341 + console.log('hasInCity',hasInCity)
  342 + if(!hasInCity.flag){
  343 + return setTimeout(()=>{
  344 + util.toast('该位置不在当前城市,建议换个位置','none');
  345 + },300)
  346 + }
  347 + wx.navigateTo({
  348 + url:util.http_build_query({
  349 + hasSuggestion:1,
  350 + keyword:suggestion.title,
  351 + lat:suggestion.latitude,
  352 + lng:suggestion.longitude,
  353 + centre_pos:`${suggestion.latitude},${suggestion.longitude}`,
  354 + multiIndex:0,
  355 + ...this.options,
  356 + },'/pages/reserve/indexList')
  357 + })
  358 + },
  359 +})
  1 +{
  2 + "navigationBarBackgroundColor": "#ffffff",
  3 + "navigationBarTextStyle": "black",
  4 + "navigationBarTitleText":"周到安排",
  5 + "usingComponents": {
  6 + "formids":"/components/formids/formids",
  7 + "getpos":"/components/userinfo/getpos",
  8 + "nav":"/components/nav/nav",
  9 + "search-item":"/components/reserve/search/item",
  10 + "as-phone":"/components/actionSheet/phone",
  11 + "sb-tr":"/components/reserve/seller-box-transverse/seller-box"
  12 + }
  13 +}
  1 +<!--pages/reserve/search.wxml-->
  2 +<nav id="nav">搜索</nav>
  3 +<view class="searchAddrView" style="height: {{navHeight+40}}px;">
  4 + <view class="searchAddr flex-ll" style="margin-top: {{navHeight+5}}px;">
  5 + <image class="icon" src="http://nosqn.colorcun.com/custom/lite-online/image/search26.png"></image>
  6 + <input style="width: 100%;" placeholder="输入餐厅名或地名,快速订包间"
  7 + type="text" confirm-type="done"
  8 + focus
  9 + bindinput="getsuggest" value="{{keyword}}"/>
  10 + <image class="icon icon-del" wx:if="{{keyword.length>0}}"
  11 + catchtap="clearKeyword"
  12 + src="http://nosqn.colorcun.com/reserve/images/del.png"></image>
  13 + </view>
  14 +</view>
  15 +<view class="pages">
  16 + <view class="res-view">
  17 + <!--绑定回填事件-->
  18 + <block wx:for="{{suggestion}}" wx:key="index"
  19 + bindtap="backfill" id="{{index}}">
  20 + <search-item item="{{item}}" keyword="{{keyword}}" bindclick="searchItemClick"></search-item>
  21 + <view wx:if="{{index==1 && hasSellerMore}}" class="see-more" bindtap="gotoList"></view>
  22 + <view wx:if="{{index==sellerSplit && sellerSplit>-1}}" class="see-split"></view>
  23 + </block>
  24 + <view class="see-more bottom" wx:if="{{suggestion.length>0}}"></view>
  25 + </view>
  26 +</view>
  27 +<view class="history" wx:if="{{suggestion.length<1}}">
  28 + <view wx:if="{{keyword.length>0}}">
  29 + <view class="flex-vc empty">
  30 + <block wx:if="{{!hasFirstShow}}">
  31 + <image src="http://nosqn.colorcun.com/custom/lite-online/image/follow-empty.png"></image>
  32 + <view class="empty-t1">抱歉,没有找到符合的内容</view>
  33 + <view class="empty-t2">试试搜搜别的</view>
  34 + </block>
  35 + </view>
  36 + <view class="rsl-block" wx:if="{{rsl.length>0}}">
  37 + <view class="line-push">为你推荐</view>
  38 + <view class="transverse-list">
  39 + <swiper
  40 + indicator-dots="{{false}}" autoplay="{{false}}" circular="{{false}}" vertical="{{false}}"
  41 + interval="2000" duration="500"
  42 + previous-margin="{{15}}px" next-margin="{{15}}px" style="height: 350rpx;"
  43 + current="{{current}}" bindchange="bindtransition" bindanimationfinish="bindtransition">
  44 + <block wx:for="{{rsl}}" wx:key="rsl.key">
  45 + <swiper-item bindtap="gotoSellerDetail" id="{{item.id}}">
  46 + <view class="seller" id="seller-{{item.id}}">
  47 + <sb-tr seller="{{item}}"
  48 + hasInSwiper bindevent="sbtrEvent"
  49 + hasActivityTags="{{false}}"
  50 + hasActivityShort="{{true}}"
  51 + hasBrand="true" hasActivityTese="true"
  52 + hasSlogan="{{false}}"></sb-tr>
  53 + </view>
  54 + </swiper-item>
  55 + </block>
  56 + </swiper>
  57 + </view>
  58 + </view>
  59 + </view>
  60 + <view class="pages" wx:elif="{{history.length>0}}">
  61 + <view class="flex-lr">
  62 + <view class="history-title">最近搜索</view>
  63 + <view class="history-empty" bindtap="historyEmpty"></view>
  64 + </view>
  65 + <view class="history-list">
  66 + <block wx:for="{{history}}" wx:key="history.key">
  67 + <search-item item="{{item}}" hasHistory bindclick="searchItemClick"></search-item>
  68 + </block>
  69 + </view>
  70 + </view>
  71 +</view>
  72 +<getpos bindpos="onpos" id="getpos" hasAllowFail></getpos>
  73 +<as-phone id="as"></as-phone>
  1 +/* pages/reserve/search.wxss */
  2 +.pages{
  3 + width: 90%;
  4 + margin: 5% auto;
  5 + color:#353535;
  6 +}
  7 +.searchAddrView{
  8 + position: fixed;
  9 + top:0rpx;
  10 + width: 100%;
  11 + height: 240rpx;
  12 + background-color: #ffffff;
  13 + z-index: 9;
  14 +}
  15 +.searchAddr {
  16 + width: 90%;
  17 + height: 60rpx;
  18 + background-color: #F5F5F5;
  19 + border-radius: 30rpx;
  20 + line-height: 60rpx;
  21 + color:#999999;
  22 + line-height: 60rpx;
  23 + font-size: 28rpx;
  24 + margin:0 auto;
  25 +}
  26 +.searchAddr .icon{
  27 + min-width: 26rpx;
  28 + width:26rpx;
  29 + height: 26rpx;
  30 + margin: 0 20rpx;
  31 +}
  32 +.searchAddr .icon-del{
  33 + min-width: 28rpx;
  34 + width: 28rpx;
  35 + height: 28rpx;
  36 +}
  37 +.res-view{
  38 + margin-top: 120rpx;
  39 +}
  40 +
  41 +.search-but{
  42 + min-width: 140rpx;
  43 + color:#000000;
  44 + border-left: 2rpx solid #cccccc;
  45 + text-align: center;
  46 + height: 32rpx;
  47 + line-height: 32rpx;
  48 +
  49 +}
  50 +.history{
  51 + margin-top: 140rpx;
  52 +}
  53 +.history .history-title{
  54 + font-size: 28rpx;
  55 + color:#353535;
  56 + height: 40rpx;
  57 + line-height: 40rpx;
  58 + font-weight:600;
  59 + margin-bottom: 20rpx;
  60 +}
  61 +
  62 +.see-more{
  63 + width: 100%;
  64 + height: 34rpx;
  65 + position: relative;
  66 + margin-bottom: 40rpx;
  67 + margin-top: 40rpx;
  68 +}
  69 +.see-more:before{
  70 + content: "";
  71 + width: 100%;
  72 + height: 2rpx;
  73 + background-color: #F5F5F5;
  74 + position: absolute;
  75 + left: 0;
  76 + top:17rpx;
  77 +}
  78 +.see-more:after{
  79 + content: "查看更多";
  80 + width:136rpx;
  81 + height:34rpx;
  82 + font-size:24rpx;
  83 + color:rgba(153,153,153,1);
  84 + line-height:34rpx;
  85 + background-color: #fefefe;
  86 + position: absolute;
  87 + display: block;
  88 + left:calc(50% - 68rpx);
  89 + top:0;
  90 + text-align: center;
  91 +}
  92 +.see-more.bottom:after{
  93 + width:200rpx;
  94 + content: "我是有底线的";
  95 + left:calc(50% - 100rpx);
  96 +}
  97 +.see-more.bottom{
  98 + padding-bottom: 40rpx;
  99 +}
  100 +.see-split{
  101 + width: 100%;
  102 + height: 20rpx;
  103 +}
  104 +.history-empty{
  105 + width: 28rpx;
  106 + height: 28rpx;
  107 + background-image: url("http://nosqn.colorcun.com/reserve/images/empty.png");
  108 + background-size: 100% 100%;
  109 +}
  110 +
  111 +.empty{margin-top: 150rpx; color: #353535}
  112 +.empty image{
  113 + width: 191px;
  114 + height: 158px;
  115 +}
  116 +.empty .empty-t1{
  117 + font-size: 28rpx;
  118 + margin-top: 60rpx;
  119 + height:40px;
  120 + line-height:40px;
  121 +}
  122 +.empty .empty-t2{
  123 + font-size: 28rpx;
  124 + margin-top: 20rpx;
  125 + height:40px;
  126 + line-height:40px;
  127 +}
  128 +
  129 +.line-push{
  130 + background-image: url("http://nosqn.colorcun.com/reserve/images/line-push.png");
  131 + width: 328rpx;
  132 + height: 42rpx;
  133 + background-size: 100% 24rpx;
  134 + margin: 0 auto;
  135 + font-size:30rpx;
  136 + color: #C0A369;
  137 + line-height: 24rpx;
  138 + background-repeat: no-repeat;
  139 + text-align: center;
  140 + margin-bottom: 60rpx;
  141 +}
  142 +.rsl-block{
  143 + position: fixed;
  144 + bottom: 0rpx;
  145 + width: 100%;
  146 +}
  147 +.transverse-list{
  148 + background-color: #fefefe;
  149 + width: 100%;
  150 +}
  151 +.transverse-list .seller{
  152 + width: 98%;
  153 + margin: 0 auto;
  154 +}
@@ -626,9 +626,10 @@ @@ -626,9 +626,10 @@
626 "scene": null 626 "scene": null
627 }, 627 },
628 { 628 {
  629 + "id": 76,
629 "name": "pages/customer/detail_owner", 630 "name": "pages/customer/detail_owner",
630 "pathName": "pages/customer/detail_owner", 631 "pathName": "pages/customer/detail_owner",
631 - "query": "id=118852", 632 + "query": "id=59113",
632 "scene": null 633 "scene": null
633 }, 634 },
634 { 635 {
@@ -294,7 +294,9 @@ export default { @@ -294,7 +294,9 @@ export default {
294 'App.Customer.SearchMap':null, 294 'App.Customer.SearchMap':null,
295 295
296 //根据腾讯地点搜索api整合现有商家 296 //根据腾讯地点搜索api整合现有商家
297 - 'App.Customer.KeywordTips':null, 297 + 'App.Customer.KeywordTips':{
  298 + alias:'App.App.KeywordTips'//限制城市
  299 + },
298 300
299 //设置C端用户常用信息 301 //设置C端用户常用信息
300 'App.Customer.SetCustomerInfo':{ 302 'App.Customer.SetCustomerInfo':{
@@ -512,6 +514,18 @@ export default { @@ -512,6 +514,18 @@ export default {
512 openid:'openid', 514 openid:'openid',
513 }, 515 },
514 516
  517 + //根据区域查询指定条件下的商家列表
  518 + 'App.Customer.GetSellerListByFoods':null,
  519 +
  520 + //用来检测找包间首页优惠板块是否显示
  521 + 'App.Customer.IsSetActivityByFoods':null,
  522 +
  523 + //根据地理位置获取相应的商家活动列表
  524 + 'App.Customer.GetActivitySellerListByFoods':null,
  525 +
  526 + //根据code获取指定区域下面的推介的商家列表
  527 + 'App.Customer.GetRecomList':null,
  528 +
515 //根据账单ID获取账单详情 529 //根据账单ID获取账单详情
516 'App.Foodset.GetFoodOrdersDetail':null, 530 'App.Foodset.GetFoodOrdersDetail':null,
517 531