Commit be55ba24936fa60d1662db23b47f55251fce95ef

Authored by zhangyan
1 parent ba7cf045

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

@@ -346,6 +346,110 @@ Page({ @@ -346,6 +346,110 @@ Page({
346 return true; 346 return true;
347 } 347 }
348 }) 348 })
  349 + let form=this.data.form;
  350 + try{
  351 + let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time);
  352 + console.log('rdate',this.data.dateStr[this.data.form.date],rdate);
  353 + App.Reserve.GetTableList({
  354 + sid:this.sellerid,
  355 + pnum_str:form.pnum_str,
  356 + rdate:rdate,
  357 + tid:form.tabid,
  358 + }).then(res=>{
  359 + let tables=[];
  360 + res.data.forEach(p=>{
  361 + if(tables.length>=3) return true;
  362 + p.list.forEach(t=>{
  363 + if(tables.length>=3) return true;
  364 + tables.push(t);
  365 + })
  366 + })
  367 + this.tablesAll=res.data;
  368 + this.setData({
  369 + tables:tables
  370 + })
  371 + })
  372 + }catch (e){
  373 + this.setData({
  374 + tables:[]
  375 + })
  376 + }
  377 +},
  378 +async formsubmit(){
  379 + if(this.data.buttonhide) return;
  380 + try {
  381 + let rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date], this.data.form.time);
  382 + console.log('rdate', rdate);
  383 + this.setData({
  384 + buttonhide: true,
  385 + })
  386 + let form = this.data.form;
  387 + form.tid = form.tid.toString();
  388 + form.sid = this.sellerid;
  389 + form.rdate =rdate
  390 + App.Reserve.SetReserveInfo(form).then(res => {
  391 + if(res.ret==200){
  392 + wx.navigateTo({
  393 + url:'b_detail?id='+res.data.id,
  394 + });
  395 + }else{
  396 + util.toast(res.msg,'none')
  397 + }
  398 + })
  399 + }catch (e){}
  400 +},
  401 +selectphone:function(e){
  402 + this.data.form.phone=e.detail.phone;
  403 + this.data.form.rname=e.detail.rname;
  404 + this.data.form.cusdem=e.detail.cusdem;
  405 + var form=this.data.form
  406 + this.data.form.sex=e.detail.sex;
  407 + this.setData({
  408 + form:this.data.form,
  409 + searchlist:null,
  410 +
  411 + })
  412 + this.conditionInfo();
  413 +},
  414 +calendarShow(){
  415 + this.setData({
  416 + calendarMask:true
  417 + })
  418 +},
  419 +dateChange(event){
  420 + console.log(event);
  421 + let clickDay = event.detail.day;
  422 + let changeDay = `dayStyle[1].day`;
  423 + let changeBg = `dayStyle[1].background`;
  424 + this.setData({
  425 + [changeDay]: clickDay,
  426 + [changeBg]: "#199095"
  427 + })
  428 + this.setDateStr(util.timetouUnix(event.detail.year+'/'+event.detail.month+'/'+event.detail.day))
  429 + this.getTables()
  430 +},
  431 +calendarClose(){
  432 + this.setData({
  433 + calendarMask:false
  434 + })
  435 +},
  436 +async selectdesk(){
  437 + let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time);
  438 + console.log(this.data.form)
  439 + wx.navigateTo({
  440 + url:'b_desk?rdate='+rdate+'&tid='+this.data.form.tabid+'&pnum_str='+this.data.form.pnum_str
  441 + })
  442 +},
  443 +conditionInfo:function(){
  444 + var form=this.data.form
  445 + if(form.tid.length>0 && form.rname.length>0){
  446 + this.data.buttonhide=false;
  447 + }
  448 + this.setData({
  449 + buttonhide:this.data.buttonhide
  450 + })
  451 +}
  452 +})
349 453
350 console.log('initModify-timePickerIndex',timePickerIndex); 454 console.log('initModify-timePickerIndex',timePickerIndex);
351 obj.form.pnum_str=res.data.pnum_str; 455 obj.form.pnum_str=res.data.pnum_str;
@@ -10,6 +10,15 @@ Page({ @@ -10,6 +10,15 @@ Page({
10 pagey:10, 10 pagey:10,
11 sort:null, 11 sort:null,
12 dateStr:'', 12 dateStr:'',
  13 + calendarMaskLoad:false,
  14 + calendarMask:false,
  15 + dayStyle:[
  16 + { month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' },
  17 + { month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' }
  18 + ],
  19 + form:{
  20 + time:0
  21 + }
13 }, 22 },
14 sellerid:0, 23 sellerid:0,
15 onLoad:function(opt){ 24 onLoad:function(opt){
@@ -17,6 +26,7 @@ Page({ @@ -17,6 +26,7 @@ Page({
17 let dateStr=util.unixtoTime(d,'MM-DD DAY'); 26 let dateStr=util.unixtoTime(d,'MM-DD DAY');
18 var radio=750/util.getsystem().windowWidth; 27 var radio=750/util.getsystem().windowWidth;
19 var contentHeight=util.getsystem().windowHeight-Math.ceil(165/radio) 28 var contentHeight=util.getsystem().windowHeight-Math.ceil(165/radio)
  29 + var todayobj=bookOrder.changedate(d*1000);
20 if(opt.seller_id){ 30 if(opt.seller_id){
21 this.sellerid=opt.seller_id; 31 this.sellerid=opt.seller_id;
22 util.cache('sellerid',opt.seller_id) 32 util.cache('sellerid',opt.seller_id)
@@ -33,13 +43,22 @@ Page({ @@ -33,13 +43,22 @@ Page({
33 systemInfo:util.getsystem(), 43 systemInfo:util.getsystem(),
34 contentHeight:contentHeight, 44 contentHeight:contentHeight,
35 listHeight:contentHeight-Math.ceil(140/radio), 45 listHeight:contentHeight-Math.ceil(140/radio),
36 - dateStr:dateStr 46 + dateStr:dateStr,
  47 + showyear:todayobj.year,
  48 + showmonth:todayobj.month,
  49 + showday:todayobj.day
  50 +
37 }) 51 })
38 console.log(this.data.sellerid) 52 console.log(this.data.sellerid)
39 util.setBarTitle('预定本'); 53 util.setBarTitle('预定本');
40 54
41 }, 55 },
42 onShow:function(){ 56 onShow:function(){
  57 + setTimeout(()=>{
  58 + this.setData({
  59 + calendarMaskLoad:true,
  60 + })
  61 + },1000);
43 var that=this; 62 var that=this;
44 this.setData({ 63 this.setData({
45 pagex:1, 64 pagex:1,
@@ -47,10 +66,6 @@ Page({ @@ -47,10 +66,6 @@ Page({
47 isloading:false, 66 isloading:false,
48 }) 67 })
49 this.getbooklist(); 68 this.getbooklist();
50 - var currentTime=Date.parse(new Date());  
51 - var timeobj=bookOrder.changedate(currentTime);  
52 - var afterobj=bookOrder.changedate(currentTime+24*60*60*1000);  
53 - console.log(afterobj)  
54 util.postSuccessFun=function(json,uri_code){ 69 util.postSuccessFun=function(json,uri_code){
55 switch (uri_code) { 70 switch (uri_code) {
56 case uri.CGI_USER_GETRESERVELIST__CODE: 71 case uri.CGI_USER_GETRESERVELIST__CODE:
@@ -112,5 +127,46 @@ Page({ @@ -112,5 +127,46 @@ Page({
112 console.log(this.data.pagex) 127 console.log(this.data.pagex)
113 this.getbooklist(); 128 this.getbooklist();
114 } 129 }
  130 + },
  131 + calendarShow(){
  132 + console.log('xxxxx')
  133 + this.setData({
  134 + calendarMask:true
  135 + })
  136 + console.log(this.data.calendarMask)
  137 + },
  138 + dateChange(event){
  139 + 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);
  140 + var currentime=bookOrder.gettimestamp(currentdate+' 00:00:00');
  141 + var myDate = new Date(parseInt(currentime)*1000);
  142 + var week=bookOrder.getweek(myDate.getDay());
  143 + var dateStr=(event.detail.month<10 ? '0'+event.detail.month : event.detail.month)+'-'+(event.detail.day<10 ? '0'+event.detail.day : event.detail.day);
  144 + if(currentime-new Date()/1000<=86400){
  145 + dateStr+=' 明天'
  146 + }else{
  147 + dateStr+=' '+week
  148 + }
  149 + let clickDay = event.detail.day;
  150 + let changeDay = `dayStyle[1].day`;
  151 + let changeBg = `dayStyle[1].background`;
  152 + console.log(changeBg)
  153 + this.setData({
  154 + showyear:event.detail.year,
  155 + showmonth:event.detail.month,
  156 + showday:event.detail.day,
  157 + dateStr:dateStr,
  158 + [changeDay]: clickDay,
  159 + [changeBg]: "#84e7d0"
  160 + })
  161 + },
  162 + calendarClose(){
  163 + this.setData({
  164 + calendarMask:false
  165 + })
  166 + },
  167 + selectedValue:function (e) {
  168 + this.setData({
  169 + form:{time:e.currentTarget.dataset.value}
  170 + })
115 } 171 }
116 }) 172 })
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 "nothingBook":"/components/book/nothing/nothing", 6 "nothingBook":"/components/book/nothing/nothing",
7 "bookList":"/components/book/list/list", 7 "bookList":"/components/book/list/list",
8 "nav":"/components/nav/nav", 8 "nav":"/components/nav/nav",
9 - "tabBar":"/components/book/tabBar/tabBar" 9 + "tabBar":"/components/book/tabBar/tabBar",
  10 + "calendar": "plugin://calendar/calendar"
10 } 11 }
11 } 12 }
@@ -11,11 +11,13 @@ @@ -11,11 +11,13 @@
11 <input placeholder="桌位·预定人姓名·手机号" placeholder-class="font30r gray-font smooth" class="font30r black-font smooth search-input"/> 11 <input placeholder="桌位·预定人姓名·手机号" placeholder-class="font30r gray-font smooth" class="font30r black-font smooth search-input"/>
12 </view> 12 </view>
13 <view class="search-easy flex-lr"> 13 <view class="search-easy flex-lr">
14 - <view class="block flex-cc">  
15 - {{dateStr}} 14 + <view class="block flex-vc" bindtap="calendarShow">
  15 + <view class="black-font font30r">时间</view>
  16 + <view class="green-font font34r font-bold flex-cc" style="margin-top:40rpx;height:54rpx;">{{dateStr}}</view>
16 </view> 17 </view>
17 - <view class="block section flex-cc">  
18 - <view class="tab flex-cc"> 18 + <view class="block section flex-vc">
  19 + <view class="black-font font30r">时段</view>
  20 + <view class="tab flex-cc" style="margin-top:40rpx;">
19 <item class="item {{form.time==0?'checked':''}}" 21 <item class="item {{form.time==0?'checked':''}}"
20 bindtap="selectedValue" data-key="time" data-value="0"> 22 bindtap="selectedValue" data-key="time" data-value="0">
21 早市 23 早市
@@ -40,15 +42,31 @@ @@ -40,15 +42,31 @@
40 <view class="flex-cc" bindtap="timeorder">时间<image src="../image/direction.png" class="icon22-26" background-size="cover"></image></view> 42 <view class="flex-cc" bindtap="timeorder">时间<image src="../image/direction.png" class="icon22-26" background-size="cover"></image></view>
41 <view class="flex-rr">操作</view> 43 <view class="flex-rr">操作</view>
42 </view> 44 </view>
43 - <scroll-view class="book-list" style="height:{{listHeight}}px;" scroll-y bindscroll="addbooklist"> 45 + <view class="book-list" style="padding-bottom:118rpx;">
44 <view class="book-list-body"> 46 <view class="book-list-body">
45 <block wx:for="{{bookList}}"> 47 <block wx:for="{{bookList}}">
46 <bookList item="{{item}}"></bookList> 48 <bookList item="{{item}}"></bookList>
47 </block> 49 </block>
48 </view> 50 </view>
49 - </scroll-view> 51 + </view>
50 </view> 52 </view>
51 </view> 53 </view>
52 </block> 54 </block>
53 </block> 55 </block>
54 -<tabBar></tabBar>  
  56 +<tabBar></tabBar>
  57 +
  58 +<view class="calendar-mask"
  59 + bindtap="calendarClose"
  60 + style="left:{{calendarMask?0:-5000}}px;" wx:if="{{calendarMaskLoad}}">
  61 +<calendar weeks-type="cn"
  62 + year="{{showyear}}"
  63 + month="{{showmonth}}"
  64 + day="{{showday}}"
  65 + start-date="2018-09"
  66 + days-color="{{dayStyle}}"
  67 + binddayClick="dateChange"
  68 + active-type="rounded"
  69 + calendar-style="calendar"
  70 + header-style="calendar-header"
  71 + board-style="calendar-board"></calendar>
  72 +</view>
@@ -11,7 +11,6 @@ page{ @@ -11,7 +11,6 @@ page{
11 border-radius:40rpx; 11 border-radius:40rpx;
12 box-shadow: 0 0 8px #ccc; 12 box-shadow: 0 0 8px #ccc;
13 margin:0 auto; 13 margin:0 auto;
14 - margin-bottom:20rpx;  
15 } 14 }
16 .search-icon{ 15 .search-icon{
17 width:40rpx; 16 width:40rpx;
@@ -61,19 +60,16 @@ page{ @@ -61,19 +60,16 @@ page{
61 } 60 }
62 61
63 .search-easy{ 62 .search-easy{
64 - height: 80rpx;  
65 - line-height: 80rpx;  
66 - margin-bottom: 20rpx;  
67 - font-weight: bold;  
68 - color:#199095; 63 + height:160rpx;
  64 + padding:30rpx 0;
69 } 65 }
70 .search-easy .block{ 66 .search-easy .block{
71 width: 50%; 67 width: 50%;
72 min-width: 50%; 68 min-width: 50%;
73 - height: 80rpx; 69 + height: 100%;
74 } 70 }
75 .search-easy .block:first-child{ 71 .search-easy .block:first-child{
76 - border-right: 2rpx solid #E0E0E0; 72 + border-right: 1px solid #E0E0E0;
77 } 73 }
78 .section .tab{ 74 .section .tab{
79 font-size: 34rpx; 75 font-size: 34rpx;
@@ -94,4 +90,30 @@ page{ @@ -94,4 +90,30 @@ page{
94 .section .tab .checked{ 90 .section .tab .checked{
95 background-color:#199095; 91 background-color:#199095;
96 color: #FEFEFE; 92 color: #FEFEFE;
  93 +}
  94 +
  95 +
  96 +.calendar-mask{
  97 + position: fixed;
  98 + z-index: 99;
  99 + width: 100%;
  100 + height: 100%;
  101 + left:0;
  102 + top:0;
  103 + background-color: rgba(0,0,0,.5);
  104 +}
  105 +.calendar {
  106 + background-color: #eeedff;
  107 + padding-top: 10px;
  108 + position: fixed;
  109 + bottom: 0;
  110 + width: 100%;
  111 +}
  112 +.calendar-header{
  113 + font-size: large; /*修改了标题文字和按钮的大小*/
  114 + color: #605eac; /*修改了标题文字和按钮的颜色*/
  115 +}
  116 +.calendar-board {
  117 + background-color: #dddcff;
  118 + color: white;
97 } 119 }