Commit a27d01fa282e067a2f652814f39fa347fe4a34e2
Merge remote-tracking branch 'origin/master'
# Conflicts: # pages/book/b_addnew.js
Showing
1 changed file
with
7 additions
and
130 deletions
| @@ -350,130 +350,6 @@ Page({ | @@ -350,130 +350,6 @@ Page({ | ||
| 350 | return true; | 350 | return true; |
| 351 | } | 351 | } |
| 352 | }) | 352 | }) |
| 353 | - let form=this.data.form; | ||
| 354 | - try{ | ||
| 355 | - let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time); | ||
| 356 | - console.log('rdate',this.data.dateStr[this.data.form.date],rdate); | ||
| 357 | - App.Reserve.GetTableList({ | ||
| 358 | - sid:this.sellerid, | ||
| 359 | - pnum_str:form.pnum_str, | ||
| 360 | - rdate:rdate, | ||
| 361 | - tid:form.tabid, | ||
| 362 | - }).then(res=>{ | ||
| 363 | - let tables=[]; | ||
| 364 | - res.data.forEach(p=>{ | ||
| 365 | - if(tables.length>=3) return true; | ||
| 366 | - p.list.forEach(t=>{ | ||
| 367 | - if(tables.length>=3) return true; | ||
| 368 | - tables.push(t); | ||
| 369 | - }) | ||
| 370 | - }) | ||
| 371 | - this.tablesAll=res.data; | ||
| 372 | - this.setData({ | ||
| 373 | - tables:tables | ||
| 374 | - }) | ||
| 375 | - }) | ||
| 376 | - }catch (e){ | ||
| 377 | - this.setData({ | ||
| 378 | - tables:[] | ||
| 379 | - }) | ||
| 380 | - } | ||
| 381 | -}, | ||
| 382 | -async formsubmit(){ | ||
| 383 | - if(this.data.buttonhide) return; | ||
| 384 | - try { | ||
| 385 | - let rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date], this.data.form.time); | ||
| 386 | - console.log('rdate', rdate); | ||
| 387 | - this.setData({ | ||
| 388 | - buttonhide: true, | ||
| 389 | - }) | ||
| 390 | - let form = this.data.form; | ||
| 391 | - form.tid = form.tid.toString(); | ||
| 392 | - form.sid = this.sellerid; | ||
| 393 | - form.rdate =rdate | ||
| 394 | - App.Reserve.SetReserveInfo(form).then(res => { | ||
| 395 | - if(res.ret==200){ | ||
| 396 | - wx.navigateTo({ | ||
| 397 | - url:'b_detail?id='+res.data.id, | ||
| 398 | - }); | ||
| 399 | - }else{ | ||
| 400 | - util.toast(res.msg,'none') | ||
| 401 | - } | ||
| 402 | - }) | ||
| 403 | - }catch (e){} | ||
| 404 | -}, | ||
| 405 | -selectphone:function(e){ | ||
| 406 | - this.data.form.phone=e.detail.phone; | ||
| 407 | - this.data.form.rname=e.detail.rname; | ||
| 408 | - this.data.form.cusdem=e.detail.cusdem; | ||
| 409 | - var form=this.data.form | ||
| 410 | - this.data.form.sex=e.detail.sex; | ||
| 411 | - this.setData({ | ||
| 412 | - form:this.data.form, | ||
| 413 | - searchlist:null, | ||
| 414 | - | ||
| 415 | - }) | ||
| 416 | - this.conditionInfo(); | ||
| 417 | -}, | ||
| 418 | -calendarShow(){ | ||
| 419 | - this.setData({ | ||
| 420 | - calendarMask:true | ||
| 421 | - }) | ||
| 422 | -}, | ||
| 423 | -dateChange(event){ | ||
| 424 | - console.log(event); | ||
| 425 | - let clickDay = event.detail.day; | ||
| 426 | - let changeDay = `dayStyle[1].day`; | ||
| 427 | - let changeBg = `dayStyle[1].background`; | ||
| 428 | - this.setData({ | ||
| 429 | - [changeDay]: clickDay, | ||
| 430 | - [changeBg]: "#199095" | ||
| 431 | - }) | ||
| 432 | - this.setDateStr(util.timetouUnix(event.detail.year+'/'+event.detail.month+'/'+event.detail.day)) | ||
| 433 | - this.getTables() | ||
| 434 | -}, | ||
| 435 | -calendarClose(){ | ||
| 436 | - this.setData({ | ||
| 437 | - calendarMask:false | ||
| 438 | - }) | ||
| 439 | -}, | ||
| 440 | -async selectdesk(){ | ||
| 441 | - let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time); | ||
| 442 | - console.log(this.data.form) | ||
| 443 | - wx.navigateTo({ | ||
| 444 | - url:'b_desk?rdate='+rdate+'&tid='+this.data.form.tabid+'&pnum_str='+this.data.form.pnum_str | ||
| 445 | - }) | ||
| 446 | -}, | ||
| 447 | -conditionInfo:function(){ | ||
| 448 | - var form=this.data.form | ||
| 449 | - if(form.tid.length>0 && form.rname.length>0){ | ||
| 450 | - this.data.buttonhide=false; | ||
| 451 | - } | ||
| 452 | - this.setData({ | ||
| 453 | - buttonhide:this.data.buttonhide | ||
| 454 | - }) | ||
| 455 | -}, | ||
| 456 | - /** | ||
| 457 | - * 修改初始化 | ||
| 458 | - */ | ||
| 459 | - async initModify(id){ | ||
| 460 | - try{ | ||
| 461 | - let res= await App.Reserve.Detail({rid:id,openid:''}); | ||
| 462 | - | ||
| 463 | - console.log('initModify',res); | ||
| 464 | - //设置日期 | ||
| 465 | - let obj = await this.setDateStr(res.data.rdate); | ||
| 466 | - //设置时间 | ||
| 467 | - let nd=util.unixtoTime(res.data.rdate,'HH:II'); | ||
| 468 | - let timePickerIndex=this.data.timePickerIndex | ||
| 469 | - console.log('initModify-',this.data.timePickerArray,obj.form.time) | ||
| 470 | - this.data.timePickerArray[obj.form.time].forEach((dd,ii)=>{ | ||
| 471 | - console.log('initModify-',nd,dd) | ||
| 472 | - if(nd==dd){ | ||
| 473 | - timePickerIndex[obj.form.time]=ii; | ||
| 474 | - return true; | ||
| 475 | - } | ||
| 476 | - }) | ||
| 477 | 353 | ||
| 478 | console.log('initModify-timePickerIndex',timePickerIndex); | 354 | console.log('initModify-timePickerIndex',timePickerIndex); |
| 479 | obj.form.pnum_str=res.data.pnum_str; | 355 | obj.form.pnum_str=res.data.pnum_str; |
| @@ -483,19 +359,20 @@ conditionInfo:function(){ | @@ -483,19 +359,20 @@ conditionInfo:function(){ | ||
| 483 | obj.form.cusdem=res.data.cusdem; | 359 | obj.form.cusdem=res.data.cusdem; |
| 484 | obj.form.rid=id; | 360 | obj.form.rid=id; |
| 485 | obj.form.tid=[]; | 361 | obj.form.tid=[]; |
| 362 | + let tablesed=[]; | ||
| 486 | res.data.tables.forEach((t,ti)=>{ | 363 | res.data.tables.forEach((t,ti)=>{ |
| 364 | + if(ti>=3) return; | ||
| 487 | t.isselect=true | 365 | t.isselect=true |
| 488 | - res.data.tables[ti]=t; | ||
| 489 | - obj.form.tid.push(t.id) | ||
| 490 | - }) | 366 | + obj.form.tid.push(t.id) |
| 367 | + tablesed.push(t); | ||
| 368 | + }) | ||
| 491 | this.setData({ | 369 | this.setData({ |
| 492 | timePickerIndex:timePickerIndex, | 370 | timePickerIndex:timePickerIndex, |
| 493 | form:obj.form, | 371 | form:obj.form, |
| 494 | - tablesed:res.data.tables, | 372 | + tablesed:tablesed, |
| 495 | }) | 373 | }) |
| 496 | }catch (e){ | 374 | }catch (e){ |
| 497 | console.log('initModify',e) | 375 | console.log('initModify',e) |
| 498 | } | 376 | } |
| 499 | }, | 377 | }, |
| 500 | - | ||
| 501 | -}) | 378 | +}) |
-
Please register or login to post a comment