报事报修页面更新

hmxc
小赖 4 years ago
parent cde0af7021
commit b3c8850624

@ -10,7 +10,60 @@ enum FIXER_TYPE {
}
class FixerModel {
FIXER_TYPE type;
String name;
String phone;
FixerModel({this.name, this.phone});
}
class FixerTypedModel {
FIXER_TYPE type;
String get typeName {
switch (type) {
case FIXER_TYPE.AIR_CONDITION:
return '空调组';
break;
case FIXER_TYPE.ELECTRIC:
return '电力组';
break;
case FIXER_TYPE.CEMENT:
return '水泥组';
break;
default:
return '';
}
}
List<FixerModel> fixers;
FixerTypedModel({
this.type,
this.fixers,
});
static List<FixerTypedModel> models = [
FixerTypedModel(
type: FIXER_TYPE.AIR_CONDITION,
fixers: [
FixerModel(name: '刘能建师傅', phone: '18923747283'),
FixerModel(name: '李惠政师傅', phone: '18910298345'),
FixerModel(name: '李慧珍师傅', phone: '17872342382'),
FixerModel(name: '林 芝师傅', phone: '18292847752'),
],
),
FixerTypedModel(
type: FIXER_TYPE.CEMENT,
fixers: [
FixerModel(name: '李雷师傅', phone: '18923747283'),
FixerModel(name: '林智师傅', phone: '18910298345'),
FixerModel(name: '刘凯欣师傅', phone: '17872342382'),
FixerModel(name: '张亮师傅', phone: '18292847752'),
],
),
FixerTypedModel(
type: FIXER_TYPE.ELECTRIC,
fixers: [
FixerModel(name: '李建国师傅', phone: '18923747283'),
FixerModel(name: '李历程师傅', phone: '18910298345'),
],
),
];
}

@ -1,4 +1,5 @@
import 'package:aku_community_manager/mock_models/fix/fix_model.dart';
import 'package:aku_community_manager/mock_models/fix/fixer_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:flutter/material.dart';
@ -55,4 +56,7 @@ class FixProvider extends ChangeNotifier {
break;
}
}
List<FixerTypedModel> _fixerModels = FixerTypedModel.models;
List<FixerTypedModel> get fixerModels => _fixerModels;
}

@ -4,12 +4,14 @@ 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/style/app_style.dart';
import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/sub_pages/fixer_department/fixer_department_page.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/show_bottom_sheet.dart';
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
class BusinessAndFixDetailPage extends StatefulWidget {
@ -122,7 +124,9 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
onPressed: detailModel.type != null &&
detailModel.subType != null &&
detailModel.limit != null
? () {}
? () {
Get.to(FixerDepartmentPage(model: widget.model));
}
: null,
child: Text(
'立即派单',
@ -136,7 +140,12 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
return AkuMaterialButton(
color: AppStyle.primaryColor,
nullColor: AppStyle.minorColor,
onPressed: () {},
onPressed: () {
Get.to(FixerDepartmentPage(
model: widget.model,
changeType: true,
));
},
child: Text(
'改派',
style: TextStyle(
@ -148,7 +157,16 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
return AkuMaterialButton(
color: AppStyle.primaryColor,
nullColor: AppStyle.minorColor,
onPressed: () {},
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();
},
child: Text(
'立即接单',
style: TextStyle(

@ -200,7 +200,16 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
: SizedBox(),
widget.model.type == FIX_ENUM.WAIT_PICKUP
? AkuMaterialButton(
onPressed: () {},
onPressed: () {
final userProvider =
Provider.of<UserProvider>(context, listen: false);
widget.model.detail.fixStatuses.add(FixStatus(
title: '${userProvider.userInfoModel.nickName}已接单',
date: DateTime.now(),
));
widget.model.type = FIX_ENUM.PROCESSING;
Get.back();
},
radius: 4.w,
color: AppStyle.primaryColor,
minWidth: 160.w,

@ -0,0 +1,205 @@
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/fix/fixer_model.dart';
import 'package:aku_community_manager/provider/fix_provider.dart';
import 'package:aku_community_manager/style/app_style.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/tools/screen_tool.dart';
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:expandable/expandable.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
class FixerDepartmentPage extends StatefulWidget {
final FixModel model;
final bool changeType;
FixerDepartmentPage({Key key, @required this.model, this.changeType = false})
: super(key: key);
@override
_FixerDepartmentPageState createState() => _FixerDepartmentPageState();
}
class _FixerDepartmentPageState extends State<FixerDepartmentPage> {
List<FixerModel> _pickedFixers = [];
@override
Widget build(BuildContext context) {
final fixProvider = Provider.of<FixProvider>(context);
return AkuScaffold(
title: '房屋管理维修部',
body: ListView.builder(
padding: EdgeInsets.symmetric(vertical: 16.w),
itemBuilder: (context, index) {
return _buildItem(fixProvider.fixerModels[index], index);
},
itemCount: fixProvider.fixerModels.length,
),
bottom: AkuMaterialButton(
height: 96.w,
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,
nullColor: AppStyle.primaryColor.withOpacity(0.5),
child: Text(
'立即派单',
style: TextStyle(
color: _pickedFixers.isEmpty
? AppStyle.minorTextColor
: AppStyle.primaryTextColor,
fontSize: 32.w,
fontWeight: FontWeight.bold,
),
),
),
);
}
_buildItem(FixerTypedModel model, int index) {
return Container(
decoration: BoxDecoration(
border: Border(
top: index == 0
? BorderSide.none
: BorderSide(color: Color(0xFFE8E8E8), width: 1.w),
bottom: BorderSide(color: Color(0xFFE8E8E8), width: 1.w),
),
),
child: Material(
color: Colors.white,
child: ExpandablePanel(
controller: ExpandableController(initialExpanded: true),
header: Container(
height: 96.w,
alignment: Alignment.centerLeft,
padding: EdgeInsets.symmetric(horizontal: 32.w),
child: Text(
model.typeName,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 32.sp,
fontWeight: FontWeight.bold,
),
),
),
collapsed: SizedBox(),
expanded: Column(
mainAxisSize: MainAxisSize.min,
children: [
Divider(
color: Color(0xFFE8E8E8),
height: 1.w,
thickness: 1.w,
),
...model.fixers.map((e) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
AkuMaterialButton(
height: 96.w,
onPressed: () {
if (_pickedFixers.indexOf(e) == -1) {
_pickedFixers.add(e);
} else {
_pickedFixers.remove(e);
}
setState(() {});
},
child: Row(
children: [
AkuBox.w(72),
Checkbox(
checkColor: AppStyle.primaryTextColor,
activeColor: AppStyle.primaryColor,
value: _pickedFixers.indexOf(e) != -1,
onChanged: (state) {
if (_pickedFixers.indexOf(e) == -1) {
_pickedFixers.add(e);
} else {
_pickedFixers.remove(e);
}
setState(() {});
},
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
),
Image.asset(
R.ASSETS_MESSAGE_IC_PEOPLE_PNG,
height: 40.w,
width: 40.w,
),
Text(
e.name,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.w,
fontWeight: FontWeight.bold,
),
),
Spacer(),
Image.asset(
R.ASSETS_MESSAGE_IC_PHONE_PNG,
height: 40.w,
width: 40.w,
),
Text(
e.phone,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.w,
fontWeight: FontWeight.bold,
),
),
AkuBox.w(101),
],
),
),
model.fixers.last == e
? SizedBox()
: Divider(
indent: 32.w,
endIndent: 32.w,
height: 1.w,
thickness: 1.w,
color: Color(0xFFE8E8E8),
),
],
);
}).toList()
],
),
theme: ExpandableThemeData(
tapHeaderToExpand: true,
iconPlacement: ExpandablePanelIconPlacement.right,
iconPadding: EdgeInsets.only(top: 32.w, right: 32.w),
iconSize: 32.w,
iconColor: AppStyle.minorTextColor,
),
),
),
);
}
}

@ -101,6 +101,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.3.5"
expandable:
dependency: "direct main"
description:
name: expandable
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.1.4"
extended_text:
dependency: "direct main"
description:

@ -52,6 +52,8 @@ dependencies:
flutter_rating_bar: ^3.0.1+1
expandable: ^4.1.4
aku_ui:
git:
url: http://test.akuhotel.com:8099/aku_fe/aku_ui.git

Loading…
Cancel
Save