无预约
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(
|
||||
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,7 +376,7 @@ 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),
|
||||
@@ -359,8 +394,13 @@ class SiteController extends GetxController with BaseControllerMixin {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
isEdit
|
||||
? SizedBox()
|
||||
: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 2,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(232, 243, 255, 1),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
@@ -382,27 +422,33 @@ class SiteController extends GetxController with BaseControllerMixin {
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 12),
|
||||
SizedBox(height: 6.h),
|
||||
|
||||
// 提示逻辑
|
||||
if (isEdit)
|
||||
const Text(
|
||||
Text(
|
||||
'每个订单只能修改一次,请确认加氢量准确无误',
|
||||
style: TextStyle(color: Colors.red, fontSize: 12),
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
fontSize: 12.sp,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
)
|
||||
else
|
||||
if (item.plateNumber == "---" || item.isTruckAttachment == 0)
|
||||
else if (item.plateNumber == "---" || item.isTruckAttachment == 0)
|
||||
Row(
|
||||
children: [
|
||||
const Expanded(
|
||||
Expanded(
|
||||
child: Text(
|
||||
'车辆未上传加氢证,请完成线下登记',
|
||||
style: TextStyle(color: Colors.red, fontSize: 12),
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
fontSize: 12.sp,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() =>
|
||||
Checkbox(
|
||||
() => Checkbox(
|
||||
value: isOfflineChecked.value,
|
||||
onChanged: (v) => isOfflineChecked.value = v ?? false,
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
@@ -412,7 +458,7 @@ class SiteController extends GetxController with BaseControllerMixin {
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
SizedBox(height: 6.h),
|
||||
|
||||
// 预定加氢量输入区
|
||||
Container(
|
||||
@@ -459,14 +505,10 @@ class SiteController extends GetxController with BaseControllerMixin {
|
||||
),
|
||||
decoration: const InputDecoration(
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Color(0xFF017143),
|
||||
),
|
||||
borderSide: BorderSide(color: Color(0xFF017143)),
|
||||
),
|
||||
focusedBorder: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Color(0xFF017143),
|
||||
),
|
||||
borderSide: BorderSide(color: Color(0xFF017143)),
|
||||
),
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.zero,
|
||||
@@ -483,10 +525,7 @@ class SiteController extends GetxController with BaseControllerMixin {
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 8,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF017143),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
@@ -509,14 +548,10 @@ class SiteController extends GetxController with BaseControllerMixin {
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 加氢枪号选择
|
||||
const Text(
|
||||
'请选择加氢枪号',
|
||||
style: TextStyle(color: Colors.grey, fontSize: 12),
|
||||
),
|
||||
const Text('请选择加氢枪号', style: TextStyle(color: Colors.grey, fontSize: 12)),
|
||||
const SizedBox(height: 8),
|
||||
Obx(
|
||||
() =>
|
||||
Container(
|
||||
() => Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey.shade300),
|
||||
@@ -528,8 +563,7 @@ class SiteController extends GetxController with BaseControllerMixin {
|
||||
isExpanded: true,
|
||||
hint: const Text('请选择加氢枪号'),
|
||||
items: gasGunList.map((String gun) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: gun, child: Text(gun));
|
||||
return DropdownMenuItem<String>(value: gun, child: Text(gun));
|
||||
}).toList(),
|
||||
onChanged: (v) => selectedGun.value = v ?? '',
|
||||
),
|
||||
@@ -559,7 +593,7 @@ class SiteController extends GetxController with BaseControllerMixin {
|
||||
item,
|
||||
gunNumber: selectedGun.value,
|
||||
plateNumber: item.plateNumber,
|
||||
isEdit: true
|
||||
isEdit: true,
|
||||
);
|
||||
Get.back();
|
||||
return;
|
||||
@@ -576,6 +610,25 @@ class SiteController extends GetxController with BaseControllerMixin {
|
||||
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;
|
||||
@@ -722,8 +775,7 @@ class SiteController extends GetxController with BaseControllerMixin {
|
||||
const Text('选择或填写拒绝原因:', style: TextStyle(color: Colors.grey)),
|
||||
const SizedBox(height: 8),
|
||||
Obx(
|
||||
() =>
|
||||
Wrap(
|
||||
() => Wrap(
|
||||
// 使用 Wrap 自动换行
|
||||
spacing: 8.0, // 水平间距
|
||||
children: presetReasons.map((reason) {
|
||||
@@ -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,
|
||||
void upDataService(
|
||||
String id,
|
||||
int status,
|
||||
int addStatus,
|
||||
num addHydAmount,
|
||||
String rejectReason,
|
||||
ReservationModel item, {
|
||||
String? gunNumber,
|
||||
String? plateNumber, bool isEdit = false
|
||||
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(
|
||||
'历史记录',
|
||||
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(
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color.fromRGBO(156, 163, 175, 1),
|
||||
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