修改绑定车辆接口

登录后查询车辆信息
This commit is contained in:
2025-12-17 09:18:34 +08:00
parent 98cac8a0a5
commit fe2ce75cec
4 changed files with 95 additions and 33 deletions

View File

@@ -447,9 +447,11 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
/// 状态变量:是否有预约数据
final RxBool hasReservationData = false.obs;
// 新增预约数据列表
final RxList<ReservationModel> reservationList = <ReservationModel>[].obs;
final RxBool shouldShowReservationList = false.obs;
// --- 用于防抖的 Timer ---
Timer? _debounce;
@@ -464,7 +466,6 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
showLoading("加载中");
try {
final Map<String, dynamic> requestData = {
'phone': StorageService.to.phone,
'pageNum': 1,
@@ -523,7 +524,6 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
if (showPopup) {
shouldShowReservationList.value = true;
}
} else {
showToast(baseModel.message);
hasReservationData.value = false;
@@ -538,7 +538,6 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
}
}
String workEfficiency = "0";
String fillingWeight = "0";
String fillingTimes = "0";
@@ -637,14 +636,16 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
}
void getSiteList() async {
if(StorageService.to.phone == "13344444444"){
if (StorageService.to.phone == "13344444444") {
//该账号给stationOptions手动添加一个数据
final testStation = StationModel(
hydrogenId: '1142167389150920704',
name: '羚牛氢能演示加氢站',
address: '上海市嘉定区于田南路111号于田大厦',
price: '35.00', // 价格
siteStatusName: '营运中', // 状态
price: '35.00',
// 价格
siteStatusName: '营运中',
// 状态
isSelect: 1, // 默认可选
);
// 使用 assignAll 可以确保列表只包含这个测试数据
@@ -700,7 +701,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
// 找到第一个可选的站点作为默认值
if (stationOptions.isNotEmpty) {
final firstSelectable = stationOptions.firstWhere(
(station) => station.isSelect == 1,
(station) => station.isSelect == 1,
orElse: () => stationOptions.first, // 降级:如果没有可选的,就用第一个
);
selectedStationId.value = firstSelectable.hydrogenId;
@@ -708,7 +709,6 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
// 如果列表为空,确保 selectedStationId 也为空
selectedStationId.value = null;
}
} catch (e) {
showToast('数据异常');
}
@@ -719,7 +719,9 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
HttpService.to.dio.options.headers = originalHeaders;
// 如果未绑定车辆,且本次会话尚未提示过,则弹出提示
if (!StorageService.to.hasShownBindVehicleDialog && StorageService.to.isLoggedIn) {
if (!StorageService.to.hasShownBindVehicleDialog &&
StorageService.to.isLoggedIn &&
!StorageService.to.hasVehicleInfo) {
Future.delayed(const Duration(milliseconds: 500), () {
DialogX.to.showConfirmDialog(
title: '当前尚未绑定车辆',