对接 完成工单

检查昵称重复/设置昵称
master
张萌 3 years ago
parent 598b0d117d
commit a9d4bcd739

@ -31,6 +31,12 @@ class SAASAPI {
}
class _Login {
///app
String get setNickName => '/butlerApp/user/setNickName';
///
String get checkNickNameRepeat => '/butlerApp/user/checkNickNameRepeat';
///
String get allCity => '/butlerApp/city/allCity';
@ -106,12 +112,6 @@ class _User {
///app()
String get sendForgotTelCode => '/app/user/sendTelCodeForgetPwd';
///
String get checkNickRepeat => '/app/user/checkNickNameRepeat';
///
String get setNickName => '/app/user/settingNickName';
///
String get certification => '/app/user/verified';

@ -1,8 +1,8 @@
import 'package:aku_new_community_manager/const/saas_api.dart';
import 'package:aku_new_community_manager/new_ui/auth/set_nick_nage_page.dart';
import 'package:aku_new_community_manager/new_ui/auth/set_nick_name_page.dart';
import 'package:aku_new_community_manager/new_ui/new_home/new_home_page.dart';
import 'package:aku_new_community_manager/saas_models/net_model/base_model.dart';
import 'package:aku_new_community_manager/tools/user_tool.dart';
import 'package:aku_new_community_manager/ui/home/new_home/new_home_page.dart';
import 'package:aku_new_community_manager/utils/network/net_util.dart';
import 'package:dio/dio.dart';
import 'package:get/get.dart' hide Response;
@ -91,21 +91,21 @@ class SignFunc {
///
static Future<bool> checkNickRepeat(String nick) async {
BaseModel baseModel = await NetUtil().get(SAASAPI.user.checkNickRepeat,
BaseModel baseModel = await NetUtil().get(SAASAPI.login.checkNickNameRepeat,
params: {
'nickName': nick,
},
showMessage: true);
return baseModel.msg == '昵称可用';
return baseModel.success;
}
///
static Future<bool> setNickName(String nick) async {
BaseModel baseModel = await NetUtil().get(SAASAPI.user.setNickName,
BaseModel baseModel = await NetUtil().get(SAASAPI.login.setNickName,
params: {
'nickName': nick,
},
showMessage: true);
return baseModel.msg == '设置成功';
return baseModel.success;
}
}

@ -1,4 +1,7 @@
import 'package:aku_new_community_manager/gen/assets.gen.dart';
import 'package:aku_new_community_manager/new_ui/work_order/distributor/work_order_distributor_page.dart';
import 'package:aku_new_community_manager/new_ui/work_order/receiver/work_order_receiver_page.dart';
import 'package:aku_new_community_manager/tools/user_tool.dart';
import 'package:aku_new_community_manager/ui/manage_pages/inspection_manage/inspection_manage_page.dart';
import 'package:dio/dio.dart';
import 'package:equatable/equatable.dart';
@ -38,6 +41,17 @@ class ApplicationUtil {
AppElement(
title: '工单管理',
imgPath: Assets.home.icArticle.path,
onTap: () async {
if (UserTool.userProvider.userInfoModel!.workOrderJurisdiction ==
1) {
Get.to(() => WorkOrderDistributorPage());
} else {
Get.to(() => WorkOrderReceiverPage());
}
}),
AppElement(
title: '住户审核',
imgPath: Assets.home.icArticle.path,
onTap: () async {})
];
}

@ -2,8 +2,6 @@ import 'package:aku_new_community_manager/const/saas_api.dart';
import 'package:aku_new_community_manager/gen/assets.gen.dart';
import 'package:aku_new_community_manager/saas_models/home/home_message_list_model.dart';
import 'package:aku_new_community_manager/tools/user_tool.dart';
import 'package:aku_new_community_manager/ui/home/new_home/application_util.dart';
import 'package:aku_new_community_manager/ui/home/new_home/home_swiper.dart';
import 'package:aku_new_community_manager/ui/widgets/app_widgets/bee_image_network.dart';
import 'package:aku_new_community_manager/utils/bee_date_util.dart';
import 'package:aku_new_community_manager/utils/extension/list_extension.dart';
@ -14,6 +12,9 @@ import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
import 'application_util.dart';
import 'home_swiper.dart';
class NewHomePage extends StatefulWidget {
const NewHomePage({Key? key}) : super(key: key);

@ -1,5 +1,26 @@
import 'dart:io';
import 'package:aku_new_community_manager/const/saas_api.dart';
import 'package:aku_new_community_manager/new_ui/work_order/work_order_func.dart';
import 'package:aku_new_community_manager/new_ui/work_order/work_order_map.dart';
import 'package:aku_new_community_manager/saas_models/work_order/work_order_submit_model.dart';
import 'package:aku_new_community_manager/tools/extensions/int_ext.dart';
import 'package:aku_new_community_manager/tools/extensions/list_extension_tool.dart';
import 'package:aku_new_community_manager/ui/widgets/app_widgets/bee_pick_image_widget.dart';
import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_new_community_manager/ui/widgets/common/bee_divider.dart';
import 'package:aku_new_community_manager/ui/widgets/common/bee_long_button.dart';
import 'package:aku_new_community_manager/ui/widgets/common/bee_picker_box.dart';
import 'package:aku_new_community_manager/utils/network/net_util.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.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:velocity_x/src/extensions/iterable_ext.dart';
import 'package:velocity_x/src/extensions/num_ext.dart';
import 'package:velocity_x/src/extensions/string_ext.dart';
class FinishReportPage extends StatefulWidget {
const FinishReportPage({Key? key}) : super(key: key);
@ -9,13 +30,411 @@ class FinishReportPage extends StatefulWidget {
}
class _FinishReportPageState extends State<FinishReportPage> {
WorkOrderSubmitModel _submitModel = WorkOrderSubmitModel.init;
List<File> _photos = [];
double get totalCost {
var sum = 0.0;
for (var item in _submitModel.workOrderFinishCostDTOList) {
if (item.costType == 1) {
sum += item.price;
} else {
sum += (item.price * item.num);
}
}
return sum;
}
@override
Widget build(BuildContext context) {
return AkuScaffold(
title: '完成报告',
body: ListView(
children: [],
children: [
24.w.heightBox,
_orderCost(),
Container(
padding: EdgeInsets.all(32.w),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(16.w)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
'进度汇报'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
],
),
32.w.heightBox,
Container(
width: double.infinity,
padding: EdgeInsets.symmetric(horizontal: 24.w),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.06),
borderRadius: BorderRadius.circular(16.w)),
child: TextField(
autofocus: false,
onChanged: (text) {
_submitModel.content = text;
},
minLines: 5,
maxLength: 200,
maxLines: 20,
decoration: InputDecoration(
border: InputBorder.none,
),
),
),
],
),
),
32.w.heightBox,
Container(
width: double.infinity,
padding: EdgeInsets.symmetric(horizontal: 24.w),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.06),
borderRadius: BorderRadius.circular(16.w)),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
children: [
'上传图片'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
Spacer(),
'建议上传图片不超过6张'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.25))
.make(),
],
),
24.w.heightBox,
BeePickImageWidget(
maxCount: 9,
onChanged: (value) {
_photos = value;
}),
],
),
)
],
),
bottom: BeeLongButton(
onPressed: () async {
var cancel = BotToast.showLoading();
var imgUrls = <String>[];
try {
imgUrls = await NetUtil()
.uploadFiles(_photos, SAASAPI.other.file.uploadImg);
} catch (e) {
print(e.toString());
}
try {
var re = await WorkOrderFuc.finish(_submitModel);
if (re) {
Get.back();
}
} catch (e) {
print(e.toString());
}
cancel();
},
text: '提交'),
);
}
Widget _orderCost() {
return Container(
width: 686.w,
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(16.w)),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
child: Row(
children: [
'工单费用'.text.size(32.sp).black.bold.make(),
Spacer(),
IconButton(
padding: EdgeInsets.zero,
constraints: BoxConstraints(minWidth: 20.w, minHeight: 20.w),
onPressed: () {
_submitModel.workOrderFinishCostDTOList
.add(WorkOrderFinishCostDTOList.init);
setState(() {});
},
icon: Icon(
CupertinoIcons.plus,
size: 30.w,
),
),
],
),
),
BeeDivider.horizontal(),
Padding(
padding: EdgeInsets.symmetric(
horizontal: 32.w,
),
child: Row(
children: [
'费用总计'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.65))
.make(),
56.w.widthBox,
totalCost.text.size(32.sp).color(Color(0xFFF5222D)).make(),
''
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.65))
.make(),
],
),
),
BeeDivider.horizontal(),
Padding(
padding: EdgeInsets.symmetric(
horizontal: 32.w,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: _submitModel.workOrderFinishCostDTOList
.mapIndexed((e, index) => _costTile(e, index))
.toList()
.sepWidget(separate: BeeDivider.horizontal()),
),
)
],
),
);
}
Widget _costTile(WorkOrderFinishCostDTOList model, int index) {
return Column(
children: [
32.w.heightBox,
Container(
width: double.infinity,
height: 60.w,
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: 32.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
color: Colors.black.withOpacity(0.06)),
child: '收费${(index + 1).toChinese}'
.text
.size(26.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
),
GestureDetector(
onTap: () async {
showModalBottomSheet(
context: context,
builder: (context) {
return BeePickerBox(
onPressed: () {
Get.back();
setState(() {});
},
child: CupertinoPicker.builder(
itemExtent: 60.w,
childCount: WorkOrderMap.costType.keys.length,
onSelectedItemChanged: (index) {
model.costType =
WorkOrderMap.costType.keys.toList()[index];
},
itemBuilder: (context, index) {
var str =
WorkOrderMap.costType.values.toList()[index];
return Center(
child: str.text.size(32.sp).isIntrinsic.make(),
);
}));
},
);
},
child: Material(
color: Colors.transparent,
child: Container(
width: double.infinity,
height: 105.w,
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 32.w),
child: Row(
children: [
'费用类型'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.65))
.make(),
56.w.widthBox,
Expanded(
child: '${model.costType == 1 ? '人工费' : '耗材费'}'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.25))
.make(),
),
Icon(
CupertinoIcons.chevron_right,
size: 25.w,
color: Colors.black.withOpacity(0.25),
)
],
),
),
),
),
model.costType == 1 ? _laborCostItem(model) : _consumablesFee(model)
],
);
}
Widget _laborCostItem(WorkOrderFinishCostDTOList model) {
return Column(
children: [
Padding(
padding: EdgeInsets.symmetric(
horizontal: 32.w,
),
child: Row(
children: [
SizedBox(
width: 170.w,
child: '金额'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
),
Expanded(
child: TextField(
textAlign: TextAlign.start,
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'[0-9.]')),
],
onChanged: (text) {
model.price = double.parse(text);
},
autofocus: false,
decoration: InputDecoration(
contentPadding: EdgeInsets.zero,
isDense: true,
border: InputBorder.none,
hintText: '请输入金额',
hintStyle: TextStyle(
fontSize: 28.sp,
color: Colors.black.withOpacity(0.25),
)),
),
),
''.text.size(28.sp).color(Colors.black.withOpacity(0.85)).make(),
],
),
)
],
);
}
Widget _consumablesFee(WorkOrderFinishCostDTOList model) {
return Column(
children: [
Padding(
padding: EdgeInsets.symmetric(
horizontal: 32.w,
),
child: Row(
children: [
SizedBox(
width: 170.w,
child: '数量'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
),
Expanded(
child: TextField(
textAlign: TextAlign.start,
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
],
onChanged: (text) {
model.num = int.parse(text);
},
autofocus: false,
decoration: InputDecoration(
contentPadding: EdgeInsets.zero,
isDense: true,
border: InputBorder.none,
hintText: '请输入数量',
hintStyle: TextStyle(
fontSize: 28.sp,
color: Colors.black.withOpacity(0.25),
)),
),
),
],
),
),
Padding(
padding: EdgeInsets.symmetric(
horizontal: 32.w,
),
child: Row(
children: [
SizedBox(
width: 170.w,
child: '单价'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
),
Expanded(
child: TextField(
textAlign: TextAlign.start,
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'[0-9.]')),
],
onChanged: (text) {
model.price = double.parse(text);
},
autofocus: false,
decoration: InputDecoration(
contentPadding: EdgeInsets.zero,
isDense: true,
border: InputBorder.none,
hintText: '请输入金额',
hintStyle: TextStyle(
fontSize: 28.sp,
color: Colors.black.withOpacity(0.25),
)),
),
),
''.text.size(28.sp).color(Colors.black.withOpacity(0.85)).make(),
],
),
)
],
);
}
}

@ -44,7 +44,7 @@ class _ReportProgressState extends State<ReportProgress> {
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
'具体需求'
'进度汇报'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.45))
@ -70,6 +70,9 @@ class _ReportProgressState extends State<ReportProgress> {
),
),
),
],
),
),
32.w.heightBox,
Container(
width: double.infinity,
@ -106,9 +109,6 @@ class _ReportProgressState extends State<ReportProgress> {
)
],
),
)
],
),
bottom: Padding(
padding: EdgeInsets.only(
left: 32.w,

@ -74,7 +74,7 @@ class WorkOrderFuc {
}
///
static Future<bool> confirmComplete(WorkOrderSubmitModel model) async {
static Future<bool> finish(WorkOrderSubmitModel model) async {
BaseModel baseModel = await NetUtil().get(SAASAPI.workOrder.finish,
params: model.toJson(), showMessage: true);
return baseModel.success;

@ -22,4 +22,6 @@ class WorkOrderMap {
8: '用户已对您的表现进行评价',
9: '任务已拒绝,中止工单进行'
};
static Map<int, String> costType = {1: '人工费', 2: '耗材费'};
}

@ -1,20 +1,29 @@
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
part 'work_order_submit_model.g.dart';
@JsonSerializable(createToJson: true)
class WorkOrderSubmitModel extends Equatable {
final int workOrderId;
final String content;
final List<String> imgUrls;
final WorkOrderFinishCostDTOList workOrderFinishCostDTOList;
class WorkOrderSubmitModel {
int workOrderId;
String content;
List<String> imgUrls;
List<WorkOrderFinishCostDTOList> workOrderFinishCostDTOList;
factory WorkOrderSubmitModel.fromJson(Map<String, dynamic> json) =>
_$WorkOrderSubmitModelFromJson(json);
Map<String, dynamic> toJson() => _$WorkOrderSubmitModelToJson(this);
static WorkOrderSubmitModel get init => WorkOrderSubmitModel(
workOrderId: 0,
content: '',
imgUrls: [],
workOrderFinishCostDTOList: <WorkOrderFinishCostDTOList>[
WorkOrderFinishCostDTOList.init
]);
//<editor-fold desc="Data Methods">
WorkOrderSubmitModel({
required this.workOrderId,
required this.content,
@ -23,22 +32,67 @@ class WorkOrderSubmitModel extends Equatable {
});
@override
List<Object?> get props =>
[workOrderId, content, imgUrls, workOrderFinishCostDTOList];
bool operator ==(Object other) =>
identical(this, other) ||
(other is WorkOrderSubmitModel &&
runtimeType == other.runtimeType &&
workOrderId == other.workOrderId &&
content == other.content &&
imgUrls == other.imgUrls &&
workOrderFinishCostDTOList == other.workOrderFinishCostDTOList);
@override
int get hashCode =>
workOrderId.hashCode ^
content.hashCode ^
imgUrls.hashCode ^
workOrderFinishCostDTOList.hashCode;
@override
String toString() {
return 'WorkOrderSubmitModel{' +
' workOrderId: $workOrderId,' +
' content: $content,' +
' imgUrls: $imgUrls,' +
' workOrderFinishCostDTOList: $workOrderFinishCostDTOList,' +
'}';
}
WorkOrderSubmitModel copyWith({
int? workOrderId,
String? content,
List<String>? imgUrls,
List<WorkOrderFinishCostDTOList>? workOrderFinishCostDTOList,
}) {
return WorkOrderSubmitModel(
workOrderId: workOrderId ?? this.workOrderId,
content: content ?? this.content,
imgUrls: imgUrls ?? this.imgUrls,
workOrderFinishCostDTOList:
workOrderFinishCostDTOList ?? this.workOrderFinishCostDTOList,
);
}
//</editor-fold>
}
@JsonSerializable(createToJson: true)
class WorkOrderFinishCostDTOList extends Equatable {
final int costType;
final String name;
final int num;
final double price;
class WorkOrderFinishCostDTOList {
int costType;
String name;
int num;
double price;
factory WorkOrderFinishCostDTOList.fromJson(Map<String, dynamic> json) =>
_$WorkOrderFinishCostDTOListFromJson(json);
Map<String, dynamic> toJson() => _$WorkOrderFinishCostDTOListToJson(this);
static WorkOrderFinishCostDTOList get init =>
WorkOrderFinishCostDTOList(costType: 0, name: '', num: 0, price: 0);
//<editor-fold desc="Data Methods">
WorkOrderFinishCostDTOList({
required this.costType,
required this.name,
@ -47,5 +101,42 @@ class WorkOrderFinishCostDTOList extends Equatable {
});
@override
List<Object?> get props => [costType, num, name, price];
bool operator ==(Object other) =>
identical(this, other) ||
(other is WorkOrderFinishCostDTOList &&
runtimeType == other.runtimeType &&
costType == other.costType &&
name == other.name &&
num == other.num &&
price == other.price);
@override
int get hashCode =>
costType.hashCode ^ name.hashCode ^ num.hashCode ^ price.hashCode;
@override
String toString() {
return 'WorkOrderFinishCostDTOList{' +
' costType: $costType,' +
' name: $name,' +
' num: $num,' +
' price: $price,' +
'}';
}
WorkOrderFinishCostDTOList copyWith({
int? costType,
String? name,
int? num,
double? price,
}) {
return WorkOrderFinishCostDTOList(
costType: costType ?? this.costType,
name: name ?? this.name,
num: num ?? this.num,
price: price ?? this.price,
);
}
//</editor-fold>
}

@ -13,8 +13,11 @@ WorkOrderSubmitModel _$WorkOrderSubmitModelFromJson(
content: json['content'] as String,
imgUrls:
(json['imgUrls'] as List<dynamic>).map((e) => e as String).toList(),
workOrderFinishCostDTOList: WorkOrderFinishCostDTOList.fromJson(
json['workOrderFinishCostDTOList'] as Map<String, dynamic>),
workOrderFinishCostDTOList: (json['workOrderFinishCostDTOList']
as List<dynamic>)
.map((e) =>
WorkOrderFinishCostDTOList.fromJson(e as Map<String, dynamic>))
.toList(),
);
Map<String, dynamic> _$WorkOrderSubmitModelToJson(

@ -0,0 +1,30 @@
extension intExt on int {
String get toChinese {
String nubStr = this.toString();
if (nubStr.length > 2) {
return '';
} else if (nubStr.length > 1) {
var p1 = _getNum(nubStr, 1);
var p2 = _getNum(nubStr, 2);
if (p2 == '') {
p2 = '';
}
if (p1 == '') {
p1 = '';
}
return p1 + '' + p2;
} else {
return _getNum(nubStr, 1);
}
}
//
String _getNum(String dig, int index) {
List<String> _chinese = ['', '', '', '', '', '', '', '', '', ''];
if (index > dig.length) {
return '';
} else {
return _chinese[int.parse(dig[index - 1])];
}
}
}
Loading…
Cancel
Save