diff --git a/lib/json_models/message/system_message_house_keeping_model.dart b/lib/json_models/message/system_message_house_keeping_model.dart new file mode 100644 index 0000000..08aa42d --- /dev/null +++ b/lib/json_models/message/system_message_house_keeping_model.dart @@ -0,0 +1,79 @@ +import 'package:equatable/equatable.dart'; +import 'package:json_annotation/json_annotation.dart'; + +import 'package:aku_community_manager/models/common/img_model.dart'; + +part 'system_message_house_keeping_model.g.dart'; + +@JsonSerializable() +class SystemMessageHouseKeepingModel extends Equatable { + final int id; + final String proposerName; + final String proposerTel; + final String roomName; + final int type; + final String content; + final int status; + final int? completion; + final String? handlerName; + final String? handlerTel; + final String? processDescription; + final String? handlingTime; + final List handlerImgList; + final num? payFee; + final int? evaluation; + final String? evaluationContent; + final String? evaluationTime; + final List evaluationImgList; + final String createDate; + final List submitImgList; + SystemMessageHouseKeepingModel({ + required this.id, + required this.proposerName, + required this.proposerTel, + required this.roomName, + required this.type, + required this.content, + required this.status, + this.completion, + this.handlerName, + this.handlerTel, + this.processDescription, + this.handlingTime, + required this.handlerImgList, + this.payFee, + this.evaluation, + this.evaluationContent, + this.evaluationTime, + required this.evaluationImgList, + required this.createDate, + required this.submitImgList, + }); + factory SystemMessageHouseKeepingModel.fromJson(Map json) => + _$SystemMessageHouseKeepingModelFromJson(json); + @override + List get props { + return [ + id, + proposerName, + proposerTel, + roomName, + type, + content, + status, + completion, + handlerName, + handlerTel, + processDescription, + handlingTime, + handlerImgList, + payFee, + evaluation, + evaluationContent, + evaluationTime, + evaluationImgList, + createDate, + submitImgList, + ]; + } +} diff --git a/lib/json_models/message/system_message_house_keeping_model.g.dart b/lib/json_models/message/system_message_house_keeping_model.g.dart new file mode 100644 index 0000000..261225b --- /dev/null +++ b/lib/json_models/message/system_message_house_keeping_model.g.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'system_message_house_keeping_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +SystemMessageHouseKeepingModel _$SystemMessageHouseKeepingModelFromJson( + Map json) { + return SystemMessageHouseKeepingModel( + id: json['id'] as int, + proposerName: json['proposerName'] as String, + proposerTel: json['proposerTel'] as String, + roomName: json['roomName'] as String, + type: json['type'] as int, + content: json['content'] as String, + status: json['status'] as int, + completion: json['completion'] as int?, + handlerName: json['handlerName'] as String?, + handlerTel: json['handlerTel'] as String?, + processDescription: json['processDescription'] as String?, + handlingTime: json['handlingTime'] as String?, + handlerImgList: (json['handlerImgList'] as List) + .map((e) => ImgModel.fromJson(e as Map)) + .toList(), + payFee: json['payFee'] as num?, + evaluation: json['evaluation'] as int?, + evaluationContent: json['evaluationContent'] as String?, + evaluationTime: json['evaluationTime'] as String?, + evaluationImgList: (json['evaluationImgList'] as List) + .map((e) => ImgModel.fromJson(e as Map)) + .toList(), + createDate: json['createDate'] as String, + submitImgList: (json['submitImgList'] as List) + .map((e) => ImgModel.fromJson(e as Map)) + .toList(), + ); +} diff --git a/lib/provider/message_provider.dart b/lib/provider/message_provider.dart index edafaea..bbfc530 100644 --- a/lib/provider/message_provider.dart +++ b/lib/provider/message_provider.dart @@ -28,6 +28,8 @@ class MessageProvider extends ChangeNotifier { return '绿化任务'; case 4: return '卫生任务'; + case 5: + return '家政服务'; default: return '未知'; } diff --git a/lib/ui/home/messages/message.dart b/lib/ui/home/messages/message.dart index 7042cab..0307cc2 100644 --- a/lib/ui/home/messages/message.dart +++ b/lib/ui/home/messages/message.dart @@ -18,7 +18,7 @@ import 'package:provider/provider.dart'; import 'package:aku_community_manager/const/resource.dart'; import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/ui/home/messages/comment_message.dart'; -import 'package:aku_community_manager/ui/home/messages/system_message.dart'; +import 'package:aku_community_manager/ui/home/messages/system/system_message.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; class Message extends StatefulWidget { diff --git a/lib/ui/home/messages/message_map.dart b/lib/ui/home/messages/message_map.dart index 8a22778..1d74b5e 100644 --- a/lib/ui/home/messages/message_map.dart +++ b/lib/ui/home/messages/message_map.dart @@ -1,5 +1,5 @@ class MessageMap { - static sysType(int type){ + static sysType(int type) { switch (type) { case 1: return '报事报修'; @@ -9,8 +9,10 @@ class MessageMap { return '绿化任务'; case 4: return '卫生任务'; + case 5: + return '家政服务'; default: return '未知'; } } -} \ No newline at end of file +} diff --git a/lib/ui/home/messages/system_message.dart b/lib/ui/home/messages/system/system_message.dart similarity index 86% rename from lib/ui/home/messages/system_message.dart rename to lib/ui/home/messages/system/system_message.dart index 9a32c43..0126e51 100644 --- a/lib/ui/home/messages/system_message.dart +++ b/lib/ui/home/messages/system/system_message.dart @@ -1,6 +1,6 @@ // Flutter imports: -import 'package:aku_community_manager/ui/home/messages/system_message_green_card.dart'; -import 'package:aku_community_manager/ui/home/messages/system_message_hygience_card.dart'; +import 'package:aku_community_manager/ui/home/messages/system/system_message_green_card.dart'; +import 'package:aku_community_manager/ui/home/messages/system/system_message_hygience_card.dart'; import 'package:common_utils/common_utils.dart'; import 'package:flutter/material.dart'; @@ -13,7 +13,7 @@ import 'package:velocity_x/velocity_x.dart'; import 'package:aku_community_manager/const/api.dart'; import 'package:aku_community_manager/models/message/system_message_item_model.dart'; import 'package:aku_community_manager/style/app_style.dart'; -import 'package:aku_community_manager/ui/home/messages/system_message_card.dart'; +import 'package:aku_community_manager/ui/home/messages/system/system_message_card.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_community_manager/ui/widgets/common/bee_list_view.dart'; @@ -76,6 +76,9 @@ class _SystemMessageState extends State { case 4: return SystemMessageHygienceCard( relationId: model.relationId!, date: _date, type: 4); + case 5: + return SystemMessageHygienceCard( + relationId: model.relationId!, date: _date, type: 5); default: return Container(); } diff --git a/lib/ui/home/messages/system_message_card.dart b/lib/ui/home/messages/system/system_message_card.dart similarity index 100% rename from lib/ui/home/messages/system_message_card.dart rename to lib/ui/home/messages/system/system_message_card.dart diff --git a/lib/ui/home/messages/system_message_green_card.dart b/lib/ui/home/messages/system/system_message_green_card.dart similarity index 100% rename from lib/ui/home/messages/system_message_green_card.dart rename to lib/ui/home/messages/system/system_message_green_card.dart diff --git a/lib/ui/home/messages/system/system_message_house_keeping_card.dart b/lib/ui/home/messages/system/system_message_house_keeping_card.dart new file mode 100644 index 0000000..aecf66a --- /dev/null +++ b/lib/ui/home/messages/system/system_message_house_keeping_card.dart @@ -0,0 +1,318 @@ +import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/json_models/message/system_message_house_keeping_model.dart'; +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/ui/home/messages/message_map.dart'; +import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_page.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_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:get/get.dart'; +import 'package:shimmer/shimmer.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class SystemMessageHouseKeepingCard extends StatefulWidget { + final int relationId; + final String? date; + final int type; + SystemMessageHouseKeepingCard( + {Key? key, required this.relationId, this.date, required this.type}) + : super(key: key); + + @override + _SystemMessageHouseKeepingCardState createState() => + _SystemMessageHouseKeepingCardState(); +} + +class _SystemMessageHouseKeepingCardState + extends State { + SystemMessageHouseKeepingModel? _systemModel; + bool _onLoad = true; + + @override + void initState() { + super.initState(); + Future.delayed(Duration(milliseconds: 300), () async { + _systemModel = await getSystemMessage(widget.relationId); + _onLoad = false; + setState(() {}); + }); + } + + @override + Widget build(BuildContext context) { + return (_systemModel == null || _onLoad) + ? _loadingWidget() + : _messageList(_systemModel!); + } + + Future getSystemMessage(int relationId) async { + BaseModel baseModel = + await NetUtil().get(API.message.getSysHygienceMessageById, params: { + "housekeepingServiceId": relationId, + }); + if (baseModel.status ?? false) { + return SystemMessageHouseKeepingModel.fromJson(baseModel.data); + } + } + + Widget _loadingWidget() { + return Column( + children: [ + Container( + margin: EdgeInsets.only(top: 24.w, bottom: 24.w), + alignment: Alignment.center, + width: double.infinity, + child: Shimmer.fromColors( + baseColor: kPrimaryColor.withOpacity(0.3), + highlightColor: kPrimaryColor.withOpacity(0.1), + child: Text( + '', + style: TextStyle(color: AppStyle.minorTextColor, fontSize: 24.sp), + ), + ), + ), + Container( + padding: EdgeInsets.only(top: 24.w, left: 24.w, right: 24.w), + color: Color(0xFFFFFFFF), + child: Shimmer.fromColors( + baseColor: kPrimaryColor.withOpacity(0.3), + highlightColor: kPrimaryColor.withOpacity(0.1), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row(children: [ + Container( + width: 16.w, + height: 16.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.w), + color: Color(0xFFFF4501)), + ), + SizedBox( + width: 16.w, + ), + Text( + '', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 32.sp, + fontWeight: FontWeight.w600), + ), + SizedBox(height: 8.w), + ]), + Text( + '', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold), + ), + SizedBox(height: 24.w), + Row( + children: [ + Image.asset( + R.ASSETS_MESSAGE_IC_PEOPLE_PNG, + width: 40.w, + height: 40.w, + ), + SizedBox( + width: 4.w, + ), + Text( + '', + style: TextStyle( + color: AppStyle.minorTextColor, fontSize: 28.sp), + ), + Spacer(), + Text( + '', + style: TextStyle( + color: AppStyle.primaryTextColor, fontSize: 28.sp), + ), + ], + ), + SizedBox(height: 16.w), + Row( + children: [ + Image.asset( + R.ASSETS_MESSAGE_IC_STAR_PNG, + width: 40.w, + height: 40.w, + ), + SizedBox( + width: 4.w, + ), + Text('', + style: TextStyle( + color: AppStyle.minorTextColor, fontSize: 28.sp)), + Spacer(), + Text('', + style: TextStyle( + color: AppStyle.primaryTextColor, fontSize: 28.sp)), + ], + ), + SizedBox(height: 16.w), + Divider(height: 1.w), + AkuButton( + onPressed: () {}, + child: Container( + height: 88.w, + alignment: Alignment.center, + padding: EdgeInsets.only(left: 24.w), + child: Row( + children: [ + Text( + '', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp), + ), + Spacer(), + Icon(Icons.arrow_forward_ios, size: 22.w), + ], + ), + ), + ), + ], + ), + ), + ), + ], + ); + } + + Widget _messageList(SystemMessageHouseKeepingModel model) { + return Column( + children: [ + widget.date == null ? 16.w.heightBox : SizedBox(), + widget.date == null + ? SizedBox() + : Container( + margin: EdgeInsets.only(top: 24.w, bottom: 24.w), + alignment: Alignment.center, + width: double.infinity, + child: Text( + widget.date!, + style: TextStyle( + color: AppStyle.minorTextColor, fontSize: 24.sp), + ), + ), + Container( + padding: EdgeInsets.only(top: 24.w, left: 24.w, right: 24.w), + color: Color(0xFFFFFFFF), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row(children: [ + Text( + '系统通知', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 32.sp, + fontWeight: FontWeight.w600), + ), + SizedBox(height: 8.w), + ]), + Text( + '你有一条新的${MessageMap.sysType(widget.type)},请立即处理', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold), + ), + SizedBox(height: 24.w), + Row( + children: [ + Image.asset( + R.ASSETS_MESSAGE_IC_PEOPLE_PNG, + width: 40.w, + height: 40.w, + ), + SizedBox( + width: 4.w, + ), + Text( + '服务人员', + style: TextStyle( + color: AppStyle.minorTextColor, fontSize: 28.sp), + ), + Spacer(), + Text( + model.handlerName ?? '', + style: TextStyle( + color: AppStyle.primaryTextColor, fontSize: 28.sp), + ), + ], + ), + SizedBox(height: 16.w), + Row( + children: [ + Image.asset( + R.ASSETS_MESSAGE_IC_PHONE_PNG, + width: 40.w, + height: 40.w, + ), + SizedBox( + width: 4.w, + ), + Text('联系电话', + style: TextStyle( + color: AppStyle.minorTextColor, fontSize: 28.sp)), + Spacer(), + Text(model.handlerTel ?? '', + style: TextStyle( + color: AppStyle.primaryTextColor, fontSize: 28.sp)), + ], + ), + SizedBox(height: 16.w), + // Row( + // children: [ + // Image.asset( + // R.ASSETS_MESSAGE_IC_AREA_PNG, + // width: 40.w, + // height: 40.w, + // ), + // SizedBox( + // width: 4.w, + // ), + // Text('报修区域', + // style: TextStyle( + // color: AppStyle.minorTextColor, fontSize: 28.sp)), + // Spacer(), + // Text('area', + // style: TextStyle( + // color: AppStyle.primaryTextColor, fontSize: 28.sp)), + // ], + // ), + // SizedBox(height: 16.w), + Divider( + height: 1.w, + ), + AkuButton( + onPressed: () { + Get.to(() => HouseKeepingPage()); + }, + child: Container( + height: 88.w, + alignment: Alignment.center, + child: Row( + children: [ + Text( + '查看详情', + style: TextStyle( + color: AppStyle.primaryTextColor, fontSize: 28.sp), + ), + Spacer(), + Icon(Icons.arrow_forward_ios, size: 22.w), + ], + ), + ), + ), + ], + ), + ), + ], + ); + } +} diff --git a/lib/ui/home/messages/system_message_hygience_card.dart b/lib/ui/home/messages/system/system_message_hygience_card.dart similarity index 96% rename from lib/ui/home/messages/system_message_hygience_card.dart rename to lib/ui/home/messages/system/system_message_hygience_card.dart index 2455b50..d0c31e6 100644 --- a/lib/ui/home/messages/system_message_hygience_card.dart +++ b/lib/ui/home/messages/system/system_message_hygience_card.dart @@ -214,16 +214,6 @@ class _SystemMessageHygienceCardState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Row(children: [ - // Container( - // width: 16.w, - // height: 16.w, - // decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(8.w), - // color: Color(0xFFFF4501)), - // ), - // SizedBox( - // width: 16.w, - // ), Text( '系统通知', style: TextStyle(