对接 派单/接单/查询派单人/处理完成照片上传/提交报告/催单 等接口

hmxc
张萌 3 years ago
parent b79b6c7ec5
commit 32ffd97ee1

@ -287,6 +287,25 @@ class _Manage {
///appid
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 {

@ -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<String, dynamic> json) =>
_$HouseKeepingPickStaffModelFromJson(json);
@override
List<Object?> 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,
];
}
}

@ -0,0 +1,41 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'house_keeping_pick_staff_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
HouseKeepingPickStaffModel _$HouseKeepingPickStaffModelFromJson(
Map<String, dynamic> 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?,
);
}

@ -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),

@ -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,6 +25,8 @@ class HouseKeepingDepartmentPage extends StatefulWidget {
class _HouseKeepingDepartmentPageState
extends State<HouseKeepingDepartmentPage> {
List<HouseKeepingPickStaffModel> _models = [];
int _selectId = 0;
@override
Widget build(BuildContext context) {
return AkuScaffold(
@ -24,22 +34,28 @@ class _HouseKeepingDepartmentPageState
body: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
onRefresh: () async {},
child: ListView(
children: [
_buildItem(1),
],
)),
);
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<HouseKeepingPickStaffModel> 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,

@ -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<HouseKeepingProcessModel> 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<HouseKeepingDetailPage> {
_buildEvaluate(),
].sepWidget(separate: 16.w.heightBox),
),
bottom: _getBottomButtons(1),
bottom: _getBottomButtons(widget.model.status),
);
}
@ -62,15 +71,43 @@ class _HouseKeepingDetailPageState extends State<HouseKeepingDetailPage> {
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();

@ -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<HouseKeepingFeedBackPage> {
int _feedBackStatus = 0;
late TextEditingController _editingController;
late TextEditingController _priceController;
late TextEditingController _materialPriceController;
late TextEditingController _servicePriceController;
late TextEditingController _totalPriceController;
List<File> _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<HouseKeepingFeedBackPage> {
_payTile(),
],
),
bottom: AkuBottomButton(
title: '立即提交',
onTap: () async {
Function cancel = BotToast.showLoading();
try {
List<String> _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<HouseKeepingFeedBackPage> {
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,19 +199,30 @@ class _HouseKeepingFeedBackPageState extends State<HouseKeepingFeedBackPage> {
color: Colors.white,
child: Column(
children: [
Row(
_payInputTile('材料费用', _materialPriceController),
_payInputTile('服务费用', _servicePriceController),
_payInputTile('总计费用', _totalPriceController),
24.w.heightBox,
AkuDivider.horizontal()
],
),
);
}
Widget _payInputTile(String title, TextEditingController controller) {
return Row(
children: [
'支付费用'.text.size(28.sp).black.make(),
350.w.widthBox,
title.text.size(28.sp).black.make(),
Spacer(),
'¥'.text.size(32.sp).bold.color(Colors.red).make(),
24.w.widthBox,
TextField(
controller: _editingController,
controller: controller,
inputFormatters: [
FilteringTextInputFormatter.allow(
RegExp(r'^[0-9][\.\d]*(,\d+)?$'))
FilteringTextInputFormatter.allow(RegExp(r'^[0-9][\.\d]*(,\d+)?$'))
],
keyboardType: TextInputType.number,
textAlign: TextAlign.end,
decoration: InputDecoration(
contentPadding: EdgeInsets.zero,
isDense: true,
@ -181,11 +238,6 @@ class _HouseKeepingFeedBackPageState extends State<HouseKeepingFeedBackPage> {
),
).expand(),
],
),
24.w.heightBox,
AkuDivider.horizontal()
],
),
);
}
}

@ -1,7 +1,11 @@
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 {
///
@ -16,4 +20,99 @@ class HouseKeepingFunc {
return [];
}
}
///
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<List<String>> uploadHouseKeepingHandlePhoto(
List<File> files) async {
List<String> 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<String> 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;
}
}
}

@ -135,14 +135,14 @@ class NetUtil {
return BaseFileModel.err();
}
Future<List<String?>> uploadFiles(List<File> files, String api) async {
List<String?> urls = [];
Future<List<String>> uploadFiles(List<File> files, String api) async {
List<String> 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??'');
}
}

Loading…
Cancel
Save