添加任务发布取消弹窗

pull/1/head
张萌 3 years ago
parent 068e8af155
commit 90429642c2

@ -1,4 +1,5 @@
import 'package:aku_new_community/model/common/img_model.dart'; import 'package:aku_new_community/model/common/img_model.dart';
import 'package:common_utils/common_utils.dart';
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
part 'my_take_task_list_model.g.dart'; part 'my_take_task_list_model.g.dart';
@ -21,10 +22,12 @@ class MyTakeTaskListModel {
final List<ImgModel>? imgList; final List<ImgModel>? imgList;
final int rewardType; final int rewardType;
final int reward; final int reward;
final int createId;
final String createDate;
factory MyTakeTaskListModel.fromJson(Map<String, dynamic> json) => factory MyTakeTaskListModel.fromJson(Map<String, dynamic> json) =>
_$MyTakeTaskListModelFromJson(json); _$MyTakeTaskListModelFromJson(json);
DateTime? get endTime => DateUtil.getDateTime(readyEndTime);
const MyTakeTaskListModel({ const MyTakeTaskListModel({
required this.id, required this.id,
required this.code, required this.code,
@ -42,5 +45,7 @@ class MyTakeTaskListModel {
this.imgList, this.imgList,
required this.rewardType, required this.rewardType,
required this.reward, required this.reward,
required this.createId,
required this.createDate,
}); });
} }

@ -26,4 +26,6 @@ MyTakeTaskListModel _$MyTakeTaskListModelFromJson(Map<String, dynamic> json) =>
.toList(), .toList(),
rewardType: json['rewardType'] as int, rewardType: json['rewardType'] as int,
reward: json['reward'] as int, reward: json['reward'] as int,
createId: json['createId'] as int,
createDate: json['createDate'] as String,
); );

@ -1,4 +1,5 @@
import 'package:aku_new_community/model/common/img_model.dart'; import 'package:aku_new_community/model/common/img_model.dart';
import 'package:common_utils/common_utils.dart';
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
part 'my_task_list_model.g.dart'; part 'my_task_list_model.g.dart';
@ -21,9 +22,12 @@ class MyTaskListModel {
final List<ImgModel>? imgList; final List<ImgModel>? imgList;
final int rewardType; final int rewardType;
final int reward; final int reward;
final int createId;
final String createDate;
factory MyTaskListModel.fromJson(Map<String, dynamic> json) => factory MyTaskListModel.fromJson(Map<String, dynamic> json) =>
_$MyTaskListModelFromJson(json); _$MyTaskListModelFromJson(json);
DateTime? get endTime => DateUtil.getDateTime(readyEndTime);
const MyTaskListModel({ const MyTaskListModel({
required this.id, required this.id,
required this.code, required this.code,
@ -41,5 +45,7 @@ class MyTaskListModel {
this.imgList, this.imgList,
required this.rewardType, required this.rewardType,
required this.reward, required this.reward,
required this.createId,
required this.createDate,
}); });
} }

@ -26,4 +26,6 @@ MyTaskListModel _$MyTaskListModelFromJson(Map<String, dynamic> json) =>
.toList(), .toList(),
rewardType: json['rewardType'] as int, rewardType: json['rewardType'] as int,
reward: json['reward'] as int, reward: json['reward'] as int,
createId: json['createId'] as int,
createDate: json['createDate'] as String,
); );

@ -218,7 +218,7 @@ class _HomePageState extends State<HomePage>
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
head, head,
// HomeSwiper(), // HomeSwiper(), //
// SizedBox(height: 100.w), // SizedBox(height: 100.w),
Container( Container(
padding: EdgeInsets.only(top: 24.w, bottom: 32.w), padding: EdgeInsets.only(top: 24.w, bottom: 32.w),

@ -0,0 +1,90 @@
import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/extensions/num_ext.dart';
import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/ui/service/task_func.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/src/extensions/string_ext.dart';
class TaskCancelDialog extends StatefulWidget {
final int taskId;
const TaskCancelDialog({Key? key, required this.taskId}) : super(key: key);
@override
_TaskCancelDialogState createState() => _TaskCancelDialogState();
}
class _TaskCancelDialogState extends State<TaskCancelDialog> {
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
color: Colors.white,
padding: EdgeInsets.all(32.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Assets.icons.cancelTask.image(
width: double.infinity,
height: 420.w,
),
64.hb,
'确定要取消任务吗?'.text.size(36.sp).black.bold.make(),
24.hb,
'不再等等吗?马上就会有人来接单了!'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
80.hb,
Row(
children: [
MaterialButton(
onPressed: () {
Get.back();
},
minWidth: 330.w,
height: 80.w,
elevation: 0,
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40.w),
side: BorderSide(color: Colors.black.withOpacity(0.25)),
),
child: Text(
'继续等待',
style: TextStyle(
fontSize: 28.sp, color: Colors.black.withOpacity(0.65)),
),
),
Spacer(),
MaterialButton(
onPressed: () async {
var re = await TaskFunc.cancel(taskId: widget.taskId);
if (re) {
Get.back();
}
},
minWidth: 330.w,
height: 80.w,
elevation: 0,
color: kPrimaryColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40.w),
),
child: Text(
'确认取消',
style: TextStyle(
fontSize: 28.sp, color: Colors.black.withOpacity(0.85)),
),
)
],
)
],
),
);
}
}

@ -1,13 +1,20 @@
import 'package:aku_new_community/base/base_style.dart'; import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/extensions/num_ext.dart'; import 'package:aku_new_community/extensions/num_ext.dart';
import 'package:aku_new_community/gen/assets.gen.dart'; import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/src/extensions/string_ext.dart'; import 'package:velocity_x/src/extensions/string_ext.dart';
import '../task_func.dart';
class TaskEvaluationDialog extends StatefulWidget { class TaskEvaluationDialog extends StatefulWidget {
const TaskEvaluationDialog({Key? key}) : super(key: key); final int taskId;
const TaskEvaluationDialog({Key? key, required this.taskId})
: super(key: key);
@override @override
_TaskEvaluationDialogState createState() => _TaskEvaluationDialogState(); _TaskEvaluationDialogState createState() => _TaskEvaluationDialogState();
@ -88,14 +95,26 @@ class _TaskEvaluationDialogState extends State<TaskEvaluationDialog> {
side: BorderSide(color: Colors.black.withOpacity(0.25)), side: BorderSide(color: Colors.black.withOpacity(0.25)),
), ),
child: Text( child: Text(
'', '暂不评价',
style: TextStyle( style: TextStyle(
fontSize: 28.sp, color: Colors.black.withOpacity(0.65)), fontSize: 28.sp, color: Colors.black.withOpacity(0.65)),
), ),
), ),
Spacer(), Spacer(),
MaterialButton( MaterialButton(
onPressed: () {}, onPressed: () async {
if (_currentIndex == null) {
BotToast.showText(text: '请选择评价满意度');
return;
}
var re = await TaskFunc.evaluate(
taskId: widget.taskId,
star: _currentIndex!,
evaluation: _controller.text);
if (re) {
Get.back();
}
},
minWidth: 330.w, minWidth: 330.w,
height: 80.w, height: 80.w,
elevation: 0, elevation: 0,
@ -104,7 +123,7 @@ class _TaskEvaluationDialogState extends State<TaskEvaluationDialog> {
borderRadius: BorderRadius.circular(40.w), borderRadius: BorderRadius.circular(40.w),
), ),
child: Text( child: Text(
'暂不评价', '确认提交',
style: TextStyle( style: TextStyle(
fontSize: 28.sp, color: Colors.black.withOpacity(0.85)), fontSize: 28.sp, color: Colors.black.withOpacity(0.85)),
), ),

@ -1,5 +1,6 @@
import 'package:aku_new_community/gen/assets.gen.dart'; import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/models/task/hall_list_model.dart'; import 'package:aku_new_community/models/task/hall_list_model.dart';
import 'package:aku_new_community/ui/service/dialogs/task_cancel_dialog.dart';
import 'package:aku_new_community/ui/service/task_func.dart'; import 'package:aku_new_community/ui/service/task_func.dart';
import 'package:aku_new_community/ui/service/task_map.dart'; import 'package:aku_new_community/ui/service/task_map.dart';
import 'package:aku_new_community/widget/bee_divider.dart'; import 'package:aku_new_community/widget/bee_divider.dart';
@ -110,7 +111,8 @@ class _HallDetailPageState extends State<HallDetailPage> {
child: myself child: myself
? BeeLongButton.white( ? BeeLongButton.white(
onPressed: () async { onPressed: () async {
var re = await TaskFunc.cancel(taskId: widget.model.id); var re = await Get.bottomSheet(
TaskCancelDialog(taskId: widget.model.id));
if (re) { if (re) {
Get.back(); Get.back();
} }

@ -1,13 +1,23 @@
import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/gen/assets.gen.dart'; import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/models/task/my_take_task_list_model.dart'; import 'package:aku_new_community/models/task/my_take_task_list_model.dart';
import 'package:aku_new_community/ui/service/dialogs/task_cancel_dialog.dart';
import 'package:aku_new_community/ui/service/task_map.dart'; import 'package:aku_new_community/ui/service/task_map.dart';
import 'package:aku_new_community/widget/bee_divider.dart'; import 'package:aku_new_community/widget/bee_divider.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/buttons/bee_long_button.dart';
import 'package:aku_new_community/widget/views/bee_grid_image_view.dart';
import 'package:aku_new_community/widget/voice_player.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import '../task_func.dart';
class MyTakeTaskDetailPage extends StatefulWidget { class MyTakeTaskDetailPage extends StatefulWidget {
final MyTakeTaskListModel model; final MyTakeTaskListModel model;
@ -18,6 +28,52 @@ class MyTakeTaskDetailPage extends StatefulWidget {
} }
class _MyTakeTaskDetailPageState extends State<MyTakeTaskDetailPage> { class _MyTakeTaskDetailPageState extends State<MyTakeTaskDetailPage> {
String get detailStatusToString {
switch (widget.model.status) {
case 1:
return '待服务';
case 2:
if (widget.model.endTime?.isBefore(DateTime.now()) ?? false) {
return '已超时(原预计${DateUtil.formatDate(widget.model.endTime, format: DateFormats.h_m)}';
} else {
return '服务中';
}
case 3:
return '等待用户确认';
case 4:
return '已完成';
case 5:
return '已评价';
case 9:
return '已取消';
default:
return '';
}
}
String get subStatusString {
switch (widget.model.status) {
case 1:
return '请与发布人确认后开始服务';
case 2:
if (widget.model.endTime?.isBefore(DateTime.now()) ?? false) {
return '请及时提醒帮手完成任务';
} else {
return '帮手正在为您服务中';
}
case 3:
return '请注意及时确认帮手的工作内容';
case 4:
return '欢迎对骑手及本次任务进行评价';
case 5:
return '感谢信任与支持,欢迎再次光临';
case 9:
return '请及时提醒帮手完成任务';
default:
return '';
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BeeScaffold( return BeeScaffold(
@ -34,7 +90,7 @@ class _MyTakeTaskDetailPageState extends State<MyTakeTaskDetailPage> {
gradient: LinearGradient( gradient: LinearGradient(
begin: Alignment.centerLeft, begin: Alignment.centerLeft,
end: Alignment.centerRight, end: Alignment.centerRight,
colors: widget.model.status == 4 colors: widget.model.status == 9
? [ ? [
Colors.white, Colors.white,
Color(0xFFADACAC), Color(0xFFADACAC),
@ -54,13 +110,13 @@ class _MyTakeTaskDetailPageState extends State<MyTakeTaskDetailPage> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
'${TaskMap.detailStatusToString[widget.model.status]}' '${detailStatusToString}'
.text .text
.size(40.sp) .size(40.sp)
.color(Colors.black) .color(Colors.black)
.bold .bold
.make(), .make(),
'${TaskMap.subStatus[widget.model.status]}' '${subStatusString}'
.text .text
.size(24.sp) .size(24.sp)
.color(Colors.black.withOpacity(0.45)) .color(Colors.black.withOpacity(0.45))
@ -69,28 +125,6 @@ class _MyTakeTaskDetailPageState extends State<MyTakeTaskDetailPage> {
), ),
), ),
Spacer(), Spacer(),
// Padding(
// padding: EdgeInsets.only(right: 32.w),
// child: MaterialButton(
// color: Colors.white,
// elevation: 0,
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(8.w),
// ),
// onPressed: () async {
// var re = await TaskFunc.cancel(
// taskId: widget.model.id);
// if (re) {
// Get.back();
// }
// },
// child: '取消订单'
// .text
// .size(24.sp)
// .color(Colors.black.withOpacity(0.65))
// .make(),
// ),
// )
], ],
), ),
], ],
@ -118,7 +152,92 @@ class _MyTakeTaskDetailPageState extends State<MyTakeTaskDetailPage> {
)), )),
], ],
), ),
bottomNavi: Container(
width: double.infinity,
color: Colors.white,
padding: EdgeInsets.all(32.w),
child: Row(
children: [
MaterialButton(
onPressed: () async {
var re = await Get.bottomSheet(
TaskCancelDialog(taskId: widget.model.id));
if (re) {
Get.back();
}
},
minWidth: 330.w,
height: 80.w,
elevation: 0,
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40.w),
side: BorderSide(color: Colors.black.withOpacity(0.25)),
),
child: Text(
'取消订单',
style: TextStyle(
fontSize: 28.sp, color: Colors.black.withOpacity(0.65)),
),
),
Spacer(),
buttonByStatus,
],
),
),
);
}
Widget get buttonByStatus {
switch (widget.model.status) {
case 1:
return MaterialButton(
onPressed: () async {
var re = await TaskFunc.start(taskId: widget.model.id);
if (re) {
Get.back();
}
},
minWidth: 330.w,
height: 80.w,
elevation: 0,
color: kPrimaryColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40.w),
),
child: Text(
'开始服务',
style: TextStyle(
fontSize: 28.sp, color: Colors.black.withOpacity(0.85)),
),
);
case 2:
return MaterialButton(
onPressed: () {},
minWidth: 330.w,
height: 80.w,
elevation: 0,
color: kPrimaryColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40.w),
),
child: Text(
'完成任务',
style: TextStyle(
fontSize: 28.sp, color: Colors.black.withOpacity(0.85)),
),
);
case 3:
return BeeLongButton(
onPressed: () async {},
text: '提醒用户',
); );
case 4:
case 5:
case 9:
default:
return SizedBox.shrink();
}
} }
Widget _taskInfo() { Widget _taskInfo() {
@ -148,13 +267,38 @@ class _MyTakeTaskDetailPageState extends State<MyTakeTaskDetailPage> {
.color(Colors.black.withOpacity(0.45)) .color(Colors.black.withOpacity(0.45))
.make(), .make(),
Spacer(), Spacer(),
'${DateUtil.formatDateStr(widget.model.updateDate)}' '${DateUtil.formatDateStr(widget.model.createDate)}'
.text .text
.size(24.sp) .size(24.sp)
.color(Colors.black.withOpacity(0.45)) .color(Colors.black.withOpacity(0.45))
.make() .make(),
64.w.widthBox,
], ],
), ),
24.w.heightBox,
Row(
children: [
'任务单号'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
Spacer(),
'${widget.model.code}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
24.w.widthBox,
GestureDetector(
onTap: () async {
await Clipboard.setData(
ClipboardData(text: widget.model.code));
BotToast.showText(text: '已复制到粘贴板');
},
child: Assets.icons.copy.image(width: 40.w, height: 40.w)),
],
)
], ],
), ),
); );
@ -171,21 +315,18 @@ class _MyTakeTaskDetailPageState extends State<MyTakeTaskDetailPage> {
color: Color(0xFFFFF7E6), color: Color(0xFFFFF7E6),
borderRadius: BorderRadius.circular(8.w), borderRadius: BorderRadius.circular(8.w),
), ),
child: '#${TaskMap.typeToString[widget.model.type]}' child: '#${TaskMap.taskType[widget.model.type]}'
.text .text
.size(28.sp) .size(28.sp)
.color(Color(0xFFFA8C16)) .color(Color(0xFFFA8C16))
.make(), .make(),
), ),
Spacer(), Spacer(),
Assets.icons.intergral.image(width: 24.w, height: 24.w),
8.w.widthBox,
'${widget.model.reward}'.text.size(32.sp).color(Colors.red).make()
], ],
); );
return Container( return Container(
width: 686.w, width: 686.w,
height: 500.w, // height: 500.w,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(8.w), borderRadius: BorderRadius.circular(8.w),
@ -197,16 +338,19 @@ class _MyTakeTaskDetailPageState extends State<MyTakeTaskDetailPage> {
34.w.heightBox, 34.w.heightBox,
Row( Row(
children: [ children: [
Assets.icons.clockCircle.image(width: 36.w, height: 36.w), Assets.icons.watch.image(width: 40.w, height: 40.w),
24.w.widthBox, 24.w.widthBox,
'${DateUtil.formatDateStr(widget.model.readyEndTime)}' '${widget.model.serviceTime ?? '0'}'
.text .richText
.size(24.sp) .withTextSpanChildren([
.color(Colors.black.withOpacity(0.65)) ' 分钟'.textSpan.size(28.sp).color(Colors.black).make(),
])
.size(28.sp)
.color(Color(0xFFFA8C16))
.make(), .make(),
], ],
), ),
20.w.heightBox, 24.w.heightBox,
Row( Row(
children: [ children: [
Assets.icons.environment.image(width: 36.w, height: 36.w), Assets.icons.environment.image(width: 36.w, height: 36.w),
@ -228,16 +372,18 @@ class _MyTakeTaskDetailPageState extends State<MyTakeTaskDetailPage> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
'#${TaskMap.typeToString[widget.model.type]}'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
16.w.heightBox,
widget.model.remarks.text widget.model.remarks.text
.size(28.sp) .size(28.sp)
.color(Colors.black.withOpacity(0.65)) .color(Colors.black.withOpacity(0.65))
.make(), .make(),
24.w.heightBox,
VoicePlayer(
url: widget.model.voiceUrl,
),
24.w.heightBox,
BeeGridImageView(
urls:
widget.model.imgList?.map((e) => e.url).toList() ?? []),
], ],
), ),
), ),
@ -254,11 +400,14 @@ class _MyTakeTaskDetailPageState extends State<MyTakeTaskDetailPage> {
.color(Colors.black.withOpacity(0.45)) .color(Colors.black.withOpacity(0.45))
.make(), .make(),
Spacer(), Spacer(),
'¥${widget.model.reward}' widget.model.rewardType == 1
.text ? Text(
.size(32.sp) '¥ ',
.color(Colors.red) style: TextStyle(color: Colors.red, fontSize: 32.sp),
.make(), )
: Assets.icons.intergral.image(width: 24.w, height: 24.w),
8.w.widthBox,
'${widget.model.reward}'.text.size(32.sp).color(Colors.red).make()
], ],
), ),
], ],

@ -1,13 +1,24 @@
import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/gen/assets.gen.dart'; import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/models/task/my_task_list_model.dart'; import 'package:aku_new_community/models/task/my_task_list_model.dart';
import 'package:aku_new_community/ui/service/dialogs/task_cancel_dialog.dart';
import 'package:aku_new_community/ui/service/dialogs/task_evaluation_dialog.dart';
import 'package:aku_new_community/ui/service/task_map.dart'; import 'package:aku_new_community/ui/service/task_map.dart';
import 'package:aku_new_community/widget/bee_divider.dart'; import 'package:aku_new_community/widget/bee_divider.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/buttons/bee_long_button.dart';
import 'package:aku_new_community/widget/views/bee_grid_image_view.dart';
import 'package:aku_new_community/widget/voice_player.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import '../task_func.dart';
class MyTaskDetailPage extends StatefulWidget { class MyTaskDetailPage extends StatefulWidget {
final MyTaskListModel model; final MyTaskListModel model;
@ -18,6 +29,52 @@ class MyTaskDetailPage extends StatefulWidget {
} }
class _MyTaskDetailPageState extends State<MyTaskDetailPage> { class _MyTaskDetailPageState extends State<MyTaskDetailPage> {
String get detailStatusToString {
switch (widget.model.status) {
case 1:
return '已发布';
case 2:
if (widget.model.endTime?.isBefore(DateTime.now()) ?? false) {
return '已超时(原预计${DateUtil.formatDate(widget.model.endTime, format: DateFormats.h_m)}';
} else {
return '服务中';
}
case 3:
return '待确认';
case 4:
return '已完成';
case 5:
return '已评价';
case 9:
return '已取消';
default:
return '';
}
}
String get subStatusString {
switch (widget.model.status) {
case 1:
return '请与发布人确认后开始服务';
case 2:
if (widget.model.endTime?.isBefore(DateTime.now()) ?? false) {
return '请及时提醒帮手完成任务';
} else {
return '帮手正在为您服务中';
}
case 3:
return '请注意及时确认帮手的工作内容';
case 4:
return '欢迎对骑手及本次任务进行评价';
case 5:
return '感谢信任与支持,欢迎再次光临';
case 9:
return '请及时提醒帮手完成任务';
default:
return '';
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BeeScaffold( return BeeScaffold(
@ -34,7 +91,7 @@ class _MyTaskDetailPageState extends State<MyTaskDetailPage> {
gradient: LinearGradient( gradient: LinearGradient(
begin: Alignment.centerLeft, begin: Alignment.centerLeft,
end: Alignment.centerRight, end: Alignment.centerRight,
colors: widget.model.status == 4 colors: widget.model.status == 9
? [ ? [
Colors.white, Colors.white,
Color(0xFFADACAC), Color(0xFFADACAC),
@ -54,13 +111,13 @@ class _MyTaskDetailPageState extends State<MyTaskDetailPage> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
'${TaskMap.detailStatusToString[widget.model.status]}' '${detailStatusToString}'
.text .text
.size(40.sp) .size(40.sp)
.color(Colors.black) .color(Colors.black)
.bold .bold
.make(), .make(),
'${TaskMap.subStatus[widget.model.status]}' '${subStatusString}'
.text .text
.size(24.sp) .size(24.sp)
.color(Colors.black.withOpacity(0.45)) .color(Colors.black.withOpacity(0.45))
@ -69,28 +126,6 @@ class _MyTaskDetailPageState extends State<MyTaskDetailPage> {
), ),
), ),
Spacer(), Spacer(),
// Padding(
// padding: EdgeInsets.only(right: 32.w),
// child: MaterialButton(
// color: Colors.white,
// elevation: 0,
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(8.w),
// ),
// onPressed: () async {
// var re = await TaskFunc.cancel(
// taskId: widget.model.id);
// if (re) {
// Get.back();
// }
// },
// child: '取消订单'
// .text
// .size(24.sp)
// .color(Colors.black.withOpacity(0.65))
// .make(),
// ),
// )
], ],
), ),
], ],
@ -118,9 +153,124 @@ class _MyTaskDetailPageState extends State<MyTaskDetailPage> {
)), )),
], ],
), ),
bottomNavi: Container(
width: double.infinity,
color: Colors.white,
padding: EdgeInsets.all(32.w),
child: Row(
children: [
Offstage(
offstage: widget.model.status > 3,
child: MaterialButton(
onPressed: () async {
var re = await Get.bottomSheet(
TaskCancelDialog(taskId: widget.model.id));
if (re) {
Get.back();
}
},
minWidth: 330.w,
height: 80.w,
elevation: 0,
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40.w),
side: BorderSide(color: Colors.black.withOpacity(0.25)),
),
child: Text(
'取消订单',
style: TextStyle(
fontSize: 28.sp, color: Colors.black.withOpacity(0.65)),
),
),
),
Spacer(),
buttonByStatus,
],
),
),
); );
} }
Widget get buttonByStatus {
switch (widget.model.status) {
case 1:
return MaterialButton(
onPressed: () async {},
minWidth: 330.w,
height: 80.w,
elevation: 0,
color: kPrimaryColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40.w),
),
child: Text(
'修改任务',
style: TextStyle(
fontSize: 28.sp, color: Colors.black.withOpacity(0.85)),
),
);
case 2:
return MaterialButton(
onPressed: () {},
minWidth: 330.w,
height: 80.w,
elevation: 0,
color: kPrimaryColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40.w),
),
child: Text(
'催促服务',
style: TextStyle(
fontSize: 28.sp, color: Colors.black.withOpacity(0.85)),
),
);
case 3:
return MaterialButton(
onPressed: () async {
var re = await TaskFunc.confirm(taskId: widget.model.id);
if (re) {
Get.back();
}
},
minWidth: 330.w,
height: 80.w,
elevation: 0,
color: kPrimaryColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40.w),
),
child: Text(
'确认完成',
style: TextStyle(
fontSize: 28.sp, color: Colors.black.withOpacity(0.85)),
),
);
case 4:
return BeeLongButton(
onPressed: () async {
var re = await Get.bottomSheet(TaskEvaluationDialog(
taskId: widget.model.id,
));
},
text: '点击评价',
);
case 5:
return BeeLongButton.white(
onPressed: () async {},
text: '再次发布',
);
case 9:
return BeeLongButton.white(
onPressed: () async {},
text: '再次发布',
);
default:
return SizedBox.shrink();
}
}
Widget _taskInfo() { Widget _taskInfo() {
return Container( return Container(
width: 686.w, width: 686.w,
@ -148,13 +298,38 @@ class _MyTaskDetailPageState extends State<MyTaskDetailPage> {
.color(Colors.black.withOpacity(0.45)) .color(Colors.black.withOpacity(0.45))
.make(), .make(),
Spacer(), Spacer(),
'${DateUtil.formatDateStr(widget.model.updateDate)}' '${DateUtil.formatDateStr(widget.model.createDate)}'
.text .text
.size(24.sp) .size(24.sp)
.color(Colors.black.withOpacity(0.45)) .color(Colors.black.withOpacity(0.45))
.make() .make(),
64.w.widthBox,
], ],
), ),
24.w.heightBox,
Row(
children: [
'任务单号'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
Spacer(),
'${widget.model.code}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
24.w.widthBox,
GestureDetector(
onTap: () async {
await Clipboard.setData(
ClipboardData(text: widget.model.code));
BotToast.showText(text: '已复制到粘贴板');
},
child: Assets.icons.copy.image(width: 40.w, height: 40.w)),
],
)
], ],
), ),
); );
@ -171,21 +346,18 @@ class _MyTaskDetailPageState extends State<MyTaskDetailPage> {
color: Color(0xFFFFF7E6), color: Color(0xFFFFF7E6),
borderRadius: BorderRadius.circular(8.w), borderRadius: BorderRadius.circular(8.w),
), ),
child: '#${TaskMap.typeToString[widget.model.type]}' child: '#${TaskMap.taskType[widget.model.type]}'
.text .text
.size(28.sp) .size(28.sp)
.color(Color(0xFFFA8C16)) .color(Color(0xFFFA8C16))
.make(), .make(),
), ),
Spacer(), Spacer(),
Assets.icons.intergral.image(width: 24.w, height: 24.w),
8.w.widthBox,
'${widget.model.reward}'.text.size(32.sp).color(Colors.red).make()
], ],
); );
return Container( return Container(
width: 686.w, width: 686.w,
height: 500.w, // height: 500.w,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(8.w), borderRadius: BorderRadius.circular(8.w),
@ -197,16 +369,19 @@ class _MyTaskDetailPageState extends State<MyTaskDetailPage> {
34.w.heightBox, 34.w.heightBox,
Row( Row(
children: [ children: [
Assets.icons.clockCircle.image(width: 36.w, height: 36.w), Assets.icons.watch.image(width: 40.w, height: 40.w),
24.w.widthBox, 24.w.widthBox,
'${DateUtil.formatDateStr(widget.model.readyEndTime)}' '${widget.model.serviceTime ?? '0'}'
.text .richText
.size(24.sp) .withTextSpanChildren([
.color(Colors.black.withOpacity(0.65)) ' 分钟'.textSpan.size(28.sp).color(Colors.black).make(),
])
.size(28.sp)
.color(Color(0xFFFA8C16))
.make(), .make(),
], ],
), ),
20.w.heightBox, 24.w.heightBox,
Row( Row(
children: [ children: [
Assets.icons.environment.image(width: 36.w, height: 36.w), Assets.icons.environment.image(width: 36.w, height: 36.w),
@ -228,16 +403,18 @@ class _MyTaskDetailPageState extends State<MyTaskDetailPage> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
'#${TaskMap.typeToString[widget.model.type]}'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.85))
.make(),
16.w.heightBox,
widget.model.remarks.text widget.model.remarks.text
.size(28.sp) .size(28.sp)
.color(Colors.black.withOpacity(0.65)) .color(Colors.black.withOpacity(0.65))
.make(), .make(),
24.w.heightBox,
VoicePlayer(
url: widget.model.voiceUrl,
),
24.w.heightBox,
BeeGridImageView(
urls:
widget.model.imgList?.map((e) => e.url).toList() ?? []),
], ],
), ),
), ),
@ -254,11 +431,14 @@ class _MyTaskDetailPageState extends State<MyTaskDetailPage> {
.color(Colors.black.withOpacity(0.45)) .color(Colors.black.withOpacity(0.45))
.make(), .make(),
Spacer(), Spacer(),
'¥${widget.model.reward}' widget.model.rewardType == 1
.text ? Text(
.size(32.sp) '¥ ',
.color(Colors.red) style: TextStyle(color: Colors.red, fontSize: 32.sp),
.make(), )
: Assets.icons.intergral.image(width: 24.w, height: 24.w),
8.w.widthBox,
'${widget.model.reward}'.text.size(32.sp).color(Colors.red).make()
], ],
), ),
], ],

@ -18,17 +18,5 @@ class TaskMap {
static Map<int, String> serviceObject = {1: '住户', 2: '物业', 3: '不限'}; static Map<int, String> serviceObject = {1: '住户', 2: '物业', 3: '不限'};
static Map<int, String> rewardType = {1: '赏金', 2: '积分'}; static Map<int, String> rewardType = {1: '赏金', 2: '积分'};
static Map<int, String> detailStatusToString = {
1: '已发布',
2: '待处理',
3: '已完成',
4: '已取消'
};
static Map<int, String> subStatus = {
1: '请耐心等待帮手领取任务',
2: '帮手正在为您服务中',
3: '帮手已完成任务',
4: '该任务已取消'
};
} }

Loading…
Cancel
Save