优化
This commit is contained in:
@@ -11,14 +11,10 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
||||
|
||||
// --- 运营状态下拉菜单所需的状态 ---
|
||||
// 下拉菜单的选项列表
|
||||
final List<String> operationStatusOptions = ['营运中', '维修中', '暂停营业', '站点关闭'];
|
||||
final List<String> 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小时的特殊处理
|
||||
|
||||
@@ -131,7 +131,10 @@ class ReservationPage extends GetView<ReservationController> {
|
||||
DropdownButtonFormField<String>(
|
||||
value: controller.selectedOperationStatus,
|
||||
items: controller.operationStatusOptions.map((String value) {
|
||||
return DropdownMenuItem<String>(value: value, child: Text(value));
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: controller.onOperationStatusChanged,
|
||||
decoration: InputDecoration(
|
||||
|
||||
@@ -177,6 +177,7 @@ class CarInfoPage extends GetView<CarInfoController> {
|
||||
var scanResult = await Get.to(() => const QrCodePage());
|
||||
if (scanResult == true) {
|
||||
controller.getUserBindCarInfo();
|
||||
refreshAppui();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
@@ -233,13 +234,13 @@ class CarInfoPage extends GetView<CarInfoController> {
|
||||
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(),
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -13,8 +13,8 @@ class ReservationPage extends GetView<C_ReservationController> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(C_ReservationController());
|
||||
return GetBuilder<C_ReservationController>(
|
||||
init: C_ReservationController(),
|
||||
id: 'reservation',
|
||||
builder: (_) {
|
||||
return Scaffold(
|
||||
@@ -99,12 +99,12 @@ class ReservationPage extends GetView<C_ReservationController> {
|
||||
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<C_ReservationController> {
|
||||
var scanResult = await Get.to(() => const QrCodePage());
|
||||
if (scanResult == true) {
|
||||
controller.getUserBindCarInfo();
|
||||
refreshAppui();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
@@ -484,7 +485,7 @@ class ReservationPage extends GetView<C_ReservationController> {
|
||||
|
||||
/// 构建下拉菜单中的每一项
|
||||
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<C_ReservationController> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'${station.name} | ¥${station.price}/kg',
|
||||
Flexible(
|
||||
child: Text(
|
||||
station.name,
|
||||
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
' | ¥${station.price}/kg',
|
||||
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
|
||||
),
|
||||
if (isMaintenance) const SizedBox(width: 8),
|
||||
if (isMaintenance)
|
||||
@@ -509,8 +519,8 @@ class ReservationPage extends GetView<C_ReservationController> {
|
||||
color: Colors.orange[100],
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: const Text(
|
||||
'维修中',
|
||||
child: Text(
|
||||
station.siteStatusName,
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
color: Colors.orange,
|
||||
|
||||
Reference in New Issue
Block a user