|
@@ -174,6 +174,10 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> { |
|
@@ -174,6 +174,10 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> { |
|
174
|
flex: 1,
|
174
|
flex: 1,
|
|
175
|
child: InkWell(
|
175
|
child: InkWell(
|
|
176
|
onTap: () {
|
176
|
onTap: () {
|
|
|
|
177
|
+ if (!_getIsSetOver()) {
|
|
|
|
178
|
+ Utils.showToast('不允许变更过去餐段订单的时间');
|
|
|
|
179
|
+ return;
|
|
|
|
180
|
+ }
|
|
177
|
String createtime = detailEntity.ddate.toString() + '000';
|
181
|
String createtime = detailEntity.ddate.toString() + '000';
|
|
178
|
DateTime reservedate =
|
182
|
DateTime reservedate =
|
|
179
|
DateTime.fromMillisecondsSinceEpoch(int.parse(createtime));
|
183
|
DateTime.fromMillisecondsSinceEpoch(int.parse(createtime));
|
|
@@ -809,7 +813,7 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> { |
|
@@ -809,7 +813,7 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> { |
|
809
|
'-' +
|
813
|
'-' +
|
|
810
|
Utils.addZeroNumber(time.month) +
|
814
|
Utils.addZeroNumber(time.month) +
|
|
811
|
'-' +
|
815
|
'-' +
|
|
812
|
- Utils.addZeroNumber(time.day) +
|
816
|
+ Utils.addZeroNumber(time.day) +
|
|
813
|
' ${datas[1]}:00'); //选中餐段结束时间戳
|
817
|
' ${datas[1]}:00'); //选中餐段结束时间戳
|
|
814
|
// 过去的餐段界定
|
818
|
// 过去的餐段界定
|
|
815
|
if (selectEtime.isBefore(DateTime.now())) {
|
819
|
if (selectEtime.isBefore(DateTime.now())) {
|
|
@@ -878,6 +882,53 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> { |
|
@@ -878,6 +882,53 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> { |
|
878
|
}
|
882
|
}
|
|
879
|
}
|
883
|
}
|
|
880
|
|
884
|
|
|
|
|
885
|
+ _getIsSetOver() {
|
|
|
|
886
|
+ //判断时间是否可变更
|
|
|
|
887
|
+
|
|
|
|
888
|
+ bool setOrder = true; //默认允许变更过去餐段订单的时间
|
|
|
|
889
|
+ //如果不允许变更过去餐段订单的时间,则开始判断
|
|
|
|
890
|
+ //连个条件同时成立: 1.订单的时间是过去 2. 时间改变
|
|
|
|
891
|
+ if (!isSetOver) {
|
|
|
|
892
|
+ String times;
|
|
|
|
893
|
+ //找到当前餐段对应的时间段
|
|
|
|
894
|
+ if (currTimeIndex == 1) {
|
|
|
|
895
|
+ times = morning;
|
|
|
|
896
|
+ } else if (currTimeIndex == 2) {
|
|
|
|
897
|
+ times = noon;
|
|
|
|
898
|
+ } else if (currTimeIndex == 3) {
|
|
|
|
899
|
+ times = night;
|
|
|
|
900
|
+ }
|
|
|
|
901
|
+ //else if (currTimeIndex == 4) {
|
|
|
|
902
|
+ // times = meal1;
|
|
|
|
903
|
+ // } else if (currTimeIndex == 5) {
|
|
|
|
904
|
+ // times = meal2;
|
|
|
|
905
|
+ // }
|
|
|
|
906
|
+ //组装时间戳
|
|
|
|
907
|
+ List<String> datas = times.split('-');
|
|
|
|
908
|
+ // DateTime selectStime = DateTime.parse('${dateTimeSelect.year}' +
|
|
|
|
909
|
+ // '-' +
|
|
|
|
910
|
+ // '${dateTimeSelect.month}' +
|
|
|
|
911
|
+ // '-' +
|
|
|
|
912
|
+ // '${dateTimeSelect.day}' +
|
|
|
|
913
|
+ // ' ${datas[0]}:00'); //选中餐段开始时间戳
|
|
|
|
914
|
+ DateTime selectEtime = DateTime.parse('${dateTime.year}' +
|
|
|
|
915
|
+ '-' +
|
|
|
|
916
|
+ Utils.addZeroNumber(dateTime.month) +
|
|
|
|
917
|
+ '-' +
|
|
|
|
918
|
+ Utils.addZeroNumber(dateTime.day) +
|
|
|
|
919
|
+ ' ${datas[1]}:00'); //选中餐段结束时间戳
|
|
|
|
920
|
+ // 过去的餐段界定
|
|
|
|
921
|
+ if (selectEtime.isBefore(DateTime.now())) {
|
|
|
|
922
|
+// 属于过去餐段
|
|
|
|
923
|
+ setOrder = false;
|
|
|
|
924
|
+ } else {
|
|
|
|
925
|
+ // 属于未来餐段
|
|
|
|
926
|
+ setOrder = true;
|
|
|
|
927
|
+ }
|
|
|
|
928
|
+ }
|
|
|
|
929
|
+ return setOrder;
|
|
|
|
930
|
+ }
|
|
|
|
931
|
+
|
|
881
|
@override
|
932
|
@override
|
|
882
|
Widget build(BuildContext context) {
|
933
|
Widget build(BuildContext context) {
|
|
883
|
storeBaseIndoProvider =
|
934
|
storeBaseIndoProvider =
|
|
@@ -1105,52 +1156,7 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> { |
|
@@ -1105,52 +1156,7 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> { |
|
1105
|
horizontal: ScreenUtil().setWidth(15)),
|
1156
|
horizontal: ScreenUtil().setWidth(15)),
|
|
1106
|
child: GestureDetector(
|
1157
|
child: GestureDetector(
|
|
1107
|
onTap: () {
|
1158
|
onTap: () {
|
|
1108
|
- //判断时间是否可变更
|
|
|
|
1109
|
-
|
|
|
|
1110
|
- bool setOrder = true; //默认允许变更过去餐段订单的时间
|
|
|
|
1111
|
- //如果不允许变更过去餐段订单的时间,则开始判断
|
|
|
|
1112
|
- //连个条件同时成立: 1.订单的时间是过去 2. 时间改变
|
|
|
|
1113
|
- if (!isSetOver) {
|
|
|
|
1114
|
- String times;
|
|
|
|
1115
|
- //找到当前餐段对应的时间段
|
|
|
|
1116
|
- if (currTimeIndex == 1) {
|
|
|
|
1117
|
- times = morning;
|
|
|
|
1118
|
- } else if (currTimeIndex == 2) {
|
|
|
|
1119
|
- times = noon;
|
|
|
|
1120
|
- } else if (currTimeIndex == 3) {
|
|
|
|
1121
|
- times = night;
|
|
|
|
1122
|
- }
|
|
|
|
1123
|
- //else if (currTimeIndex == 4) {
|
|
|
|
1124
|
- // times = meal1;
|
|
|
|
1125
|
- // } else if (currTimeIndex == 5) {
|
|
|
|
1126
|
- // times = meal2;
|
|
|
|
1127
|
- // }
|
|
|
|
1128
|
- //组装时间戳
|
|
|
|
1129
|
- List<String> datas = times.split('-');
|
|
|
|
1130
|
- // DateTime selectStime = DateTime.parse('${dateTimeSelect.year}' +
|
|
|
|
1131
|
- // '-' +
|
|
|
|
1132
|
- // '${dateTimeSelect.month}' +
|
|
|
|
1133
|
- // '-' +
|
|
|
|
1134
|
- // '${dateTimeSelect.day}' +
|
|
|
|
1135
|
- // ' ${datas[0]}:00'); //选中餐段开始时间戳
|
|
|
|
1136
|
- DateTime selectEtime = DateTime.parse(
|
|
|
|
1137
|
- '${dateTime.year}' +
|
|
|
|
1138
|
- '-' +
|
|
|
|
1139
|
- Utils.addZeroNumber(dateTime.month) +
|
|
|
|
1140
|
- '-' +
|
|
|
|
1141
|
- Utils.addZeroNumber(dateTime.day) +
|
|
|
|
1142
|
- ' ${datas[1]}:00'); //选中餐段结束时间戳
|
|
|
|
1143
|
- // 过去的餐段界定
|
|
|
|
1144
|
- if (selectEtime.isBefore(DateTime.now())) {
|
|
|
|
1145
|
-// 属于过去餐段
|
|
|
|
1146
|
- setOrder = false;
|
|
|
|
1147
|
- } else {
|
|
|
|
1148
|
- // 属于未来餐段
|
|
|
|
1149
|
- setOrder = true;
|
|
|
|
1150
|
- }
|
|
|
|
1151
|
- }
|
|
|
|
1152
|
-
|
|
|
|
1153
|
- if (!setOrder) {
|
1159
|
+ if (!_getIsSetOver()) {
|
|
1154
|
Utils.showToast('不允许变更过去餐段订单的时间');
|
1160
|
Utils.showToast('不允许变更过去餐段订单的时间');
|
|
1155
|
return;
|
1161
|
return;
|
|
1156
|
}
|
1162
|
}
|
|
@@ -1504,6 +1510,10 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> { |
|
@@ -1504,6 +1510,10 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> { |
|
1504
|
onTap: () async {
|
1510
|
onTap: () async {
|
|
1505
|
FocusScope.of(context)
|
1511
|
FocusScope.of(context)
|
|
1506
|
.requestFocus(FocusNode()); //点击空白处隐藏键盘
|
1512
|
.requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
1513
|
+ if (!_getIsSetOver()) {
|
|
|
|
1514
|
+ Utils.showToast('不允许变更过去餐段订单的桌位');
|
|
|
|
1515
|
+ return;
|
|
|
|
1516
|
+ }
|
|
1507
|
int ddate = dateTime.millisecondsSinceEpoch;
|
1517
|
int ddate = dateTime.millisecondsSinceEpoch;
|
|
1508
|
String ddateSolt = currTimeIndex.toString();
|
1518
|
String ddateSolt = currTimeIndex.toString();
|
|
1509
|
Map temp = await NavigatorUtil
|
1519
|
Map temp = await NavigatorUtil
|