优化
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 = "";
|
String selectedOperationStatus = "营运中";
|
||||||
|
|
||||||
ReservationController() {
|
|
||||||
selectedOperationStatus = operationStatusOptions[0]; // 初始化选中值
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@@ -68,7 +64,8 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
startBusiness = result.data["startBusiness"];
|
startBusiness = result.data["startBusiness"];
|
||||||
endBusiness = result.data["endBusiness"];
|
endBusiness = result.data["endBusiness"];
|
||||||
operatingEnterprise = result.data["operatingEnterprise"].toString();
|
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) {
|
if (startBusiness.isNotEmpty && endBusiness.isNotEmpty) {
|
||||||
// 营业时间为24小时的特殊处理
|
// 营业时间为24小时的特殊处理
|
||||||
|
|||||||
@@ -131,7 +131,10 @@ class ReservationPage extends GetView<ReservationController> {
|
|||||||
DropdownButtonFormField<String>(
|
DropdownButtonFormField<String>(
|
||||||
value: controller.selectedOperationStatus,
|
value: controller.selectedOperationStatus,
|
||||||
items: controller.operationStatusOptions.map((String value) {
|
items: controller.operationStatusOptions.map((String value) {
|
||||||
return DropdownMenuItem<String>(value: value, child: Text(value));
|
return DropdownMenuItem<String>(
|
||||||
|
value: value,
|
||||||
|
child: Text(value),
|
||||||
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
onChanged: controller.onOperationStatusChanged,
|
onChanged: controller.onOperationStatusChanged,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
|
|||||||
@@ -177,6 +177,7 @@ class CarInfoPage extends GetView<CarInfoController> {
|
|||||||
var scanResult = await Get.to(() => const QrCodePage());
|
var scanResult = await Get.to(() => const QrCodePage());
|
||||||
if (scanResult == true) {
|
if (scanResult == true) {
|
||||||
controller.getUserBindCarInfo();
|
controller.getUserBindCarInfo();
|
||||||
|
refreshAppui();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
@@ -233,13 +234,13 @@ class CarInfoPage extends GetView<CarInfoController> {
|
|||||||
const Divider(),
|
const Divider(),
|
||||||
_buildCertificateRow(
|
_buildCertificateRow(
|
||||||
icon: Icons.article_rounded,
|
icon: Icons.article_rounded,
|
||||||
title: '运营证',
|
title: '营运证',
|
||||||
attachments: controller.operationAttachments,
|
attachments: controller.operationAttachments,
|
||||||
),
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
_buildCertificateRow(
|
_buildCertificateRow(
|
||||||
icon: Icons.propane_tank_rounded,
|
icon: Icons.propane_tank_rounded,
|
||||||
title: '氢瓶证',
|
title: '加氢证',
|
||||||
attachments: controller.hydrogenationAttachments,
|
attachments: controller.hydrogenationAttachments,
|
||||||
),
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
|
|||||||
@@ -561,8 +561,6 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String phone = "";
|
|
||||||
String name = "";
|
|
||||||
String leftHydrogen = "0";
|
String leftHydrogen = "0";
|
||||||
String workEfficiency = "0";
|
String workEfficiency = "0";
|
||||||
String fillingWeight = "0";
|
String fillingWeight = "0";
|
||||||
@@ -570,13 +568,14 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
String plateNumber = "";
|
String plateNumber = "";
|
||||||
String vin = "";
|
String vin = "";
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get listenLifecycleEvent => true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
phone = StorageService.to.phone ?? "";
|
super.onInit();
|
||||||
name = StorageService.to.name ?? "";
|
|
||||||
getUserBindCarInfo();
|
getUserBindCarInfo();
|
||||||
getSiteList();
|
getSiteList();
|
||||||
super.onInit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void getUserBindCarInfo() {
|
void getUserBindCarInfo() {
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ class ReservationPage extends GetView<C_ReservationController> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Get.put(C_ReservationController());
|
|
||||||
return GetBuilder<C_ReservationController>(
|
return GetBuilder<C_ReservationController>(
|
||||||
|
init: C_ReservationController(),
|
||||||
id: 'reservation',
|
id: 'reservation',
|
||||||
builder: (_) {
|
builder: (_) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@@ -99,12 +99,12 @@ class ReservationPage extends GetView<C_ReservationController> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
controller.name,
|
"${StorageService.to.name}",
|
||||||
style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
|
style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
SizedBox(height: 6),
|
SizedBox(height: 6),
|
||||||
Text(
|
Text(
|
||||||
controller.phone,
|
"${StorageService.to.phone}",
|
||||||
style: TextStyle(color: Colors.grey, fontSize: 11),
|
style: TextStyle(color: Colors.grey, fontSize: 11),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -204,6 +204,7 @@ class ReservationPage extends GetView<C_ReservationController> {
|
|||||||
var scanResult = await Get.to(() => const QrCodePage());
|
var scanResult = await Get.to(() => const QrCodePage());
|
||||||
if (scanResult == true) {
|
if (scanResult == true) {
|
||||||
controller.getUserBindCarInfo();
|
controller.getUserBindCarInfo();
|
||||||
|
refreshAppui();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
@@ -484,7 +485,7 @@ class ReservationPage extends GetView<C_ReservationController> {
|
|||||||
|
|
||||||
/// 构建下拉菜单中的每一项
|
/// 构建下拉菜单中的每一项
|
||||||
Widget _buildDropdownItem(StationModel station) {
|
Widget _buildDropdownItem(StationModel station) {
|
||||||
bool isMaintenance = station.siteStatusName == '维修中';
|
bool isMaintenance = (station.siteStatusName != '营运中');
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -495,11 +496,20 @@ class ReservationPage extends GetView<C_ReservationController> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Flexible(
|
||||||
'${station.name} | ¥${station.price}/kg',
|
child: Text(
|
||||||
|
station.name,
|
||||||
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
|
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
|
||||||
overflow: TextOverflow.ellipsis,
|
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) const SizedBox(width: 8),
|
||||||
if (isMaintenance)
|
if (isMaintenance)
|
||||||
@@ -509,8 +519,8 @@ class ReservationPage extends GetView<C_ReservationController> {
|
|||||||
color: Colors.orange[100],
|
color: Colors.orange[100],
|
||||||
borderRadius: BorderRadius.circular(4),
|
borderRadius: BorderRadius.circular(4),
|
||||||
),
|
),
|
||||||
child: const Text(
|
child: Text(
|
||||||
'维修中',
|
station.siteStatusName,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
color: Colors.orange,
|
color: Colors.orange,
|
||||||
|
|||||||
Reference in New Issue
Block a user