diff --git a/lib/ui/service/hall/hall_card.dart b/lib/ui/service/hall/hall_card.dart index 8e7c31b8..a829ef3b 100644 --- a/lib/ui/service/hall/hall_card.dart +++ b/lib/ui/service/hall/hall_card.dart @@ -9,6 +9,8 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:velocity_x/velocity_x.dart'; +import '../task_func.dart'; + class HallCard extends StatelessWidget { final HallListModel model; final VoidCallback refresh; @@ -109,7 +111,14 @@ class HallCard extends StatelessWidget { Row( children: [ Spacer(), - CardBottomButton.yellow(text: '领取任务', onPressed: () {}), + CardBottomButton.yellow( + text: '领取任务', + onPressed: () async { + var re = await TaskFunc.take(taskId: model.id); + if (re) { + refresh(); + } + }), ], ), ], @@ -128,8 +137,22 @@ class HallCard extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.end, children: [ 40.w.heightBox, - CardBottomButton.white(text: '取消订单', onPressed: () {}), - CardBottomButton.yellow(text: '确认完成', onPressed: () {}), + CardBottomButton.white( + text: '取消订单', + onPressed: () async { + var re = await TaskFunc.cancel(taskId: model.id); + if (re) { + refresh(); + } + }), + CardBottomButton.yellow( + text: '确认完成', + onPressed: () async { + var re = await TaskFunc.finish(taskId: model.id); + if (re) { + refresh(); + } + }), ], ); case 4: diff --git a/lib/ui/service/hall/hall_detail_page.dart b/lib/ui/service/hall/hall_detail_page.dart index cd9462f4..c8c549b0 100644 --- a/lib/ui/service/hall/hall_detail_page.dart +++ b/lib/ui/service/hall/hall_detail_page.dart @@ -69,22 +69,28 @@ class _HallDetailPageState extends State { ), ), Spacer(), - Padding( - padding: EdgeInsets.only(right: 32.w), - child: MaterialButton( - color: Colors.white, - elevation: 0, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8.w), - ), - onPressed: () {}, - child: '取消订单' - .text - .size(24.sp) - .color(Colors.black.withOpacity(0.65)) - .make(), - ), - ) + // 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(), + // ), + // ) ], ), ], diff --git a/lib/ui/service/my_take_task/my_take_task_card.dart b/lib/ui/service/my_take_task/my_take_task_card.dart index dbf96c3e..a2a20fbd 100644 --- a/lib/ui/service/my_take_task/my_take_task_card.dart +++ b/lib/ui/service/my_take_task/my_take_task_card.dart @@ -1,15 +1,20 @@ +import 'package:aku_new_community/extensions/widget_list_ext.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/my_take_task_list_model.dart'; +import 'package:aku_new_community/ui/service/my_take_task/my_take_task_detail_page.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/buttons/card_bottom_button.dart'; import 'package:flustars/flustars.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; import 'package:velocity_x/velocity_x.dart'; +import '../task_func.dart'; + class MyTakeTaskCard extends StatelessWidget { - final HallListModel model; + final MyTakeTaskListModel model; final VoidCallback refresh; const MyTakeTaskCard({Key? key, required this.model, required this.refresh}) @@ -17,116 +22,121 @@ class MyTakeTaskCard extends StatelessWidget { @override Widget build(BuildContext context) { - return Container( - width: double.infinity, - decoration: BoxDecoration( - color: Color(0xFFFFF7E6), - borderRadius: BorderRadius.circular(8.w), - ), - padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), - child: Column( - children: [ - Row( - children: [ - '接单时间 ${DateUtil.formatDateStr(model.createDate)}' - .text - .size(26.sp) - .color(Colors.black.withOpacity(0.45)) - .make(), - Spacer(), - '${TaskMap.statusToString[model.status]}' - .text - .size(28.sp) - .color(Colors.black.withOpacity(0.85)) - .bold - .make() - ], - ), - 20.w.heightBox, - BeeDivider.horizontal(), - 34.w.heightBox, - Row( - children: [ - Assets.icons.clockCircle.image(width: 36.w, height: 36.w), - 24.w.widthBox, - '${DateUtil.formatDateStr(model.appointmentDate)}' - .text - .size(24.sp) - .color(Colors.black.withOpacity(0.65)) - .make(), - ], - ), - 20.w.heightBox, - Row( - children: [ - Assets.icons.environment.image(width: 36.w, height: 36.w), - 24.w.widthBox, - '${model.appointmentAddress}' - .text - .size(24.sp) - .color(Colors.black.withOpacity(0.65)) - .make(), - ], - ), - 34.w.heightBox, - Container( - width: 638.w, - decoration: BoxDecoration( - color: Colors.black.withOpacity(0.03), - borderRadius: BorderRadius.circular(8.w)), - padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + return GestureDetector( + onTap: () { + Get.to(() => MyTakeTaskDetailPage(model: model)); + }, + child: Container( + width: double.infinity, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w), + ), + padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), + child: Column( + children: [ + Row( children: [ - '#${TaskMap.typeToString[model.type]}' + '接单时间 ${DateUtil.formatDateStr(model.createDate)}' + .text + .size(26.sp) + .color(Colors.black.withOpacity(0.45)) + .make(), + Spacer(), + '${TaskMap.statusToString[model.status]}' .text .size(28.sp) .color(Colors.black.withOpacity(0.85)) + .bold + .make() + ], + ), + 20.w.heightBox, + BeeDivider.horizontal(), + 34.w.heightBox, + Row( + children: [ + Assets.icons.clockCircle.image(width: 36.w, height: 36.w), + 24.w.widthBox, + '${DateUtil.formatDateStr(model.appointmentDate)}' + .text + .size(24.sp) + .color(Colors.black.withOpacity(0.65)) .make(), - 16.w.heightBox, - model.content.text - .size(28.sp) + ], + ), + 20.w.heightBox, + Row( + children: [ + Assets.icons.environment.image(width: 36.w, height: 36.w), + 24.w.widthBox, + '${model.appointmentAddress}' + .text + .size(24.sp) .color(Colors.black.withOpacity(0.65)) .make(), ], ), - ), - 40.w.heightBox, - Row( - children: [ - Spacer(), - RichText( - text: TextSpan( - text: '实付 ', - children: model.rewardType == 2 - ? [ - WidgetSpan( - child: Assets.icons.intergral - .image(width: 24.w, height: 24.w), - ), - model.reward - .toString() - .textSpan - .size(32.sp) - .color(Colors.red) - .make(), - ] - : [ - '¥ ${model.reward}' - .toString() - .textSpan - .size(32.sp) - .color(Colors.red) - .make(), - ], - style: TextStyle( - color: Colors.black.withOpacity(0.65), fontSize: 24.sp), - ), - ) - ], - ), - _cardBottom(model.status), - ], + 34.w.heightBox, + Container( + width: 638.w, + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.03), + borderRadius: BorderRadius.circular(8.w)), + padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + '#${TaskMap.typeToString[model.type]}' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.85)) + .make(), + 16.w.heightBox, + model.content.text + .size(28.sp) + .color(Colors.black.withOpacity(0.65)) + .make(), + ], + ), + ), + 40.w.heightBox, + Row( + children: [ + Spacer(), + RichText( + text: TextSpan( + text: '实付 ', + children: model.rewardType == 2 + ? [ + WidgetSpan( + child: Assets.icons.intergral + .image(width: 24.w, height: 24.w), + ), + model.reward + .toString() + .textSpan + .size(32.sp) + .color(Colors.red) + .make(), + ] + : [ + '¥ ${model.reward}' + .toString() + .textSpan + .size(32.sp) + .color(Colors.red) + .make(), + ], + style: TextStyle( + color: Colors.black.withOpacity(0.65), fontSize: 24.sp), + ), + ) + ], + ), + _cardBottom(model.status), + ], + ), ), ); } @@ -139,10 +149,25 @@ class MyTakeTaskCard extends StatelessWidget { children: [ 40.w.heightBox, Row( + mainAxisAlignment: MainAxisAlignment.end, children: [ - CardBottomButton.white(text: '取消订单', onPressed: () {}), - CardBottomButton.yellow(text: '确认完成', onPressed: () {}), - ], + // CardBottomButton.white( + // text: '取消订单', + // onPressed: () async { + // var re = await TaskFunc.cancel(taskId: model.id); + // if (re) { + // refresh(); + // } + // }), + CardBottomButton.yellow( + text: '确认完成', + onPressed: () async { + var re = await TaskFunc.finish(taskId: model.id); + if (re) { + refresh(); + } + }), + ].sepWidget(separate: 10.w.widthBox), ) ], ); diff --git a/lib/ui/service/my_take_task/my_take_task_detail_page.dart b/lib/ui/service/my_take_task/my_take_task_detail_page.dart new file mode 100644 index 00000000..bf50cc9a --- /dev/null +++ b/lib/ui/service/my_take_task/my_take_task_detail_page.dart @@ -0,0 +1,268 @@ +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/ui/service/task_map.dart'; +import 'package:aku_new_community/widget/bee_divider.dart'; +import 'package:aku_new_community/widget/bee_scaffold.dart'; +import 'package:flustars/flustars.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class MyTakeTaskDetailPage extends StatefulWidget { + final MyTakeTaskListModel model; + + const MyTakeTaskDetailPage({Key? key, required this.model}) : super(key: key); + + @override + _MyTakeTaskDetailPageState createState() => _MyTakeTaskDetailPageState(); +} + +class _MyTakeTaskDetailPageState extends State { + @override + Widget build(BuildContext context) { + return BeeScaffold( + extendBody: true, + title: '', + body: Stack( + children: [ + Column( + children: [ + Container( + width: double.infinity, + height: 380.w, + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + colors: widget.model.status == 4 + ? [ + Colors.white, + Color(0xFFADACAC), + ] + : [ + Color(0xFFFFB737), + Color(0xFFFFD361), + ]), + ), + child: Column( + children: [ + 150.w.heightBox, + Row( + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 32.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + '${TaskMap.detailStatusToString[widget.model.status]}' + .text + .size(40.sp) + .color(Colors.black) + .bold + .make(), + '${TaskMap.subStatus[widget.model.status]}' + .text + .size(24.sp) + .color(Colors.black.withOpacity(0.45)) + .make(), + ], + ), + ), + 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(), + // ), + // ) + ], + ), + ], + ), + ), + Flexible( + child: Container( + width: double.infinity, + color: Color(0xFFE5E5E5), + ), + ), + ], + ), + Positioned( + top: 280.w, + left: 32.w, + right: 32.w, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + _content(), + 24.w.heightBox, + _taskInfo(), + ], + )), + ], + ), + ); + } + + Widget _taskInfo() { + return Container( + width: 686.w, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w), + ), + padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), + child: Column( + children: [ + Row( + children: [ + '任务信息'.text.size(28.sp).color(Colors.black).bold.make(), + Spacer(), + ], + ), + 24.w.heightBox, + BeeDivider.horizontal(), + 24.w.heightBox, + Row( + children: [ + '创建时间' + .text + .size(24.sp) + .color(Colors.black.withOpacity(0.45)) + .make(), + Spacer(), + '${DateUtil.formatDateStr(widget.model.createDate)}' + .text + .size(24.sp) + .color(Colors.black.withOpacity(0.45)) + .make() + ], + ), + ], + ), + ); + } + + Widget _content() { + var head = Row( + children: [ + Container( + width: 100.w, + height: 50.w, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFFFFF7E6), + borderRadius: BorderRadius.circular(8.w), + ), + child: '#${TaskMap.typeToString[widget.model.type]}' + .text + .size(28.sp) + .color(Color(0xFFFA8C16)) + .make(), + ), + 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( + width: 686.w, + height: 500.w, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w), + ), + padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), + child: Column( + children: [ + head, + 34.w.heightBox, + Row( + children: [ + Assets.icons.clockCircle.image(width: 36.w, height: 36.w), + 24.w.widthBox, + '${DateUtil.formatDateStr(widget.model.appointmentDate)}' + .text + .size(24.sp) + .color(Colors.black.withOpacity(0.65)) + .make(), + ], + ), + 20.w.heightBox, + Row( + children: [ + Assets.icons.environment.image(width: 36.w, height: 36.w), + 24.w.widthBox, + '${widget.model.appointmentAddress}' + .text + .size(24.sp) + .color(Colors.black.withOpacity(0.65)) + .make(), + ], + ), + 34.w.heightBox, + Container( + width: 638.w, + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.03), + borderRadius: BorderRadius.circular(8.w)), + padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + '#${TaskMap.typeToString[widget.model.type]}' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.85)) + .make(), + 16.w.heightBox, + widget.model.content.text + .size(28.sp) + .color(Colors.black.withOpacity(0.65)) + .make(), + ], + ), + ), + 32.w.heightBox, + BeeDivider.horizontal(), + 32.w.heightBox, + Row( + children: [ + Assets.icons.reward.image(width: 36.w, height: 36.w), + 24.w.widthBox, + '报酬' + .text + .size(26.sp) + .color(Colors.black.withOpacity(0.45)) + .make(), + Spacer(), + '¥${widget.model.reward}' + .text + .size(32.sp) + .color(Colors.red) + .make(), + ], + ), + ], + ), + ); + } +} diff --git a/lib/ui/service/my_task/my_task_card.dart b/lib/ui/service/my_task/my_task_card.dart index 5f662aa5..21a77f8d 100644 --- a/lib/ui/service/my_task/my_task_card.dart +++ b/lib/ui/service/my_task/my_task_card.dart @@ -1,12 +1,16 @@ 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/ui/service/my_task/my_task_detail_page.dart'; import 'package:aku_new_community/ui/service/task_map.dart'; import 'package:aku_new_community/widget/buttons/card_bottom_button.dart'; import 'package:flustars/flustars.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; import 'package:velocity_x/velocity_x.dart'; +import '../task_func.dart'; + class MyTaskCard extends StatelessWidget { final MyTaskListModel model; final VoidCallback refresh; @@ -41,110 +45,122 @@ class MyTaskCard extends StatelessWidget { .make() ], ); - return Container( - width: double.infinity, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8.w), - ), - padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), - child: Column( - children: [ - head, - 34.w.heightBox, - Row( - children: [ - Assets.icons.clockCircle.image(width: 36.w, height: 36.w), - 24.w.widthBox, - '${DateUtil.formatDateStr(model.appointmentDate)}' - .text - .size(24.sp) - .color(Colors.black.withOpacity(0.65)) - .make(), - ], - ), - 20.w.heightBox, - Row( - children: [ - Assets.icons.environment.image(width: 36.w, height: 36.w), - 24.w.widthBox, - '${model.appointmentAddress}' - .text - .size(24.sp) - .color(Colors.black.withOpacity(0.65)) - .make(), - ], - ), - 34.w.heightBox, - Container( - width: 638.w, - decoration: BoxDecoration( - color: Colors.black.withOpacity(0.03), - borderRadius: BorderRadius.circular(8.w)), - padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + return GestureDetector( + onTap: () { + Get.to(() => MyTaskDetailPage(model: model)); + }, + child: Container( + width: double.infinity, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w), + ), + padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), + child: Column( + children: [ + head, + 34.w.heightBox, + Row( children: [ - '#${TaskMap.typeToString[model.type]}' + Assets.icons.clockCircle.image(width: 36.w, height: 36.w), + 24.w.widthBox, + '${DateUtil.formatDateStr(model.appointmentDate)}' .text - .size(28.sp) - .color(Colors.black.withOpacity(0.85)) + .size(24.sp) + .color(Colors.black.withOpacity(0.65)) .make(), - 16.w.heightBox, - model.content.text - .size(28.sp) + ], + ), + 20.w.heightBox, + Row( + children: [ + Assets.icons.environment.image(width: 36.w, height: 36.w), + 24.w.widthBox, + '${model.appointmentAddress}' + .text + .size(24.sp) .color(Colors.black.withOpacity(0.65)) .make(), ], ), - ), - 40.w.heightBox, - Row( - children: [ - Spacer(), - RichText( - text: TextSpan( - text: '实付 ', - children: model.rewardType == 2 - ? [ - WidgetSpan( - child: Assets.icons.intergral - .image(width: 24.w, height: 24.w), - ), - model.reward - .toString() - .textSpan - .size(32.sp) - .color(Colors.red) - .make(), - ] - : [ - '¥ ${model.reward}' - .toString() - .textSpan - .size(32.sp) - .color(Colors.red) - .make(), - ], - style: TextStyle( - color: Colors.black.withOpacity(0.65), fontSize: 24.sp), - ), - ) - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - 40.w.heightBox, - Row( + 34.w.heightBox, + Container( + width: 638.w, + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.03), + borderRadius: BorderRadius.circular(8.w)), + padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Spacer(), - CardBottomButton.yellow(text: '取消订单', onPressed: () {}), + '#${TaskMap.typeToString[model.type]}' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.85)) + .make(), + 16.w.heightBox, + model.content.text + .size(28.sp) + .color(Colors.black.withOpacity(0.65)) + .make(), ], ), - ], - ), - ], + ), + 40.w.heightBox, + Row( + children: [ + Spacer(), + RichText( + text: TextSpan( + text: '实付 ', + children: model.rewardType == 2 + ? [ + WidgetSpan( + child: Assets.icons.intergral + .image(width: 24.w, height: 24.w), + ), + model.reward + .toString() + .textSpan + .size(32.sp) + .color(Colors.red) + .make(), + ] + : [ + '¥ ${model.reward}' + .toString() + .textSpan + .size(32.sp) + .color(Colors.red) + .make(), + ], + style: TextStyle( + color: Colors.black.withOpacity(0.65), fontSize: 24.sp), + ), + ) + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + 40.w.heightBox, + Row( + children: [ + Spacer(), + CardBottomButton.yellow( + text: '取消订单', + onPressed: () async { + var re = await TaskFunc.cancel(taskId: model.id); + if (re) { + refresh(); + } + }), + ], + ), + ], + ), + ], + ), ), ); } diff --git a/lib/ui/service/my_task/my_task_detail_page.dart b/lib/ui/service/my_task/my_task_detail_page.dart new file mode 100644 index 00000000..627882a6 --- /dev/null +++ b/lib/ui/service/my_task/my_task_detail_page.dart @@ -0,0 +1,268 @@ +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/ui/service/task_map.dart'; +import 'package:aku_new_community/widget/bee_divider.dart'; +import 'package:aku_new_community/widget/bee_scaffold.dart'; +import 'package:flustars/flustars.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class MyTaskDetailPage extends StatefulWidget { + final MyTaskListModel model; + + const MyTaskDetailPage({Key? key, required this.model}) : super(key: key); + + @override + _MyTaskDetailPageState createState() => _MyTaskDetailPageState(); +} + +class _MyTaskDetailPageState extends State { + @override + Widget build(BuildContext context) { + return BeeScaffold( + extendBody: true, + title: '', + body: Stack( + children: [ + Column( + children: [ + Container( + width: double.infinity, + height: 380.w, + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + colors: widget.model.status == 4 + ? [ + Colors.white, + Color(0xFFADACAC), + ] + : [ + Color(0xFFFFB737), + Color(0xFFFFD361), + ]), + ), + child: Column( + children: [ + 150.w.heightBox, + Row( + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 32.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + '${TaskMap.detailStatusToString[widget.model.status]}' + .text + .size(40.sp) + .color(Colors.black) + .bold + .make(), + '${TaskMap.subStatus[widget.model.status]}' + .text + .size(24.sp) + .color(Colors.black.withOpacity(0.45)) + .make(), + ], + ), + ), + 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(), + // ), + // ) + ], + ), + ], + ), + ), + Flexible( + child: Container( + width: double.infinity, + color: Color(0xFFE5E5E5), + ), + ), + ], + ), + Positioned( + top: 280.w, + left: 32.w, + right: 32.w, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + _content(), + 24.w.heightBox, + _taskInfo(), + ], + )), + ], + ), + ); + } + + Widget _taskInfo() { + return Container( + width: 686.w, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w), + ), + padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), + child: Column( + children: [ + Row( + children: [ + '任务信息'.text.size(28.sp).color(Colors.black).bold.make(), + Spacer(), + ], + ), + 24.w.heightBox, + BeeDivider.horizontal(), + 24.w.heightBox, + Row( + children: [ + '创建时间' + .text + .size(24.sp) + .color(Colors.black.withOpacity(0.45)) + .make(), + Spacer(), + '${DateUtil.formatDateStr(widget.model.createDate)}' + .text + .size(24.sp) + .color(Colors.black.withOpacity(0.45)) + .make() + ], + ), + ], + ), + ); + } + + Widget _content() { + var head = Row( + children: [ + Container( + width: 100.w, + height: 50.w, + alignment: Alignment.center, + decoration: BoxDecoration( + color: Color(0xFFFFF7E6), + borderRadius: BorderRadius.circular(8.w), + ), + child: '#${TaskMap.typeToString[widget.model.type]}' + .text + .size(28.sp) + .color(Color(0xFFFA8C16)) + .make(), + ), + 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( + width: 686.w, + height: 500.w, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w), + ), + padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), + child: Column( + children: [ + head, + 34.w.heightBox, + Row( + children: [ + Assets.icons.clockCircle.image(width: 36.w, height: 36.w), + 24.w.widthBox, + '${DateUtil.formatDateStr(widget.model.appointmentDate)}' + .text + .size(24.sp) + .color(Colors.black.withOpacity(0.65)) + .make(), + ], + ), + 20.w.heightBox, + Row( + children: [ + Assets.icons.environment.image(width: 36.w, height: 36.w), + 24.w.widthBox, + '${widget.model.appointmentAddress}' + .text + .size(24.sp) + .color(Colors.black.withOpacity(0.65)) + .make(), + ], + ), + 34.w.heightBox, + Container( + width: 638.w, + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.03), + borderRadius: BorderRadius.circular(8.w)), + padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + '#${TaskMap.typeToString[widget.model.type]}' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.85)) + .make(), + 16.w.heightBox, + widget.model.content.text + .size(28.sp) + .color(Colors.black.withOpacity(0.65)) + .make(), + ], + ), + ), + 32.w.heightBox, + BeeDivider.horizontal(), + 32.w.heightBox, + Row( + children: [ + Assets.icons.reward.image(width: 36.w, height: 36.w), + 24.w.widthBox, + '报酬' + .text + .size(26.sp) + .color(Colors.black.withOpacity(0.45)) + .make(), + Spacer(), + '¥${widget.model.reward}' + .text + .size(32.sp) + .color(Colors.red) + .make(), + ], + ), + ], + ), + ); + } +} diff --git a/lib/ui/service/publish_task_page.dart b/lib/ui/service/publish_task_page.dart index 935f3ccf..38f21c34 100644 --- a/lib/ui/service/publish_task_page.dart +++ b/lib/ui/service/publish_task_page.dart @@ -266,7 +266,7 @@ class _PublishTaskPageState extends State { Get.back(); setState(() {}); }, - child: '业主' + child: '物业' .text .size(28.sp) .isIntrinsic diff --git a/lib/ui/service/task_func.dart b/lib/ui/service/task_func.dart index d302af30..347c3997 100644 --- a/lib/ui/service/task_func.dart +++ b/lib/ui/service/task_func.dart @@ -31,7 +31,7 @@ class TaskFunc { static Future cancel({ required int taskId, }) async { - var base = await NetUtil().post(API.manager.task.cancel, params: { + var base = await NetUtil().get(API.manager.task.cancel, params: { 'taskId': taskId, }); return base.status ?? false; @@ -42,7 +42,7 @@ class TaskFunc { static Future take({ required int taskId, }) async { - var base = await NetUtil().post(API.manager.task.take, params: { + var base = await NetUtil().get(API.manager.task.take, params: { 'taskId': taskId, }); return base.status ?? false; @@ -53,7 +53,7 @@ class TaskFunc { static Future finish({ required int taskId, }) async { - var base = await NetUtil().post(API.manager.task.finish, params: { + var base = await NetUtil().get(API.manager.task.finish, params: { 'taskId': taskId, }); return base.status ?? false;