|
@@ -24,9 +24,9 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
@@ -24,9 +24,9 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
24
|
TextEditingController customController = TextEditingController(); //客户要求
|
24
|
TextEditingController customController = TextEditingController(); //客户要求
|
|
25
|
List sexList = []; // 先生、女士、公司
|
25
|
List sexList = []; // 先生、女士、公司
|
|
26
|
Map dailyMap = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟
|
26
|
Map dailyMap = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟
|
|
27
|
- List<String> mornings=[];//早市时间段
|
|
|
|
28
|
- List<String> noons=[];//午市时间段
|
|
|
|
29
|
- List<String> nights=[];//晚市时间段
|
27
|
+ List<String> mornings = []; //早市时间段
|
|
|
|
28
|
+ List<String> noons = []; //午市时间段
|
|
|
|
29
|
+ List<String> nights = []; //晚市时间段
|
|
30
|
String ddateStr = ''; //16:30
|
30
|
String ddateStr = ''; //16:30
|
|
31
|
NotebookDetail detailEntity;
|
31
|
NotebookDetail detailEntity;
|
|
32
|
List<TableList> tableList = [];
|
32
|
List<TableList> tableList = [];
|
|
@@ -233,7 +233,7 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
@@ -233,7 +233,7 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
233
|
|
233
|
|
|
234
|
/// 早市、午市、晚市对应的半个小时间隔时间段
|
234
|
/// 早市、午市、晚市对应的半个小时间隔时间段
|
|
235
|
initDateHourMinuteList(BuildContext context) async {
|
235
|
initDateHourMinuteList(BuildContext context) async {
|
|
236
|
- UserModel userModel=Provider.of<UserModel>(context);
|
236
|
+ UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
237
|
userModel.user.morning == ''
|
237
|
userModel.user.morning == ''
|
|
238
|
? dailyMap.putIfAbsent('morning', () => '')
|
238
|
? dailyMap.putIfAbsent('morning', () => '')
|
|
239
|
: dailyMap.putIfAbsent(
|
239
|
: dailyMap.putIfAbsent(
|
|
@@ -247,12 +247,12 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
@@ -247,12 +247,12 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
247
|
: dailyMap.putIfAbsent(
|
247
|
: dailyMap.putIfAbsent(
|
|
248
|
'night', () => _getHourAndMinute(userModel.user.night, 3));
|
248
|
'night', () => _getHourAndMinute(userModel.user.night, 3));
|
|
249
|
|
249
|
|
|
250
|
- _initSunDateList(userModel.user.morning, userModel.user.noon, userModel.user.night);
|
250
|
+ _initSunDateList(
|
|
|
|
251
|
+ userModel.user.morning, userModel.user.noon, userModel.user.night);
|
|
251
|
}
|
252
|
}
|
|
252
|
|
253
|
|
|
253
|
//根据获取时间 11:00-12:30 获取30分钟间隔组装的数组
|
254
|
//根据获取时间 11:00-12:30 获取30分钟间隔组装的数组
|
|
254
|
- _getHourAndMinute(
|
|
|
|
255
|
- String hourAndMinuteStr, int mnd) {
|
255
|
+ _getHourAndMinute(String hourAndMinuteStr, int mnd) {
|
|
256
|
List tempDate = hourAndMinuteStr.split("-");
|
256
|
List tempDate = hourAndMinuteStr.split("-");
|
|
257
|
String beginDate = tempDate[0];
|
257
|
String beginDate = tempDate[0];
|
|
258
|
String endDate = tempDate[1];
|
258
|
String endDate = tempDate[1];
|
|
@@ -267,11 +267,14 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
@@ -267,11 +267,14 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
267
|
bool tempLimit = true;
|
267
|
bool tempLimit = true;
|
|
268
|
while (tempLimit) {
|
268
|
while (tempLimit) {
|
|
269
|
String temp = _dealTime(beginHour, beginMinute);
|
269
|
String temp = _dealTime(beginHour, beginMinute);
|
|
270
|
- if(mnd==1){//早市
|
270
|
+ if (mnd == 1) {
|
|
|
|
271
|
+ //早市
|
|
271
|
mornings.add(temp);
|
272
|
mornings.add(temp);
|
|
272
|
- }else if(mnd==2){//午市
|
273
|
+ } else if (mnd == 2) {
|
|
|
|
274
|
+ //午市
|
|
273
|
noons.add(temp);
|
275
|
noons.add(temp);
|
|
274
|
- }else if(mnd==3){//晚市
|
276
|
+ } else if (mnd == 3) {
|
|
|
|
277
|
+ //晚市
|
|
275
|
nights.add(temp);
|
278
|
nights.add(temp);
|
|
276
|
}
|
279
|
}
|
|
277
|
bool tempSelect = false;
|
280
|
bool tempSelect = false;
|
|
@@ -313,8 +316,8 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
@@ -313,8 +316,8 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
313
|
}
|
316
|
}
|
|
314
|
|
317
|
|
|
315
|
//初始化早市午市晚市选中时间
|
318
|
//初始化早市午市晚市选中时间
|
|
316
|
- initHourAndMinuteSelect(){
|
|
|
|
317
|
- int timeMillsNow=DateTime.now().millisecondsSinceEpoch;
|
319
|
+ initHourAndMinuteSelect() {
|
|
|
|
320
|
+ int timeMillsNow = DateTime.now().millisecondsSinceEpoch;
|
|
318
|
//当前选中 月 日string
|
321
|
//当前选中 月 日string
|
|
319
|
String mdStr = '';
|
322
|
String mdStr = '';
|
|
320
|
//今天 明天 其他天
|
323
|
//今天 明天 其他天
|
|
@@ -325,55 +328,70 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
@@ -325,55 +328,70 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
325
|
}
|
328
|
}
|
|
326
|
String timeNowYear = DateUtil.formatDate(DateTime.now(), format: 'yyyy');
|
329
|
String timeNowYear = DateUtil.formatDate(DateTime.now(), format: 'yyyy');
|
|
327
|
String ymyStr = timeNowYear + '-' + mdStr; //年月日
|
330
|
String ymyStr = timeNowYear + '-' + mdStr; //年月日
|
|
328
|
- String timeStr = ymyStr+' 00:00:00';
|
331
|
+ String timeStr = ymyStr + ' 00:00:00';
|
|
329
|
LogUtil.v(timeStr);
|
332
|
LogUtil.v(timeStr);
|
|
330
|
- DateTime dateTime=DateUtil.getDateTime(timeStr);//当前年月日
|
|
|
|
331
|
- for(var sunDate in sunDateList){
|
|
|
|
332
|
- if(sunDate['isSelect']==false)continue;
|
|
|
|
333
|
- switch(sunDate['key']){
|
|
|
|
334
|
- case "morning"://选中早市
|
|
|
|
335
|
- bool select=false;
|
|
|
|
336
|
- for(var temp in dailyMap['morning']){//早市选中距离当前时间最近
|
|
|
|
337
|
- temp['select']=false;
|
|
|
|
338
|
- if(select)continue;//只选中第一个
|
|
|
|
339
|
- if(timeMillsNow<=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "${temp['title']}:00"))){
|
|
|
|
340
|
- temp['select']=true;
|
|
|
|
341
|
- select=true;
|
333
|
+ DateTime dateTime = DateUtil.getDateTime(timeStr); //当前年月日
|
|
|
|
334
|
+ for (var sunDate in sunDateList) {
|
|
|
|
335
|
+ if (sunDate['isSelect'] == false) continue;
|
|
|
|
336
|
+ switch (sunDate['key']) {
|
|
|
|
337
|
+ case "morning": //选中早市
|
|
|
|
338
|
+ bool select = false;
|
|
|
|
339
|
+ for (var temp in dailyMap['morning']) {
|
|
|
|
340
|
+ //早市选中距离当前时间最近
|
|
|
|
341
|
+ temp['select'] = false;
|
|
|
|
342
|
+ if (select) continue; //只选中第一个
|
|
|
|
343
|
+ if (timeMillsNow <=
|
|
|
|
344
|
+ DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime)
|
|
|
|
345
|
+ .replaceRange(11, 19, "${temp['title']}:00"))) {
|
|
|
|
346
|
+ temp['select'] = true;
|
|
|
|
347
|
+ select = true;
|
|
342
|
}
|
348
|
}
|
|
343
|
}
|
349
|
}
|
|
344
|
break;
|
350
|
break;
|
|
345
|
- case "noon"://选中午市
|
|
|
|
346
|
- bool select=false;
|
|
|
|
347
|
- for(var temp in dailyMap['noon']){//午市选中12:30
|
|
|
|
348
|
- temp['select']=false;
|
|
|
|
349
|
- if(select)continue;
|
|
|
|
350
|
- if(noons.contains("12:30")&&timeMillsNow<=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "12:30:00"))){
|
|
|
|
351
|
- if(temp['title']=="12:30"){
|
|
|
|
352
|
- temp['select']=true;
|
|
|
|
353
|
- select=true;
|
351
|
+ case "noon": //选中午市
|
|
|
|
352
|
+ bool select = false;
|
|
|
|
353
|
+ for (var temp in dailyMap['noon']) {
|
|
|
|
354
|
+ //午市选中12:30
|
|
|
|
355
|
+ temp['select'] = false;
|
|
|
|
356
|
+ if (select) continue;
|
|
|
|
357
|
+ if (noons.contains("12:30") &&
|
|
|
|
358
|
+ timeMillsNow <=
|
|
|
|
359
|
+ DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime)
|
|
|
|
360
|
+ .replaceRange(11, 19, "12:30:00"))) {
|
|
|
|
361
|
+ if (temp['title'] == "12:30") {
|
|
|
|
362
|
+ temp['select'] = true;
|
|
|
|
363
|
+ select = true;
|
|
354
|
}
|
364
|
}
|
|
355
|
- }else{
|
|
|
|
356
|
- if(timeMillsNow<=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "${temp['title']}:00"))){
|
|
|
|
357
|
- temp['select']=true;
|
|
|
|
358
|
- select=true;
|
365
|
+ } else {
|
|
|
|
366
|
+ if (timeMillsNow <=
|
|
|
|
367
|
+ DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime)
|
|
|
|
368
|
+ .replaceRange(11, 19, "${temp['title']}:00"))) {
|
|
|
|
369
|
+ temp['select'] = true;
|
|
|
|
370
|
+ select = true;
|
|
359
|
}
|
371
|
}
|
|
360
|
}
|
372
|
}
|
|
361
|
}
|
373
|
}
|
|
362
|
break;
|
374
|
break;
|
|
363
|
- case "night"://选中晚市
|
|
|
|
364
|
- bool select=false;
|
|
|
|
365
|
- for(var temp in dailyMap['night']){//晚市选中18:30
|
|
|
|
366
|
- temp['select']=false;
|
|
|
|
367
|
- if(select)continue;
|
|
|
|
368
|
- if(nights.contains("18:30")&&timeMillsNow<=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "18:30:00"))){
|
|
|
|
369
|
- if(temp['title']=="18:30"){
|
|
|
|
370
|
- temp['select']=true;
|
|
|
|
371
|
- select=true;
|
375
|
+ case "night": //选中晚市
|
|
|
|
376
|
+ bool select = false;
|
|
|
|
377
|
+ for (var temp in dailyMap['night']) {
|
|
|
|
378
|
+ //晚市选中18:30
|
|
|
|
379
|
+ temp['select'] = false;
|
|
|
|
380
|
+ if (select) continue;
|
|
|
|
381
|
+ if (nights.contains("18:30") &&
|
|
|
|
382
|
+ timeMillsNow <=
|
|
|
|
383
|
+ DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime)
|
|
|
|
384
|
+ .replaceRange(11, 19, "18:30:00"))) {
|
|
|
|
385
|
+ if (temp['title'] == "18:30") {
|
|
|
|
386
|
+ temp['select'] = true;
|
|
|
|
387
|
+ select = true;
|
|
372
|
}
|
388
|
}
|
|
373
|
- }else{
|
|
|
|
374
|
- if(timeMillsNow<=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "${temp['title']}:00"))){
|
|
|
|
375
|
- temp['select']=true;
|
|
|
|
376
|
- select=true;
|
389
|
+ } else {
|
|
|
|
390
|
+ if (timeMillsNow <=
|
|
|
|
391
|
+ DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime)
|
|
|
|
392
|
+ .replaceRange(11, 19, "${temp['title']}:00"))) {
|
|
|
|
393
|
+ temp['select'] = true;
|
|
|
|
394
|
+ select = true;
|
|
377
|
}
|
395
|
}
|
|
378
|
}
|
396
|
}
|
|
379
|
}
|
397
|
}
|
|
@@ -444,8 +462,8 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
@@ -444,8 +462,8 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
444
|
'ddate_solt': ddate_solt,
|
462
|
'ddate_solt': ddate_solt,
|
|
445
|
'pnum': pnum
|
463
|
'pnum': pnum
|
|
446
|
};
|
464
|
};
|
|
447
|
- if(detailEntity.id.isNotEmpty&&detailEntity.id!="-1"){
|
|
|
|
448
|
- params['rid']=detailEntity.id;
|
465
|
+ if (detailEntity.id.isNotEmpty && detailEntity.id != "-1") {
|
|
|
|
466
|
+ params['rid'] = detailEntity.id;
|
|
449
|
}
|
467
|
}
|
|
450
|
BaseResp<dynamic> baseResp = await DioUtil()
|
468
|
BaseResp<dynamic> baseResp = await DioUtil()
|
|
451
|
.request<dynamic>(context, Method.get, HttpUrl.get_table_list,
|
469
|
.request<dynamic>(context, Method.get, HttpUrl.get_table_list,
|
|
@@ -623,7 +641,7 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
@@ -623,7 +641,7 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
623
|
String timeStrEnd = ymyStr + ' ' + temp.last['title'] + ':00';
|
641
|
String timeStrEnd = ymyStr + ' ' + temp.last['title'] + ':00';
|
|
624
|
int startM = DateUtil.getDateMsByTimeStr(timeStrStart);
|
642
|
int startM = DateUtil.getDateMsByTimeStr(timeStrStart);
|
|
625
|
int endM = DateUtil.getDateMsByTimeStr(timeStrEnd);
|
643
|
int endM = DateUtil.getDateMsByTimeStr(timeStrEnd);
|
|
626
|
- String start='${startM}'.substring(0, 10);
|
644
|
+ String start = '${startM}'.substring(0, 10);
|
|
627
|
String end = '${endM}'.substring(0, 10);
|
645
|
String end = '${endM}'.substring(0, 10);
|
|
628
|
rdate = start + '-' + end;
|
646
|
rdate = start + '-' + end;
|
|
629
|
}
|
647
|
}
|
|
@@ -637,14 +655,14 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
@@ -637,14 +655,14 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
637
|
"sex": sex, //预订人姓名:1:男 2:女
|
655
|
"sex": sex, //预订人姓名:1:男 2:女
|
|
638
|
"phone": phoneController.text, //预订人电话
|
656
|
"phone": phoneController.text, //预订人电话
|
|
639
|
"cusdem": customController.text, //预订人需求:25汉字
|
657
|
"cusdem": customController.text, //预订人需求:25汉字
|
|
640
|
- 'note_name':userModel.user.account,
|
|
|
|
641
|
- 'type':"0",//内部预订
|
658
|
+ 'note_name': userModel.user.account,
|
|
|
|
659
|
+ 'type': "0", //内部预订
|
|
642
|
"rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time)
|
660
|
"rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time)
|
|
643
|
"ddate": '${ddate}'.substring(0, 10), //到店时间
|
661
|
"ddate": '${ddate}'.substring(0, 10), //到店时间
|
|
644
|
- 'is_set_ddate':"1"
|
662
|
+ 'is_set_ddate': "1"
|
|
645
|
};
|
663
|
};
|
|
646
|
- if(detailEntity.id.isNotEmpty&&detailEntity.id!="-1"){
|
|
|
|
647
|
- params['rid']=detailEntity.id;
|
664
|
+ if (detailEntity.id.isNotEmpty && detailEntity.id != "-1") {
|
|
|
|
665
|
+ params['rid'] = detailEntity.id;
|
|
648
|
}
|
666
|
}
|
|
649
|
print(params);
|
667
|
print(params);
|
|
650
|
BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
|
668
|
BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
|
|
@@ -665,14 +683,17 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
@@ -665,14 +683,17 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
665
|
baseResp.responseData['data']['row'] != null) {
|
683
|
baseResp.responseData['data']['row'] != null) {
|
|
666
|
itemModel = ReserveInfoModel.fromJson(baseResp.responseData).data;
|
684
|
itemModel = ReserveInfoModel.fromJson(baseResp.responseData).data;
|
|
667
|
} else {
|
685
|
} else {
|
|
668
|
- Utils.showToast(baseResp.msg ?? detailEntity.id=="-1"?"录入预订订单失败,请重试!":"变更预订订单失败,请重试!");
|
686
|
+ Utils.showToast(baseResp.msg ?? detailEntity.id == "-1"
|
|
|
|
687
|
+ ? "录入预订订单失败,请重试!"
|
|
|
|
688
|
+ : "变更预订订单失败,请重试!");
|
|
669
|
}
|
689
|
}
|
|
670
|
return itemModel;
|
690
|
return itemModel;
|
|
671
|
}
|
691
|
}
|
|
672
|
}
|
692
|
}
|
|
673
|
|
693
|
|
|
674
|
//更改在线预订
|
694
|
//更改在线预订
|
|
675
|
- Future<SunReserveInfoModel> updateOnlineReserveInfo(BuildContext context) async {
|
695
|
+ Future<SunReserveInfoModel> updateOnlineReserveInfo(
|
|
|
|
696
|
+ BuildContext context) async {
|
|
676
|
UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
697
|
UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
677
|
String pnum = '6';
|
698
|
String pnum = '6';
|
|
678
|
for (var item in personNumList) {
|
699
|
for (var item in personNumList) {
|
|
@@ -738,14 +759,14 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
@@ -738,14 +759,14 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
738
|
String timeStrEnd = ymyStr + ' ' + temp.last['title'] + ':00';
|
759
|
String timeStrEnd = ymyStr + ' ' + temp.last['title'] + ':00';
|
|
739
|
int startM = DateUtil.getDateMsByTimeStr(timeStrStart);
|
760
|
int startM = DateUtil.getDateMsByTimeStr(timeStrStart);
|
|
740
|
int endM = DateUtil.getDateMsByTimeStr(timeStrEnd);
|
761
|
int endM = DateUtil.getDateMsByTimeStr(timeStrEnd);
|
|
741
|
- String start='${startM}'.substring(0, 10);
|
762
|
+ String start = '${startM}'.substring(0, 10);
|
|
742
|
String end = '${endM}'.substring(0, 10);
|
763
|
String end = '${endM}'.substring(0, 10);
|
|
743
|
rdate = start + '-' + end;
|
764
|
rdate = start + '-' + end;
|
|
744
|
}
|
765
|
}
|
|
745
|
}
|
766
|
}
|
|
746
|
}
|
767
|
}
|
|
747
|
Map<String, String> params = {
|
768
|
Map<String, String> params = {
|
|
748
|
- "rid":detailEntity.id,
|
769
|
+ "rid": detailEntity.id,
|
|
749
|
'is_set_ddate': isSetDate,
|
770
|
'is_set_ddate': isSetDate,
|
|
750
|
"sid": userModel.user.sellerid, //商家ID
|
771
|
"sid": userModel.user.sellerid, //商家ID
|
|
751
|
"tid": tableSelectInfo, //桌子ID: 格式 2,3,4
|
772
|
"tid": tableSelectInfo, //桌子ID: 格式 2,3,4
|
|
@@ -754,7 +775,7 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
@@ -754,7 +775,7 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
754
|
"sex": sex, //预订人姓名:1:男 2:女
|
775
|
"sex": sex, //预订人姓名:1:男 2:女
|
|
755
|
"phone": phoneController.text, //预订人电话
|
776
|
"phone": phoneController.text, //预订人电话
|
|
756
|
"cusdem": customController.text, //预订人需求:25汉字
|
777
|
"cusdem": customController.text, //预订人需求:25汉字
|
|
757
|
- "type":"0",
|
778
|
+ "type": "0",
|
|
758
|
"rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time)
|
779
|
"rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time)
|
|
759
|
"ddate": '${ddate}'.substring(0, 10), //到店时间
|
780
|
"ddate": '${ddate}'.substring(0, 10), //到店时间
|
|
760
|
"ddate_solt": ddateSolt
|
781
|
"ddate_solt": ddateSolt
|
|
@@ -762,8 +783,8 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
@@ -762,8 +783,8 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
762
|
print(params);
|
783
|
print(params);
|
|
763
|
BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
|
784
|
BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
|
|
764
|
.request<Map<String, dynamic>>(
|
785
|
.request<Map<String, dynamic>>(
|
|
765
|
- context, Method.get, HttpUrl.set_customer_info,
|
|
|
|
766
|
- data: params)
|
786
|
+ context, Method.get, HttpUrl.set_customer_info,
|
|
|
|
787
|
+ data: params)
|
|
767
|
.catchError((error) {
|
788
|
.catchError((error) {
|
|
768
|
print(error.toString());
|
789
|
print(error.toString());
|
|
769
|
});
|
790
|
});
|