|
...
|
...
|
@@ -174,6 +174,10 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> { |
|
|
|
flex: 1,
|
|
|
|
child: InkWell(
|
|
|
|
onTap: () {
|
|
|
|
if (!_getIsSetOver()) {
|
|
|
|
Utils.showToast('不允许变更过去餐段订单的时间');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
String createtime = detailEntity.ddate.toString() + '000';
|
|
|
|
DateTime reservedate =
|
|
|
|
DateTime.fromMillisecondsSinceEpoch(int.parse(createtime));
|
|
...
|
...
|
@@ -809,7 +813,7 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> { |
|
|
|
'-' +
|
|
|
|
Utils.addZeroNumber(time.month) +
|
|
|
|
'-' +
|
|
|
|
Utils.addZeroNumber(time.day) +
|
|
|
|
Utils.addZeroNumber(time.day) +
|
|
|
|
' ${datas[1]}:00'); //选中餐段结束时间戳
|
|
|
|
// 过去的餐段界定
|
|
|
|
if (selectEtime.isBefore(DateTime.now())) {
|
|
...
|
...
|
@@ -878,6 +882,53 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_getIsSetOver() {
|
|
|
|
//判断时间是否可变更
|
|
|
|
|
|
|
|
bool setOrder = true; //默认允许变更过去餐段订单的时间
|
|
|
|
//如果不允许变更过去餐段订单的时间,则开始判断
|
|
|
|
//连个条件同时成立: 1.订单的时间是过去 2. 时间改变
|
|
|
|
if (!isSetOver) {
|
|
|
|
String times;
|
|
|
|
//找到当前餐段对应的时间段
|
|
|
|
if (currTimeIndex == 1) {
|
|
|
|
times = morning;
|
|
|
|
} else if (currTimeIndex == 2) {
|
|
|
|
times = noon;
|
|
|
|
} else if (currTimeIndex == 3) {
|
|
|
|
times = night;
|
|
|
|
}
|
|
|
|
//else if (currTimeIndex == 4) {
|
|
|
|
// times = meal1;
|
|
|
|
// } else if (currTimeIndex == 5) {
|
|
|
|
// times = meal2;
|
|
|
|
// }
|
|
|
|
//组装时间戳
|
|
|
|
List<String> datas = times.split('-');
|
|
|
|
// DateTime selectStime = DateTime.parse('${dateTimeSelect.year}' +
|
|
|
|
// '-' +
|
|
|
|
// '${dateTimeSelect.month}' +
|
|
|
|
// '-' +
|
|
|
|
// '${dateTimeSelect.day}' +
|
|
|
|
// ' ${datas[0]}:00'); //选中餐段开始时间戳
|
|
|
|
DateTime selectEtime = DateTime.parse('${dateTime.year}' +
|
|
|
|
'-' +
|
|
|
|
Utils.addZeroNumber(dateTime.month) +
|
|
|
|
'-' +
|
|
|
|
Utils.addZeroNumber(dateTime.day) +
|
|
|
|
' ${datas[1]}:00'); //选中餐段结束时间戳
|
|
|
|
// 过去的餐段界定
|
|
|
|
if (selectEtime.isBefore(DateTime.now())) {
|
|
|
|
// 属于过去餐段
|
|
|
|
setOrder = false;
|
|
|
|
} else {
|
|
|
|
// 属于未来餐段
|
|
|
|
setOrder = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return setOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
storeBaseIndoProvider =
|
|
...
|
...
|
@@ -1105,52 +1156,7 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> { |
|
|
|
horizontal: ScreenUtil().setWidth(15)),
|
|
|
|
child: GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
//判断时间是否可变更
|
|
|
|
|
|
|
|
bool setOrder = true; //默认允许变更过去餐段订单的时间
|
|
|
|
//如果不允许变更过去餐段订单的时间,则开始判断
|
|
|
|
//连个条件同时成立: 1.订单的时间是过去 2. 时间改变
|
|
|
|
if (!isSetOver) {
|
|
|
|
String times;
|
|
|
|
//找到当前餐段对应的时间段
|
|
|
|
if (currTimeIndex == 1) {
|
|
|
|
times = morning;
|
|
|
|
} else if (currTimeIndex == 2) {
|
|
|
|
times = noon;
|
|
|
|
} else if (currTimeIndex == 3) {
|
|
|
|
times = night;
|
|
|
|
}
|
|
|
|
//else if (currTimeIndex == 4) {
|
|
|
|
// times = meal1;
|
|
|
|
// } else if (currTimeIndex == 5) {
|
|
|
|
// times = meal2;
|
|
|
|
// }
|
|
|
|
//组装时间戳
|
|
|
|
List<String> datas = times.split('-');
|
|
|
|
// DateTime selectStime = DateTime.parse('${dateTimeSelect.year}' +
|
|
|
|
// '-' +
|
|
|
|
// '${dateTimeSelect.month}' +
|
|
|
|
// '-' +
|
|
|
|
// '${dateTimeSelect.day}' +
|
|
|
|
// ' ${datas[0]}:00'); //选中餐段开始时间戳
|
|
|
|
DateTime selectEtime = DateTime.parse(
|
|
|
|
'${dateTime.year}' +
|
|
|
|
'-' +
|
|
|
|
Utils.addZeroNumber(dateTime.month) +
|
|
|
|
'-' +
|
|
|
|
Utils.addZeroNumber(dateTime.day) +
|
|
|
|
' ${datas[1]}:00'); //选中餐段结束时间戳
|
|
|
|
// 过去的餐段界定
|
|
|
|
if (selectEtime.isBefore(DateTime.now())) {
|
|
|
|
// 属于过去餐段
|
|
|
|
setOrder = false;
|
|
|
|
} else {
|
|
|
|
// 属于未来餐段
|
|
|
|
setOrder = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!setOrder) {
|
|
|
|
if (!_getIsSetOver()) {
|
|
|
|
Utils.showToast('不允许变更过去餐段订单的时间');
|
|
|
|
return;
|
|
|
|
}
|
|
...
|
...
|
@@ -1504,6 +1510,10 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> { |
|
|
|
onTap: () async {
|
|
|
|
FocusScope.of(context)
|
|
|
|
.requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
if (!_getIsSetOver()) {
|
|
|
|
Utils.showToast('不允许变更过去餐段订单的桌位');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
int ddate = dateTime.millisecondsSinceEpoch;
|
|
|
|
String ddateSolt = currTimeIndex.toString();
|
|
|
|
Map temp = await NavigatorUtil
|
...
|
...
|
|