Merge branch 'zhang'

# Conflicts:
#	lib/const/api.dart
hmxc
张萌 4 years ago
commit 6c47308790

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

@ -104,4 +104,30 @@ class _Manage {
class _Upload { class _Upload {
/// ///
String get avatar => '/user/upload/butlerAppHeadSculpture'; String get avatar => '/user/upload/butlerAppHeadSculpture';
///id
String get repairDetail => '/user/repair/findById';
///-
String get dispatchListDetailType => '/manage/dataDictionary/findSysDispatchListDetailType';
///(id and name)
String get workOrderTimeLimit => '/user/repair/findWorkOrderTimeLimit';
///
String get workOrderTypeDetail => '/user/repair/findWorkOrderTypeDetail';
///
String get repairDispatch => '/user/repair/dispatch';
///
String get repairReassignment => '/user/repair/reassignment';
///
String get recevingOrders => '/user/repair/receivingOrders';
///
String get applyDelayed => '/user/repair/applyDelayed';
///
String get handleResult => '/user/repair/handleResult';
} }

@ -17,7 +17,7 @@ enum FIX_ENUM {
/// ///
DONE, DONE,
} }
@deprecated
class FixModel { class FixModel {
static Map<FIX_ENUM, String> managerRoleMap = { static Map<FIX_ENUM, String> managerRoleMap = {
FIX_ENUM.HAND_OUT: '待派单', FIX_ENUM.HAND_OUT: '待派单',
@ -206,7 +206,7 @@ Map<String, FIX_DATE_LIMIT> fixDateLimitStringMap = {
'12小时内处理': FIX_DATE_LIMIT.HOUR_12, '12小时内处理': FIX_DATE_LIMIT.HOUR_12,
'8小时内处理': FIX_DATE_LIMIT.HOUR_8, '8小时内处理': FIX_DATE_LIMIT.HOUR_8,
}; };
@deprecated
class FixDetailModel { class FixDetailModel {
/// ///
String userName; String userName;

@ -0,0 +1,21 @@
class DispatchDetialModel {
String showName;
int showValue;
String remarks;
DispatchDetialModel({this.showName, this.showValue, this.remarks});
DispatchDetialModel.fromJson(Map<String, dynamic> json) {
showName = json['showName'];
showValue = json['showValue'];
remarks = json['remarks'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['showName'] = this.showName;
data['showValue'] = this.showValue;
data['remarks'] = this.remarks;
return data;
}
}

@ -0,0 +1,27 @@
class DispatchReportModel {
int dispatchListId;
int workOrderTyoe;
int workOrderTypeDetail;
int workOrderTimeLimit;
int type;
int operato;
String remark;
DispatchReportModel.zero() {
dispatchListId = -1;
workOrderTyoe = -1;
workOrderTypeDetail = -1;
workOrderTimeLimit = -1;
type = -1;
operato = -1;
remark = '';
}
DispatchReportModel(
{this.dispatchListId,
this.operato,
this.remark,
this.type,
this.workOrderTimeLimit,
this.workOrderTyoe,
this.workOrderTypeDetail});
}

@ -0,0 +1,239 @@
class FixedDetailModel {
HandlingSituation handlingSituation;
DispatchType dispatchType;
CostDetail costDetail;
RepairDetail repairDetail;
String evaluateInfo;
int type;
List<ProcessRecord> processRecord;
FixedDetailModel(
{this.handlingSituation,
this.dispatchType,
this.costDetail,
this.repairDetail,
this.evaluateInfo,
this.type,
this.processRecord});
FixedDetailModel.fromJson(Map<String, dynamic> json) {
handlingSituation = json['handlingSituation'] != null
? new HandlingSituation.fromJson(json['handlingSituation'])
: null;
dispatchType = json['dispatchType'] != null
? new DispatchType.fromJson(json['dispatchType'])
: null;
costDetail = json['costDetail'] != null
? new CostDetail.fromJson(json['costDetail'])
: null;
repairDetail = json['repairDetail'] != null
? new RepairDetail.fromJson(json['repairDetail'])
: null;
evaluateInfo = json['evaluateInfo'];
type = json['type'];
if (json['processRecord'] != null) {
processRecord = new List<ProcessRecord>();
json['processRecord'].forEach((v) {
processRecord.add(new ProcessRecord.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.handlingSituation != null) {
data['handlingSituation'] = this.handlingSituation.toJson();
}
if (this.dispatchType != null) {
data['dispatchType'] = this.dispatchType.toJson();
}
if (this.costDetail != null) {
data['costDetail'] = this.costDetail.toJson();
}
if (this.repairDetail != null) {
data['repairDetail'] = this.repairDetail.toJson();
}
data['evaluateInfo'] = this.evaluateInfo;
data['type'] = this.type;
if (this.processRecord != null) {
data['processRecord'] =
this.processRecord.map((v) => v.toJson()).toList();
}
return data;
}
}
class HandlingSituation {
int id;
String detail;
String materialList;
List<ImgUrls> imgUrls;
HandlingSituation({this.id, this.detail, this.materialList, this.imgUrls});
HandlingSituation.fromJson(Map<String, dynamic> json) {
id = json['id'];
detail = json['detail'];
materialList = json['materialList'];
if (json['imgUrls'] != null) {
imgUrls = new List<ImgUrls>();
json['imgUrls'].forEach((v) {
imgUrls.add(new ImgUrls.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['detail'] = this.detail;
data['materialList'] = this.materialList;
if (this.imgUrls != null) {
data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList();
}
return data;
}
}
class ImgUrls {
String url;
String size;
int longs;
int paragraph;
int sort;
ImgUrls({this.url, this.size, this.longs, this.paragraph, this.sort});
ImgUrls.fromJson(Map<String, dynamic> json) {
url = json['url'];
size = json['size'];
longs = json['longs'];
paragraph = json['paragraph'];
sort = json['sort'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['url'] = this.url;
data['size'] = this.size;
data['longs'] = this.longs;
data['paragraph'] = this.paragraph;
data['sort'] = this.sort;
return data;
}
}
class DispatchType {
int dispatchType;
String workOrderLimitName;
String workOrderSubclassName;
DispatchType(
{this.dispatchType, this.workOrderLimitName, this.workOrderSubclassName});
DispatchType.fromJson(Map<String, dynamic> json) {
dispatchType = json['dispatchType'];
workOrderLimitName = json['workOrderLimitName'];
workOrderSubclassName = json['workOrderSubclassName'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['dispatchType'] = this.dispatchType;
data['workOrderLimitName'] = this.workOrderLimitName;
data['workOrderSubclassName'] = this.workOrderSubclassName;
return data;
}
}
class CostDetail {
int laborCost;
int materialCost;
int totalCost;
CostDetail({this.laborCost, this.materialCost, this.totalCost});
CostDetail.fromJson(Map<String, dynamic> json) {
laborCost = json['laborCost'];
materialCost = json['materialCost'];
totalCost = json['totalCost'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['laborCost'] = this.laborCost;
data['materialCost'] = this.materialCost;
data['totalCost'] = this.totalCost;
return data;
}
}
class RepairDetail {
int id;
int dispatchId;
String name;
String tel;
int type;
int status;
List<ImgUrls> imgUrls;
RepairDetail(
{this.id,
this.dispatchId,
this.name,
this.tel,
this.type,
this.status,
this.imgUrls});
RepairDetail.fromJson(Map<String, dynamic> json) {
id = json['id'];
dispatchId = json['dispatchId'];
name = json['name'];
tel = json['tel'];
type = json['type'];
status = json['status'];
if (json['imgUrls'] != null) {
imgUrls = new List<ImgUrls>();
json['imgUrls'].forEach((v) {
imgUrls.add(new ImgUrls.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['dispatchId'] = this.dispatchId;
data['name'] = this.name;
data['tel'] = this.tel;
data['type'] = this.type;
data['status'] = this.status;
if (this.imgUrls != null) {
data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList();
}
return data;
}
}
class ProcessRecord {
int id;
int operationType;
String operationDate;
ProcessRecord({this.id, this.operationType, this.operationDate});
ProcessRecord.fromJson(Map<String, dynamic> json) {
id = json['id'];
operationType = json['operationType'];
operationDate = json['operationDate'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['operationType'] = this.operationType;
data['operationDate'] = this.operationDate;
return data;
}
}

@ -0,0 +1,18 @@
class WorkOrderTypeModel {
int id;
String name;
WorkOrderTypeModel({this.id, this.name});
WorkOrderTypeModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
return data;
}
}

@ -0,0 +1,18 @@
class WorkTimeLimitModel {
int id;
String name;
WorkTimeLimitModel({this.id, this.name});
WorkTimeLimitModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
return data;
}
}

@ -1,4 +1,5 @@
class AkuMap { class AkuMap {
///
static String fixStatus(bool canOpention, bool canPickup, int status) { static String fixStatus(bool canOpention, bool canPickup, int status) {
if (canOpention) { if (canOpention) {
switch (status) { switch (status) {
@ -57,4 +58,22 @@ class AkuMap {
} }
} }
} }
///
static Map<int, String> fixAreaType = {1: '公区维修', 2: '家庭维修'};
///-
static Map<int, String> operationType = {
1: '提交报修',
2: '派单',
3: '开始处理',
4: '处理完成',
5: '确认',
6: '回访',
7: '回退',
8: '作废',
9: '取消'
};
static Map<int, String> dispatchType = {1: '无偿服务', 2: '有偿服务'};
} }

@ -1,5 +1,5 @@
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/models/manager/bussiness_and_fix_model.dart'; import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// Project imports: // Project imports:

@ -1,5 +1,5 @@
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/models/manager/bussiness_and_fix_model.dart'; import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';

@ -1,29 +1,39 @@
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/dispatch_detail_model.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/dispatch_report_model.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/fixed_detail_model.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/work_order_type_model.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/work_time_limit_model.dart';
import 'package:aku_community_manager/tools/aku_map.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fix_more_time_page.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fix_work_finish_page.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fixer_department_page.dart';
import 'package:aku_community_manager/utils/network/base_model.dart';
import 'package:aku_community_manager/utils/network/manage_func.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// Package imports: // Package imports:
import 'package:aku_ui/common_widgets/aku_material_button.dart'; import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
// Project imports: // Project imports:
import 'package:aku_community_manager/const/resource.dart'; import 'package:aku_community_manager/const/resource.dart';
import 'package:aku_community_manager/mock_models/fix/fix_model.dart';
import 'package:aku_community_manager/mock_models/users/user_info_model.dart'; import 'package:aku_community_manager/mock_models/users/user_info_model.dart';
import 'package:aku_community_manager/provider/user_provider.dart'; import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/screen_tool.dart'; import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:aku_community_manager/tools/widget_tool.dart'; import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fix_more_time_page.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fix_work_finish_page.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fixer_department_page.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_title_box.dart'; import 'package:aku_community_manager/ui/widgets/inner/aku_title_box.dart';
import 'package:aku_community_manager/ui/widgets/inner/show_bottom_sheet.dart'; import 'package:aku_community_manager/ui/widgets/inner/show_bottom_sheet.dart';
class BusinessAndFixDetailPage extends StatefulWidget { class BusinessAndFixDetailPage extends StatefulWidget {
final FixModel model; final BussinessAndFixModel model;
BusinessAndFixDetailPage({Key key, this.model}) : super(key: key); BusinessAndFixDetailPage({Key key, this.model}) : super(key: key);
@override @override
@ -37,103 +47,91 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
return userProvider.userInfoModel.role; return userProvider.userInfoModel.role;
} }
bool get isHandOut => widget.model.type == FIX_ENUM.HAND_OUT; bool get isHandOut => widget.model.status == 1;
FixDetailModel get detailModel => widget.model.detail; FixedDetailModel _detailModel;
bool _onload = true;
EasyRefreshController _easyRefreshController;
String get fixType { List<DispatchDetialModel> _dispatchModels;
switch (detailModel.type) { List<WorkTimeLimitModel> _timeLimitModels;
case FIX_PAYMENT_TYPE.FREE: List<WorkOrderTypeModel> _workTypeModels;
return '无偿服务'; DispatchReportModel _reportModel = DispatchReportModel.zero();
break;
case FIX_PAYMENT_TYPE.PAY: @override
return '有偿服务'; void initState() {
break; super.initState();
default: _easyRefreshController = EasyRefreshController();
return '';
break;
}
} }
String get dateLimit { @override
switch (detailModel.limit) { void dispose() {
case FIX_DATE_LIMIT.HOUR_24: _easyRefreshController?.dispose();
return '24小时内处理'; super.dispose();
break;
case FIX_DATE_LIMIT.HOUR_12:
return '12小时内处理';
break;
case FIX_DATE_LIMIT.HOUR_8:
return '8小时内处理';
break;
default:
return '';
break;
}
} }
String get subType { Widget fixTypeWidget() {
switch (detailModel.subType) { UserProvider userProvider =
case FIX_SUB_TYPE.NORMAL: Provider.of<UserProvider>(context, listen: false);
return '一般单'; return Text(
break; AkuMap.fixStatus(userProvider.infoModel.canOperation,
case FIX_SUB_TYPE.HURRY: userProvider.infoModel.canPickUpTicket, widget.model.status),
return '加急单'; style: TextStyle(
break; color: widget.model.status < 4
default: ? Color(0XFFFF4501)
return ''; : AppStyle.minorTextColor,
break; ),
} );
} }
Widget get fixTypeWidget { Widget _empty() {
if (userRole == USER_ROLE.MANAGER) { return Container();
return Text(
FixModel.managerRoleMap[widget.model.type],
style: TextStyle(
color: widget.model.type != FIX_ENUM.DONE
? Color(0XFFFF4501)
: AppStyle.minorTextColor,
),
);
} else {
return Text(
FixModel.otherRoleMap[widget.model.type],
style: TextStyle(
color: widget.model.type != FIX_ENUM.DONE
? Color(0XFFFF4501)
: AppStyle.minorTextColor,
),
);
}
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AkuScaffold( return AkuScaffold(
title: '报修详情', title: '报修详情',
body: ListView( body: EasyRefresh(
padding: EdgeInsets.symmetric(vertical: 16.w), firstRefresh: true,
children: [ controller: _easyRefreshController,
_buildInfo(), header: MaterialHeader(),
_buildType(widget.model.type == FIX_ENUM.HAND_OUT), onRefresh: () async {
_buildProcess(), _detailModel = await ManageFunc.repairDetail(widget.model.id);
detailModel.result == null ? SizedBox() : _buildResult(), _reportModel.dispatchListId = widget.model.id;
detailModel.review == null ? SizedBox() : _buildRating(), _reportModel.workOrderTyoe = 1;
], _onload = false;
setState(() {});
},
child: _onload
? _empty()
: ListView(
padding: EdgeInsets.symmetric(vertical: 16.w),
children: [
_buildInfo(),
_buildType(widget.model.status == 1),
_buildProcess(),
_detailModel.handlingSituation == null
? SizedBox()
: _buildResult(),
_detailModel.evaluateInfo == null
? SizedBox()
: _buildRating(),
],
),
), ),
bottom: Builder( bottom: Builder(
builder: (context) { builder: (context) {
final userProvider = final userProvider =
Provider.of<UserProvider>(context, listen: false); Provider.of<UserProvider>(context, listen: false);
if (widget.model.type == FIX_ENUM.HAND_OUT) { if (userProvider.infoModel.canOperation&&widget.model.status<2) {
return AkuMaterialButton( return AkuMaterialButton(
color: AppStyle.primaryColor, color: AppStyle.primaryColor,
nullColor: AppStyle.minorColor, nullColor: AppStyle.minorColor,
onPressed: detailModel.type != null && onPressed: _reportModel.type != null &&
detailModel.subType != null && _reportModel.workOrderTyoe != null &&
detailModel.limit != null _reportModel.workOrderTimeLimit != null
? () { ? () {
Get.to(FixerDepartmentPage(model: widget.model)); Get.to(FixerDepartmentPage(model: _reportModel));
} }
: null, : null,
child: Text( child: Text(
@ -143,14 +141,14 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
), ),
), ),
); );
} else if (widget.model.type == FIX_ENUM.WAIT_PICKUP) { } else if (widget.model.status == 2) {
if (userProvider.userInfoModel.role == USER_ROLE.MANAGER) { if (userProvider.infoModel.canOperation) {
return AkuMaterialButton( return AkuMaterialButton(
color: AppStyle.primaryColor, color: AppStyle.primaryColor,
nullColor: AppStyle.minorColor, nullColor: AppStyle.minorColor,
onPressed: () { onPressed: () {
Get.to(FixerDepartmentPage( Get.to(FixerDepartmentPage(
model: widget.model, model: _reportModel,
changeType: true, changeType: true,
)); ));
}, },
@ -165,15 +163,14 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
return AkuMaterialButton( return AkuMaterialButton(
color: AppStyle.primaryColor, color: AppStyle.primaryColor,
nullColor: AppStyle.minorColor, nullColor: AppStyle.minorColor,
onPressed: () { onPressed: () async {
final userProvider = BaseModel baseModel =
Provider.of<UserProvider>(context, listen: false); await ManageFunc.recevingOrders(widget.model.dispatchId);
detailModel.fixStatuses.add(FixStatus( if (baseModel.status) {
title: '${userProvider.userInfoModel.nickName}已接单', Get.back();
date: DateTime.now(), } else {
)); BotToast.showText(text: baseModel.message);
widget.model.type = FIX_ENUM.PROCESSING; }
Get.back();
}, },
child: Text( child: Text(
'立即接单', '立即接单',
@ -183,8 +180,8 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
), ),
); );
} }
} else if (widget.model.type == FIX_ENUM.PROCESSING && } else if ((widget.model.status==3) &&
userProvider.userInfoModel.role == USER_ROLE.FIXER) userProvider.infoModel.canPickUpTicket)
return Container( return Container(
height: 96.w, height: 96.w,
alignment: Alignment.center, alignment: Alignment.center,
@ -212,7 +209,8 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
), ),
), ),
onPressed: () { onPressed: () {
Get.to(FixMoreTimePage(model: widget.model)); Get.to(
FixMoreTimePage(dispatchId: widget.model.dispatchId));
}, },
child: Text( child: Text(
'申请延时', '申请延时',
@ -228,7 +226,11 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
radius: 4.w, radius: 4.w,
color: AppStyle.primaryColor, color: AppStyle.primaryColor,
onPressed: () { onPressed: () {
Get.to(FixWorkFinishPage(model: widget.model)); Get.to(FixWorkFinishPage(
fixModel: widget.model,
model: _detailModel,
dispatchType:
_detailModel.dispatchType.dispatchType == 1));
}, },
child: Text( child: Text(
'处理完成', '处理完成',
@ -251,27 +253,27 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
_buildInfo() { _buildInfo() {
return AkuTitleBox( return AkuTitleBox(
title: '报修信息', title: '报修信息',
suffix: fixTypeWidget, suffix: fixTypeWidget(),
children: [ children: [
AkuBox.h(16), AkuBox.h(16),
_buildTile( _buildTile(
R.ASSETS_MESSAGE_IC_PEOPLE_PNG, R.ASSETS_MESSAGE_IC_PEOPLE_PNG,
'报修人', '报修人',
widget.model.detail.userName, _detailModel.repairDetail.name,
), ),
_buildTile( _buildTile(
R.ASSETS_MESSAGE_IC_PHONE_PNG, R.ASSETS_MESSAGE_IC_PHONE_PNG,
'联系电话', '联系电话',
widget.model.detail.userPhoneNumber, _detailModel.repairDetail.tel,
), ),
_buildTile( _buildTile(
R.ASSETS_MESSAGE_IC_AREA_PNG, R.ASSETS_MESSAGE_IC_AREA_PNG,
'报修区域', '报修区域',
widget.model.detail.fixArea, AkuMap.fixAreaType[_detailModel.repairDetail.type],
), ),
AkuBox.h(8), AkuBox.h(8),
Text( Text(
widget.model.title, widget.model.reportDetail,
style: TextStyle( style: TextStyle(
color: AppStyle.primaryTextColor, color: AppStyle.primaryTextColor,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -285,10 +287,11 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
crossAxisSpacing: 16.w, crossAxisSpacing: 16.w,
mainAxisSpacing: 16.w, mainAxisSpacing: 16.w,
), ),
children: widget.model.imgs.map((e) { children: _detailModel.repairDetail.imgUrls.map((e) {
return ClipRRect( return ClipRRect(
borderRadius: BorderRadius.circular(4.w), borderRadius: BorderRadius.circular(4.w),
child: (e is String) ? Image.asset(e) : Image.file(e), child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP, image: e.url),
); );
}).toList(), }).toList(),
shrinkWrap: true, shrinkWrap: true,
@ -304,54 +307,93 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
children: [ children: [
_buildTypeTile( _buildTypeTile(
'派单类型', '派单类型',
fixType, canTap
? _dispatchModels == null
? null
: _dispatchModels[_dispatchModels.indexWhere(
(element) => element.showValue == _reportModel.type)]
.showName
: AkuMap.dispatchType[_detailModel.dispatchType.dispatchType],
canTap, canTap,
helpContent: '请选择服务类型', helpContent: '请选择服务类型',
onTap: () { onTap: () async {
List models = await ManageFunc.dispatchListDetailType();
_dispatchModels =
models.map((e) => DispatchDetialModel.fromJson(e)).toList();
showItemSheet( showItemSheet(
title: '派单类型', title: '派单类型',
items: ['无偿服务', '有偿服务'], items: _dispatchModels.map((e) => e.showName).toList(),
selectItem: fixPaymentMap[detailModel.type], ids: _dispatchModels.map((e) => e.showValue).toList(),
selectItem: _reportModel.type,
onTap: (result) { onTap: (result) {
detailModel.type = fixPaymentStringMap[result]; _reportModel.type = result;
}, },
).then((_) { ).then((_) {
if (_reportModel.type == -1) {
_dispatchModels = null;
}
setState(() {}); setState(() {});
}); });
}, },
), ),
_buildTypeTile( _buildTypeTile(
'工单时限', '工单时限',
dateLimit, canTap
? _timeLimitModels == null
? null
: _timeLimitModels[_timeLimitModels.indexWhere((element) =>
element.id == _reportModel.workOrderTimeLimit)]
?.name
: _detailModel.dispatchType.workOrderLimitName,
canTap, canTap,
helpContent: '请选择工单时限', helpContent: '请选择工单时限',
onTap: () { onTap: () async {
List models = await ManageFunc.workOrderTimeType();
_timeLimitModels =
models.map((e) => WorkTimeLimitModel.fromJson(e)).toList();
showItemSheet( showItemSheet(
title: '工单时限', title: '工单时限',
items: ['24小时内处理', '12小时内处理', '8小时内处理'], items: _timeLimitModels.map((e) => e.name).toList(),
selectItem: fixDateLimitMap[detailModel.limit], ids: _timeLimitModels.map((e) => e.id).toList(),
selectItem: _reportModel.workOrderTimeLimit,
onTap: (result) { onTap: (result) {
detailModel.limit = fixDateLimitStringMap[result]; _reportModel.workOrderTimeLimit = result;
}, },
).then((_) { ).then((_) {
if (_reportModel.workOrderTimeLimit == -1) {
_timeLimitModels = null;
}
setState(() {}); setState(() {});
}); });
}, },
), ),
_buildTypeTile( _buildTypeTile(
'工单子类', '工单子类',
subType, canTap
? _workTypeModels == null
? null
: _workTypeModels[_workTypeModels.indexWhere((element) =>
element.id == _reportModel.workOrderTypeDetail)]
.name
: _detailModel.dispatchType.workOrderSubclassName,
canTap, canTap,
helpContent: '请选择工单子类', helpContent: '请选择工单子类',
onTap: () { onTap: () async {
List models = await ManageFunc.workOrderTypeDetail(widget.model.id);
_workTypeModels =
models.map((e) => WorkOrderTypeModel.fromJson(e)).toList();
showItemSheet( showItemSheet(
title: '工单子类', title: '工单子类',
items: ['一般单', '加急单'], items: _workTypeModels.map((e) => e.name).toList(),
selectItem: fixSubTypeMap[detailModel.subType], ids: _workTypeModels.map((e) => e.id).toList(),
selectItem: _reportModel.workOrderTypeDetail,
onTap: (result) { onTap: (result) {
detailModel.subType = fixSubTypeStringMap[result]; _reportModel.workOrderTypeDetail = result;
}, },
).then((_) { ).then((_) {
if (_reportModel.workOrderTypeDetail == -1) {
_workTypeModels = null;
}
setState(() {}); setState(() {});
}); });
}, },
@ -363,10 +405,11 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
_buildProcess() { _buildProcess() {
return AkuTitleBox( return AkuTitleBox(
title: '报修进程', title: '报修进程',
children: detailModel.fixStatuses.map((e) { children: _detailModel.processRecord.map((e) {
return _buildProcessTile( return _buildProcessTile(
e.title, AkuMap.operationType[e.operationType],
DateUtil.formatDate(e.date, format: 'yyyy-MM-dd HH:mm:ss'), DateUtil.formatDateStr(e.operationDate,
format: 'yyyy-MM-dd HH:mm:ss'),
); );
}).toList(), }).toList(),
); );
@ -386,7 +429,7 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
), ),
AkuBox.h(8), AkuBox.h(8),
Text( Text(
detailModel.result.detail, _detailModel.handlingSituation.detail,
style: TextStyle( style: TextStyle(
color: AppStyle.primaryTextColor, color: AppStyle.primaryTextColor,
fontSize: 28.w, fontSize: 28.w,
@ -403,7 +446,7 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
), ),
AkuBox.h(8), AkuBox.h(8),
Text( Text(
detailModel.result.material, _detailModel.handlingSituation.materialList,
style: TextStyle( style: TextStyle(
color: AppStyle.primaryTextColor, color: AppStyle.primaryTextColor,
fontSize: 28.w, fontSize: 28.w,
@ -425,19 +468,11 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4, crossAxisCount: 4,
), ),
children: detailModel.result.imgs.map((e) { children: _detailModel.handlingSituation.imgUrls.map((e) {
return ClipRRect( return ClipRRect(
borderRadius: BorderRadius.circular(4.w), borderRadius: BorderRadius.circular(4.w),
child: (e is String) child: FadeInImage.assetNetwork(
? Image.asset( placeholder: R.ASSETS_PLACEHOLDER_WEBP, image: e.url));
e,
fit: BoxFit.cover,
)
: Image.file(
e,
fit: BoxFit.cover,
),
);
}).toList(), }).toList(),
), ),
], ],
@ -459,7 +494,7 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
), ),
), ),
Spacer(), Spacer(),
_buildStar(detailModel.review.rate), _buildStar(5),
], ],
), ),
AkuBox.h(24), AkuBox.h(24),
@ -472,7 +507,7 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
), ),
AkuBox.h(8), AkuBox.h(8),
Text( Text(
detailModel.review.content, _detailModel.evaluateInfo,
style: TextStyle( style: TextStyle(
color: AppStyle.primaryTextColor, color: AppStyle.primaryTextColor,
fontSize: 28.w, fontSize: 28.w,

@ -1,11 +1,13 @@
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/models/manager/bussiness_and_fix_model.dart'; import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart';
import 'package:aku_community_manager/tools/aku_map.dart'; import 'package:aku_community_manager/tools/aku_map.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// Package imports: // Package imports:
import 'package:aku_ui/common_widgets/aku_material_button.dart'; import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
// Project imports: // Project imports:
@ -62,7 +64,7 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
final userProvider = Provider.of<UserProvider>(context, listen: false); final userProvider = Provider.of<UserProvider>(context, listen: false);
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
// Get.to(BusinessAndFixDetailPage(model: widget.model)); Get.to(BusinessAndFixDetailPage(model: widget.model));
}, },
child: Container( child: Container(
padding: EdgeInsets.all(24.w), padding: EdgeInsets.all(24.w),

@ -1,5 +1,5 @@
import 'package:aku_community_manager/const/api.dart'; import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix_model.dart'; import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_fix_card.dart'; import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_fix_card.dart';
import 'package:aku_community_manager/ui/widgets/common/bee_list_view.dart'; import 'package:aku_community_manager/ui/widgets/common/bee_list_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';

@ -1,23 +1,23 @@
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/utils/network/base_model.dart';
import 'package:aku_community_manager/utils/network/manage_func.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// Package imports: // Package imports:
import 'package:aku_ui/common_widgets/aku_material_button.dart'; import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
// Project imports: // Project imports:
import 'package:aku_community_manager/const/resource.dart'; import 'package:aku_community_manager/const/resource.dart';
import 'package:aku_community_manager/mock_models/fix/fix_model.dart';
import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/screen_tool.dart'; import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:aku_community_manager/tools/widget_tool.dart'; import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:get/get.dart';
class FixMoreTimePage extends StatefulWidget { class FixMoreTimePage extends StatefulWidget {
final FixModel model; final int dispatchId;
FixMoreTimePage({Key key, @required this.model}) : super(key: key); FixMoreTimePage({Key key, @required this.dispatchId}) : super(key: key);
@override @override
_FixMoreTimePageState createState() => _FixMoreTimePageState(); _FixMoreTimePageState createState() => _FixMoreTimePageState();
@ -25,6 +25,20 @@ class FixMoreTimePage extends StatefulWidget {
class _FixMoreTimePageState extends State<FixMoreTimePage> { class _FixMoreTimePageState extends State<FixMoreTimePage> {
String _nowSelect = '24h'; String _nowSelect = '24h';
List<String> _delayList = ['24h', '48h', '72h', '未知'];
TextEditingController _textEditingController;
@override
void initState() {
super.initState();
_textEditingController = TextEditingController();
}
@override
void dispose() {
_textEditingController?.dispose();
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AkuScaffold( return AkuScaffold(
@ -56,7 +70,7 @@ class _FixMoreTimePageState extends State<FixMoreTimePage> {
AkuBox.h(24), AkuBox.h(24),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: ['24h', '48h', '72h', '未知'].map((e) { children: _delayList.map((e) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
@ -131,6 +145,10 @@ class _FixMoreTimePageState extends State<FixMoreTimePage> {
child: TextField( child: TextField(
minLines: 7, minLines: 7,
maxLines: 7, maxLines: 7,
controller: _textEditingController,
onChanged: (_) {
setState(() {});
},
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
border: InputBorder.none, border: InputBorder.none,
@ -141,15 +159,24 @@ class _FixMoreTimePageState extends State<FixMoreTimePage> {
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 32.w), padding: EdgeInsets.symmetric(horizontal: 32.w),
child: AkuMaterialButton( child: AkuMaterialButton(
onPressed: () { onPressed: () async {
final userProvider = // final userProvider =
Provider.of<UserProvider>(context, listen: false); // Provider.of<UserProvider>(context, listen: false);
widget.model.detail.fixStatuses.add( // widget.model.detail.fixStatuses.add(
FixStatus( // FixStatus(
title: '${userProvider.userInfoModel.nickName}申请延时', // title: '${userProvider.userInfoModel.nickName}申请延时',
date: DateTime.now()), // date: DateTime.now()),
); // );
Get.back(); // Get.back();
BaseModel baseModel = await ManageFunc.applyDelayed(
widget.dispatchId,
_delayList.indexOf(_nowSelect) + 1,
_textEditingController.text ?? '');
if (baseModel.status) {
Get.back();
} else {
BotToast.showText(text: baseModel.message);
}
}, },
radius: 8.w, radius: 8.w,
child: Text( child: Text(

@ -0,0 +1,29 @@
import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_fix_card.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:flutter/material.dart';
import 'package:aku_community_manager/const/resource.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
class FixSubmitFinishPage extends StatelessWidget {
final BussinessAndFixModel model;
const FixSubmitFinishPage({Key key, this.model}) : super(key: key);
@override
Widget build(BuildContext context) {
return AkuScaffold(
title: '处理完成',
body:Container(
width:double.infinity,
child: Column(
children: [
Image.asset(R.ASSETS_MANAGE_SUBMIT_SUCCESS_PNG,width:587.w,height:350.w),
'您已处理完成该报修'.text.black.size(40.sp).bold.make(),
120.w.heightBox,
BusinessFixCard(model: this.model),
],
),
),
);
}
}

@ -2,26 +2,39 @@
import 'dart:io'; import 'dart:io';
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/fixed_detail_model.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fix_submit_finish_page.dart';
import 'package:aku_community_manager/utils/network/base_model.dart';
import 'package:aku_community_manager/utils/network/manage_func.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';
// Package imports: // Package imports:
import 'package:aku_ui/common_widgets/aku_material_button.dart'; import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
import 'package:get/get.dart';
// Project imports: // Project imports:
import 'package:aku_community_manager/mock_models/fix/fix_model.dart';
import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/screen_tool.dart'; import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:aku_community_manager/tools/widget_tool.dart'; import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_title_box.dart'; import 'package:aku_community_manager/ui/widgets/inner/aku_title_box.dart';
import 'package:aku_community_manager/ui/widgets/inner/pick_image.dart'; import 'package:aku_community_manager/ui/widgets/inner/pick_image.dart';
import 'package:get/get.dart';
import 'package:aku_community_manager/tools/extensions/router_extension_tool.dart';
class FixWorkFinishPage extends StatefulWidget { class FixWorkFinishPage extends StatefulWidget {
final FixModel model; final FixedDetailModel model;
FixWorkFinishPage({Key key, @required this.model}) : super(key: key); final BussinessAndFixModel fixModel;
final bool dispatchType;
FixWorkFinishPage(
{Key key,
@required this.model,
@required this.dispatchType,
@required this.fixModel})
: super(key: key);
@override @override
_FixWorkFinishPageState createState() => _FixWorkFinishPageState(); _FixWorkFinishPageState createState() => _FixWorkFinishPageState();
@ -34,6 +47,9 @@ class _FixWorkFinishPageState extends State<FixWorkFinishPage> {
TextEditingController _humanController = TextEditingController(); TextEditingController _humanController = TextEditingController();
TextEditingController _materialPriceController = TextEditingController(); TextEditingController _materialPriceController = TextEditingController();
double humanPrice;
double materialPrice;
@override @override
void dispose() { void dispose() {
_descriptionController?.dispose(); _descriptionController?.dispose();
@ -57,7 +73,7 @@ class _FixWorkFinishPageState extends State<FixWorkFinishPage> {
spacing: 24, spacing: 24,
children: [ children: [
Text( Text(
widget.model.title, widget.fixModel.reportDetail,
style: TextStyle( style: TextStyle(
color: AppStyle.primaryTextColor, color: AppStyle.primaryTextColor,
fontSize: 28.w, fontSize: 28.w,
@ -73,13 +89,15 @@ class _FixWorkFinishPageState extends State<FixWorkFinishPage> {
mainAxisSpacing: 16.w, mainAxisSpacing: 16.w,
), ),
itemBuilder: (context, index) { itemBuilder: (context, index) {
final img = widget.model.imgs[index]; // final img = widget.model.imgs[index];
return ClipRRect( return ClipRRect(
borderRadius: BorderRadius.circular(4.w), borderRadius: BorderRadius.circular(4.w),
child: (img is String) ? Image.asset(img) : Image.file(img), child: FadeInImage.assetNetwork(
); placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: widget.model.repairDetail.imgUrls[index].url,
));
}, },
itemCount: widget.model.imgs.length, itemCount: widget.model.repairDetail.imgUrls.length,
), ),
], ],
), ),
@ -262,87 +280,87 @@ class _FixWorkFinishPageState extends State<FixWorkFinishPage> {
) )
], ],
), ),
// widget.model.detail.type == FIX_PAYMENT_TYPE.FREE widget.dispatchType
// ? SizedBox() ? SizedBox()
// : : AkuTitleBox(
AkuTitleBox( title: '费用明细',
title: '费用明细', spacing: 16,
spacing: 16, children: [
children: [ Row(
Row( children: [
children: [ AkuBox.h(96),
AkuBox.h(96), Text('人工费'),
Text('人工费'), Expanded(
Expanded( child: TextField(
child: TextField( controller: _humanController,
controller: _humanController, onChanged: (_) => setState(() {}),
onChanged: (_) => setState(() {}), keyboardType: TextInputType.number,
keyboardType: TextInputType.number, textAlign: TextAlign.end,
textAlign: TextAlign.end, decoration: InputDecoration(
decoration: InputDecoration( border: InputBorder.none,
border: InputBorder.none, hintText: '请输入',
hintText: '请输入', hintStyle: TextStyle(
hintStyle: TextStyle( fontWeight: FontWeight.bold,
fontWeight: FontWeight.bold, fontSize: 28.sp,
fontSize: 28.sp, color: AppStyle.minorTextColor,
color: AppStyle.minorTextColor, ),
),
),
), ),
), ],
), ),
), Divider(height: 1.w),
], Row(
), children: [
Divider(height: 1.w), AkuBox.h(96),
Row( Text('材料费'),
children: [ Expanded(
AkuBox.h(96), child: TextField(
Text('材料费'), onChanged: (_) => setState(() {}),
Expanded( controller: _materialPriceController,
child: TextField( textAlign: TextAlign.end,
onChanged: (_) => setState(() {}), keyboardType: TextInputType.number,
controller: _materialPriceController, decoration: InputDecoration(
textAlign: TextAlign.end, border: InputBorder.none,
keyboardType: TextInputType.number, hintText: '请输入',
decoration: InputDecoration( hintStyle: TextStyle(
border: InputBorder.none, fontWeight: FontWeight.bold,
hintText: '请输入', fontSize: 28.sp,
hintStyle: TextStyle( color: AppStyle.minorTextColor,
fontWeight: FontWeight.bold, ),
fontSize: 28.sp, ),
color: AppStyle.minorTextColor, ),
), ),
), ],
), ),
), Divider(height: 1.w),
], Row(
), children: [
Divider(height: 1.w), AkuBox.h(96),
Row( Text('总计费用'),
children: [ Spacer(),
AkuBox.h(96), Builder(
Text('总计费用'), builder: (context) {
Spacer(), humanPrice = double.tryParse(_humanController.text);
Builder( materialPrice =
builder: (context) { double.tryParse(_materialPriceController.text);
double humanPrice =
double.tryParse(_humanController.text);
double materialPrice =
double.tryParse(_materialPriceController.text);
if (TextUtil.isEmpty(_humanController.text) || if (TextUtil.isEmpty(_humanController.text) ||
TextUtil.isEmpty(_materialPriceController.text)) { TextUtil.isEmpty(
return Text('人工费或材料费不能为空'); _materialPriceController.text)) {
} else if (humanPrice == null || materialPrice == null) return Text('人工费或材料费不能为空');
return Text('输入有误'); } else if (humanPrice == null ||
else materialPrice == null)
return Text( return Text('输入有误');
'¥${(humanPrice + materialPrice).toStringAsFixed(2)}'); else
}, return Text(
), '¥${(humanPrice + materialPrice).toStringAsFixed(2)}');
], },
), ),
], ],
), ),
],
),
], ],
), ),
bottom: AkuMaterialButton( bottom: AkuMaterialButton(
@ -356,19 +374,35 @@ class _FixWorkFinishPageState extends State<FixWorkFinishPage> {
), ),
height: 96.w, height: 96.w,
color: AppStyle.primaryColor, color: AppStyle.primaryColor,
onPressed: () { onPressed: () async {
widget.model.detail.result = FixResult( // widget.model.detail.result = FixResult(
detail: _descriptionController.text, // detail: _descriptionController.text,
material: _materialController.text, // material: _materialController.text,
imgs: _imgs, // imgs: _imgs,
); // );
widget.model.type = FIX_ENUM.DONE; // widget.model.type = FIX_ENUM.DONE;
if (widget.model.detail.type == FIX_PAYMENT_TYPE.PAY) // if (widget.model.detail.type == FIX_PAYMENT_TYPE.PAY)
widget.model.detail.priceDetail = FixPriceDetail( // widget.model.detail.priceDetail = FixPriceDetail(
humanPrice: double.parse(_humanController.text), // humanPrice: double.parse(_humanController.text),
materialPrice: double.parse(_materialController.text), // materialPrice: double.parse(_materialController.text),
); // );
Get.back(); // Get.back();
BaseModel baseModel = await ManageFunc.handleResult(
widget.model.repairDetail.dispatchId,
_descriptionController.text,
_materialController.text,
humanPrice,
materialPrice,
humanPrice + materialPrice,
1, []);
if (baseModel.status) {
FixSubmitFinishPage(
model:widget.fixModel,
).to();
} else {
BotToast.showText(text: baseModel.message);
}
}, },
), ),
); );

@ -1,8 +1,11 @@
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/const/api.dart'; import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/dispatch_report_model.dart';
import 'package:aku_community_manager/models/manager/fixer_item_model.dart'; import 'package:aku_community_manager/models/manager/fixer_item_model.dart';
import 'package:aku_community_manager/utils/network/base_model.dart'; import 'package:aku_community_manager/utils/network/base_model.dart';
import 'package:aku_community_manager/utils/network/manage_func.dart';
import 'package:aku_community_manager/utils/network/net_util.dart'; import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// Package imports: // Package imports:
@ -13,14 +16,13 @@ import 'package:get/get.dart';
// Project imports: // Project imports:
import 'package:aku_community_manager/const/resource.dart'; import 'package:aku_community_manager/const/resource.dart';
import 'package:aku_community_manager/mock_models/fix/fix_model.dart';
import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/screen_tool.dart'; import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:aku_community_manager/tools/widget_tool.dart'; import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
class FixerDepartmentPage extends StatefulWidget { class FixerDepartmentPage extends StatefulWidget {
final FixModel model; final DispatchReportModel model;
final bool changeType; final bool changeType;
FixerDepartmentPage({Key key, @required this.model, this.changeType = false}) FixerDepartmentPage({Key key, @required this.model, this.changeType = false})
: super(key: key); : super(key: key);
@ -30,9 +32,26 @@ class FixerDepartmentPage extends StatefulWidget {
} }
class _FixerDepartmentPageState extends State<FixerDepartmentPage> { class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
DispatchReportModel _reportModel;
List<RepairmanVos> _pickedFixers = []; List<RepairmanVos> _pickedFixers = [];
List<FixerItemModel> _fixerItems = []; List<FixerItemModel> _fixerItems = [];
bool get canDispatch {
if (_reportModel?.operato==null) {
return false;
} else if (_reportModel.type == -1) {
return false;
} else if (_reportModel.workOrderTimeLimit == -1) {
return false;
} else if (_reportModel.workOrderTyoe == -1) {
return false;
} else if (_reportModel.workOrderTypeDetail == -1) {
return false;
}
return true;
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AkuScaffold( return AkuScaffold(
@ -45,6 +64,7 @@ class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
_fixerItems = (model.data as List) _fixerItems = (model.data as List)
.map((e) => FixerItemModel.fromJson(e)) .map((e) => FixerItemModel.fromJson(e))
.toList(); .toList();
_reportModel = widget.model;
setState(() {}); setState(() {});
}, },
child: ListView.builder( child: ListView.builder(
@ -57,29 +77,51 @@ class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
), ),
bottom: AkuMaterialButton( bottom: AkuMaterialButton(
height: 96.w, height: 96.w,
onPressed: _pickedFixers.isEmpty onPressed: canDispatch
? null ? () async {
: () {
if (widget.changeType) { if (widget.changeType) {
Get.back(); BaseModel baseModel = await ManageFunc.repairReassignment(
_pickedFixers.forEach((element) { _reportModel.dispatchListId, _reportModel.operato);
widget.model.detail.fixStatuses.add( if (baseModel.status) {
FixStatus( Get.back();
title: '改派给${element.name}', date: DateTime.now()), } else {
); BotToast.showText(text: baseModel.message);
}); }
} else { } else {
Get.back(); BaseModel baseModel =
Get.back(); await ManageFunc.repairDispatch(_reportModel);
widget.model.type = FIX_ENUM.WAIT_PICKUP; if (baseModel.status) {
_pickedFixers.forEach((element) { Get.back();
widget.model.detail.fixStatuses.add( Get.back();
FixStatus( } else {
title: '分配给${element.name}', date: DateTime.now()), BotToast.showText(text: baseModel.message);
); }
});
} }
}, }
: null,
// onPressed: _pickedFixers.isEmpty
// ? null
// : () {
// if (widget.changeType) {
// Get.back();
// _pickedFixers.forEach((element) {
// widget.model.detail.fixStatuses.add(
// FixStatus(
// title: '改派给${element.name}', date: DateTime.now()),
// );
// });
// } else {
// Get.back();
// Get.back();
// widget.model.type = FIX_ENUM.WAIT_PICKUP;
// _pickedFixers.forEach((element) {
// widget.model.detail.fixStatuses.add(
// FixStatus(
// title: '分配给${element.name}', date: DateTime.now()),
// );
// });
// }
// },
color: AppStyle.primaryColor, color: AppStyle.primaryColor,
nullColor: AppStyle.primaryColor.withOpacity(0.5), nullColor: AppStyle.primaryColor.withOpacity(0.5),
child: Text( child: Text(
@ -139,13 +181,14 @@ class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
AkuMaterialButton( AkuMaterialButton(
height: 96.w, height: 96.w,
onPressed: () { onPressed: () {
if (_pickedFixers // if (_pickedFixers
.indexWhere((element) => element.id == e.id) == // .indexWhere((element) => element.id == e.id) ==
-1) { // -1) {
_pickedFixers.add(e); // _pickedFixers.add(e);
} else { // } else {
_pickedFixers.remove(e); // _pickedFixers.remove(e);
} // }
_reportModel.operato = e.id;
setState(() {}); setState(() {});
}, },
child: Row( child: Row(
@ -154,12 +197,17 @@ class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
Checkbox( Checkbox(
checkColor: AppStyle.primaryTextColor, checkColor: AppStyle.primaryTextColor,
activeColor: AppStyle.primaryColor, activeColor: AppStyle.primaryColor,
value: _pickedFixers.indexOf(e) != -1, value: _reportModel.operato == e.id,
onChanged: (state) { onChanged: (state) {
if (_pickedFixers.indexOf(e) == -1) { // if (_pickedFixers.indexOf(e) == -1) {
_pickedFixers.add(e); // _pickedFixers.add(e);
// } else {
// _pickedFixers.remove(e);
// }
if (_reportModel.operato == e.id) {
_reportModel.operato = -1;
} else { } else {
_pickedFixers.remove(e); _reportModel.operato = e.id;
} }
setState(() {}); setState(() {});
}, },

@ -58,8 +58,9 @@ Future showNormalSheet(String title, List<Widget> children) async {
Future showItemSheet({ Future showItemSheet({
String title, String title,
List<String> items, List<String> items,
String selectItem, List<int> ids,
Function(String result) onTap, int selectItem,
Function(int result) onTap,
}) async { }) async {
await showNormalSheet( await showNormalSheet(
title, title,
@ -69,14 +70,14 @@ Future showItemSheet({
minWidth: double.infinity, minWidth: double.infinity,
onPressed: () { onPressed: () {
Get.back(); Get.back();
onTap(e); onTap(ids[items.indexOf(e)]);
}, },
child: Text( child: Text(
e, e,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 32.sp, fontSize: 32.sp,
color: e == selectItem color: items.indexOf(e)==ids.indexOf(selectItem)
? AppStyle.secondaryColor ? AppStyle.secondaryColor
: AppStyle.primaryTextColor, : AppStyle.primaryTextColor,
), ),

@ -0,0 +1,104 @@
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/dispatch_report_model.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/fixed_detail_model.dart';
import 'package:aku_community_manager/utils/network/base_model.dart';
import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:dio/dio.dart';
class ManageFunc {
///
static Future repairDetail(int id) async {
Response response =
await NetUtil().dio.get(API.manage.repairDetail, queryParameters: {
'repairId': id,
});
return FixedDetailModel.fromJson(response.data);
}
///
static Future dispatchListDetailType() async {
Response response = await NetUtil().dio.get(
'http://test.akuhotel.com:8804/IntelligentCommunity' +
API.manage.dispatchListDetailType);
return response.data as List;
}
///
static Future workOrderTimeType() async {
BaseModel baseModel = await NetUtil().get(API.manage.workOrderTimeLimit);
return baseModel.data as List;
}
///
static Future workOrderTypeDetail(int id) async {
BaseModel baseModel =
await NetUtil().get(API.manage.workOrderTypeDetail, params: {
'workOrderTypeId': id,
});
return baseModel.data as List;
}
///
static Future repairDispatch(DispatchReportModel model) async {
BaseModel baseModel =
await NetUtil().get(API.manage.repairDispatch, params: {
'dispatchListId': model.dispatchListId,
'workOrderType': model.workOrderTyoe,
'workOrderTypeDetail': model.workOrderTypeDetail,
'workOrderTimeLimit': model.workOrderTimeLimit,
'type': model.type,
'operator': model.operato,
'remake': model.remark,
});
return baseModel;
}
///
static Future repairReassignment(int id, int operato) async {
BaseModel baseModel = await NetUtil().get(API.manage.repairReassignment,
params: {'dispatchListId': id, 'operator': operato});
return baseModel;
}
///
static Future recevingOrders(int id) async {
BaseModel basemodel = await NetUtil()
.get(API.manage.recevingOrders, params: {'dispatchListId': id});
return basemodel;
}
///
static Future applyDelayed(int id, int delayed, String remark) async {
BaseModel baseModel =
await NetUtil().post(API.manage.applyDelayed, params: {
'dispatchListId': id,
'delayedTime': delayed,
'remake': remark,
});
return baseModel;
}
///
static Future handleResult(
int dispatchListId,
String detail,
String materialList,
double laborCost,
double materialCost,
double totalCost,
int repairResult,
List<String> fileUrls) async {
BaseModel baseModel =
await NetUtil().post(API.manage.handleResult, params: {
'dispatchListId': dispatchListId,
'detail': detail,
'materialList': materialList,
'laborCost': laborCost,
'materialCost': materialCost,
'totalCost': totalCost,
'repairResult': repairResult,
'fileUrls': fileUrls,
});
return baseModel;
}
}

@ -104,8 +104,15 @@ class NetUtil {
}) async { }) async {
try { try {
Response res = await _dio.get(path, queryParameters: params); Response res = await _dio.get(path, queryParameters: params);
BaseListModel baseListModel = BaseListModel.fromJson(res.data); if ((res.data as Map<String, dynamic>).containsKey('status') &&
return baseListModel; (res.data as Map<String, dynamic>).containsKey('data') &&
(res.data as Map<String, dynamic>).containsKey('message')) {
BaseModel baseModel = BaseModel.fromJson(res.data);
_parseRequestError(baseModel);
} else {
BaseListModel baseListModel = BaseListModel.fromJson(res.data);
return baseListModel;
}
} on DioError catch (e) { } on DioError catch (e) {
_parseErr(e); _parseErr(e);
} }

Loading…
Cancel
Save