对接:接单

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

@ -78,4 +78,13 @@ class _Manage {
///
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_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';
// Package imports:
@ -159,15 +163,14 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
return AkuMaterialButton(
color: AppStyle.primaryColor,
nullColor: AppStyle.minorColor,
onPressed: () {
// final userProvider =
// Provider.of<UserProvider>(context, listen: false);
// detailModel.fixStatuses.add(FixStatus(
// title: '${userProvider.userInfoModel.nickName}已接单',
// date: DateTime.now(),
// ));
// widget.model.type = FIX_ENUM.PROCESSING;
// Get.back();
onPressed: () async {
BaseModel baseModel =
await ManageFunc.recevingOrders(widget.model.dispatchId);
if (baseModel.status) {
Get.back();
} else {
BotToast.showText(text: baseModel.message);
}
},
child: Text(
'立即接单',
@ -206,7 +209,8 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
),
),
onPressed: () {
// Get.to(FixMoreTimePage(model: widget.model));
Get.to(
FixMoreTimePage(dispatchId: widget.model.dispatchId));
},
child: Text(
'申请延时',
@ -222,7 +226,11 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
radius: 4.w,
color: AppStyle.primaryColor,
onPressed: () {
// Get.to(FixWorkFinishPage(model: widget.model));
Get.to(FixWorkFinishPage(
reportDetail: widget.model.reportDetail,
model: _detailModel,
dispatchType:
_detailModel.dispatchType.dispatchType == 1));
},
child: Text(
'处理完成',

@ -1,23 +1,23 @@
// 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';
// Package imports:
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
// Project imports:
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/tools/screen_tool.dart';
import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:get/get.dart';
class FixMoreTimePage extends StatefulWidget {
final FixModel model;
FixMoreTimePage({Key key, @required this.model}) : super(key: key);
final int dispatchId;
FixMoreTimePage({Key key, @required this.dispatchId}) : super(key: key);
@override
_FixMoreTimePageState createState() => _FixMoreTimePageState();
@ -25,6 +25,20 @@ class FixMoreTimePage extends StatefulWidget {
class _FixMoreTimePageState extends State<FixMoreTimePage> {
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
Widget build(BuildContext context) {
return AkuScaffold(
@ -56,7 +70,7 @@ class _FixMoreTimePageState extends State<FixMoreTimePage> {
AkuBox.h(24),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: ['24h', '48h', '72h', '未知'].map((e) {
children: _delayList.map((e) {
return GestureDetector(
onTap: () {
setState(() {
@ -131,6 +145,10 @@ class _FixMoreTimePageState extends State<FixMoreTimePage> {
child: TextField(
minLines: 7,
maxLines: 7,
controller: _textEditingController,
onChanged: (_) {
setState(() {});
},
decoration: InputDecoration(
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
@ -141,15 +159,24 @@ class _FixMoreTimePageState extends State<FixMoreTimePage> {
Padding(
padding: EdgeInsets.symmetric(horizontal: 32.w),
child: AkuMaterialButton(
onPressed: () {
final userProvider =
Provider.of<UserProvider>(context, listen: false);
widget.model.detail.fixStatuses.add(
FixStatus(
title: '${userProvider.userInfoModel.nickName}申请延时',
date: DateTime.now()),
);
onPressed: () async {
// final userProvider =
// Provider.of<UserProvider>(context, listen: false);
// widget.model.detail.fixStatuses.add(
// FixStatus(
// title: '${userProvider.userInfoModel.nickName}申请延时',
// date: DateTime.now()),
// );
// 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,
child: Text(

@ -2,26 +2,37 @@
import 'dart:io';
// 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/material.dart';
// Package imports:
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:common_utils/common_utils.dart';
import 'package:get/get.dart';
// 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/tools/screen_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/inner/aku_title_box.dart';
import 'package:aku_community_manager/ui/widgets/inner/pick_image.dart';
import 'package:get/get.dart';
class FixWorkFinishPage extends StatefulWidget {
final FixModel model;
FixWorkFinishPage({Key key, @required this.model}) : super(key: key);
final FixedDetailModel model;
final String reportDetail;
final bool dispatchType;
FixWorkFinishPage(
{Key key,
@required this.model,
@required this.dispatchType,
@required this.reportDetail})
: super(key: key);
@override
_FixWorkFinishPageState createState() => _FixWorkFinishPageState();
@ -34,6 +45,9 @@ class _FixWorkFinishPageState extends State<FixWorkFinishPage> {
TextEditingController _humanController = TextEditingController();
TextEditingController _materialPriceController = TextEditingController();
double humanPrice;
double materialPrice;
@override
void dispose() {
_descriptionController?.dispose();
@ -57,7 +71,7 @@ class _FixWorkFinishPageState extends State<FixWorkFinishPage> {
spacing: 24,
children: [
Text(
widget.model.title,
widget.reportDetail,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.w,
@ -73,13 +87,15 @@ class _FixWorkFinishPageState extends State<FixWorkFinishPage> {
mainAxisSpacing: 16.w,
),
itemBuilder: (context, index) {
final img = widget.model.imgs[index];
// final img = widget.model.imgs[index];
return ClipRRect(
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,10 +278,9 @@ class _FixWorkFinishPageState extends State<FixWorkFinishPage> {
)
],
),
// widget.model.detail.type == FIX_PAYMENT_TYPE.FREE
// ? SizedBox()
// :
AkuTitleBox(
widget.dispatchType
? SizedBox()
: AkuTitleBox(
title: '费用明细',
spacing: 16,
children: [
@ -324,15 +339,16 @@ class _FixWorkFinishPageState extends State<FixWorkFinishPage> {
Spacer(),
Builder(
builder: (context) {
double humanPrice =
double.tryParse(_humanController.text);
double materialPrice =
humanPrice = double.tryParse(_humanController.text);
materialPrice =
double.tryParse(_materialPriceController.text);
if (TextUtil.isEmpty(_humanController.text) ||
TextUtil.isEmpty(_materialPriceController.text)) {
TextUtil.isEmpty(
_materialPriceController.text)) {
return Text('人工费或材料费不能为空');
} else if (humanPrice == null || materialPrice == null)
} else if (humanPrice == null ||
materialPrice == null)
return Text('输入有误');
else
return Text(
@ -356,19 +372,33 @@ class _FixWorkFinishPageState extends State<FixWorkFinishPage> {
),
height: 96.w,
color: AppStyle.primaryColor,
onPressed: () {
widget.model.detail.result = FixResult(
detail: _descriptionController.text,
material: _materialController.text,
imgs: _imgs,
);
widget.model.type = FIX_ENUM.DONE;
if (widget.model.detail.type == FIX_PAYMENT_TYPE.PAY)
widget.model.detail.priceDetail = FixPriceDetail(
humanPrice: double.parse(_humanController.text),
materialPrice: double.parse(_materialController.text),
);
Get.back();
onPressed: () async {
// widget.model.detail.result = FixResult(
// detail: _descriptionController.text,
// material: _materialController.text,
// imgs: _imgs,
// );
// widget.model.type = FIX_ENUM.DONE;
// if (widget.model.detail.type == FIX_PAYMENT_TYPE.PAY)
// widget.model.detail.priceDetail = FixPriceDetail(
// humanPrice: double.parse(_humanController.text),
// materialPrice: double.parse(_materialController.text),
// );
// 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';
class ManageFunc {
///
static Future repairDetail(int id) async {
Response response =
await NetUtil().dio.get(API.manage.repairDetail, queryParameters: {
@ -14,6 +15,7 @@ class ManageFunc {
return FixedDetailModel.fromJson(response.data);
}
///
static Future dispatchListDetailType() async {
Response response = await NetUtil().dio.get(
'http://test.akuhotel.com:8804/IntelligentCommunity' +
@ -21,11 +23,13 @@ class ManageFunc {
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: {
@ -34,6 +38,7 @@ class ManageFunc {
return baseModel.data as List;
}
///
static Future repairDispatch(DispatchReportModel model) async {
BaseModel baseModel =
await NetUtil().get(API.manage.repairDispatch, params: {
@ -48,9 +53,52 @@ class ManageFunc {
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;
}
}

Loading…
Cancel
Save