取消预约按钮
This commit is contained in:
@@ -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,58 +151,97 @@ 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,
|
||||
),
|
||||
),
|
||||
),
|
||||
// 修改按钮 (仅在 hasEdit 为 true 时显示)
|
||||
Spacer(),
|
||||
//取消预约
|
||||
if (reservation.hasEdit)
|
||||
GestureDetector(
|
||||
onTap: () 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,
|
||||
SizedBox(
|
||||
height: 28, // 限制按钮高度,显得精致
|
||||
child: OutlinedButton(
|
||||
onPressed: () async{
|
||||
var responseData = await HttpService.to.post(
|
||||
'appointment/orderAddHyd/vehicle-cancel',
|
||||
data: {
|
||||
'id': reservation.id,
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 12,
|
||||
vertical: 4,
|
||||
|
||||
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(), // 胶囊形状
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFFFF7E6),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: const Text(
|
||||
"修改",
|
||||
style: TextStyle(
|
||||
color: Color(0xFFFA8C16),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14,
|
||||
),
|
||||
child: Text(
|
||||
'取消预约',
|
||||
style: TextStyle(color: Colors.grey.shade600, fontSize: 12),
|
||||
),
|
||||
),
|
||||
),
|
||||
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),
|
||||
|
||||
Reference in New Issue
Block a user