From 32ffd97ee1166809f7fa30447988cbd683c06eb4 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Wed, 21 Jul 2021 17:49:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=20=E6=B4=BE=E5=8D=95/?= =?UTF-8?q?=E6=8E=A5=E5=8D=95/=E6=9F=A5=E8=AF=A2=E6=B4=BE=E5=8D=95?= =?UTF-8?q?=E4=BA=BA/=E5=A4=84=E7=90=86=E5=AE=8C=E6=88=90=E7=85=A7?= =?UTF-8?q?=E7=89=87=E4=B8=8A=E4=BC=A0/=E6=8F=90=E4=BA=A4=E6=8A=A5?= =?UTF-8?q?=E5=91=8A/=E5=82=AC=E5=8D=95=20=E7=AD=89=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/const/api.dart | 23 ++++ .../house_keeping_pick_staff_model.dart | 101 ++++++++++++++ .../house_keeping_pick_staff_model.g.dart | 41 ++++++ .../house_keeping/house_keeping_card.dart | 29 +++- .../house_keeping_department_page.dart | 86 ++++++------ .../house_keeping_detail_page.dart | 49 ++++++- .../house_keeping_feed_back_page.dart | 124 +++++++++++++----- .../house_keeping/house_keeping_func.dart | 103 ++++++++++++++- lib/utils/network/net_util.dart | 6 +- 9 files changed, 470 insertions(+), 92 deletions(-) create mode 100644 lib/json_models/manager/house_keeping/house_keeping_pick_staff_model.dart create mode 100644 lib/json_models/manager/house_keeping/house_keeping_pick_staff_model.g.dart diff --git a/lib/const/api.dart b/lib/const/api.dart index eb0783a..8e8dfdd 100644 --- a/lib/const/api.dart +++ b/lib/const/api.dart @@ -287,6 +287,25 @@ class _Manage { ///管家app新版家政服务:根据家政服务主键id查询家政服务服务进程 String get newHouseKeepingProcess => '/user/housekeepingService/findHousekeepingProcessRecord'; + + ///管家app 新版家政服务:催促人员 + String get newHouseKeepingUrgeWork => + '/user/housekeepingService/urgedWorkers'; + + ///管家app 新版家政服务:接单 + String get newHouseKeepingOrderReceive => + '/user/housekeepingService/orderReceiving'; + + ///管家app 新版家政服务:查询所有的接单人员 + String get newHouseKeepingPickStaffList => + '/user/housekeepingService/findPickUpSinglePersonnel'; + + ///管家app 新版家政服务:派单 + String get newHouseKeepingOrderDepart => + '/user/housekeepingService/sendSingle'; + + ///管家app 新版家政服务:提交报告 + String get newHouseKeepingSubmit => '/user/housekeepingService/submitReport'; } class _Upload { @@ -327,6 +346,10 @@ class _Upload { ///上传设施设备检查照片 String get uploadFacilitiCheckPhoto => '/user/upload/uploadFacilitiesCheckPhoto'; + + ///家政服务 上传处理完成照片 + String get uploadHandlerPhoto => + '/user/upload/uploadHousekeepingServiceHandlerPhone'; } class _Message { diff --git a/lib/json_models/manager/house_keeping/house_keeping_pick_staff_model.dart b/lib/json_models/manager/house_keeping/house_keeping_pick_staff_model.dart new file mode 100644 index 0000000..f28a708 --- /dev/null +++ b/lib/json_models/manager/house_keeping/house_keeping_pick_staff_model.dart @@ -0,0 +1,101 @@ +import 'package:equatable/equatable.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'house_keeping_pick_staff_model.g.dart'; + +@JsonSerializable() +class HouseKeepingPickStaffModel extends Equatable { + final int id; + final String? userName; + final String? pwd; + final String actualName; + final String tel; + final int? sex; + final String? userCode; + final String? birthday; + final String? email; + final String? idCard; + final int? organizationId; + final String? organizationIdPath; + final int? positionId; + final int? roleId; + final int? status; + final int? isDelete; + final int? createId; + final String? createDate; + final int? modifyId; + final String? modifyDate; + final String? lastLoginIp; + final String? lastLoginDate; + final String? nickName; + final String? code; + final String? codeSendDate; + final String? remake; + final String? reportTo; + final String? entryDate; + HouseKeepingPickStaffModel({ + required this.id, + this.userName, + this.pwd, + required this.actualName, + required this.tel, + this.sex, + this.userCode, + this.birthday, + this.email, + this.idCard, + this.organizationId, + this.organizationIdPath, + this.positionId, + this.roleId, + this.status, + this.isDelete, + this.createId, + this.createDate, + this.modifyId, + this.modifyDate, + this.lastLoginIp, + this.lastLoginDate, + this.nickName, + this.code, + this.codeSendDate, + this.remake, + this.reportTo, + this.entryDate, + }); + factory HouseKeepingPickStaffModel.fromJson(Map json) => + _$HouseKeepingPickStaffModelFromJson(json); + @override + List get props { + return [ + id, + userName, + pwd, + actualName, + tel, + sex, + userCode, + birthday, + email, + idCard, + organizationId, + organizationIdPath, + positionId, + roleId, + status, + isDelete, + createId, + createDate, + modifyId, + modifyDate, + lastLoginIp, + lastLoginDate, + nickName, + code, + codeSendDate, + remake, + reportTo, + entryDate, + ]; + } +} diff --git a/lib/json_models/manager/house_keeping/house_keeping_pick_staff_model.g.dart b/lib/json_models/manager/house_keeping/house_keeping_pick_staff_model.g.dart new file mode 100644 index 0000000..8a34519 --- /dev/null +++ b/lib/json_models/manager/house_keeping/house_keeping_pick_staff_model.g.dart @@ -0,0 +1,41 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'house_keeping_pick_staff_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +HouseKeepingPickStaffModel _$HouseKeepingPickStaffModelFromJson( + Map json) { + return HouseKeepingPickStaffModel( + id: json['id'] as int, + userName: json['userName'] as String?, + pwd: json['pwd'] as String?, + actualName: json['actualName'] as String, + tel: json['tel'] as String, + sex: json['sex'] as int?, + userCode: json['userCode'] as String?, + birthday: json['birthday'] as String?, + email: json['email'] as String?, + idCard: json['idCard'] as String?, + organizationId: json['organizationId'] as int?, + organizationIdPath: json['organizationIdPath'] as String?, + positionId: json['positionId'] as int?, + roleId: json['roleId'] as int?, + status: json['status'] as int?, + isDelete: json['isDelete'] as int?, + createId: json['createId'] as int?, + createDate: json['createDate'] as String?, + modifyId: json['modifyId'] as int?, + modifyDate: json['modifyDate'] as String?, + lastLoginIp: json['lastLoginIp'] as String?, + lastLoginDate: json['lastLoginDate'] as String?, + nickName: json['nickName'] as String?, + code: json['code'] as String?, + codeSendDate: json['codeSendDate'] as String?, + remake: json['remake'] as String?, + reportTo: json['reportTo'] as String?, + entryDate: json['entryDate'] as String?, + ); +} diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_card.dart b/lib/ui/manage_pages/house_keeping/house_keeping_card.dart index c12abc2..398f1b2 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_card.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_card.dart @@ -4,13 +4,16 @@ import 'package:aku_community_manager/json_models/manager/house_keeping/house_ke import 'package:aku_community_manager/models/user/user_info_model.dart'; import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/tools/user_tool.dart'; +import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_department_page.dart'; import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_detail_page.dart'; import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_func.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_material_button.dart'; import 'package:aku_community_manager/ui/widgets/inner/aku_chip_box.dart'; +import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:url_launcher/url_launcher.dart'; import 'package:velocity_x/velocity_x.dart'; class HouseKeepingCard extends StatelessWidget { @@ -31,6 +34,7 @@ class HouseKeepingCard extends StatelessWidget { await Get.to(() => HouseKeepingDetailPage( model: model, processModels: processModels, + callRefresh: callRefresh, )); callRefresh(); }, @@ -128,7 +132,15 @@ class HouseKeepingCard extends StatelessWidget { return [ AkuMaterialButton( height: 64.w, - onPressed: () async {}, + onPressed: () async { + (UserTool.userProvider.infoModel!.houseKeepingAuthority == + HKAUTH.SEND) + ? Get.to(() => HouseKeepingDepartmentPage( + id: model.id, + callRefresh: callRefresh, + )) + : null; + }, radius: 4, color: AppStyle.primaryColor, padding: EdgeInsets.symmetric(horizontal: 24.w), @@ -151,10 +163,13 @@ class HouseKeepingCard extends StatelessWidget { AkuMaterialButton( height: 64.w, onPressed: () async { - // Get.to(() => BusinessAndFixDetailPage(model: widget.model)); - // if (widget.callRefresh != null) { - // widget.callRefresh!(); - // } + Function cancel = BotToast.showLoading(); + (UserTool.userProvider.infoModel!.houseKeepingAuthority == + HKAUTH.SEND) + ? await HouseKeepingFunc.newHouseKeepingUrgeWork(model.id) + : await HouseKeepingFunc.newHouseKeepingOrderReceive( + model.id); + cancel(); }, radius: 4, color: AppStyle.primaryColor, @@ -195,7 +210,9 @@ class HouseKeepingCard extends StatelessWidget { : SizedBox(), AkuMaterialButton( height: 64.w, - onPressed: () async {}, + onPressed: () async { + await launch(model.proposerTel); + }, radius: 4, color: AppStyle.primaryColor, padding: EdgeInsets.symmetric(horizontal: 24.w), diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_department_page.dart b/lib/ui/manage_pages/house_keeping/house_keeping_department_page.dart index a87f170..e6fdbc3 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_department_page.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_department_page.dart @@ -1,14 +1,22 @@ +import 'package:aku_community_manager/json_models/manager/house_keeping/house_keeping_pick_staff_model.dart'; import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_func.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_material_button.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_community_manager/ui/widgets/inner/aku_bottom_button.dart'; import 'package:expandable/expandable.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:get/get.dart'; import 'package:velocity_x/velocity_x.dart'; import 'package:aku_community_manager/utils/extension/list_extension.dart'; class HouseKeepingDepartmentPage extends StatefulWidget { - HouseKeepingDepartmentPage({Key? key}) : super(key: key); + final int id; + final VoidCallback callRefresh; + HouseKeepingDepartmentPage( + {Key? key, required this.id, required this.callRefresh}) + : super(key: key); @override _HouseKeepingDepartmentPageState createState() => @@ -17,29 +25,37 @@ class HouseKeepingDepartmentPage extends StatefulWidget { class _HouseKeepingDepartmentPageState extends State { + List _models = []; + int _selectId = 0; @override Widget build(BuildContext context) { return AkuScaffold( - title: '派单人员列表', - body: EasyRefresh( - firstRefresh: true, - header: MaterialHeader(), - onRefresh: () async {}, - child: ListView( - children: [ - _buildItem(1), - ], - )), - ); + title: '派单人员列表', + body: EasyRefresh( + firstRefresh: true, + header: MaterialHeader(), + onRefresh: () async { + _models = await HouseKeepingFunc.newHouseKeepingPickStaffList(); + }, + child: ListView(children: _buildItem(_models))), + bottom: AkuBottomButton( + title: '立即派单', + onTap: () async { + bool result = await HouseKeepingFunc.newHouseKeepingOrderDepart( + widget.id, _selectId); + if (result) { + Get.back(); + widget.callRefresh(); + } + }, + )); } - _buildItem(int index) { + _buildItem(List models) { return Container( decoration: BoxDecoration( border: Border( - top: index == 0 - ? BorderSide.none - : BorderSide(color: Color(0xFFE8E8E8), width: 1.w), + top: BorderSide.none, bottom: BorderSide(color: Color(0xFFE8E8E8), width: 1.w), ), ), @@ -52,7 +68,7 @@ class _HouseKeepingDepartmentPageState alignment: Alignment.centerLeft, padding: EdgeInsets.symmetric(horizontal: 32.w), child: Text( - 'model.name!', + '环境卫生部', style: TextStyle( color: AppStyle.primaryTextColor, fontSize: 32.sp, @@ -69,21 +85,18 @@ class _HouseKeepingDepartmentPageState height: 1.w, thickness: 1.w, ), - ...[].map((e) { + ...models.map((e) { return Column( mainAxisSize: MainAxisSize.min, children: [ AkuMaterialButton( height: 96.w, onPressed: () { - // if (_pickedFixers - // .indexWhere((element) => element.id == e.id) == - // -1) { - // _pickedFixers.add(e); - // } else { - // _pickedFixers.remove(e); - // } - // _reportModel!.operato = e.id; + if (_selectId == e.id) { + _selectId = 0; + } else { + _selectId = e.id; + } setState(() {}); }, child: Row( @@ -92,18 +105,13 @@ class _HouseKeepingDepartmentPageState Checkbox( checkColor: AppStyle.primaryTextColor, activeColor: AppStyle.primaryColor, - value: false, + value: _selectId == e.id, onChanged: (state) { - // if (_pickedFixers.indexOf(e) == -1) { - // _pickedFixers.add(e); - // } else { - // _pickedFixers.remove(e); - // } - // if (_reportModel!.operato == e.id) { - // _reportModel!.operato = -1; - // } else { - // _reportModel!.operato = e.id; - // } + if (state ?? false) { + _selectId = 0; + } else { + _selectId = e.id; + } setState(() {}); }, materialTapTargetSize: @@ -115,7 +123,7 @@ class _HouseKeepingDepartmentPageState width: 40.w, ), Text( - e.name!, + e.actualName, style: TextStyle( color: AppStyle.primaryTextColor, fontSize: 28.w, @@ -129,7 +137,7 @@ class _HouseKeepingDepartmentPageState width: 40.w, ), Text( - e.tel!, + e.tel, style: TextStyle( color: AppStyle.primaryTextColor, fontSize: 28.w, diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_detail_page.dart b/lib/ui/manage_pages/house_keeping/house_keeping_detail_page.dart index 4eb0a01..cb8206c 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_detail_page.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_detail_page.dart @@ -1,9 +1,13 @@ import 'package:aku_community_manager/const/api.dart'; import 'package:aku_community_manager/json_models/manager/house_keeping/house_keeping_list_model.dart'; import 'package:aku_community_manager/json_models/manager/house_keeping/house_keeping_process_model.dart'; +import 'package:aku_community_manager/models/user/user_info_model.dart'; import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/tools/aku_divider.dart'; +import 'package:aku_community_manager/tools/user_tool.dart'; +import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_department_page.dart'; import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_feed_back_page.dart'; +import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_func.dart'; import 'package:aku_community_manager/ui/widgets/app_widgets/bee_grid_image_view.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_community_manager/ui/widgets/inner/aku_bottom_button.dart'; @@ -14,6 +18,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_rating_bar/flutter_rating_bar.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:url_launcher/url_launcher.dart'; import 'package:velocity_x/velocity_x.dart'; import 'package:aku_community_manager/utils/extension/list_extension.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; @@ -21,8 +26,12 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart'; class HouseKeepingDetailPage extends StatefulWidget { final HouseKeepingListModel model; final List processModels; + final VoidCallback callRefresh; HouseKeepingDetailPage( - {Key? key, required this.model, required this.processModels}) + {Key? key, + required this.model, + required this.processModels, + required this.callRefresh}) : super(key: key); @override @@ -54,7 +63,7 @@ class _HouseKeepingDetailPageState extends State { _buildEvaluate(), ].sepWidget(separate: 16.w.heightBox), ), - bottom: _getBottomButtons(1), + bottom: _getBottomButtons(widget.model.status), ); } @@ -62,15 +71,43 @@ class _HouseKeepingDetailPageState extends State { switch (status) { case 1: return AkuBottomButton( - title: '立即提交', + title: '立即派单', onTap: () { - Get.to(() => HouseKeepingFeedBackPage()); + Get.to(() => HouseKeepingDepartmentPage( + id: widget.model.id, callRefresh: widget.callRefresh)); }, ); case 2: + return UserTool.userProvider.infoModel!.houseKeepingAuthority == + HKAUTH.PICK + ? AkuBottomButton( + title: '立即接单', + onTap: () async { + bool reslut = + await await HouseKeepingFunc.newHouseKeepingOrderReceive( + widget.model.id); + if (reslut) { + Get.back(); + } + }, + ) + : SizedBox(); + case 3: return AkuBottomButton( - title: '', - onTap: () {}, + title: '提交报告', + onTap: () { + Get.to(() => HouseKeepingFeedBackPage( + model: widget.model, + callRefresh: widget.callRefresh + )); + }, + ); + case 4: + return AkuBottomButton( + title: '联系用户', + onTap: () async { + await launch(widget.model.proposerTel); + }, ); default: return SizedBox(); diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_feed_back_page.dart b/lib/ui/manage_pages/house_keeping/house_keeping_feed_back_page.dart index 3890802..4c1583a 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_feed_back_page.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_feed_back_page.dart @@ -1,17 +1,28 @@ import 'dart:io'; +import 'package:aku_community_manager/json_models/manager/house_keeping/house_keeping_list_model.dart'; import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/tools/aku_divider.dart'; +import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_func.dart'; import 'package:aku_community_manager/ui/widgets/app_widgets/aku_pick_image_widget.dart'; import 'package:aku_community_manager/ui/widgets/app_widgets/aku_single_check_button.dart'; import 'package:aku_community_manager/ui/widgets/app_widgets/bee_grid_image_view.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_community_manager/ui/widgets/inner/aku_bottom_button.dart'; +import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:power_logger/power_logger.dart'; import 'package:velocity_x/velocity_x.dart'; + class HouseKeepingFeedBackPage extends StatefulWidget { - HouseKeepingFeedBackPage({Key? key}) : super(key: key); + final HouseKeepingListModel model; + final VoidCallback callRefresh; + HouseKeepingFeedBackPage( + {Key? key, required this.model, required this.callRefresh}) + : super(key: key); @override _HouseKeepingFeedBackPageState createState() => @@ -21,20 +32,25 @@ class HouseKeepingFeedBackPage extends StatefulWidget { class _HouseKeepingFeedBackPageState extends State { int _feedBackStatus = 0; late TextEditingController _editingController; - late TextEditingController _priceController; - + late TextEditingController _materialPriceController; + late TextEditingController _servicePriceController; + late TextEditingController _totalPriceController; List _files = []; @override void initState() { super.initState(); _editingController = TextEditingController(); - _priceController = TextEditingController(); + _materialPriceController = TextEditingController(); + _servicePriceController = TextEditingController(); + _totalPriceController = TextEditingController(); } @override void dispose() { _editingController.dispose(); - _priceController.dispose(); + _materialPriceController.dispose(); + _servicePriceController.dispose(); + _totalPriceController.dispose(); super.dispose(); } @@ -52,6 +68,34 @@ class _HouseKeepingFeedBackPageState extends State { _payTile(), ], ), + bottom: AkuBottomButton( + title: '立即提交', + onTap: () async { + Function cancel = BotToast.showLoading(); + try { + List _urls = + await HouseKeepingFunc.uploadHouseKeepingHandlePhoto(_files); + bool result = await HouseKeepingFunc.newHouseKeepingSubmit( + widget.model.id, + _feedBackStatus, + _editingController.text, + double.tryParse(_materialPriceController.text) ?? 0, + double.tryParse(_servicePriceController.text) ?? 0, + double.tryParse(_totalPriceController.text) ?? 0, + _urls, + ); + + if (result) { + Get.back(); + Get.back(); + widget.callRefresh(); + } + } catch (e) { + LoggerData.addData(e); + } + cancel(); + }, + ), ); } @@ -65,9 +109,11 @@ class _HouseKeepingFeedBackPageState extends State { children: [ '服务信息'.text.size(36.sp).black.bold.make(), 40.w.heightBox, - ''.text.size(28.sp).black.make(), + widget.model.content.text.size(28.sp).black.make(), 16.w.heightBox, - BeeGridImageView(urls: []), + BeeGridImageView( + urls: + widget.model.submitImgList.map((e) => e.url ?? '').toList()), ], ), ); @@ -153,39 +199,45 @@ class _HouseKeepingFeedBackPageState extends State { color: Colors.white, child: Column( children: [ - Row( - children: [ - '支付费用'.text.size(28.sp).black.make(), - 350.w.widthBox, - '¥'.text.size(32.sp).bold.color(Colors.red).make(), - 24.w.widthBox, - TextField( - controller: _editingController, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(r'^[0-9][\.\d]*(,\d+)?$')) - ], - keyboardType: TextInputType.number, - decoration: InputDecoration( - contentPadding: EdgeInsets.zero, - isDense: true, - border: InputBorder.none, - hintText: '请输入金额', - hintStyle: TextStyle( - fontSize: 32.sp, - color: kTextSubColor, - fontWeight: FontWeight.bold)), - style: TextStyle( - fontSize: 32.sp, - color: Colors.black, - ), - ).expand(), - ], - ), + _payInputTile('材料费用', _materialPriceController), + _payInputTile('服务费用', _servicePriceController), + _payInputTile('总计费用', _totalPriceController), 24.w.heightBox, AkuDivider.horizontal() ], ), ); } + + Widget _payInputTile(String title, TextEditingController controller) { + return Row( + children: [ + title.text.size(28.sp).black.make(), + Spacer(), + '¥'.text.size(32.sp).bold.color(Colors.red).make(), + 24.w.widthBox, + TextField( + controller: controller, + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp(r'^[0-9][\.\d]*(,\d+)?$')) + ], + keyboardType: TextInputType.number, + textAlign: TextAlign.end, + decoration: InputDecoration( + contentPadding: EdgeInsets.zero, + isDense: true, + border: InputBorder.none, + hintText: '请输入金额', + hintStyle: TextStyle( + fontSize: 32.sp, + color: kTextSubColor, + fontWeight: FontWeight.bold)), + style: TextStyle( + fontSize: 32.sp, + color: Colors.black, + ), + ).expand(), + ], + ); + } } diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_func.dart b/lib/ui/manage_pages/house_keeping/house_keeping_func.dart index 85e3a1f..84738eb 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_func.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_func.dart @@ -1,10 +1,14 @@ +import 'dart:io'; + import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/json_models/manager/house_keeping/house_keeping_pick_staff_model.dart'; import 'package:aku_community_manager/json_models/manager/house_keeping/house_keeping_process_model.dart'; import 'package:aku_community_manager/utils/network/base_model.dart'; import 'package:aku_community_manager/utils/network/net_util.dart'; +import 'package:bot_toast/bot_toast.dart'; class HouseKeepingFunc { - ///获取家政服务进程 + ///获取家政服务进程 static Future getHouseKeepingProcess(int id) async { BaseModel baseModel = await NetUtil().get(API.manage.newHouseKeepingProcess, params: {"housekeepingServiceId": id}); @@ -16,4 +20,99 @@ class HouseKeepingFunc { return []; } } -} \ No newline at end of file + + ///催单 + static Future newHouseKeepingUrgeWork(int id) async { + BaseModel baseModel = + await NetUtil().get(API.manage.newHouseKeepingUrgeWork, params: { + "housekeepingServiceId": id, + }); + if (baseModel.status ?? false) { + BotToast.showText(text: '已成功催单,请耐心等候'); + return true; + } else { + return false; + } + } + + ///接单 + static Future newHouseKeepingOrderReceive(int id) async { + BaseModel baseModel = + await NetUtil().post(API.manage.newHouseKeepingOrderReceive, params: { + "id": id, + }); + if (baseModel.status ?? false) { + BotToast.showText(text: '接单成功'); + return true; + } else { + return false; + } + } + + ///获得派单人员列表 + static Future newHouseKeepingPickStaffList() async { + BaseModel baseModel = + await NetUtil().get(API.manage.newHouseKeepingPickStaffList); + if (baseModel.status ?? false) { + return (baseModel.data as List) + .map((e) => HouseKeepingPickStaffModel.fromJson(e)) + .toList(); + } else { + return []; + } + } + + ///派单 + static Future newHouseKeepingOrderDepart(int id, int handlerId) async { + BaseModel baseModel = + await NetUtil().post(API.manage.newHouseKeepingOrderDepart, params: { + "id": id, + "handler": handlerId, + }); + if (baseModel.status ?? false) { + BotToast.showText(text: '派单成功'); + return true; + } else { + BotToast.showText(text: baseModel.message ?? '派单失败'); + return false; + } + } + + ///上传处理完成照片 + static Future> uploadHouseKeepingHandlePhoto( + List files) async { + List urls = + await NetUtil().uploadFiles(files, API.upload.uploadHandlerPhoto); + + return urls; + } + + ///提交报告 + static Future newHouseKeepingSubmit( + int id, + int completion, + String description, + double materialFee, + double serviceFee, + double payFee, + List urls, + ) async { + BaseModel baseModel = + await NetUtil().post(API.manage.newHouseKeepingSubmit, params: { + "id": id, + "completion": completion, + "processDescription": description, + "materialFee": materialFee, + "serviceFee": serviceFee, + "payFee": payFee, + "handlerImgList":urls, + }); + if (baseModel.status ?? false) { + BotToast.showText(text: '提交成功'); + return true; + } else { + BotToast.showText(text: baseModel.message ?? '提交失败'); + return false; + } + } +} diff --git a/lib/utils/network/net_util.dart b/lib/utils/network/net_util.dart index fa1a92a..9c92bb6 100644 --- a/lib/utils/network/net_util.dart +++ b/lib/utils/network/net_util.dart @@ -135,14 +135,14 @@ class NetUtil { return BaseFileModel.err(); } - Future> uploadFiles(List files, String api) async { - List urls = []; + Future> uploadFiles(List files, String api) async { + List urls = []; if (files.isEmpty) { return []; } else { for (var item in files) { BaseFileModel model = await NetUtil().upload(api, item); - urls.add(model.url); + urls.add(model.url??''); } }