diff --git a/lib/main.dart b/lib/main.dart index 9f21035..05a59ec 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -23,6 +23,7 @@ import 'package:aku_community_manager/style/apptheme.dart'; import 'package:aku_community_manager/ui/splash/splash_page.dart'; import 'package:aku_community_manager/utils/dev_util.dart'; import 'package:aku_community_manager/utils/jpush_message_parse.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -98,6 +99,7 @@ class MyApp extends StatelessWidget { BotToastNavigatorObserver(), ], localizationsDelegates: [ + S.delegate, GlobalCupertinoLocalizations.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, diff --git a/lib/models/user/user_info_model.dart b/lib/models/user/user_info_model.dart index 3d7dbde..7e2403c 100644 --- a/lib/models/user/user_info_model.dart +++ b/lib/models/user/user_info_model.dart @@ -1,10 +1,13 @@ -enum HKAUTH { +enum HKAUTH { ///家政服务派单权限 - SEND, + SEND, + ///家政服务接单权限 - PICK, + PICK, + ///家政服务隐藏 - HIDE } + HIDE +} class UserInfoModel { int? id; @@ -33,6 +36,10 @@ class UserInfoModel { ///报事报修管家 bool get manager => canSendTicket && canPickUpTicket; + ///隐藏报事报修 + bool get hideFix => + (!jurisdiction!.contains(53)) && (!jurisdiction!.contains(52)); + HKAUTH get houseKeepingAuthority { if (jurisdiction!.contains(68)) { return HKAUTH.PICK; diff --git a/lib/ui/home/application/applications_page.dart b/lib/ui/home/application/applications_page.dart index fb7f282..3d443af 100644 --- a/lib/ui/home/application/applications_page.dart +++ b/lib/ui/home/application/applications_page.dart @@ -71,7 +71,7 @@ class _ApplicationPageState extends State AppApplication('一键报警', R.ASSETS_HOME_IC_POLICE_PNG, () => WarningPage()), AppApplication( '访客管理', R.ASSETS_HOME_IC_VISITORS_PNG, () => VisitorManagerPage()), - if (UserTool.userProvider.infoModel!.manager) + if (!UserTool.userProvider.infoModel!.hideFix) AppApplication( '报事报修', R.ASSETS_HOME_IC_SERVICE_PNG, () => BusinessAndFixPage()), AppApplication( @@ -97,7 +97,7 @@ class _ApplicationPageState extends State AppApplication( '考勤管理', R.ASSETS_HOME_CLOCK_IN_OUT_PNG, () => ClockInOutPage()), AppApplication('访谈管理', R.ASSETS_HOME_INTERVIEW_PNG, () => InterviewPage()), - if (UserTool.userProvider.infoModel!.houseKeepingAuthority == HKAUTH.HIDE) + if (UserTool.userProvider.infoModel!.houseKeepingAuthority != HKAUTH.HIDE) AppApplication( '家政服务', R.ASSETS_HOME_HOUSE_KEEPING_PNG, () => HouseKeepingPage()), ]; diff --git a/lib/ui/home/messages/comment_message_card.dart b/lib/ui/home/messages/comment_message_card.dart index 5796cc6..97423dd 100644 --- a/lib/ui/home/messages/comment_message_card.dart +++ b/lib/ui/home/messages/comment_message_card.dart @@ -295,6 +295,7 @@ class _CommentMessageCardState extends State { // color: AppStyle.primaryTextColor, // fontSize: 28.sp)), RatingBar.builder( + ignoreGestures: true, initialRating: model.level!.toDouble(), itemSize: 40.w, allowHalfRating: true, diff --git a/lib/ui/home/messages/message.dart b/lib/ui/home/messages/message.dart index 0307cc2..5fd3f0f 100644 --- a/lib/ui/home/messages/message.dart +++ b/lib/ui/home/messages/message.dart @@ -107,21 +107,23 @@ class _MessageState extends State { children: [ Text(text, style: AppStyle().minorStyle), Spacer(), - Container( - alignment: Alignment.center, - width: 32.w, - height: 32.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(16.w), - color: Color(0xFFFF4501)), - child: Text( - number.toString(), - style: TextStyle( - color: Color(0xFFFFFFFF), - fontSize: 20.sp, - ), - ), - ), + number == 0 + ? SizedBox() + : Container( + alignment: Alignment.center, + width: 32.w, + height: 32.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16.w), + color: Color(0xFFFF4501)), + child: Text( + number.toString(), + style: TextStyle( + color: Color(0xFFFFFFFF), + fontSize: 20.sp, + ), + ), + ), ], ), ], 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 398f1b2..3871e54 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_card.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_card.dart @@ -170,6 +170,7 @@ class HouseKeepingCard extends StatelessWidget { : await HouseKeepingFunc.newHouseKeepingOrderReceive( model.id); cancel(); + callRefresh(); }, radius: 4, color: AppStyle.primaryColor, @@ -190,7 +191,7 @@ class HouseKeepingCard extends StatelessWidget { ]; case 3: return [ - UserTool.userProvider.infoModel!.canPickUpTicket + UserTool.userProvider.infoModel!.houseKeepingAuthority == HKAUTH.PICK ? AkuMaterialButton( height: 64.w, onPressed: () async {}, @@ -207,25 +208,24 @@ class HouseKeepingCard extends StatelessWidget { ), ), ) - : SizedBox(), - AkuMaterialButton( - height: 64.w, - onPressed: () async { - await launch(model.proposerTel); - }, - 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, - ), - ), - ), + : AkuMaterialButton( + height: 64.w, + onPressed: () async { + await launch('tel:${model.proposerTel}'); + }, + 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 4: return [ diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_department_page.dart b/lib/ui/manage_pages/house_keeping/house_keeping_department_page.dart index e6fdbc3..cd52b9d 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_department_page.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_department_page.dart @@ -37,7 +37,9 @@ class _HouseKeepingDepartmentPageState onRefresh: () async { _models = await HouseKeepingFunc.newHouseKeepingPickStaffList(); }, - child: ListView(children: _buildItem(_models))), + child: ListView( + padding: EdgeInsets.all(32.w), + children: [_buildItem(_models)])), bottom: AkuBottomButton( title: '立即派单', onTap: () async { @@ -108,9 +110,9 @@ class _HouseKeepingDepartmentPageState value: _selectId == e.id, onChanged: (state) { if (state ?? false) { - _selectId = 0; - } else { _selectId = e.id; + } else { + _selectId = 0; } setState(() {}); }, 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 cb8206c..1728efb 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 @@ -58,9 +58,10 @@ class _HouseKeepingDetailPageState extends State { children: [ _buildInfo(), _buildProcess(), - _serviceFeedBack(), - payfeePrice, - _buildEvaluate(), + if (widget.model.handlingTime != null) _serviceFeedBack(), + if (widget.model.payFee != null) payfeePrice, + if (widget.model.evaluationTime != null) _buildEvaluate(), + 16.w.heightBox, ].sepWidget(separate: 16.w.heightBox), ), bottom: _getBottomButtons(widget.model.status), @@ -97,16 +98,14 @@ class _HouseKeepingDetailPageState extends State { title: '提交报告', onTap: () { Get.to(() => HouseKeepingFeedBackPage( - model: widget.model, - callRefresh: widget.callRefresh - )); + model: widget.model, callRefresh: widget.callRefresh)); }, ); case 4: return AkuBottomButton( title: '联系用户', onTap: () async { - await launch(widget.model.proposerTel); + await launch('tel:${widget.model.proposerTel}'); }, ); default: @@ -243,7 +242,7 @@ class _HouseKeepingDetailPageState extends State { _buildTile( R.ASSETS_MESSAGE_IC_PHONE_PNG, '联系电话', widget.model.proposerTel), _buildTile(R.ASSETS_MESSAGE_IC_AREA_PNG, '地址', - '${S.of(context)!.tempPlotName}·${widget.model.roomName}'), + '${S.of(Get.context!)?.tempPlotName ?? ''}·${widget.model.roomName}'), 8.w.heightBox, Text( widget.model.content, diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_func.dart b/lib/ui/manage_pages/house_keeping/house_keeping_func.dart index 84738eb..63c91c7 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_func.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_func.dart @@ -9,7 +9,8 @@ import 'package:bot_toast/bot_toast.dart'; class HouseKeepingFunc { ///获取家政服务进程 - static Future getHouseKeepingProcess(int id) async { + static Future> getHouseKeepingProcess( + int id) async { BaseModel baseModel = await NetUtil().get(API.manage.newHouseKeepingProcess, params: {"housekeepingServiceId": id}); if (baseModel.status ?? false) { @@ -105,7 +106,7 @@ class HouseKeepingFunc { "materialFee": materialFee, "serviceFee": serviceFee, "payFee": payFee, - "handlerImgList":urls, + "handlerImgList": urls, }); if (baseModel.status ?? false) { BotToast.showText(text: '提交成功'); diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_page.dart b/lib/ui/manage_pages/house_keeping/house_keeping_page.dart index e5279e6..c12a7dd 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_page.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_page.dart @@ -1,10 +1,10 @@ -import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_add_page.dart'; +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/house_keeping/house_keeping_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/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:get/get.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class HouseKeepingPage extends StatefulWidget { @@ -16,7 +16,17 @@ class HouseKeepingPage extends StatefulWidget { class _HouseKeepingPageState extends State with TickerProviderStateMixin { - List _tabs = ['全部', '待派单', '已派单', '处理中', '待支付', '待评价', '已完成']; + List get _tabs { + switch (UserTool.userProvider.infoModel!.houseKeepingAuthority) { + case HKAUTH.SEND: + return ['全部', '待派单', '已派单', '处理中', '待支付', '待评价', '已完成']; + case HKAUTH.PICK: + return ['全部', '已派单', '处理中', '待支付', '待评价', '已完成']; + default: + return []; + } + } + late TabController _tabController; @override void initState() { @@ -36,7 +46,11 @@ class _HouseKeepingPageState extends State title: '家政服务', appBarBottom: PreferredSize( preferredSize: Size.fromHeight(88.w), - child: AkuTabBar(controller: _tabController, tabs: _tabs,isScrollable: true,), + child: AkuTabBar( + controller: _tabController, + tabs: _tabs, + isScrollable: true, + ), ), body: TabBarView( controller: _tabController, @@ -48,20 +62,17 @@ class _HouseKeepingPageState extends State ), ), actions: [ - IconButton( - iconSize: 40.w, - icon: Icon( - CupertinoIcons.plus_circle, - size: 40.w, - color: Colors.black, - ), - onPressed: () { - Get.to(() => HouseKeepingAddPage()); - }) + // IconButton( + // iconSize: 40.w, + // icon: Icon( + // CupertinoIcons.plus_circle, + // size: 40.w, + // color: Colors.black, + // ), + // onPressed: () { + // Get.to(() => HouseKeepingAddPage()); + // }) ], - // body: HouseKeepingView( - // index: 0, - // ), ); } } 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 48a64f6..4689d7c 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,7 @@ 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/tools/user_tool.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'; @@ -30,12 +32,27 @@ class _HouseKeepingViewState extends State { super.dispose(); } + int? get housekeepingServiceStatus { + switch (UserTool.userProvider.infoModel!.houseKeepingAuthority) { + case HKAUTH.PICK: + if (widget.index == 0) { + return null; + } else { + return widget.index + 1; + } + case HKAUTH.SEND: + return widget.index == 0 ? null : widget.index; + default: + return widget.index == 0 ? null : widget.index; + } + } + @override Widget build(BuildContext context) { return BeeListView( path: API.manage.newHouseKeepingList, extraParams: { - "housekeepingServiceStatus": widget.index == 0 ? null : widget.index + "housekeepingServiceStatus": housekeepingServiceStatus, }, controller: _refreshController, convert: (models) {