Showing
6 changed files
with
104 additions
and
11 deletions
| @@ -4,7 +4,7 @@ import comm from '../../utils/bookCommon'; | @@ -4,7 +4,7 @@ import comm from '../../utils/bookCommon'; | ||
| 4 | import App from '../../utils/api'; | 4 | import App from '../../utils/api'; |
| 5 | const {regeneratorRuntime} = global | 5 | const {regeneratorRuntime} = global |
| 6 | const formTpl={ | 6 | const formTpl={ |
| 7 | - | 7 | + id:'', |
| 8 | date:0, | 8 | date:0, |
| 9 | time:0, | 9 | time:0, |
| 10 | pnum_str:'1-4', | 10 | pnum_str:'1-4', |
| @@ -66,20 +66,29 @@ Page({ | @@ -66,20 +66,29 @@ Page({ | ||
| 66 | this.setData({ | 66 | this.setData({ |
| 67 | timePickerArray: timePickerArray, | 67 | timePickerArray: timePickerArray, |
| 68 | }) | 68 | }) |
| 69 | + if(options.id>0){ | ||
| 70 | + this.initModify(options.id); | ||
| 71 | + } | ||
| 69 | }, | 72 | }, |
| 70 | /** | 73 | /** |
| 71 | * | 74 | * |
| 72 | * @param d | 75 | * @param d |
| 73 | * | 76 | * |
| 74 | */ | 77 | */ |
| 75 | - setDateStr(d=new Date()/1000){ | 78 | + async setDateStr(d=new Date()/1000){ |
| 76 | let dateStr=[ | 79 | let dateStr=[ |
| 77 | util.unixtoTime(d,'MM-DD `DAY/周WW`'), | 80 | util.unixtoTime(d,'MM-DD `DAY/周WW`'), |
| 78 | util.unixtoTime(parseInt(d)+86400,'MM-DD `DAY/周WW`'), | 81 | util.unixtoTime(parseInt(d)+86400,'MM-DD `DAY/周WW`'), |
| 79 | ]; | 82 | ]; |
| 80 | - this.setData({ | 83 | + let form=this.data.form; |
| 84 | + form.time=await comm.getTimeSpaceIndex(d); | ||
| 85 | + let obj={ | ||
| 81 | dateStr:dateStr, | 86 | dateStr:dateStr, |
| 82 | - }) | 87 | + form:form, |
| 88 | + }; | ||
| 89 | + this.setData(obj) | ||
| 90 | + return obj; | ||
| 91 | + | ||
| 83 | }, | 92 | }, |
| 84 | 93 | ||
| 85 | /** | 94 | /** |
| @@ -296,4 +305,48 @@ Page({ | @@ -296,4 +305,48 @@ Page({ | ||
| 296 | timePickerIndex:timePickerIndex, | 305 | timePickerIndex:timePickerIndex, |
| 297 | }) | 306 | }) |
| 298 | }, | 307 | }, |
| 308 | + /** | ||
| 309 | + * 修改初始化 | ||
| 310 | + */ | ||
| 311 | + async initModify(id){ | ||
| 312 | + try{ | ||
| 313 | + let res= await App.Reserve.Detail({rid:id,openid:''}); | ||
| 314 | + | ||
| 315 | + console.log('initModify',res); | ||
| 316 | + //设置日期 | ||
| 317 | + let obj = await this.setDateStr(res.data.rdate); | ||
| 318 | + //设置时间 | ||
| 319 | + let nd=util.unixtoTime(res.data.rdate,'HH:II'); | ||
| 320 | + let timePickerIndex=this.data.timePickerIndex | ||
| 321 | + console.log('initModify-',this.data.timePickerArray,obj.form.time) | ||
| 322 | + this.data.timePickerArray[obj.form.time].forEach((dd,ii)=>{ | ||
| 323 | + console.log('initModify-',nd,dd) | ||
| 324 | + if(nd==dd){ | ||
| 325 | + timePickerIndex[obj.form.time]=ii; | ||
| 326 | + return true; | ||
| 327 | + } | ||
| 328 | + }) | ||
| 329 | + | ||
| 330 | + console.log('initModify-timePickerIndex',timePickerIndex); | ||
| 331 | + obj.form.pnum_str=res.data.pnum_str; | ||
| 332 | + obj.form.rname=res.data.rname; | ||
| 333 | + obj.form.phone=res.data.phone; | ||
| 334 | + obj.form.sex=res.data.sex; | ||
| 335 | + obj.form.cusdem=res.data.cusdem; | ||
| 336 | + obj.form.id=id; | ||
| 337 | + obj.form.tid=[]; | ||
| 338 | + res.data.tables.forEach((t,ti)=>{ | ||
| 339 | + t.isselect=true | ||
| 340 | + res.data.tables[ti]=t; | ||
| 341 | + obj.form.tid.push(t.id) | ||
| 342 | + }) | ||
| 343 | + this.setData({ | ||
| 344 | + timePickerIndex:timePickerIndex, | ||
| 345 | + form:obj.form, | ||
| 346 | + tablesed:res.data.tables, | ||
| 347 | + }) | ||
| 348 | + }catch (e){ | ||
| 349 | + console.log('initModify',e) | ||
| 350 | + } | ||
| 351 | + } | ||
| 299 | }) | 352 | }) |
| @@ -88,10 +88,10 @@ | @@ -88,10 +88,10 @@ | ||
| 88 | 88 | ||
| 89 | <view class="page-full tables"> | 89 | <view class="page-full tables"> |
| 90 | <view class="page"> | 90 | <view class="page"> |
| 91 | - <view class="title">可订桌位</view> | 91 | + <view class="title">可订桌位<text wx:if="{{tables.length>0}}"> ({{tables.length}})</text></view> |
| 92 | <view class="advice-desk-detail flex-lr" wx:if="{{tables.length>0}}"> | 92 | <view class="advice-desk-detail flex-lr" wx:if="{{tables.length>0}}"> |
| 93 | <view class="flex-ll"> | 93 | <view class="flex-ll"> |
| 94 | - <block wx:for="{{tables}}" wx:key="tables.key"> | 94 | + <block wx:for="{{tablesed||tables}}" wx:key="tables.key"> |
| 95 | <view class="order-desk-info" | 95 | <view class="order-desk-info" |
| 96 | bindtap="selectedValue" | 96 | bindtap="selectedValue" |
| 97 | data-value="{{index}}" | 97 | data-value="{{index}}" |
| @@ -113,7 +113,7 @@ | @@ -113,7 +113,7 @@ | ||
| 113 | </view> | 113 | </view> |
| 114 | </block> | 114 | </block> |
| 115 | </view> | 115 | </view> |
| 116 | - <view class="flex-rr advice-more" bindtap="selectdesk"> | 116 | + <view class="flex-rr advice-more" bindtap="selectdesk" wx:if="{{tables.length>3 || form.id>0}}"> |
| 117 | <view style="padding-right:30rpx;" class="gray-deep-font font26r">更多</view> | 117 | <view style="padding-right:30rpx;" class="gray-deep-font font26r">更多</view> |
| 118 | <image src="../image/click.png" class="icon12-22"></image> | 118 | <image src="../image/click.png" class="icon12-22"></image> |
| 119 | </view> | 119 | </view> |
| 1 | <nav>订座详情</nav> | 1 | <nav>订座详情</nav> |
| 2 | <!--订单信息--> | 2 | <!--订单信息--> |
| 3 | -<view class="order-info"> | 3 | +<view class="order-info" bindtap="gotoModify"> |
| 4 | <view class="flex-lr order-detail"> | 4 | <view class="flex-lr order-detail"> |
| 5 | <view class="gray-deep-font font30r">用餐时间</view> | 5 | <view class="gray-deep-font font30r">用餐时间</view> |
| 6 | <view class="black-font font34r">{{bookInfo.rdateStr}}</view> | 6 | <view class="black-font font34r">{{bookInfo.rdateStr}}</view> |
| @@ -30,7 +30,7 @@ | @@ -30,7 +30,7 @@ | ||
| 30 | "list": [] | 30 | "list": [] |
| 31 | }, | 31 | }, |
| 32 | "miniprogram": { | 32 | "miniprogram": { |
| 33 | - "current": 16, | 33 | + "current": 17, |
| 34 | "list": [ | 34 | "list": [ |
| 35 | { | 35 | { |
| 36 | "id": 0, | 36 | "id": 0, |
| @@ -162,6 +162,13 @@ | @@ -162,6 +162,13 @@ | ||
| 162 | "name": "预定本-发短信", | 162 | "name": "预定本-发短信", |
| 163 | "pathName": "pages/book/b_sms", | 163 | "pathName": "pages/book/b_sms", |
| 164 | "query": "id=25" | 164 | "query": "id=25" |
| 165 | + }, | ||
| 166 | + { | ||
| 167 | + "id": -1, | ||
| 168 | + "name": "预定本-编辑预定信息", | ||
| 169 | + "pathName": "pages/book/b_addnew", | ||
| 170 | + "query": "id=51", | ||
| 171 | + "scene": "1001" | ||
| 165 | } | 172 | } |
| 166 | ] | 173 | ] |
| 167 | } | 174 | } |
| @@ -59,8 +59,9 @@ module.exports ={ | @@ -59,8 +59,9 @@ module.exports ={ | ||
| 59 | } | 59 | } |
| 60 | if (sc.daily){ | 60 | if (sc.daily){ |
| 61 | let ti=['morning','noon','night']; | 61 | let ti=['morning','noon','night']; |
| 62 | + console.log('getTimeSpace',sc.daily[ti[timeIndex]],timeIndex); | ||
| 62 | let ts=sc.daily[ti[timeIndex]].split('-'); | 63 | let ts=sc.daily[ti[timeIndex]].split('-'); |
| 63 | - console.log(ts); | 64 | + |
| 64 | let stime | 65 | let stime |
| 65 | if(stimestr){ | 66 | if(stimestr){ |
| 66 | stime=util.unixtoTime(d,'YYYY-'+mmdd+' '+stimestr); | 67 | stime=util.unixtoTime(d,'YYYY-'+mmdd+' '+stimestr); |
| @@ -89,7 +90,7 @@ module.exports ={ | @@ -89,7 +90,7 @@ module.exports ={ | ||
| 89 | let dts=[[],[],[]]; | 90 | let dts=[[],[],[]]; |
| 90 | ti.forEach((tx,ii)=>{ | 91 | ti.forEach((tx,ii)=>{ |
| 91 | let ts=sc.daily[tx].split('-'); | 92 | let ts=sc.daily[tx].split('-'); |
| 92 | - console.log(ts); | 93 | + console.log('getDayTimeSpace',ts); |
| 93 | while (ts[0]<=ts[1]){ | 94 | while (ts[0]<=ts[1]){ |
| 94 | dts[ii].push(ts[0]); | 95 | dts[ii].push(ts[0]); |
| 95 | let _dt=ts[0].split(':'); | 96 | let _dt=ts[0].split(':'); |
| @@ -110,5 +111,32 @@ module.exports ={ | @@ -110,5 +111,32 @@ module.exports ={ | ||
| 110 | console.log(e); | 111 | console.log(e); |
| 111 | } | 112 | } |
| 112 | return false; | 113 | return false; |
| 114 | + }, | ||
| 115 | + //获得时间戳在早中晚的索引 | ||
| 116 | + async getTimeSpaceIndex(d=new Date()/1000,sc=null){ | ||
| 117 | + try { | ||
| 118 | + if(!sc){ | ||
| 119 | + let res = await App.Reserve.SellerInfo(util.cache('enter_params')); | ||
| 120 | + sc = res.data; | ||
| 121 | + } | ||
| 122 | + if (sc.daily){ | ||
| 123 | + let ti=['morning','noon','night']; | ||
| 124 | + let dti=0; | ||
| 125 | + let date=util.unixtoTime(d,'HH:II') | ||
| 126 | + ti.forEach((tx,ii)=>{ | ||
| 127 | + let ts=sc.daily[tx].split('-'); | ||
| 128 | + console.log('getTimeSpaceIndex',ts); | ||
| 129 | + if(date>=ts[0] && ts[0]<=ts[1]){ | ||
| 130 | + dti=ii; | ||
| 131 | + return dti; | ||
| 132 | + } | ||
| 133 | + }) | ||
| 134 | + return dti; | ||
| 135 | + } | ||
| 136 | + }catch (e){ | ||
| 137 | + console.log(e); | ||
| 138 | + } | ||
| 139 | + return 0; | ||
| 113 | } | 140 | } |
| 141 | + | ||
| 114 | } | 142 | } |
-
Please register or login to post a comment