|
...
|
...
|
@@ -46,13 +46,13 @@ class EnterModel with ChangeNotifier { |
|
|
|
isSetDate = '0';
|
|
|
|
}
|
|
|
|
|
|
|
|
initData(NotebookDetail notebookDetail){
|
|
|
|
this.detailEntity=notebookDetail;
|
|
|
|
initData(NotebookDetail notebookDetail) {
|
|
|
|
this.detailEntity = notebookDetail;
|
|
|
|
print(detailEntity);
|
|
|
|
if (detailEntity.phone != '0') {
|
|
|
|
phoneController.text = detailEntity.phone;
|
|
|
|
}
|
|
|
|
if (detailEntity.rnameStr != '') {
|
|
|
|
if (detailEntity.rname != null && detailEntity.rnameStr != '') {
|
|
|
|
nameController.text = detailEntity.rname;
|
|
|
|
}
|
|
|
|
if (detailEntity.cusdem != '') {
|
|
...
|
...
|
@@ -68,7 +68,7 @@ class EnterModel with ChangeNotifier { |
|
|
|
_initDateList() {
|
|
|
|
String createtime = detailEntity.ddate.toString() + '000';
|
|
|
|
DateTime createTime =
|
|
|
|
DateTime.fromMillisecondsSinceEpoch(int.parse(createtime));
|
|
|
|
DateTime.fromMillisecondsSinceEpoch(int.parse(createtime));
|
|
|
|
ddateStr = DateUtil.formatDate(createTime, format: DateFormats.h_m);
|
|
|
|
String dateTimeSelect = DateUtil.formatDateMs(
|
|
|
|
createTime.millisecondsSinceEpoch,
|
|
...
|
...
|
@@ -87,7 +87,7 @@ class EnterModel with ChangeNotifier { |
|
|
|
//明天
|
|
|
|
int tomorrowMill = dateTimeMill + 24 * 60 * 60 * 1000;
|
|
|
|
String dateTextTomorrow =
|
|
|
|
DateUtil.formatDateMs(tomorrowMill, format: 'MM-dd');
|
|
|
|
DateUtil.formatDateMs(tomorrowMill, format: 'MM-dd');
|
|
|
|
dateList.add({
|
|
|
|
'title': dateTextTomorrow,
|
|
|
|
'select': dateTimeSelect == dateTextTomorrow ? true : false,
|
|
...
|
...
|
@@ -110,7 +110,7 @@ class EnterModel with ChangeNotifier { |
|
|
|
}
|
|
|
|
|
|
|
|
/// 初始化 早市、午市、晚市
|
|
|
|
_initSunDateList(BuildContext context,morning, noon, night) {
|
|
|
|
_initSunDateList(BuildContext context, morning, noon, night) {
|
|
|
|
String ddateSolt = detailEntity.ddate_solt;
|
|
|
|
if (morning != '') {
|
|
|
|
sunDateList.add({
|
|
...
|
...
|
@@ -119,7 +119,10 @@ class EnterModel with ChangeNotifier { |
|
|
|
'ddateSolt': 1,
|
|
|
|
'key': 'morning',
|
|
|
|
'isSelect': ddateSolt == '1' ? true : false,
|
|
|
|
"isEnable":!isOverMorning(DateTime.fromMillisecondsSinceEpoch(int.parse(detailEntity.ddate)*1000), context)
|
|
|
|
"isEnable": !isOverMorning(
|
|
|
|
DateTime.fromMillisecondsSinceEpoch(
|
|
|
|
int.parse(detailEntity.ddate) * 1000),
|
|
|
|
context)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if (noon != '') {
|
|
...
|
...
|
@@ -129,7 +132,10 @@ class EnterModel with ChangeNotifier { |
|
|
|
'ddateSolt': 2,
|
|
|
|
'key': 'noon',
|
|
|
|
'isSelect': ddateSolt == '2' ? true : false,
|
|
|
|
"isEnable":!isOverNoon(DateTime.fromMillisecondsSinceEpoch(int.parse(detailEntity.ddate)*1000), context)
|
|
|
|
"isEnable": !isOverNoon(
|
|
|
|
DateTime.fromMillisecondsSinceEpoch(
|
|
|
|
int.parse(detailEntity.ddate) * 1000),
|
|
|
|
context)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if (night != '') {
|
|
...
|
...
|
@@ -139,64 +145,68 @@ class EnterModel with ChangeNotifier { |
|
|
|
'ddateSolt': 3,
|
|
|
|
'key': 'night',
|
|
|
|
'isSelect': ddateSolt == '3' ? true : false,
|
|
|
|
"isEnable":!isOverNight(DateTime.fromMillisecondsSinceEpoch(int.parse(detailEntity.ddate)*1000), context)
|
|
|
|
"isEnable": !isOverNight(
|
|
|
|
DateTime.fromMillisecondsSinceEpoch(
|
|
|
|
int.parse(detailEntity.ddate) * 1000),
|
|
|
|
context)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
|
|
|
|
updateSunDateList(DateTime dateTime,BuildContext context){
|
|
|
|
UserModel userModel=Provider.of<UserModel>(context,listen: false);
|
|
|
|
for(Map item in sunDateList){
|
|
|
|
item["isEnable"]=true;
|
|
|
|
if(item['dateText']=="早市"){
|
|
|
|
item["isEnable"]=!isOverMorning(dateTime, context);
|
|
|
|
}else if(item['dateText']=="午市"){
|
|
|
|
item["isEnable"]=!isOverNoon(dateTime, context);
|
|
|
|
}else if(item['dateText']=="晚市"){
|
|
|
|
item["isEnable"]=!isOverNight(dateTime, context);
|
|
|
|
updateSunDateList(DateTime dateTime, BuildContext context) {
|
|
|
|
UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
for (Map item in sunDateList) {
|
|
|
|
item["isEnable"] = true;
|
|
|
|
if (item['dateText'] == "早市") {
|
|
|
|
item["isEnable"] = !isOverMorning(dateTime, context);
|
|
|
|
} else if (item['dateText'] == "午市") {
|
|
|
|
item["isEnable"] = !isOverNoon(dateTime, context);
|
|
|
|
} else if (item['dateText'] == "晚市") {
|
|
|
|
item["isEnable"] = !isOverNight(dateTime, context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//当前时间是否查过所选日期早市
|
|
|
|
bool isOverMorning(DateTime dateTime,BuildContext context){
|
|
|
|
int millsNow=DateTime.now().millisecondsSinceEpoch;
|
|
|
|
UserModel userModel=Provider.of<UserModel>(context,listen: false);
|
|
|
|
String morning=userModel.user.morning==""?"00:00-00:00":userModel.user.morning;
|
|
|
|
String endMorning=morning.split("-")[1];
|
|
|
|
int endMorningMills=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "$endMorning:00"));
|
|
|
|
if(millsNow>endMorningMills)return true;
|
|
|
|
bool isOverMorning(DateTime dateTime, BuildContext context) {
|
|
|
|
int millsNow = DateTime.now().millisecondsSinceEpoch;
|
|
|
|
UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
String morning =
|
|
|
|
userModel.user.morning == "" ? "00:00-00:00" : userModel.user.morning;
|
|
|
|
String endMorning = morning.split("-")[1];
|
|
|
|
int endMorningMills = DateUtil.getDateMsByTimeStr(
|
|
|
|
DateUtil.formatDate(dateTime).replaceRange(11, 19, "$endMorning:00"));
|
|
|
|
if (millsNow > endMorningMills) return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//当前时间是否查过所选日期午市
|
|
|
|
bool isOverNoon(DateTime dateTime,BuildContext context){
|
|
|
|
int millsNow=DateTime.now().millisecondsSinceEpoch;
|
|
|
|
UserModel userModel=Provider.of<UserModel>(context,listen: false);
|
|
|
|
String noon=userModel.user.noon==""?"00:00-00:00":userModel.user.noon;
|
|
|
|
String endNoon=noon.split("-")[1];
|
|
|
|
int endNoonMills=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "$endNoon:00"));
|
|
|
|
if(millsNow>endNoonMills)return true;
|
|
|
|
bool isOverNoon(DateTime dateTime, BuildContext context) {
|
|
|
|
int millsNow = DateTime.now().millisecondsSinceEpoch;
|
|
|
|
UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
String noon =
|
|
|
|
userModel.user.noon == "" ? "00:00-00:00" : userModel.user.noon;
|
|
|
|
String endNoon = noon.split("-")[1];
|
|
|
|
int endNoonMills = DateUtil.getDateMsByTimeStr(
|
|
|
|
DateUtil.formatDate(dateTime).replaceRange(11, 19, "$endNoon:00"));
|
|
|
|
if (millsNow > endNoonMills) return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//当前时间是否查过所选日期晚市
|
|
|
|
bool isOverNight(DateTime dateTime,BuildContext context){
|
|
|
|
int millsNow=DateTime.now().millisecondsSinceEpoch;
|
|
|
|
UserModel userModel=Provider.of<UserModel>(context,listen: false);
|
|
|
|
String night=userModel.user.night==""?"00:00-00:00":userModel.user.night;
|
|
|
|
String endNight=night.split("-")[1];
|
|
|
|
int endNightMills=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "$endNight:00"));
|
|
|
|
if(millsNow>endNightMills)return true;
|
|
|
|
bool isOverNight(DateTime dateTime, BuildContext context) {
|
|
|
|
int millsNow = DateTime.now().millisecondsSinceEpoch;
|
|
|
|
UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
String night =
|
|
|
|
userModel.user.night == "" ? "00:00-00:00" : userModel.user.night;
|
|
|
|
String endNight = night.split("-")[1];
|
|
|
|
int endNightMills = DateUtil.getDateMsByTimeStr(
|
|
|
|
DateUtil.formatDate(dateTime).replaceRange(11, 19, "$endNight:00"));
|
|
|
|
if (millsNow > endNightMills) return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//人数
|
|
|
|
_initPersonNumList() {
|
|
|
|
String pnum = detailEntity.pnum;
|
|
...
|
...
|
@@ -286,16 +296,17 @@ class EnterModel with ChangeNotifier { |
|
|
|
model.daily.morning == ''
|
|
|
|
? dailyMap.putIfAbsent('morning', () => '')
|
|
|
|
: dailyMap.putIfAbsent(
|
|
|
|
'morning', () => _getHourAndMinute(model.daily.morning, 1, model));
|
|
|
|
'morning', () => _getHourAndMinute(model.daily.morning, 1, model));
|
|
|
|
model.daily.noon == ''
|
|
|
|
? dailyMap.putIfAbsent('noon', () => '')
|
|
|
|
: dailyMap.putIfAbsent(
|
|
|
|
'noon', () => _getHourAndMinute(model.daily.noon, 2, model));
|
|
|
|
'noon', () => _getHourAndMinute(model.daily.noon, 2, model));
|
|
|
|
model.daily.night == ''
|
|
|
|
? dailyMap.putIfAbsent('night', () => '')
|
|
|
|
: dailyMap.putIfAbsent(
|
|
|
|
'night', () => _getHourAndMinute(model.daily.night, 3, model));
|
|
|
|
_initSunDateList(context,model.daily.morning, model.daily.noon, model.daily.night);
|
|
|
|
'night', () => _getHourAndMinute(model.daily.night, 3, model));
|
|
|
|
_initSunDateList(
|
|
|
|
context, model.daily.morning, model.daily.noon, model.daily.night);
|
|
|
|
}
|
|
|
|
|
|
|
|
//根据获取时间 11:00-12:30 获取30分钟间隔组装的数组
|
|
...
|
...
|
@@ -317,7 +328,7 @@ class EnterModel with ChangeNotifier { |
|
|
|
String temp = _dealTime(beginHour, beginMinute);
|
|
|
|
bool tempSelect = false;
|
|
|
|
if (int.parse(isSetDate) == 1) //设置预订时间
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (temp == ddateStr) {
|
|
|
|
tempSelect = true;
|
|
|
|
}
|
|
...
|
...
|
@@ -380,7 +391,7 @@ class EnterModel with ChangeNotifier { |
|
|
|
};
|
|
|
|
BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
|
|
|
|
.request<Map<String, dynamic>>(context, Method.get, HttpUrl.sellerinfo,
|
|
|
|
data: params)
|
|
|
|
data: params)
|
|
|
|
.catchError((error) {
|
|
|
|
print(error.toString());
|
|
|
|
});
|
|
...
|
...
|
@@ -418,7 +429,7 @@ class EnterModel with ChangeNotifier { |
|
|
|
};
|
|
|
|
BaseResp<dynamic> baseResp = await DioUtil()
|
|
|
|
.request<dynamic>(context, Method.get, HttpUrl.get_table_list,
|
|
|
|
data: params)
|
|
|
|
data: params)
|
|
|
|
.catchError((error) {
|
|
|
|
print(error.toString());
|
|
|
|
});
|
|
...
|
...
|
@@ -608,14 +619,14 @@ class EnterModel with ChangeNotifier { |
|
|
|
"rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time)
|
|
|
|
"ddate": '$ddate'.substring(0, 10), //到店时间
|
|
|
|
"ddate_solt": ddateSolt,
|
|
|
|
"channel":'5',
|
|
|
|
"uid":userModel.user.openid
|
|
|
|
"channel": '5',
|
|
|
|
"uid": userModel.user.openid
|
|
|
|
};
|
|
|
|
print(params.toString());
|
|
|
|
BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
|
|
|
|
.request<Map<String, dynamic>>(
|
|
|
|
context, Method.get, HttpUrl.set_reserve_info,
|
|
|
|
data: params)
|
|
|
|
context, Method.get, HttpUrl.set_reserve_info,
|
|
|
|
data: params)
|
|
|
|
.catchError((error) {
|
|
|
|
print(error);
|
|
|
|
});
|
...
|
...
|
|