Commit 3309e3c8fe7dc1238fa5d8fc397e9c3a8ea028f3

Authored by liuxuqinfhp1220
1 parent bdc67407

no message

@@ -12,6 +12,10 @@ Component({ @@ -12,6 +12,10 @@ Component({
12 usecondition:{ 12 usecondition:{
13 type:String, 13 type:String,
14 value:'custom' 14 value:'custom'
  15 + },
  16 + seletroomlist:{
  17 + type:Array,
  18 + value:[]
15 } 19 }
16 }, 20 },
17 data:{ 21 data:{
@@ -20,20 +24,8 @@ Component({ @@ -20,20 +24,8 @@ Component({
20 observers: { 24 observers: {
21 'date,section': function(newdate,newsection) { 25 'date,section': function(newdate,newsection) {
22 console.log('room',newdate,newsection) 26 console.log('room',newdate,newsection)
23 - console.log('old',this.date,this.section)  
24 if(newdate && newsection){ 27 if(newdate && newsection){
25 - if(this.date && this.section){  
26 - console.log(this.date=!newdate || this.section!=newsection)  
27 - if(this.date=!newdate || this.section!=newsection){  
28 - this.getroomtype();  
29 - this.date=newdate;  
30 - this.section=newsection;  
31 - }  
32 - }else{  
33 - this.getroomtype();  
34 - this.date=newdate;  
35 - this.section=newsection;  
36 - } 28 + this.getroomtype();
37 } 29 }
38 } 30 }
39 }, 31 },
@@ -41,7 +33,7 @@ Component({ @@ -41,7 +33,7 @@ Component({
41 getroomtype(){ 33 getroomtype(){
42 let parmdata={ 34 let parmdata={
43 sellerid:this.data.seller.id, 35 sellerid:this.data.seller.id,
44 - day:util.timetouUnix(this.data.date,'-'), 36 + day:new Date(this.data.date+' 00:00:00')/1000,
45 interval:dur.indexOf(this.data.section)+1 37 interval:dur.indexOf(this.data.section)+1
46 } 38 }
47 App.Seller.GetSellerTableClass(parmdata).then((json)=>{ 39 App.Seller.GetSellerTableClass(parmdata).then((json)=>{
@@ -57,6 +49,9 @@ Component({ @@ -57,6 +49,9 @@ Component({
57 this.setData({ 49 this.setData({
58 roomlist:json.data 50 roomlist:json.data
59 }) 51 })
  52 + if(this.data.seletroomlist.length>0){
  53 + this.changestyle();
  54 + }
60 } 55 }
61 }) 56 })
62 }, 57 },
@@ -77,9 +72,9 @@ Component({ @@ -77,9 +72,9 @@ Component({
77 ////// 72 //////
78 console.log('置满') 73 console.log('置满')
79 let parmdata={ 74 let parmdata={
80 - classid:_target.id,  
81 - day:util.timetouUnix(this.data.date,'-'),  
82 - interval:dur.indexOf(this.data.section)+1 75 + classid:_target.id,
  76 + day:new Date(this.data.date+' 00:00:00')/1000,
  77 + interval:dur.indexOf(this.data.section)+1
83 } 78 }
84 if(_target.fid){ 79 if(_target.fid){
85 parmdata.id=_target.fid; 80 parmdata.id=_target.fid;
@@ -104,5 +99,19 @@ Component({ @@ -104,5 +99,19 @@ Component({
104 } 99 }
105 }) 100 })
106 }, 101 },
  102 + changestyle(){
  103 + let seletroomlist=this.data.seletroomlist;
  104 + let roomlist=this.data.roomlist;
  105 + seletroomlist.forEach((v,i)=>{
  106 + roomlist.forEach((r,n)=>{
  107 + if(v.id==r.id){
  108 + r.selectnum+=1;
  109 + }
  110 + })
  111 + })
  112 + this.setData({
  113 + roomlist:roomlist
  114 + })
  115 + },
107 } 116 }
108 }) 117 })
1 import util from '../../../utils/util'; 1 import util from '../../../utils/util';
2 import App from '../../../utils/api'; 2 import App from '../../../utils/api';
  3 +let dur=['morning','noon','night','midnight']
3 Component({ 4 Component({
4 properties:{ 5 properties:{
5 seller:Object, 6 seller:Object,
@@ -7,7 +8,8 @@ Component({ @@ -7,7 +8,8 @@ Component({
7 date:{ 8 date:{
8 type:String, 9 type:String,
9 value:util.unixtoTime(new Date()/1000,'YYYY-MM-DD'), 10 value:util.unixtoTime(new Date()/1000,'YYYY-MM-DD'),
10 - } 11 + },
  12 + section:String
11 }, 13 },
12 attached(){ 14 attached(){
13 }, 15 },
@@ -21,16 +23,20 @@ Component({ @@ -21,16 +23,20 @@ Component({
21 if(today==newdate){ 23 if(today==newdate){
22 this.markoversection(); 24 this.markoversection();
23 }else{ 25 }else{
24 - this.changesectionstyle(this.data.sectionlist[0].section); 26 + if(this.data.section){
  27 + this.changesectionstyle(this.data.section);
  28 + }else{
  29 + this.changesectionstyle(this.data.sectionlist[0].section);
  30 + }
25 let obj={ 31 let obj={
26 - section:this.data.sectionlist[0].section, 32 + section:this.data.section ? this.data.section : this.data.sectionlist[0].section,
27 action:'defalut', 33 action:'defalut',
28 time:this.data.sectionlist[0].sectiondur.split('-')[0] 34 time:this.data.sectionlist[0].sectiondur.split('-')[0]
29 } 35 }
30 this.triggerEvent('selectsection',obj) 36 this.triggerEvent('selectsection',obj)
31 } 37 }
32 } 38 }
33 - } 39 + },
34 }, 40 },
35 ready(){ 41 ready(){
36 42
@@ -8,34 +8,17 @@ Component({ @@ -8,34 +8,17 @@ Component({
8 value:util.unixtoTime(new Date()/1000,'YYYY-MM-DD') 8 value:util.unixtoTime(new Date()/1000,'YYYY-MM-DD')
9 }, 9 },
10 section:String, 10 section:String,
  11 + seletroomlist:{
  12 + type:Array,
  13 + value:[]
  14 + }
11 }, 15 },
12 data:{ 16 data:{
13 - seletroomlist:[]  
14 }, 17 },
15 attached(){ 18 attached(){
16 this.room=this.selectComponent('#room'); 19 this.room=this.selectComponent('#room');
17 console.log('xxxxx',this.data.seller); 20 console.log('xxxxx',this.data.seller);
18 }, 21 },
19 - observers: {  
20 - 'date,section': function(newdate,newsection) {  
21 - console.log('room',newdate,newsection)  
22 - if(newdate && newsection){  
23 - if(this.date && this.section){  
24 - if(newdate!=this.date || this.section!=newsection){  
25 - this.setData({  
26 - seletroomlist:[]  
27 - })  
28 - this.date=newdate;  
29 - this.section=newsection;  
30 - }  
31 - }else{  
32 - this.date=newdate;  
33 - this.section=newsection;  
34 - }  
35 -  
36 - }  
37 - }  
38 - },  
39 methods:{ 22 methods:{
40 selectroom(e){ 23 selectroom(e){
41 console.log(e) 24 console.log(e)
@@ -9,4 +9,4 @@ @@ -9,4 +9,4 @@
9 </view> 9 </view>
10 </block> 10 </block>
11 </view> 11 </view>
12 -<room bindselectroom="selectroom" seller="{{seller}}" date="{{date}}" section="{{section}}" id="room"></room>  
  12 +<room bindselectroom="selectroom" seller="{{seller}}" date="{{date}}" section="{{section}}" id="room" seletroomlist="{{seletroomlist}}"></room>
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <block wx:if="{{seller && seller.id}}"> 2 <block wx:if="{{seller && seller.id}}">
3 <calendar seller="{{seller}}" date="{{reserveDate}}" bindtellselectdate="selectdate" setroom="{{reserveRoom}}"></calendar> 3 <calendar seller="{{seller}}" date="{{reserveDate}}" bindtellselectdate="selectdate" setroom="{{reserveRoom}}"></calendar>
4 <view style="height:40rpx;"></view> 4 <view style="height:40rpx;"></view>
5 - <section seller="{{seller}}" date="{{reserveDate}}" bind:selectsection="selectsection"></section> 5 + <section seller="{{seller}}" date="{{reserveDate}}" bind:selectsection="selectsection" section="{{reserveSection}}"></section>
6 <view style="height:80rpx;"></view> 6 <view style="height:80rpx;"></view>
7 <select-room seller="{{seller}}" date="{{reserveDate}}" section="{{reserveSection}}" usecondition="seller" bindchangeroom="setroom"></select-room> 7 <select-room seller="{{seller}}" date="{{reserveDate}}" section="{{reserveSection}}" usecondition="seller" bindchangeroom="setroom"></select-room>
8 </block> 8 </block>
@@ -279,8 +279,9 @@ Page({ @@ -279,8 +279,9 @@ Page({
279 let t=setTimeout(()=>{ 279 let t=setTimeout(()=>{
280 this.setData({ 280 this.setData({
281 reserveSection:e.detail.section, 281 reserveSection:e.detail.section,
  282 + seletroomlist:e.detail.action=='click' ? [] : this.data.seletroomlist,
282 }) 283 })
283 - this.reserve.selectroom=[]; 284 + this.reserve.selectroom=e.detail.action=='click' ? [] : this.reserve.selectroom;
284 clearTimeout(t); 285 clearTimeout(t);
285 },0) 286 },0)
286 287
@@ -290,6 +291,9 @@ Page({ @@ -290,6 +291,9 @@ Page({
290 //包间类型改变 291 //包间类型改变
291 selectroom(e){ 292 selectroom(e){
292 console.log(e) 293 console.log(e)
  294 + this.setData({
  295 + seletroomlist:e.detail.selectroom
  296 + })
293 this.reserve.selectroom=e.detail.selectroom; 297 this.reserve.selectroom=e.detail.selectroom;
294 }, 298 },
295 complete(){ 299 complete(){
@@ -333,10 +337,12 @@ Page({ @@ -333,10 +337,12 @@ Page({
333 }) 337 })
334 } 338 }
335 this.reserve.date=e.detail.date; 339 this.reserve.date=e.detail.date;
336 - this.reserve.selectroom=[]; 340 + this.reserve.selectroom=e.detail.action=='click' ? [] : this.reserve.selectroom;
337 this.setData({ 341 this.setData({
338 reserveDate:e.detail.date, 342 reserveDate:e.detail.date,
  343 + seletroomlist:e.detail.action=='click' ? [] : this.data.seletroomlist,
339 hasFullHouse:false, 344 hasFullHouse:false,
  345 + reserveSection:e.detail.action=='click' ? null : this.data.reserveSection,
340 fullHouseMsg:'今日所有包间已订满', 346 fullHouseMsg:'今日所有包间已订满',
341 }) 347 })
342 } 348 }
@@ -213,8 +213,8 @@ @@ -213,8 +213,8 @@
213 <view class="olreserve bg_white"> 213 <view class="olreserve bg_white">
214 <calendar seller="{{seller}}" bindselectdate="selectdate"></calendar> 214 <calendar seller="{{seller}}" bindselectdate="selectdate"></calendar>
215 <view class="reserve-time Semibold">预订时段</view> 215 <view class="reserve-time Semibold">预订时段</view>
216 - <section seller="{{seller}}" date="{{reserveDate}}" bind:selectsection="selectsection"></section>  
217 - <select-room seller="{{seller}}" date="{{reserveDate}}" section="{{reserveSection}}" bindchangeroom="selectroom"></select-room> 216 + <section seller="{{seller}}" date="{{reserveDate}}" bind:selectsection="selectsection" section="{{reserveSection}}"></section>
  217 + <select-room seller="{{seller}}" date="{{reserveDate}}" section="{{reserveSection}}" seletroomlist="{{seletroomlist}}" bindchangeroom="selectroom"></select-room>
218 </view> 218 </view>
219 <view class="white-font font32r reserve-button flex-cc" catchtap="complete">选好了</view> 219 <view class="white-font font32r reserve-button flex-cc" catchtap="complete">选好了</view>
220 </view> 220 </view>
@@ -471,7 +471,7 @@ @@ -471,7 +471,7 @@
471 "id": 56, 471 "id": 56,
472 "name": "测试组件", 472 "name": "测试组件",
473 "pathName": "pages/reserve/detail", 473 "pathName": "pages/reserve/detail",
474 - "query": "id=154", 474 + "query": "id=48",
475 "scene": null 475 "scene": null
476 }, 476 },
477 { 477 {