This commit is contained in:
2026-01-29 19:26:59 +08:00
parent 1177be821a
commit d09faac1d2
7 changed files with 56 additions and 29 deletions

View File

@@ -91,10 +91,10 @@ class B_BaseWidgetsPage extends GetView<B_BaseWidgetsController> {
id: 'b_baseWidgets',
builder: (_) {
return Scaffold(
extendBody: false,
extendBody: true,
resizeToAvoidBottomInset: false,
bottomNavigationBar: _buildNavigationBar(),
body: SafeArea(child: _buildView()),
body: _buildView(),
);
},
);

View File

@@ -36,7 +36,7 @@ class ReservationPage extends GetView<ReservationController> {
_buildSystemTips(),
SizedBox(height: 24),
_buildLogoutButton(),
SizedBox(height: 40),
SizedBox(height: 75.h),
],
),
),
@@ -363,9 +363,9 @@ class ReservationPage extends GetView<ReservationController> {
child: Text(
status,
style: TextStyle(
fontSize: 11.sp,
fontSize: 13.sp,
color: isSelected ? Colors.white : Color.fromRGBO(51, 51, 51, 1),
fontWeight: FontWeight.w400,
fontWeight: FontWeight.w500,
),
),
),

View File

@@ -6,6 +6,7 @@ import 'package:getx_scaffold/getx_scaffold.dart';
import 'package:ln_jq_app/common/model/base_model.dart';
import 'package:ln_jq_app/common/styles/theme.dart';
import 'package:ln_jq_app/storage_service.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
enum ReservationStatus {
pending, // 待处理 ( addStatus: 0)
@@ -144,6 +145,7 @@ class SiteController extends GetxController with BaseControllerMixin {
final TextEditingController searchController = TextEditingController();
bool isNotice = false;
final RefreshController refreshController = RefreshController(initialRefresh: false);
@override
bool get listenLifecycleEvent => true;
@@ -200,6 +202,8 @@ class SiteController extends GetxController with BaseControllerMixin {
});
}
void onRefresh() => renderData(isRefresh: true);
///停止定时器的方法
void stopAutoRefresh() {
// 如果定时器存在并且是激活状态,就取消它
@@ -222,7 +226,7 @@ class SiteController extends GetxController with BaseControllerMixin {
'pageNum': 1,
'pageSize': 50, // 暂时不考虑分页一次获取30条
'keyword': searchText, // 加氢站名称、手机号
'stationId': StorageService.to.userId
'stationId': StorageService.to.userId,
},
);
@@ -588,7 +592,7 @@ class SiteController extends GetxController with BaseControllerMixin {
String orderTotalAmount = "";
String orderUnfinishedAmount = "";
Future<void> renderData() async {
Future<void> renderData({bool isRefresh = false}) async {
try {
var responseData = await HttpService.to.get(
'appointment/station/getStationInfoById?hydrogenId=${StorageService.to.userId}',
@@ -621,6 +625,10 @@ class SiteController extends GetxController with BaseControllerMixin {
} finally {
//加载列表数据
fetchReservationData();
if (isRefresh) {
refreshController.refreshCompleted();
}
}
}
}

View File

@@ -4,6 +4,7 @@ import 'package:ln_jq_app/common/login_util.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/c_page/message/view.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'controller.dart';
@@ -19,7 +20,12 @@ class SitePage extends GetView<SiteController> {
builder: (_) {
return Scaffold(
backgroundColor: Color.fromRGBO(247, 249, 251, 1),
body: SingleChildScrollView(child: _buildView(context)),
body: SmartRefresher(
controller: controller.refreshController,
enablePullUp: false,
onRefresh: controller.onRefresh,
child: SingleChildScrollView(child: _buildView(context)),
),
);
},
);
@@ -127,10 +133,10 @@ class SitePage extends GetView<SiteController> {
],
),
),
SizedBox(height: 35.h),
],
),
),
SizedBox(height: 75.h),
],
);
}
@@ -185,7 +191,6 @@ class SitePage extends GetView<SiteController> {
if (scanResult == null) {
controller.msgNotice();
}
},
style: IconButton.styleFrom(
backgroundColor: Colors.grey[100],
@@ -495,7 +500,7 @@ class SitePage extends GetView<SiteController> {
"预约量:${item.amount}",
style: TextStyle(
color: Color(0xFF00A870),
fontSize: 12.sp,
fontSize: 13.sp,
fontWeight: FontWeight.bold,
),
),
@@ -510,7 +515,7 @@ class SitePage extends GetView<SiteController> {
"${item.contactPerson} | ${item.contactPhone}",
style: TextStyle(
color: Color(0xFF999999),
fontSize: 12.sp,
fontSize: 13.sp,
fontWeight: FontWeight.w400,
),
),

View File

@@ -33,6 +33,8 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
@override
String get builderId => 'reservation';
C_ReservationController();
final DateTime _now = DateTime.now();
// 计算当前时间属于哪个1小时区间
@@ -583,12 +585,6 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
}
}
@override
void onPaused() {
stopAutoRefresh();
super.onPaused();
}
void startAutoRefresh() {
// 先停止已存在的定时器,防止重复启动
stopAutoRefresh();
@@ -782,7 +778,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
if (stationOptions.isEmpty) {
showToast('附近暂无可用加氢站');
} else {
showToast('站点列表已刷新');
// showToast('站点列表已刷新');
}
// 找到第一个可选的站点作为默认值
@@ -828,8 +824,30 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
return '$hour:$minute';
}
@override
void onDetached() {
super.onDetached();
Logger.d('aaa-onDetached');
}
@override
void onHidden() {
super.onHidden();
Logger.d('aaa-onHidden');
}
@override
void onPaused() {
super.onPaused();
Logger.d('aaa-onPaused');
stopAutoRefresh();
}
@override
void onClose() {
super.onClose();
Logger.d('aaa-onClose');
amountController.dispose();
plateNumberController.dispose();
if (_debounce != null) {
@@ -837,6 +855,6 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
}
_sheetWorker?.dispose();
stopAutoRefresh();
super.onClose();
}
}

View File

@@ -1,17 +1,12 @@
import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:getx_scaffold/getx_scaffold.dart';
import 'package:ln_jq_app/common/login_util.dart';
import 'package:ln_jq_app/common/model/station_model.dart';
import 'package:ln_jq_app/common/styles/theme.dart';
import 'package:ln_jq_app/pages/c_page/message/view.dart';
import 'package:ln_jq_app/pages/qr_code/view.dart';
import 'package:ln_jq_app/storage_service.dart';
import 'controller.dart';
import 'reservation_list_bottomsheet.dart';
///加氢预约
class ReservationPage extends GetView<C_ReservationController> {

View File

@@ -68,13 +68,14 @@ class _LoginPageState extends State<LoginPage> with SingleTickerProviderStateMix
return Scaffold(
backgroundColor: Colors.white,
resizeToAvoidBottomInset: false,
body: GestureDetector(
onTap: () {
hideKeyboard();
},
child: Stack(
children: [
// 1. 顶部背景与装饰
//顶部背景与装饰
Positioned(
top: 0,
left: 0,
@@ -92,9 +93,9 @@ class _LoginPageState extends State<LoginPage> with SingleTickerProviderStateMix
),
_buildBrandingHeader(),
// 2. 登录表单主体
// 登录表单主体
Positioned(
top: 280.h,
top: 300.h,
left: 0,
right: 0,
bottom: 0,