From 797afb63b18880a572bef0720c393a6413a8d123 Mon Sep 17 00:00:00 2001 From: userGyl Date: Wed, 19 Nov 2025 15:54:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/b_page/reservation/controller.dart | 11 +++----- .../lib/pages/b_page/reservation/view.dart | 5 +++- ln_jq_app/lib/pages/c_page/car_info/view.dart | 5 ++-- .../pages/c_page/reservation/controller.dart | 9 +++---- .../lib/pages/c_page/reservation/view.dart | 26 +++++++++++++------ 5 files changed, 33 insertions(+), 23 deletions(-) diff --git a/ln_jq_app/lib/pages/b_page/reservation/controller.dart b/ln_jq_app/lib/pages/b_page/reservation/controller.dart index 3339dab..aefb0f8 100644 --- a/ln_jq_app/lib/pages/b_page/reservation/controller.dart +++ b/ln_jq_app/lib/pages/b_page/reservation/controller.dart @@ -11,14 +11,10 @@ class ReservationController extends GetxController with BaseControllerMixin { // --- 运营状态下拉菜单所需的状态 --- // 下拉菜单的选项列表 - final List operationStatusOptions = ['营运中', '维修中', '暂停营业', '站点关闭']; + final List operationStatusOptions = ["营运中", "维修中", "暂停营业", "站点关闭"]; // 当前选中的值,默认为'运营中' - String selectedOperationStatus = ""; - - ReservationController() { - selectedOperationStatus = operationStatusOptions[0]; // 初始化选中值 - } + String selectedOperationStatus = "营运中"; @override void onInit() { @@ -68,7 +64,8 @@ class ReservationController extends GetxController with BaseControllerMixin { startBusiness = result.data["startBusiness"]; endBusiness = result.data["endBusiness"]; operatingEnterprise = result.data["operatingEnterprise"].toString(); - selectedOperationStatus = result.data["siteStatusName"].toString(); + String temp = result.data["siteStatusName"].toString(); + selectedOperationStatus = (temp.isEmpty || temp == "null") ? "营运中" : temp; if (startBusiness.isNotEmpty && endBusiness.isNotEmpty) { // 营业时间为24小时的特殊处理 diff --git a/ln_jq_app/lib/pages/b_page/reservation/view.dart b/ln_jq_app/lib/pages/b_page/reservation/view.dart index 2550255..78b7fe7 100644 --- a/ln_jq_app/lib/pages/b_page/reservation/view.dart +++ b/ln_jq_app/lib/pages/b_page/reservation/view.dart @@ -131,7 +131,10 @@ class ReservationPage extends GetView { DropdownButtonFormField( value: controller.selectedOperationStatus, items: controller.operationStatusOptions.map((String value) { - return DropdownMenuItem(value: value, child: Text(value)); + return DropdownMenuItem( + value: value, + child: Text(value), + ); }).toList(), onChanged: controller.onOperationStatusChanged, decoration: InputDecoration( diff --git a/ln_jq_app/lib/pages/c_page/car_info/view.dart b/ln_jq_app/lib/pages/c_page/car_info/view.dart index 4dcdf57..35ab41e 100644 --- a/ln_jq_app/lib/pages/c_page/car_info/view.dart +++ b/ln_jq_app/lib/pages/c_page/car_info/view.dart @@ -177,6 +177,7 @@ class CarInfoPage extends GetView { var scanResult = await Get.to(() => const QrCodePage()); if (scanResult == true) { controller.getUserBindCarInfo(); + refreshAppui(); } }, child: Container( @@ -233,13 +234,13 @@ class CarInfoPage extends GetView { const Divider(), _buildCertificateRow( icon: Icons.article_rounded, - title: '运营证', + title: '营运证', attachments: controller.operationAttachments, ), const Divider(), _buildCertificateRow( icon: Icons.propane_tank_rounded, - title: '氢瓶证', + title: '加氢证', attachments: controller.hydrogenationAttachments, ), const Divider(), 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 eafebaf..bedeb8a 100644 --- a/ln_jq_app/lib/pages/c_page/reservation/controller.dart +++ b/ln_jq_app/lib/pages/c_page/reservation/controller.dart @@ -561,8 +561,6 @@ class C_ReservationController extends GetxController with BaseControllerMixin { ); } - String phone = ""; - String name = ""; String leftHydrogen = "0"; String workEfficiency = "0"; String fillingWeight = "0"; @@ -570,13 +568,14 @@ class C_ReservationController extends GetxController with BaseControllerMixin { String plateNumber = ""; String vin = ""; + @override + bool get listenLifecycleEvent => true; + @override void onInit() { - phone = StorageService.to.phone ?? ""; - name = StorageService.to.name ?? ""; + super.onInit(); getUserBindCarInfo(); getSiteList(); - super.onInit(); } void getUserBindCarInfo() { 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 c8bf5be..152aec3 100644 --- a/ln_jq_app/lib/pages/c_page/reservation/view.dart +++ b/ln_jq_app/lib/pages/c_page/reservation/view.dart @@ -13,8 +13,8 @@ class ReservationPage extends GetView { @override Widget build(BuildContext context) { - Get.put(C_ReservationController()); return GetBuilder( + init: C_ReservationController(), id: 'reservation', builder: (_) { return Scaffold( @@ -99,12 +99,12 @@ class ReservationPage extends GetView { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - controller.name, + "${StorageService.to.name}", style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold), ), SizedBox(height: 6), Text( - controller.phone, + "${StorageService.to.phone}", style: TextStyle(color: Colors.grey, fontSize: 11), ), ], @@ -204,6 +204,7 @@ class ReservationPage extends GetView { var scanResult = await Get.to(() => const QrCodePage()); if (scanResult == true) { controller.getUserBindCarInfo(); + refreshAppui(); } }, child: Container( @@ -484,7 +485,7 @@ class ReservationPage extends GetView { /// 构建下拉菜单中的每一项 Widget _buildDropdownItem(StationModel station) { - bool isMaintenance = station.siteStatusName == '维修中'; + bool isMaintenance = (station.siteStatusName != '营运中'); return Padding( padding: const EdgeInsets.symmetric(vertical: 8.0), child: Row( @@ -495,11 +496,20 @@ class ReservationPage extends GetView { mainAxisAlignment: MainAxisAlignment.center, children: [ Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, children: [ + Flexible( + child: Text( + station.name, + style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500), + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), + ), Text( - '${station.name} | ¥${station.price}/kg', + ' | ¥${station.price}/kg', style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500), - overflow: TextOverflow.ellipsis, ), if (isMaintenance) const SizedBox(width: 8), if (isMaintenance) @@ -509,8 +519,8 @@ class ReservationPage extends GetView { color: Colors.orange[100], borderRadius: BorderRadius.circular(4), ), - child: const Text( - '维修中', + child: Text( + station.siteStatusName, style: TextStyle( fontSize: 10, color: Colors.orange,