Commit be55ba24936fa60d1662db23b47f55251fce95ef

Authored by zhangyan
1 parent ba7cf045

Merge branch 'master' of /Volumes/DATA/Workspace/book with conflicts.

... ... @@ -346,6 +346,110 @@ Page({
return true;
}
})
let form=this.data.form;
try{
let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time);
console.log('rdate',this.data.dateStr[this.data.form.date],rdate);
App.Reserve.GetTableList({
sid:this.sellerid,
pnum_str:form.pnum_str,
rdate:rdate,
tid:form.tabid,
}).then(res=>{
let tables=[];
res.data.forEach(p=>{
if(tables.length>=3) return true;
p.list.forEach(t=>{
if(tables.length>=3) return true;
tables.push(t);
})
})
this.tablesAll=res.data;
this.setData({
tables:tables
})
})
}catch (e){
this.setData({
tables:[]
})
}
},
async formsubmit(){
if(this.data.buttonhide) return;
try {
let rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date], this.data.form.time);
console.log('rdate', rdate);
this.setData({
buttonhide: true,
})
let form = this.data.form;
form.tid = form.tid.toString();
form.sid = this.sellerid;
form.rdate =rdate
App.Reserve.SetReserveInfo(form).then(res => {
if(res.ret==200){
wx.navigateTo({
url:'b_detail?id='+res.data.id,
});
}else{
util.toast(res.msg,'none')
}
})
}catch (e){}
},
selectphone:function(e){
this.data.form.phone=e.detail.phone;
this.data.form.rname=e.detail.rname;
this.data.form.cusdem=e.detail.cusdem;
var form=this.data.form
this.data.form.sex=e.detail.sex;
this.setData({
form:this.data.form,
searchlist:null,
})
this.conditionInfo();
},
calendarShow(){
this.setData({
calendarMask:true
})
},
dateChange(event){
console.log(event);
let clickDay = event.detail.day;
let changeDay = `dayStyle[1].day`;
let changeBg = `dayStyle[1].background`;
this.setData({
[changeDay]: clickDay,
[changeBg]: "#199095"
})
this.setDateStr(util.timetouUnix(event.detail.year+'/'+event.detail.month+'/'+event.detail.day))
this.getTables()
},
calendarClose(){
this.setData({
calendarMask:false
})
},
async selectdesk(){
let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time);
console.log(this.data.form)
wx.navigateTo({
url:'b_desk?rdate='+rdate+'&tid='+this.data.form.tabid+'&pnum_str='+this.data.form.pnum_str
})
},
conditionInfo:function(){
var form=this.data.form
if(form.tid.length>0 && form.rname.length>0){
this.data.buttonhide=false;
}
this.setData({
buttonhide:this.data.buttonhide
})
}
})
console.log('initModify-timePickerIndex',timePickerIndex);
obj.form.pnum_str=res.data.pnum_str;
... ...
... ... @@ -10,6 +10,15 @@ Page({
pagey:10,
sort:null,
dateStr:'',
calendarMaskLoad:false,
calendarMask:false,
dayStyle:[
{ month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' },
{ month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' }
],
form:{
time:0
}
},
sellerid:0,
onLoad:function(opt){
... ... @@ -17,6 +26,7 @@ Page({
let dateStr=util.unixtoTime(d,'MM-DD DAY');
var radio=750/util.getsystem().windowWidth;
var contentHeight=util.getsystem().windowHeight-Math.ceil(165/radio)
var todayobj=bookOrder.changedate(d*1000);
if(opt.seller_id){
this.sellerid=opt.seller_id;
util.cache('sellerid',opt.seller_id)
... ... @@ -33,13 +43,22 @@ Page({
systemInfo:util.getsystem(),
contentHeight:contentHeight,
listHeight:contentHeight-Math.ceil(140/radio),
dateStr:dateStr
dateStr:dateStr,
showyear:todayobj.year,
showmonth:todayobj.month,
showday:todayobj.day
})
console.log(this.data.sellerid)
util.setBarTitle('预定本');
},
onShow:function(){
setTimeout(()=>{
this.setData({
calendarMaskLoad:true,
})
},1000);
var that=this;
this.setData({
pagex:1,
... ... @@ -47,10 +66,6 @@ Page({
isloading:false,
})
this.getbooklist();
var currentTime=Date.parse(new Date());
var timeobj=bookOrder.changedate(currentTime);
var afterobj=bookOrder.changedate(currentTime+24*60*60*1000);
console.log(afterobj)
util.postSuccessFun=function(json,uri_code){
switch (uri_code) {
case uri.CGI_USER_GETRESERVELIST__CODE:
... ... @@ -112,5 +127,46 @@ Page({
console.log(this.data.pagex)
this.getbooklist();
}
},
calendarShow(){
console.log('xxxxx')
this.setData({
calendarMask:true
})
console.log(this.data.calendarMask)
},
dateChange(event){
var currentdate=event.detail.year+'-'+(event.detail.month<10 ? '0'+event.detail.month : event.detail.month)+'-'+(event.detail.day<10 ? '0'+event.detail.day : event.detail.day);
var currentime=bookOrder.gettimestamp(currentdate+' 00:00:00');
var myDate = new Date(parseInt(currentime)*1000);
var week=bookOrder.getweek(myDate.getDay());
var dateStr=(event.detail.month<10 ? '0'+event.detail.month : event.detail.month)+'-'+(event.detail.day<10 ? '0'+event.detail.day : event.detail.day);
if(currentime-new Date()/1000<=86400){
dateStr+=' 明天'
}else{
dateStr+=' '+week
}
let clickDay = event.detail.day;
let changeDay = `dayStyle[1].day`;
let changeBg = `dayStyle[1].background`;
console.log(changeBg)
this.setData({
showyear:event.detail.year,
showmonth:event.detail.month,
showday:event.detail.day,
dateStr:dateStr,
[changeDay]: clickDay,
[changeBg]: "#84e7d0"
})
},
calendarClose(){
this.setData({
calendarMask:false
})
},
selectedValue:function (e) {
this.setData({
form:{time:e.currentTarget.dataset.value}
})
}
})
\ No newline at end of file
... ...
... ... @@ -6,6 +6,7 @@
"nothingBook":"/components/book/nothing/nothing",
"bookList":"/components/book/list/list",
"nav":"/components/nav/nav",
"tabBar":"/components/book/tabBar/tabBar"
"tabBar":"/components/book/tabBar/tabBar",
"calendar": "plugin://calendar/calendar"
}
}
\ No newline at end of file
... ...
... ... @@ -11,11 +11,13 @@
<input placeholder="桌位·预定人姓名·手机号" placeholder-class="font30r gray-font smooth" class="font30r black-font smooth search-input"/>
</view>
<view class="search-easy flex-lr">
<view class="block flex-cc">
{{dateStr}}
<view class="block flex-vc" bindtap="calendarShow">
<view class="black-font font30r">时间</view>
<view class="green-font font34r font-bold flex-cc" style="margin-top:40rpx;height:54rpx;">{{dateStr}}</view>
</view>
<view class="block section flex-cc">
<view class="tab flex-cc">
<view class="block section flex-vc">
<view class="black-font font30r">时段</view>
<view class="tab flex-cc" style="margin-top:40rpx;">
<item class="item {{form.time==0?'checked':''}}"
bindtap="selectedValue" data-key="time" data-value="0">
早市
... ... @@ -40,15 +42,31 @@
<view class="flex-cc" bindtap="timeorder">时间<image src="../image/direction.png" class="icon22-26" background-size="cover"></image></view>
<view class="flex-rr">操作</view>
</view>
<scroll-view class="book-list" style="height:{{listHeight}}px;" scroll-y bindscroll="addbooklist">
<view class="book-list" style="padding-bottom:118rpx;">
<view class="book-list-body">
<block wx:for="{{bookList}}">
<bookList item="{{item}}"></bookList>
</block>
</view>
</scroll-view>
</view>
</view>
</view>
</block>
</block>
<tabBar></tabBar>
\ No newline at end of file
<tabBar></tabBar>
<view class="calendar-mask"
bindtap="calendarClose"
style="left:{{calendarMask?0:-5000}}px;" wx:if="{{calendarMaskLoad}}">
<calendar weeks-type="cn"
year="{{showyear}}"
month="{{showmonth}}"
day="{{showday}}"
start-date="2018-09"
days-color="{{dayStyle}}"
binddayClick="dateChange"
active-type="rounded"
calendar-style="calendar"
header-style="calendar-header"
board-style="calendar-board"></calendar>
</view>
\ No newline at end of file
... ...
... ... @@ -11,7 +11,6 @@ page{
border-radius:40rpx;
box-shadow: 0 0 8px #ccc;
margin:0 auto;
margin-bottom:20rpx;
}
.search-icon{
width:40rpx;
... ... @@ -61,19 +60,16 @@ page{
}
.search-easy{
height: 80rpx;
line-height: 80rpx;
margin-bottom: 20rpx;
font-weight: bold;
color:#199095;
height:160rpx;
padding:30rpx 0;
}
.search-easy .block{
width: 50%;
min-width: 50%;
height: 80rpx;
height: 100%;
}
.search-easy .block:first-child{
border-right: 2rpx solid #E0E0E0;
border-right: 1px solid #E0E0E0;
}
.section .tab{
font-size: 34rpx;
... ... @@ -94,4 +90,30 @@ page{
.section .tab .checked{
background-color:#199095;
color: #FEFEFE;
}
.calendar-mask{
position: fixed;
z-index: 99;
width: 100%;
height: 100%;
left:0;
top:0;
background-color: rgba(0,0,0,.5);
}
.calendar {
background-color: #eeedff;
padding-top: 10px;
position: fixed;
bottom: 0;
width: 100%;
}
.calendar-header{
font-size: large; /*修改了标题文字和按钮的大小*/
color: #605eac; /*修改了标题文字和按钮的颜色*/
}
.calendar-board {
background-color: #dddcff;
color: white;
}
\ No newline at end of file
... ...