diff --git a/ln_jq_app/lib/common/model/station_model.dart b/ln_jq_app/lib/common/model/station_model.dart index fb7280f..1292f07 100644 --- a/ln_jq_app/lib/common/model/station_model.dart +++ b/ln_jq_app/lib/common/model/station_model.dart @@ -4,6 +4,7 @@ class StationModel { final String address; final String price; final String siteStatusName; // 例如 "维修中" + final int isSelect; // 新增字段 1是可用 0是不可用 StationModel({ required this.hydrogenId, @@ -11,6 +12,7 @@ class StationModel { required this.address, required this.price, required this.siteStatusName, + required this.isSelect, }); // 从 JSON map 创建对象的工厂构造函数 @@ -21,6 +23,7 @@ class StationModel { address: json['address'] ?? '地址未知', price: json['price']?.toString() ?? '0.00', siteStatusName: json['siteStatusName'] ?? '', + isSelect: json['isSelect'] as int? ?? 0, // 新增字段的解析,默认为 0 ); } } diff --git a/ln_jq_app/lib/pages/c_page/reservation/controller.dart b/ln_jq_app/lib/pages/c_page/reservation/controller.dart index ac5e510..650ff3b 100644 --- a/ln_jq_app/lib/pages/c_page/reservation/controller.dart +++ b/ln_jq_app/lib/pages/c_page/reservation/controller.dart @@ -533,7 +533,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin { ), // Blue border ), child: Text( - reservation.stateName, + reservation.stateName+"-"+reservation.addStatusName, style: const TextStyle( color: Color(0xFF1890FF), fontWeight: FontWeight.bold, @@ -552,11 +552,11 @@ class C_ReservationController extends GetxController with BaseControllerMixin { borderRadius: BorderRadius.circular(12), ), child: Text( - reservation.addStatusName, + "修改", style: const TextStyle( color: Color(0xFFFA8C16), fontWeight: FontWeight.bold, - fontSize: 12, + fontSize: 14, ), ), ), diff --git a/ln_jq_app/lib/pages/c_page/reservation/view.dart b/ln_jq_app/lib/pages/c_page/reservation/view.dart index c3842d4..787617a 100644 --- a/ln_jq_app/lib/pages/c_page/reservation/view.dart +++ b/ln_jq_app/lib/pages/c_page/reservation/view.dart @@ -432,6 +432,7 @@ class ReservationPage extends GetView { .map( (station) => DropdownMenuItem( value: station.hydrogenId, // value 是站点的唯一ID + enabled: station.isSelect == 1, child: _buildDropdownItem(station), // child 是自定义的 Widget ), ) @@ -478,7 +479,10 @@ class ReservationPage extends GetView { /// 构建下拉菜单中的每一项 Widget _buildDropdownItem(StationModel station) { - bool isMaintenance = (station.siteStatusName != '营运中'); + bool isSelectable = (station.isSelect == 1); + //营运并且可用 + bool isMaintenance = ((station.siteStatusName != '营运中') && isSelectable); + final textColor = isSelectable ? Colors.black : Colors.grey; return Padding( padding: const EdgeInsets.symmetric(vertical: 8.0), child: Row( @@ -495,14 +499,22 @@ class ReservationPage extends GetView { Flexible( child: Text( station.name, - style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500), + style: TextStyle( + color: textColor, + fontSize: 14, + fontWeight: FontWeight.w500, + ), overflow: TextOverflow.ellipsis, maxLines: 1, ), ), Text( ' | ¥${station.price}/kg', - style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500), + style: TextStyle( + color: textColor, + fontSize: 14, + fontWeight: FontWeight.w500, + ), ), if (isMaintenance) const SizedBox(width: 8), if (isMaintenance)