diff --git a/lib/new_ui/new_home/new_home_page.dart b/lib/new_ui/new_home/new_home_page.dart index 4ee01aa..1406a82 100644 --- a/lib/new_ui/new_home/new_home_page.dart +++ b/lib/new_ui/new_home/new_home_page.dart @@ -56,6 +56,7 @@ class _NewHomePageState extends State { @override Widget build(BuildContext context) { + print(UserTool.userProvider.userInfoModel!.workOrderJurisdiction); return Scaffold( extendBody: true, drawer: PersonalDraw(), diff --git a/lib/new_ui/work_order/distributor/distributor_detail_page.dart b/lib/new_ui/work_order/distributor/distributor_detail_page.dart index 65f9097..38a817d 100644 --- a/lib/new_ui/work_order/distributor/distributor_detail_page.dart +++ b/lib/new_ui/work_order/distributor/distributor_detail_page.dart @@ -221,7 +221,6 @@ class _DistributorDetailPageState extends State { } }, text: '移至待分配'); - case 3: return BeeLongButton( onPressed: () async { @@ -231,7 +230,6 @@ class _DistributorDetailPageState extends State { } }, text: '提醒处理'); - case 4: return BeeLongButton( onPressed: () async { diff --git a/lib/new_ui/work_order/receiver/receiver_card.dart b/lib/new_ui/work_order/receiver/receiver_card.dart index bfdeff8..f80cbd7 100644 --- a/lib/new_ui/work_order/receiver/receiver_card.dart +++ b/lib/new_ui/work_order/receiver/receiver_card.dart @@ -1,6 +1,7 @@ import 'package:aku_new_community_manager/gen/assets.gen.dart'; import 'package:aku_new_community_manager/new_ui/work_order/distributor/distributor_card.dart'; import 'package:aku_new_community_manager/new_ui/work_order/distributor/distributor_detail_page.dart'; +import 'package:aku_new_community_manager/new_ui/work_order/receiver/receiver_detail_page.dart'; import 'package:aku_new_community_manager/saas_models/work_order/work_order_list_model.dart'; import 'package:aku_new_community_manager/style/app_style.dart'; import 'package:aku_new_community_manager/ui/widgets/common/bee_hor_image_view.dart'; @@ -54,7 +55,7 @@ class ReceiverCard extends StatelessWidget { )), GestureDetector( onTap: () { - Get.to(() => DistributorDetailPage( + Get.to(() => ReceiverDetailPage( id: model.id, )); }, diff --git a/lib/new_ui/work_order/receiver/receiver_detail_page.dart b/lib/new_ui/work_order/receiver/receiver_detail_page.dart index ed9d2d7..92d2386 100644 --- a/lib/new_ui/work_order/receiver/receiver_detail_page.dart +++ b/lib/new_ui/work_order/receiver/receiver_detail_page.dart @@ -204,7 +204,7 @@ class _ReceiverDetailPageState extends State { Widget _getBottomButton() { switch (_model?.status) { - case 1: + case 2: return BeeLongButton( onPressed: () async { var re = await WorkOrderFuc.receiveTask(widget.id); @@ -213,7 +213,7 @@ class _ReceiverDetailPageState extends State { } }, text: '领取任务'); - case 2: + case 3: return BeeLongButton( onPressed: () async { Get.bottomSheet(UrgeDialog( @@ -228,14 +228,14 @@ class _ReceiverDetailPageState extends State { }, text: '开始服务'); - case 3: + case 4: return BottomPluralButtonWidget( onLeftTap: () {}, onRightTap: () {}, leftTitle: '提交报告', rightTitle: '完成工单'); - case 4: + case 5: return BeeLongButton( onPressed: () async { var re = await WorkOrderFuc.reminderConfirm(widget.id); @@ -244,7 +244,7 @@ class _ReceiverDetailPageState extends State { } }, text: '提醒用户确认'); - case 5: + case 6: return BeeLongButton( onPressed: () async { WorkOrderFuc.getBill( @@ -259,14 +259,14 @@ class _ReceiverDetailPageState extends State { ); }, text: '提醒用户支付'); - case 6: - case 7: case 8: - return SizedBox.shrink(); + case 9: return SizedBox.shrink(); + case 10: + return SizedBox.shrink(); default: return SizedBox.shrink(); } diff --git a/lib/new_ui/work_order/receiver/work_order_receiver_page.dart b/lib/new_ui/work_order/receiver/work_order_receiver_page.dart index fc970c5..c3c6ce8 100644 --- a/lib/new_ui/work_order/receiver/work_order_receiver_page.dart +++ b/lib/new_ui/work_order/receiver/work_order_receiver_page.dart @@ -1,5 +1,6 @@ import 'package:aku_new_community_manager/const/saas_api.dart'; import 'package:aku_new_community_manager/new_ui/work_order/distributor/distributor_card.dart'; +import 'package:aku_new_community_manager/new_ui/work_order/receiver/receiver_card.dart'; import 'package:aku_new_community_manager/new_ui/work_order/receiver/work_order_receiver_widget.dart'; import 'package:aku_new_community_manager/saas_models/work_order/work_order_list_model.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; @@ -33,20 +34,20 @@ class _WorkOrderReceiverPageState extends State '已取消' ]; late TabController _tabController; - EasyRefreshController _refreshController = EasyRefreshController(); - int _page = 1; - int _size = 10; - List _models = []; + List _refreshControllers = []; @override void initState() { + _refreshControllers = List.filled(_tabs.length, EasyRefreshController()); _tabController = TabController(length: _tabs.length, vsync: this); super.initState(); } @override void dispose() { - _refreshController.dispose(); + _refreshControllers.forEach((element) { + element.dispose(); + }); _tabController.dispose(); super.dispose(); } @@ -75,56 +76,56 @@ class _WorkOrderReceiverPageState extends State controller: _tabController, children: _tabs .mapIndexed((e, index) => WorkOrderReceiverWidget( - index: index, + refreshController: _refreshControllers[index],index: index, )) .toList()), ); } - Widget _getOrderView(int index) { - return EasyRefresh( - firstRefresh: true, - header: MaterialHeader(), - onRefresh: () async { - _models = []; - _page = 1; - var base = await NetUtil().getList(SAASAPI.workOrder.list, params: { - 'pageNum': _page, - 'size': _size, - 'status': index == 0 ? null : index + 1, - }); - _models = - base.rows.map((e) => WorkOrderListModel.fromJson(e)).toList(); - setState(() {}); - }, - onLoad: () async { - _page++; - var base = await NetUtil().getList(SAASAPI.workOrder.list, params: { - 'pageNum': _page, - 'size': _size, - 'status': index == 0 ? null : index + 1, - }); - if (_models.length < base.total) { - _models.addAll( - base.rows.map((e) => WorkOrderListModel.fromJson(e)).toList()); - setState(() {}); - } else { - _refreshController.finishLoad(); - } - }, - child: _models == [] - ? SizedBox() - : ListView.separated( - padding: EdgeInsets.all(24.w), - itemBuilder: (context, index) { - return DistributorCard( - model: _models[index], - refresh: _refreshController.callRefresh, - ); - }, - separatorBuilder: (context, index) { - return 24.w.heightBox; - }, - itemCount: _models.length)); - } + // Widget _getOrderView(int index) { + // return EasyRefresh( + // firstRefresh: true, + // header: MaterialHeader(), + // onRefresh: () async { + // _models = []; + // _page = 1; + // var base = await NetUtil().getList(SAASAPI.workOrder.list, params: { + // 'pageNum': _page, + // 'size': _size, + // 'status': index == 0 ? null : index + 1, + // }); + // _models = + // base.rows.map((e) => WorkOrderListModel.fromJson(e)).toList(); + // setState(() {}); + // }, + // onLoad: () async { + // _page++; + // var base = await NetUtil().getList(SAASAPI.workOrder.list, params: { + // 'pageNum': _page, + // 'size': _size, + // 'status': index == 0 ? null : index + 1, + // }); + // if (_models.length < base.total) { + // _models.addAll( + // base.rows.map((e) => WorkOrderListModel.fromJson(e)).toList()); + // setState(() {}); + // } else { + // _refreshController.finishLoad(); + // } + // }, + // child: _models == [] + // ? SizedBox() + // : ListView.separated( + // padding: EdgeInsets.all(24.w), + // itemBuilder: (context, index) { + // return ReceiverCard( + // model: _models[index], + // refresh: _refreshController.callRefresh, + // ); + // }, + // separatorBuilder: (context, index) { + // return 24.w.heightBox; + // }, + // itemCount: _models.length)); + // } } diff --git a/lib/new_ui/work_order/receiver/work_order_receiver_widget.dart b/lib/new_ui/work_order/receiver/work_order_receiver_widget.dart index a5d5aa3..d1e153d 100644 --- a/lib/new_ui/work_order/receiver/work_order_receiver_widget.dart +++ b/lib/new_ui/work_order/receiver/work_order_receiver_widget.dart @@ -1,5 +1,6 @@ import 'package:aku_new_community_manager/const/saas_api.dart'; import 'package:aku_new_community_manager/new_ui/work_order/distributor/distributor_card.dart'; +import 'package:aku_new_community_manager/new_ui/work_order/receiver/receiver_card.dart'; import 'package:aku_new_community_manager/saas_models/work_order/work_order_list_model.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/inner/aku_tab_bar.dart'; @@ -12,9 +13,9 @@ import 'package:velocity_x/velocity_x.dart'; class WorkOrderReceiverWidget extends StatefulWidget { final int index; + final EasyRefreshController refreshController; - - const WorkOrderReceiverWidget({Key? key, required this.index}) : super(key: key); + const WorkOrderReceiverWidget({Key? key, required this.index, required this.refreshController}) : super(key: key); @override _WorkOrderReceiverWidgetState createState() => _WorkOrderReceiverWidgetState(); @@ -23,24 +24,10 @@ class WorkOrderReceiverWidget extends StatefulWidget { class _WorkOrderReceiverWidgetState extends State with SingleTickerProviderStateMixin { - EasyRefreshController _refreshController = EasyRefreshController(); int _page = 1; int _size = 10; List _models = []; - @override - void initState() { - - super.initState(); - } - - @override - void dispose() { - _refreshController.dispose(); - - super.dispose(); - } - @override Widget build(BuildContext context) { return EasyRefresh( @@ -70,15 +57,15 @@ class _WorkOrderReceiverWidgetState extends State base.rows.map((e) => WorkOrderListModel.fromJson(e)).toList()); setState(() {}); } else { - _refreshController.finishLoad(); + widget.refreshController.finishLoad(); } }, child:_models==[]?SizedBox(): ListView.separated( padding: EdgeInsets.all(24.w), itemBuilder: (context, index) { - return DistributorCard( + return ReceiverCard( model: _models[index], - refresh: _refreshController.callRefresh, + refresh: widget.refreshController.callRefresh, ); }, separatorBuilder: (context, index) {