Commit 096756478a0f1dc2ed77a3192f08596dda757d39

Authored by vking
1 parent 0fc19042

search

@@ -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 }
  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 +var myBehavior = require('hv_behavior')
  3 +const items=[
  4 + {id:1,label:'早餐'},
  5 + {id:2,label:'午餐'},
  6 + {id:3,label:'晚餐'},
  7 + {},
  8 + {},
  9 +]
  10 +Component({
  11 + behaviors: [myBehavior],
  12 + data:{
  13 + items:items,
  14 + },
  15 + lifetimes: {
  16 + created: function () {
  17 + // 在组件实例进入页面节点树时执行
  18 + this.type='dur'
  19 + },
  20 + detached: function () {
  21 + // 在组件实例被从页面节点树移除时执行
  22 + },
  23 + },
  24 +
  25 + /**
  26 + * 组件的方法列表
  27 + */
  28 + methods: {
  29 +
  30 + }
  31 +})
  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:{},
  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 + },
  32 + observers: {
  33 + 'findSellerData': function(findSellerData) {
  34 + console.log('page=>findSellerData',findSellerData)
  35 + }
  36 + },
  37 + /**
  38 + * 组件的方法列表
  39 + */
  40 + methods: {
  41 + paramEvent(e){
  42 + console.log('paramEvent',e.detail.type,e.detail)
  43 + this.params[e.detail.type]=e.detail
  44 + },
  45 + submit(){
  46 + console.log(this.params)
  47 + let paramObj={}
  48 + if(this.params['date']){
  49 + paramObj.when_date=util.unixtoTime(this.params['date'].val,'YYYY-MM-DD')
  50 + }
  51 + if(this.params['pnum']){
  52 + paramObj.several=this.params['pnum'].val
  53 + }
  54 + if(this.params['dur'] && this.params['dur'].val>=0){
  55 + paramObj.daily=this.params['dur'].val
  56 + }
  57 + this.triggerEvent('event',{
  58 + params:this.params,
  59 + paramObj:paramObj,
  60 + })
  61 + },
  62 + show(){
  63 + this.setData({
  64 + hidden:false
  65 + })
  66 + },
  67 + hide(){
  68 + this.setData({
  69 + hidden:true
  70 + })
  71 + },
  72 + }
  73 +})
  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 +Component({
  5 + /**
  6 + * 组件的属性列表
  7 + */
  8 + properties: {
  9 +
  10 + },
  11 +
  12 + /**
  13 + * 组件的初始数据
  14 + */
  15 + data: {
  16 +
  17 + },
  18 + attached(){
  19 + this.init()
  20 + this.position={}
  21 + this.selectComponent('#getpos').getPos();
  22 + },
  23 + /**
  24 + * 组件的方法列表
  25 + */
  26 + methods: {
  27 + async init(){
  28 + this.setData({
  29 + citys: await DA.getCitys()
  30 + })
  31 + },
  32 + onpos(e) {
  33 + let res = e.detail;
  34 + console.log('onpos.res', res);
  35 + this.position.latitude = res.latitude;
  36 + this.position.longitude = res.longitude;
  37 + },
  38 + }
  39 +})
  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">
  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="{{true}}" class="flex justify-start align-start">
  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">的说法是电风扇东风风神懂法守法水电费水电费水电费水电费水电费水电费水电费</view>
  19 + </view>
  20 + <view wx:else="" class="text-30 flex-treble text-center">未获取到位置</view>
  21 + <view class="view margin-bottom-xl margin-top-lg grid col-4 city-view">
  22 + <view class="view flex justify-center city-city" wx:for="{{citys}}" wx:key="citys">
  23 + <view class="view city">{{item.name}}</view>
  24 + </view>
  25 + </view>
  26 + <view class="flex justify-center margin-bottom-lg margin-top">
  27 + <button class="view cu-btn margin-right-xl round bg-ghostWhite" wx:if="{{opt.cancelText}}"
  28 + bindtap="tapButton" data-type="cancel"
  29 + style="color:{{opt.cancelColor}};">{{opt.cancelText}}</button>
  30 + <button class="view cu-btn round bg-blue"
  31 + bindtap="tapButton" data-type="confirm"
  32 + style="color:{{opt.confirmColor}};">{{opt.confirmText}}</button>
  33 + </view>
  34 + </view>
  35 + </view>
  36 +</view>
  37 +<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-view .city-city:nth-child(4n+0){
  18 + background-color: #1AAD19;
  19 + justify-items: flex-end;
  20 +}
  21 +.city.active{
  22 + color: #42A5FF;
  23 + background: #E6F3FF;
  24 +}
@@ -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);
@@ -14,7 +14,12 @@ let getCatesID=async function(index){ @@ -14,7 +14,12 @@ let getCatesID=async function(index){
14 let res=await App.Reserve.GetCustomerConfig(); 14 let res=await App.Reserve.GetCustomerConfig();
15 return res.data.cate[index].id; 15 return res.data.cate[index].id;
16 } 16 }
  17 +let getCitys=async function(){
  18 + let res=await App.Reserve.GetCustomerConfig();
  19 + return res.data.region_code;
  20 +}
17 export default { 21 export default {
18 getCates:getCates, 22 getCates:getCates,
19 getCatesID:getCatesID, 23 getCatesID:getCatesID,
  24 + getCitys:getCitys,
20 } 25 }
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' 1 +// pages/reserve/home.js
12 Page({ 2 Page({
13 3
14 /** 4 /**
15 * 页面的初始数据 5 * 页面的初始数据
16 */ 6 */
17 data: { 7 data: {
18 - history:[],  
19 - suggestion:[],  
20 - hasSellerMore:false,  
21 - keyword:'',  
22 - sellerSplit:-1,  
23 - navHeight:100, 8 +
24 }, 9 },
25 10
26 /** 11 /**
27 * 生命周期函数--监听页面加载 12 * 生命周期函数--监听页面加载
28 */ 13 */
29 onLoad: function (options) { 14 onLoad: function (options) {
30 - this.selectComponent('#getpos').getPos(); 15 +
31 }, 16 },
32 17
33 /** 18 /**
@@ -41,11 +26,6 @@ Page({ @@ -41,11 +26,6 @@ Page({
41 * 生命周期函数--监听页面显示 26 * 生命周期函数--监听页面显示
42 */ 27 */
43 onShow: function () { 28 onShow: function () {
44 - PubSub.emit('custom-tab-bar')  
45 - this.getHistory();  
46 - this.setData({  
47 - navHeight:this.selectComponent('#nav').getHeight()  
48 - })  
49 29
50 }, 30 },
51 31
@@ -62,266 +42,43 @@ Page({ @@ -62,266 +42,43 @@ Page({
62 onUnload: function () { 42 onUnload: function () {
63 43
64 }, 44 },
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 - })  
84 - },  
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 - }  
104 - },  
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  
126 - }  
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 - },  
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()  
198 - },  
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 - }) 45 +
  46 + /**
  47 + * 页面相关事件处理函数--监听用户下拉动作
  48 + */
  49 + onPullDownRefresh: function () {
  50 +
209 }, 51 },
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')  
218 - }) 52 +
  53 + /**
  54 + * 页面上拉触底事件的处理函数
  55 + */
  56 + onReachBottom: function () {
  57 +
219 }, 58 },
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')  
246 - }) 59 +
  60 + /**
  61 + * 用户点击右上角分享
  62 + */
  63 + onShareAppMessage: function () {
  64 + return{
  65 + title:'请客订包间,就上周到安排'
247 } 66 }
248 }, 67 },
249 - historyEmpty(){  
250 - App.Customer.DelHistorySearch().then(()=>{  
251 - App.Customer.GetHistorySearch({},'clear')  
252 - this.setData({  
253 - history:[]  
254 - })  
255 - }) 68 + dispalySearchHow(){
  69 + this.selectComponent('#search-how').show();
256 }, 70 },
257 - clearKeyword(){ 71 + howEvent(e){
  72 + console.log('howEvent',e.detail)
  73 + //this.eventChannel.emit('findSellerData',e.detail)
  74 + this.findSellerData=e.detail
258 this.setData({ 75 this.setData({
259 - keyword:'',  
260 - suggestion:[],  
261 - })  
262 - },  
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=>{  
271 - this.setData({  
272 - rsl:res.data  
273 - })  
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 - }  
292 - },  
293 - gotoSellerDetail(e){  
294 - let url='/pages/reserve/detail?id='+e.currentTarget.id  
295 - wx.navigateTo({  
296 - url:url,  
297 - })  
298 - },  
299 - sbtrEvent(e){  
300 - console.log(e);  
301 - if(e.detail.act=='oncall'){  
302 - this.selectComponent('#as').show(e.detail.seller);  
303 - }  
304 - },  
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') 76 + findSellerData:e.detail
325 }) 77 })
  78 + //setTimeout(()=>{this.getList();},0)
  79 + this.selectComponent('#search-how').hide();
326 }, 80 },
  81 + locationEvent(e){
  82 + console.log('locationEvent',e.detail)
  83 + }
327 }) 84 })
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"
12 } 8 }
13 } 9 }
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>  
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> 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 class="view flex-treble text-bold text-xl text-cut margin-right-lg">ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss</view>
  10 + <view class="view flex flex-direction align-center justify-center">
  11 + <view class="view posicon"></view>
  12 + <view class="view text-blue txt-24-h" style="margin-top: 4rpx;">我的位置</view>
58 </view> 13 </view>
59 </view> 14 </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> 15 + <view class="view solid-bottom flex justify-around align-center" style="height: 110rpx;" bindtap="dispalySearchHow">
  16 + <view class="flex-treble">sss</view>
  17 + <view class="more"></view>
  18 + </view>
  19 + <view class="view solid-bottom flex justify-around align-center" style="height: 110rpx;">
  20 + <view class="flex-treble">sss</view>
  21 + <view class="more"></view>
  22 + </view>
  23 + <view class="view flex justify-around align-center" style="height: 110rpx;">
  24 + <view class="flex-treble">sss</view>
  25 + <view class="more"></view>
  26 + </view>
  27 + <view class="view flex justify-around align-center round bg-blue-blue text-bold" style="height: 84rpx;">
  28 + 查找包间
70 </view> 29 </view>
71 </view> 30 </view>
72 -<getpos bindpos="onpos" id="getpos" hasAllowFail></getpos>  
73 -<as-phone id="as"></as-phone>  
  31 +<search-how id="search-how" findSellerData="{{findSellerData}}" bindevent="howEvent"></search-how>
  32 +<location id="location" bindevent="locationEvent"></location>
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; 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;
154 } 48 }