无预约
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() ?? '---',
|
||||
amount: '${json['hydAmount']?.toString() ?? '0'}kg',
|
||||
time: timeRange,
|
||||
contactPerson: json['contacts']?.toString() ?? '无联系人',
|
||||
contactPhone: json['phone']?.toString() ?? '无联系电话',
|
||||
contactPerson: json['contacts']?.toString() ?? '',
|
||||
contactPhone: json['phone']?.toString() ?? '',
|
||||
status: currentStatus,
|
||||
|
||||
// 新增的完整字段
|
||||
@@ -315,11 +315,46 @@ class SiteController extends GetxController with BaseControllerMixin {
|
||||
}
|
||||
|
||||
/// 确认预约弹窗重构
|
||||
Future<void> confirmReservation(String id, {bool isEdit = false}) async {
|
||||
final item = reservationList.firstWhere(
|
||||
(item) => item.id == id,
|
||||
orElse: () => throw Exception('Reservation not found'),
|
||||
);
|
||||
Future<void> confirmReservation(
|
||||
String id, {
|
||||
bool isEdit = false,
|
||||
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位小数
|
||||
double initialAmount = double.tryParse(item.hydAmount) ?? 0.0;
|
||||
@@ -341,242 +376,212 @@ class SiteController extends GetxController with BaseControllerMixin {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
isEdit ? '修改加氢量' : '确认加氢状态',
|
||||
isAdd ? "无预约车辆加氢" : (isEdit ? '修改加氢量' : '确认加氢状态'),
|
||||
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 车牌号及标签
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
item.plateNumber == "---" ? '-------' : item.plateNumber,
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: item.plateNumber == "---" ? Colors.grey : Colors.black,
|
||||
letterSpacing: item.plateNumber == "---" ? 2 : 0,
|
||||
),
|
||||
// 车牌号及标签
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
item.plateNumber == "---" ? '-------' : item.plateNumber,
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: item.plateNumber == "---" ? Colors.grey : Colors.black,
|
||||
letterSpacing: item.plateNumber == "---" ? 2 : 0,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(232, 243, 255, 1),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(
|
||||
item.plateNumber == "---" ? '车牌号识别' : '重新识别',
|
||||
style: TextStyle(
|
||||
color: Color.fromRGBO(22, 93, 255, 1),
|
||||
fontSize: 13.sp,
|
||||
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(
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
isEdit
|
||||
? SizedBox()
|
||||
: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 2,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(232, 243, 255, 1),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(
|
||||
'车辆未上传加氢证,请完成线下登记',
|
||||
style: TextStyle(color: Colors.red, fontSize: 12),
|
||||
item.plateNumber == "---" ? '车牌号识别' : '重新识别',
|
||||
style: TextStyle(
|
||||
color: Color.fromRGBO(22, 93, 255, 1),
|
||||
fontSize: 13.sp,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() =>
|
||||
Checkbox(
|
||||
value: isOfflineChecked.value,
|
||||
onChanged: (v) => isOfflineChecked.value = v ?? false,
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
activeColor: AppTheme.themeColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 16.w),
|
||||
if (item.plateNumber != "---" && item.hasDrivingAttachment)
|
||||
_buildInfoTag('行驶证'),
|
||||
if (item.plateNumber != "---" && item.hasHydrogenationAttachment)
|
||||
_buildInfoTag('加氢证'),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
SizedBox(height: 6.h),
|
||||
|
||||
// 预定加氢量输入区
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF7F8FA),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
// 提示逻辑
|
||||
if (isEdit)
|
||||
Text(
|
||||
'每个订单只能修改一次,请确认加氢量准确无误',
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
fontSize: 12.sp,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
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),
|
||||
|
||||
// 按钮
|
||||
)
|
||||
else if (item.plateNumber == "---" || item.isTruckAttachment == 0)
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
//加氢后 订单编辑
|
||||
if (isEdit) {
|
||||
final num addHydAmount =
|
||||
num.tryParse(amountController.text) ?? 0;
|
||||
upDataService(
|
||||
id,
|
||||
0,
|
||||
1,
|
||||
addHydAmount,
|
||||
"",
|
||||
item,
|
||||
gunNumber: selectedGun.value,
|
||||
plateNumber: item.plateNumber,
|
||||
isEdit: true
|
||||
);
|
||||
Get.back();
|
||||
return;
|
||||
}
|
||||
//订单确认
|
||||
if (!isEdit &&
|
||||
(item.plateNumber == "---" ||
|
||||
item.isTruckAttachment == 0) &&
|
||||
!isOfflineChecked.value) {
|
||||
showToast("车辆未上传加氢证 , 请确保线下登记后点击确认");
|
||||
return;
|
||||
}
|
||||
if (selectedGun.value.isEmpty) {
|
||||
showToast("请选择加氢枪号");
|
||||
return;
|
||||
}
|
||||
Get.back();
|
||||
child: Text(
|
||||
'车辆未上传加氢证,请完成线下登记',
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
fontSize: 12.sp,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() => Checkbox(
|
||||
value: isOfflineChecked.value,
|
||||
onChanged: (v) => isOfflineChecked.value = v ?? false,
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
activeColor: AppTheme.themeColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
SizedBox(height: 6.h),
|
||||
|
||||
// 预定加氢量输入区
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF7F8FA),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
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(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
//加氢后 订单编辑
|
||||
if (isEdit) {
|
||||
final num addHydAmount =
|
||||
num.tryParse(amountController.text) ?? 0;
|
||||
upDataService(
|
||||
@@ -588,86 +593,134 @@ class SiteController extends GetxController with BaseControllerMixin {
|
||||
item,
|
||||
gunNumber: selectedGun.value,
|
||||
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();
|
||||
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),
|
||||
return;
|
||||
}
|
||||
//订单确认
|
||||
if (!isEdit &&
|
||||
(item.plateNumber == "---" ||
|
||||
item.isTruckAttachment == 0) &&
|
||||
!isOfflineChecked.value) {
|
||||
showToast("车辆未上传加氢证 , 请确保线下登记后点击确认");
|
||||
return;
|
||||
}
|
||||
if (selectedGun.value.isEmpty) {
|
||||
showToast("请选择加氢枪号");
|
||||
return;
|
||||
}
|
||||
//无预约订单
|
||||
if (isAdd) {
|
||||
final num addHydAmount =
|
||||
num.tryParse(amountController.text) ?? 0;
|
||||
upDataService(
|
||||
id,
|
||||
0,
|
||||
1,
|
||||
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),
|
||||
Row(
|
||||
children: [
|
||||
const Expanded(
|
||||
child: Divider(color: Color(0xFFEEEEEE), thickness: 1),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: GestureDetector(
|
||||
onTap: () => Get.back(),
|
||||
child: Text(
|
||||
'暂不处理',
|
||||
style: TextStyle(
|
||||
color: Color.fromRGBO(16, 185, 129, 1),
|
||||
fontSize: 14.sp,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
const Expanded(
|
||||
child: Divider(color: Color(0xFFEEEEEE), thickness: 1),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: GestureDetector(
|
||||
onTap: () => Get.back(),
|
||||
child: Text(
|
||||
'暂不处理',
|
||||
style: TextStyle(
|
||||
color: Color.fromRGBO(16, 185, 129, 1),
|
||||
fontSize: 14.sp,
|
||||
),
|
||||
),
|
||||
),
|
||||
const Expanded(
|
||||
child: Divider(color: Color(0xFFEEEEEE), thickness: 1),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Expanded(
|
||||
child: Divider(color: Color(0xFFEEEEEE), thickness: 1),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
barrierDismissible: true,
|
||||
);
|
||||
}
|
||||
@@ -722,28 +775,27 @@ class SiteController extends GetxController with BaseControllerMixin {
|
||||
const Text('选择或填写拒绝原因:', style: TextStyle(color: Colors.grey)),
|
||||
const SizedBox(height: 8),
|
||||
Obx(
|
||||
() =>
|
||||
Wrap(
|
||||
// 使用 Wrap 自动换行
|
||||
spacing: 8.0, // 水平间距
|
||||
children: presetReasons.map((reason) {
|
||||
final isSelected = selectedReason.value == reason;
|
||||
return ChoiceChip(
|
||||
label: Text(reason),
|
||||
selected: isSelected,
|
||||
onSelected: (selected) {
|
||||
if (selected) {
|
||||
selectedReason.value = reason;
|
||||
reasonController.clear(); // 选择预设原因时,清空自定义输入
|
||||
}
|
||||
},
|
||||
selectedColor: Get.theme.primaryColor.withOpacity(0.2),
|
||||
labelStyle: TextStyle(
|
||||
color: isSelected ? Get.theme.primaryColor : Colors.black,
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
() => Wrap(
|
||||
// 使用 Wrap 自动换行
|
||||
spacing: 8.0, // 水平间距
|
||||
children: presetReasons.map((reason) {
|
||||
final isSelected = selectedReason.value == reason;
|
||||
return ChoiceChip(
|
||||
label: Text(reason),
|
||||
selected: isSelected,
|
||||
onSelected: (selected) {
|
||||
if (selected) {
|
||||
selectedReason.value = reason;
|
||||
reasonController.clear(); // 选择预设原因时,清空自定义输入
|
||||
}
|
||||
},
|
||||
selectedColor: Get.theme.primaryColor.withOpacity(0.2),
|
||||
labelStyle: TextStyle(
|
||||
color: isSelected ? Get.theme.primaryColor : Colors.black,
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
@@ -794,16 +846,14 @@ class SiteController extends GetxController with BaseControllerMixin {
|
||||
plateNumber: item.plateNumber,
|
||||
);
|
||||
},
|
||||
child: const Text('确认拒绝', style: TextStyle(color: Colors
|
||||
.red)),
|
||||
child: const Text('确认拒绝', style: TextStyle(color: Colors.red)),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: TextButton(
|
||||
onPressed: () => Get.back(),
|
||||
child: const Text('暂不处理', style: TextStyle(color: Colors
|
||||
.grey)),
|
||||
child: const Text('暂不处理', style: TextStyle(color: Colors.grey)),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -818,20 +868,32 @@ class SiteController extends GetxController with BaseControllerMixin {
|
||||
}
|
||||
|
||||
//addStatus 1完成 2未加 -1拒绝
|
||||
void upDataService(String id,
|
||||
int status,
|
||||
int addStatus,
|
||||
num addHydAmount,
|
||||
String rejectReason,
|
||||
ReservationModel item, {
|
||||
String? gunNumber,
|
||||
String? plateNumber, bool isEdit = false
|
||||
}) async {
|
||||
void upDataService(
|
||||
String id,
|
||||
int status,
|
||||
int addStatus,
|
||||
num addHydAmount,
|
||||
String rejectReason,
|
||||
ReservationModel item, {
|
||||
String? gunNumber,
|
||||
String? plateNumber,
|
||||
bool isEdit = false,
|
||||
bool isAdd = false,
|
||||
}) async {
|
||||
showLoading("确认中");
|
||||
|
||||
try {
|
||||
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(
|
||||
'appointment/orderAddHyd/modifyOrder',
|
||||
data: {
|
||||
@@ -841,7 +903,7 @@ class SiteController extends GetxController with BaseControllerMixin {
|
||||
if (gunNumber != null && gunNumber.isNotEmpty) "gunNumber": gunNumber,
|
||||
},
|
||||
);
|
||||
}else if (addStatus == -1) {
|
||||
} else if (addStatus == -1) {
|
||||
responseData = await HttpService.to.post(
|
||||
'appointment/orderAddHyd/rejectOrder',
|
||||
data: {
|
||||
@@ -867,7 +929,6 @@ class SiteController extends GetxController with BaseControllerMixin {
|
||||
|
||||
if (responseData == null || responseData.data == null) {
|
||||
dismissLoading();
|
||||
showToast('服务暂不可用,请稍后');
|
||||
return;
|
||||
}
|
||||
var result = BaseModel.fromJson(responseData.data);
|
||||
@@ -922,15 +983,15 @@ class SiteController extends GetxController with BaseControllerMixin {
|
||||
orderUnfinishedAmount = result.data["orderUnfinishedAmount"].toString();
|
||||
|
||||
leftHydrogen = leftHydrogen.isEmpty ? "统计中" : leftHydrogen.toString();
|
||||
orderTotalAmount =
|
||||
orderTotalAmount.isEmpty ? "统计中" : orderTotalAmount.toString();
|
||||
orderTotalAmount = orderTotalAmount.isEmpty ? "统计中" : orderTotalAmount.toString();
|
||||
orderUnfinishedAmount = orderUnfinishedAmount.isEmpty
|
||||
? "统计中"
|
||||
: orderUnfinishedAmount.toString();
|
||||
} catch (e) {
|
||||
showToast('数据异常');
|
||||
}
|
||||
} catch (e) {} finally {
|
||||
} catch (e) {
|
||||
} finally {
|
||||
//加载列表数据
|
||||
fetchReservationData();
|
||||
|
||||
|
||||
@@ -56,17 +56,32 @@ class SitePage extends GetView<SiteController> {
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.to(
|
||||
() => HistoryPage(),
|
||||
arguments: {'stationName': controller.name},
|
||||
);
|
||||
// 手动录入
|
||||
controller.confirmReservation("", isAdd: true);
|
||||
},
|
||||
child: Text(
|
||||
'历史记录',
|
||||
style: TextStyle(
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color.fromRGBO(156, 163, 175, 1),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
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(
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
_buildDropdownMenu(),
|
||||
],
|
||||
),
|
||||
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) {
|
||||
return Expanded(
|
||||
child: Container(
|
||||
@@ -508,7 +537,9 @@ class SitePage extends GetView<SiteController> {
|
||||
const SizedBox(height: 8),
|
||||
// 联系信息
|
||||
Text(
|
||||
"${item.contactPerson} | ${item.contactPhone}",
|
||||
item.contactPerson.isEmpty || item.contactPhone.isEmpty
|
||||
? ""
|
||||
: "${item.contactPerson} | ${item.contactPhone}",
|
||||
style: TextStyle(
|
||||
color: Color(0xFF999999),
|
||||
fontSize: 13.sp,
|
||||
|
||||
Reference in New Issue
Block a user