From 04b99bfebc193d6a17609b58e1acdd3eb0d4c2a1 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Wed, 30 Mar 2022 15:15:20 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/sign/sign_func.dart | 1 + lib/provider/user_provider.dart | 3 + .../task/dialogs/task_evaluation_dialog.dart | 125 ++++++++++------ .../dialogs/work_order_bill_dialog.dart | 7 +- .../work_order/work_order_detail_page.dart | 37 ++--- .../work_order/work_order_func.dart | 39 ++++- lib/ui/market/order/order_card.dart | 2 +- .../search/submit_order_page_normal.dart | 2 +- lib/ui/profile/new_house/my_house_page.dart | 140 ++++++++++-------- 9 files changed, 219 insertions(+), 137 deletions(-) diff --git a/lib/pages/sign/sign_func.dart b/lib/pages/sign/sign_func.dart index 2a48ac14..8a1d9b44 100644 --- a/lib/pages/sign/sign_func.dart +++ b/lib/pages/sign/sign_func.dart @@ -153,6 +153,7 @@ class SignFunc { return true; } + ///获取用户房屋列表 static Future> getMyHouseInfo() async { BaseModel baseModel = await NetUtil().get( SAASAPI.profile.house.userHouse, diff --git a/lib/provider/user_provider.dart b/lib/provider/user_provider.dart index dfd5fd23..fc290659 100644 --- a/lib/provider/user_provider.dart +++ b/lib/provider/user_provider.dart @@ -30,6 +30,7 @@ class UserProvider extends ChangeNotifier { await updateUserInfo(); WebSocketUtil().setUser(userInfoModel!.id.toString()); WebSocketUtil().startWebSocket(); + await updateMyHouseInfo(); ///初始化用户配置 _userConfig = await HiveStore.userBox!.get('${_userInfoModel!.id}') ?? @@ -77,6 +78,7 @@ class UserProvider extends ChangeNotifier { notifyListeners(); } + ///更新我的房屋列表 Future updateMyHouseInfo() async { _myHouses = await SignFunc.getMyHouseInfo(); if (_myHouses.isEmpty) { @@ -99,6 +101,7 @@ class UserProvider extends ChangeNotifier { UserInfoModel? get userInfoModel => _userInfoModel; + ///我的房屋列表 List _myHouses = []; List get myHouses => _myHouses; diff --git a/lib/ui/function_and_service/task/dialogs/task_evaluation_dialog.dart b/lib/ui/function_and_service/task/dialogs/task_evaluation_dialog.dart index d8883788..80b8ad99 100644 --- a/lib/ui/function_and_service/task/dialogs/task_evaluation_dialog.dart +++ b/lib/ui/function_and_service/task/dialogs/task_evaluation_dialog.dart @@ -80,51 +80,20 @@ class _TaskEvaluationDialogState extends State { ), ), 80.hb, - Row( - children: [ - MaterialButton( - onPressed: () {}, - minWidth: 330.w, - height: 80.w, - elevation: 0, - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(40.w), - side: BorderSide(color: Colors.black.withOpacity(0.25)), - ), - child: Text( - '暂不评价', - style: TextStyle( - fontSize: 28.sp, color: Colors.black.withOpacity(0.65)), - ), - ), - Spacer(), - MaterialButton( - onPressed: () async { - if (_currentIndex == null) { - BotToast.showText(text: '请选择评价满意度'); - return; - } - var re = - await widget.evaluate(_currentIndex!, _controller.text); - if (re) { - Get.back(); - } - }, - minWidth: 330.w, - height: 80.w, - elevation: 0, - color: kPrimaryColor, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(40.w), - ), - child: Text( - '确认提交', - style: TextStyle( - fontSize: 28.sp, color: Colors.black.withOpacity(0.85)), - ), - ) - ], + BottomPluralButtonWidget( + leftTitle: '暂不评价', + onLeftTap: () {}, + rightTitle: '确认提交', + onRightTap: () async { + if (_currentIndex == null) { + BotToast.showText(text: '请选择评价满意度'); + return; + } + var re = await widget.evaluate(_currentIndex!, _controller.text); + if (re) { + Get.back(); + } + }, ) ], ), @@ -159,3 +128,69 @@ class _TaskEvaluationDialogState extends State { ); } } + +class BottomPluralButtonWidget extends StatelessWidget { + const BottomPluralButtonWidget({ + Key? key, + required this.onLeftTap, + required this.onRightTap, + required this.leftTitle, + required this.rightTitle, + this.padding = false, + }) : super(key: key); + final VoidCallback onLeftTap; + final VoidCallback onRightTap; + final String leftTitle; + final String rightTitle; + final bool padding; + + @override + Widget build(BuildContext context) { + return Container( + padding: padding + ? EdgeInsets.only( + left: 32.w, + top: 32.w, + bottom: 32.w + MediaQuery.of(context).padding.bottom, + right: 32.w) + : EdgeInsets.zero, + color: padding ? Colors.white : Colors.transparent, + child: Row( + children: [ + MaterialButton( + onPressed: onLeftTap, + minWidth: 330.w, + height: 80.w, + elevation: 0, + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40.w), + side: BorderSide(color: Colors.black.withOpacity(0.25)), + ), + child: Text( + leftTitle, + style: TextStyle( + fontSize: 28.sp, color: Colors.black.withOpacity(0.65)), + ), + ), + Spacer(), + MaterialButton( + onPressed: onRightTap, + minWidth: 330.w, + height: 80.w, + elevation: 0, + color: kPrimaryColor, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(40.w), + ), + child: Text( + rightTitle, + style: TextStyle( + fontSize: 28.sp, color: Colors.black.withOpacity(0.85)), + ), + ) + ], + ), + ); + } +} diff --git a/lib/ui/function_and_service/work_order/dialogs/work_order_bill_dialog.dart b/lib/ui/function_and_service/work_order/dialogs/work_order_bill_dialog.dart index 97753c2d..1813f698 100644 --- a/lib/ui/function_and_service/work_order/dialogs/work_order_bill_dialog.dart +++ b/lib/ui/function_and_service/work_order/dialogs/work_order_bill_dialog.dart @@ -5,6 +5,7 @@ import 'package:aku_new_community/widget/bee_divider.dart'; import 'package:aku_new_community/widget/buttons/bee_long_button.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; import 'package:velocity_x/src/extensions/string_ext.dart'; class WorkOrderBillDialog extends StatelessWidget { @@ -76,7 +77,11 @@ class WorkOrderBillDialog extends StatelessWidget { ], ), 80.hb, - BeeLongButton(onPressed: () {}, text: '确认支付'), + BeeLongButton( + onPressed: () { + Get.back(); + }, + text: '确认支付'), ], ), ); diff --git a/lib/ui/function_and_service/work_order/work_order_detail_page.dart b/lib/ui/function_and_service/work_order/work_order_detail_page.dart index 6f23a934..3fbef45b 100644 --- a/lib/ui/function_and_service/work_order/work_order_detail_page.dart +++ b/lib/ui/function_and_service/work_order/work_order_detail_page.dart @@ -2,12 +2,10 @@ import 'package:aku_new_community/constants/saas_api.dart'; import 'package:aku_new_community/extensions/num_ext.dart'; import 'package:aku_new_community/gen/assets.gen.dart'; import 'package:aku_new_community/saas_model/work_order/work_order_detail_model.dart'; -import 'package:aku_new_community/saas_model/work_order/work_order_progress_model.dart'; import 'package:aku_new_community/ui/function_and_service/task/dialogs/task_evaluation_dialog.dart'; import 'package:aku_new_community/ui/function_and_service/work_order/dialogs/urge_dialog.dart'; -import 'package:aku_new_community/ui/function_and_service/work_order/dialogs/work_order_bill_dialog.dart'; import 'package:aku_new_community/ui/function_and_service/work_order/dialogs/work_order_finish_dialog.dart'; -import 'package:aku_new_community/ui/function_and_service/work_order/dialogs/work_order_progress_dialog.dart'; +import 'package:aku_new_community/ui/function_and_service/work_order/history_report_page.dart'; import 'package:aku_new_community/ui/function_and_service/work_order/team_list_page.dart'; import 'package:aku_new_community/ui/function_and_service/work_order/work_order_func.dart'; import 'package:aku_new_community/ui/function_and_service/work_order/work_order_map.dart'; @@ -78,21 +76,8 @@ class _WorkOrderDetailPageState extends State { children: [ GestureDetector( onTap: () async { - var base = await NetUtil().get( - SAASAPI.workOrder.findScheduleById, - params: {'workOrderId': widget.id}); - if (base.success) { - var models = (base.data as List) - .map((e) => - WorkOrderProgressModel.fromJson( - e)) - .toList(); - await Get.bottomSheet( - WorkOrderProgressDialog( - models: models)); - } else { - BotToast.showText(text: base.msg); - } + await WorkOrderFuc.getProgress( + workOrderId: widget.id); }, child: Material( color: Colors.transparent, @@ -147,6 +132,14 @@ class _WorkOrderDetailPageState extends State { padding: EdgeInsets.only(top: 120.w, left: 32.w, right: 32.w), children: [ + Offstage( + offstage: _model!.status < 5, + child: Column( + children: [ + _historyReport(), + 24.hb, + ], + )), Offstage( offstage: _model!.servicePersonnelImgList == null || _model!.servicePersonnelImgList!.isEmpty, @@ -242,8 +235,8 @@ class _WorkOrderDetailPageState extends State { case 6: return BeeLongButton( onPressed: () async { - var bills = await WorkOrderFuc.getBill(workOrderId: widget.id); - await Get.bottomSheet(WorkOrderBillDialog(models: bills)); + await WorkOrderFuc.getBill(workOrderId: widget.id); + _refreshController.callRefresh(); }, text: '确认支付'); case 7: @@ -268,7 +261,9 @@ class _WorkOrderDetailPageState extends State { Widget _historyReport() { return GestureDetector( - onTap: () {}, + onTap: () { + Get.to(HistoryReportPage(id: widget.id)); + }, child: Material( color: Colors.transparent, child: Container( diff --git a/lib/ui/function_and_service/work_order/work_order_func.dart b/lib/ui/function_and_service/work_order/work_order_func.dart index 4898b334..009b3d49 100644 --- a/lib/ui/function_and_service/work_order/work_order_func.dart +++ b/lib/ui/function_and_service/work_order/work_order_func.dart @@ -1,7 +1,14 @@ import 'package:aku_new_community/constants/saas_api.dart'; import 'package:aku_new_community/saas_model/work_order/work_order_bill_model.dart'; +import 'package:aku_new_community/saas_model/work_order/work_order_progress_model.dart'; import 'package:aku_new_community/utils/network/base_model.dart'; import 'package:aku_new_community/utils/network/net_util.dart'; +import 'package:bot_toast/bot_toast.dart'; +import 'package:get/get_core/src/get_main.dart'; +import 'package:get/get_navigation/src/extension_navigation.dart'; + +import 'dialogs/work_order_bill_dialog.dart'; +import 'dialogs/work_order_progress_dialog.dart'; class WorkOrderFuc { ///催促 @@ -48,20 +55,36 @@ class WorkOrderFuc { return base.success; } - ///账单 - static Future> getBill({ + ///查询工单进度 + static Future getProgress({ + required int workOrderId, + }) async { + var base = await NetUtil().get(SAASAPI.workOrder.findScheduleById, + params: {'workOrderId': workOrderId}); + if (base.success) { + var models = (base.data as List) + .map((e) => WorkOrderProgressModel.fromJson(e)) + .toList(); + await Get.bottomSheet(WorkOrderProgressDialog(models: models)); + } else { + BotToast.showText(text: base.msg); + } + } + + ///查询账单 + static Future getBill({ required int workOrderId, }) async { - var models = []; - var base = await NetUtil().get(SAASAPI.workOrder.cancel, params: { - 'workOrderId': workOrderId, - }); + var base = await NetUtil().get(SAASAPI.workOrder.workOrderBill, + params: {'workOrderId': workOrderId}); if (base.success) { - models = (base.data as List) + var models = (base.data as List) .map((e) => WorkOrderBillModel.fromJson(e)) .toList(); + await Get.bottomSheet(WorkOrderBillDialog(models: models)); + } else { + BotToast.showText(text: base.msg); } - return models; } ///发布工单 diff --git a/lib/ui/market/order/order_card.dart b/lib/ui/market/order/order_card.dart index 00f88db3..7b760dad 100644 --- a/lib/ui/market/order/order_card.dart +++ b/lib/ui/market/order/order_card.dart @@ -76,7 +76,7 @@ class _OrderCardState extends State { "payType": 1, //暂时写死 等待后续补充 "payPrice": widget.model.payPrice, "residentId": UserTool.userProvider.userInfoModel!.id, - "payname": UserTool.userProvider.userInfoModel!.name, + "payName": UserTool.userProvider.userInfoModel!.name, "payTel": UserTool.userProvider.userInfoModel!.tel, }); if (baseModel.success) { diff --git a/lib/ui/market/search/submit_order_page_normal.dart b/lib/ui/market/search/submit_order_page_normal.dart index 438c92d0..ac554f60 100644 --- a/lib/ui/market/search/submit_order_page_normal.dart +++ b/lib/ui/market/search/submit_order_page_normal.dart @@ -197,7 +197,7 @@ class _SubmitOrderNormalPageState extends State { "payPrice": totalPrice, // 'points': widget.integral, "residentId": UserTool.userProvider.userInfoModel!.id, - "payname": UserTool.userProvider.userInfoModel!.name, + "payName": UserTool.userProvider.userInfoModel!.name, "payTel": UserTool.userProvider.userInfoModel!.tel, }, showMessage: true); diff --git a/lib/ui/profile/new_house/my_house_page.dart b/lib/ui/profile/new_house/my_house_page.dart index 8e12d2b4..7de4ba49 100644 --- a/lib/ui/profile/new_house/my_house_page.dart +++ b/lib/ui/profile/new_house/my_house_page.dart @@ -11,6 +11,7 @@ import 'package:aku_new_community/widget/dialog/certification_dialog.dart'; import 'package:aku_new_community/widget/others/user_tool.dart'; import 'package:aku_new_community/widget/tag/bee_tag.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:velocity_x/velocity_x.dart'; @@ -23,15 +24,19 @@ class MyHousePage extends StatefulWidget { } class _MyHousePageState extends State { + EasyRefreshController _refreshController = EasyRefreshController(); + @override void initState() { - Future.delayed(Duration(milliseconds: 0), () async { - await UserTool.userProvider.updateMyHouseInfo(); - setState(() {}); - }); super.initState(); } + @override + void dispose() { + _refreshController.dispose(); + super.dispose(); + } + @override Widget build(BuildContext context) { return BeeScaffold( @@ -46,14 +51,23 @@ class _MyHousePageState extends State { body: SafeArea( child: UserTool.userProvider.myHouses.isEmpty ? HouseEmptyWidget() - : ListView( - padding: - EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w), - children: [ - ...UserTool.userProvider.myHouses - .map((e) => _houseCard(e)) - .toList() - ].sepWidget(separate: 24.w.heightBox), + : EasyRefresh( + controller: _refreshController, + firstRefresh: true, + header: MaterialHeader(), + onRefresh: () async { + await UserTool.userProvider.updateMyHouseInfo(); + setState(() {}); + }, + child: ListView( + padding: + EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w), + children: [ + ...UserTool.userProvider.myHouses + .map((e) => _houseCard(e)) + .toList() + ].sepWidget(separate: 24.w.heightBox), + ), )), bottomNavi: Padding( padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w), @@ -74,57 +88,63 @@ class _MyHousePageState extends State { Widget _houseCard(MyHouseModel model) { return Stack( children: [ - Container( - width: 686.w, - padding: EdgeInsets.all(24.w), - decoration: BoxDecoration( - color: Colors.white, borderRadius: BorderRadius.circular(8.w)), - child: Column( - children: [ - Row( - children: [ - '${model.addressName} ${model.communityName}' - .text - .size(24.sp) - .color(Colors.black.withOpacity(0.65)) - .make(), - ], - ), - 8.w.heightBox, - Row( + GestureDetector( + onTap: () {}, + child: Material( + child: Container( + width: 686.w, + padding: EdgeInsets.all(24.w), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w)), + child: Column( children: [ - '${model.buildingName}${model.unitName}${model.estateName}' - .text - .size(36.sp) - .color(Colors.black.withOpacity(0.85)) - .make(), - 24.w.widthBox, - model.isDefault == 1 - ? BeeTag.yellowSolid( - text: '${model.manageEstateTypeName}') - : BeeTag.blackSolid( - text: '${model.manageEstateTypeName}'), + Row( + children: [ + '${model.addressName} ${model.communityName}' + .text + .size(24.sp) + .color(Colors.black.withOpacity(0.65)) + .make(), + ], + ), + 8.w.heightBox, + Row( + children: [ + '${model.buildingName}${model.unitName}${model.estateName}' + .text + .size(36.sp) + .color(Colors.black.withOpacity(0.85)) + .make(), + 24.w.widthBox, + model.isDefault == 1 + ? BeeTag.yellowSolid( + text: '${model.manageEstateTypeName}') + : BeeTag.blackSolid( + text: '${model.manageEstateTypeName}'), + ], + ), + 24.w.heightBox, + BeeDivider.horizontal(), + 24.w.heightBox, + Row( + children: [ + model.isDefault == 1 + ? BeeTag.yellowHollow( + text: '${model.manageEstateTypeName}') + : BeeTag.blackHollow( + text: '${model.manageEstateTypeName}'), + 10.w.widthBox, + '${model.name} ${model.tel}' + .text + .size(24.sp) + .color(Colors.black.withOpacity(0.65)) + .make(), + ], + ) ], ), - 24.w.heightBox, - BeeDivider.horizontal(), - 24.w.heightBox, - Row( - children: [ - model.isDefault == 1 - ? BeeTag.yellowHollow( - text: '${model.manageEstateTypeName}') - : BeeTag.blackHollow( - text: '${model.manageEstateTypeName}'), - 10.w.widthBox, - '${model.name} ${model.tel}' - .text - .size(24.sp) - .color(Colors.black.withOpacity(0.65)) - .make(), - ], - ) - ], + ), ), ), if (model.isDefault == 1) From cbfba39946ad7617456efa25010ab1d67c8694bf Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Wed, 30 Mar 2022 15:22:36 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=88=87=E6=8D=A2=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E6=88=BF=E5=B1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/constants/profile_api.dart | 3 +++ lib/ui/profile/new_house/my_house_page.dart | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/constants/profile_api.dart b/lib/constants/profile_api.dart index 40057b68..54fce71a 100644 --- a/lib/constants/profile_api.dart +++ b/lib/constants/profile_api.dart @@ -7,6 +7,9 @@ class _ProfileApi { } class _MyHouse { + ///切换默认房屋 + String get switchDefaultEstate => '/app/user/myEstate/checkEstate'; + ///查询所有我的房屋 String get userHouse => '/app/user/myEstate/findAllMyEstate'; diff --git a/lib/ui/profile/new_house/my_house_page.dart b/lib/ui/profile/new_house/my_house_page.dart index 7de4ba49..b2d69023 100644 --- a/lib/ui/profile/new_house/my_house_page.dart +++ b/lib/ui/profile/new_house/my_house_page.dart @@ -1,15 +1,18 @@ import 'package:aku_new_community/base/base_style.dart'; +import 'package:aku_new_community/constants/saas_api.dart'; import 'package:aku_new_community/extensions/widget_list_ext.dart'; import 'package:aku_new_community/gen/assets.gen.dart'; import 'package:aku_new_community/models/user/my_house_model.dart'; import 'package:aku_new_community/ui/profile/new_house/add_house_page.dart'; import 'package:aku_new_community/ui/profile/new_house/apply_record_page.dart'; import 'package:aku_new_community/ui/profile/new_house/widgets/add_house_button.dart'; +import 'package:aku_new_community/utils/network/net_util.dart'; import 'package:aku_new_community/widget/bee_divider.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:aku_new_community/widget/dialog/certification_dialog.dart'; import 'package:aku_new_community/widget/others/user_tool.dart'; import 'package:aku_new_community/widget/tag/bee_tag.dart'; +import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -89,7 +92,17 @@ class _MyHousePageState extends State { return Stack( children: [ GestureDetector( - onTap: () {}, + onTap: () async { + var base = await NetUtil().get( + SAASAPI.profile.house.switchDefaultEstate, + params: {'estateId': model.isDefault}); + if (base.success) { + await UserTool.userProvider.updateMyHouseInfo(); + _refreshController.callRefresh(); + } else { + BotToast.showText(text: '切换默认房屋失败'); + } + }, child: Material( child: Container( width: 686.w,