diff --git a/lib/ui/home/application/applications_page.dart b/lib/ui/home/application/applications_page.dart index a0fa928..fb7f282 100644 --- a/lib/ui/home/application/applications_page.dart +++ b/lib/ui/home/application/applications_page.dart @@ -1,4 +1,5 @@ // Flutter imports: +import 'package:aku_community_manager/models/user/user_info_model.dart'; import 'package:aku_community_manager/tools/user_tool.dart'; import 'package:aku_community_manager/ui/manage_pages/clock_in_out/clock_in_out_page.dart'; import 'package:aku_community_manager/ui/manage_pages/facilities/facilities_select_page.dart'; @@ -96,8 +97,9 @@ class _ApplicationPageState extends State AppApplication( '考勤管理', R.ASSETS_HOME_CLOCK_IN_OUT_PNG, () => ClockInOutPage()), AppApplication('访谈管理', R.ASSETS_HOME_INTERVIEW_PNG, () => InterviewPage()), - AppApplication( - '家政服务', R.ASSETS_HOME_HOUSE_KEEPING_PNG, () => HouseKeepingPage()), + if (UserTool.userProvider.infoModel!.houseKeepingAuthority == HKAUTH.HIDE) + AppApplication( + '家政服务', R.ASSETS_HOME_HOUSE_KEEPING_PNG, () => HouseKeepingPage()), ]; @override diff --git a/lib/ui/home/messages/system_message_green_card.dart b/lib/ui/home/messages/system_message_green_card.dart index ed77ea5..9c20e0c 100644 --- a/lib/ui/home/messages/system_message_green_card.dart +++ b/lib/ui/home/messages/system_message_green_card.dart @@ -1,7 +1,7 @@ // Flutter imports: import 'dart:async'; -import 'package:aku_community_manager/json_models/system_message_green_model.dart'; +import 'package:aku_community_manager/json_models/message/system_message_green_model.dart'; import 'package:aku_community_manager/ui/home/messages/message_map.dart'; import 'package:aku_community_manager/ui/manage_pages/green_manage/green_manage_page.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_button.dart'; diff --git a/lib/ui/home/messages/system_message_hygience_card.dart b/lib/ui/home/messages/system_message_hygience_card.dart index 9fc3464..2455b50 100644 --- a/lib/ui/home/messages/system_message_hygience_card.dart +++ b/lib/ui/home/messages/system_message_hygience_card.dart @@ -1,7 +1,7 @@ // Flutter imports: import 'dart:async'; -import 'package:aku_community_manager/json_models/system_message_hygience_model.dart'; +import 'package:aku_community_manager/json_models/message/system_message_hygience_model.dart'; import 'package:aku_community_manager/ui/home/messages/message_map.dart'; import 'package:aku_community_manager/ui/manage_pages/hygience_manage/hygience_manage_page.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_button.dart'; diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_card.dart b/lib/ui/manage_pages/house_keeping/house_keeping_card.dart index 73540b6..a0dbab6 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_card.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_card.dart @@ -1,4 +1,6 @@ import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/json_models/manager/house_keeping/house_keeping_list_model.dart'; +import 'package:aku_community_manager/models/user/user_info_model.dart'; import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/tools/user_tool.dart'; import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_detail_page.dart'; @@ -9,101 +11,18 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:velocity_x/velocity_x.dart'; -// class HouseKeepingCard extends StatefulWidget { -// final HouseKeepingListModel model; -// HouseKeepingCard({Key? key, required this.model}) : super(key: key); - -// @override -// _HouseKeepingCardState createState() => _HouseKeepingCardState(); -// } - -// class _HouseKeepingCardState extends State { -// @override -// Widget build(BuildContext context) { -// return MaterialButton( -// minWidth: double.infinity, -// color: Colors.white, -// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.w)), -// elevation: 0, -// padding: EdgeInsets.all(24.w), -// onPressed: () { -// Get.to(() => HouseKeepingDetailPage(model:widget.model)); -// }, -// child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// Row( -// children: [ -// '家政服务'.text.size(32.sp).color(kTextPrimaryColor).bold.make(), -// Spacer(), -// ], -// ), -// 16.w.heightBox, -// AkuDivider.horizontal(), -// 24.w.heightBox, -// ...[ -// _rowTile( -// R.ASSETS_MANAGE_IC_RENWU_PNG, -// '房产名称', -// widget.model.roomName!.text -// .size(24.sp) -// .color(kTextSubColor) -// .make()), -// _rowTile( -// R.ASSETS_MANAGE_IC_RENWU_PNG, -// '人数', -// widget.model.num -// .toString() -// .text -// .size(24.sp) -// .color(kTextSubColor) -// .make()), -// _rowTile( -// R.ASSETS_MANAGE_IC_RENWU_PNG, -// '负责人姓名', -// widget.model.leaderName!.text -// .size(24.sp) -// .color(kTextSubColor) -// .make()), -// _rowTile( -// R.ASSETS_MESSAGE_IC_PHONE_PNG, -// '负责人手机', -// widget.model.leaderTel!.text -// .size(24.sp) -// .color(kTextSubColor) -// .make()), -// ].sepWidget(separate: 12.w.heightBox), -// ], -// ), -// ); -// } - -// Widget _rowTile(String iconPath, String title, Widget content) { -// return Row( -// children: [ -// SizedBox( -// width: 40.w, -// height: 40.w, -// child: Image.asset(iconPath), -// ), -// 12.w.widthBox, -// title.text.size(24.sp).color(kTextSubColor).make(), -// Spacer(), -// content, -// ], -// ); -// } -// } class HouseKeepingCard extends StatelessWidget { final VoidCallback callRefresh; - const HouseKeepingCard({Key? key, required this.callRefresh}) + final HouseKeepingListModel model; + const HouseKeepingCard( + {Key? key, required this.callRefresh, required this.model}) : super(key: key); @override Widget build(BuildContext context) { return GestureDetector( onTap: () async { - await Get.to(() => HouseKeepingDetailPage()); + await Get.to(() => HouseKeepingDetailPage(model: model)); callRefresh(); }, child: Container( @@ -118,7 +37,7 @@ class HouseKeepingCard extends StatelessWidget { 16.w.widthBox, Expanded( child: Text( - 'dateStart', + model.createDate, style: TextStyle( color: AppStyle.minorTextColor, fontSize: 22.sp, @@ -126,32 +45,14 @@ class HouseKeepingCard extends StatelessWidget { ), ), Text( - // widget.hasFinished - // ? '已处理' - // : AkuMap.fixStatus(userInfoModel!.canSendTicket, - - // userInfoModel!.canPickUpTicket, widget.model.status!), - '', - style: - // widget.hasFinished - true - ? TextStyle(color: AppStyle.minorTextColor) - : TextStyle( - // color: widget.model.status! < 4 - // ? Color(0XFFFF4501) - // : AppStyle.minorTextColor, - ), + model.statusString, + style: TextStyle(color: Color(0xFFFF4501)), ), ], ), 24.w.heightBox, Text( - // widget.model.reportDetail! - '', - // maxLines: widget.homeDisplay ? 1 : null, - // overflow: !widget.homeDisplay - // ? TextOverflow.visible - // : TextOverflow.ellipsis, + model.content, style: TextStyle( color: AppStyle.primaryTextColor, fontSize: 28.sp, @@ -180,8 +81,7 @@ class HouseKeepingCard extends StatelessWidget { child: ListView.builder( scrollDirection: Axis.horizontal, itemBuilder: (context, index) { - // var imgObj = widget.model.imgUrls![index].url; - var imgObj = ''; + var imgObj = model.submitImgList[index].url; return Container( margin: EdgeInsets.symmetric(horizontal: 8.w), height: 168.w, @@ -191,11 +91,11 @@ class HouseKeepingCard extends StatelessWidget { ), clipBehavior: Clip.antiAlias, child: FadeInImage.assetNetwork( - placeholder: R.ASSETS_PLACEHOLDER_WEBP, image: API.image('')), + placeholder: R.ASSETS_PLACEHOLDER_WEBP, + image: API.image(imgObj!)), ); }, - // itemCount: widget.model.imgUrls!.length, - itemCount: 1, + itemCount: model.submitImgList.length, ), ); } @@ -214,22 +114,18 @@ class HouseKeepingCard extends StatelessWidget { } _getButtons() { - switch (1) { + switch (model.status) { case 1: return [ AkuMaterialButton( height: 64.w, - onPressed: () async { - // Get.to(() => BusinessAndFixDetailPage(model: widget.model)); - // if (widget.callRefresh != null) { - // widget.callRefresh!(); - // } - }, + onPressed: () async {}, radius: 4, color: AppStyle.primaryColor, padding: EdgeInsets.symmetric(horizontal: 24.w), child: Text( - (UserTool.userProvider.infoModel!.canSendTicket + (UserTool.userProvider.infoModel!.houseKeepingAuthority == + HKAUTH.SEND ? '立即派单' : '查看详情'), style: TextStyle( @@ -255,11 +151,10 @@ class HouseKeepingCard extends StatelessWidget { color: AppStyle.primaryColor, padding: EdgeInsets.symmetric(horizontal: 24.w), child: Text( - (UserTool.userProvider.infoModel!.canSendTicket - ? '改派' - : UserTool.userProvider.infoModel!.canPickUpTicket - ? '立即接单' - : '查看详情'), + (UserTool.userProvider.infoModel!.houseKeepingAuthority == + HKAUTH.PICK + ? '立即接单' + : '催单'), style: TextStyle( color: AppStyle.primaryTextColor, fontWeight: FontWeight.bold, @@ -274,18 +169,12 @@ class HouseKeepingCard extends StatelessWidget { UserTool.userProvider.infoModel!.canPickUpTicket ? AkuMaterialButton( height: 64.w, - onPressed: () async { - // Get.to(() => Get.to(() => - // FixMoreTimePage(dispatchId: widget.model.dispatchId!))); - // if (widget.callRefresh != null) { - // widget.callRefresh!(); - // } - }, + onPressed: () async {}, radius: 4, color: AppStyle.primaryColor, padding: EdgeInsets.symmetric(horizontal: 24.w), child: Text( - ('申请延时'), + ('查看详情'), style: TextStyle( color: AppStyle.primaryTextColor, fontWeight: FontWeight.bold, @@ -297,19 +186,12 @@ class HouseKeepingCard extends StatelessWidget { : SizedBox(), AkuMaterialButton( height: 64.w, - onPressed: () async { - // Get.to(() => BusinessAndFixDetailPage(model: widget.model)); - // if (widget.callRefresh != null) { - // widget.callRefresh!(); - // } - }, + onPressed: () async {}, radius: 4, color: AppStyle.primaryColor, padding: EdgeInsets.symmetric(horizontal: 24.w), child: Text( - (UserTool.userProvider.infoModel!.canPickUpTicket - ? '处理完成' - : '查看详情'), + ('联系住户'), style: TextStyle( color: AppStyle.primaryTextColor, fontWeight: FontWeight.bold, @@ -323,12 +205,83 @@ class HouseKeepingCard extends StatelessWidget { return [ AkuMaterialButton( height: 64.w, - onPressed: () async { - // Get.to(() => BusinessAndFixDetailPage(model: widget.model)); - // if (widget.callRefresh != null) { - // widget.callRefresh!(); - // } - }, + onPressed: () async {}, + radius: 4, + color: AppStyle.primaryColor, + padding: EdgeInsets.symmetric(horizontal: 24.w), + child: Text( + ('查看详情'), + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 28.sp, + height: 40 / 28, + ), + ), + ), + ]; + case 5: + return [ + AkuMaterialButton( + height: 64.w, + onPressed: () async {}, + radius: 4, + color: AppStyle.primaryColor, + padding: EdgeInsets.symmetric(horizontal: 24.w), + child: Text( + ('查看详情'), + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 28.sp, + height: 40 / 28, + ), + ), + ), + ]; + case 6: + return [ + AkuMaterialButton( + height: 64.w, + onPressed: () async {}, + radius: 4, + color: AppStyle.primaryColor, + padding: EdgeInsets.symmetric(horizontal: 24.w), + child: Text( + ('查看详情'), + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 28.sp, + height: 40 / 28, + ), + ), + ), + ]; + case 9: + return [ + AkuMaterialButton( + height: 64.w, + onPressed: () async {}, + radius: 4, + color: AppStyle.primaryColor, + padding: EdgeInsets.symmetric(horizontal: 24.w), + child: Text( + ('查看详情'), + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 28.sp, + height: 40 / 28, + ), + ), + ), + ]; + case 10: + return [ + AkuMaterialButton( + height: 64.w, + onPressed: () async {}, radius: 4, color: AppStyle.primaryColor, padding: EdgeInsets.symmetric(horizontal: 24.w), diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_detail_page.dart b/lib/ui/manage_pages/house_keeping/house_keeping_detail_page.dart index 8d1014a..e9f695d 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_detail_page.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_detail_page.dart @@ -1,4 +1,5 @@ import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/json_models/manager/house_keeping/house_keeping_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/manage_pages/house_keeping/house_keeping_feed_back_page.dart'; @@ -14,138 +15,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:velocity_x/velocity_x.dart'; import 'package:aku_community_manager/utils/extension/list_extension.dart'; -// class HouseKeepingDetailPage extends StatefulWidget { -// final HouseKeepingListModel model; -// HouseKeepingDetailPage({Key? key, required this.model}) : super(key: key); - -// @override -// _HouseKeepingDetailPageState createState() => _HouseKeepingDetailPageState(); -// } - -// class _HouseKeepingDetailPageState extends State { -// @override -// Widget build(BuildContext context) { -// return AkuScaffold( -// title: '服务详情', -// body: ListView( -// padding: EdgeInsets.all(32.w), -// children: [ -// _interviewInfo(), -// 20.w.heightBox, -// _contentWidget(), -// ], -// ), -// ); -// } - -// Widget _interviewInfo() { -// return Container( -// width: double.infinity, -// decoration: BoxDecoration( -// color: Colors.white, borderRadius: BorderRadius.circular(8.w)), -// padding: EdgeInsets.all(24.w), -// child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// Row( -// children: [ -// '家政服务'.text.size(32.sp).color(kTextPrimaryColor).bold.make(), -// Spacer(), -// ], -// ), -// 16.w.heightBox, -// AkuDivider.horizontal(), -// 24.w.heightBox, -// ...[ -// _rowTile( -// R.ASSETS_MANAGE_IC_RENWU_PNG, -// '房产名称', -// widget.model.roomName!.text -// .size(24.sp) -// .color(kTextSubColor) -// .make()), -// _rowTile( -// R.ASSETS_MANAGE_IC_RENWU_PNG, -// '人数', -// widget.model.num -// .toString() -// .text -// .size(24.sp) -// .color(kTextSubColor) -// .make()), -// _rowTile( -// R.ASSETS_MANAGE_IC_RENWU_PNG, -// '负责人姓名', -// widget.model.leaderName!.text -// .size(24.sp) -// .color(kTextSubColor) -// .make()), -// _rowTile( -// R.ASSETS_MESSAGE_IC_PHONE_PNG, -// '负责人手机', -// widget.model.leaderTel!.text -// .size(24.sp) -// .color(kTextSubColor) -// .make()), -// ].sepWidget(separate: 12.w.heightBox), -// // _getBottomButtons(widget.model.status), -// ], -// ), -// ); -// } - -// 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.content!.text.size(28.sp).color(kTextPrimaryColor).make(), -// 40.w.heightBox, -// Row( -// children: [ -// Spacer(), -// widget.model.createDate!.text -// .size(24.sp) -// .color(kTextSubColor) -// .make(), -// ], -// ), -// ], -// ), -// ); -// } - -// Widget _rowTile(String iconPath, String title, Widget content) { -// return Row( -// children: [ -// SizedBox( -// width: 40.w, -// height: 40.w, -// child: Image.asset(iconPath), -// ), -// 12.w.widthBox, -// title.text.size(24.sp).color(kTextSubColor).make(), -// Spacer(), -// content, -// ], -// ); -// } -// } class HouseKeepingDetailPage extends StatefulWidget { - HouseKeepingDetailPage({Key? key}) : super(key: key); + final HouseKeepingListModel model; + HouseKeepingDetailPage({Key? key, required this.model}) : super(key: key); @override _HouseKeepingDetailPageState createState() => _HouseKeepingDetailPageState(); @@ -161,7 +33,7 @@ class _HouseKeepingDetailPageState extends State { children: [ '服务费用'.text.size(28.sp).black.make(), Spacer(), - '¥ ${0}'.text.size(32.sp).color(Colors.red).make() + '¥ ${widget.model.payFee}'.text.size(32.sp).color(Colors.red).make() ], ), ); @@ -308,13 +180,13 @@ class _HouseKeepingDetailPageState extends State { _buildInfo() { return AkuTitleBox( - title: '报修信息', - suffix: ''.text.size(28.sp).black.make(), + title: '服务信息', + suffix: widget.model.statusString.text.size(28.sp).color(Color(0xFFFF4501)).make(), children: [ 16.w.heightBox, - _buildTile(R.ASSETS_MESSAGE_IC_PEOPLE_PNG, '报修人', ''), - _buildTile(R.ASSETS_MESSAGE_IC_PHONE_PNG, '联系电话', ''), - _buildTile(R.ASSETS_MESSAGE_IC_AREA_PNG, '报修区域', ''), + _buildTile(R.ASSETS_MESSAGE_IC_PEOPLE_PNG, '报修人', widget.model.proposerName), + _buildTile(R.ASSETS_MESSAGE_IC_PHONE_PNG, '联系电话', widget.model.proposerTel), + _buildTile(R.ASSETS_MESSAGE_IC_AREA_PNG, '报修区域', '${0}'), 8.w.heightBox, Text( '', diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_view.dart b/lib/ui/manage_pages/house_keeping/house_keeping_view.dart index 14fee53..486ab7d 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_view.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_view.dart @@ -1,5 +1,5 @@ import 'package:aku_community_manager/const/api.dart'; -import 'package:aku_community_manager/models/manager/house_keeping/house_keeping_list_model.dart'; +import 'package:aku_community_manager/json_models/manager/house_keeping/house_keeping_list_model.dart'; import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_card.dart'; import 'package:aku_community_manager/ui/widgets/common/bee_list_view.dart'; import 'package:flutter/material.dart'; @@ -46,6 +46,7 @@ class _HouseKeepingViewState extends State { padding: EdgeInsets.all(24.w), itemBuilder: (context, index) { return HouseKeepingCard( + model: items[index], callRefresh: () { _refreshController!.callRefresh(); }, diff --git a/tool/grind.dart b/tool/grind.dart index c576fdf..e193740 100644 --- a/tool/grind.dart +++ b/tool/grind.dart @@ -83,6 +83,12 @@ void gen() async { await Pub.run('build_runner', arguments: ['build']); } +@Task('生成model') +void genClean() async { + await Pub.runAsync('build_runner', + arguments: ['build', '--delete-conflicting-outputs']); +} + @Task() Future getVersion() async { String projectPath = Directory('.').absolute.path;