对接:接单

对接:申请延时
对接:处理完成
hmxc
张萌 4 years ago
parent c356c70576
commit 31233e030d

@ -78,4 +78,13 @@ class _Manage {
/// ///
String get repairReassignment => '/user/repair/reassignment'; String get repairReassignment => '/user/repair/reassignment';
///
String get recevingOrders => '/user/repair/receivingOrders';
///
String get applyDelayed => '/user/repair/applyDelayed';
///
String get handleResult => '/user/repair/handleResult';
} }

@ -6,8 +6,12 @@ import 'package:aku_community_manager/models/manager/bussiness_and_fix/fixed_det
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_order_type_model.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/work_time_limit_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/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/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: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:
@ -144,7 +148,7 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
nullColor: AppStyle.minorColor, nullColor: AppStyle.minorColor,
onPressed: () { onPressed: () {
Get.to(FixerDepartmentPage( Get.to(FixerDepartmentPage(
model:_reportModel , model: _reportModel,
changeType: true, changeType: true,
)); ));
}, },
@ -159,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(
'立即接单', '立即接单',
@ -206,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(
'申请延时', '申请延时',
@ -222,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(
reportDetail: widget.model.reportDetail,
model: _detailModel,
dispatchType:
_detailModel.dispatchType.dispatchType == 1));
}, },
child: Text( child: Text(
'处理完成', '处理完成',

@ -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(

@ -2,26 +2,37 @@
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/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';
class FixWorkFinishPage extends StatefulWidget { class FixWorkFinishPage extends StatefulWidget {
final FixModel model; final FixedDetailModel model;
FixWorkFinishPage({Key key, @required this.model}) : super(key: key); final String reportDetail;
final bool dispatchType;
FixWorkFinishPage(
{Key key,
@required this.model,
@required this.dispatchType,
@required this.reportDetail})
: super(key: key);
@override @override
_FixWorkFinishPageState createState() => _FixWorkFinishPageState(); _FixWorkFinishPageState createState() => _FixWorkFinishPageState();
@ -34,6 +45,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 +71,7 @@ class _FixWorkFinishPageState extends State<FixWorkFinishPage> {
spacing: 24, spacing: 24,
children: [ children: [
Text( Text(
widget.model.title, widget.reportDetail,
style: TextStyle( style: TextStyle(
color: AppStyle.primaryTextColor, color: AppStyle.primaryTextColor,
fontSize: 28.w, fontSize: 28.w,
@ -73,13 +87,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 +278,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 +372,33 @@ 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) {
Get.back(); //TODO
} else {
BotToast.showText(text: baseModel.message);
}
}, },
), ),
); );

@ -6,6 +6,7 @@ import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
class ManageFunc { class ManageFunc {
///
static Future repairDetail(int id) async { static Future repairDetail(int id) async {
Response response = Response response =
await NetUtil().dio.get(API.manage.repairDetail, queryParameters: { await NetUtil().dio.get(API.manage.repairDetail, queryParameters: {
@ -14,6 +15,7 @@ class ManageFunc {
return FixedDetailModel.fromJson(response.data); return FixedDetailModel.fromJson(response.data);
} }
///
static Future dispatchListDetailType() async { static Future dispatchListDetailType() async {
Response response = await NetUtil().dio.get( Response response = await NetUtil().dio.get(
'http://test.akuhotel.com:8804/IntelligentCommunity' + 'http://test.akuhotel.com:8804/IntelligentCommunity' +
@ -21,11 +23,13 @@ class ManageFunc {
return response.data as List; return response.data as List;
} }
///
static Future workOrderTimeType() async { static Future workOrderTimeType() async {
BaseModel baseModel = await NetUtil().get(API.manage.workOrderTimeLimit); BaseModel baseModel = await NetUtil().get(API.manage.workOrderTimeLimit);
return baseModel.data as List; return baseModel.data as List;
} }
///
static Future workOrderTypeDetail(int id) async { static Future workOrderTypeDetail(int id) async {
BaseModel baseModel = BaseModel baseModel =
await NetUtil().get(API.manage.workOrderTypeDetail, params: { await NetUtil().get(API.manage.workOrderTypeDetail, params: {
@ -34,6 +38,7 @@ class ManageFunc {
return baseModel.data as List; return baseModel.data as List;
} }
///
static Future repairDispatch(DispatchReportModel model) async { static Future repairDispatch(DispatchReportModel model) async {
BaseModel baseModel = BaseModel baseModel =
await NetUtil().get(API.manage.repairDispatch, params: { await NetUtil().get(API.manage.repairDispatch, params: {
@ -48,9 +53,52 @@ class ManageFunc {
return baseModel; return baseModel;
} }
///
static Future repairReassignment(int id, int operato) async { static Future repairReassignment(int id, int operato) async {
BaseModel baseModel = await NetUtil().get(API.manage.repairReassignment, BaseModel baseModel = await NetUtil().get(API.manage.repairReassignment,
params: {'dispatchListId': id, 'operator': operato}); params: {'dispatchListId': id, 'operator': operato});
return baseModel; 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;
}
} }

Loading…
Cancel
Save