站点样式
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@@ -33,6 +35,9 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
final TextEditingController broadcastContentController = TextEditingController();
|
final TextEditingController broadcastContentController = TextEditingController();
|
||||||
final RxInt selectedTabIndex = 0.obs;
|
final RxInt selectedTabIndex = 0.obs;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get listenLifecycleEvent => true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
@@ -40,6 +45,39 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
customStartTime = DateTime.now();
|
customStartTime = DateTime.now();
|
||||||
customEndTime = customStartTime!.add(const Duration(days: 1));
|
customEndTime = customStartTime!.add(const Duration(days: 1));
|
||||||
renderData();
|
renderData();
|
||||||
|
_msgNotice(); // 红点消息
|
||||||
|
startAutoRefresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onPaused() {
|
||||||
|
stopAutoRefresh();
|
||||||
|
super.onPaused();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
stopAutoRefresh();
|
||||||
|
broadcastTitleController.dispose();
|
||||||
|
broadcastContentController.dispose();
|
||||||
|
super.onClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
void startAutoRefresh() {
|
||||||
|
// 先停止已存在的定时器,防止重复启动
|
||||||
|
stopAutoRefresh();
|
||||||
|
|
||||||
|
// 创建一个每5分钟执行一次的周期性定时器
|
||||||
|
_refreshTimer = Timer.periodic(const Duration(minutes: 5), (timer) {
|
||||||
|
renderData();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
///停止定时器的方法
|
||||||
|
void stopAutoRefresh() {
|
||||||
|
// 如果定时器存在并且是激活状态,就取消它
|
||||||
|
_refreshTimer?.cancel();
|
||||||
|
_refreshTimer = null; // 置为null,方便判断
|
||||||
}
|
}
|
||||||
|
|
||||||
String name = "";
|
String name = "";
|
||||||
@@ -56,6 +94,8 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
String jobTipStr = "";
|
String jobTipStr = "";
|
||||||
String jobDetailsStr = "";
|
String jobDetailsStr = "";
|
||||||
String jobId = "";
|
String jobId = "";
|
||||||
|
Timer? _refreshTimer;
|
||||||
|
bool isNotice = false;
|
||||||
|
|
||||||
Future<void> renderData() async {
|
Future<void> renderData() async {
|
||||||
showLoading("加载中");
|
showLoading("加载中");
|
||||||
@@ -65,11 +105,16 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
if (jobData != null) {
|
if (jobData != null) {
|
||||||
final jobDataResult = BaseModel.fromJson(jobData.data);
|
final jobDataResult = BaseModel.fromJson(jobData.data);
|
||||||
if (jobDataResult.code == 0) {
|
if (jobDataResult.code == 0) {
|
||||||
try{
|
try {
|
||||||
jobId = jobDataResult.data["id"] ?? "";
|
final List<dynamic> dataList = jobDataResult.data is List
|
||||||
String endTime = jobDataResult.data["endTime"] ?? "";
|
? jobDataResult.data
|
||||||
String beginTime = jobDataResult.data["beginTime"] ?? "";
|
: [];
|
||||||
String hydStatus = jobDataResult.data["hydStatus"] ?? "";
|
final firstJob = dataList[0];
|
||||||
|
|
||||||
|
jobId = firstJob["id"] ?? "";
|
||||||
|
String endTime = firstJob["endTime"] ?? "";
|
||||||
|
String beginTime = firstJob["beginTime"] ?? "";
|
||||||
|
String hydStatus = firstJob["hydStatus"].toString() ?? "";
|
||||||
String hydStatusStr = "";
|
String hydStatusStr = "";
|
||||||
if (hydStatus == "0") {
|
if (hydStatus == "0") {
|
||||||
hydStatusStr = "营运中";
|
hydStatusStr = "营运中";
|
||||||
@@ -81,28 +126,52 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
hydStatusStr = "暂停营业";
|
hydStatusStr = "暂停营业";
|
||||||
}
|
}
|
||||||
|
|
||||||
jobDetailsStr = "当前站点已设置$beginTime-$endTime为$hydStatusStr状态";
|
//现在的时间晚于开始时间就不显示文案
|
||||||
|
bool isJobStarted = false;
|
||||||
|
try {
|
||||||
|
if (beginTime.isNotEmpty) {
|
||||||
|
DateTime beginDateTime = DateTime.parse(beginTime);
|
||||||
|
if (DateTime.now().isAfter(beginDateTime)) {
|
||||||
|
isJobStarted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print("开始时间解析失败: $e");
|
||||||
|
}
|
||||||
|
if (isJobStarted) {
|
||||||
|
jobTipStr = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
//结束时间
|
||||||
if (endTime.isNotEmpty) {
|
if (endTime.isNotEmpty) {
|
||||||
try {
|
try {
|
||||||
// 解析时间字符串
|
// 解析时间字符串
|
||||||
DateTime endDateTime = DateTime.parse(endTime);
|
DateTime endDateTime = DateTime.parse(endTime);
|
||||||
DateTime beginDateTime = DateTime.parse(beginTime);
|
DateTime beginDateTime = DateTime.parse(beginTime);
|
||||||
DateTime now = DateTime.now(); // 2. 计算时间差 (endTime - now)
|
DateTime now = DateTime.now(); //计算时间差 (endTime - now)
|
||||||
Duration diff = endDateTime.difference(now);
|
Duration diff = endDateTime.difference(now);
|
||||||
|
|
||||||
// 计算小时数 (允许小数,例如 0.5)
|
// 计算小时数 (允许小数,例如 0.5)
|
||||||
// inMinutes / 60 可以得到更精确的小数小时
|
// inMinutes / 60 可以得到更精确的小数小时
|
||||||
double hoursLeft = diff.inMinutes / 60.0;
|
double hoursLeft = diff.inMinutes / 60.0;
|
||||||
|
|
||||||
if (hoursLeft > 0) {
|
//计算当前时间-开始时间
|
||||||
|
Duration startDiff = beginDateTime.difference(now);
|
||||||
|
double hoursUntilStart = startDiff.inMinutes / 60.0;
|
||||||
|
|
||||||
|
|
||||||
|
// 只有在【当前时间早于开始时间】且【剩余时间大于0】时才显示文案
|
||||||
|
if (now.isBefore(beginDateTime) && hoursLeft > 0) {
|
||||||
// 如果是正数,表示还有多久结束
|
// 如果是正数,表示还有多久结束
|
||||||
String timeTip = "${hoursLeft.toStringAsFixed(1)}小时后";
|
String timeTip = " ${hoursUntilStart.toStringAsFixed(2)}小时后";
|
||||||
jobTipStr = "$timeTip$hydStatusStr";
|
jobTipStr = "$timeTip$hydStatusStr";
|
||||||
} else {
|
} else {
|
||||||
jobTipStr = "";
|
jobTipStr = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jobDetailsStr =
|
||||||
|
"当前站点已设置$beginTime至$endTime,共${hoursLeft.toStringAsFixed(2)}小时,为$hydStatusStr状态";
|
||||||
|
|
||||||
// 如果是处于非营运状态,自动回填开始和结束时间
|
// 如果是处于非营运状态,自动回填开始和结束时间
|
||||||
// 假设 customStartTime 是现在,customEndTime 是接口返回的结束时间
|
// 假设 customStartTime 是现在,customEndTime 是接口返回的结束时间
|
||||||
customStartTime = beginDateTime;
|
customStartTime = beginDateTime;
|
||||||
@@ -111,8 +180,10 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
print("时间解析失败: $e");
|
print("时间解析失败: $e");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (e){
|
} catch (e) {
|
||||||
Logger.d("解析失败: $e");
|
Logger.d("解析失败或者没返回信息: $e");
|
||||||
|
|
||||||
|
jobTipStr = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -177,6 +248,26 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _msgNotice() async {
|
||||||
|
final Map<String, dynamic> requestData = {
|
||||||
|
'appFlag': 1,
|
||||||
|
'isRead': 1,
|
||||||
|
'pageNum': 1,
|
||||||
|
'pageSize': 5,
|
||||||
|
};
|
||||||
|
final response = await HttpService.to.get(
|
||||||
|
'appointment/unread_notice/page',
|
||||||
|
params: requestData,
|
||||||
|
);
|
||||||
|
if (response != null) {
|
||||||
|
final result = BaseModel.fromJson(response.data);
|
||||||
|
if (result.code == 0 && result.data != null) {
|
||||||
|
String total = result.data["total"].toString();
|
||||||
|
isNotice = int.parse(total) > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void onOperationStatusChanged(String? newValue) {
|
void onOperationStatusChanged(String? newValue) {
|
||||||
if (newValue != null) {
|
if (newValue != null) {
|
||||||
selectedOperationStatus = newValue;
|
selectedOperationStatus = newValue;
|
||||||
@@ -282,6 +373,7 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
'appointment/station/updateStationStatus',
|
'appointment/station/updateStationStatus',
|
||||||
data: {
|
data: {
|
||||||
'hydrogenId': hydrogenId,
|
'hydrogenId': hydrogenId,
|
||||||
|
'name': name,
|
||||||
'siteStatus': selectedOperationStatus == "营运中"
|
'siteStatus': selectedOperationStatus == "营运中"
|
||||||
? "0"
|
? "0"
|
||||||
: selectedOperationStatus == "维修中"
|
: selectedOperationStatus == "维修中"
|
||||||
@@ -309,6 +401,9 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
var result = BaseModel.fromJson(responseData.data);
|
var result = BaseModel.fromJson(responseData.data);
|
||||||
if (result.code == 0) {
|
if (result.code == 0) {
|
||||||
showSuccessToast("保存成功,已同步通知对应司机");
|
showSuccessToast("保存成功,已同步通知对应司机");
|
||||||
|
|
||||||
|
//重新刷新页面
|
||||||
|
renderData();
|
||||||
}
|
}
|
||||||
dismissLoading();
|
dismissLoading();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -325,10 +420,7 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
|
|
||||||
DialogX.to.showConfirmDialog(
|
DialogX.to.showConfirmDialog(
|
||||||
title: '当前设置详情',
|
title: '当前设置详情',
|
||||||
content: Text(
|
content: Text(jobDetailsStr, style: const TextStyle(fontSize: 15, height: 1.5)),
|
||||||
jobDetailsStr,
|
|
||||||
style: const TextStyle(fontSize: 15, height: 1.5),
|
|
||||||
),
|
|
||||||
confirmText: '好的',
|
confirmText: '好的',
|
||||||
cancelText: '取消设置',
|
cancelText: '取消设置',
|
||||||
onCancel: () {
|
onCancel: () {
|
||||||
@@ -342,9 +434,7 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
void _cancelJob() async {
|
void _cancelJob() async {
|
||||||
showLoading("正在取消...");
|
showLoading("正在取消...");
|
||||||
try {
|
try {
|
||||||
var response = await HttpService.to.delete(
|
var response = await HttpService.to.delete('appointment/job/hyd/$jobId');
|
||||||
'appointment/job/hyd/$jobId',
|
|
||||||
);
|
|
||||||
|
|
||||||
dismissLoading();
|
dismissLoading();
|
||||||
if (response != null) {
|
if (response != null) {
|
||||||
@@ -404,11 +494,4 @@ class ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
await StorageService.to.clearLoginInfo();
|
await StorageService.to.clearLoginInfo();
|
||||||
Get.offAll(() => LoginPage());
|
Get.offAll(() => LoginPage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void onClose() {
|
|
||||||
broadcastTitleController.dispose();
|
|
||||||
broadcastContentController.dispose();
|
|
||||||
super.onClose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,17 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:getx_scaffold/getx_scaffold.dart';
|
import 'package:getx_scaffold/getx_scaffold.dart';
|
||||||
|
import 'package:ln_jq_app/common/login_util.dart';
|
||||||
import 'package:ln_jq_app/pages/b_page/reservation/controller.dart';
|
import 'package:ln_jq_app/pages/b_page/reservation/controller.dart';
|
||||||
|
import 'package:ln_jq_app/pages/c_page/message/view.dart';
|
||||||
|
|
||||||
class ReservationPage extends GetView<ReservationController> {
|
class ReservationPage extends GetView<ReservationController> {
|
||||||
const ReservationPage({super.key});
|
const ReservationPage({super.key});
|
||||||
|
|
||||||
|
// 定义主题色
|
||||||
|
static const kPrimaryColor = Color(0xFF006D35); // 效果图深绿色
|
||||||
|
static const kBgColor = Color(0xFFF5F7F9); // 背景灰
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GetBuilder<ReservationController>(
|
return GetBuilder<ReservationController>(
|
||||||
@@ -13,180 +19,309 @@ class ReservationPage extends GetView<ReservationController> {
|
|||||||
id: 'b_reservation',
|
id: 'b_reservation',
|
||||||
builder: (_) {
|
builder: (_) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: kBgColor,
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(12.0),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
||||||
children: [
|
children: [
|
||||||
_buildHeaderCard(),
|
_buildTopSection(context),
|
||||||
const SizedBox(height: 12),
|
Padding(
|
||||||
_buildInfoFormCard(context),
|
padding: EdgeInsets.symmetric(horizontal: 20.w),
|
||||||
const SizedBox(height: 12),
|
child: Column(
|
||||||
_buildTipsCard(),
|
children: [
|
||||||
const SizedBox(height: 12),
|
SizedBox(height: 16),
|
||||||
|
_buildBasicInfoCard(),
|
||||||
|
SizedBox(height: 16),
|
||||||
|
_buildOperationContentCard(context),
|
||||||
|
SizedBox(height: 16.h),
|
||||||
|
_buildSystemTips(),
|
||||||
|
SizedBox(height: 24),
|
||||||
_buildLogoutButton(),
|
_buildLogoutButton(),
|
||||||
|
SizedBox(height: 40),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 构建顶部的站点信息头卡片
|
/// 1. 顶部个人信息及统计栏
|
||||||
Widget _buildHeaderCard() {
|
Widget _buildTopSection(BuildContext context) {
|
||||||
return Card(
|
return Container(
|
||||||
elevation: 2,
|
width: double.infinity,
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
decoration: const BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.vertical(bottom: Radius.circular(30)),
|
||||||
|
),
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: MediaQuery.of(context).padding.top + 10,
|
||||||
|
left: 20,
|
||||||
|
right: 20,
|
||||||
|
bottom: 25,
|
||||||
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
ListTile(
|
Row(
|
||||||
leading: const Icon(Icons.local_gas_station, color: Colors.blue, size: 40),
|
|
||||||
title: Text(
|
|
||||||
controller.name,
|
|
||||||
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 18),
|
|
||||||
),
|
|
||||||
subtitle: Text(controller.address),
|
|
||||||
trailing: Container(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.blue[100],
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
controller.selectedOperationStatus,
|
|
||||||
style: const TextStyle(
|
|
||||||
color: Colors.blue,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontSize: 12,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const Divider(height: 1, indent: 16, endIndent: 16),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
children: [
|
children: [
|
||||||
_buildHeaderStat(controller.customerPrice, '氢气价格'),
|
CircleAvatar(
|
||||||
_buildHeaderStat(controller.timeStr, '营业时间'),
|
radius: 25,
|
||||||
_buildHeaderStat('98%', '设备状态'),
|
backgroundColor: Colors.white,
|
||||||
],
|
child: LoginUtil.getAssImg('ic_user_logo@2x'),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(width: 12),
|
||||||
],
|
Expanded(
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 构建头部卡片中的单个统计项
|
|
||||||
Widget _buildHeaderStat(String value, String label) {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
value,
|
|
||||||
style: const TextStyle(
|
|
||||||
color: Colors.blue,
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 4),
|
|
||||||
Text(label, style: const TextStyle(color: Colors.grey, fontSize: 12)),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 构建包含所有信息表单的卡片(增加 Tab 切换功能)
|
|
||||||
Widget _buildInfoFormCard(BuildContext context) {
|
|
||||||
return Card(
|
|
||||||
elevation: 2,
|
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
|
||||||
clipBehavior: Clip.antiAlias, // 确保 Tab 背景圆角生效
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
// Tab 切换栏
|
|
||||||
Obx(
|
|
||||||
() => Container(
|
|
||||||
color: Colors.grey[50],
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
_buildTabItem(0, Icons.business_outlined, '站点信息'),
|
|
||||||
_buildTabItem(1, Icons.campaign_outlined, '站点广播'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const Divider(height: 1),
|
|
||||||
// 内容区域
|
|
||||||
Obx(
|
|
||||||
() => controller.selectedTabIndex.value == 0
|
|
||||||
? _buildStationInfo(context)
|
|
||||||
: _buildStationBroadcast(context),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 构建单个 Tab 项
|
|
||||||
Widget _buildTabItem(int index, IconData icon, String label) {
|
|
||||||
bool isSelected = controller.selectedTabIndex.value == index;
|
|
||||||
return Expanded(
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () => controller.selectedTabIndex.value = index,
|
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border(
|
|
||||||
bottom: BorderSide(
|
|
||||||
color: isSelected ? Colors.blue : Colors.transparent,
|
|
||||||
width: 2,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Icon(icon, size: 20, color: isSelected ? Colors.blue : Colors.grey[600]),
|
|
||||||
const SizedBox(width: 8),
|
|
||||||
Text(
|
|
||||||
label,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: isSelected ? FontWeight.bold : FontWeight.normal,
|
|
||||||
color: isSelected ? Colors.blue : Colors.grey[600],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 站点信息子视图
|
|
||||||
Widget _buildStationInfo(BuildContext context) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.all(16.0),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
_buildSectionTitle('基本信息'),
|
|
||||||
_buildDisplayField(label: '站点名称', value: controller.name),
|
|
||||||
_buildDisplayField(label: '运营企业', value: controller.operatingEnterprise),
|
|
||||||
_buildDisplayField(label: '站点地址', value: controller.address),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
_buildSectionTitle('价格信息'),
|
|
||||||
_buildDisplayField(label: '官方价格 (元/kg)', value: controller.customerPrice),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
_buildSectionTitle('运营信息'),
|
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text('运营状态', style: TextStyle(color: Colors.grey[600], fontSize: 14)),
|
Text(
|
||||||
|
controller.name,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
_buildStatusTag(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Text(
|
||||||
|
"站点:${controller.address}",
|
||||||
|
style: TextStyle(color: Colors.grey[500], fontSize: 13),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
Get.to(() => const MessagePage());
|
||||||
|
},
|
||||||
|
style: IconButton.styleFrom(
|
||||||
|
backgroundColor: Colors.grey[100],
|
||||||
|
padding: const EdgeInsets.all(8),
|
||||||
|
),
|
||||||
|
icon: Badge(
|
||||||
|
smallSize: 8,
|
||||||
|
backgroundColor: controller.isNotice
|
||||||
|
? Colors.red
|
||||||
|
: Colors.transparent,
|
||||||
|
child: const Icon(
|
||||||
|
Icons.notifications_outlined,
|
||||||
|
color: Colors.black87,
|
||||||
|
size: 30,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 25),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
_buildStatBox("氢气价格", "Hydrogen price", controller.customerPrice, "/kg"),
|
||||||
|
SizedBox(width: 4.w),
|
||||||
|
_buildStatBox("营业时间", "Opening time", controller.timeStr, ""),
|
||||||
|
SizedBox(width: 4.w),
|
||||||
|
_buildStatBox("设备状态", "Anlagenzustand", "98", "%"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildStatusTag() {
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: const Color(0xFFE1F5FE),
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
controller.selectedOperationStatus,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color(0xFF03A9F4),
|
||||||
|
fontSize: 12.sp,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildStatBox(String title, String enTitle, String value, String unit) {
|
||||||
|
return Expanded(
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.only(left: 12.w, top: 4.h, bottom: 4.h),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: kBgColor,
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.sp,
|
||||||
|
color: Color.fromRGBO(51, 51, 51, 0.8),
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(enTitle, style: const TextStyle(fontSize: 9, color: Colors.grey)),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
value,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.sp,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Color(0xFF333333),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 2),
|
||||||
|
Text(unit, style: const TextStyle(fontSize: 11, color: Colors.grey)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 2. 站点基本信息
|
||||||
|
Widget _buildBasicInfoCard() {
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.all(20),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"站点基本信息",
|
||||||
|
style: TextStyle(fontSize: 14.sp, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
SizedBox(height: 15),
|
||||||
|
_buildInfoRow("站点名称", controller.name),
|
||||||
|
_buildInfoRow("运营企业", controller.operatingEnterprise),
|
||||||
|
_buildInfoRow("站点地址", controller.address),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildInfoRow(String label, String value) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 12),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
label,
|
||||||
|
style: TextStyle(color: Colors.grey, fontSize: 11.sp),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
value,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color(0xFF333333),
|
||||||
|
fontSize: 12.sp,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 3. 运营信息/站点广播 Tab 及内容
|
||||||
|
Widget _buildOperationContentCard(BuildContext context) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: hideKeyboard,
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
// 自定义 TabBar
|
||||||
|
Obx(
|
||||||
|
() => Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 16, top: 16),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
_buildTabTitle(0, "运营信息"),
|
||||||
|
const SizedBox(width: 30),
|
||||||
|
_buildTabTitle(1, "站点广播"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Obx(
|
||||||
|
() => controller.selectedTabIndex.value == 0
|
||||||
|
? _buildOperatingForm(context)
|
||||||
|
: _buildBroadcastForm(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildTabTitle(int index, String title) {
|
||||||
|
bool isSelected = controller.selectedTabIndex.value == index;
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () => controller.selectedTabIndex.value = index,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 17,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: isSelected ? Colors.black87 : Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (isSelected)
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(top: 4),
|
||||||
|
width: 25,
|
||||||
|
height: 3,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: const Color(0xFF00A870), // 效果图中的亮绿色横线
|
||||||
|
borderRadius: BorderRadius.circular(2),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildOperatingForm(BuildContext context) {
|
||||||
|
return Padding(
|
||||||
|
padding: EdgeInsets.all(16),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'运营状态',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color.fromRGBO(51, 51, 51, 1),
|
||||||
|
fontSize: 12.sp,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
//加氢站未执行的状态修改任务
|
//加氢站未执行的状态修改任务
|
||||||
if (controller.jobTipStr.isNotEmpty)
|
if (controller.jobTipStr.isNotEmpty)
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
@@ -203,157 +338,113 @@ class ReservationPage extends GetView<ReservationController> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 12),
|
||||||
DropdownButtonFormField<String>(
|
// 状态网格选择
|
||||||
value: controller.selectedOperationStatus,
|
Wrap(
|
||||||
items: controller.operationStatusOptions.map((String value) {
|
spacing: 4,
|
||||||
return DropdownMenuItem<String>(value: value, child: Text(value));
|
runSpacing: 4,
|
||||||
|
children: controller.operationStatusOptions.map((status) {
|
||||||
|
bool isSelected = controller.selectedOperationStatus == status;
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () => controller.onOperationStatusChanged(status),
|
||||||
|
child: Container(
|
||||||
|
width: (Get.width - 80) / 2,
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: isSelected ? kPrimaryColor : const Color(0xFFEBEBEB),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Text(
|
||||||
|
status,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 11.sp,
|
||||||
|
color: isSelected ? Colors.white : Color.fromRGBO(51, 51, 51, 1),
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}).toList(),
|
}).toList(),
|
||||||
onChanged: controller.onOperationStatusChanged,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(8.0)),
|
|
||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 12.0),
|
|
||||||
),
|
),
|
||||||
),
|
SizedBox(height: 12.h),
|
||||||
const SizedBox(height: 16),
|
|
||||||
if (controller.selectedOperationStatus == "营运中")
|
if (controller.selectedOperationStatus == "营运中")
|
||||||
_buildDisplayField(label: '营业时间', value: controller.timeStr)
|
_buildDisplayField(label: '营业时间', value: controller.timeStr)
|
||||||
else
|
else
|
||||||
Column(
|
Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
_buildClickField(
|
_buildInputLabel("开始时间"),
|
||||||
label: '开始时间',
|
_buildDateTimePicker(
|
||||||
value: controller.customStartTimeStr,
|
controller.customStartTimeStr,
|
||||||
onTap: () => controller.pickDateTime(context, true),
|
() => controller.pickDateTime(context, true),
|
||||||
),
|
),
|
||||||
_buildClickField(
|
const SizedBox(height: 15),
|
||||||
label: '结束时间',
|
_buildInputLabel("结束时间"),
|
||||||
value: controller.customEndTimeStr,
|
_buildDateTimePicker(
|
||||||
onTap: () => controller.pickDateTime(context, false),
|
controller.customEndTimeStr,
|
||||||
|
() => controller.pickDateTime(context, false),
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 15),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
_buildDisplayField(label: '联系电话', value: controller.phone),
|
_buildDisplayField(label: '联系电话', value: controller.phone),
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 25),
|
||||||
ElevatedButton(
|
|
||||||
onPressed: controller.saveInfo,
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
minimumSize: const Size(double.infinity, 48),
|
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
|
||||||
),
|
|
||||||
child: const Text('保存信息', style: TextStyle(fontSize: 16)),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 站点广播子视图
|
|
||||||
Widget _buildStationBroadcast(BuildContext context) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.all(16.0),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
const Icon(Icons.campaign, color: Colors.blue, size: 28),
|
Expanded(
|
||||||
const SizedBox(width: 10),
|
flex: 1,
|
||||||
const Text(
|
child: OutlinedButton(
|
||||||
'站点广播通知',
|
onPressed: () {
|
||||||
style: TextStyle(
|
controller.renderData();
|
||||||
fontSize: 18,
|
}, // 重置逻辑
|
||||||
fontWeight: FontWeight.bold,
|
style: OutlinedButton.styleFrom(
|
||||||
color: Colors.black87,
|
side: const BorderSide(color: kPrimaryColor),
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
child: const Text("重置", style: TextStyle(color: kPrimaryColor)),
|
||||||
),
|
|
||||||
const SizedBox(height: 13),
|
|
||||||
_buildTextFieldLabel('通知标题'),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
SizedBox(
|
|
||||||
height: 45.h,
|
|
||||||
child: TextField(
|
|
||||||
controller: controller.broadcastTitleController,
|
|
||||||
maxLength: 30,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintText: '例如:临时闭站通知',
|
|
||||||
hintStyle: TextStyle(color: Colors.grey[400], fontSize: 14),
|
|
||||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)),
|
|
||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
|
||||||
counterText: '', // 隐藏原生计数器,我们可以按需自定义
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(width: 15),
|
||||||
const SizedBox(height: 20),
|
Expanded(
|
||||||
_buildTextFieldLabel('通知内容'),
|
flex: 2,
|
||||||
const SizedBox(height: 8),
|
child: ElevatedButton(
|
||||||
TextField(
|
onPressed: controller.saveInfo,
|
||||||
controller: controller.broadcastContentController,
|
|
||||||
maxLength: 150,
|
|
||||||
maxLines: 5,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintText: '请输入通知内容...',
|
|
||||||
hintStyle: TextStyle(color: Colors.grey[400], fontSize: 14),
|
|
||||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)),
|
|
||||||
contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
ElevatedButton(
|
|
||||||
onPressed: controller.sendBroadcast,
|
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: Colors.blue,
|
backgroundColor: kPrimaryColor,
|
||||||
foregroundColor: Colors.white,
|
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||||
minimumSize: const Size(double.infinity, 50),
|
shape: RoundedRectangleBorder(
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
borderRadius: BorderRadius.circular(10),
|
||||||
elevation: 0,
|
|
||||||
),
|
|
||||||
child: const Text(
|
|
||||||
'发送',
|
|
||||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
child: const Text("保存设置", style: TextStyle(color: Colors.white)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildTextFieldLabel(String label) {
|
|
||||||
return Text(
|
|
||||||
label,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 14,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
color: Colors.black87,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 构建带标题的表单区域
|
|
||||||
Widget _buildSectionTitle(String title) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.only(bottom: 12.0),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Container(width: 4, height: 16, color: Colors.blue),
|
|
||||||
const SizedBox(width: 8),
|
|
||||||
Text(title, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 构建一个“标签+纯文本”的显示行
|
|
||||||
Widget _buildDisplayField({required String label, required String value}) {
|
Widget _buildDisplayField({required String label, required String value}) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 12.0),
|
padding: const EdgeInsets.only(bottom: 12.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(label, style: TextStyle(color: Colors.grey[600], fontSize: 14)),
|
Text(
|
||||||
|
label,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color.fromRGBO(51, 51, 51, 1),
|
||||||
|
fontSize: 12.sp,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Container(
|
Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
@@ -373,118 +464,177 @@ class ReservationPage extends GetView<ReservationController> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 构建一个“可点击”的选择行
|
Widget _buildBroadcastForm() {
|
||||||
Widget _buildClickField({
|
|
||||||
required String label,
|
|
||||||
required String value,
|
|
||||||
required VoidCallback onTap,
|
|
||||||
}) {
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 12.0),
|
padding: const EdgeInsets.all(16),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(label, style: TextStyle(color: Colors.grey[600], fontSize: 14)),
|
_buildInputLabel("通知标题"),
|
||||||
const SizedBox(height: 8),
|
TextField(
|
||||||
InkWell(
|
controller: controller.broadcastTitleController,
|
||||||
|
decoration: _inputDecoration("例如:临时闭站通知"),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
_buildInputLabel("通知内容"),
|
||||||
|
TextField(
|
||||||
|
controller: controller.broadcastContentController,
|
||||||
|
maxLines: 4,
|
||||||
|
decoration: _inputDecoration("请输入通知内容..."),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: OutlinedButton(
|
||||||
|
onPressed: () {
|
||||||
|
controller.broadcastTitleController.clear();
|
||||||
|
controller.broadcastContentController.clear();
|
||||||
|
}, // 重置逻辑
|
||||||
|
style: OutlinedButton.styleFrom(
|
||||||
|
side: const BorderSide(color: kPrimaryColor),
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: const Text("重置", style: TextStyle(color: kPrimaryColor)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 15),
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: controller.sendBroadcast,
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: kPrimaryColor,
|
||||||
|
minimumSize: const Size(double.infinity, 50),
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||||
|
),
|
||||||
|
child: const Text("发送广播", style: TextStyle(color: Colors.white)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildInputLabel(String label) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 0, bottom: 8),
|
||||||
|
child: Text(
|
||||||
|
label,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color.fromRGBO(51, 51, 51, 1),
|
||||||
|
fontSize: 12.sp,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildDateTimePicker(String value, VoidCallback onTap) {
|
||||||
|
return GestureDetector(
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
child: Container(
|
child: Container(
|
||||||
width: double.infinity,
|
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 12),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 12.0),
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
border: Border.all(color: const Color(0xFF00A870).withOpacity(0.5)),
|
||||||
borderRadius: BorderRadius.circular(8.0),
|
borderRadius: BorderRadius.circular(10),
|
||||||
border: Border.all(color: Colors.blue.withOpacity(0.5)),
|
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(value, style: const TextStyle(color: Colors.black87)),
|
||||||
|
const Icon(Icons.calendar_today_outlined, size: 18, color: Color(0xFF00A870)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
InputDecoration _inputDecoration(String hint) {
|
||||||
|
return InputDecoration(
|
||||||
|
hintText: hint,
|
||||||
|
hintStyle: const TextStyle(color: Colors.grey, fontSize: 14),
|
||||||
|
border: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
borderSide: const BorderSide(color: Color(0xFFE0E0E0)),
|
||||||
|
),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
borderSide: const BorderSide(color: Color(0xFFE0E0E0)),
|
||||||
|
),
|
||||||
|
contentPadding: const EdgeInsets.symmetric(horizontal: 15, vertical: 12),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 4. 系统提醒
|
||||||
|
Widget _buildSystemTips() {
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.all(15),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: const Color(0xFFF1F9F6), // 极浅绿色背景
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Icon(Icons.info_outline, color: Color.fromRGBO(1, 113, 55, 1), size: 20),
|
||||||
|
SizedBox(width: 8.w),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
value,
|
"系统提醒",
|
||||||
style: const TextStyle(fontSize: 14, color: Colors.black87),
|
style: TextStyle(
|
||||||
|
color: Color.fromRGBO(1, 113, 55, 1),
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 14.sp,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 6.h),
|
||||||
|
Text(
|
||||||
|
"请您确保所提供的信息准确无误,价格信息也将实时\n更新至用户端",
|
||||||
|
style: TextStyle(color: Color.fromRGBO(1, 113, 55, 0.8), fontSize: 12.sp),
|
||||||
|
),
|
||||||
|
SizedBox(height: 6.h),
|
||||||
|
Text(
|
||||||
|
"如有疑问请联系客服:400-021-1773",
|
||||||
|
style: TextStyle(color: Color.fromRGBO(1, 113, 55, 0.8), fontSize: 12.sp),
|
||||||
),
|
),
|
||||||
const Icon(Icons.calendar_month, size: 18, color: Colors.blue),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 构建静态提示信息卡片
|
/// 5. 退出登录按钮
|
||||||
Widget _buildTipsCard() {
|
|
||||||
return Card(
|
|
||||||
elevation: 2,
|
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(16.0),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
_buildInfoItem(Icons.info_outline, '请确保信息准确无误'),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
_buildInfoItem(Icons.help_outline, '价格信息将实时更新到用户端'),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
_buildInfoItem(Icons.headset_mic_outlined, '如有疑问请联系技术支持: 400-021-1773'),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
const Icon(Icons.verified_outlined, color: Colors.blue, size: 20),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
Expanded(
|
|
||||||
child: FutureBuilder<String>(
|
|
||||||
future: getVersion(),
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
|
||||||
return const Text("");
|
|
||||||
}
|
|
||||||
if (snapshot.hasData) {
|
|
||||||
return TextX.labelSmall(
|
|
||||||
"当前版本: ${snapshot.data}",
|
|
||||||
color: Colors.black54,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return const Text("");
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 构建退出登录按钮
|
|
||||||
Widget _buildLogoutButton() {
|
Widget _buildLogoutButton() {
|
||||||
return ElevatedButton(
|
return SizedBox(
|
||||||
|
width: double.infinity,
|
||||||
|
height: 50,
|
||||||
|
child: ElevatedButton(
|
||||||
onPressed: controller.logout,
|
onPressed: controller.logout,
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: Colors.red,
|
backgroundColor: Color.fromRGBO(204, 52, 46, 1),
|
||||||
foregroundColor: Colors.white,
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(25)),
|
||||||
minimumSize: const Size(double.infinity, 48),
|
elevation: 0,
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
|
|
||||||
elevation: 2,
|
|
||||||
),
|
),
|
||||||
child: const Text(
|
child: const Text(
|
||||||
'退出登录',
|
"退出登录",
|
||||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 构建带图标的提示信息行
|
|
||||||
Widget _buildInfoItem(IconData icon, String text) {
|
|
||||||
return Row(
|
|
||||||
children: [
|
|
||||||
Icon(icon, color: Colors.blue, size: 20),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
Expanded(
|
|
||||||
child: Text(text, style: const TextStyle(fontSize: 14, color: Colors.black54)),
|
|
||||||
),
|
),
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,12 +136,13 @@ class SiteController extends GetxController with BaseControllerMixin {
|
|||||||
Timer? _refreshTimer;
|
Timer? _refreshTimer;
|
||||||
|
|
||||||
final TextEditingController searchController = TextEditingController();
|
final TextEditingController searchController = TextEditingController();
|
||||||
|
bool isNotice = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
renderData();
|
renderData();
|
||||||
|
_msgNotice();
|
||||||
startAutoRefresh();
|
startAutoRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,6 +153,26 @@ class SiteController extends GetxController with BaseControllerMixin {
|
|||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _msgNotice() async {
|
||||||
|
final Map<String, dynamic> requestData = {
|
||||||
|
'appFlag': 1,
|
||||||
|
'isRead': 1,
|
||||||
|
'pageNum': 1,
|
||||||
|
'pageSize': 5,
|
||||||
|
};
|
||||||
|
final response = await HttpService.to.get(
|
||||||
|
'appointment/unread_notice/page',
|
||||||
|
params: requestData,
|
||||||
|
);
|
||||||
|
if (response != null) {
|
||||||
|
final result = BaseModel.fromJson(response.data);
|
||||||
|
if (result.code == 0 && result.data != null) {
|
||||||
|
String total = result.data["total"].toString();
|
||||||
|
isNotice = int.parse(total) > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void startAutoRefresh() {
|
void startAutoRefresh() {
|
||||||
// 先停止已存在的定时器,防止重复启动
|
// 先停止已存在的定时器,防止重复启动
|
||||||
stopAutoRefresh();
|
stopAutoRefresh();
|
||||||
@@ -580,7 +601,6 @@ class SiteController extends GetxController with BaseControllerMixin {
|
|||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
} finally {
|
} finally {
|
||||||
|
|
||||||
//加载列表数据
|
//加载列表数据
|
||||||
fetchReservationData();
|
fetchReservationData();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:getx_scaffold/getx_scaffold.dart';
|
import 'package:getx_scaffold/getx_scaffold.dart';
|
||||||
|
import 'package:ln_jq_app/common/login_util.dart';
|
||||||
import 'package:ln_jq_app/common/styles/theme.dart';
|
import 'package:ln_jq_app/common/styles/theme.dart';
|
||||||
import 'package:ln_jq_app/pages/b_page/history/view.dart';
|
import 'package:ln_jq_app/pages/b_page/history/view.dart';
|
||||||
|
import 'package:ln_jq_app/pages/c_page/message/view.dart';
|
||||||
|
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
|
|
||||||
@@ -15,196 +17,250 @@ class SitePage extends GetView<SiteController> {
|
|||||||
init: SiteController(),
|
init: SiteController(),
|
||||||
id: 'site',
|
id: 'site',
|
||||||
builder: (_) {
|
builder: (_) {
|
||||||
return SingleChildScrollView(child: _buildView());
|
return Scaffold(
|
||||||
|
backgroundColor: Color(0xFFF5F7F9),
|
||||||
|
body: SingleChildScrollView(child: _buildView(context)),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 主视图
|
// 主视图
|
||||||
Widget _buildView() {
|
Widget _buildView(BuildContext context) {
|
||||||
return Padding(
|
return Column(
|
||||||
padding: const EdgeInsets.all(12.0),
|
children: [
|
||||||
|
// 第一个卡片: 今日预约统计
|
||||||
|
_buildTopSection(context),
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
|
||||||
// 第一个卡片: 今日预约统计
|
|
||||||
Card(
|
|
||||||
elevation: 3,
|
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.0)),
|
|
||||||
margin: const EdgeInsets.only(bottom: 12),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 12.0),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
padding: EdgeInsets.only(top: 17.h, bottom: 10.h),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
const Icon(Icons.calendar_today, color: Colors.blue, size: 32),
|
|
||||||
const SizedBox(width: 12),
|
|
||||||
const Expanded(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'今日预约统计',
|
"预约信息",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
color: Color.fromRGBO(51, 51, 51, 1),
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 14.sp,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
GestureDetector(
|
||||||
"Today's Reservation Statistics",
|
|
||||||
style: TextStyle(fontSize: 12, color: Colors.grey),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 10,
|
|
||||||
vertical: 4,
|
|
||||||
),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.blue.withOpacity(0.1),
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
|
||||||
child: const Text(
|
|
||||||
'实时',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.blue,
|
|
||||||
fontSize: 12,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
const Divider(height: 1, indent: 16, endIndent: 16),
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
children: [
|
|
||||||
_buildStatItem(controller.leftHydrogen, '剩余余量'),
|
|
||||||
_buildStatItem(controller.orderAmount, '预约车辆'),
|
|
||||||
_buildStatItem(controller.completedAmount, '已完成'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
children: [
|
|
||||||
_buildStatItem(controller.orderTotalAmount, '加氢总量'),
|
|
||||||
_buildStatItem(controller.orderUnfinishedAmount, '未加氢总量'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
// 第二个卡片: 预约信息
|
|
||||||
Card(
|
|
||||||
elevation: 3,
|
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.0)),
|
|
||||||
margin: EdgeInsets.only(bottom: 12),
|
|
||||||
clipBehavior: Clip.antiAlias,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
color: Colors.blue,
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: GestureDetector(
|
|
||||||
onTap: () {
|
onTap: () {
|
||||||
controller.renderData();
|
|
||||||
},
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'今日预约信息',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 32,
|
|
||||||
height: 32,
|
|
||||||
child: const Icon(
|
|
||||||
Icons.refresh,
|
|
||||||
size: 18,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ElevatedButton(
|
|
||||||
onPressed: () {
|
|
||||||
Get.to(
|
Get.to(
|
||||||
() => HistoryPage(),
|
() => HistoryPage(),
|
||||||
arguments: {
|
arguments: {'stationName': controller.name},
|
||||||
'stationName': controller.name,
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
style: ElevatedButton.styleFrom(
|
child: Text(
|
||||||
backgroundColor: Colors.blue.shade700,
|
|
||||||
foregroundColor: Colors.white,
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(5),
|
|
||||||
),
|
|
||||||
elevation: 2,
|
|
||||||
),
|
|
||||||
child: const Text(
|
|
||||||
'历史记录',
|
'历史记录',
|
||||||
style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
|
style: TextStyle(
|
||||||
|
fontSize: 14.sp,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Color.fromRGBO(156, 163, 175, 1),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
// 第二个卡片: 预约信息
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
_buildSearchView(),
|
_buildSearchView(),
|
||||||
controller.hasReservationData
|
controller.hasReservationData
|
||||||
? _buildReservationListView()
|
? _buildReservationListView()
|
||||||
: _buildEmptyReservationView(),
|
: _buildEmptyReservationView(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
|
|
||||||
//第三部分
|
//第三部分
|
||||||
Card(
|
Container(
|
||||||
elevation: 3,
|
padding: const EdgeInsets.all(15),
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.0)),
|
decoration: BoxDecoration(
|
||||||
margin: const EdgeInsets.only(bottom: 12),
|
color: const Color(0xFFF1F9F6), // 极浅绿色背景
|
||||||
child: Padding(
|
borderRadius: BorderRadius.circular(10),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0),
|
),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.info_outline,
|
||||||
|
color: Color.fromRGBO(1, 113, 55, 1),
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
|
SizedBox(width: 8.w),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"系统提醒",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color.fromRGBO(1, 113, 55, 1),
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 14.sp,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 6.h),
|
||||||
|
Text(
|
||||||
|
"数据每五分钟自动刷新,如需实时更新请下拉页面",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color.fromRGBO(1, 113, 55, 0.8),
|
||||||
|
fontSize: 12.sp,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 6.h),
|
||||||
|
Text(
|
||||||
|
"如有疑问请联系客服:400-021-1773",
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color.fromRGBO(1, 113, 55, 0.8),
|
||||||
|
fontSize: 12.sp,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildTopSection(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.vertical(bottom: Radius.circular(20)),
|
||||||
|
),
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: MediaQuery.of(context).padding.top + 10,
|
||||||
|
left: 20,
|
||||||
|
right: 20,
|
||||||
|
bottom: 25,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
CircleAvatar(
|
||||||
|
radius: 25,
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
child: LoginUtil.getAssImg('ic_user_logo@2x'),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
_buildInfoItem(Icons.info_outline, '数据每5分钟自动刷新一次'),
|
Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"今日预约统计",
|
||||||
|
style: TextStyle(fontSize: 14.sp, fontWeight: FontWeight.w400),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Text(
|
||||||
|
"Today's Reservation Statistics",
|
||||||
|
style: TextStyle(color: Colors.grey[500], fontSize: 13),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
Get.to(() => const MessagePage());
|
||||||
|
},
|
||||||
|
style: IconButton.styleFrom(
|
||||||
|
backgroundColor: Colors.grey[100],
|
||||||
|
padding: const EdgeInsets.all(8),
|
||||||
|
),
|
||||||
|
icon: Badge(
|
||||||
|
smallSize: 8,
|
||||||
|
backgroundColor: controller.isNotice ? Colors.red : Colors.transparent,
|
||||||
|
child: const Icon(
|
||||||
|
Icons.notifications_outlined,
|
||||||
|
color: Colors.black87,
|
||||||
|
size: 30,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 25),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
_buildStatBox("剩余氢量", "remaining quantity", controller.leftHydrogen, "kg"),
|
||||||
|
SizedBox(width: 4.w),
|
||||||
|
_buildStatBox(
|
||||||
|
"今日加氢量",
|
||||||
|
"Have been added",
|
||||||
|
controller.orderTotalAmount,
|
||||||
|
"kg",
|
||||||
|
),
|
||||||
|
SizedBox(width: 4.w),
|
||||||
|
_buildStatBox(
|
||||||
|
"未加氢总量",
|
||||||
|
"No quantity added",
|
||||||
|
controller.orderUnfinishedAmount,
|
||||||
|
"kg",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildStatBox(String title, String enTitle, String value, String unit) {
|
||||||
|
return Expanded(
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.only(left: 12.w, top: 4.h, bottom: 4.h),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Color(0xFFF5F7F9),
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.sp,
|
||||||
|
color: Color.fromRGBO(51, 51, 51, 0.8),
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(enTitle, style: const TextStyle(fontSize: 9, color: Colors.grey)),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
_buildInfoItem(Icons.headset_mic_outlined, '如有疑问请联系客服: 400-021-1773'),
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
value,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12.sp,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Color(0xFF333333),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 2),
|
||||||
|
Text(unit, style: const TextStyle(fontSize: 11, color: Colors.grey)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -649,9 +649,8 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
|
|
||||||
void getCatinfo() async {
|
void getCatinfo() async {
|
||||||
try {
|
try {
|
||||||
HttpService.to.setBaseUrl(AppTheme.car_service_url);
|
|
||||||
var responseData = await HttpService.to.post(
|
var responseData = await HttpService.to.post(
|
||||||
'VehicleData/getHydrogenInfoByPlateNumber',
|
'appointment/vehicle/getHydrogenInfoByPlateNumber',
|
||||||
data: {
|
data: {
|
||||||
'userName': "xll@lingniu",
|
'userName': "xll@lingniu",
|
||||||
'password': "4q%3!l6s0p",
|
'password': "4q%3!l6s0p",
|
||||||
@@ -686,8 +685,6 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
|
|
||||||
updateUi();
|
updateUi();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
} finally {
|
|
||||||
HttpService.to.setBaseUrl(AppTheme.test_service_url);
|
|
||||||
}
|
}
|
||||||
renderSliderTheme();
|
renderSliderTheme();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class LoginController extends GetxController with BaseControllerMixin {
|
|||||||
data: {"mobile": phoneController.text},
|
data: {"mobile": phoneController.text},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (responseData == null && responseData!.data == null) {
|
if (responseData == null) {
|
||||||
showToast('验证码发送失败,请稍后重试');
|
showToast('验证码发送失败,请稍后重试');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,8 +146,6 @@ class _LoginPageState extends State<LoginPage> with SingleTickerProviderStateMix
|
|||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
buildAgreement(),
|
buildAgreement(),
|
||||||
const SizedBox(height: 40),
|
const SizedBox(height: 40),
|
||||||
_buildFooterSlogan(),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -156,7 +154,7 @@ class _LoginPageState extends State<LoginPage> with SingleTickerProviderStateMix
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Positioned(left: 0, right: 0, bottom: 33.h, child: _buildFooterSlogan()),
|
||||||
if (AppTheme.is_show_host)
|
if (AppTheme.is_show_host)
|
||||||
Positioned(
|
Positioned(
|
||||||
top: 40.h,
|
top: 40.h,
|
||||||
@@ -355,6 +353,7 @@ class _LoginPageState extends State<LoginPage> with SingleTickerProviderStateMix
|
|||||||
Widget _buildInputWrapper({required Widget child}) {
|
Widget _buildInputWrapper({required Widget child}) {
|
||||||
return Container(
|
return Container(
|
||||||
height: 55.h,
|
height: 55.h,
|
||||||
|
alignment: Alignment.center,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: const Color(0xFFF7F9FB),
|
color: const Color(0xFFF7F9FB),
|
||||||
borderRadius: BorderRadius.circular(28),
|
borderRadius: BorderRadius.circular(28),
|
||||||
|
|||||||
Reference in New Issue
Block a user