取消预约按钮
This commit is contained in:
@@ -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,22 +151,69 @@ 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,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
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 时显示)
|
// 修改按钮 (仅在 hasEdit 为 true 时显示)
|
||||||
if (reservation.hasEdit)
|
if (reservation.hasEdit)
|
||||||
GestureDetector(
|
SizedBox(
|
||||||
onTap: () async {
|
height: 28,
|
||||||
|
child: OutlinedButton(
|
||||||
|
onPressed: () async{
|
||||||
var result = await Get.to(
|
var result = await Get.to(
|
||||||
() => ReservationEditPage(),
|
() => ReservationEditPage(),
|
||||||
arguments: {
|
arguments: {
|
||||||
@@ -184,25 +231,17 @@ class _ReservationListBottomSheetState extends State<ReservationListBottomSheet>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
style: OutlinedButton.styleFrom(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||||
horizontal: 12,
|
side: const BorderSide(color: Colors.blue), // 蓝色边框
|
||||||
vertical: 4,
|
shape: const StadiumBorder(),
|
||||||
),
|
backgroundColor: Colors.white,
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: const Color(0xFFFFF7E6),
|
|
||||||
borderRadius: BorderRadius.circular(12),
|
|
||||||
),
|
),
|
||||||
child: const Text(
|
child: const Text(
|
||||||
"修改",
|
'修改',
|
||||||
style: TextStyle(
|
style: TextStyle(color: Colors.blue, fontSize: 12),
|
||||||
color: Color(0xFFFA8C16),
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontSize: 14,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
),),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
|
|||||||
Reference in New Issue
Block a user