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