司机预约 显示拒绝原因

This commit is contained in:
2025-12-11 13:27:28 +08:00
parent 20877a3eb1
commit b52659df6c
3 changed files with 20 additions and 11 deletions

View File

@@ -25,6 +25,7 @@ class ReservationModel {
final String contacts;
final String phone;
final String rejectReason;
final String stationName;
final String startTime;
final String endTime;
@@ -56,6 +57,7 @@ class ReservationModel {
required this.stateName,
required this.addStatus,
required this.addStatusName,
required this.rejectReason,
});
/// 工厂构造函数用于从JSON创建ReservationModel实例
@@ -113,6 +115,7 @@ class ReservationModel {
addStatus: statusFromServer.toString(),
addStatusName: json['addStatusName']?.toString() ?? '',
stateName: json['stateName']?.toString() ?? '',
rejectReason: json['rejectReason']?.toString() ?? '',
hasEdit: true,
);
}
@@ -137,7 +140,8 @@ class SiteController extends GetxController with BaseControllerMixin {
void onInit() {
super.onInit();
renderData();
//加载列表数据
fetchReservationData();
startAutoRefresh();
}
@@ -530,8 +534,7 @@ class SiteController extends GetxController with BaseControllerMixin {
} else if (addStatus == 2) {
item.status = ReservationStatus.unadded;
}
updateUi();
renderData();
} catch (e) {
dismissLoading();
}
@@ -570,12 +573,12 @@ class SiteController extends GetxController with BaseControllerMixin {
orderUnfinishedAmount = orderUnfinishedAmount.isEmpty
? "统计中"
: orderUnfinishedAmount.toString();
//加载列表数据
fetchReservationData();
} catch (e) {
showToast('数据异常');
}
} catch (e) {}
} catch (e) {
} finally {
updateUi();
}
}
}

View File

@@ -428,6 +428,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
stateName: '',
addStatus: '',
addStatusName: '',
rejectReason: '',
hasEdit: true,
);
@@ -498,7 +499,9 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
final endDateTime = DateTime.parse(reservation.endTime);
// 如果当前时间在结束时间之后,则不能编辑
if (now.isAfter(endDateTime)) {
if (now.isAfter(endDateTime) ||
plateNumber.isEmpty ||
reservation.addStatus != "0") {
reservation.hasEdit = false;
} else {
reservation.hasEdit = true;
@@ -612,7 +615,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
),
),
),
!reservation.hasEdit || plateNumber.isEmpty
!reservation.hasEdit
? SizedBox()
: GestureDetector(
onTap: () async {
@@ -664,6 +667,9 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
_buildDetailRow('结束时间:', reservation.endTime),
_buildDetailRow('联系人:', reservation.contacts),
_buildDetailRow('联系电话:', reservation.phone),
reservation.addStatus == "5"
? _buildDetailRow('拒绝原因:', reservation.rejectReason)
: SizedBox(),
],
),
),

View File

@@ -233,7 +233,7 @@ class ReservationEditController extends GetxController with BaseControllerMixin
//弹窗刷新数据
Get.back(result: true);
} else {
showErrorToast(result.message);
showToast(result.error);
}
} catch (e) {
showErrorToast("保存失败,请稍后再试");