diff --git a/assets/manage/address.png b/assets/manage/address.png new file mode 100644 index 0000000..b03f0f9 Binary files /dev/null and b/assets/manage/address.png differ diff --git a/assets/manage/decoration.png b/assets/manage/decoration.png new file mode 100644 index 0000000..5bc27af Binary files /dev/null and b/assets/manage/decoration.png differ diff --git a/assets/manage/home.png b/assets/manage/home.png new file mode 100644 index 0000000..9350291 Binary files /dev/null and b/assets/manage/home.png differ diff --git a/assets/manage/status.png b/assets/manage/status.png new file mode 100644 index 0000000..8bd2ca6 Binary files /dev/null and b/assets/manage/status.png differ diff --git a/lib/mock_models/decoration/decoration_data.dart b/lib/mock_models/decoration/decoration_data.dart new file mode 100644 index 0000000..73344b0 --- /dev/null +++ b/lib/mock_models/decoration/decoration_data.dart @@ -0,0 +1,118 @@ +import 'package:aku_community_manager/mock_models/decoration/decoration_model.dart'; +import 'package:aku_community_manager/mock_models/fix/fixer_model.dart'; + +class DecorationData { + static List allModels = [ + DecorationModel( + type: DecorationType.DONE, + statusType: DecorationStatusType.DONE, + userHomeModel: UserHomeModel( + userName: '李慧珍', + plot: '深圳华茂悦峰', + detailAddr: '1幢-1单元-302室', + phone: '18201939840', + decorationStatus: false, + ), + decorationTeamModel: DecorationTeamModel( + name: '深圳莫川装修有限公司', + userName: '李惠政', + phone: '19298540192', + ), + cycleCheck: CycleCheck( + decorationDate: DateTime(2020, 1, 23, 12, 23, 0), + authPerson: FixerModel(name: '林鸿章', phone: '18294859301'), + startDate: DateTime(2020, 1, 23, 20, 23, 0), + checkCycle: 7, + checkDetails: [ + CHECK_TYPE.ELECTRIC, + CHECK_TYPE.WATER, + CHECK_TYPE.WALL, + CHECK_TYPE.DOOR_AND_WINDOWS, + ], + ), + workFinishCheck: WorkFinishCheck( + decorationDate: DateTime(2020, 1, 23, 12, 23, 0), + authPerson: FixerModel(name: '林鸿章', phone: '18294859301'), + startDate: DateTime(2020, 1, 23, 20, 23, 0), + checkDetails: [ + CHECK_TYPE.ELECTRIC, + CHECK_TYPE.WATER, + CHECK_TYPE.WALL, + CHECK_TYPE.DOOR_AND_WINDOWS, + CHECK_TYPE.SECURITY, + ], + ), + checkInfomations: [ + CheckInfomation( + checkDate: DateTime(2020, 3, 20, 12, 00), + info: '正常', + checkType: '完工检查', + details: [ + CheckDetail(type: CHECK_TYPE.ELECTRIC), + CheckDetail(type: CHECK_TYPE.WATER), + CheckDetail(type: CHECK_TYPE.WALL), + CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS), + ], + ), + CheckInfomation( + checkDate: DateTime(2020, 2, 14, 12, 00), + info: '正常', + checkType: '周期检查', + details: [ + CheckDetail(type: CHECK_TYPE.ELECTRIC), + CheckDetail(type: CHECK_TYPE.WATER), + CheckDetail(type: CHECK_TYPE.WALL), + CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS), + ], + ), + CheckInfomation( + checkDate: DateTime(2020, 2, 7, 12, 00), + info: '厨房水路异常', + checkType: '周期检查', + details: [ + CheckDetail(type: CHECK_TYPE.ELECTRIC), + CheckDetail(type: CHECK_TYPE.WATER, status: false), + CheckDetail(type: CHECK_TYPE.WALL), + CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS), + ], + ), + CheckInfomation( + checkDate: DateTime(2020, 1, 30, 12, 00), + info: '正常', + checkType: '周期检查', + details: [ + CheckDetail(type: CHECK_TYPE.ELECTRIC), + CheckDetail(type: CHECK_TYPE.WATER), + CheckDetail(type: CHECK_TYPE.WALL), + CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS), + ], + ), + CheckInfomation( + checkDate: DateTime(2020, 1, 23, 12, 00), + info: '正常', + checkType: '周期检查', + details: [ + CheckDetail(type: CHECK_TYPE.ELECTRIC), + CheckDetail(type: CHECK_TYPE.WATER), + CheckDetail(type: CHECK_TYPE.WALL), + CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS), + ], + ), + ], + ), + ]; + + static List getModels(DecorationType type) { + return allModels.where((element) => element.type == type).toList(); + } + + static List getTypeModels(DecorationStatusType type) { + return allModels.where((element) => element.statusType == type).toList(); + } + + static List get allPropertyModels { + return allModels + .where((element) => element.type != DecorationType.WAIT_HAND_OUT) + .toList(); + } +} diff --git a/lib/mock_models/decoration/decoration_model.dart b/lib/mock_models/decoration/decoration_model.dart index c5d49c1..091bcbc 100644 --- a/lib/mock_models/decoration/decoration_model.dart +++ b/lib/mock_models/decoration/decoration_model.dart @@ -1,14 +1,22 @@ +import 'package:aku_community_manager/mock_models/fix/fixer_model.dart'; +import 'package:flutter/material.dart'; + enum DecorationType { - /// - WAIT_, + ///待指派 + WAIT_HAND_OUT, - ///已指派 + ///已指派&待执行 HAND_OUT, ///已执行 DONE, } +enum DecorationStatusType { + PROGRESS, + DONE, +} + enum CHECK_TYPE { ELECTRIC, WATER, @@ -17,13 +25,47 @@ enum CHECK_TYPE { SECURITY, } +Map checkTypeMap = { + CHECK_TYPE.ELECTRIC: '电路', + CHECK_TYPE.WATER: '水路', + CHECK_TYPE.WALL: '墙面', + CHECK_TYPE.DOOR_AND_WINDOWS: '门窗', + CHECK_TYPE.SECURITY: '安防', +}; + +Map checkTypeStringMap = { + '电路': CHECK_TYPE.ELECTRIC, + '水路': CHECK_TYPE.WATER, + '墙面': CHECK_TYPE.WALL, + '门窗': CHECK_TYPE.DOOR_AND_WINDOWS, + '安防': CHECK_TYPE.SECURITY, +}; + class DecorationModel { - DateTime decorationDate; - DateTime startDate; - String checkCycle; + DecorationType type; + DecorationStatusType statusType; UserHomeModel userHomeModel; DecorationTeamModel decorationTeamModel; - List checkTypes; + CycleCheck cycleCheck; + WorkFinishCheck workFinishCheck; + List checkInfomations; + + String get statusTypeValue { + if (statusType == DecorationStatusType.PROGRESS) + return '装修中'; + else + return '装修完成'; + } + + DecorationModel({ + @required this.type, + @required this.statusType, + @required this.userHomeModel, + @required this.decorationTeamModel, + this.cycleCheck, + this.workFinishCheck, + this.checkInfomations, + }); } ///用户家庭信息 @@ -32,11 +74,13 @@ class UserHomeModel { String detailAddr; String userName; String phone; + bool decorationStatus; UserHomeModel({ this.plot, this.detailAddr, this.userName, this.phone, + this.decorationStatus, }); } @@ -51,3 +95,66 @@ class DecorationTeamModel { this.phone, }); } + +///周期检查 +class CycleCheck { + DateTime decorationDate; + FixerModel authPerson; + DateTime startDate; + + ///check cycle in days + int checkCycle; + List checkDetails; + CycleCheck({ + this.decorationDate, + this.authPerson, + this.startDate, + this.checkCycle, + this.checkDetails, + }); +} + +class WorkFinishCheck { + DateTime decorationDate; + FixerModel authPerson; + DateTime startDate; + List checkDetails; + WorkFinishCheck({ + this.decorationDate, + this.authPerson, + this.startDate, + this.checkDetails, + }); +} + +///周期检查细节 +class CheckInfomation { + DateTime checkDate; + List details; + String info; + String checkType; + CheckInfomation({ + this.checkDate, + this.info, + this.details, + this.checkType, + }); + + ///检查结果 + bool get checkAllResult { + for (var item in details) { + if (!item.status) return false; + } + return true; + } +} + +class CheckDetail { + CHECK_TYPE type; + bool status; + CheckDetail({ + @required this.type, + this.status = true, + }); + String get typeValue => checkTypeMap[type]; +} diff --git a/lib/mock_models/users/user_info_model.dart b/lib/mock_models/users/user_info_model.dart index 236e868..3c81639 100644 --- a/lib/mock_models/users/user_info_model.dart +++ b/lib/mock_models/users/user_info_model.dart @@ -4,7 +4,7 @@ enum USER_ROLE { ///管家角色 MANAGER, - ///修理师傅角色 + ///师傅角色 FIXER, ///保安角色 diff --git a/lib/style/app_style.dart b/lib/style/app_style.dart index 82a8f1a..abf1225 100644 --- a/lib/style/app_style.dart +++ b/lib/style/app_style.dart @@ -2,6 +2,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +export 'package:flutter_screenutil/flutter_screenutil.dart'; + class AppStyle { //颜色,渐变主颜色和次级颜色 static const primaryColor = Color(0xFFFDCF12); diff --git a/lib/ui/sub_pages/business_and_fix/business_fix_card.dart b/lib/ui/sub_pages/business_and_fix/business_fix_card.dart index 3b5f754..e439c83 100644 --- a/lib/ui/sub_pages/business_and_fix/business_fix_card.dart +++ b/lib/ui/sub_pages/business_and_fix/business_fix_card.dart @@ -6,6 +6,7 @@ import 'package:aku_community_manager/tools/widget_tool.dart'; import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_and_fix_detail_page.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/widgets/inner/aku_chip_box.dart'; import 'package:aku_ui/common_widgets/aku_material_button.dart'; import 'package:common_utils/common_utils.dart'; import 'package:flutter/material.dart'; @@ -66,23 +67,7 @@ class _BusinessFixCardState extends State { children: [ Row( children: [ - Container( - child: Text( - '报事报修', - style: TextStyle( - color: AppStyle.secondaryColor, - fontSize: 20.sp, - fontWeight: FontWeight.bold, - ), - ), - padding: - EdgeInsets.symmetric(vertical: 6.w, horizontal: 16.w), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(2.w), - border: - Border.all(width: 2.w, color: AppStyle.secondaryColor), - ), - ), + AkuChipBox(title: '报事报修'), AkuBox.w(16), Expanded( child: Text( diff --git a/lib/ui/sub_pages/decoration_manager/decoration_manager_card.dart b/lib/ui/sub_pages/decoration_manager/decoration_manager_card.dart new file mode 100644 index 0000000..08b36db --- /dev/null +++ b/lib/ui/sub_pages/decoration_manager/decoration_manager_card.dart @@ -0,0 +1,182 @@ +import 'package:aku_community_manager/mock_models/decoration/decoration_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/style/app_style.dart'; +import 'package:aku_community_manager/tools/widget_tool.dart'; +import 'package:aku_community_manager/ui/widgets/inner/aku_chip_box.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:aku_community_manager/const/resource.dart'; +import 'package:provider/provider.dart'; + +class DecorationManagerCard extends StatefulWidget { + final DecorationModel model; + DecorationManagerCard({Key key, @required this.model}) : super(key: key); + + @override + _DecorationManagerCardState createState() => _DecorationManagerCardState(); +} + +class _DecorationManagerCardState extends State { + USER_ROLE get role => + Provider.of(context, listen: false).userInfoModel.role; + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.only(top: 16.w), + padding: EdgeInsets.all(24.w), + child: Column( + children: [ + Row( + children: [ + AkuChipBox(title: '装修管理'), + AkuBox.w(16), + Text( + DateUtil.formatDate( + widget.model.cycleCheck.decorationDate, + format: 'yyyy-MM-dd HH:mm:ss', + ), + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 22.w, + ), + ), + Spacer(), + Text( + _getTagName(), + style: TextStyle( + color: _getTagColor(), + fontSize: 24.w, + ), + ), + ], + ), + AkuBox.h(24), + _buildTile( + R.ASSETS_MANAGE_HOME_PNG, + '小区名称', + widget.model.userHomeModel.plot, + ), + AkuBox.h(12), + _buildTile( + R.ASSETS_MANAGE_ADDRESS_PNG, + '详细地址', + widget.model.userHomeModel.detailAddr, + ), + AkuBox.h(12), + _buildTile( + R.ASSETS_MANAGE_DECORATION_PNG, + '装修公司', + widget.model.decorationTeamModel.name, + ), + AkuBox.h(12), + _buildTile( + R.ASSETS_MANAGE_STATUS_PNG, + '装修状态', + widget.model.statusTypeValue, + ), + Divider( + height: 48.w, + ), + Align( + alignment: Alignment.centerRight, + child: AkuMaterialButton( + onPressed: () {}, + height: 64.w, + minWidth: 160.w, + color: AppStyle.primaryColor, + child: Text( + '查看详情', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 28.w, + ), + ), + radius: 4.w, + ), + ), + ], + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w), + ), + ); + } + + _buildTile(String path, String title, String subTitle) { + return Row( + children: [ + Image.asset( + path, + height: 40.w, + width: 40.w, + ), + Text( + title, + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 28.sp, + ), + ), + Spacer(), + Text( + subTitle, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold, + ), + ), + ], + ); + } + + _getTagName() { + Map managerMap = { + DecorationType.WAIT_HAND_OUT: '待指派', + DecorationType.HAND_OUT: '已指派', + DecorationType.DONE: '已执行', + }; + + Map fixerMap = { + DecorationType.HAND_OUT: '待执行', + DecorationType.DONE: '已执行', + }; + + Map defaultMap = { + DecorationStatusType.DONE: '装修完成', + DecorationStatusType.PROGRESS: '装修中', + }; + + switch (role) { + case USER_ROLE.MANAGER: + return managerMap[widget.model.type]; + break; + case USER_ROLE.PROPERTY: + return fixerMap[widget.model.type]; + break; + default: + return defaultMap[widget.model.statusType]; + break; + } + } + + Color _getTagColor() { + if (role == USER_ROLE.MANAGER || role == USER_ROLE.PROPERTY) { + if (widget.model.type == DecorationType.WAIT_HAND_OUT || + widget.model.type == DecorationType.HAND_OUT) { + return Color(0xFFFF4501); + } else + return AppStyle.minorTextColor; + } else { + if (widget.model.statusType == DecorationStatusType.PROGRESS) { + return Color(0xFFFF4501); + } else + return Color(0xFF32B814); + } + } +} diff --git a/lib/ui/sub_pages/decoration_manager/decoration_manager_page.dart b/lib/ui/sub_pages/decoration_manager/decoration_manager_page.dart index 36136d7..9bc4958 100644 --- a/lib/ui/sub_pages/decoration_manager/decoration_manager_page.dart +++ b/lib/ui/sub_pages/decoration_manager/decoration_manager_page.dart @@ -1,5 +1,13 @@ +import 'package:aku_community_manager/mock_models/decoration/decoration_data.dart'; +import 'package:aku_community_manager/mock_models/decoration/decoration_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/ui/sub_pages/decoration_manager/decoration_manager_card.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_community_manager/ui/widgets/inner/aku_tab_bar.dart'; +import 'package:aku_community_manager/tools/screen_tool.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class DecorationManagerPage extends StatefulWidget { DecorationManagerPage({Key key}) : super(key: key); @@ -8,11 +16,88 @@ class DecorationManagerPage extends StatefulWidget { _DecorationManagerPageState createState() => _DecorationManagerPageState(); } -class _DecorationManagerPageState extends State { +class _DecorationManagerPageState extends State + with TickerProviderStateMixin { + TabController _tabController; + USER_ROLE get role => + Provider.of(context, listen: false).userInfoModel.role; + + List get tabs { + switch (role) { + case USER_ROLE.MANAGER: + return ['待指派', '已指派', '已执行', '全部']; + break; + + case USER_ROLE.PROPERTY: + return ['待执行', '已执行', '全部']; + break; + default: + return ['装修中', '装修完成', '全部']; + break; + } + } + + @override + void initState() { + super.initState(); + + _tabController = TabController(length: tabs.length, vsync: this); + } + @override Widget build(BuildContext context) { return AkuScaffold( title: '装修管理', + appBarBottom: PreferredSize( + child: AkuTabBar( + controller: _tabController, + tabs: tabs, + ), + preferredSize: Size.fromHeight(96.w), + ), + body: TabBarView( + controller: _tabController, + children: _getViews(), + ), + ); + } + + List _getViews() { + switch (role) { + case USER_ROLE.MANAGER: + return [ + _getSingleListView( + DecorationData.getModels(DecorationType.WAIT_HAND_OUT)), + _getSingleListView(DecorationData.getModels(DecorationType.HAND_OUT)), + _getSingleListView(DecorationData.getModels(DecorationType.DONE)), + _getSingleListView(DecorationData.allModels), + ]; + break; + case USER_ROLE.PROPERTY: + return [ + _getSingleListView(DecorationData.getModels(DecorationType.HAND_OUT)), + _getSingleListView(DecorationData.getModels(DecorationType.DONE)), + _getSingleListView(DecorationData.allPropertyModels), + ]; + default: + return [ + _getSingleListView( + DecorationData.getTypeModels(DecorationStatusType.PROGRESS)), + _getSingleListView( + DecorationData.getTypeModels(DecorationStatusType.DONE)), + _getSingleListView(DecorationData.allPropertyModels), + ]; + break; + } + } + + _getSingleListView(List models) { + return ListView.builder( + itemBuilder: (context, index) { + return DecorationManagerCard(model: models[index]); + }, + itemCount: models.length, + padding: EdgeInsets.symmetric(horizontal: 32.w), ); } } diff --git a/lib/ui/widgets/inner/aku_chip_box.dart b/lib/ui/widgets/inner/aku_chip_box.dart new file mode 100644 index 0000000..ffe96e7 --- /dev/null +++ b/lib/ui/widgets/inner/aku_chip_box.dart @@ -0,0 +1,26 @@ +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:flutter/material.dart'; + +class AkuChipBox extends StatelessWidget { + final String title; + const AkuChipBox({Key key, @required this.title}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Container( + child: Text( + title, + style: TextStyle( + color: AppStyle.secondaryColor, + fontSize: 20.sp, + fontWeight: FontWeight.bold, + ), + ), + padding: EdgeInsets.symmetric(vertical: 6.w, horizontal: 16.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2.w), + border: Border.all(width: 2.w, color: AppStyle.secondaryColor), + ), + ); + } +}