调整司机预约时间
站点工单状态
This commit is contained in:
BIN
ln_jq_app/android/app/src/main/res/mipmap-xhdpi/logo.jpg
Normal file
BIN
ln_jq_app/android/app/src/main/res/mipmap-xhdpi/logo.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 74 KiB |
@@ -294,14 +294,10 @@
|
|||||||
inputFileListPaths = (
|
inputFileListPaths = (
|
||||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
||||||
);
|
);
|
||||||
inputPaths = (
|
|
||||||
);
|
|
||||||
name = "[CP] Embed Pods Frameworks";
|
name = "[CP] Embed Pods Frameworks";
|
||||||
outputFileListPaths = (
|
outputFileListPaths = (
|
||||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
||||||
);
|
);
|
||||||
outputPaths = (
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
||||||
@@ -374,14 +370,10 @@
|
|||||||
inputFileListPaths = (
|
inputFileListPaths = (
|
||||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
|
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
|
||||||
);
|
);
|
||||||
inputPaths = (
|
|
||||||
);
|
|
||||||
name = "[CP] Copy Pods Resources";
|
name = "[CP] Copy Pods Resources";
|
||||||
outputFileListPaths = (
|
outputFileListPaths = (
|
||||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
|
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
|
||||||
);
|
);
|
||||||
outputPaths = (
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
|
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
|
||||||
|
|||||||
@@ -76,8 +76,6 @@ void initHttpSet() {
|
|||||||
await StorageService.to.clearLoginInfo();
|
await StorageService.to.clearLoginInfo();
|
||||||
Get.offAll(() => LoginPage());
|
Get.offAll(() => LoginPage());
|
||||||
return baseModel.message;
|
return baseModel.message;
|
||||||
} else {
|
|
||||||
return baseModel.message;
|
|
||||||
}
|
}
|
||||||
} on Exception catch (e) {
|
} on Exception catch (e) {
|
||||||
e.printInfo();
|
e.printInfo();
|
||||||
|
|||||||
@@ -7,9 +7,10 @@ import 'package:ln_jq_app/common/styles/theme.dart';
|
|||||||
import 'package:ln_jq_app/storage_service.dart';
|
import 'package:ln_jq_app/storage_service.dart';
|
||||||
|
|
||||||
enum ReservationStatus {
|
enum ReservationStatus {
|
||||||
pending, // 待处理 ( addStatus: 1)
|
pending, // 待处理 ( addStatus: 0)
|
||||||
completed, // 已完成 ( addStatus: 2)
|
completed, // 完成 ( addStatus: 1)
|
||||||
rejected, // 已拒绝 ( 3)
|
rejected, // 拒绝 ( -1)
|
||||||
|
unadded, // 未加 ( 2)
|
||||||
unknown, // 未知状态
|
unknown, // 未知状态
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,6 +34,7 @@ class ReservationModel {
|
|||||||
final String stateName;
|
final String stateName;
|
||||||
final String addStatus;
|
final String addStatus;
|
||||||
final String addStatusName;
|
final String addStatusName;
|
||||||
|
bool hasEdit;
|
||||||
|
|
||||||
ReservationModel({
|
ReservationModel({
|
||||||
required this.id,
|
required this.id,
|
||||||
@@ -41,6 +43,7 @@ class ReservationModel {
|
|||||||
required this.time,
|
required this.time,
|
||||||
required this.contactPerson,
|
required this.contactPerson,
|
||||||
required this.contactPhone,
|
required this.contactPhone,
|
||||||
|
required this.hasEdit,
|
||||||
this.status = ReservationStatus.pending,
|
this.status = ReservationStatus.pending,
|
||||||
required this.contacts,
|
required this.contacts,
|
||||||
required this.phone,
|
required this.phone,
|
||||||
@@ -57,9 +60,13 @@ class ReservationModel {
|
|||||||
|
|
||||||
/// 工厂构造函数,用于从JSON创建ReservationModel实例
|
/// 工厂构造函数,用于从JSON创建ReservationModel实例
|
||||||
factory ReservationModel.fromJson(Map<String, dynamic> json) {
|
factory ReservationModel.fromJson(Map<String, dynamic> json) {
|
||||||
//1完成 0待处理 2已拒绝
|
// 1完成 2未加 -1拒绝 0是待加氢
|
||||||
ReservationStatus currentStatus;
|
ReservationStatus currentStatus;
|
||||||
int statusFromServer = json['addStatus'] as int? ?? 0;
|
int statusFromServer = json['addStatus'] as int? ?? 0;
|
||||||
|
int state = json['state'] as int? ?? 0;
|
||||||
|
if (state == -1) {
|
||||||
|
currentStatus = ReservationStatus.rejected;
|
||||||
|
} else {
|
||||||
switch (statusFromServer) {
|
switch (statusFromServer) {
|
||||||
case 0:
|
case 0:
|
||||||
currentStatus = ReservationStatus.pending;
|
currentStatus = ReservationStatus.pending;
|
||||||
@@ -68,11 +75,12 @@ class ReservationModel {
|
|||||||
currentStatus = ReservationStatus.completed;
|
currentStatus = ReservationStatus.completed;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
currentStatus = ReservationStatus.rejected;
|
currentStatus = ReservationStatus.unadded;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
currentStatus = ReservationStatus.unknown;
|
currentStatus = ReservationStatus.unknown;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 格式化时间显示
|
// 格式化时间显示
|
||||||
String startTimeStr = json['startTime']?.toString() ?? '';
|
String startTimeStr = json['startTime']?.toString() ?? '';
|
||||||
@@ -105,6 +113,7 @@ class ReservationModel {
|
|||||||
addStatus: statusFromServer.toString(),
|
addStatus: statusFromServer.toString(),
|
||||||
addStatusName: json['addStatusName']?.toString() ?? '',
|
addStatusName: json['addStatusName']?.toString() ?? '',
|
||||||
stateName: json['stateName']?.toString() ?? '',
|
stateName: json['stateName']?.toString() ?? '',
|
||||||
|
hasEdit: true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -189,7 +198,7 @@ class SiteController extends GetxController with BaseControllerMixin {
|
|||||||
// 【核心修改】处理接口返回的列表数据
|
// 【核心修改】处理接口返回的列表数据
|
||||||
final dataMap = baseModel.data as Map<String, dynamic>;
|
final dataMap = baseModel.data as Map<String, dynamic>;
|
||||||
|
|
||||||
final List<dynamic> listFromServer = dataMap['list'] ?? [];
|
final List<dynamic> listFromServer = dataMap['records'] ?? [];
|
||||||
|
|
||||||
// 使用 .map() 遍历列表,将每个 item 转换为一个 ReservationModel 对象
|
// 使用 .map() 遍历列表,将每个 item 转换为一个 ReservationModel 对象
|
||||||
reservationList = listFromServer.map((item) {
|
reservationList = listFromServer.map((item) {
|
||||||
@@ -553,8 +562,8 @@ class SiteController extends GetxController with BaseControllerMixin {
|
|||||||
orderAmount = result.data["orderAmount"].toString();
|
orderAmount = result.data["orderAmount"].toString();
|
||||||
completedAmount = result.data["completedAmount"].toString();
|
completedAmount = result.data["completedAmount"].toString();
|
||||||
name = result.data["name"].toString();
|
name = result.data["name"].toString();
|
||||||
orderTotalAmount = result.data["orderTotalAmount"] ?? "";
|
orderTotalAmount = result.data["orderTotalAmount"].toString() ?? "";
|
||||||
orderUnfinishedAmount = result.data["orderUnfinishedAmount"] ?? "";
|
orderUnfinishedAmount = result.data["orderUnfinishedAmount"].toString() ?? "";
|
||||||
|
|
||||||
leftHydrogen = leftHydrogen.isEmpty ? "统计中" : leftHydrogen.toString();
|
leftHydrogen = leftHydrogen.isEmpty ? "统计中" : leftHydrogen.toString();
|
||||||
orderTotalAmount = orderTotalAmount.isEmpty ? "统计中" : orderTotalAmount.toString();
|
orderTotalAmount = orderTotalAmount.isEmpty ? "统计中" : orderTotalAmount.toString();
|
||||||
|
|||||||
@@ -433,15 +433,19 @@ class SitePage extends GetView<SiteController> {
|
|||||||
Color color;
|
Color color;
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case ReservationStatus.pending:
|
case ReservationStatus.pending:
|
||||||
text = '待处理';
|
text = '待加氢';
|
||||||
color = Colors.orange;
|
color = Colors.orange;
|
||||||
break;
|
break;
|
||||||
case ReservationStatus.completed:
|
case ReservationStatus.completed:
|
||||||
text = '已完成';
|
text = '已加氢';
|
||||||
color = Colors.greenAccent;
|
color = Colors.greenAccent;
|
||||||
break;
|
break;
|
||||||
case ReservationStatus.rejected:
|
case ReservationStatus.rejected:
|
||||||
text = '已拒绝';
|
text = '拒绝加氢';
|
||||||
|
color = Colors.red;
|
||||||
|
break;
|
||||||
|
case ReservationStatus.unadded:
|
||||||
|
text = '未加氢';
|
||||||
color = Colors.red;
|
color = Colors.red;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -79,6 +79,16 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
void pickDate(BuildContext context) {
|
void pickDate(BuildContext context) {
|
||||||
DateTime tempDate = selectedDate.value;
|
DateTime tempDate = selectedDate.value;
|
||||||
|
|
||||||
|
// 获取今天的日期 (不含时间)
|
||||||
|
final DateTime today = DateTime(
|
||||||
|
DateTime.now().year,
|
||||||
|
DateTime.now().month,
|
||||||
|
DateTime.now().day,
|
||||||
|
);
|
||||||
|
|
||||||
|
//计算明天的日期
|
||||||
|
final DateTime tomorrow = today.add(const Duration(days: 1));
|
||||||
|
|
||||||
Get.bottomSheet(
|
Get.bottomSheet(
|
||||||
Container(
|
Container(
|
||||||
height: 300,
|
height: 300,
|
||||||
@@ -106,8 +116,17 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
),
|
),
|
||||||
CupertinoButton(
|
CupertinoButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
final bool isChangingToToday = tempDate.isAtSameMomentAs(today) && !selectedDate.value.isAtSameMomentAs(today);
|
||||||
|
final bool isDateChanged = !tempDate.isAtSameMomentAs(selectedDate.value);
|
||||||
|
|
||||||
|
// 更新选中的日期
|
||||||
selectedDate.value = tempDate;
|
selectedDate.value = tempDate;
|
||||||
Get.back();
|
Get.back(); // 先关闭弹窗
|
||||||
|
|
||||||
|
// 如果日期发生了变化,则重置时间
|
||||||
|
if (isDateChanged) {
|
||||||
|
resetTimeForSelectedDate();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: const Text(
|
child: const Text(
|
||||||
'确认',
|
'确认',
|
||||||
@@ -125,12 +144,9 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
child: CupertinoDatePicker(
|
child: CupertinoDatePicker(
|
||||||
mode: CupertinoDatePickerMode.date,
|
mode: CupertinoDatePickerMode.date,
|
||||||
initialDateTime: selectedDate.value,
|
initialDateTime: selectedDate.value,
|
||||||
minimumDate: DateTime(
|
minimumDate: today, // 最小可选日期为今天
|
||||||
DateTime.now().year,
|
maximumDate: tomorrow, // 最大可选日期为明天
|
||||||
DateTime.now().month,
|
// ---------------------
|
||||||
DateTime.now().day,
|
|
||||||
),
|
|
||||||
maximumDate: DateTime.now().add(const Duration(days: 365)),
|
|
||||||
onDateTimeChanged: (DateTime newDate) {
|
onDateTimeChanged: (DateTime newDate) {
|
||||||
tempDate = newDate;
|
tempDate = newDate;
|
||||||
},
|
},
|
||||||
@@ -143,6 +159,24 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void resetTimeForSelectedDate() {
|
||||||
|
final now = DateTime.now();
|
||||||
|
final today = DateTime(now.year, now.month, now.day);
|
||||||
|
|
||||||
|
// 判断新选择的日期是不是今天
|
||||||
|
if (selectedDate.value.isAtSameMomentAs(today)) {
|
||||||
|
// 如果是今天,就将时间重置为当前时间所在的半小时区间
|
||||||
|
startTime.value = _calculateInitialStartTime(now);
|
||||||
|
endTime.value = TimeOfDay.fromDateTime(
|
||||||
|
_getDateTimeFromTimeOfDay(startTime.value).add(const Duration(minutes: 30)),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// 如果是明天(或其他未来日期),则可以将时间重置为一天的最早可用时间,例如 00:00
|
||||||
|
startTime.value = const TimeOfDay(hour: 0, minute: 0);
|
||||||
|
endTime.value = const TimeOfDay(hour: 0, minute: 30);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///30 分钟为间隔 时间选择器
|
///30 分钟为间隔 时间选择器
|
||||||
void pickTime(BuildContext context) {
|
void pickTime(BuildContext context) {
|
||||||
final now = DateTime.now();
|
final now = DateTime.now();
|
||||||
@@ -386,6 +420,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
stateName: '',
|
stateName: '',
|
||||||
addStatus: '',
|
addStatus: '',
|
||||||
addStatusName: '',
|
addStatusName: '',
|
||||||
|
hasEdit: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
//打开预约列表
|
//打开预约列表
|
||||||
@@ -393,7 +428,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
getReservationList();
|
getReservationList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
showErrorToast(result.message);
|
showToast(result.error);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
dismissLoading();
|
dismissLoading();
|
||||||
@@ -432,13 +467,30 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
|
|
||||||
if (baseModel.code == 0 && baseModel.data != null) {
|
if (baseModel.code == 0 && baseModel.data != null) {
|
||||||
final dataMap = baseModel.data as Map<String, dynamic>;
|
final dataMap = baseModel.data as Map<String, dynamic>;
|
||||||
final List<dynamic> listFromServer = dataMap['list'] ?? [];
|
final List<dynamic> listFromServer = dataMap['records'] ?? [];
|
||||||
reservationList = listFromServer.map((item) {
|
reservationList = listFromServer.map((item) {
|
||||||
return ReservationModel.fromJson(item as Map<String, dynamic>);
|
return ReservationModel.fromJson(item as Map<String, dynamic>);
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
||||||
// 根据列表是否为空来更新 hasReservationData 状态
|
// 根据列表是否为空来更新 hasReservationData 状态
|
||||||
hasReservationData = reservationList.isNotEmpty;
|
hasReservationData = reservationList.isNotEmpty;
|
||||||
|
|
||||||
|
for (var reservation in reservationList) {
|
||||||
|
try {
|
||||||
|
// 获取当前时间和预约的结束时间
|
||||||
|
final now = DateTime.now();
|
||||||
|
final endDateTime = DateTime.parse(reservation.endTime);
|
||||||
|
|
||||||
|
// 如果当前时间在结束时间之后,则不能编辑
|
||||||
|
if (now.isAfter(endDateTime)) {
|
||||||
|
reservation.hasEdit = false;
|
||||||
|
} else {
|
||||||
|
reservation.hasEdit = true;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
reservation.hasEdit = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
showToast(baseModel.message);
|
showToast(baseModel.message);
|
||||||
hasReservationData = false;
|
hasReservationData = false;
|
||||||
@@ -544,7 +596,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
plateNumber.isEmpty
|
!reservation.hasEdit
|
||||||
? SizedBox()
|
? SizedBox()
|
||||||
: GestureDetector(
|
: GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
|
|||||||
Reference in New Issue
Block a user