|
@@ -19,7 +19,8 @@ Component({ |
|
@@ -19,7 +19,8 @@ Component({ |
|
19
|
}
|
19
|
}
|
|
20
|
},
|
20
|
},
|
|
21
|
data:{
|
21
|
data:{
|
|
22
|
- roomlist:[],
|
22
|
+ roomlist:[],
|
|
|
|
23
|
+ ddate_solt:'',
|
|
23
|
},
|
24
|
},
|
|
24
|
observers: {
|
25
|
observers: {
|
|
25
|
'date,section': function(newdate,newsection) {
|
26
|
'date,section': function(newdate,newsection) {
|
|
@@ -28,7 +29,7 @@ Component({ |
|
@@ -28,7 +29,7 @@ Component({ |
|
28
|
roomlist:[]
|
29
|
roomlist:[]
|
|
29
|
})
|
30
|
})
|
|
30
|
if(newdate && newsection){
|
31
|
if(newdate && newsection){
|
|
31
|
- this.getroomtype();
|
32
|
+ this.getLocalLunchTime()
|
|
32
|
}
|
33
|
}
|
|
33
|
}
|
34
|
}
|
|
34
|
},
|
35
|
},
|
|
@@ -36,11 +37,62 @@ Component({ |
|
@@ -36,11 +37,62 @@ Component({ |
|
36
|
console.log('初次进入详情页---小米8测试',this.data.date ? this.data.date : '没有日期','openid:',getApp().openid)
|
37
|
console.log('初次进入详情页---小米8测试',this.data.date ? this.data.date : '没有日期','openid:',getApp().openid)
|
|
37
|
},
|
38
|
},
|
|
38
|
methods:{
|
39
|
methods:{
|
|
39
|
- getroomtype(){
|
40
|
+ //获取日期对应的多时段
|
|
|
|
41
|
+ getLocalLunchTime(){
|
|
|
|
42
|
+ App.Seller.getMealSectionByDay({
|
|
|
|
43
|
+ sellerid: this.data.seller.id,
|
|
|
|
44
|
+ day: this.data.date,
|
|
|
|
45
|
+ }).then(res => {
|
|
|
|
46
|
+ let data = res.data;
|
|
|
|
47
|
+ let lunchDinnerList = [];
|
|
|
|
48
|
+ if (data.length <= 3 && !data[0].ddate_solt) {
|
|
|
|
49
|
+ data.forEach(i => {
|
|
|
|
50
|
+ if (i.mname == '早餐') {
|
|
|
|
51
|
+ lunchDinnerList.push({
|
|
|
|
52
|
+ mname: "早餐",
|
|
|
|
53
|
+ mdate: i.mdate,
|
|
|
|
54
|
+ ddate_solt: 1,
|
|
|
|
55
|
+ })
|
|
|
|
56
|
+ }
|
|
|
|
57
|
+ if (i.mname == '午餐') {
|
|
|
|
58
|
+ lunchDinnerList.push({
|
|
|
|
59
|
+ mname: "午餐",
|
|
|
|
60
|
+ mdate: i.mdate,
|
|
|
|
61
|
+ ddate_solt: 2,
|
|
|
|
62
|
+ })
|
|
|
|
63
|
+ }
|
|
|
|
64
|
+ if (i.mname == '晚餐') {
|
|
|
|
65
|
+ lunchDinnerList.push({
|
|
|
|
66
|
+ mname: "晚餐",
|
|
|
|
67
|
+ mdate: i.mdate,
|
|
|
|
68
|
+ ddate_solt: 3,
|
|
|
|
69
|
+ })
|
|
|
|
70
|
+ }
|
|
|
|
71
|
+ })
|
|
|
|
72
|
+ } else {
|
|
|
|
73
|
+ lunchDinnerList = data;
|
|
|
|
74
|
+ }
|
|
|
|
75
|
+ lunchDinnerList.forEach((item,index)=>{
|
|
|
|
76
|
+ item.section = 'ket'+index
|
|
|
|
77
|
+ })
|
|
|
|
78
|
+ let obj=lunchDinnerList.filter(item=>{return item.section == this.data.section});
|
|
|
|
79
|
+ let ddate_solt = '';
|
|
|
|
80
|
+ if(obj && obj[0]){
|
|
|
|
81
|
+ ddate_solt = obj[0].ddate_solt;
|
|
|
|
82
|
+ }
|
|
|
|
83
|
+ this.setData({
|
|
|
|
84
|
+ ddate_solt
|
|
|
|
85
|
+ })
|
|
|
|
86
|
+ this.getroomtype(ddate_solt)
|
|
|
|
87
|
+ }).catch(res => {
|
|
|
|
88
|
+ console.log(res, '获取多时段失败');
|
|
|
|
89
|
+ })
|
|
|
|
90
|
+ },
|
|
|
|
91
|
+ getroomtype(ddate_solt){
|
|
40
|
let parmdata={
|
92
|
let parmdata={
|
|
41
|
sellerid:this.data.seller.id,
|
93
|
sellerid:this.data.seller.id,
|
|
42
|
day:util.timetouUnix(this.data.date+' 00:00:00'),
|
94
|
day:util.timetouUnix(this.data.date+' 00:00:00'),
|
|
43
|
- interval:dur.indexOf(this.data.section)+1
|
95
|
+ interval:ddate_solt,
|
|
44
|
}
|
96
|
}
|
|
45
|
console.log('参数',this.data.date,parmdata);
|
97
|
console.log('参数',this.data.date,parmdata);
|
|
46
|
App.Seller.GetSellerTableClass(parmdata).then((json)=>{
|
98
|
App.Seller.GetSellerTableClass(parmdata).then((json)=>{
|
|
@@ -55,7 +107,7 @@ Component({ |
|
@@ -55,7 +107,7 @@ Component({ |
|
55
|
}
|
107
|
}
|
|
56
|
this.setData({
|
108
|
this.setData({
|
|
57
|
roomlist:json.data
|
109
|
roomlist:json.data
|
|
58
|
- })
|
110
|
+ })
|
|
59
|
if(this.data.seletroomlist.length>0){
|
111
|
if(this.data.seletroomlist.length>0){
|
|
60
|
this.changestyle();
|
112
|
this.changestyle();
|
|
61
|
}
|
113
|
}
|
|
@@ -72,7 +124,7 @@ Component({ |
|
@@ -72,7 +124,7 @@ Component({ |
|
72
|
act:'reserve',
|
124
|
act:'reserve',
|
|
73
|
seller:this.data.seller.sellername,
|
125
|
seller:this.data.seller.sellername,
|
|
74
|
date:this.data.date,
|
126
|
date:this.data.date,
|
|
75
|
- section:this.data.section,
|
127
|
+ section:this.data.section,
|
|
76
|
room:this.data.roomlist[_target.index].name
|
128
|
room:this.data.roomlist[_target.index].name
|
|
77
|
}
|
129
|
}
|
|
78
|
// this.selectComponent('#qiang').show(obj);
|
130
|
// this.selectComponent('#qiang').show(obj);
|
|
@@ -101,7 +153,7 @@ Component({ |
|
@@ -101,7 +153,7 @@ Component({ |
|
101
|
let parmdata={
|
153
|
let parmdata={
|
|
102
|
classid:_target.id,
|
154
|
classid:_target.id,
|
|
103
|
day:util.timetouUnix(this.data.date+' 00:00:00'),
|
155
|
day:util.timetouUnix(this.data.date+' 00:00:00'),
|
|
104
|
- interval:dur.indexOf(this.data.section)+1
|
156
|
+ interval:this.ddate_solt
|
|
105
|
}
|
157
|
}
|
|
106
|
if(_target.fid){
|
158
|
if(_target.fid){
|
|
107
|
parmdata.id=_target.fid;
|
159
|
parmdata.id=_target.fid;
|
|
@@ -110,7 +162,7 @@ Component({ |
|
@@ -110,7 +162,7 @@ Component({ |
|
110
|
console.log(json)
|
162
|
console.log(json)
|
|
111
|
if(json.ret==200){
|
163
|
if(json.ret==200){
|
|
112
|
this.triggerEvent('changeroom',{id:_target.id,action:parmdata.id ? 'cancel' : 'confirm'})
|
164
|
this.triggerEvent('changeroom',{id:_target.id,action:parmdata.id ? 'cancel' : 'confirm'})
|
|
113
|
- this.getroomtype();
|
165
|
+ this.getLocalLunchTime();
|
|
114
|
}
|
166
|
}
|
|
115
|
})
|
167
|
})
|
|
116
|
}
|
168
|
}
|
|
@@ -128,7 +180,7 @@ Component({ |
|
@@ -128,7 +180,7 @@ Component({ |
|
128
|
})
|
180
|
})
|
|
129
|
},
|
181
|
},
|
|
130
|
changestyle(){
|
182
|
changestyle(){
|
|
131
|
- let seletroomlist=this.data.seletroomlist;
|
183
|
+ let seletroomlist=this.data.seletroomlist;
|
|
132
|
let roomlist=this.data.roomlist;
|
184
|
let roomlist=this.data.roomlist;
|
|
133
|
seletroomlist.forEach((v,i)=>{
|
185
|
seletroomlist.forEach((v,i)=>{
|
|
134
|
roomlist.forEach((r,n)=>{
|
186
|
roomlist.forEach((r,n)=>{
|