|
1
|
// pages/book/b_addnew.js
|
1
|
// pages/book/b_addnew.js
|
|
2
|
import util from '../../../utils/util';
|
2
|
import util from '../../../utils/util';
|
|
3
|
-import comm from '../../../utils/bookCommon';
|
|
|
|
4
|
import App from '../../../utils/api';
|
3
|
import App from '../../../utils/api';
|
|
5
|
-const {regeneratorRuntime} = global
|
|
|
|
6
|
-const formTpl = {
|
|
|
|
7
|
- rid: '',
|
|
|
|
8
|
- date: 0,
|
|
|
|
9
|
- time: 0,
|
|
|
|
10
|
- //pnum_str:'1-4',
|
|
|
|
11
|
- pnum: 6,
|
|
|
|
12
|
- tabid: 0,
|
|
|
|
13
|
-
|
|
|
|
14
|
- rname: '',
|
|
|
|
15
|
- phone: '',
|
|
|
|
16
|
- sex: 1,
|
|
|
|
17
|
- cusdem: '',
|
|
|
|
18
|
-
|
|
|
|
19
|
- tid: [],
|
|
|
|
20
|
-
|
|
|
|
21
|
-}
|
|
|
|
22
|
Page({
|
4
|
Page({
|
|
23
|
-
|
|
|
|
24
|
/**
|
5
|
/**
|
|
25
|
* 页面的初始数据
|
6
|
* 页面的初始数据
|
|
26
|
*/
|
7
|
*/
|
|
27
|
data: {
|
8
|
data: {
|
|
28
|
- dateStr: [],
|
|
|
|
29
|
- form: JSON.parse(JSON.stringify(formTpl)),
|
|
|
|
30
|
- tables: [],
|
|
|
|
31
|
- grand: [
|
|
|
|
32
|
- {
|
|
|
|
33
|
- sex: 1,
|
|
|
|
34
|
- grand_title: '先生',
|
|
|
|
35
|
- isselect: true
|
|
|
|
36
|
- },
|
|
|
|
37
|
- {
|
|
|
|
38
|
- sex: 2,
|
|
|
|
39
|
- grand_title: '女士',
|
|
|
|
40
|
- isselect: false
|
|
|
|
41
|
- },
|
|
|
|
42
|
- {
|
|
|
|
43
|
- sex: 3,
|
|
|
|
44
|
- grand_title: '公司',
|
|
|
|
45
|
- isselect: false
|
|
|
|
46
|
- }
|
|
|
|
47
|
- ],
|
|
|
|
48
|
- buttonhide: true,
|
|
|
|
49
|
-
|
|
|
|
50
|
- calendarMaskLoad: false,
|
|
|
|
51
|
- calendarMask: false,
|
|
|
|
52
|
- dayStyle: [
|
|
|
|
53
|
- {month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5'},
|
|
|
|
54
|
- {month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5'}
|
|
|
|
55
|
- ],
|
|
|
|
56
|
- timePickerArray: [
|
|
|
|
57
|
- [],
|
|
|
|
58
|
- [],
|
|
|
|
59
|
- [],
|
|
|
|
60
|
- ],
|
|
|
|
61
|
- timePickerIndex: [0, 0, 0],
|
|
|
|
62
|
- tablesLength: 0,
|
|
|
|
63
|
-
|
|
|
|
64
|
- timePickerMask: false,
|
|
|
|
65
|
- pnumInputFocus: false,
|
|
|
|
66
|
- pageMarginBottom: 0,
|
|
|
|
67
|
- speciallist: [],
|
|
|
|
68
|
- calendar: {
|
|
|
|
69
|
- nextNum: 0,
|
|
|
|
70
|
- },
|
|
|
|
71
|
- defDtime: ['', '12:00', '18:30'],
|
|
|
|
72
|
- hasUseDefDtime: true,
|
|
|
|
73
|
- CustomRemark:[],
|
|
|
|
74
|
- CustomRemarkMoreMask:false,
|
9
|
+ nowtime:0,//当前时间戳,或修改到店,或桌位预订时间
|
|
|
|
10
|
+ date:'',//当前选择的日期
|
|
75
|
},
|
11
|
},
|
|
76
|
/**
|
12
|
/**
|
|
77
|
* 生命周期函数--监听页面加载
|
13
|
* 生命周期函数--监听页面加载
|
|
78
|
*/
|
14
|
*/
|
|
79
|
- reserve_id: '',
|
|
|
|
80
|
- checkedTables:{},//已选中的桌子集合
|
|
|
|
81
|
- year:util.unixtoTime(new Date() / 1000,'YYYY'),
|
|
|
|
82
|
onLoad: async function (options) {
|
15
|
onLoad: async function (options) {
|
|
83
|
this.options=options
|
16
|
this.options=options
|
|
84
|
- this.initLoad(options)
|
|
|
|
85
|
- this.getCustomRemark();
|
|
|
|
86
|
- },
|
|
|
|
87
|
- async initLoad(options = {}){
|
|
|
|
88
|
- let nt = new Date() / 1000;
|
|
|
|
89
|
- let speciallist = [
|
|
|
|
90
|
- {date: util.unixtoTime(nt, 'YYYY-MM-DD'), background: '', text: '今 天'},
|
|
|
|
91
|
- {date: util.unixtoTime(nt + 86400, 'YYYY-MM-DD'), background: '', text: '明 天'},
|
|
|
|
92
|
- {date: util.unixtoTime(nt + 86400 * 2, 'YYYY-MM-DD'), background: '', text: '后 天'},
|
|
|
|
93
|
- ];
|
|
|
|
94
|
- this.reserve_id = options.id || '';
|
|
|
|
95
|
- let rev_time=parseInt(nt)
|
|
|
|
96
|
- this.sellerid = util.cache('enter_params')['seller_id'];
|
|
|
|
97
|
- let timePickerArray = await comm.getDayTimeSpace();
|
|
|
|
98
|
- this.setData({
|
|
|
|
99
|
- timePickerArray: timePickerArray,
|
|
|
|
100
|
- speciallist: speciallist,
|
|
|
|
101
|
- //hasUseDefDtime: hasUseDefDtime,
|
|
|
|
102
|
- })
|
|
|
|
103
|
- if(options.hasQuick==1){
|
|
|
|
104
|
- let rdate=options.ddate.split('-')
|
|
|
|
105
|
- if(!(rev_time>=rdate[0] && rev_time<=rdate[1])){
|
|
|
|
106
|
- rev_time=rdate[0]
|
|
|
|
107
|
- }
|
|
|
|
108
|
- }
|
|
|
|
109
|
- await this.setDateStr(rev_time);
|
|
|
|
110
|
- if (this.reserve_id > 0) {
|
|
|
|
111
|
- this.initModify(this.reserve_id);
|
|
|
|
112
|
- } else if(options.hasQuick==1){
|
|
|
|
113
|
- this.initQuick(options);
|
|
|
|
114
|
- } else {
|
|
|
|
115
|
- this.getTables();
|
|
|
|
116
|
- }
|
|
|
|
117
|
- },
|
|
|
|
118
|
-
|
|
|
|
119
|
- hasInTimeSpace(hhii,timeIndex){
|
|
|
|
120
|
- console.log('hasInTimeSpace',this.data.timePickerArray)
|
|
|
|
121
|
- if(this.data.timePickerArray.length<1)return false
|
|
|
|
122
|
- let timePickerArray=this.data.timePickerArray[timeIndex];
|
|
|
|
123
|
- let tl=timePickerArray.length
|
|
|
|
124
|
- if(tl<1) return false
|
|
|
|
125
|
- console.log('hasInTimeSpace',hhii,timePickerArray[0],timePickerArray[tl-1],hhii>=timePickerArray[0] && hhii<=timePickerArray[tl-1])
|
|
|
|
126
|
- if(hhii>=timePickerArray[0] && hhii<=timePickerArray[tl-1]) return true
|
|
|
|
127
|
- return false
|
|
|
|
128
|
- },
|
|
|
|
129
|
- async setDateStr(d = new Date() / 1000,hasUseDefDtime=false,fouceTime=-1){
|
|
|
|
130
|
- fouceTime=fouceTime>-1?fouceTime:this.data.form.time
|
|
|
|
131
|
- hasUseDefDtime=this.hasInTimeSpace(this.data.defDtime[fouceTime],fouceTime)
|
|
|
|
132
|
- if(hasUseDefDtime){//
|
|
|
|
133
|
- let timestr=util.unixtoTime(d,'YYYY-MM-DD '+this.data.defDtime[fouceTime])
|
|
|
|
134
|
- d=util.timetouUnix(timestr)
|
|
|
|
135
|
- }
|
|
|
|
136
|
- console.log('setDateStr',util.unixtoTime(d,'YYYY-MM-DD HH:II'),hasUseDefDtime,fouceTime)
|
|
|
|
137
|
- this.year=util.unixtoTime(d,'YYYY');
|
|
|
|
138
|
- let ns = new Date() / 1000;
|
|
|
|
139
|
- let dateStr = [
|
|
|
|
140
|
- util.unixtoTime(ns, 'MM-DD `DAY/周WW`'),
|
|
|
|
141
|
- util.unixtoTime(parseInt(ns) + 86400, 'MM-DD `DAY/周WW`'),
|
|
|
|
142
|
- ];
|
|
|
|
143
|
- //let dateStr=this.data.dateStr;
|
|
|
|
144
|
- let nowStr = util.unixtoTime(d, 'MM-DD `DAY/周WW`')
|
|
|
|
145
|
- let form = this.data.form;
|
|
|
|
146
|
-
|
|
|
|
147
|
- let timeObj = await comm.getTimeSpaceIndexData(d,null,fouceTime);
|
|
|
|
148
|
- if(fouceTime!=timeObj.timeIndex && fouceTime>0){
|
|
|
|
149
|
- timeObj.timeIndex=fouceTime
|
|
|
|
150
|
- }
|
|
|
|
151
|
- //form.time=await comm.getTimeSpaceIndex(d);
|
|
|
|
152
|
- //如果小于默认时间,使用默认时间
|
|
|
|
153
|
- let mmii = util.unixtoTime(d,'HH:II')
|
|
|
|
154
|
- console.log('setDateStr-timeObj',timeObj,mmii,this.data.defDtime[timeObj.timeIndex])
|
|
|
|
155
|
- if (mmii < this.data.defDtime[timeObj.timeIndex]) {
|
|
|
|
156
|
- hasUseDefDtime=this.hasInTimeSpace(this.data.defDtime[timeObj.timeIndex],timeObj.timeIndex)
|
|
|
|
157
|
- if(hasUseDefDtime){
|
|
|
|
158
|
- let str=util.unixtoTime(d, 'YYYY-MM-DD '+this.data.defDtime[timeObj.timeIndex]+':00')
|
|
|
|
159
|
- timeObj = await comm.getTimeSpaceIndexData(util.timetouUnix(str));
|
|
|
|
160
|
- }
|
17
|
+ if(options.id>0){
|
|
|
|
18
|
+ //修改
|
|
|
|
19
|
+ return;
|
|
161
|
}
|
20
|
}
|
|
162
|
-
|
|
|
|
163
|
- form.time = timeObj.timeIndex;
|
|
|
|
164
|
- let ind = dateStr._indexOf(nowStr);
|
|
|
|
165
|
- if (ind > -1) {
|
|
|
|
166
|
- form.date = ind
|
|
|
|
167
|
- } else {
|
|
|
|
168
|
- dateStr.push(nowStr.substr(0, 5));
|
|
|
|
169
|
- form.date = 2;
|
21
|
+ if(options.tid){
|
|
|
|
22
|
+ //桌位预订
|
|
|
|
23
|
+ return;
|
|
170
|
}
|
24
|
}
|
|
171
|
- let timePickerIndex = this.data.timePickerIndex;
|
|
|
|
172
|
- timePickerIndex[timeObj.timeIndex] = timeObj.timeMatchIndex;
|
|
|
|
173
|
- let obj = {
|
|
|
|
174
|
- dateStr: dateStr,
|
|
|
|
175
|
- form: form,
|
|
|
|
176
|
- timePickerIndex: timePickerIndex,
|
|
|
|
177
|
- timeOpt: timeObj.timeOpt,
|
|
|
|
178
|
- hasUseDefDtime:hasUseDefDtime
|
|
|
|
179
|
- };
|
|
|
|
180
|
-
|
|
|
|
181
|
- this.setData(obj)
|
|
|
|
182
|
- return obj;
|
|
|
|
183
|
-
|
25
|
+ this.setData({
|
|
|
|
26
|
+ nowtime:parseInt(new Date()/1000)
|
|
|
|
27
|
+ })
|
|
184
|
},
|
28
|
},
|
|
185
|
|
29
|
|
|
186
|
/**
|
30
|
/**
|
|
@@ -194,16 +38,7 @@ Page({ |
|
@@ -194,16 +38,7 @@ Page({ |
|
194
|
* 生命周期函数--监听页面显示
|
38
|
* 生命周期函数--监听页面显示
|
|
195
|
*/
|
39
|
*/
|
|
196
|
onShow: function () {
|
40
|
onShow: function () {
|
|
197
|
- //if(!this.reserve_id || util.cache('tableid').length>0){
|
|
|
|
198
|
- //if (util.cache('tableid').length > 0) {
|
|
|
|
199
|
- this.getTables();
|
|
|
|
200
|
- //}
|
|
|
|
201
|
- setTimeout(() => {
|
|
|
|
202
|
- this.setData({
|
|
|
|
203
|
- calendarMaskLoad: true,
|
|
|
|
204
|
- })
|
|
|
|
205
|
- }, 1000);
|
|
|
|
206
|
- this.conditionInfo()
|
41
|
+
|
|
207
|
},
|
42
|
},
|
|
208
|
|
43
|
|
|
209
|
/**
|
44
|
/**
|
|
@@ -240,680 +75,25 @@ Page({ |
|
@@ -240,680 +75,25 @@ Page({ |
|
240
|
onShareAppMessage: function () {
|
75
|
onShareAppMessage: function () {
|
|
241
|
|
76
|
|
|
242
|
},
|
77
|
},
|
|
243
|
- async selectedValueAsync(e){
|
|
|
|
244
|
- console.log(e);
|
|
|
|
245
|
- let key = util.attr(e, 'key');
|
|
|
|
246
|
- let val;
|
|
|
|
247
|
- let sobj = {};
|
|
|
|
248
|
- if (key == 'date') {
|
|
|
|
249
|
- this.year=util.unixtoTime(new Date() / 1000,'YYYY');
|
|
|
|
250
|
- }
|
|
|
|
251
|
- if (e.type == 'input' || e.type == 'confirm') {
|
|
|
|
252
|
- val = util.val(e);
|
|
|
|
253
|
- if (key == 'phone') {
|
|
|
|
254
|
- var that = this;
|
|
|
|
255
|
- if (e.detail.value != '' && e.detail.value.length >= 3) {
|
|
|
|
256
|
- App.Reserve.GetReserveUser(
|
|
|
|
257
|
- {
|
|
|
|
258
|
- keywords: e.detail.value,
|
|
|
|
259
|
- sid: this.sellerid
|
|
|
|
260
|
- }
|
|
|
|
261
|
- ).then(function (json) {
|
|
|
|
262
|
- if (json.ret == 200 && json.data.length > 0) {
|
|
|
|
263
|
- that.setData({
|
|
|
|
264
|
- searchlist: json.data
|
|
|
|
265
|
- })
|
|
|
|
266
|
- } else {
|
|
|
|
267
|
- that.setData({
|
|
|
|
268
|
- searchlist: null
|
|
|
|
269
|
- })
|
|
|
|
270
|
- }
|
|
|
|
271
|
- })
|
|
|
|
272
|
- } else {
|
|
|
|
273
|
- this.setData({
|
|
|
|
274
|
- searchlist: null
|
|
|
|
275
|
- })
|
|
|
|
276
|
- }
|
|
|
|
277
|
- }
|
|
|
|
278
|
- if (key == 'pnum') {
|
|
|
|
279
|
- sobj.pnumInputFocus = true;
|
|
|
|
280
|
- }
|
|
|
|
281
|
- } else {
|
|
|
|
282
|
- val = util.attr(e, 'value');
|
|
|
|
283
|
- }
|
|
|
|
284
|
- if (key == 'time') {
|
|
|
|
285
|
- if (this.data.timeOpt[val]) return;
|
|
|
|
286
|
- }
|
|
|
|
287
|
- if ((key == 'time' && this.data.form.time == val) || (key == 'date' && this.data.form.date == val)) {
|
|
|
|
288
|
- if (util.attr(e, 'display') != 'block') {
|
|
|
|
289
|
- return;
|
|
|
|
290
|
- }
|
|
|
|
291
|
- }
|
|
|
|
292
|
- let form = this.data.form;
|
|
|
|
293
|
-
|
|
|
|
294
|
- if (key == 'tid') {
|
|
|
|
295
|
- let ts = this.data.tables;
|
|
|
|
296
|
- if (ts[val].isselect) {
|
|
|
|
297
|
- ts[val].isselect = false;
|
|
|
|
298
|
- form.tid.remove(ts[val].id);
|
|
|
|
299
|
- delete this.checkedTables[ts[val].id]
|
|
|
|
300
|
- } else {
|
|
|
|
301
|
- ts[val].isselect = true;
|
|
|
|
302
|
- form.tid.push(ts[val].id);
|
|
|
|
303
|
- this.checkedTables[ts[val].id]=ts[val].name
|
|
|
|
304
|
- }
|
|
|
|
305
|
- sobj.tables = ts;
|
|
|
|
306
|
- } else {
|
|
|
|
307
|
- form[key] = val;
|
|
|
|
308
|
- }
|
|
|
|
309
|
- console.log('ts', sobj.tables,this.checkedTables);
|
|
|
|
310
|
- //console.log(e.type,key,val,form);
|
|
|
|
311
|
- sobj.form = form;
|
|
|
|
312
|
- sobj.buttonhide = this.data.buttonhide;
|
|
|
|
313
|
- if (form.tid.length > 0 && form.rname.length > 0) {
|
|
|
|
314
|
- sobj.buttonhide = false;
|
|
|
|
315
|
- }else{
|
|
|
|
316
|
- sobj.buttonhide = true;
|
|
|
|
317
|
- }
|
|
|
|
318
|
- let displayTimes = false;
|
|
|
|
319
|
- if (key == 'time') {
|
|
|
|
320
|
- if (util.attr(e, 'display') == 'block') {
|
|
|
|
321
|
- displayTimes = true;
|
|
|
|
322
|
- sobj.timePickerMask = true;
|
|
|
|
323
|
- }
|
|
|
|
324
|
- }
|
|
|
|
325
|
- //判断hasUseDefDtime
|
|
|
|
326
|
- if ((key == 'time' || key == 'date') && !sobj.timePickerMask) {
|
|
|
|
327
|
- sobj.hasUseDefDtime = true
|
|
|
|
328
|
- let ntime = parseInt(new Date() / 1000)
|
|
|
|
329
|
- let xtime =ntime
|
|
|
|
330
|
- if(key == 'time'){
|
|
|
|
331
|
- xtime=util.unixtoTime(new Date() / 1000, this.year+'-' + (this.data.dateStr[this.data.form.date].substr(0, 5)) + ' HH:II:SS');
|
|
|
|
332
|
- xtime=util.timetouUnix(xtime)
|
|
|
|
333
|
- //if 当前时间在区间内 hasUseDefDtime 为 false
|
|
|
|
334
|
- let d_rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date],
|
|
|
|
335
|
- this.data.form.time, null,null,this.year);
|
|
|
|
336
|
- d_rdate=d_rdate.split('-');
|
|
|
|
337
|
- if(d_rdate[0] <= ntime && ntime<=d_rdate[1]){
|
|
|
|
338
|
- sobj.hasUseDefDtime=false
|
|
|
|
339
|
- }
|
|
|
|
340
|
- }
|
|
|
|
341
|
- this.setDateStr(xtime,sobj.hasUseDefDtime,sobj.form.time);
|
|
|
|
342
|
- }
|
|
|
|
343
|
-
|
|
|
|
344
|
- if (this.data.form.date == 0) {//
|
|
|
|
345
|
- let mmii = util.unixtoTime(new Date() / 1000, 'HH:II');
|
|
|
|
346
|
- if (mmii > this.data.defDtime[key == 'time' ? val : this.data.form.time]) {
|
|
|
|
347
|
- sobj.hasUseDefDtime = false;
|
|
|
|
348
|
- }
|
|
|
|
349
|
- }
|
|
|
|
350
|
- if ('date,time,pnum,pnum_str,tabid'.indexOf(key) > -1) {
|
|
|
|
351
|
- if (!displayTimes) {
|
|
|
|
352
|
- //sobj.form.tid = []; //切换日期时间清空桌位
|
|
|
|
353
|
- //sobj.buttonhide = true;
|
|
|
|
354
|
- this.getTables();
|
|
|
|
355
|
- }
|
|
|
|
356
|
- if (key == 'date') {
|
|
|
|
357
|
- let xtime = util.unixtoTime(new Date() / 1000, this.year+'-' + (this.data.dateStr[val].substr(0, 5)) + ' HH:II:SS');
|
|
|
|
358
|
- this.setDateStr(util.timetouUnix(xtime),sobj.hasUseDefDtime);
|
|
|
|
359
|
- }
|
|
|
|
360
|
- }
|
|
|
|
361
|
- this.setData(sobj)
|
|
|
|
362
|
- },
|
|
|
|
363
|
- selectedValue(e){
|
|
|
|
364
|
- console.log(e);
|
|
|
|
365
|
- let key = util.attr(e, 'key');
|
|
|
|
366
|
- let val;
|
|
|
|
367
|
- let sobj = {};
|
|
|
|
368
|
- if (key == 'date') {
|
|
|
|
369
|
- this.year=util.unixtoTime(new Date() / 1000,'YYYY');
|
|
|
|
370
|
- }
|
|
|
|
371
|
- if (e.type == 'input' || e.type == 'confirm') {
|
|
|
|
372
|
- val = util.val(e);
|
|
|
|
373
|
- if (key == 'phone') {
|
|
|
|
374
|
- var that = this;
|
|
|
|
375
|
- if (e.detail.value != '' && e.detail.value.length >= 3) {
|
|
|
|
376
|
- App.Reserve.GetReserveUser(
|
|
|
|
377
|
- {
|
|
|
|
378
|
- keywords: e.detail.value,
|
|
|
|
379
|
- sid: this.sellerid
|
|
|
|
380
|
- }
|
|
|
|
381
|
- ).then(function (json) {
|
|
|
|
382
|
- if (json.ret == 200 && json.data.length > 0) {
|
|
|
|
383
|
- that.setData({
|
|
|
|
384
|
- searchlist: json.data
|
|
|
|
385
|
- })
|
|
|
|
386
|
- } else {
|
|
|
|
387
|
- that.setData({
|
|
|
|
388
|
- searchlist: null
|
|
|
|
389
|
- })
|
|
|
|
390
|
- }
|
|
|
|
391
|
- })
|
|
|
|
392
|
- } else {
|
|
|
|
393
|
- this.setData({
|
|
|
|
394
|
- searchlist: null
|
|
|
|
395
|
- })
|
|
|
|
396
|
- }
|
|
|
|
397
|
- }
|
|
|
|
398
|
- if (key == 'pnum') {
|
|
|
|
399
|
- sobj.pnumInputFocus = true;
|
|
|
|
400
|
- }
|
|
|
|
401
|
- } else {
|
|
|
|
402
|
- val = util.attr(e, 'value');
|
|
|
|
403
|
- }
|
|
|
|
404
|
- if (key == 'time') {
|
|
|
|
405
|
- if (this.data.timeOpt[val]) return;
|
|
|
|
406
|
- }
|
|
|
|
407
|
- if ((key == 'time' && this.data.form.time == val) || (key == 'date' && this.data.form.date == val)) {
|
|
|
|
408
|
- if (util.attr(e, 'display') != 'block') {
|
|
|
|
409
|
- return;
|
|
|
|
410
|
- }
|
|
|
|
411
|
- }
|
|
|
|
412
|
- let form = this.data.form;
|
|
|
|
413
|
-
|
|
|
|
414
|
- if (key == 'tid') {
|
|
|
|
415
|
- let ts = this.data.tables;
|
|
|
|
416
|
- if (ts[val].isselect) {
|
|
|
|
417
|
- ts[val].isselect = false;
|
|
|
|
418
|
- form.tid.remove(ts[val].id);
|
|
|
|
419
|
- delete this.checkedTables[ts[val].id]
|
|
|
|
420
|
- } else {
|
|
|
|
421
|
- ts[val].isselect = true;
|
|
|
|
422
|
- form.tid.push(ts[val].id);
|
|
|
|
423
|
- this.checkedTables[ts[val].id]=ts[val].name
|
|
|
|
424
|
- }
|
|
|
|
425
|
- sobj.tables = ts;
|
|
|
|
426
|
- } else {
|
|
|
|
427
|
- form[key] = val;
|
|
|
|
428
|
- }
|
|
|
|
429
|
- console.log('ts', sobj.tables,this.checkedTables);
|
|
|
|
430
|
- //console.log(e.type,key,val,form);
|
|
|
|
431
|
- sobj.form = form;
|
|
|
|
432
|
- sobj.buttonhide = this.data.buttonhide;
|
|
|
|
433
|
- if (form.tid.length > 0 && form.rname.length > 0 && this.data.timePickerArray[form.time].length>0){
|
|
|
|
434
|
- sobj.buttonhide = false;
|
|
|
|
435
|
- }else{
|
|
|
|
436
|
- sobj.buttonhide = true;
|
|
|
|
437
|
- }
|
|
|
|
438
|
- let displayTimes = false;
|
|
|
|
439
|
- if (key == 'time') {
|
|
|
|
440
|
- if (util.attr(e, 'display') == 'block') {
|
|
|
|
441
|
- displayTimes = true;
|
|
|
|
442
|
- sobj.timePickerMask = true;
|
|
|
|
443
|
- }
|
|
|
|
444
|
- }
|
|
|
|
445
|
- //判断hasUseDefDtime
|
|
|
|
446
|
- if ((key == 'time' || key == 'date') && !sobj.timePickerMask) {
|
|
|
|
447
|
- sobj.hasUseDefDtime = true
|
|
|
|
448
|
- let ntime = parseInt(new Date() / 1000)
|
|
|
|
449
|
- let xtime =ntime
|
|
|
|
450
|
- if(key == 'time'){
|
|
|
|
451
|
- xtime=util.unixtoTime(new Date() / 1000, this.year+'-' + (this.data.dateStr[this.data.form.date].substr(0, 5)) + ' HH:II:SS');
|
|
|
|
452
|
- xtime=util.timetouUnix(xtime)
|
|
|
|
453
|
- }
|
|
|
|
454
|
- this.setDateStr(xtime,sobj.hasUseDefDtime);
|
|
|
|
455
|
- }
|
|
|
|
456
|
- if (this.data.form.date == 0) {//
|
|
|
|
457
|
- let mmii = util.unixtoTime(new Date() / 1000, 'HH:II');
|
|
|
|
458
|
- if (mmii > this.data.defDtime[key == 'time' ? val : this.data.form.time]) {
|
|
|
|
459
|
- sobj.hasUseDefDtime = false;
|
|
|
|
460
|
- }
|
|
|
|
461
|
- }
|
|
|
|
462
|
- if ('date,time,pnum,pnum_str,tabid'.indexOf(key) > -1) {
|
|
|
|
463
|
- if (!displayTimes) {
|
|
|
|
464
|
- //sobj.form.tid = []; //切换日期时间清空桌位
|
|
|
|
465
|
- //sobj.buttonhide = true;
|
|
|
|
466
|
- this.getTables();
|
|
|
|
467
|
- }
|
|
|
|
468
|
- if (key == 'date') {
|
|
|
|
469
|
- let xtime = util.unixtoTime(new Date() / 1000, this.year+'-' + (this.data.dateStr[val].substr(0, 5)) + ' HH:II:SS');
|
|
|
|
470
|
- this.setDateStr(util.timetouUnix(xtime),sobj.hasUseDefDtime);
|
|
|
|
471
|
- }
|
|
|
|
472
|
- }
|
|
|
|
473
|
-
|
|
|
|
474
|
- this.setData(sobj)
|
|
|
|
475
|
- },
|
|
|
|
476
|
- async getTables(){
|
|
|
|
477
|
- let form = this.data.form;
|
|
|
|
478
|
- let tableid = util.cache('tableid');
|
|
|
|
479
|
- console.log('getTables-tableid', tableid.length, this.reserve_id);
|
|
|
|
480
|
- //if (tableid.length < 1 && this.reserve_id) {
|
|
|
|
481
|
- if (tableid.length < 1) {
|
|
|
|
482
|
- tableid = this.data.form.tid;
|
|
|
|
483
|
- }
|
|
|
|
484
|
- console.log('getTables-tableid', tableid, tableid.length);
|
|
|
|
485
|
- try {
|
|
|
|
486
|
- let rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date], this.data.form.time,null,null,this.year);
|
|
|
|
487
|
- console.log('rdate', this.data.dateStr[this.data.form.date], rdate);
|
|
|
|
488
|
- App.Reserve.GetTableList({
|
|
|
|
489
|
- sid: util.cache('enter_params')['seller_id'],
|
|
|
|
490
|
- //pnum_str:form.pnum_str,
|
|
|
|
491
|
- pnum: form.pnum,
|
|
|
|
492
|
- rdate: util.unixtoTime(rdate.substr(0,10),'YYYYMMDD'),
|
|
|
|
493
|
- tid: form.tabid,
|
|
|
|
494
|
- rid: this.reserve_id,
|
|
|
|
495
|
- ddate_solt:parseInt(form.time)+1
|
|
|
|
496
|
- }).then(res => {
|
|
|
|
497
|
- let tables = [];
|
|
|
|
498
|
- let tablesLength = 0;
|
|
|
|
499
|
- if (tableid.length > 0) {
|
|
|
|
500
|
- let toastTables={...this.checkedTables}
|
|
|
|
501
|
- let resData=res.data.slice(1,res.data.length);
|
|
|
|
502
|
- console.log('resData',resData)
|
|
|
|
503
|
- resData.forEach(p => {
|
|
|
|
504
|
- //if(tables.length>=3) return true;
|
|
|
|
505
|
- p.list.forEach(t => {
|
|
|
|
506
|
- delete toastTables[t.id]
|
|
|
|
507
|
- tablesLength++;
|
|
|
|
508
|
- if (tables.length >= 3) return true;
|
|
|
|
509
|
- if (tableid._indexOf(t.id) > -1) {
|
|
|
|
510
|
- t.isselect = true;
|
|
|
|
511
|
- tables.push(t);
|
|
|
|
512
|
- }
|
|
|
|
513
|
- })
|
|
|
|
514
|
- })
|
|
|
|
515
|
- console.log('toastTables',toastTables,this.data.form.tid,this.checkedTables);
|
|
|
|
516
|
- //清理已选中的桌位
|
|
|
|
517
|
- let toastTablesInfo=[];
|
|
|
|
518
|
- let tid=this.data.form.tid
|
|
|
|
519
|
- Object.keys(this.checkedTables).forEach(ckid=>{
|
|
|
|
520
|
- if(toastTables[ckid]){
|
|
|
|
521
|
- delete this.checkedTables[ckid]
|
|
|
|
522
|
- tid.remove(ckid);
|
|
|
|
523
|
- toastTablesInfo.push(toastTables[ckid]);
|
|
|
|
524
|
- }
|
|
|
|
525
|
- })
|
|
|
|
526
|
- if(toastTablesInfo.length>0){
|
|
|
|
527
|
- this.setData({
|
|
|
|
528
|
- [`form.tid`]:tid,
|
|
|
|
529
|
- })
|
|
|
|
530
|
- util.toast(toastTablesInfo.toString()+'已被占用啦','none');
|
|
|
|
531
|
- }
|
|
|
|
532
|
- wx.removeStorage({key: 'tableid'})
|
|
|
|
533
|
- }
|
|
|
|
534
|
- console.log('tables-first',tables);
|
|
|
|
535
|
- if(tables.length<1){
|
|
|
|
536
|
- tablesLength=0;
|
|
|
|
537
|
- let fortids=[];
|
|
|
|
538
|
- res.data.forEach((p,ri) => {
|
|
|
|
539
|
- p.list.forEach(t => {
|
|
|
|
540
|
- if(fortids._indexOf(t.id)<0) {
|
|
|
|
541
|
- tablesLength++;
|
|
|
|
542
|
- tables.push(t);
|
|
|
|
543
|
- fortids.push(t.id);
|
|
|
|
544
|
- }
|
|
|
|
545
|
- })
|
|
|
|
546
|
- })
|
|
|
|
547
|
- if (tables.length >= 3) {
|
|
|
|
548
|
- tables = tables.slice(0, 3);
|
|
|
|
549
|
- }
|
|
|
|
550
|
- }
|
|
|
|
551
|
- this.tablesLength = tablesLength;
|
|
|
|
552
|
- this.setData({
|
|
|
|
553
|
- tables: tables,
|
|
|
|
554
|
- tablesLength: tablesLength
|
|
|
|
555
|
- })
|
|
|
|
556
|
- this.conditionInfo();
|
|
|
|
557
|
- })
|
|
|
|
558
|
- } catch (e) {
|
|
|
|
559
|
- this.setData({
|
|
|
|
560
|
- tables: []
|
|
|
|
561
|
- })
|
|
|
|
562
|
- }
|
|
|
|
563
|
- },
|
|
|
|
564
|
- async formsubmit(){
|
|
|
|
565
|
- if (this.data.buttonhide) return;
|
|
|
|
566
|
- try {
|
|
|
|
567
|
- let d_stimestr = this.data.timePickerArray[this.data.form.time][this.data.timePickerIndex[this.data.form.time]];
|
|
|
|
568
|
- let d_rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date],
|
|
|
|
569
|
- this.data.form.time, d_stimestr,null,this.year);
|
|
|
|
570
|
- let stimestr = this.data.timePickerArray[this.data.form.time][this.data.timePickerIndex[0]];
|
|
|
|
571
|
- let rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date],
|
|
|
|
572
|
- this.data.form.time, stimestr,null,this.year);
|
|
|
|
573
|
- console.log('stimestr', stimestr, this.data.form.time, this.data.timePickerIndex);
|
|
|
|
574
|
- console.log('rdate', rdate);
|
|
|
|
575
|
- this.setData({
|
|
|
|
576
|
- buttonhide: true,
|
|
|
|
577
|
- })
|
|
|
|
578
|
- let form = JSON.parse(JSON.stringify(this.data.form));
|
|
|
|
579
|
- console.log('typeof form.tid', typeof form.tid);
|
|
|
|
580
|
- if (typeof form.tid == 'object') {
|
|
|
|
581
|
- let tid = new Set(form.tid);//tid 去重
|
|
|
|
582
|
- form.tid = [...tid].toString();
|
|
|
|
583
|
- }
|
|
|
|
584
|
- if(this.data.timePickerArray[form.time].length<1){
|
|
|
|
585
|
- return util.toast('请选择时段', 'none');
|
|
|
|
586
|
- }
|
|
|
|
587
|
- if (!form.tid) {
|
|
|
|
588
|
- return util.toast('请选择桌子', 'none');
|
|
|
|
589
|
- }
|
|
|
|
590
|
- if (!form.rname) {
|
|
|
|
591
|
- return util.toast('请填写预订人', 'none');
|
|
|
|
592
|
- }
|
|
|
|
593
|
- form.sid = this.sellerid;
|
|
|
|
594
|
- form.rdate = rdate
|
|
|
|
595
|
-
|
|
|
|
596
|
- try {
|
|
|
|
597
|
- let enter_params = util.cache('enter_params');
|
|
|
|
598
|
- let sc = (await App.Reserve.SellerInfo(enter_params)).data
|
|
|
|
599
|
- let note_openid = enter_params.seller_openid;
|
|
|
|
600
|
- let note_name = sc.seller_user.nick_name || sc.seller_user.nickname;
|
|
|
|
601
|
- form.note_openid = note_openid || '';
|
|
|
|
602
|
- if (form.rid) {//修改时传递uid
|
|
|
|
603
|
- form.note_openid = enter_params.manager_id || '';
|
|
|
|
604
|
- }
|
|
|
|
605
|
- form.note_name = note_name || '';
|
|
|
|
606
|
- } catch (e) {}
|
|
|
|
607
|
-
|
|
|
|
608
|
- form.ddate = d_rdate.substr(0, 10);
|
|
|
|
609
|
- if (this.data.hasUseDefDtime && this.data.form.time > 0) {//转为默认时间
|
|
|
|
610
|
- let ddateStr = util.unixtoTime(form.ddate, "YYYY-MM-DD " + this.data.defDtime[this.data.form.time] + ":00");
|
|
|
|
611
|
- form.ddate = util.timetouUnix(ddateStr);
|
|
|
|
612
|
- }
|
|
|
|
613
|
- form.ddate_solt=parseInt(form.time)+1
|
|
|
|
614
|
- form.is_set_ddate=1
|
|
|
|
615
|
- App.Reserve.SetReserveInfo(form).then(res => {
|
|
|
|
616
|
- if (res.ret == 200) {
|
|
|
|
617
|
- this.getCustomRemark()
|
|
|
|
618
|
- let _id = (res.data.id || res.data)
|
|
|
|
619
|
- this.setData({
|
|
|
|
620
|
- form: JSON.parse(JSON.stringify(formTpl)),
|
|
|
|
621
|
- tables: [],
|
|
|
|
622
|
- timePickerIndex: [0, 0, 0],
|
|
|
|
623
|
- })
|
|
|
|
624
|
- this.initLoad();
|
|
|
|
625
|
- this.checkedTables={};
|
|
|
|
626
|
- App.Reserve.Detail({rid: _id, openid: ''}, 'clear')
|
|
|
|
627
|
- wx.navigateTo({
|
|
|
|
628
|
- url: util.http_build_query({id:_id,tplid:1},'b_invitation'),
|
|
|
|
629
|
- });
|
|
|
|
630
|
- } else {
|
|
|
|
631
|
- util.toast(res.msg, 'none')
|
|
|
|
632
|
- }
|
|
|
|
633
|
- })
|
|
|
|
634
|
- } catch (e) {
|
|
|
|
635
|
- }
|
|
|
|
636
|
- },
|
|
|
|
637
|
- selectphone: function (e) {
|
|
|
|
638
|
- this.data.form.phone = e.detail.phone;
|
|
|
|
639
|
- this.data.form.rname = e.detail.rname;
|
|
|
|
640
|
- this.data.form.cusdem = e.detail.cusdem;
|
|
|
|
641
|
- var form = this.data.form
|
|
|
|
642
|
- this.data.form.sex = e.detail.sex;
|
78
|
+ //日期选择通知
|
|
|
|
79
|
+ addDateEvent(e){
|
|
|
|
80
|
+ //console.log('addDateEvent',e.detail)
|
|
|
|
81
|
+ //{checked: 1, checkedTime: 123456790}
|
|
643
|
this.setData({
|
82
|
this.setData({
|
|
644
|
- form: this.data.form,
|
|
|
|
645
|
- searchlist: null
|
|
|
|
646
|
- })
|
|
|
|
647
|
- this.conditionInfo();
|
|
|
|
648
|
- },
|
|
|
|
649
|
- calendarShow(){
|
|
|
|
650
|
- this.setData({
|
|
|
|
651
|
- calendarMask: true
|
|
|
|
652
|
- })
|
|
|
|
653
|
- },
|
|
|
|
654
|
- dateChange(event){
|
|
|
|
655
|
- console.log(event);
|
|
|
|
656
|
- //let cktime=util.timetouUnix(event.detail.year+'/'+event.detail.month+'/'+event.detail.day)
|
|
|
|
657
|
- let cktime = util.timetouUnix(event.detail.date)
|
|
|
|
658
|
- this.year=event.detail.date.substr(0, 4);
|
|
|
|
659
|
- console.log('this.year',this.year);
|
|
|
|
660
|
- let day0 = parseInt(new Date(new Date().setHours(0, 0, 0, 0)) / 1000);
|
|
|
|
661
|
- // if (cktime < day0) {
|
|
|
|
662
|
- // util.toast('请选择有效日期', 'none');
|
|
|
|
663
|
- // return;
|
|
|
|
664
|
- // }
|
|
|
|
665
|
- let clickDay = event.detail.date.substr(8, 2);
|
|
|
|
666
|
- let changeDay = `dayStyle[1].day`;
|
|
|
|
667
|
- let changeBg = `dayStyle[1].background`;
|
|
|
|
668
|
- this.setData({
|
|
|
|
669
|
- [changeDay]: clickDay,
|
|
|
|
670
|
- [changeBg]: "#84e7d0",
|
|
|
|
671
|
- //[`form.tid`]: [], //切换日期时间清空桌位
|
|
|
|
672
|
- //buttonhide: true,
|
|
|
|
673
|
- })
|
|
|
|
674
|
- console.log('cktime',cktime,util.unixtoTime(cktime,'YYYY-MM-DD'))
|
|
|
|
675
|
- if(cktime == day0){//今天
|
|
|
|
676
|
- this.setDateStr( new Date() / 1000 )
|
|
|
|
677
|
- }else{
|
|
|
|
678
|
- let xtime=util.unixtoTime(new Date() / 1000, event.detail.date + ' HH:II:SS');
|
|
|
|
679
|
- xtime=util.timetouUnix(xtime)
|
|
|
|
680
|
- this.setDateStr(xtime,true)
|
|
|
|
681
|
- }
|
|
|
|
682
|
-
|
|
|
|
683
|
- this.calendarClose();
|
|
|
|
684
|
- setTimeout(res=>{
|
|
|
|
685
|
- this.getTables();
|
|
|
|
686
|
- },10)
|
|
|
|
687
|
-
|
|
|
|
688
|
- },
|
|
|
|
689
|
- calendarClose(){
|
|
|
|
690
|
- this.setData({
|
|
|
|
691
|
- calendarMask: false,
|
|
|
|
692
|
- timePickerMask: false,
|
|
|
|
693
|
- })
|
|
|
|
694
|
- },
|
|
|
|
695
|
- async selectdesk(){
|
|
|
|
696
|
- let rdate = await comm.getTimeSpace(this.data.dateStr[this.data.form.date], this.data.form.time,null,null,this.year);
|
|
|
|
697
|
- console.log(this.data.form)
|
|
|
|
698
|
- wx.navigateTo({
|
|
|
|
699
|
- url: 'b_desk?rdate=' + rdate + '&tid=' + this.data.form.tabid
|
|
|
|
700
|
- //+'&pnum_str='+this.data.form.pnum_str
|
|
|
|
701
|
- + '&pnum=' + this.data.form.pnum
|
|
|
|
702
|
- + '&checked_tids=' + this.data.form.tid
|
|
|
|
703
|
- + '&rid=' + this.reserve_id
|
|
|
|
704
|
- + '&ddate_solt='+(parseInt(this.data.form.time)+1)
|
|
|
|
705
|
- })
|
|
|
|
706
|
- },
|
|
|
|
707
|
- conditionInfo: function () {
|
|
|
|
708
|
- var form = this.data.form
|
|
|
|
709
|
- if (form.tid.length > 0 && form.rname.length > 0) {
|
|
|
|
710
|
- this.data.buttonhide = false;
|
|
|
|
711
|
- }
|
|
|
|
712
|
- this.setData({
|
|
|
|
713
|
- buttonhide: this.data.buttonhide
|
|
|
|
714
|
- })
|
|
|
|
715
|
- },
|
|
|
|
716
|
- /**
|
|
|
|
717
|
- * 选中时间区域
|
|
|
|
718
|
- */
|
|
|
|
719
|
- bindTimePickerChange(e){
|
|
|
|
720
|
- let timeIndex = util.attr(e, 'timeIndex');
|
|
|
|
721
|
- if (timeIndex < 0) return;
|
|
|
|
722
|
- let timePickerIndex = this.data.timePickerIndex;
|
|
|
|
723
|
- //timePickerIndex[timeIndex]=util.val(e);
|
|
|
|
724
|
- timePickerIndex[timeIndex] = util.attr(e, 'val');
|
|
|
|
725
|
-
|
|
|
|
726
|
- console.log(e, timeIndex, util.attr(e, 'val'));
|
|
|
|
727
|
- this.setData({
|
|
|
|
728
|
- timePickerIndex: timePickerIndex,
|
|
|
|
729
|
- hasUseDefDtime: false,
|
|
|
|
730
|
- })
|
|
|
|
731
|
- },
|
|
|
|
732
|
- /**
|
|
|
|
733
|
- * 修改初始化
|
|
|
|
734
|
- */
|
|
|
|
735
|
- async initModify(id){
|
|
|
|
736
|
- try {
|
|
|
|
737
|
- let res = await App.Reserve.Detail({rid: id, openid: ''});
|
|
|
|
738
|
-
|
|
|
|
739
|
- console.log('initModify', res);
|
|
|
|
740
|
- //设置日期
|
|
|
|
741
|
- let obj = await this.setDateStr(res.data.ddate,null,res.data.ddate_solt-1);
|
|
|
|
742
|
- //设置时间
|
|
|
|
743
|
- let nd = util.unixtoTime(res.data.ddate, 'HH:II');
|
|
|
|
744
|
- let timePickerIndex = this.data.timePickerIndex
|
|
|
|
745
|
- console.log('initModify-', this.data.timePickerArray, obj.form.time, nd)
|
|
|
|
746
|
- this.data.timePickerArray[obj.form.time].forEach((dd, ii) => {
|
|
|
|
747
|
- console.log('initModify-', nd, dd)
|
|
|
|
748
|
- if (nd == dd) {
|
|
|
|
749
|
- timePickerIndex[obj.form.time] = ii;
|
|
|
|
750
|
- return true;
|
|
|
|
751
|
- }
|
|
|
|
752
|
- })
|
|
|
|
753
|
-
|
|
|
|
754
|
- console.log('initModify-timePickerIndex', timePickerIndex);
|
|
|
|
755
|
- //obj.form.pnum_str=res.data.pnum_str;
|
|
|
|
756
|
- obj.form.pnum = res.data.pnum || 6;
|
|
|
|
757
|
- obj.form.rname = res.data.rname;
|
|
|
|
758
|
- obj.form.phone = res.data.phone || "";
|
|
|
|
759
|
- obj.form.sex = res.data.sex;
|
|
|
|
760
|
- obj.form.cusdem = res.data.cusdem;
|
|
|
|
761
|
- obj.form.rid = id;
|
|
|
|
762
|
- obj.form.tid = [];
|
|
|
|
763
|
- let tablesed = [];
|
|
|
|
764
|
- res.data.tables.forEach((t, ti) => {
|
|
|
|
765
|
- obj.form.tid.push(t.id)
|
|
|
|
766
|
- if (ti >= 3) return;
|
|
|
|
767
|
- t.isselect = true
|
|
|
|
768
|
- t["isselected"] = 1
|
|
|
|
769
|
- tablesed.push(t);
|
|
|
|
770
|
- this.checkedTables[t.id]=t.name;
|
|
|
|
771
|
- })
|
|
|
|
772
|
- this.setData({
|
|
|
|
773
|
- timePickerIndex: timePickerIndex,
|
|
|
|
774
|
- form: obj.form,
|
|
|
|
775
|
- //tablesed:tablesed,
|
|
|
|
776
|
- hasUseDefDtime: false,
|
|
|
|
777
|
- })
|
|
|
|
778
|
- setTimeout(() => {
|
|
|
|
779
|
- this.getTables();
|
|
|
|
780
|
- }, 300)
|
|
|
|
781
|
-
|
|
|
|
782
|
- } catch (e) {
|
|
|
|
783
|
- console.log('initModify', e)
|
|
|
|
784
|
- }
|
|
|
|
785
|
- },
|
|
|
|
786
|
- pnumInputFocusEvent(e){
|
|
|
|
787
|
- console.log(e);
|
|
|
|
788
|
- this.setData({
|
|
|
|
789
|
- pnumInputFocus: 'focus' == e.type
|
|
|
|
790
|
- })
|
|
|
|
791
|
- },
|
|
|
|
792
|
- inputFocusTime: 0,
|
|
|
|
793
|
- blurTime: 0,
|
|
|
|
794
|
- inputFocus(e){
|
|
|
|
795
|
- console.log(e, this.inputFocusTime);
|
|
|
|
796
|
- return;
|
|
|
|
797
|
- if (e.timeStamp > this.inputFocusTime) {
|
|
|
|
798
|
- this.inputFocusTime = e.timeStamp;
|
|
|
|
799
|
- if (e.type == 'focus' && this.data.pageMarginBottom == 0) {
|
|
|
|
800
|
- this.setData({
|
|
|
|
801
|
- pageMarginBottom: 300
|
|
|
|
802
|
- })
|
|
|
|
803
|
- setTimeout(res => {
|
|
|
|
804
|
- this.pageScrollToBottom();
|
|
|
|
805
|
- }, 100)
|
|
|
|
806
|
- } else {
|
|
|
|
807
|
- if (this.blurTime > 5) {
|
|
|
|
808
|
- this.blurTime = 0;
|
|
|
|
809
|
- this.setData({
|
|
|
|
810
|
- pageMarginBottom: 0
|
|
|
|
811
|
- })
|
|
|
|
812
|
- } else {
|
|
|
|
813
|
- setTimeout(res => {
|
|
|
|
814
|
- this.blurTime += 1;
|
|
|
|
815
|
- this.inputFocus(e);
|
|
|
|
816
|
- }, 300)
|
|
|
|
817
|
- }
|
|
|
|
818
|
-
|
|
|
|
819
|
- }
|
|
|
|
820
|
-
|
|
|
|
821
|
- }
|
|
|
|
822
|
- },
|
|
|
|
823
|
- pageScrollToBottom: function () {
|
|
|
|
824
|
- wx.createSelectorQuery().select('#j_page').boundingClientRect(function (rect) {
|
|
|
|
825
|
- // 使页面滚动到底部
|
|
|
|
826
|
- wx.pageScrollTo({
|
|
|
|
827
|
- scrollTop: rect.bottom
|
|
|
|
828
|
- })
|
|
|
|
829
|
- }).exec()
|
|
|
|
830
|
- },
|
|
|
|
831
|
- gotoday(e){
|
|
|
|
832
|
- this.setData({
|
|
|
|
833
|
- [`calendar.nextNum`]: 0
|
|
|
|
834
|
- })
|
|
|
|
835
|
- },
|
|
|
|
836
|
- nextMonth(e){
|
|
|
|
837
|
- this.setData({
|
|
|
|
838
|
- [`calendar.nextNum`]: this.data.calendar.nextNum + 1
|
|
|
|
839
|
- })
|
|
|
|
840
|
- },
|
|
|
|
841
|
- prevMonth(e){
|
|
|
|
842
|
- this.setData({
|
|
|
|
843
|
- [`calendar.nextNum`]: this.data.calendar.nextNum - 1
|
|
|
|
844
|
- })
|
|
|
|
845
|
- },
|
|
|
|
846
|
- /**
|
|
|
|
847
|
- * 快速预订初始化
|
|
|
|
848
|
- * tid
|
|
|
|
849
|
- * tname
|
|
|
|
850
|
- * ddate
|
|
|
|
851
|
- * pnum
|
|
|
|
852
|
- */
|
|
|
|
853
|
- async initQuick(options){
|
|
|
|
854
|
- try {
|
|
|
|
855
|
- console.log('initQuick', options);
|
|
|
|
856
|
- this.checkedTables[options.tid]=options.tname
|
|
|
|
857
|
- this.year=util.unixtoTime(options.ddate.substr(0,10),'YYYY');
|
|
|
|
858
|
- let form=this.data.form
|
|
|
|
859
|
- form.tid=[options.tid]
|
|
|
|
860
|
-
|
|
|
|
861
|
- this.setData({
|
|
|
|
862
|
- form: form,
|
|
|
|
863
|
- })
|
|
|
|
864
|
- setTimeout(() => {
|
|
|
|
865
|
- this.getTables();
|
|
|
|
866
|
- }, 300)
|
|
|
|
867
|
- } catch (e) {
|
|
|
|
868
|
- console.log('initQuick', e)
|
|
|
|
869
|
- }
|
|
|
|
870
|
- },
|
|
|
|
871
|
- getCustomRemark(){
|
|
|
|
872
|
- App.User.GetCustomRemark({
|
|
|
|
873
|
- uid:util.cache('enter_params')['manager_id'],
|
|
|
|
874
|
- }).then(res=>{
|
|
|
|
875
|
- let CustomRemark=[];
|
|
|
|
876
|
- res.data.forEach(r=>{
|
|
|
|
877
|
- if(r.often_use){
|
|
|
|
878
|
- CustomRemark.push(r);
|
|
|
|
879
|
- }
|
|
|
|
880
|
- })
|
|
|
|
881
|
- this.setData({
|
|
|
|
882
|
- CustomRemark:CustomRemark,
|
|
|
|
883
|
- })
|
|
|
|
884
|
- })
|
|
|
|
885
|
- },
|
|
|
|
886
|
- oftenUse(e){
|
|
|
|
887
|
- let id=util.attr(e,'id');
|
|
|
|
888
|
- let val=util.attr(e,'value');
|
|
|
|
889
|
- let CustomRemark=this.data.CustomRemark;
|
|
|
|
890
|
- let form=this.data.form;
|
|
|
|
891
|
- CustomRemark.forEach(r=>{
|
|
|
|
892
|
- if(id==r.id){
|
|
|
|
893
|
- if(r.active){
|
|
|
|
894
|
- form.cusdem=form.cusdem.replace(val+'、','')
|
|
|
|
895
|
- }
|
|
|
|
896
|
- r.active=!r.active
|
|
|
|
897
|
- if(r.active){
|
|
|
|
898
|
- form.cusdem+=val+'、'
|
|
|
|
899
|
- }
|
|
|
|
900
|
- }
|
|
|
|
901
|
- })
|
|
|
|
902
|
- this.setData({
|
|
|
|
903
|
- CustomRemark:CustomRemark,
|
|
|
|
904
|
- form:form,
|
|
|
|
905
|
- })
|
|
|
|
906
|
- this.conditionInfo()
|
|
|
|
907
|
- },
|
|
|
|
908
|
- CustomRemarkMore(){
|
|
|
|
909
|
- this.setData({
|
|
|
|
910
|
- CustomRemarkMoreMask:!this.data.CustomRemarkMoreMask
|
83
|
+ date:util.unixtoTime(e.detail.checkedTime,'YYYY-MM-DD')
|
|
911
|
})
|
84
|
})
|
|
912
|
},
|
85
|
},
|
|
|
|
86
|
+ //时段选择通知
|
|
913
|
addTimeDurEvent(e){
|
87
|
addTimeDurEvent(e){
|
|
914
|
- console.log('add-time-dur.event',e);
|
88
|
+ //console.log('addTimeDurEvent',e.detail)
|
|
|
|
89
|
+ //{ddate_solt: 1, list: Array(9), listIndex: 4}
|
|
|
|
90
|
+ },
|
|
|
|
91
|
+ //到店时间选择通知
|
|
|
|
92
|
+ addTimeDurItemsEvent(e){
|
|
|
|
93
|
+ //{time: 1577689200, ddate_solt: 1}
|
|
|
|
94
|
+ //console.log('addTimeDurItemsEvent',e.detail)
|
|
915
|
this.setData({
|
95
|
this.setData({
|
|
916
|
- [`form.time`]:e.detail.ddate_solt,
|
96
|
+ ...e.detail,
|
|
917
|
})
|
97
|
})
|
|
918
|
},
|
98
|
},
|
|
919
|
}) |
99
|
}) |