取消预约按钮

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:get/get.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_edit/controller.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,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// 状态标签
@@ -151,22 +151,69 @@ class _ReservationListBottomSheetState extends State<ReservationListBottomSheet>
vertical: 5,
),
decoration: BoxDecoration(
color: const Color(0xFFE6F7FF),
borderRadius: BorderRadius.circular(4),
border: Border.all(color: const Color(0xFF91D5FF)),
color: Colors.blue.shade50, // 淡蓝色背景
borderRadius: BorderRadius.circular(4), // 小圆角
// 可以选择去掉边框,或者用极淡的边框
border: Border.all(color: Colors.blue.shade100),
),
child: Text(
"${reservation.stateName}-${reservation.addStatusName}",
style: const TextStyle(
color: Color(0xFF1890FF),
fontWeight: FontWeight.bold,
style: TextStyle(
color: Colors.blue.shade700,
fontSize: 12,
fontWeight: FontWeight.w500,
),
),
),
Spacer(),
//取消预约
if (reservation.hasEdit)
SizedBox(
height: 28, // 限制按钮高度,显得精致
child: OutlinedButton(
onPressed: () async{
var responseData = await HttpService.to.post(
'appointment/orderAddHyd/vehicle-cancel',
data: {
'id': reservation.id,
},
);
if (responseData == null || responseData.data == null) {
showToast('服务暂不可用,请稍后');
dismissLoading();
return;
}
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(), // 胶囊形状
),
child: Text(
'取消预约',
style: TextStyle(color: Colors.grey.shade600, fontSize: 12),
),
),
),
SizedBox(width: 10.w,),
// 修改按钮 (仅在 hasEdit 为 true 时显示)
if (reservation.hasEdit)
GestureDetector(
onTap: () async {
SizedBox(
height: 28,
child: OutlinedButton(
onPressed: () async{
var result = await Get.to(
() => ReservationEditPage(),
arguments: {
@@ -184,25 +231,17 @@ class _ReservationListBottomSheetState extends State<ReservationListBottomSheet>
);
}
},
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 4,
),
decoration: BoxDecoration(
color: const Color(0xFFFFF7E6),
borderRadius: BorderRadius.circular(12),
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: Color(0xFFFA8C16),
fontWeight: FontWeight.bold,
fontSize: 14,
),
),
),
'修改',
style: TextStyle(color: Colors.blue, fontSize: 12),
),
),),
],
),
const SizedBox(height: 12),