diff --git a/lib/const/api.dart b/lib/const/api.dart index 49e48c4..eb0783a 100644 --- a/lib/const/api.dart +++ b/lib/const/api.dart @@ -280,6 +280,13 @@ class _Manage { ///管家app 新版装修:提交检查报告 String get submitRenovation => '/user/userDecorationNew/submitReport'; + + ///管家app 新版家政服务:查询所有的家政服务信息(包含搜索条件) + String get newHouseKeepingList => '/user/housekeepingService/list'; + + ///管家app新版家政服务:根据家政服务主键id查询家政服务服务进程 + String get newHouseKeepingProcess => + '/user/housekeepingService/findHousekeepingProcessRecord'; } class _Upload { diff --git a/lib/json_models/manager/house_keeping/house_keeping_list_model.dart b/lib/json_models/manager/house_keeping/house_keeping_list_model.dart index fcf75f7..b2f342c 100644 --- a/lib/json_models/manager/house_keeping/house_keeping_list_model.dart +++ b/lib/json_models/manager/house_keeping/house_keeping_list_model.dart @@ -92,6 +92,17 @@ class HouseKeepingListModel extends Equatable { } } + String get completionString { + switch (this.completion) { + case 1: + return '未完成'; + case 2: + return '已完成'; + default: + return '未知'; + } + } + @override List get props { return [ diff --git a/lib/json_models/manager/house_keeping/house_keeping_process_model.dart b/lib/json_models/manager/house_keeping/house_keeping_process_model.dart new file mode 100644 index 0000000..bb8eaff --- /dev/null +++ b/lib/json_models/manager/house_keeping/house_keeping_process_model.dart @@ -0,0 +1,46 @@ +import 'package:equatable/equatable.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'house_keeping_process_model.g.dart'; + +@JsonSerializable() +class HouseKeepingProcessModel extends Equatable { + final int id; + final int housekeepingServiceId; + final String operationDate; + final int operationType; + @JsonKey(name: 'operator') + final int opName; + final int operatorType; + final String operatorContent; + HouseKeepingProcessModel({ + required this.id, + required this.housekeepingServiceId, + required this.operationDate, + required this.operationType, + required this.opName, + required this.operatorType, + required this.operatorContent, + }); + factory HouseKeepingProcessModel.fromJson(Map json) => + _$HouseKeepingProcessModelFromJson(json); + factory HouseKeepingProcessModel.fail() => HouseKeepingProcessModel( + id: -1, + housekeepingServiceId: -1, + operationDate: '', + opName: 0, + operationType: 0, + operatorContent: '', + operatorType: 1); + @override + List get props { + return [ + id, + housekeepingServiceId, + operationDate, + operationType, + operatorType, + operatorContent, + ]; + } +} diff --git a/lib/json_models/manager/house_keeping/house_keeping_process_model.g.dart b/lib/json_models/manager/house_keeping/house_keeping_process_model.g.dart new file mode 100644 index 0000000..f746283 --- /dev/null +++ b/lib/json_models/manager/house_keeping/house_keeping_process_model.g.dart @@ -0,0 +1,20 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'house_keeping_process_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +HouseKeepingProcessModel _$HouseKeepingProcessModelFromJson( + Map json) { + return HouseKeepingProcessModel( + id: json['id'] as int, + housekeepingServiceId: json['housekeepingServiceId'] as int, + operationDate: json['operationDate'] as String, + operationType: json['operationType'] as int, + opName: json['operator'] as int, + operatorType: json['operatorType'] as int, + operatorContent: json['operatorContent'] as String, + ); +} 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 a0dbab6..c12abc2 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_card.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_card.dart @@ -1,9 +1,11 @@ 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/json_models/manager/house_keeping/house_keeping_process_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'; +import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_func.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_material_button.dart'; import 'package:aku_community_manager/ui/widgets/inner/aku_chip_box.dart'; import 'package:flutter/material.dart'; @@ -22,7 +24,14 @@ class HouseKeepingCard extends StatelessWidget { Widget build(BuildContext context) { return GestureDetector( onTap: () async { - await Get.to(() => HouseKeepingDetailPage(model: model)); + List processModels = + await HouseKeepingFunc.getHouseKeepingProcess( + model.id, + ); + await Get.to(() => HouseKeepingDetailPage( + model: model, + processModels: processModels, + )); callRefresh(); }, child: Container( 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 e9f695d..4eb0a01 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,5 +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/json_models/manager/house_keeping/house_keeping_process_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'; @@ -15,9 +16,14 @@ 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'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; + class HouseKeepingDetailPage extends StatefulWidget { final HouseKeepingListModel model; - HouseKeepingDetailPage({Key? key, required this.model}) : super(key: key); + final List processModels; + HouseKeepingDetailPage( + {Key? key, required this.model, required this.processModels}) + : super(key: key); @override _HouseKeepingDetailPageState createState() => _HouseKeepingDetailPageState(); @@ -85,7 +91,7 @@ class _HouseKeepingDetailPageState extends State { children: [ '完成情况'.text.size(28.sp).color(kTextSubColor).make(), Spacer(), - 'widget.model.completionString'.text.size(32.sp).black.make() + widget.model.completionString.text.size(32.sp).black.make() ], ), 40.w.heightBox, @@ -99,7 +105,7 @@ class _HouseKeepingDetailPageState extends State { 8.w.widthBox, '维修人'.text.size(28.sp).color(kTextSubColor).make(), Spacer(), - 'widget.model.proposerName'.text.size(28.sp).black.make(), + widget.model.handlerName!.text.size(28.sp).black.make(), ], ), 16.w.heightBox, @@ -113,20 +119,21 @@ class _HouseKeepingDetailPageState extends State { 8.w.widthBox, '联系电话'.text.size(28.sp).color(kTextSubColor).make(), Spacer(), - 'widget.model.proposerTel'.text.size(28.sp).black.make(), + widget.model.handlerTel!.text.size(28.sp).black.make(), ], ), 16.w.heightBox, 40.w.heightBox, '处理描述'.text.size(28.sp).color(kTextSubColor).make(), 24.w.heightBox, - ('widget.model.processDescription') - .text + widget.model.processDescription!.text .size(2) .black .softWrap(true) .make(), - BeeGridImageView(urls: []) + BeeGridImageView( + urls: + widget.model.handlerImgList.map((e) => e.url ?? '').toList()) ], ), ); @@ -152,7 +159,7 @@ class _HouseKeepingDetailPageState extends State { allowHalfRating: true, itemPadding: EdgeInsets.symmetric(horizontal: 15.w), itemSize: 32.w, - initialRating: (0).toDouble(), + initialRating: (widget.model.evaluation!).toDouble(), ratingWidget: RatingWidget( empty: Icon( CupertinoIcons.star, @@ -171,8 +178,15 @@ class _HouseKeepingDetailPageState extends State { 40.w.heightBox, AkuDivider.horizontal(), 40.w.heightBox, - ('').text.size(28.sp).black.softWrap(true).make(), - BeeGridImageView(urls: []) + widget.model.evaluationContent!.text + .size(28.sp) + .black + .softWrap(true) + .make(), + BeeGridImageView( + urls: widget.model.evaluationImgList + .map((e) => e.url ?? '') + .toList()) ], ), ); @@ -181,15 +195,21 @@ class _HouseKeepingDetailPageState extends State { _buildInfo() { return AkuTitleBox( title: '服务信息', - suffix: widget.model.statusString.text.size(28.sp).color(Color(0xFFFF4501)).make(), + suffix: widget.model.statusString.text + .size(28.sp) + .color(Color(0xFFFF4501)) + .make(), children: [ 16.w.heightBox, - _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}'), + _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, '地址', + '${S.of(context)!.tempPlotName}·${widget.model.roomName}'), 8.w.heightBox, Text( - '', + widget.model.content, style: TextStyle( color: AppStyle.primaryTextColor, fontWeight: FontWeight.bold, @@ -203,11 +223,12 @@ class _HouseKeepingDetailPageState extends State { crossAxisSpacing: 16.w, mainAxisSpacing: 16.w, ), - children: [].map((e) { + children: widget.model.submitImgList.map((e) { return ClipRRect( borderRadius: BorderRadius.circular(4.w), child: FadeInImage.assetNetwork( - placeholder: R.ASSETS_PLACEHOLDER_WEBP, image: API.image('')), + placeholder: R.ASSETS_PLACEHOLDER_WEBP, + image: API.image(e.url ?? '')), ); }).toList(), shrinkWrap: true, @@ -248,11 +269,11 @@ class _HouseKeepingDetailPageState extends State { _buildProcess() { return AkuTitleBox( - title: '报修进程', - children: [].map((e) { + title: '服务进程', + children: widget.processModels.map((e) { return _buildProcessTile( - '', - DateUtil.formatDateStr(e.operationDate!, + e.operatorContent, + DateUtil.formatDateStr(e.operationDate, format: 'yyyy-MM-dd HH:mm:ss'), ); }).toList(), diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_func.dart b/lib/ui/manage_pages/house_keeping/house_keeping_func.dart new file mode 100644 index 0000000..85e3a1f --- /dev/null +++ b/lib/ui/manage_pages/house_keeping/house_keeping_func.dart @@ -0,0 +1,19 @@ +import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/json_models/manager/house_keeping/house_keeping_process_model.dart'; +import 'package:aku_community_manager/utils/network/base_model.dart'; +import 'package:aku_community_manager/utils/network/net_util.dart'; + +class HouseKeepingFunc { + ///获取家政服务进程 + static Future getHouseKeepingProcess(int id) async { + BaseModel baseModel = await NetUtil().get(API.manage.newHouseKeepingProcess, + params: {"housekeepingServiceId": id}); + if (baseModel.status ?? false) { + return (baseModel.data as List) + .map((e) => HouseKeepingProcessModel.fromJson(e)) + .toList(); + } else { + return []; + } + } +} \ No newline at end of file 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 486ab7d..48a64f6 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_view.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_view.dart @@ -33,8 +33,10 @@ class _HouseKeepingViewState extends State { @override Widget build(BuildContext context) { return BeeListView( - path: API.manage.houseKeepingList, - // extraParams: {"status": widget.index == 0 ? null : widget.index}, + path: API.manage.newHouseKeepingList, + extraParams: { + "housekeepingServiceStatus": widget.index == 0 ? null : widget.index + }, controller: _refreshController, convert: (models) { return models.tableList!