diff --git a/lib/const/api.dart b/lib/const/api.dart index be7aa01..58ec3cb 100644 --- a/lib/const/api.dart +++ b/lib/const/api.dart @@ -270,6 +270,12 @@ class _Manage { ///管家app 家政服务管理:添加家政服务信息 String get addHouseKeeping => '/user/housekeeping/insert'; + + ///管家app 装修管理:查询所有的装修管理信息 + String get newRenovationList => '/user/userDecorationNew/list'; + + ///管家app 新版装修:提交检查报告 + String get submitRenovation => '/user/userDecorationNew/submitReport'; } class _Upload { diff --git a/lib/models/manager/new_renovation/new_renovation_list_model.dart b/lib/models/manager/new_renovation/new_renovation_list_model.dart new file mode 100644 index 0000000..7f37c97 --- /dev/null +++ b/lib/models/manager/new_renovation/new_renovation_list_model.dart @@ -0,0 +1,221 @@ +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:common_utils/common_utils.dart'; +import 'package:flutter/material.dart'; + +class NewRenovationListModel { + int id; + String roomName; + int status; + String constructionUnit; + String director; + String directorTel; + String expectedBegin; + String expectedEnd; + String actualBegin; + String actualEnd; + String rejectReason; + String reviewerName; + String auditDate; + String trackerName; + String applicationCheckDate; + int isQualified; + String createName; + String createDate; + List checkVoList; + + NewRenovationListModel( + {this.id, + this.roomName, + this.status, + this.constructionUnit, + this.director, + this.directorTel, + this.expectedBegin, + this.expectedEnd, + this.actualBegin, + this.actualEnd, + this.rejectReason, + this.reviewerName, + this.auditDate, + this.trackerName, + this.applicationCheckDate, + this.isQualified, + this.createName, + this.createDate, + this.checkVoList}); + + NewRenovationListModel.fromJson(Map json) { + id = json['id']; + roomName = json['roomName']; + status = json['status']; + constructionUnit = json['constructionUnit']; + director = json['director']; + directorTel = json['directorTel']; + expectedBegin = json['expectedBegin']; + expectedEnd = json['expectedEnd']; + actualBegin = json['actualBegin']; + actualEnd = json['actualEnd']; + rejectReason = json['rejectReason']; + reviewerName = json['reviewerName']; + auditDate = json['auditDate']; + trackerName = json['trackerName']; + applicationCheckDate = json['applicationCheckDate']; + isQualified = json['isQualified']; + createName = json['createName']; + createDate = json['createDate']; + if (json['checkVoList'] != null) { + checkVoList = new List(); + json['checkVoList'].forEach((v) { + checkVoList.add(new CheckVoList.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['roomName'] = this.roomName; + data['status'] = this.status; + data['constructionUnit'] = this.constructionUnit; + data['director'] = this.director; + data['directorTel'] = this.directorTel; + data['expectedBegin'] = this.expectedBegin; + data['expectedEnd'] = this.expectedEnd; + data['actualBegin'] = this.actualBegin; + data['actualEnd'] = this.actualEnd; + data['rejectReason'] = this.rejectReason; + data['reviewerName'] = this.reviewerName; + data['auditDate'] = this.auditDate; + data['trackerName'] = this.trackerName; + data['applicationCheckDate'] = this.applicationCheckDate; + data['isQualified'] = this.isQualified; + data['createName'] = this.createName; + data['createDate'] = this.createDate; + if (this.checkVoList != null) { + data['checkVoList'] = this.checkVoList.map((v) => v.toJson()).toList(); + } + return data; + } + + String get expectBginString => + DateUtil.formatDateStr(this.expectedBegin, format: 'yyyy-MM-dd HH:mm'); + + String get expectEndString => + DateUtil.formatDateStr(this.expectedEnd, format: 'yyyy-MM-dd HH:mm'); + + String get actualBginString => DateUtil.formatDateStr(this.actualBegin ?? '', + format: 'yyyy-MM-dd HH:mm'); + + String get actualEndString => + DateUtil.formatDateStr(this.actualEnd ?? '', format: 'yyyy-MM-dd HH:mm'); + String get expectSlot => + '${expectBginString}-${DateUtil.formatDateStr(this.expectedEnd, format: 'HH:mm')}'; + String get actualSlot => + '${actualBginString}-${DateUtil.formatDateStr(this.actualEnd ?? '', format: 'HH:mm')}'; + + String get qualitfied { + switch (this.isQualified) { + case 1: + return '合格'; + case 2: + return '不合格'; + default: + return '未知'; + } + } + + String get statusString { + switch (this.status) { + // case 1: + // return '申请中'; + // case 2: + // return '装修中'; + // case 3: + // return '申请驳回'; + // // case 4: + // // return '装修中'; + // case 5: + // return '申请完工检查'; + case 6: + return '完工检查中'; + case 7: + return '检查通过'; + case 8: + return '检查不通过'; + default: + return '未知'; + } + } + + Color get statusColor { + switch (this.status) { + // case 1: + // return kPrimaryColor; + // case 2: + // return Colors.green; + // case 3: + // return Colors.red; + // // case 4: + // // return ktextPrimary; + // case 5: + // return kPrimaryColor; + case 6: + return kTextSubColor; + + case 7: + return Colors.green; + case 8: + return Colors.red; + default: + return kTextPrimaryColor; + } + } +} + +class CheckVoList { + int id; + int decorationNewId; + String detail; + int isQualified; + String createName; + String createDate; + + CheckVoList( + {this.id, + this.decorationNewId, + this.detail, + this.isQualified, + this.createName, + this.createDate}); + + CheckVoList.fromJson(Map json) { + id = json['id']; + decorationNewId = json['decorationNewId']; + detail = json['detail']; + isQualified = json['isQualified']; + createName = json['createName']; + createDate = json['createDate']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['decorationNewId'] = this.decorationNewId; + data['detail'] = this.detail; + data['isQualified'] = this.isQualified; + data['createName'] = this.createName; + data['createDate'] = this.createDate; + return data; + } + + String get qualitfied { + switch (this.isQualified) { + case 1: + return '合格'; + case 2: + return '不合格'; + default: + return '未知'; + } + } +} diff --git a/lib/provider/app_provider.dart b/lib/provider/app_provider.dart index d05a0a5..ceb654e 100644 --- a/lib/provider/app_provider.dart +++ b/lib/provider/app_provider.dart @@ -91,13 +91,10 @@ class AppProvider extends ChangeNotifier { DateTime get clockOutTime => _clockOutTime; initClock() { - DateUtil.isToday(_dateRecord.millisecondsSinceEpoch.abs()); - // if (_dateRecord == null || - // (_dateRecord != - // DateTime.utc(DateTime.now().year, DateTime.now().month, - // DateTime.now().day))) { - // resetClock(); - // } + if (_dateRecord == null || + (DateUtil.isToday(_dateRecord.millisecondsSinceEpoch.abs()))) { + resetClock(); + } if (_dateRecord == null || (!DateUtils.isSameDay(_dateRecord, DateTime.now()))) { diff --git a/lib/ui/home/application/applications_page.dart b/lib/ui/home/application/applications_page.dart index ba26a2c..0ff454f 100644 --- a/lib/ui/home/application/applications_page.dart +++ b/lib/ui/home/application/applications_page.dart @@ -3,6 +3,7 @@ import 'package:aku_community_manager/ui/manage_pages/clock_in_out/clock_in_out_ import 'package:aku_community_manager/ui/manage_pages/facilities/facilities_select_page.dart'; import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_page.dart'; import 'package:aku_community_manager/ui/manage_pages/interview/interview_page.dart'; +import 'package:aku_community_manager/ui/sub_pages/decoration_manager/new_renovation/new_renovation_page.dart'; import 'package:flutter/material.dart'; // Package imports: @@ -25,7 +26,6 @@ import 'package:aku_community_manager/ui/manage_pages/rules_manage/rules_manage_ import 'package:aku_community_manager/ui/sub_pages/activity_manager/activity_manager_page.dart'; import 'package:aku_community_manager/ui/sub_pages/borrow_manager/borrow_manager_page.dart'; import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_and_fix_page.dart'; -import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_manager_page.dart'; import 'package:aku_community_manager/ui/sub_pages/items_outdoor/items_outdoor_page.dart'; import 'package:aku_community_manager/ui/sub_pages/visitor_manager/visitor_manager_page.dart'; import 'package:aku_community_manager/ui/tool_pages/warning/warning_page.dart'; @@ -74,7 +74,7 @@ class _ApplicationPageState extends State AppApplication( '物品出户', R.ASSETS_HOME_IC_ARTICLE_PNG, () => ItemsOutdoorPage()), AppApplication( - '装修管理', R.ASSETS_HOME_IC_DECORATION_PNG, () => DecorationManagerPage()), + '装修管理', R.ASSETS_HOME_IC_DECORATION_PNG, () => NewRenovationPage()), AppApplication( '活动管理', R.ASSETS_HOME_IC_ACTIVITY_PNG, () => ActivityManagerPage()), AppApplication( diff --git a/lib/ui/home/search_workorder_page.dart b/lib/ui/home/search_workorder_page.dart index a1bd866..7dcda93 100644 --- a/lib/ui/home/search_workorder_page.dart +++ b/lib/ui/home/search_workorder_page.dart @@ -3,6 +3,7 @@ import 'package:aku_community_manager/ui/manage_pages/clock_in_out/clock_in_out_ import 'package:aku_community_manager/ui/manage_pages/facilities/facilities_select_page.dart'; import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_page.dart'; import 'package:aku_community_manager/ui/manage_pages/interview/interview_page.dart'; +import 'package:aku_community_manager/ui/sub_pages/decoration_manager/new_renovation/new_renovation_page.dart'; import 'package:flutter/material.dart'; // Package imports: @@ -26,7 +27,6 @@ import 'package:aku_community_manager/ui/manage_pages/rules_manage/rules_manage_ import 'package:aku_community_manager/ui/sub_pages/activity_manager/activity_manager_page.dart'; import 'package:aku_community_manager/ui/sub_pages/borrow_manager/borrow_manager_page.dart'; import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_and_fix_page.dart'; -import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_manager_page.dart'; import 'package:aku_community_manager/ui/sub_pages/items_outdoor/items_outdoor_page.dart'; import 'package:aku_community_manager/ui/sub_pages/visitor_manager/visitor_manager_page.dart'; import 'package:aku_community_manager/ui/tool_pages/warning/warning_page.dart'; @@ -43,17 +43,17 @@ class SearchWorkOrderPage extends StatefulWidget { class _SearchWorkOrderpageState extends State { TextEditingController _textController; List _wisdomApplications = [ - AppApplication('一键报警', R.ASSETS_HOME_IC_POLICE_PNG, WarningPage()), - AppApplication('访客管理', R.ASSETS_HOME_IC_VISITORS_PNG, VisitorManagerPage()), - AppApplication('报事报修', R.ASSETS_HOME_IC_SERVICE_PNG, BusinessAndFixPage()), - AppApplication('物品出户', R.ASSETS_HOME_IC_ARTICLE_PNG, ItemsOutdoorPage()), + AppApplication('一键报警', R.ASSETS_HOME_IC_POLICE_PNG, ()=>WarningPage()), + AppApplication('访客管理', R.ASSETS_HOME_IC_VISITORS_PNG, ()=>VisitorManagerPage()), + AppApplication('报事报修', R.ASSETS_HOME_IC_SERVICE_PNG, ()=>BusinessAndFixPage()), + AppApplication('物品出户', R.ASSETS_HOME_IC_ARTICLE_PNG,()=> ItemsOutdoorPage()), AppApplication( - '装修管理', R.ASSETS_HOME_IC_DECORATION_PNG, DecorationManagerPage()), + '装修管理', R.ASSETS_HOME_IC_DECORATION_PNG, ()=>NewRenovationPage()), AppApplication( - '活动管理', R.ASSETS_HOME_IC_ACTIVITY_PNG, ActivityManagerPage()), - AppApplication('借还管理', R.ASSETS_HOME_IC_BORROW_PNG, BorrowManagerPage()), - AppApplication('巡检管理', R.ASSETS_HOME_IC_PATROL_PNG, InspectionManagePage()), - AppApplication('绿化管理', R.ASSETS_HOME_IC_GREENING_PNG, GreenManagePage()), + '活动管理', R.ASSETS_HOME_IC_ACTIVITY_PNG, ()=>ActivityManagerPage()), + AppApplication('借还管理', R.ASSETS_HOME_IC_BORROW_PNG,()=> BorrowManagerPage()), + AppApplication('巡检管理', R.ASSETS_HOME_IC_PATROL_PNG, ()=>InspectionManagePage()), + AppApplication('绿化管理', R.ASSETS_HOME_IC_GREENING_PNG,()=> GreenManagePage()), AppApplication( '设施检查', R.ASSETS_HOME_IC_FACILITIES_PNG, () => FacilitiesSelectPage()), AppApplication( diff --git a/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_card.dart b/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_card.dart new file mode 100644 index 0000000..39f66f8 --- /dev/null +++ b/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_card.dart @@ -0,0 +1,164 @@ +import 'package:aku_community_manager/models/manager/new_renovation/new_renovation_list_model.dart'; +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/tools/aku_divider.dart'; +import 'package:aku_community_manager/ui/sub_pages/decoration_manager/new_renovation/new_renovation_detail_page.dart'; +import 'package:aku_community_manager/ui/sub_pages/decoration_manager/new_renovation/new_renovation_finsih_submit_page.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_row_tile.dart'; +import 'package:aku_community_manager/ui/widgets/common/car_bottom_button.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:velocity_x/velocity_x.dart'; +import 'package:aku_community_manager/tools/extensions/list_extension_tool.dart'; + +class NewRenovationCard extends StatefulWidget { + final NewRenovationListModel model; + final VoidCallback callRefresh; + NewRenovationCard({ + Key key, + this.model, + this.callRefresh, + }) : super(key: key); + + @override + _NewRenovationCardState createState() => _NewRenovationCardState(); +} + +class _NewRenovationCardState extends State { + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: () { + Get.to(() => NewRenovationDetailPage( + model: widget.model, + )); + }, + child: Container( + width: double.infinity, + padding: EdgeInsets.all(24.w), + decoration: BoxDecoration( + color: Colors.white, borderRadius: BorderRadius.circular(8.w)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + widget.model.roomName, + style: TextStyle( + fontSize: 32.sp, + fontWeight: FontWeight.bold, + color: kTextPrimaryColor, + ), + ), + Spacer(), + widget.model.statusString.text + .size(30.sp) + .color(widget.model.statusColor) + .bold + .make(), + ], + ), + 16.w.heightBox, + AkuDivider.horizontal(), + 24.w.heightBox, + ...[ + AkuRowTile( + assetPath: R.ASSETS_MANAGE_IC_RENWU_PNG, + title: '装修公司', + content: widget.model.constructionUnit.text + .size(24.sp) + .color(kTextSubColor) + .make(), + ), + AkuRowTile( + assetPath: R.ASSETS_MANAGE_IC_RENWU_PNG, + title: '负责人姓名', + content: widget.model.director.text + .size(24.sp) + .color(kTextSubColor) + .make(), + ), + AkuRowTile( + assetPath: R.ASSETS_MANAGE_IC_RENWU_PNG, + title: '负责人电话', + content: widget.model.directorTel.text + .size(24.sp) + .color(kTextSubColor) + .make(), + ), + AkuRowTile( + assetPath: R.ASSETS_MANAGE_IC_RENWU_PNG, + title: '预计装修时间', + content: widget.model.expectSlot.text + .size(24.sp) + .color(kTextSubColor) + .make(), + ), + ..._nullableRowTile( + widget.model.actualEnd.isEmptyOrNull, + R.ASSETS_MANAGE_IC_RENWU_PNG, + '实际装修时间', + widget.model.actualSlot.text + .size(24.sp) + .color(kTextSubColor) + .make()), + ..._nullableRowTile( + widget.model.isQualified == null, + R.ASSETS_MANAGE_IC_RENWU_PNG, + '检查情况', + widget.model.qualitfied.text + .size(24.sp) + .color(kTextSubColor) + .make()) + ].sepWidget(separate: 12.w.heightBox), + ..._bottomWidgets(), + ], + ), + ), + ); + } + + List _bottomWidgets() { + return (widget.model.status != 6) + ? [] + : [ + 40.w.heightBox, + Row( + children: [Spacer(), ..._getButtons()], + ), + ]; + } + + List _getButtons() { + List buttons = []; + switch (widget.model.status) { + case 6: + buttons = [ + CardBottomButton.yellow( + text: '提交报告', + onPressed: () async { + Get.to(() => NewRenovationFinishSubmitPage( + id: widget.model.id, + callRefresh: () { + widget.callRefresh(); + }, + )); + }) + ]; + break; + default: + buttons = []; + } + return buttons; + } + + _nullableRowTile( + bool isNull, String assetPath, String title, Widget content) { + return isNull + ? [] + : [ + AkuRowTile(assetPath: assetPath, title: title, content: content), + ]; + } +} diff --git a/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_detail_page.dart b/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_detail_page.dart new file mode 100644 index 0000000..c7fd342 --- /dev/null +++ b/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_detail_page.dart @@ -0,0 +1,211 @@ +import 'package:aku_community_manager/models/manager/new_renovation/new_renovation_list_model.dart'; +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/tools/aku_divider.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_row_tile.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; +import 'package:aku_community_manager/tools/extensions/list_extension_tool.dart'; + +class NewRenovationDetailPage extends StatefulWidget { + final NewRenovationListModel model; + NewRenovationDetailPage({Key key, this.model}) : super(key: key); + + @override + _NewRenovationDetailPageState createState() => + _NewRenovationDetailPageState(); +} + +class _NewRenovationDetailPageState extends State { + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '装修详情', + body: ListView( + padding: EdgeInsets.all(32.w), + children: [ + _renovationInfo(), + 40.w.heightBox, + _contentWidget(), + ..._checkWidge(), + ], + ), + ); + } + + Widget _contentWidget() { + return Container( + width: double.infinity, + decoration: BoxDecoration( + color: Colors.white, borderRadius: BorderRadius.circular(8.w)), + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + '装修反馈'.text.size(32.sp).color(kTextPrimaryColor).bold.make(), + Spacer(), + ], + ), + 16.w.heightBox, + AkuDivider.horizontal(), + 20.w.heightBox, + (widget.model.rejectReason ?? '') + .text + .size(28.sp) + .color(kTextPrimaryColor) + .make(), + ...widget.model.auditDate.isEmptyOrNull + ? [] + : [ + 40.w.heightBox, + Row( + children: [ + Spacer(), + widget.model.auditDate.text + .size(24.sp) + .color(kTextSubColor) + .make(), + ], + ), + ], + ...widget.model.checkVoList.isEmpty ? [] : [..._checkWidge()] + ], + ), + ); + } + + List _checkWidge() { + return widget.model.checkVoList + .map((e) => Container( + width: double.infinity, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w)), + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), + child: Column( + children: [ + 16.w.heightBox, + AkuDivider.horizontal(), + 20.w.heightBox, + Row( + children: [ + '完工检查${widget.model.checkVoList.indexOf(e)}' + .text + .size(32.sp) + .color(kTextPrimaryColor) + .bold + .make(), + Spacer(), + ], + ), + 12.w.heightBox, + e.qualitfied.text + .size(28.sp) + .color(e.isQualified == 1 ? Colors.green : Colors.red) + .make(), + 20.w.heightBox, + Row( + children: [ + Spacer(), + (e.createDate) + .text + .size(24.sp) + .color(kTextSubColor) + .make(), + ], + ), + ], + ), + )) + .toList(); + } + + Widget _renovationInfo() { + return Container( + width: double.infinity, + padding: EdgeInsets.all(24.w), + decoration: BoxDecoration( + color: Colors.white, borderRadius: BorderRadius.circular(8.w)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + widget.model.roomName, + style: TextStyle( + fontSize: 32.sp, + fontWeight: FontWeight.bold, + color: kTextPrimaryColor, + ), + ), + Spacer(), + widget.model.statusString.text + .size(30.sp) + .color(widget.model.statusColor) + .bold + .make(), + ], + ), + 16.w.heightBox, + AkuDivider.horizontal(), + 24.w.heightBox, + ...[ + AkuRowTile( + assetPath: R.ASSETS_MANAGE_IC_RENWU_PNG, + title: '装修公司', + content: widget.model.constructionUnit.text + .size(24.sp) + .color(kTextSubColor) + .make(), + ), + AkuRowTile( + assetPath: R.ASSETS_MANAGE_IC_RENWU_PNG, + title: '负责人姓名', + content: widget.model.director.text + .size(24.sp) + .color(kTextSubColor) + .make(), + ), + AkuRowTile( + assetPath: R.ASSETS_MANAGE_IC_RENWU_PNG, + title: '负责人电话', + content: widget.model.directorTel.text + .size(24.sp) + .color(kTextSubColor) + .make(), + ), + AkuRowTile( + assetPath: R.ASSETS_MANAGE_IC_RENWU_PNG, + title: '预计装修时间', + content: widget.model.expectSlot.text + .size(24.sp) + .color(kTextSubColor) + .make(), + ), + ..._nullableRowTile( + widget.model.actualEnd.isEmptyOrNull, + R.ASSETS_MANAGE_IC_RENWU_PNG, + '实际装修时间', + widget.model.actualSlot.text + .size(24.sp) + .color(kTextSubColor) + .make()) + ].sepWidget(separate: 12.w.heightBox), + ], + ), + ); + } + + _nullableRowTile( + bool isNull, String assetPath, String title, Widget content) { + return isNull + ? [] + : [ + AkuRowTile(assetPath: assetPath, title: title, content: content), + ]; + } +} diff --git a/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_finsih_submit_page.dart b/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_finsih_submit_page.dart new file mode 100644 index 0000000..6482a81 --- /dev/null +++ b/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_finsih_submit_page.dart @@ -0,0 +1,126 @@ +import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/ui/widgets/app_widgets/aku_single_check_button.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_community_manager/ui/widgets/common/bee_text_field.dart'; +import 'package:aku_community_manager/ui/widgets/inner/aku_bottom_button.dart'; +import 'package:aku_community_manager/utils/network/base_model.dart'; +import 'package:aku_community_manager/utils/network/net_util.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class NewRenovationFinishSubmitPage extends StatefulWidget { + final int id; + final VoidCallback callRefresh; + NewRenovationFinishSubmitPage({Key key, @required this.id, this.callRefresh}) : super(key: key); + + @override + _NewRenovationFinishSubmitPageState createState() => + _NewRenovationFinishSubmitPageState(); +} + +class _NewRenovationFinishSubmitPageState + extends State { + int _isQualified = 1; + TextEditingController _detailController; + @override + void initState() { + super.initState(); + _detailController = TextEditingController(); + } + + @override + void dispose() { + _detailController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '完工检查', + body: ListView( + padding: EdgeInsets.all(32.w), + children: [ + Container( + padding: EdgeInsets.all(24.w), + width: double.infinity, + decoration: BoxDecoration( + color: Colors.white, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _headWidget(), + 40.w.heightBox, + BeeTextField( + controller: _detailController, + hintText: '请输入具体检查情况', + onChange: () { + setState(() {}); + }, + ) + ], + ), + ), + ], + ), + bottom: AkuBottomButton( + title: '立即提交', + onTap: () async { + BaseModel baseModel = + await NetUtil().post(API.manage.submitRenovation, + params: { + "decorationNewId": widget.id, + "detail": _detailController.text, + "isQualified": _isQualified, + }, + showMessage: true); + if (baseModel.status ?? false) { + Get.back(); + } + }, + ), + ); + } + + Widget _headWidget() { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + '检查结果'.text.size(32.sp).bold.color(kTextPrimaryColor).make(), + Spacer(), + ], + ), + 20.w.heightBox, + Row( + children: [ + AkuSingleCheckButton( + text: '合格', + value: 1, + gropValue: _isQualified, + onPressed: () { + _isQualified = 1; + setState(() {}); + }, + ), + 40.w.widthBox, + AkuSingleCheckButton( + text: '不合格', + value: 2, + gropValue: _isQualified, + onPressed: () { + _isQualified = 2; + setState(() {}); + }, + ), + ], + ), + ], + ); + } +} diff --git a/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_page.dart b/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_page.dart new file mode 100644 index 0000000..3af8abb --- /dev/null +++ b/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_page.dart @@ -0,0 +1,40 @@ +import 'package:aku_community_manager/ui/sub_pages/decoration_manager/new_renovation/new_renovation_view.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:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class NewRenovationPage extends StatefulWidget { + NewRenovationPage({Key key}) : super(key: key); + + @override + _NewRenovationState createState() => _NewRenovationState(); +} + +class _NewRenovationState extends State + with TickerProviderStateMixin { + TabController _tabController; + List _tabs = ['检查中', '检查通过','检查不通过']; + @override + void initState() { + super.initState(); + _tabController = TabController(length: _tabs.length, vsync: this); + } + + @override + void dispose() { + _tabController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '装修管理', + appBarBottom: PreferredSize(preferredSize: Size.fromHeight(88.w),child: AkuTabBar(controller: _tabController, tabs: _tabs),), + body: TabBarView( + controller: _tabController, + children: List.generate(_tabs.length, (index) => NewRenovationView(index:index+6))), + ); + } +} diff --git a/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_view.dart b/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_view.dart new file mode 100644 index 0000000..68cd688 --- /dev/null +++ b/lib/ui/sub_pages/decoration_manager/new_renovation/new_renovation_view.dart @@ -0,0 +1,64 @@ +import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/models/manager/new_renovation/new_renovation_list_model.dart'; +import 'package:aku_community_manager/ui/sub_pages/decoration_manager/new_renovation/new_renovation_card.dart'; +import 'package:aku_community_manager/ui/widgets/common/bee_list_view.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class NewRenovationView extends StatefulWidget { + final int index; + NewRenovationView({Key key, this.index}) : super(key: key); + + @override + _NewRenovationState createState() => _NewRenovationState(); +} + +class _NewRenovationState extends State + with AutomaticKeepAliveClientMixin { + EasyRefreshController _refreshController; + @override + void initState() { + super.initState(); + _refreshController = EasyRefreshController(); + } + + @override + void dispose() { + _refreshController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return BeeListView( + path: API.manage.newRenovationList, + controller: _refreshController, + extraParams: {"userDecorationNewStatus": widget.index}, + convert: (models) { + return models.tableList + .map((e) => NewRenovationListModel.fromJson(e)) + .toList(); + }, + builder: (items) { + return ListView.separated( + padding: EdgeInsets.all(32.w), + itemBuilder: (context, index) { + return NewRenovationCard( + model: items[index], + callRefresh: () { + _refreshController.callRefresh(); + }, + ); + }, + separatorBuilder: (_, __) { + return 24.w.heightBox; + }, + itemCount: items.length); + }); + } + + @override + bool get wantKeepAlive => true; +} diff --git a/lib/ui/widgets/common/aku_input_row.dart b/lib/ui/widgets/common/aku_input_row.dart new file mode 100644 index 0000000..7c64b61 --- /dev/null +++ b/lib/ui/widgets/common/aku_input_row.dart @@ -0,0 +1,53 @@ +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; +class AkuInputRow extends StatefulWidget { + + final String title; + final List formatters; + final TextEditingController controller; + final String hintText; + AkuInputRow({Key key, this.title, this.formatters, this.controller, this.hintText}) : super(key: key); + + @override + _AkuInputRowState createState() => _AkuInputRowState(); +} + +class _AkuInputRowState extends State { + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + widget.title.text.size(28.sp).color(kTextPrimaryColor).make(), + 32.w.heightBox, + TextField( + inputFormatters: widget.formatters, + controller: widget.controller, + textAlign: TextAlign.start, + onChanged: (value) { + setState(() {}); + }, + decoration: InputDecoration( + hintText: widget.hintText ?? '', + isDense: true, + contentPadding: EdgeInsets.zero, + enabledBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Color(0xFFE8E8E8), width: 2.w), + ), + ), + style: TextStyle( + fontSize: 36.sp, + fontWeight: FontWeight.bold, + color: kTextPrimaryColor, + ), + ), + ], + ), + ); + } +} \ No newline at end of file diff --git a/lib/ui/widgets/common/aku_row_tile.dart b/lib/ui/widgets/common/aku_row_tile.dart new file mode 100644 index 0000000..af2791f --- /dev/null +++ b/lib/ui/widgets/common/aku_row_tile.dart @@ -0,0 +1,29 @@ +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class AkuRowTile extends StatelessWidget { + final String assetPath; + final String title; + final Widget content; + const AkuRowTile({Key key, this.assetPath, this.title, this.content}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return Row( + children: [ + Image.asset( + assetPath, + width: 40.w, + height: 40.w, + ), + 12.w.widthBox, + title.text.size(24.sp).color(kTextSubColor).make(), + Spacer(), + content, + ], + ); + } +} diff --git a/lib/ui/widgets/common/bee_text_field.dart b/lib/ui/widgets/common/bee_text_field.dart new file mode 100644 index 0000000..949aa78 --- /dev/null +++ b/lib/ui/widgets/common/bee_text_field.dart @@ -0,0 +1,60 @@ +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:flutter/material.dart'; + +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class BeeTextField extends StatefulWidget { + final TextEditingController controller; + final VoidCallback onChange; + final String hintText; + final int minLines; + final int maxLines; + BeeTextField( + {Key key, + @required this.controller, + this.onChange, + @required this.hintText, + this.minLines, + this.maxLines}) + : super(key: key); + + @override + _BeeTextFieldState createState() => _BeeTextFieldState(); +} + +class _BeeTextFieldState extends State { + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.w), + border: Border.all( + width: 2.w, + color: Color(0xFFE8E8E8), + ), + ), + child: TextField( + minLines: widget.minLines ?? 5, + maxLines: widget.maxLines ?? 10, + autofocus: false, + onChanged: (value) { + if (widget.onChange != null) { + widget.onChange(); + } + }, + decoration: InputDecoration( + hintText: widget.hintText, + hintStyle: TextStyle( + fontSize: 28.sp, + color: kTextSubColor, + ), + contentPadding: + EdgeInsets.symmetric(vertical: 16.w, horizontal: 24.w), + border: InputBorder.none, + isDense: true, + ), + ), + ); + } +} diff --git a/lib/ui/widgets/common/car_bottom_button.dart b/lib/ui/widgets/common/car_bottom_button.dart new file mode 100644 index 0000000..f772b55 --- /dev/null +++ b/lib/ui/widgets/common/car_bottom_button.dart @@ -0,0 +1,53 @@ +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:flutter/material.dart'; + +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class CardBottomButton extends StatelessWidget { + final String text; + final Color textColor; + final Color bgColor; + final bool hasBorder; + final VoidCallback onPressed; + const CardBottomButton( + {Key key, + this.text, + this.textColor, + this.bgColor, + this.hasBorder = false, + this.onPressed}) + : super(key: key); + CardBottomButton.white({ + Key key, + this.text, + this.onPressed, + }) : this.bgColor = Colors.white, + this.textColor = kTextPrimaryColor, + this.hasBorder = true, + super(key: key); + CardBottomButton.yellow({ + Key key, + this.text, + this.onPressed, + }) : this.bgColor = Color(0xFFFFC40C), + this.textColor = kTextPrimaryColor, + this.hasBorder = false, + super(key: key); + @override + Widget build(BuildContext context) { + return MaterialButton( + onPressed: this.onPressed, + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(74.w), + side: this.hasBorder + ? BorderSide(color: Color(0xFF999999), width: 2.w) + : BorderSide.none), + child: text.text.size(26.sp).color(this.textColor).bold.make(), + color: this.bgColor, + padding: EdgeInsets.symmetric(vertical: 8.w, horizontal: 24.w), + height: 52.w, + ); + } +}