Commit 312db3195e5f4964055b18d47765c4187d2fed86

Authored by vking
1 parent 547aa611

search

... ... @@ -3,7 +3,7 @@ var myBehavior = require('hv_behavior')
const items=(function(){
let today=parseInt(new Date()/1000);
let ds=[]
for(let i=0;i<=15;i++){
for(let i=0;i<15;i++){
ds.push(today+86400*i)
}
return ds
... ...
<!--components/reserve/search/how/hv/date.wxml-->
<wxs src="../../../../utils/util.wxs" module="util" />
<swiper previous-margin="20rpx" next-margin="20rpx"
<swiper previous-margin="35rpx" next-margin="45rpx"
class="tabs"
display-multiple-items="5">
<swiper-item wx:for="{{items}}" wx:key="items">
... ...
// components/reserve/search/how/dur.js
// components/reserve/search/how/hv/pnum.js
var myBehavior = require('hv_behavior')
const items=[
{id:1,label:'早餐'},
{id:2,label:'午餐'},
{id:3,label:'晚餐'},
{},
{},
]
Component({
/**
* 组件的属性列表
*/
properties: {
behaviors: [myBehavior],
data:{
items:items,
},
/**
* 组件的初始数据
*/
data: {
lifetimes: {
attached: function () {
// 在组件实例进入页面节点树时执行
console.log(this.data.pi)
this.setData({
spi:this.data.pi,
})
},
detached: function () {
// 在组件实例被从页面节点树移除时执行
},
},
/**
... ...
<!--components/reserve/search/how/dur.wxml-->
<view class="tabs flex-ll">
<view class="item" data-id="1">
早餐
</view>
<view class="item" data-id="2">
午餐
</view>
<view class="item" data-id="3">
晚餐
</view>
</view>
<swiper previous-margin="35rpx" next-margin="45rpx"
class="tabs"
display-multiple-items="5">
<swiper-item wx:for="{{items}}" wx:key="items">
<view class="item {{spi==index?'active':''}} flex-vc"
bindtap="{{index>2?'':'checked'}}"
data-index="{{index}}"
data-val="{{item.id}}"
data-type="dur">
<view class="name">{{item.label}}</view>
</view>
</swiper-item>
</swiper>
... ...
// components/reserve/search/how/index.js
import util from '../../../../utils/util'
Component({
/**
* 组件的属性列表
*/
properties: {
hasPage:{
type:Boolean,
value:false,
},
date_pi:{
type:Number,
value:0,
},
pnum_pi:{
type:Number,
value:0,
},
dur_pi:{
type:Number,
value:-1,
}
},
/**
... ... @@ -13,16 +29,30 @@ Component({
data: {
},
attached(){
this.params={}
},
/**
* 组件的方法列表
*/
methods: {
pnumEvent(e){
console.log(e)
paramEvent(e){
console.log('paramEvent',e.detail)
this.params[e.detail.type]=e.detail
},
dateEvent(e){
console.log(e)
submit(){
console.log(this.params)
let paramObj={
when_date:util.unixtoTime(this.params['date'].val,'YYYY-MM-DD'),
several:this.params['pnum'].val,
}
if(this.params['dur'].val>=0){
paramObj.daily=this.params['dur'].val
}
this.triggerEvent('event',{
params:this.params,
paramObj:paramObj,
})
},
}
})
... ...
<!--components/reserve/search/how/index.wxml-->
<view class="mask"></view>
<view class="pages {{hasPage?'':'window'}}">
<view>
<view>您好,几位,什么时候</view>
<view class="close">X</view>
<view class="mask" wx:if="{{!hasPage}}"></view>
<view class="{{hasPage?'pages':'pages-window'}}">
<view class="title flex-lr">
<view class="title-name">您好,几位,什么时候</view>
<view class="close"></view>
</view>
<view>
<pnum bindevent="pnumEvent"></pnum>
<pnum bindevent="paramEvent" pi="{{pnum_pi}}"></pnum>
<view style="margin: 60rpx 0">
<date bindevent="dateEvent"></date>
<date bindevent="paramEvent" pi="{{pnum_pi}}"></date>
</view>
<dur></dur>
<dur bindevent="paramEvent" pi="{{dur_pi}}"></dur>
</view>
<view class="button" bindtap></view>
</view>
<view class="submit" bindtap="submit">查找餐厅</view>
... ...
/* components/reserve/search/how/index.wxss */
\ No newline at end of file
/* components/reserve/search/how/index.wxss */
@import "../../../../app.wxss";
.pages{
padding: 20rpx 0;
}
.pages-window{
padding: 58rpx 0;
border-radius:20rpx 20rpx 0 0;
}
.pages .close{
display: none;
}
.title{
height:48rpx;
font-size:34rpx;
font-weight:600;
color:rgba(53,53,53,1);
line-height:48rpx;
padding: 0 40rpx;
width: calc(100% - 80rpx);
margin-bottom: 60rpx;
}
.close{
background-image: url("http://qn.colorcun.com/reserve/images/close.png");
background-size: 100% 100%;
width: 32rpx;
height: 32rpx;
}
.submit{
height:80rpx;
background:rgba(192,163,105,1);
border-radius:10rpx;
font-size:32rpx;
font-weight:500;
color:rgba(255,255,255,1);
line-height:80rpx;
text-align: center;
margin: 0 40rpx;
width: calc(100% - 80rpx);
position: fixed;
bottom: 80rpx;
}
\ No newline at end of file
... ...
<!--components/reserve/search/how/hv/pnum.wxml-->
<swiper previous-margin="20rpx" next-margin="20rpx"
<swiper previous-margin="35rpx" next-margin="45rpx"
class="tabs"
display-multiple-items="5">
<swiper-item wx:for="{{items}}" wx:key="items">
... ...
... ... @@ -199,7 +199,7 @@
</view>
<view class="reserve reserve-click flex-vc">
<formids class="flex-vc" bindclick="reserveEvent" id="reserve-button">
<view class="text">{{hasOnlineReserve?'包间预订':'联系餐厅'}}</view>
<view class="text">{{hasOnlineReserve?'订包间':'联系餐厅'}}</view>
</formids>
</view>
... ...
... ... @@ -58,6 +58,6 @@ Page({
},
howEvent(e){
console.log(e)
console.log('howEvent',e)
},
})
\ No newline at end of file
... ...