|
@@ -3,286 +3,364 @@ import util from '../../utils/util'; |
|
@@ -3,286 +3,364 @@ import util from '../../utils/util'; |
|
3
|
import comm from '../../utils/bookCommon';
|
3
|
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
|
-Page({
|
|
|
|
7
|
- /**
|
|
|
|
8
|
- * 页面的初始数据
|
|
|
|
9
|
- */
|
|
|
|
10
|
- data: {
|
|
|
|
11
|
- dateStr:[],
|
|
|
|
12
|
- form:{
|
6
|
+const formTpl={
|
|
|
|
7
|
+ rid:'',
|
|
|
|
8
|
+ date:0,
|
|
|
|
9
|
+ time:0,
|
|
|
|
10
|
+ pnum_str:'1-4',
|
|
|
|
11
|
+ tabid:0,
|
|
13
|
|
12
|
|
|
14
|
- date:0,
|
|
|
|
15
|
- time:0,
|
|
|
|
16
|
- pnum_str:'1-4',
|
|
|
|
17
|
- tabid:0,
|
13
|
+ rname:'',
|
|
|
|
14
|
+ phone:'',
|
|
|
|
15
|
+ sex:1,
|
|
|
|
16
|
+ cusdem:'',
|
|
18
|
|
17
|
|
|
19
|
- rname:'',
|
|
|
|
20
|
- phone:'',
|
|
|
|
21
|
- sex:1,
|
|
|
|
22
|
- cusdem:'',
|
18
|
+ tid:[],
|
|
23
|
|
19
|
|
|
24
|
- tid:[],
|
20
|
+}
|
|
|
|
21
|
+Page({
|
|
25
|
|
22
|
|
|
26
|
- },
|
|
|
|
27
|
- tables:[],
|
|
|
|
28
|
- grand:[
|
|
|
|
29
|
- {
|
|
|
|
30
|
- sex:1,
|
|
|
|
31
|
- grand_title:'先生',
|
|
|
|
32
|
- isselect:true
|
|
|
|
33
|
- },
|
|
|
|
34
|
- {
|
|
|
|
35
|
- sex:2,
|
|
|
|
36
|
- grand_title:'女士',
|
|
|
|
37
|
- isselect:false
|
|
|
|
38
|
- }
|
|
|
|
39
|
- ],
|
|
|
|
40
|
- buttonhide:true,
|
23
|
+ /**
|
|
|
|
24
|
+ * 页面的初始数据
|
|
|
|
25
|
+ */
|
|
|
|
26
|
+ data: {
|
|
|
|
27
|
+ dateStr:[],
|
|
|
|
28
|
+ form:JSON.parse(JSON.stringify(formTpl)),
|
|
|
|
29
|
+ tables:[],
|
|
|
|
30
|
+ grand:[
|
|
|
|
31
|
+ {
|
|
|
|
32
|
+ sex:1,
|
|
|
|
33
|
+ grand_title:'先生',
|
|
|
|
34
|
+ isselect:true
|
|
|
|
35
|
+ },
|
|
|
|
36
|
+ {
|
|
|
|
37
|
+ sex:2,
|
|
|
|
38
|
+ grand_title:'女士',
|
|
|
|
39
|
+ isselect:false
|
|
|
|
40
|
+ }
|
|
|
|
41
|
+ ],
|
|
|
|
42
|
+ buttonhide:true,
|
|
41
|
|
43
|
|
|
42
|
- calendarMaskLoad:false,
|
|
|
|
43
|
- calendarMask:false,
|
|
|
|
44
|
- dayStyle:[
|
|
|
|
45
|
- { month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' },
|
|
|
|
46
|
- { month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' }
|
|
|
|
47
|
- ],
|
|
|
|
48
|
- },
|
44
|
+ calendarMaskLoad:false,
|
|
|
|
45
|
+ calendarMask:false,
|
|
|
|
46
|
+ dayStyle:[
|
|
|
|
47
|
+ { month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' },
|
|
|
|
48
|
+ { month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' }
|
|
|
|
49
|
+ ],
|
|
|
|
50
|
+ },
|
|
49
|
tablesAll:[],
|
51
|
tablesAll:[],
|
|
50
|
- /**
|
|
|
|
51
|
- * 生命周期函数--监听页面加载
|
|
|
|
52
|
- */
|
|
|
|
53
|
- onLoad: function (options) {
|
|
|
|
54
|
- this.setDateStr();
|
|
|
|
55
|
- this.sellerid=util.cache('sellerid');
|
|
|
|
56
|
- this.getTables()
|
|
|
|
57
|
- },
|
52
|
+ /**
|
|
|
|
53
|
+ * 生命周期函数--监听页面加载
|
|
|
|
54
|
+ */
|
|
|
|
55
|
+ onLoad: function (options) {
|
|
|
|
56
|
+ this.setDateStr();
|
|
|
|
57
|
+ this.sellerid=util.cache('sellerid');
|
|
|
|
58
|
+ let timePickerArray= await comm.getDayTimeSpace();
|
|
|
|
59
|
+ this.setData({
|
|
|
|
60
|
+ timePickerArray: timePickerArray,
|
|
|
|
61
|
+ })
|
|
|
|
62
|
+ if(options.id>0){
|
|
|
|
63
|
+ this.initModify(options.id);
|
|
|
|
64
|
+ }
|
|
|
|
65
|
+ },
|
|
58
|
/**
|
66
|
/**
|
|
59
|
*
|
67
|
*
|
|
60
|
- * @param d
|
68
|
+ * @param d
|
|
61
|
*
|
69
|
*
|
|
62
|
*/
|
70
|
*/
|
|
63
|
- setDateStr(d=new Date()/1000){
|
|
|
|
64
|
- let dateStr=[
|
|
|
|
65
|
- util.unixtoTime(d,'MM-DD `DAY/周WW`'),
|
|
|
|
66
|
- util.unixtoTime(parseInt(d)+86400,'MM-DD `DAY/周WW`'),
|
|
|
|
67
|
- ];
|
|
|
|
68
|
- this.setData({
|
|
|
|
69
|
- dateStr:dateStr,
|
|
|
|
70
|
- })
|
|
|
|
71
|
- },
|
71
|
+ async setDateStr(d=new Date()/1000){
|
|
|
|
72
|
+ let dateStr=[
|
|
|
|
73
|
+ util.unixtoTime(d,'MM-DD `DAY/周WW`'),
|
|
|
|
74
|
+ util.unixtoTime(parseInt(d)+86400,'MM-DD `DAY/周WW`'),
|
|
|
|
75
|
+ ];
|
|
|
|
76
|
+ let form=this.data.form;
|
|
|
|
77
|
+ form.time=await comm.getTimeSpaceIndex(d);
|
|
|
|
78
|
+ let obj={
|
|
|
|
79
|
+ dateStr:dateStr,
|
|
|
|
80
|
+ form:form,
|
|
|
|
81
|
+ };
|
|
|
|
82
|
+ this.setData(obj)
|
|
|
|
83
|
+ return obj;
|
|
72
|
|
84
|
|
|
73
|
- /**
|
|
|
|
74
|
- * 生命周期函数--监听页面初次渲染完成
|
|
|
|
75
|
- */
|
|
|
|
76
|
- onReady: function () {
|
85
|
+ },
|
|
77
|
|
86
|
|
|
78
|
- },
|
87
|
+ /**
|
|
|
|
88
|
+ * 生命周期函数--监听页面初次渲染完成
|
|
|
|
89
|
+ */
|
|
|
|
90
|
+ onReady: function () {
|
|
79
|
|
91
|
|
|
80
|
- /**
|
|
|
|
81
|
- * 生命周期函数--监听页面显示
|
|
|
|
82
|
- */
|
|
|
|
83
|
- onShow: function () {
|
|
|
|
84
|
- setTimeout(()=>{
|
|
|
|
85
|
- this.setData({
|
|
|
|
86
|
- calendarMaskLoad:true,
|
|
|
|
87
|
- })
|
|
|
|
88
|
- },1000);
|
|
|
|
89
|
- this.conditionInfo()
|
92
|
+ },
|
|
90
|
|
93
|
|
|
91
|
- },
|
94
|
+ /**
|
|
|
|
95
|
+ * 生命周期函数--监听页面显示
|
|
|
|
96
|
+ */
|
|
|
|
97
|
+ onShow: function () {
|
|
|
|
98
|
+ this.getTables();
|
|
|
|
99
|
+ setTimeout(()=>{
|
|
|
|
100
|
+ this.setData({
|
|
|
|
101
|
+ calendarMaskLoad:true,
|
|
|
|
102
|
+ })
|
|
|
|
103
|
+ },1000);
|
|
|
|
104
|
+ this.conditionInfo()
|
|
|
|
105
|
+ },
|
|
92
|
|
106
|
|
|
93
|
- /**
|
|
|
|
94
|
- * 生命周期函数--监听页面隐藏
|
|
|
|
95
|
- */
|
|
|
|
96
|
- onHide: function () {
|
107
|
+ /**
|
|
|
|
108
|
+ * 生命周期函数--监听页面隐藏
|
|
|
|
109
|
+ */
|
|
|
|
110
|
+ onHide: function () {
|
|
97
|
|
111
|
|
|
98
|
- },
|
112
|
+ },
|
|
99
|
|
113
|
|
|
100
|
- /**
|
|
|
|
101
|
- * 生命周期函数--监听页面卸载
|
|
|
|
102
|
- */
|
|
|
|
103
|
- onUnload: function () {
|
114
|
+ /**
|
|
|
|
115
|
+ * 生命周期函数--监听页面卸载
|
|
|
|
116
|
+ */
|
|
|
|
117
|
+ onUnload: function () {
|
|
104
|
|
118
|
|
|
105
|
- },
|
119
|
+ },
|
|
106
|
|
120
|
|
|
107
|
- /**
|
|
|
|
108
|
- * 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
109
|
- */
|
|
|
|
110
|
- onPullDownRefresh: function () {
|
121
|
+ /**
|
|
|
|
122
|
+ * 页面相关事件处理函数--监听用户下拉动作
|
|
|
|
123
|
+ */
|
|
|
|
124
|
+ onPullDownRefresh: function () {
|
|
111
|
|
125
|
|
|
112
|
- },
|
126
|
+ },
|
|
113
|
|
127
|
|
|
114
|
- /**
|
|
|
|
115
|
- * 页面上拉触底事件的处理函数
|
|
|
|
116
|
- */
|
|
|
|
117
|
- onReachBottom: function () {
|
128
|
+ /**
|
|
|
|
129
|
+ * 页面上拉触底事件的处理函数
|
|
|
|
130
|
+ */
|
|
|
|
131
|
+ onReachBottom: function () {
|
|
118
|
|
132
|
|
|
119
|
- },
|
133
|
+ },
|
|
120
|
|
134
|
|
|
121
|
- /**
|
|
|
|
122
|
- * 用户点击右上角分享
|
|
|
|
123
|
- */
|
|
|
|
124
|
- onShareAppMessage: function () {
|
135
|
+ /**
|
|
|
|
136
|
+ * 用户点击右上角分享
|
|
|
|
137
|
+ */
|
|
|
|
138
|
+ onShareAppMessage: function () {
|
|
125
|
|
139
|
|
|
126
|
- },
|
140
|
+ },
|
|
127
|
selectedValue(e){
|
141
|
selectedValue(e){
|
|
128
|
- //console.log(e);
|
|
|
|
129
|
- let key=util.attr(e,'key');
|
142
|
+ //console.log(e);
|
|
|
|
143
|
+ let key=util.attr(e,'key');
|
|
130
|
let val;
|
144
|
let val;
|
|
131
|
- if(e.type=='input'){
|
|
|
|
132
|
- val=util.val(e);
|
|
|
|
133
|
- if(e.currentTarget.dataset.key=='phone'){
|
|
|
|
134
|
- var that=this;
|
|
|
|
135
|
- if(e.detail.value!='' && e.detail.value.length>=3) {
|
|
|
|
136
|
- App.Reserve.GetReserveUser({keywords:e.detail.value}).then(function(json){
|
|
|
|
137
|
- if(json.ret==200 && json.data.length>0){
|
|
|
|
138
|
- that.setData({
|
|
|
|
139
|
- searchlist:json.data
|
|
|
|
140
|
- })
|
|
|
|
141
|
- }else{
|
|
|
|
142
|
- that.setData({
|
|
|
|
143
|
- searchlist:null
|
|
|
|
144
|
- })
|
|
|
|
145
|
- }
|
|
|
|
146
|
- })
|
|
|
|
147
|
- }else{
|
|
|
|
148
|
- this.setData({
|
|
|
|
149
|
- searchlist:null
|
|
|
|
150
|
- })
|
|
|
|
151
|
- }
|
|
|
|
152
|
- }
|
|
|
|
153
|
- }else{
|
|
|
|
154
|
- val=util.attr(e,'value');
|
|
|
|
155
|
- }
|
145
|
+ if(e.type=='input'){
|
|
|
|
146
|
+ val=util.val(e);
|
|
|
|
147
|
+ if(e.currentTarget.dataset.key=='phone'){
|
|
|
|
148
|
+ var that=this;
|
|
|
|
149
|
+ if(e.detail.value!='' && e.detail.value.length>=3) {
|
|
|
|
150
|
+ App.Reserve.GetReserveUser({keywords:e.detail.value}).then(function(json){
|
|
|
|
151
|
+ if(json.ret==200 && json.data.length>0){
|
|
|
|
152
|
+ that.setData({
|
|
|
|
153
|
+ searchlist:json.data
|
|
|
|
154
|
+ })
|
|
|
|
155
|
+ }else{
|
|
|
|
156
|
+ that.setData({
|
|
|
|
157
|
+ searchlist:null
|
|
|
|
158
|
+ })
|
|
|
|
159
|
+ }
|
|
|
|
160
|
+ })
|
|
|
|
161
|
+ }else{
|
|
|
|
162
|
+ this.setData({
|
|
|
|
163
|
+ searchlist:null
|
|
|
|
164
|
+ })
|
|
|
|
165
|
+ }
|
|
|
|
166
|
+ }
|
|
|
|
167
|
+ }else{
|
|
|
|
168
|
+ val=util.attr(e,'value');
|
|
|
|
169
|
+ }
|
|
156
|
|
170
|
|
|
157
|
- let form=this.data.form;
|
|
|
|
158
|
- let sobj={};
|
|
|
|
159
|
- if(key=='tid'){
|
|
|
|
160
|
- let ts=this.data.tables;
|
|
|
|
161
|
- if(ts[val].isselect){
|
|
|
|
162
|
- ts[val].isselect=false;
|
|
|
|
163
|
- form.tid.remove(ts[val].id);
|
|
|
|
164
|
- }else{
|
|
|
|
165
|
- ts[val].isselect=true;
|
|
|
|
166
|
- form.tid.push(ts[val].id);
|
|
|
|
167
|
- }
|
|
|
|
168
|
- sobj.tables=ts;
|
|
|
|
169
|
- }else{
|
|
|
|
170
|
- form[key]=val;
|
|
|
|
171
|
- }
|
|
|
|
172
|
- //console.log(e.type,key,val,form);
|
171
|
+ let form=this.data.form;
|
|
|
|
172
|
+ let sobj={};
|
|
|
|
173
|
+ if(key=='tid'){
|
|
|
|
174
|
+ let ts=this.data.tables;
|
|
|
|
175
|
+ if(ts[val].isselect){
|
|
|
|
176
|
+ ts[val].isselect=false;
|
|
|
|
177
|
+ form.tid.remove(ts[val].id);
|
|
|
|
178
|
+ }else{
|
|
|
|
179
|
+ ts[val].isselect=true;
|
|
|
|
180
|
+ form.tid.push(ts[val].id);
|
|
|
|
181
|
+ }
|
|
|
|
182
|
+ sobj.tables=ts;
|
|
|
|
183
|
+ }else{
|
|
|
|
184
|
+ form[key]=val;
|
|
|
|
185
|
+ }
|
|
|
|
186
|
+ //console.log(e.type,key,val,form);
|
|
173
|
sobj.form=form;
|
187
|
sobj.form=form;
|
|
174
|
sobj.buttonhide=true;
|
188
|
sobj.buttonhide=true;
|
|
175
|
- if(form.tid.length>0 && form.rname.length>0){
|
|
|
|
176
|
- sobj.buttonhide=false;
|
|
|
|
177
|
- }
|
|
|
|
178
|
- this.setData(sobj)
|
189
|
+ if(form.tid.length>0 && form.rname.length>0){
|
|
|
|
190
|
+ sobj.buttonhide=false;
|
|
|
|
191
|
+ }
|
|
|
|
192
|
+ this.setData(sobj)
|
|
179
|
|
193
|
|
|
180
|
- if('date,time,pnum_str,tabid'.indexOf(key)>-1){
|
|
|
|
181
|
- this.getTables();
|
|
|
|
182
|
- }
|
194
|
+ if('date,time,pnum_str,tabid'.indexOf(key)>-1){
|
|
|
|
195
|
+ this.getTables();
|
|
|
|
196
|
+ }
|
|
183
|
},
|
197
|
},
|
|
184
|
async getTables(){
|
198
|
async getTables(){
|
|
185
|
- let form=this.data.form;
|
|
|
|
186
|
- try{
|
|
|
|
187
|
- let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time);
|
|
|
|
188
|
- console.log('rdate',this.data.dateStr[this.data.form.date],rdate);
|
|
|
|
189
|
- App.Reserve.GetTableList({
|
|
|
|
190
|
- sid:this.sellerid,
|
|
|
|
191
|
- pnum_str:form.pnum_str,
|
|
|
|
192
|
- rdate:rdate,
|
|
|
|
193
|
- tid:form.tabid,
|
|
|
|
194
|
- }).then(res=>{
|
|
|
|
195
|
- let tables=[];
|
|
|
|
196
|
- res.data.forEach(p=>{
|
|
|
|
197
|
- if(tables.length>=3) return true;
|
|
|
|
198
|
- p.list.forEach(t=>{
|
|
|
|
199
|
- if(tables.length>=3) return true;
|
|
|
|
200
|
- tables.push(t);
|
|
|
|
201
|
- })
|
|
|
|
202
|
- })
|
|
|
|
203
|
- this.tablesAll=res.data;
|
199
|
+ let form=this.data.form;
|
|
|
|
200
|
+ try{
|
|
|
|
201
|
+ let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time);
|
|
|
|
202
|
+ console.log('rdate',this.data.dateStr[this.data.form.date],rdate);
|
|
|
|
203
|
+ App.Reserve.GetTableList({
|
|
|
|
204
|
+ sid:this.sellerid,
|
|
|
|
205
|
+ pnum_str:form.pnum_str,
|
|
|
|
206
|
+ rdate:rdate,
|
|
|
|
207
|
+ tid:form.tabid,
|
|
|
|
208
|
+ }).then(res=>{
|
|
|
|
209
|
+ let tables=[];
|
|
|
|
210
|
+ res.data.forEach(p=>{
|
|
|
|
211
|
+ if(tables.length>=3) return true;
|
|
|
|
212
|
+ p.list.forEach(t=>{
|
|
|
|
213
|
+ if(tables.length>=3) return true;
|
|
|
|
214
|
+ tables.push(t);
|
|
|
|
215
|
+ })
|
|
|
|
216
|
+ })
|
|
|
|
217
|
+ this.tablesAll=res.data;
|
|
|
|
218
|
+ this.setData({
|
|
|
|
219
|
+ tables:tables
|
|
|
|
220
|
+ })
|
|
|
|
221
|
+ })
|
|
|
|
222
|
+ }catch (e){
|
|
|
|
223
|
+ this.setData({
|
|
|
|
224
|
+ tables:[]
|
|
|
|
225
|
+ })
|
|
|
|
226
|
+ }
|
|
|
|
227
|
+ },
|
|
|
|
228
|
+ async formsubmit(){
|
|
|
|
229
|
+ if(this.data.buttonhide) return;
|
|
|
|
230
|
+ try {
|
|
|
|
231
|
+ let stimestr=this.data.timePickerArray[this.data.form.time][this.data.timePickerIndex[this.data.form.time]];
|
|
|
|
232
|
+ console.log('stimestr', stimestr,this.data.form.time,this.data.timePickerIndex);
|
|
|
|
233
|
+ let rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date],
|
|
|
|
234
|
+ this.data.form.time,stimestr);
|
|
|
|
235
|
+ console.log('rdate', rdate);
|
|
|
|
236
|
+ this.setData({
|
|
|
|
237
|
+ buttonhide: true,
|
|
|
|
238
|
+ })
|
|
|
|
239
|
+ let form = this.data.form;
|
|
|
|
240
|
+ form.tid = form.tid.toString();
|
|
|
|
241
|
+ form.sid = this.sellerid;
|
|
|
|
242
|
+ form.rdate =rdate
|
|
|
|
243
|
+ App.Reserve.SetReserveInfo(form).then(res => {
|
|
|
|
244
|
+ if(res.ret==200){
|
|
|
|
245
|
+ let _id=(res.data.id || res.data)
|
|
|
|
246
|
+ this.setData({
|
|
|
|
247
|
+ form:JSON.parse(JSON.stringify(formTpl)),
|
|
|
|
248
|
+ tablesed:null,
|
|
|
|
249
|
+ })
|
|
|
|
250
|
+ App.Reserve.Detail({rid:_id,openid:''},true)
|
|
|
|
251
|
+ wx.navigateTo({
|
|
|
|
252
|
+ url:'b_detail?id='+res.data.id,
|
|
|
|
253
|
+ });
|
|
|
|
254
|
+ }else{
|
|
|
|
255
|
+ util.toast(res.msg,'none')
|
|
|
|
256
|
+ }
|
|
|
|
257
|
+ })
|
|
|
|
258
|
+ }catch (e){}
|
|
|
|
259
|
+ },
|
|
|
|
260
|
+ selectphone:function(e){
|
|
|
|
261
|
+ this.data.form.phone=e.detail.phone;
|
|
|
|
262
|
+ this.data.form.rname=e.detail.rname;
|
|
|
|
263
|
+ this.data.form.cusdem=e.detail.cusdem;
|
|
|
|
264
|
+ var form=this.data.form
|
|
|
|
265
|
+ this.data.form.sex=e.detail.sex;
|
|
|
|
266
|
+ this.setData({
|
|
|
|
267
|
+ form:this.data.form,
|
|
|
|
268
|
+ searchlist:null
|
|
|
|
269
|
+ })
|
|
|
|
270
|
+ this.conditionInfo();
|
|
|
|
271
|
+ },
|
|
|
|
272
|
+ calendarShow(){
|
|
204
|
this.setData({
|
273
|
this.setData({
|
|
205
|
- tables:tables
|
274
|
+ calendarMask:true
|
|
206
|
})
|
275
|
})
|
|
207
|
- })
|
|
|
|
208
|
- }catch (e){
|
276
|
+ },
|
|
|
|
277
|
+ dateChange(event){
|
|
|
|
278
|
+ console.log(event);
|
|
|
|
279
|
+ let clickDay = event.detail.day;
|
|
|
|
280
|
+ let changeDay = `dayStyle[1].day`;
|
|
|
|
281
|
+ let changeBg = `dayStyle[1].background`;
|
|
209
|
this.setData({
|
282
|
this.setData({
|
|
210
|
- tables:[]
|
283
|
+ [changeDay]: clickDay,
|
|
|
|
284
|
+ [changeBg]: "#84e7d0"
|
|
211
|
})
|
285
|
})
|
|
212
|
- }
|
|
|
|
213
|
-},
|
|
|
|
214
|
-async formsubmit(){
|
|
|
|
215
|
- if(this.data.buttonhide) return;
|
|
|
|
216
|
- try {
|
|
|
|
217
|
- let rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date], this.data.form.time);
|
|
|
|
218
|
- console.log('rdate', rdate);
|
286
|
+ this.setDateStr(util.timetouUnix(event.detail.year+'/'+event.detail.month+'/'+event.detail.day))
|
|
|
|
287
|
+ this.getTables()
|
|
|
|
288
|
+ },
|
|
|
|
289
|
+ calendarClose(){
|
|
219
|
this.setData({
|
290
|
this.setData({
|
|
220
|
- buttonhide: true,
|
291
|
+ calendarMask:false
|
|
221
|
})
|
292
|
})
|
|
222
|
- let form = this.data.form;
|
|
|
|
223
|
- form.tid = form.tid.toString();
|
|
|
|
224
|
- form.sid = this.sellerid;
|
|
|
|
225
|
- form.rdate =rdate
|
|
|
|
226
|
- App.Reserve.SetReserveInfo(form).then(res => {
|
|
|
|
227
|
- if(res.ret==200){
|
|
|
|
228
|
- wx.navigateTo({
|
|
|
|
229
|
- url:'b_detail?id='+res.data.id,
|
|
|
|
230
|
- });
|
|
|
|
231
|
- }else{
|
|
|
|
232
|
- util.toast(res.msg,'none')
|
293
|
+ },
|
|
|
|
294
|
+ async selectdesk(){
|
|
|
|
295
|
+ let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time);
|
|
|
|
296
|
+ console.log(this.data.form)
|
|
|
|
297
|
+ wx.navigateTo({
|
|
|
|
298
|
+ url:'b_desk?rdate='+rdate+'&tid='+this.data.form.tabid+'&pnum_str='+this.data.form.pnum_str
|
|
|
|
299
|
+ })
|
|
|
|
300
|
+ },
|
|
|
|
301
|
+ conditionInfo:function(){
|
|
|
|
302
|
+ var form=this.data.form
|
|
|
|
303
|
+ if(form.tid.length>0 && form.rname.length>0){
|
|
|
|
304
|
+ this.data.buttonhide=false;
|
|
233
|
}
|
305
|
}
|
|
234
|
- })
|
|
|
|
235
|
- }catch (e){}
|
|
|
|
236
|
-},
|
|
|
|
237
|
-selectphone:function(e){
|
|
|
|
238
|
- this.data.form.phone=e.detail.phone;
|
|
|
|
239
|
- this.data.form.rname=e.detail.rname;
|
|
|
|
240
|
- this.data.form.cusdem=e.detail.cusdem;
|
|
|
|
241
|
- var form=this.data.form
|
|
|
|
242
|
- this.data.form.sex=e.detail.sex;
|
|
|
|
243
|
- this.setData({
|
|
|
|
244
|
- form:this.data.form,
|
|
|
|
245
|
- searchlist:null,
|
306
|
+ this.setData({
|
|
|
|
307
|
+ buttonhide:this.data.buttonhide
|
|
|
|
308
|
+ })
|
|
|
|
309
|
+ },
|
|
|
|
310
|
+ /**
|
|
|
|
311
|
+ * 选中时间区域
|
|
|
|
312
|
+ */
|
|
|
|
313
|
+ bindTimePickerChange(e){
|
|
|
|
314
|
+ let timeIndex=util.attr(e,'timeIndex');
|
|
|
|
315
|
+ console.log(e,timeIndex);
|
|
|
|
316
|
+ let timePickerIndex=this.data.timePickerIndex;
|
|
|
|
317
|
+ timePickerIndex[timeIndex]=util.val(e);
|
|
|
|
318
|
+ this.setData({
|
|
|
|
319
|
+ timePickerIndex:timePickerIndex,
|
|
|
|
320
|
+ })
|
|
|
|
321
|
+ },
|
|
|
|
322
|
+ /**
|
|
|
|
323
|
+ * 修改初始化
|
|
|
|
324
|
+ */
|
|
|
|
325
|
+ async initModify(id){
|
|
|
|
326
|
+ try{
|
|
|
|
327
|
+ let res= await App.Reserve.Detail({rid:id,openid:''});
|
|
246
|
|
328
|
|
|
247
|
- })
|
|
|
|
248
|
- this.conditionInfo();
|
|
|
|
249
|
-},
|
|
|
|
250
|
-calendarShow(){
|
|
|
|
251
|
- this.setData({
|
|
|
|
252
|
- calendarMask:true
|
|
|
|
253
|
- })
|
|
|
|
254
|
-},
|
|
|
|
255
|
-dateChange(event){
|
|
|
|
256
|
- console.log(event);
|
|
|
|
257
|
- let clickDay = event.detail.day;
|
|
|
|
258
|
- let changeDay = `dayStyle[1].day`;
|
|
|
|
259
|
- let changeBg = `dayStyle[1].background`;
|
|
|
|
260
|
- this.setData({
|
|
|
|
261
|
- [changeDay]: clickDay,
|
|
|
|
262
|
- [changeBg]: "#84e7d0"
|
|
|
|
263
|
- })
|
|
|
|
264
|
- this.setDateStr(util.timetouUnix(event.detail.year+'/'+event.detail.month+'/'+event.detail.day))
|
|
|
|
265
|
- this.getTables()
|
|
|
|
266
|
-},
|
|
|
|
267
|
-calendarClose(){
|
|
|
|
268
|
- this.setData({
|
|
|
|
269
|
- calendarMask:false
|
|
|
|
270
|
- })
|
|
|
|
271
|
-},
|
|
|
|
272
|
-async selectdesk(){
|
|
|
|
273
|
- let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time);
|
|
|
|
274
|
- console.log(this.data.form)
|
|
|
|
275
|
- wx.navigateTo({
|
|
|
|
276
|
- url:'b_desk?rdate='+rdate+'&tid='+this.data.form.tabid+'&pnum_str='+this.data.form.pnum_str
|
|
|
|
277
|
- })
|
|
|
|
278
|
-},
|
|
|
|
279
|
-conditionInfo:function(){
|
|
|
|
280
|
- var form=this.data.form
|
|
|
|
281
|
- if(form.tid.length>0 && form.rname.length>0){
|
|
|
|
282
|
- this.data.buttonhide=false;
|
|
|
|
283
|
- }
|
|
|
|
284
|
- this.setData({
|
|
|
|
285
|
- buttonhide:this.data.buttonhide
|
|
|
|
286
|
- })
|
|
|
|
287
|
-}
|
|
|
|
288
|
-}) |
329
|
+ console.log('initModify',res);
|
|
|
|
330
|
+ //设置日期
|
|
|
|
331
|
+ let obj = await this.setDateStr(res.data.rdate);
|
|
|
|
332
|
+ //设置时间
|
|
|
|
333
|
+ let nd=util.unixtoTime(res.data.rdate,'HH:II');
|
|
|
|
334
|
+ let timePickerIndex=this.data.timePickerIndex
|
|
|
|
335
|
+ console.log('initModify-',this.data.timePickerArray,obj.form.time)
|
|
|
|
336
|
+ this.data.timePickerArray[obj.form.time].forEach((dd,ii)=>{
|
|
|
|
337
|
+ console.log('initModify-',nd,dd)
|
|
|
|
338
|
+ if(nd==dd){
|
|
|
|
339
|
+ timePickerIndex[obj.form.time]=ii;
|
|
|
|
340
|
+ return true;
|
|
|
|
341
|
+ }
|
|
|
|
342
|
+ })
|
|
|
|
343
|
+
|
|
|
|
344
|
+ console.log('initModify-timePickerIndex',timePickerIndex);
|
|
|
|
345
|
+ obj.form.pnum_str=res.data.pnum_str;
|
|
|
|
346
|
+ obj.form.rname=res.data.rname;
|
|
|
|
347
|
+ obj.form.phone=res.data.phone;
|
|
|
|
348
|
+ obj.form.sex=res.data.sex;
|
|
|
|
349
|
+ obj.form.cusdem=res.data.cusdem;
|
|
|
|
350
|
+ obj.form.rid=id;
|
|
|
|
351
|
+ obj.form.tid=[];
|
|
|
|
352
|
+ res.data.tables.forEach((t,ti)=>{
|
|
|
|
353
|
+ t.isselect=true
|
|
|
|
354
|
+ res.data.tables[ti]=t;
|
|
|
|
355
|
+ obj.form.tid.push(t.id)
|
|
|
|
356
|
+ })
|
|
|
|
357
|
+ this.setData({
|
|
|
|
358
|
+ timePickerIndex:timePickerIndex,
|
|
|
|
359
|
+ form:obj.form,
|
|
|
|
360
|
+ tablesed:res.data.tables,
|
|
|
|
361
|
+ })
|
|
|
|
362
|
+ }catch (e){
|
|
|
|
363
|
+ console.log('initModify',e)
|
|
|
|
364
|
+ }
|
|
|
|
365
|
+ },
|
|
|
|
366
|
+}) |