无预约
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 573 B After Width: | Height: | Size: 947 B |
Binary file not shown.
|
Before Width: | Height: | Size: 508 B After Width: | Height: | Size: 594 B |
@@ -124,8 +124,8 @@ class ReservationModel {
|
|||||||
plateNumber: json['plateNumber']?.toString() ?? '---',
|
plateNumber: json['plateNumber']?.toString() ?? '---',
|
||||||
amount: '${json['hydAmount']?.toString() ?? '0'}kg',
|
amount: '${json['hydAmount']?.toString() ?? '0'}kg',
|
||||||
time: timeRange,
|
time: timeRange,
|
||||||
contactPerson: json['contacts']?.toString() ?? '无联系人',
|
contactPerson: json['contacts']?.toString() ?? '',
|
||||||
contactPhone: json['phone']?.toString() ?? '无联系电话',
|
contactPhone: json['phone']?.toString() ?? '',
|
||||||
status: currentStatus,
|
status: currentStatus,
|
||||||
|
|
||||||
// 新增的完整字段
|
// 新增的完整字段
|
||||||
@@ -315,11 +315,46 @@ class SiteController extends GetxController with BaseControllerMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// 确认预约弹窗重构
|
/// 确认预约弹窗重构
|
||||||
Future<void> confirmReservation(String id, {bool isEdit = false}) async {
|
Future<void> confirmReservation(
|
||||||
final item = reservationList.firstWhere(
|
String id, {
|
||||||
(item) => item.id == id,
|
bool isEdit = false,
|
||||||
orElse: () => throw Exception('Reservation not found'),
|
bool isAdd = false,
|
||||||
);
|
}) async {
|
||||||
|
ReservationModel item;
|
||||||
|
if (isAdd) {
|
||||||
|
// 如果是无预约车辆加氢,创建一个临时 model
|
||||||
|
item = ReservationModel(
|
||||||
|
id: "",
|
||||||
|
stationId: StorageService.to.userId ?? "",
|
||||||
|
plateNumber: "---",
|
||||||
|
amount: "0.000",
|
||||||
|
time: "",
|
||||||
|
contactPerson: "",
|
||||||
|
contactPhone: "",
|
||||||
|
hasEdit: true,
|
||||||
|
contacts: "",
|
||||||
|
phone: "",
|
||||||
|
stationName: name,
|
||||||
|
startTime: "",
|
||||||
|
endTime: "",
|
||||||
|
date: "",
|
||||||
|
hydAmount: "0.000",
|
||||||
|
state: "",
|
||||||
|
stateName: "",
|
||||||
|
addStatus: "",
|
||||||
|
addStatusName: "",
|
||||||
|
rejectReason: "",
|
||||||
|
isTruckAttachment: 0,
|
||||||
|
hasDrivingAttachment: false,
|
||||||
|
hasHydrogenationAttachment: false,
|
||||||
|
isEdit: "0",
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
item = reservationList.firstWhere(
|
||||||
|
(item) => item.id == id,
|
||||||
|
orElse: () => throw Exception('Reservation not found'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// 加氢量保留3位小数
|
// 加氢量保留3位小数
|
||||||
double initialAmount = double.tryParse(item.hydAmount) ?? 0.0;
|
double initialAmount = double.tryParse(item.hydAmount) ?? 0.0;
|
||||||
@@ -341,242 +376,212 @@ class SiteController extends GetxController with BaseControllerMixin {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
isEdit ? '修改加氢量' : '确认加氢状态',
|
isAdd ? "无预约车辆加氢" : (isEdit ? '修改加氢量' : '确认加氢状态'),
|
||||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
|
|
||||||
// 车牌号及标签
|
// 车牌号及标签
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
item.plateNumber == "---" ? '-------' : item.plateNumber,
|
item.plateNumber == "---" ? '-------' : item.plateNumber,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16.sp,
|
fontSize: 16.sp,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color: item.plateNumber == "---" ? Colors.grey : Colors.black,
|
color: item.plateNumber == "---" ? Colors.grey : Colors.black,
|
||||||
letterSpacing: item.plateNumber == "---" ? 2 : 0,
|
letterSpacing: item.plateNumber == "---" ? 2 : 0,
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
),
|
||||||
Container(
|
const SizedBox(width: 8),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
isEdit
|
||||||
decoration: BoxDecoration(
|
? SizedBox()
|
||||||
color: Color.fromRGBO(232, 243, 255, 1),
|
: Container(
|
||||||
borderRadius: BorderRadius.circular(4),
|
padding: const EdgeInsets.symmetric(
|
||||||
),
|
horizontal: 8,
|
||||||
child: Text(
|
vertical: 2,
|
||||||
item.plateNumber == "---" ? '车牌号识别' : '重新识别',
|
),
|
||||||
style: TextStyle(
|
decoration: BoxDecoration(
|
||||||
color: Color.fromRGBO(22, 93, 255, 1),
|
color: Color.fromRGBO(232, 243, 255, 1),
|
||||||
fontSize: 13.sp,
|
borderRadius: BorderRadius.circular(4),
|
||||||
fontWeight: FontWeight.bold,
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(width: 16.w),
|
|
||||||
if (item.plateNumber != "---" && item.hasDrivingAttachment)
|
|
||||||
_buildInfoTag('行驶证'),
|
|
||||||
if (item.plateNumber != "---" && item.hasHydrogenationAttachment)
|
|
||||||
_buildInfoTag('加氢证'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
|
|
||||||
// 提示逻辑
|
|
||||||
if (isEdit)
|
|
||||||
const Text(
|
|
||||||
'每个订单只能修改一次,请确认加氢量准确无误',
|
|
||||||
style: TextStyle(color: Colors.red, fontSize: 12),
|
|
||||||
)
|
|
||||||
else
|
|
||||||
if (item.plateNumber == "---" || item.isTruckAttachment == 0)
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
const Expanded(
|
|
||||||
child: Text(
|
child: Text(
|
||||||
'车辆未上传加氢证,请完成线下登记',
|
item.plateNumber == "---" ? '车牌号识别' : '重新识别',
|
||||||
style: TextStyle(color: Colors.red, fontSize: 12),
|
style: TextStyle(
|
||||||
|
color: Color.fromRGBO(22, 93, 255, 1),
|
||||||
|
fontSize: 13.sp,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Obx(
|
SizedBox(width: 16.w),
|
||||||
() =>
|
if (item.plateNumber != "---" && item.hasDrivingAttachment)
|
||||||
Checkbox(
|
_buildInfoTag('行驶证'),
|
||||||
value: isOfflineChecked.value,
|
if (item.plateNumber != "---" && item.hasHydrogenationAttachment)
|
||||||
onChanged: (v) => isOfflineChecked.value = v ?? false,
|
_buildInfoTag('加氢证'),
|
||||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
],
|
||||||
activeColor: AppTheme.themeColor,
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
|
|
||||||
const SizedBox(height: 16),
|
SizedBox(height: 6.h),
|
||||||
|
|
||||||
// 预定加氢量输入区
|
// 提示逻辑
|
||||||
Container(
|
if (isEdit)
|
||||||
padding: const EdgeInsets.all(16),
|
Text(
|
||||||
decoration: BoxDecoration(
|
'每个订单只能修改一次,请确认加氢量准确无误',
|
||||||
color: const Color(0xFFF7F8FA),
|
style: TextStyle(
|
||||||
borderRadius: BorderRadius.circular(12),
|
color: Colors.red,
|
||||||
|
fontSize: 12.sp,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
),
|
),
|
||||||
child: Row(
|
)
|
||||||
children: [
|
else if (item.plateNumber == "---" || item.isTruckAttachment == 0)
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'预定加氢量',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Color.fromRGBO(51, 51, 51, 1),
|
|
||||||
fontSize: 14.sp,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 4),
|
|
||||||
Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.baseline,
|
|
||||||
textBaseline: TextBaseline.alphabetic,
|
|
||||||
children: [
|
|
||||||
IntrinsicWidth(
|
|
||||||
child: TextField(
|
|
||||||
controller: amountController,
|
|
||||||
keyboardType: const TextInputType.numberWithOptions(
|
|
||||||
decimal: true,
|
|
||||||
),
|
|
||||||
inputFormatters: [
|
|
||||||
// 限制最多输入3位小数
|
|
||||||
FilteringTextInputFormatter.allow(
|
|
||||||
RegExp(r'^\d+\.?\d{0,3}'),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 24,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: Color(0xFF017143),
|
|
||||||
),
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
enabledBorder: UnderlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Color(0xFF017143),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
focusedBorder: const UnderlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Color(0xFF017143),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
isDense: true,
|
|
||||||
contentPadding: EdgeInsets.zero,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const Text(
|
|
||||||
' KG',
|
|
||||||
style: TextStyle(color: Colors.grey, fontSize: 14),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 12,
|
|
||||||
vertical: 8,
|
|
||||||
),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: const Color(0xFF017143),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: const Row(
|
|
||||||
children: [
|
|
||||||
Icon(Icons.qr_code_scanner, color: Colors.white, size: 18),
|
|
||||||
SizedBox(width: 4),
|
|
||||||
Text(
|
|
||||||
'识别',
|
|
||||||
style: TextStyle(color: Colors.white, fontSize: 14),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
|
|
||||||
// 加氢枪号选择
|
|
||||||
const Text(
|
|
||||||
'请选择加氢枪号',
|
|
||||||
style: TextStyle(color: Colors.grey, fontSize: 12),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
Obx(
|
|
||||||
() =>
|
|
||||||
Container(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border.all(color: Colors.grey.shade300),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: DropdownButtonHideUnderline(
|
|
||||||
child: DropdownButton<String>(
|
|
||||||
value: selectedGun.value.isEmpty ? null : selectedGun.value,
|
|
||||||
isExpanded: true,
|
|
||||||
hint: const Text('请选择加氢枪号'),
|
|
||||||
items: gasGunList.map((String gun) {
|
|
||||||
return DropdownMenuItem<String>(
|
|
||||||
value: gun, child: Text(gun));
|
|
||||||
}).toList(),
|
|
||||||
onChanged: (v) => selectedGun.value = v ?? '',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
const SizedBox(height: 24),
|
|
||||||
|
|
||||||
// 按钮
|
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
child: Text(
|
||||||
child: ElevatedButton(
|
'车辆未上传加氢证,请完成线下登记',
|
||||||
onPressed: () {
|
style: TextStyle(
|
||||||
//加氢后 订单编辑
|
color: Colors.red,
|
||||||
if (isEdit) {
|
fontSize: 12.sp,
|
||||||
final num addHydAmount =
|
fontWeight: FontWeight.w400,
|
||||||
num.tryParse(amountController.text) ?? 0;
|
),
|
||||||
upDataService(
|
),
|
||||||
id,
|
),
|
||||||
0,
|
Obx(
|
||||||
1,
|
() => Checkbox(
|
||||||
addHydAmount,
|
value: isOfflineChecked.value,
|
||||||
"",
|
onChanged: (v) => isOfflineChecked.value = v ?? false,
|
||||||
item,
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||||
gunNumber: selectedGun.value,
|
activeColor: AppTheme.themeColor,
|
||||||
plateNumber: item.plateNumber,
|
),
|
||||||
isEdit: true
|
),
|
||||||
);
|
],
|
||||||
Get.back();
|
),
|
||||||
return;
|
|
||||||
}
|
SizedBox(height: 6.h),
|
||||||
//订单确认
|
|
||||||
if (!isEdit &&
|
// 预定加氢量输入区
|
||||||
(item.plateNumber == "---" ||
|
Container(
|
||||||
item.isTruckAttachment == 0) &&
|
padding: const EdgeInsets.all(16),
|
||||||
!isOfflineChecked.value) {
|
decoration: BoxDecoration(
|
||||||
showToast("车辆未上传加氢证 , 请确保线下登记后点击确认");
|
color: const Color(0xFFF7F8FA),
|
||||||
return;
|
borderRadius: BorderRadius.circular(12),
|
||||||
}
|
),
|
||||||
if (selectedGun.value.isEmpty) {
|
child: Row(
|
||||||
showToast("请选择加氢枪号");
|
children: [
|
||||||
return;
|
Expanded(
|
||||||
}
|
child: Column(
|
||||||
Get.back();
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'预定加氢量',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Color.fromRGBO(51, 51, 51, 1),
|
||||||
|
fontSize: 14.sp,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.baseline,
|
||||||
|
textBaseline: TextBaseline.alphabetic,
|
||||||
|
children: [
|
||||||
|
IntrinsicWidth(
|
||||||
|
child: TextField(
|
||||||
|
controller: amountController,
|
||||||
|
keyboardType: const TextInputType.numberWithOptions(
|
||||||
|
decimal: true,
|
||||||
|
),
|
||||||
|
inputFormatters: [
|
||||||
|
// 限制最多输入3位小数
|
||||||
|
FilteringTextInputFormatter.allow(
|
||||||
|
RegExp(r'^\d+\.?\d{0,3}'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 24,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Color(0xFF017143),
|
||||||
|
),
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
enabledBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0xFF017143)),
|
||||||
|
),
|
||||||
|
focusedBorder: const UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Color(0xFF017143)),
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.zero,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Text(
|
||||||
|
' KG',
|
||||||
|
style: TextStyle(color: Colors.grey, fontSize: 14),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: const Color(0xFF017143),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: const Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.qr_code_scanner, color: Colors.white, size: 18),
|
||||||
|
SizedBox(width: 4),
|
||||||
|
Text(
|
||||||
|
'识别',
|
||||||
|
style: TextStyle(color: Colors.white, fontSize: 14),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
|
||||||
|
// 加氢枪号选择
|
||||||
|
const Text('请选择加氢枪号', style: TextStyle(color: Colors.grey, fontSize: 12)),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Obx(
|
||||||
|
() => Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: Colors.grey.shade300),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: DropdownButtonHideUnderline(
|
||||||
|
child: DropdownButton<String>(
|
||||||
|
value: selectedGun.value.isEmpty ? null : selectedGun.value,
|
||||||
|
isExpanded: true,
|
||||||
|
hint: const Text('请选择加氢枪号'),
|
||||||
|
items: gasGunList.map((String gun) {
|
||||||
|
return DropdownMenuItem<String>(value: gun, child: Text(gun));
|
||||||
|
}).toList(),
|
||||||
|
onChanged: (v) => selectedGun.value = v ?? '',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
const SizedBox(height: 24),
|
||||||
|
|
||||||
|
// 按钮
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
//加氢后 订单编辑
|
||||||
|
if (isEdit) {
|
||||||
final num addHydAmount =
|
final num addHydAmount =
|
||||||
num.tryParse(amountController.text) ?? 0;
|
num.tryParse(amountController.text) ?? 0;
|
||||||
upDataService(
|
upDataService(
|
||||||
@@ -588,86 +593,134 @@ class SiteController extends GetxController with BaseControllerMixin {
|
|||||||
item,
|
item,
|
||||||
gunNumber: selectedGun.value,
|
gunNumber: selectedGun.value,
|
||||||
plateNumber: item.plateNumber,
|
plateNumber: item.plateNumber,
|
||||||
|
isEdit: true,
|
||||||
);
|
);
|
||||||
},
|
|
||||||
style: ElevatedButton.styleFrom(
|
|
||||||
backgroundColor: const Color(0xFF017143),
|
|
||||||
minimumSize: const Size(double.infinity, 48),
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
elevation: 0,
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
isEdit ? '确认修改' : '确认加氢',
|
|
||||||
style: const TextStyle(color: Colors.white, fontSize: 16),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 12),
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
child: OutlinedButton(
|
|
||||||
onPressed: () {
|
|
||||||
Get.back();
|
Get.back();
|
||||||
if (!isEdit) {
|
return;
|
||||||
upDataService(
|
}
|
||||||
id,
|
//订单确认
|
||||||
0,
|
if (!isEdit &&
|
||||||
2,
|
(item.plateNumber == "---" ||
|
||||||
0,
|
item.isTruckAttachment == 0) &&
|
||||||
"",
|
!isOfflineChecked.value) {
|
||||||
item,
|
showToast("车辆未上传加氢证 , 请确保线下登记后点击确认");
|
||||||
gunNumber: selectedGun.value,
|
return;
|
||||||
plateNumber: item.plateNumber,
|
}
|
||||||
);
|
if (selectedGun.value.isEmpty) {
|
||||||
}
|
showToast("请选择加氢枪号");
|
||||||
},
|
return;
|
||||||
style: OutlinedButton.styleFrom(
|
}
|
||||||
minimumSize: const Size(double.infinity, 48),
|
//无预约订单
|
||||||
side: BorderSide(color: Colors.grey.shade300),
|
if (isAdd) {
|
||||||
shape: RoundedRectangleBorder(
|
final num addHydAmount =
|
||||||
borderRadius: BorderRadius.circular(8),
|
num.tryParse(amountController.text) ?? 0;
|
||||||
),
|
upDataService(
|
||||||
),
|
id,
|
||||||
child: Text(
|
0,
|
||||||
isEdit ? '取消' : '未加氢',
|
1,
|
||||||
style: const TextStyle(color: Colors.grey, fontSize: 16),
|
addHydAmount,
|
||||||
|
"",
|
||||||
|
item,
|
||||||
|
gunNumber: selectedGun.value,
|
||||||
|
plateNumber: item.plateNumber,
|
||||||
|
isAdd: true,
|
||||||
|
);
|
||||||
|
Get.back();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//有预约订单确认
|
||||||
|
Get.back();
|
||||||
|
final num addHydAmount =
|
||||||
|
num.tryParse(amountController.text) ?? 0;
|
||||||
|
upDataService(
|
||||||
|
id,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
addHydAmount,
|
||||||
|
"",
|
||||||
|
item,
|
||||||
|
gunNumber: selectedGun.value,
|
||||||
|
plateNumber: item.plateNumber,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: const Color(0xFF017143),
|
||||||
|
minimumSize: const Size(double.infinity, 48),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
|
elevation: 0,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
isEdit ? '确认修改' : '确认加氢',
|
||||||
|
style: const TextStyle(color: Colors.white, fontSize: 16),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
const SizedBox(width: 12),
|
||||||
|
Expanded(
|
||||||
|
flex: 1,
|
||||||
|
child: OutlinedButton(
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
if (!isEdit) {
|
||||||
|
upDataService(
|
||||||
|
id,
|
||||||
|
0,
|
||||||
|
2,
|
||||||
|
0,
|
||||||
|
"",
|
||||||
|
item,
|
||||||
|
gunNumber: selectedGun.value,
|
||||||
|
plateNumber: item.plateNumber,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
style: OutlinedButton.styleFrom(
|
||||||
|
minimumSize: const Size(double.infinity, 48),
|
||||||
|
side: BorderSide(color: Colors.grey.shade300),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
isEdit ? '取消' : '未加氢',
|
||||||
|
style: const TextStyle(color: Colors.grey, fontSize: 16),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
const Expanded(
|
const Expanded(
|
||||||
child: Divider(color: Color(0xFFEEEEEE), thickness: 1),
|
child: Divider(color: Color(0xFFEEEEEE), thickness: 1),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () => Get.back(),
|
onTap: () => Get.back(),
|
||||||
child: Text(
|
child: Text(
|
||||||
'暂不处理',
|
'暂不处理',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Color.fromRGBO(16, 185, 129, 1),
|
color: Color.fromRGBO(16, 185, 129, 1),
|
||||||
fontSize: 14.sp,
|
fontSize: 14.sp,
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Expanded(
|
),
|
||||||
child: Divider(color: Color(0xFFEEEEEE), thickness: 1),
|
const Expanded(
|
||||||
),
|
child: Divider(color: Color(0xFFEEEEEE), thickness: 1),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
barrierDismissible: true,
|
barrierDismissible: true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -722,28 +775,27 @@ class SiteController extends GetxController with BaseControllerMixin {
|
|||||||
const Text('选择或填写拒绝原因:', style: TextStyle(color: Colors.grey)),
|
const Text('选择或填写拒绝原因:', style: TextStyle(color: Colors.grey)),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Obx(
|
Obx(
|
||||||
() =>
|
() => Wrap(
|
||||||
Wrap(
|
// 使用 Wrap 自动换行
|
||||||
// 使用 Wrap 自动换行
|
spacing: 8.0, // 水平间距
|
||||||
spacing: 8.0, // 水平间距
|
children: presetReasons.map((reason) {
|
||||||
children: presetReasons.map((reason) {
|
final isSelected = selectedReason.value == reason;
|
||||||
final isSelected = selectedReason.value == reason;
|
return ChoiceChip(
|
||||||
return ChoiceChip(
|
label: Text(reason),
|
||||||
label: Text(reason),
|
selected: isSelected,
|
||||||
selected: isSelected,
|
onSelected: (selected) {
|
||||||
onSelected: (selected) {
|
if (selected) {
|
||||||
if (selected) {
|
selectedReason.value = reason;
|
||||||
selectedReason.value = reason;
|
reasonController.clear(); // 选择预设原因时,清空自定义输入
|
||||||
reasonController.clear(); // 选择预设原因时,清空自定义输入
|
}
|
||||||
}
|
},
|
||||||
},
|
selectedColor: Get.theme.primaryColor.withOpacity(0.2),
|
||||||
selectedColor: Get.theme.primaryColor.withOpacity(0.2),
|
labelStyle: TextStyle(
|
||||||
labelStyle: TextStyle(
|
color: isSelected ? Get.theme.primaryColor : Colors.black,
|
||||||
color: isSelected ? Get.theme.primaryColor : Colors.black,
|
),
|
||||||
),
|
);
|
||||||
);
|
}).toList(),
|
||||||
}).toList(),
|
),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
|
|
||||||
@@ -794,16 +846,14 @@ class SiteController extends GetxController with BaseControllerMixin {
|
|||||||
plateNumber: item.plateNumber,
|
plateNumber: item.plateNumber,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: const Text('确认拒绝', style: TextStyle(color: Colors
|
child: const Text('确认拒绝', style: TextStyle(color: Colors.red)),
|
||||||
.red)),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextButton(
|
child: TextButton(
|
||||||
onPressed: () => Get.back(),
|
onPressed: () => Get.back(),
|
||||||
child: const Text('暂不处理', style: TextStyle(color: Colors
|
child: const Text('暂不处理', style: TextStyle(color: Colors.grey)),
|
||||||
.grey)),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -818,20 +868,32 @@ class SiteController extends GetxController with BaseControllerMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//addStatus 1完成 2未加 -1拒绝
|
//addStatus 1完成 2未加 -1拒绝
|
||||||
void upDataService(String id,
|
void upDataService(
|
||||||
int status,
|
String id,
|
||||||
int addStatus,
|
int status,
|
||||||
num addHydAmount,
|
int addStatus,
|
||||||
String rejectReason,
|
num addHydAmount,
|
||||||
ReservationModel item, {
|
String rejectReason,
|
||||||
String? gunNumber,
|
ReservationModel item, {
|
||||||
String? plateNumber, bool isEdit = false
|
String? gunNumber,
|
||||||
}) async {
|
String? plateNumber,
|
||||||
|
bool isEdit = false,
|
||||||
|
bool isAdd = false,
|
||||||
|
}) async {
|
||||||
showLoading("确认中");
|
showLoading("确认中");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var responseData;
|
var responseData;
|
||||||
if (isEdit) {
|
if (isAdd) {
|
||||||
|
responseData = await HttpService.to.post(
|
||||||
|
'appointment/orderAddHyd/addOfflineOrder',
|
||||||
|
data: {
|
||||||
|
"addHydAmount": addHydAmount,
|
||||||
|
"plateNumber": plateNumber,
|
||||||
|
if (gunNumber != null && gunNumber.isNotEmpty) "gunNumber": gunNumber,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else if (isEdit) {
|
||||||
responseData = await HttpService.to.post(
|
responseData = await HttpService.to.post(
|
||||||
'appointment/orderAddHyd/modifyOrder',
|
'appointment/orderAddHyd/modifyOrder',
|
||||||
data: {
|
data: {
|
||||||
@@ -841,7 +903,7 @@ class SiteController extends GetxController with BaseControllerMixin {
|
|||||||
if (gunNumber != null && gunNumber.isNotEmpty) "gunNumber": gunNumber,
|
if (gunNumber != null && gunNumber.isNotEmpty) "gunNumber": gunNumber,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}else if (addStatus == -1) {
|
} else if (addStatus == -1) {
|
||||||
responseData = await HttpService.to.post(
|
responseData = await HttpService.to.post(
|
||||||
'appointment/orderAddHyd/rejectOrder',
|
'appointment/orderAddHyd/rejectOrder',
|
||||||
data: {
|
data: {
|
||||||
@@ -867,7 +929,6 @@ class SiteController extends GetxController with BaseControllerMixin {
|
|||||||
|
|
||||||
if (responseData == null || responseData.data == null) {
|
if (responseData == null || responseData.data == null) {
|
||||||
dismissLoading();
|
dismissLoading();
|
||||||
showToast('服务暂不可用,请稍后');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var result = BaseModel.fromJson(responseData.data);
|
var result = BaseModel.fromJson(responseData.data);
|
||||||
@@ -922,15 +983,15 @@ class SiteController extends GetxController with BaseControllerMixin {
|
|||||||
orderUnfinishedAmount = result.data["orderUnfinishedAmount"].toString();
|
orderUnfinishedAmount = result.data["orderUnfinishedAmount"].toString();
|
||||||
|
|
||||||
leftHydrogen = leftHydrogen.isEmpty ? "统计中" : leftHydrogen.toString();
|
leftHydrogen = leftHydrogen.isEmpty ? "统计中" : leftHydrogen.toString();
|
||||||
orderTotalAmount =
|
orderTotalAmount = orderTotalAmount.isEmpty ? "统计中" : orderTotalAmount.toString();
|
||||||
orderTotalAmount.isEmpty ? "统计中" : orderTotalAmount.toString();
|
|
||||||
orderUnfinishedAmount = orderUnfinishedAmount.isEmpty
|
orderUnfinishedAmount = orderUnfinishedAmount.isEmpty
|
||||||
? "统计中"
|
? "统计中"
|
||||||
: orderUnfinishedAmount.toString();
|
: orderUnfinishedAmount.toString();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showToast('数据异常');
|
showToast('数据异常');
|
||||||
}
|
}
|
||||||
} catch (e) {} finally {
|
} catch (e) {
|
||||||
|
} finally {
|
||||||
//加载列表数据
|
//加载列表数据
|
||||||
fetchReservationData();
|
fetchReservationData();
|
||||||
|
|
||||||
|
|||||||
@@ -56,17 +56,32 @@ class SitePage extends GetView<SiteController> {
|
|||||||
),
|
),
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Get.to(
|
// 手动录入
|
||||||
() => HistoryPage(),
|
controller.confirmReservation("", isAdd: true);
|
||||||
arguments: {'stationName': controller.name},
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Container(
|
||||||
'历史记录',
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||||
style: TextStyle(
|
decoration: BoxDecoration(
|
||||||
fontSize: 14.sp,
|
color: Colors.white,
|
||||||
fontWeight: FontWeight.bold,
|
borderRadius: BorderRadius.circular(20),
|
||||||
color: Color.fromRGBO(156, 163, 175, 1),
|
border: Border.all(color: const Color(0xFFEEEEEE)),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const Icon(
|
||||||
|
Icons.add_circle_outline,
|
||||||
|
size: 18,
|
||||||
|
color: Color(0xFF666666),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
Text(
|
||||||
|
"无预约车辆加氢",
|
||||||
|
style: TextStyle(
|
||||||
|
color: const Color(0xFF666666),
|
||||||
|
fontSize: 13.sp,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -184,27 +199,7 @@ class SitePage extends GetView<SiteController> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
IconButton(
|
_buildDropdownMenu(),
|
||||||
onPressed: () async {
|
|
||||||
var scanResult = await Get.to(() => const MessagePage());
|
|
||||||
if (scanResult == null) {
|
|
||||||
controller.msgNotice();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
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),
|
const SizedBox(height: 25),
|
||||||
@@ -232,6 +227,40 @@ class SitePage extends GetView<SiteController> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildDropdownMenu() {
|
||||||
|
return PopupMenuButton<String>(
|
||||||
|
icon: Container(child: const Icon(Icons.grid_view_rounded, size: 24)),
|
||||||
|
onSelected: (value) async {
|
||||||
|
if (value == 'message') {
|
||||||
|
var scanResult = await Get.to(() => const MessagePage());
|
||||||
|
if (scanResult == null) {
|
||||||
|
controller.msgNotice();
|
||||||
|
}
|
||||||
|
} else if (value == 'history') {
|
||||||
|
Get.to(() => const HistoryPage(), arguments: {'stationName': controller.name});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
itemBuilder: (context) => [
|
||||||
|
const PopupMenuItem(
|
||||||
|
value: 'message',
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.notifications_none, size: 20),
|
||||||
|
SizedBox(width: 8),
|
||||||
|
Text('消息中心'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const PopupMenuItem(
|
||||||
|
value: 'history',
|
||||||
|
child: Row(
|
||||||
|
children: [Icon(Icons.history, size: 20), SizedBox(width: 8), Text('加氢历史')],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildStatBox(String title, String enTitle, String value, String unit) {
|
Widget _buildStatBox(String title, String enTitle, String value, String unit) {
|
||||||
return Expanded(
|
return Expanded(
|
||||||
child: Container(
|
child: Container(
|
||||||
@@ -508,7 +537,9 @@ class SitePage extends GetView<SiteController> {
|
|||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
// 联系信息
|
// 联系信息
|
||||||
Text(
|
Text(
|
||||||
"${item.contactPerson} | ${item.contactPhone}",
|
item.contactPerson.isEmpty || item.contactPhone.isEmpty
|
||||||
|
? ""
|
||||||
|
: "${item.contactPerson} | ${item.contactPhone}",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Color(0xFF999999),
|
color: Color(0xFF999999),
|
||||||
fontSize: 13.sp,
|
fontSize: 13.sp,
|
||||||
|
|||||||
Reference in New Issue
Block a user