This commit is contained in:
2026-01-15 09:30:47 +08:00
parent d1b7a9eb76
commit d8f335eb4e
7 changed files with 120 additions and 25 deletions

View File

@@ -65,11 +65,14 @@ class ReservationController extends GetxController with BaseControllerMixin {
if (jobData != null) {
final jobDataResult = BaseModel.fromJson(jobData.data);
if (jobDataResult.code == 0) {
try{
jobId = jobDataResult.data["id"] ?? "";
String endTime = jobDataResult.data["endTime"] ?? "";
String beginTime = jobDataResult.data["beginTime"] ?? "";
String hydStatus = jobDataResult.data["hydStatus"] ?? "";
try {
final List<dynamic> dataList = jobDataResult.data is List ? jobDataResult.data : [];
final firstJob = dataList[0];
jobId = firstJob["id"] ?? "";
String endTime = firstJob["endTime"] ?? "";
String beginTime = firstJob["beginTime"] ?? "";
String hydStatus = firstJob["hydStatus"].toString() ?? "";
String hydStatusStr = "";
if (hydStatus == "0") {
hydStatusStr = "营运中";
@@ -97,7 +100,7 @@ class ReservationController extends GetxController with BaseControllerMixin {
if (hoursLeft > 0) {
// 如果是正数,表示还有多久结束
String timeTip = "${hoursLeft.toStringAsFixed(1)}小时后";
String timeTip = " ${hoursLeft.toStringAsFixed(1)}小时后";
jobTipStr = "$timeTip$hydStatusStr";
} else {
jobTipStr = "";
@@ -111,8 +114,10 @@ class ReservationController extends GetxController with BaseControllerMixin {
print("时间解析失败: $e");
}
}
}catch (e){
Logger.d("解析失败: $e");
} catch (e) {
Logger.d("解析失败或者没返回信息: $e");
jobTipStr = "";
}
}
}
@@ -282,6 +287,7 @@ class ReservationController extends GetxController with BaseControllerMixin {
'appointment/station/updateStationStatus',
data: {
'hydrogenId': hydrogenId,
'name': name,
'siteStatus': selectedOperationStatus == "营运中"
? "0"
: selectedOperationStatus == "维修中"
@@ -309,6 +315,9 @@ class ReservationController extends GetxController with BaseControllerMixin {
var result = BaseModel.fromJson(responseData.data);
if (result.code == 0) {
showSuccessToast("保存成功,已同步通知对应司机");
//重新刷新页面
renderData();
}
dismissLoading();
} catch (e) {
@@ -325,10 +334,7 @@ class ReservationController extends GetxController with BaseControllerMixin {
DialogX.to.showConfirmDialog(
title: '当前设置详情',
content: Text(
jobDetailsStr,
style: const TextStyle(fontSize: 15, height: 1.5),
),
content: Text(jobDetailsStr, style: const TextStyle(fontSize: 15, height: 1.5)),
confirmText: '好的',
cancelText: '取消设置',
onCancel: () {
@@ -342,9 +348,7 @@ class ReservationController extends GetxController with BaseControllerMixin {
void _cancelJob() async {
showLoading("正在取消...");
try {
var response = await HttpService.to.delete(
'appointment/job/hyd/$jobId',
);
var response = await HttpService.to.delete('appointment/job/hyd/$jobId');
dismissLoading();
if (response != null) {

View File

@@ -197,6 +197,7 @@ class ReservationPage extends GetView<ReservationController> {
controller.jobTipStr,
style: TextStyle(color: Colors.yellow[800], fontSize: 14),
),
SizedBox(width: 2.w),
Icon(AntdIcon.question_circle, size: 14, color: Colors.yellow[800]),
],
),

View File

@@ -57,7 +57,7 @@ class MineController extends GetxController with BaseControllerMixin {
_fetchAccidentCount(), // 请求2事故数
_fetchBreakRulesCount(), // 请求3违章数
_rating(), // 司机评分
_msgNotice(), // 红点消息
msgNotice(), // 红点消息
]);
await renderViolation();
@@ -69,7 +69,7 @@ class MineController extends GetxController with BaseControllerMixin {
}
}
Future<void> _msgNotice() async {
Future<void> msgNotice() async {
final Map<String, dynamic> requestData = {
'appFlag': 1,
'isRead': 1,

View File

@@ -82,9 +82,12 @@ class MinePage extends GetView<MineController> {
),
),
IconButton(
onPressed: () {
onPressed: () async {
// 跳转消息中心
Get.to(() => const MessagePage());
var scanResult = await Get.to(() => const MessagePage());
if (scanResult == null) {
controller.msgNotice();
}
},
// 这里的 style 是为了模拟你图片里的灰色圆形背景
style: IconButton.styleFrom(

View File

@@ -341,12 +341,12 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
final startTimeStr =
'$dateStr ${_formatTimeOfDay(startTime.value)}:00'; // Use helper directly
if (lastSuccessfulReservation != null &&
/*if (lastSuccessfulReservation != null &&
lastSuccessfulReservation!.id == selectedStationId.value &&
lastSuccessfulReservation!.startTime == startTimeStr) {
showToast("请勿重复提交相同时间段的预约,可在“查看预约”中修改");
return;
}
}*/
final reservationEndDateTime = DateTime(
selectedDate.value.year,