|
@@ -46,13 +46,13 @@ class EnterModel with ChangeNotifier { |
|
@@ -46,13 +46,13 @@ class EnterModel with ChangeNotifier { |
|
46
|
isSetDate = '0';
|
46
|
isSetDate = '0';
|
|
47
|
}
|
47
|
}
|
|
48
|
|
48
|
|
|
49
|
- initData(NotebookDetail notebookDetail){
|
|
|
|
50
|
- this.detailEntity=notebookDetail;
|
49
|
+ initData(NotebookDetail notebookDetail) {
|
|
|
|
50
|
+ this.detailEntity = notebookDetail;
|
|
51
|
print(detailEntity);
|
51
|
print(detailEntity);
|
|
52
|
if (detailEntity.phone != '0') {
|
52
|
if (detailEntity.phone != '0') {
|
|
53
|
phoneController.text = detailEntity.phone;
|
53
|
phoneController.text = detailEntity.phone;
|
|
54
|
}
|
54
|
}
|
|
55
|
- if (detailEntity.rnameStr != '') {
|
55
|
+ if (detailEntity.rname != null && detailEntity.rnameStr != '') {
|
|
56
|
nameController.text = detailEntity.rname;
|
56
|
nameController.text = detailEntity.rname;
|
|
57
|
}
|
57
|
}
|
|
58
|
if (detailEntity.cusdem != '') {
|
58
|
if (detailEntity.cusdem != '') {
|
|
@@ -68,7 +68,7 @@ class EnterModel with ChangeNotifier { |
|
@@ -68,7 +68,7 @@ class EnterModel with ChangeNotifier { |
|
68
|
_initDateList() {
|
68
|
_initDateList() {
|
|
69
|
String createtime = detailEntity.ddate.toString() + '000';
|
69
|
String createtime = detailEntity.ddate.toString() + '000';
|
|
70
|
DateTime createTime =
|
70
|
DateTime createTime =
|
|
71
|
- DateTime.fromMillisecondsSinceEpoch(int.parse(createtime));
|
71
|
+ DateTime.fromMillisecondsSinceEpoch(int.parse(createtime));
|
|
72
|
ddateStr = DateUtil.formatDate(createTime, format: DateFormats.h_m);
|
72
|
ddateStr = DateUtil.formatDate(createTime, format: DateFormats.h_m);
|
|
73
|
String dateTimeSelect = DateUtil.formatDateMs(
|
73
|
String dateTimeSelect = DateUtil.formatDateMs(
|
|
74
|
createTime.millisecondsSinceEpoch,
|
74
|
createTime.millisecondsSinceEpoch,
|
|
@@ -87,7 +87,7 @@ class EnterModel with ChangeNotifier { |
|
@@ -87,7 +87,7 @@ class EnterModel with ChangeNotifier { |
|
87
|
//明天
|
87
|
//明天
|
|
88
|
int tomorrowMill = dateTimeMill + 24 * 60 * 60 * 1000;
|
88
|
int tomorrowMill = dateTimeMill + 24 * 60 * 60 * 1000;
|
|
89
|
String dateTextTomorrow =
|
89
|
String dateTextTomorrow =
|
|
90
|
- DateUtil.formatDateMs(tomorrowMill, format: 'MM-dd');
|
90
|
+ DateUtil.formatDateMs(tomorrowMill, format: 'MM-dd');
|
|
91
|
dateList.add({
|
91
|
dateList.add({
|
|
92
|
'title': dateTextTomorrow,
|
92
|
'title': dateTextTomorrow,
|
|
93
|
'select': dateTimeSelect == dateTextTomorrow ? true : false,
|
93
|
'select': dateTimeSelect == dateTextTomorrow ? true : false,
|
|
@@ -110,7 +110,7 @@ class EnterModel with ChangeNotifier { |
|
@@ -110,7 +110,7 @@ class EnterModel with ChangeNotifier { |
|
110
|
}
|
110
|
}
|
|
111
|
|
111
|
|
|
112
|
/// 初始化 早市、午市、晚市
|
112
|
/// 初始化 早市、午市、晚市
|
|
113
|
- _initSunDateList(BuildContext context,morning, noon, night) {
|
113
|
+ _initSunDateList(BuildContext context, morning, noon, night) {
|
|
114
|
String ddateSolt = detailEntity.ddate_solt;
|
114
|
String ddateSolt = detailEntity.ddate_solt;
|
|
115
|
if (morning != '') {
|
115
|
if (morning != '') {
|
|
116
|
sunDateList.add({
|
116
|
sunDateList.add({
|
|
@@ -119,7 +119,10 @@ class EnterModel with ChangeNotifier { |
|
@@ -119,7 +119,10 @@ class EnterModel with ChangeNotifier { |
|
119
|
'ddateSolt': 1,
|
119
|
'ddateSolt': 1,
|
|
120
|
'key': 'morning',
|
120
|
'key': 'morning',
|
|
121
|
'isSelect': ddateSolt == '1' ? true : false,
|
121
|
'isSelect': ddateSolt == '1' ? true : false,
|
|
122
|
- "isEnable":!isOverMorning(DateTime.fromMillisecondsSinceEpoch(int.parse(detailEntity.ddate)*1000), context)
|
122
|
+ "isEnable": !isOverMorning(
|
|
|
|
123
|
+ DateTime.fromMillisecondsSinceEpoch(
|
|
|
|
124
|
+ int.parse(detailEntity.ddate) * 1000),
|
|
|
|
125
|
+ context)
|
|
123
|
});
|
126
|
});
|
|
124
|
}
|
127
|
}
|
|
125
|
if (noon != '') {
|
128
|
if (noon != '') {
|
|
@@ -129,7 +132,10 @@ class EnterModel with ChangeNotifier { |
|
@@ -129,7 +132,10 @@ class EnterModel with ChangeNotifier { |
|
129
|
'ddateSolt': 2,
|
132
|
'ddateSolt': 2,
|
|
130
|
'key': 'noon',
|
133
|
'key': 'noon',
|
|
131
|
'isSelect': ddateSolt == '2' ? true : false,
|
134
|
'isSelect': ddateSolt == '2' ? true : false,
|
|
132
|
- "isEnable":!isOverNoon(DateTime.fromMillisecondsSinceEpoch(int.parse(detailEntity.ddate)*1000), context)
|
135
|
+ "isEnable": !isOverNoon(
|
|
|
|
136
|
+ DateTime.fromMillisecondsSinceEpoch(
|
|
|
|
137
|
+ int.parse(detailEntity.ddate) * 1000),
|
|
|
|
138
|
+ context)
|
|
133
|
});
|
139
|
});
|
|
134
|
}
|
140
|
}
|
|
135
|
if (night != '') {
|
141
|
if (night != '') {
|
|
@@ -139,64 +145,68 @@ class EnterModel with ChangeNotifier { |
|
@@ -139,64 +145,68 @@ class EnterModel with ChangeNotifier { |
|
139
|
'ddateSolt': 3,
|
145
|
'ddateSolt': 3,
|
|
140
|
'key': 'night',
|
146
|
'key': 'night',
|
|
141
|
'isSelect': ddateSolt == '3' ? true : false,
|
147
|
'isSelect': ddateSolt == '3' ? true : false,
|
|
142
|
- "isEnable":!isOverNight(DateTime.fromMillisecondsSinceEpoch(int.parse(detailEntity.ddate)*1000), context)
|
148
|
+ "isEnable": !isOverNight(
|
|
|
|
149
|
+ DateTime.fromMillisecondsSinceEpoch(
|
|
|
|
150
|
+ int.parse(detailEntity.ddate) * 1000),
|
|
|
|
151
|
+ context)
|
|
143
|
});
|
152
|
});
|
|
144
|
}
|
153
|
}
|
|
145
|
notifyListeners();
|
154
|
notifyListeners();
|
|
146
|
}
|
155
|
}
|
|
147
|
|
156
|
|
|
148
|
- updateSunDateList(DateTime dateTime,BuildContext context){
|
|
|
|
149
|
- UserModel userModel=Provider.of<UserModel>(context,listen: false);
|
|
|
|
150
|
- for(Map item in sunDateList){
|
|
|
|
151
|
- item["isEnable"]=true;
|
|
|
|
152
|
- if(item['dateText']=="早市"){
|
|
|
|
153
|
- item["isEnable"]=!isOverMorning(dateTime, context);
|
|
|
|
154
|
- }else if(item['dateText']=="午市"){
|
|
|
|
155
|
- item["isEnable"]=!isOverNoon(dateTime, context);
|
|
|
|
156
|
- }else if(item['dateText']=="晚市"){
|
|
|
|
157
|
- item["isEnable"]=!isOverNight(dateTime, context);
|
157
|
+ updateSunDateList(DateTime dateTime, BuildContext context) {
|
|
|
|
158
|
+ UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
159
|
+ for (Map item in sunDateList) {
|
|
|
|
160
|
+ item["isEnable"] = true;
|
|
|
|
161
|
+ if (item['dateText'] == "早市") {
|
|
|
|
162
|
+ item["isEnable"] = !isOverMorning(dateTime, context);
|
|
|
|
163
|
+ } else if (item['dateText'] == "午市") {
|
|
|
|
164
|
+ item["isEnable"] = !isOverNoon(dateTime, context);
|
|
|
|
165
|
+ } else if (item['dateText'] == "晚市") {
|
|
|
|
166
|
+ item["isEnable"] = !isOverNight(dateTime, context);
|
|
158
|
}
|
167
|
}
|
|
159
|
}
|
168
|
}
|
|
160
|
}
|
169
|
}
|
|
161
|
|
170
|
|
|
162
|
-
|
|
|
|
163
|
-
|
|
|
|
164
|
//当前时间是否查过所选日期早市
|
171
|
//当前时间是否查过所选日期早市
|
|
165
|
- bool isOverMorning(DateTime dateTime,BuildContext context){
|
|
|
|
166
|
- int millsNow=DateTime.now().millisecondsSinceEpoch;
|
|
|
|
167
|
- UserModel userModel=Provider.of<UserModel>(context,listen: false);
|
|
|
|
168
|
- String morning=userModel.user.morning==""?"00:00-00:00":userModel.user.morning;
|
|
|
|
169
|
- String endMorning=morning.split("-")[1];
|
|
|
|
170
|
- int endMorningMills=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "$endMorning:00"));
|
|
|
|
171
|
- if(millsNow>endMorningMills)return true;
|
172
|
+ bool isOverMorning(DateTime dateTime, BuildContext context) {
|
|
|
|
173
|
+ int millsNow = DateTime.now().millisecondsSinceEpoch;
|
|
|
|
174
|
+ UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
175
|
+ String morning =
|
|
|
|
176
|
+ userModel.user.morning == "" ? "00:00-00:00" : userModel.user.morning;
|
|
|
|
177
|
+ String endMorning = morning.split("-")[1];
|
|
|
|
178
|
+ int endMorningMills = DateUtil.getDateMsByTimeStr(
|
|
|
|
179
|
+ DateUtil.formatDate(dateTime).replaceRange(11, 19, "$endMorning:00"));
|
|
|
|
180
|
+ if (millsNow > endMorningMills) return true;
|
|
172
|
return false;
|
181
|
return false;
|
|
173
|
}
|
182
|
}
|
|
174
|
|
183
|
|
|
175
|
//当前时间是否查过所选日期午市
|
184
|
//当前时间是否查过所选日期午市
|
|
176
|
- bool isOverNoon(DateTime dateTime,BuildContext context){
|
|
|
|
177
|
- int millsNow=DateTime.now().millisecondsSinceEpoch;
|
|
|
|
178
|
- UserModel userModel=Provider.of<UserModel>(context,listen: false);
|
|
|
|
179
|
- String noon=userModel.user.noon==""?"00:00-00:00":userModel.user.noon;
|
|
|
|
180
|
- String endNoon=noon.split("-")[1];
|
|
|
|
181
|
- int endNoonMills=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "$endNoon:00"));
|
|
|
|
182
|
- if(millsNow>endNoonMills)return true;
|
185
|
+ bool isOverNoon(DateTime dateTime, BuildContext context) {
|
|
|
|
186
|
+ int millsNow = DateTime.now().millisecondsSinceEpoch;
|
|
|
|
187
|
+ UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
188
|
+ String noon =
|
|
|
|
189
|
+ userModel.user.noon == "" ? "00:00-00:00" : userModel.user.noon;
|
|
|
|
190
|
+ String endNoon = noon.split("-")[1];
|
|
|
|
191
|
+ int endNoonMills = DateUtil.getDateMsByTimeStr(
|
|
|
|
192
|
+ DateUtil.formatDate(dateTime).replaceRange(11, 19, "$endNoon:00"));
|
|
|
|
193
|
+ if (millsNow > endNoonMills) return true;
|
|
183
|
return false;
|
194
|
return false;
|
|
184
|
}
|
195
|
}
|
|
185
|
|
196
|
|
|
186
|
//当前时间是否查过所选日期晚市
|
197
|
//当前时间是否查过所选日期晚市
|
|
187
|
- bool isOverNight(DateTime dateTime,BuildContext context){
|
|
|
|
188
|
- int millsNow=DateTime.now().millisecondsSinceEpoch;
|
|
|
|
189
|
- UserModel userModel=Provider.of<UserModel>(context,listen: false);
|
|
|
|
190
|
- String night=userModel.user.night==""?"00:00-00:00":userModel.user.night;
|
|
|
|
191
|
- String endNight=night.split("-")[1];
|
|
|
|
192
|
- int endNightMills=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "$endNight:00"));
|
|
|
|
193
|
- if(millsNow>endNightMills)return true;
|
198
|
+ bool isOverNight(DateTime dateTime, BuildContext context) {
|
|
|
|
199
|
+ int millsNow = DateTime.now().millisecondsSinceEpoch;
|
|
|
|
200
|
+ UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
201
|
+ String night =
|
|
|
|
202
|
+ userModel.user.night == "" ? "00:00-00:00" : userModel.user.night;
|
|
|
|
203
|
+ String endNight = night.split("-")[1];
|
|
|
|
204
|
+ int endNightMills = DateUtil.getDateMsByTimeStr(
|
|
|
|
205
|
+ DateUtil.formatDate(dateTime).replaceRange(11, 19, "$endNight:00"));
|
|
|
|
206
|
+ if (millsNow > endNightMills) return true;
|
|
194
|
return false;
|
207
|
return false;
|
|
195
|
}
|
208
|
}
|
|
196
|
|
209
|
|
|
197
|
-
|
|
|
|
198
|
-
|
|
|
|
199
|
-
|
|
|
|
200
|
//人数
|
210
|
//人数
|
|
201
|
_initPersonNumList() {
|
211
|
_initPersonNumList() {
|
|
202
|
String pnum = detailEntity.pnum;
|
212
|
String pnum = detailEntity.pnum;
|
|
@@ -286,16 +296,17 @@ class EnterModel with ChangeNotifier { |
|
@@ -286,16 +296,17 @@ class EnterModel with ChangeNotifier { |
|
286
|
model.daily.morning == ''
|
296
|
model.daily.morning == ''
|
|
287
|
? dailyMap.putIfAbsent('morning', () => '')
|
297
|
? dailyMap.putIfAbsent('morning', () => '')
|
|
288
|
: dailyMap.putIfAbsent(
|
298
|
: dailyMap.putIfAbsent(
|
|
289
|
- 'morning', () => _getHourAndMinute(model.daily.morning, 1, model));
|
299
|
+ 'morning', () => _getHourAndMinute(model.daily.morning, 1, model));
|
|
290
|
model.daily.noon == ''
|
300
|
model.daily.noon == ''
|
|
291
|
? dailyMap.putIfAbsent('noon', () => '')
|
301
|
? dailyMap.putIfAbsent('noon', () => '')
|
|
292
|
: dailyMap.putIfAbsent(
|
302
|
: dailyMap.putIfAbsent(
|
|
293
|
- 'noon', () => _getHourAndMinute(model.daily.noon, 2, model));
|
303
|
+ 'noon', () => _getHourAndMinute(model.daily.noon, 2, model));
|
|
294
|
model.daily.night == ''
|
304
|
model.daily.night == ''
|
|
295
|
? dailyMap.putIfAbsent('night', () => '')
|
305
|
? dailyMap.putIfAbsent('night', () => '')
|
|
296
|
: dailyMap.putIfAbsent(
|
306
|
: dailyMap.putIfAbsent(
|
|
297
|
- 'night', () => _getHourAndMinute(model.daily.night, 3, model));
|
|
|
|
298
|
- _initSunDateList(context,model.daily.morning, model.daily.noon, model.daily.night);
|
307
|
+ 'night', () => _getHourAndMinute(model.daily.night, 3, model));
|
|
|
|
308
|
+ _initSunDateList(
|
|
|
|
309
|
+ context, model.daily.morning, model.daily.noon, model.daily.night);
|
|
299
|
}
|
310
|
}
|
|
300
|
|
311
|
|
|
301
|
//根据获取时间 11:00-12:30 获取30分钟间隔组装的数组
|
312
|
//根据获取时间 11:00-12:30 获取30分钟间隔组装的数组
|
|
@@ -317,7 +328,7 @@ class EnterModel with ChangeNotifier { |
|
@@ -317,7 +328,7 @@ class EnterModel with ChangeNotifier { |
|
317
|
String temp = _dealTime(beginHour, beginMinute);
|
328
|
String temp = _dealTime(beginHour, beginMinute);
|
|
318
|
bool tempSelect = false;
|
329
|
bool tempSelect = false;
|
|
319
|
if (int.parse(isSetDate) == 1) //设置预订时间
|
330
|
if (int.parse(isSetDate) == 1) //设置预订时间
|
|
320
|
- {
|
331
|
+ {
|
|
321
|
if (temp == ddateStr) {
|
332
|
if (temp == ddateStr) {
|
|
322
|
tempSelect = true;
|
333
|
tempSelect = true;
|
|
323
|
}
|
334
|
}
|
|
@@ -380,7 +391,7 @@ class EnterModel with ChangeNotifier { |
|
@@ -380,7 +391,7 @@ class EnterModel with ChangeNotifier { |
|
380
|
};
|
391
|
};
|
|
381
|
BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
|
392
|
BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
|
|
382
|
.request<Map<String, dynamic>>(context, Method.get, HttpUrl.sellerinfo,
|
393
|
.request<Map<String, dynamic>>(context, Method.get, HttpUrl.sellerinfo,
|
|
383
|
- data: params)
|
394
|
+ data: params)
|
|
384
|
.catchError((error) {
|
395
|
.catchError((error) {
|
|
385
|
print(error.toString());
|
396
|
print(error.toString());
|
|
386
|
});
|
397
|
});
|
|
@@ -418,7 +429,7 @@ class EnterModel with ChangeNotifier { |
|
@@ -418,7 +429,7 @@ class EnterModel with ChangeNotifier { |
|
418
|
};
|
429
|
};
|
|
419
|
BaseResp<dynamic> baseResp = await DioUtil()
|
430
|
BaseResp<dynamic> baseResp = await DioUtil()
|
|
420
|
.request<dynamic>(context, Method.get, HttpUrl.get_table_list,
|
431
|
.request<dynamic>(context, Method.get, HttpUrl.get_table_list,
|
|
421
|
- data: params)
|
432
|
+ data: params)
|
|
422
|
.catchError((error) {
|
433
|
.catchError((error) {
|
|
423
|
print(error.toString());
|
434
|
print(error.toString());
|
|
424
|
});
|
435
|
});
|
|
@@ -608,14 +619,14 @@ class EnterModel with ChangeNotifier { |
|
@@ -608,14 +619,14 @@ class EnterModel with ChangeNotifier { |
|
608
|
"rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time)
|
619
|
"rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time)
|
|
609
|
"ddate": '$ddate'.substring(0, 10), //到店时间
|
620
|
"ddate": '$ddate'.substring(0, 10), //到店时间
|
|
610
|
"ddate_solt": ddateSolt,
|
621
|
"ddate_solt": ddateSolt,
|
|
611
|
- "channel":'5',
|
|
|
|
612
|
- "uid":userModel.user.openid
|
622
|
+ "channel": '5',
|
|
|
|
623
|
+ "uid": userModel.user.openid
|
|
613
|
};
|
624
|
};
|
|
614
|
print(params.toString());
|
625
|
print(params.toString());
|
|
615
|
BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
|
626
|
BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
|
|
616
|
.request<Map<String, dynamic>>(
|
627
|
.request<Map<String, dynamic>>(
|
|
617
|
- context, Method.get, HttpUrl.set_reserve_info,
|
|
|
|
618
|
- data: params)
|
628
|
+ context, Method.get, HttpUrl.set_reserve_info,
|
|
|
|
629
|
+ data: params)
|
|
619
|
.catchError((error) {
|
630
|
.catchError((error) {
|
|
620
|
print(error);
|
631
|
print(error);
|
|
621
|
});
|
632
|
});
|