取消预约按钮

This commit is contained in:
2026-01-07 09:59:12 +08:00
parent c57c849073
commit 8a4bc1d1ab

View File

@@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:getx_scaffold/common/index.dart'; import 'package:getx_scaffold/common/index.dart';
import 'package:ln_jq_app/common/model/base_model.dart';
import 'package:ln_jq_app/pages/c_page/reservation/controller.dart'; import 'package:ln_jq_app/pages/c_page/reservation/controller.dart';
import 'package:ln_jq_app/pages/c_page/reservation_edit/controller.dart'; import 'package:ln_jq_app/pages/c_page/reservation_edit/controller.dart';
import 'package:ln_jq_app/pages/c_page/reservation_edit/view.dart'; import 'package:ln_jq_app/pages/c_page/reservation_edit/view.dart';
@@ -141,7 +142,6 @@ class _ReservationListBottomSheetState extends State<ReservationListBottomSheet>
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// 状态标签 // 状态标签
@@ -151,58 +151,97 @@ class _ReservationListBottomSheetState extends State<ReservationListBottomSheet>
vertical: 5, vertical: 5,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color(0xFFE6F7FF), color: Colors.blue.shade50, // 淡蓝色背景
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4), // 小圆角
border: Border.all(color: const Color(0xFF91D5FF)), // 可以选择去掉边框,或者用极淡的边框
border: Border.all(color: Colors.blue.shade100),
), ),
child: Text( child: Text(
"${reservation.stateName}-${reservation.addStatusName}", "${reservation.stateName}-${reservation.addStatusName}",
style: const TextStyle( style: TextStyle(
color: Color(0xFF1890FF), color: Colors.blue.shade700,
fontWeight: FontWeight.bold, fontSize: 12,
fontWeight: FontWeight.w500,
), ),
), ),
), ),
// 修改按钮 (仅在 hasEdit 为 true 时显示) Spacer(),
//取消预约
if (reservation.hasEdit) if (reservation.hasEdit)
GestureDetector( SizedBox(
onTap: () async { height: 28, // 限制按钮高度,显得精致
var result = await Get.to( child: OutlinedButton(
() => ReservationEditPage(), onPressed: () async{
arguments: { var responseData = await HttpService.to.post(
'reservation': reservation, 'appointment/orderAddHyd/vehicle-cancel',
'difference': _controller.difference, data: {
}, 'id': reservation.id,
binding: BindingsBuilder(() { },
Get.put(ReservationEditController());
}),
preventDuplicates: false,
);
if (result == true) {
_controller.getReservationList(
addStatus: _selectedStatus,
); );
}
}, if (responseData == null || responseData.data == null) {
child: Container( showToast('服务暂不可用,请稍后');
padding: const EdgeInsets.symmetric( dismissLoading();
horizontal: 12, return;
vertical: 4, }
var result = BaseModel.fromJson(responseData.data);
if (result.code == 0) {
showSuccessToast("已取消");
_controller.getReservationList(
addStatus: _selectedStatus,
);
} else {
showToast(result.error);
}
},
style: OutlinedButton.styleFrom(
padding: const EdgeInsets.symmetric(horizontal: 12),
side: BorderSide(color: Colors.grey.shade400), // 灰色边框
shape: const StadiumBorder(), // 胶囊形状
), ),
decoration: BoxDecoration( child: Text(
color: const Color(0xFFFFF7E6), '取消预约',
borderRadius: BorderRadius.circular(12), style: TextStyle(color: Colors.grey.shade600, fontSize: 12),
),
child: const Text(
"修改",
style: TextStyle(
color: Color(0xFFFA8C16),
fontWeight: FontWeight.bold,
fontSize: 14,
),
), ),
), ),
), ),
SizedBox(width: 10.w,),
// 修改按钮 (仅在 hasEdit 为 true 时显示)
if (reservation.hasEdit)
SizedBox(
height: 28,
child: OutlinedButton(
onPressed: () async{
var result = await Get.to(
() => ReservationEditPage(),
arguments: {
'reservation': reservation,
'difference': _controller.difference,
},
binding: BindingsBuilder(() {
Get.put(ReservationEditController());
}),
preventDuplicates: false,
);
if (result == true) {
_controller.getReservationList(
addStatus: _selectedStatus,
);
}
},
style: OutlinedButton.styleFrom(
padding: const EdgeInsets.symmetric(horizontal: 12),
side: const BorderSide(color: Colors.blue), // 蓝色边框
shape: const StadiumBorder(),
backgroundColor: Colors.white,
),
child: const Text(
'修改',
style: TextStyle(color: Colors.blue, fontSize: 12),
),
),),
], ],
), ),
const SizedBox(height: 12), const SizedBox(height: 12),