增加弹窗限制条件
This commit is contained in:
@@ -521,15 +521,16 @@ class SiteController extends GetxController with BaseControllerMixin {
|
|||||||
}
|
}
|
||||||
dismissLoading();
|
dismissLoading();
|
||||||
|
|
||||||
//addStatus 1完成 2未加 -1拒绝
|
//1完成 2未加 -1拒绝
|
||||||
if (addStatus == 1) {
|
if (addStatus == 1) {
|
||||||
item.status = ReservationStatus.completed;
|
item.status = ReservationStatus.completed;
|
||||||
item.amount = "${addHydAmount}kg";
|
item.amount = "${addHydAmount}kg";
|
||||||
} else if (addStatus == -1) {
|
} else if (addStatus == -1) {
|
||||||
item.status = ReservationStatus.rejected;
|
item.status = ReservationStatus.rejected;
|
||||||
} else if (addStatus == 2) {
|
} else if (addStatus == 2) {
|
||||||
item.status = ReservationStatus.pending;
|
item.status = ReservationStatus.unadded;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateUi();
|
updateUi();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
dismissLoading();
|
dismissLoading();
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class CarInfoController extends GetxController with BaseControllerMixin {
|
|||||||
void onReady() {
|
void onReady() {
|
||||||
super.onReady();
|
super.onReady();
|
||||||
// 如果未绑定车辆,且本次会话尚未提示过,则弹出提示
|
// 如果未绑定车辆,且本次会话尚未提示过,则弹出提示
|
||||||
if (!StorageService.to.hasShownBindVehicleDialog) {
|
if (!StorageService.to.hasShownBindVehicleDialog && StorageService.to.isLoggedIn) {
|
||||||
Future.delayed(const Duration(milliseconds: 500), () {
|
Future.delayed(const Duration(milliseconds: 500), () {
|
||||||
DialogX.to.showConfirmDialog(
|
DialogX.to.showConfirmDialog(
|
||||||
title: '当前尚未绑定车辆',
|
title: '当前尚未绑定车辆',
|
||||||
|
|||||||
@@ -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';
|
||||||
@@ -116,8 +118,12 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
),
|
),
|
||||||
CupertinoButton(
|
CupertinoButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
final bool isChangingToToday = tempDate.isAtSameMomentAs(today) && !selectedDate.value.isAtSameMomentAs(today);
|
final bool isChangingToToday =
|
||||||
final bool isDateChanged = !tempDate.isAtSameMomentAs(selectedDate.value);
|
tempDate.isAtSameMomentAs(today) &&
|
||||||
|
!selectedDate.value.isAtSameMomentAs(today);
|
||||||
|
final bool isDateChanged = !tempDate.isAtSameMomentAs(
|
||||||
|
selectedDate.value,
|
||||||
|
);
|
||||||
|
|
||||||
// 更新选中的日期
|
// 更新选中的日期
|
||||||
selectedDate.value = tempDate;
|
selectedDate.value = tempDate;
|
||||||
@@ -144,8 +150,10 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
child: CupertinoDatePicker(
|
child: CupertinoDatePicker(
|
||||||
mode: CupertinoDatePickerMode.date,
|
mode: CupertinoDatePickerMode.date,
|
||||||
initialDateTime: selectedDate.value,
|
initialDateTime: selectedDate.value,
|
||||||
minimumDate: today, // 最小可选日期为今天
|
minimumDate: today,
|
||||||
maximumDate: tomorrow, // 最大可选日期为明天
|
// 最小可选日期为今天
|
||||||
|
maximumDate: tomorrow,
|
||||||
|
// 最大可选日期为明天
|
||||||
// ---------------------
|
// ---------------------
|
||||||
onDateTimeChanged: (DateTime newDate) {
|
onDateTimeChanged: (DateTime newDate) {
|
||||||
tempDate = newDate;
|
tempDate = newDate;
|
||||||
@@ -424,7 +432,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
);
|
);
|
||||||
|
|
||||||
//打开预约列表
|
//打开预约列表
|
||||||
Future.delayed(const Duration(milliseconds: 800), () {
|
Future.delayed(const Duration(milliseconds: 500), () {
|
||||||
getReservationList();
|
getReservationList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -442,8 +450,16 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
// 新增预约数据列表
|
// 新增预约数据列表
|
||||||
List<ReservationModel> reservationList = [];
|
List<ReservationModel> reservationList = [];
|
||||||
|
|
||||||
|
// --- 用于防抖的 Timer ---
|
||||||
|
Timer? _debounce;
|
||||||
|
|
||||||
//查看预约列表
|
//查看预约列表
|
||||||
void getReservationList() async {
|
void getReservationList() async {
|
||||||
|
if (_debounce?.isActive ?? false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_debounce = Timer(const Duration(seconds: 1), () {});
|
||||||
|
|
||||||
showLoading("加载中");
|
showLoading("加载中");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -596,7 +612,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
!reservation.hasEdit
|
!reservation.hasEdit || plateNumber.isEmpty
|
||||||
? SizedBox()
|
? SizedBox()
|
||||||
: GestureDetector(
|
: GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
@@ -837,7 +853,7 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
HttpService.to.dio.options.headers = originalHeaders;
|
HttpService.to.dio.options.headers = originalHeaders;
|
||||||
|
|
||||||
// 如果未绑定车辆,且本次会话尚未提示过,则弹出提示
|
// 如果未绑定车辆,且本次会话尚未提示过,则弹出提示
|
||||||
if (!StorageService.to.hasShownBindVehicleDialog) {
|
if (!StorageService.to.hasShownBindVehicleDialog && StorageService.to.isLoggedIn) {
|
||||||
Future.delayed(const Duration(milliseconds: 500), () {
|
Future.delayed(const Duration(milliseconds: 500), () {
|
||||||
DialogX.to.showConfirmDialog(
|
DialogX.to.showConfirmDialog(
|
||||||
title: '当前尚未绑定车辆',
|
title: '当前尚未绑定车辆',
|
||||||
@@ -864,6 +880,9 @@ class C_ReservationController extends GetxController with BaseControllerMixin {
|
|||||||
void onClose() {
|
void onClose() {
|
||||||
amountController.dispose();
|
amountController.dispose();
|
||||||
plateNumberController.dispose();
|
plateNumberController.dispose();
|
||||||
|
if (_debounce != null) {
|
||||||
|
_debounce?.cancel();
|
||||||
|
}
|
||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user