diff --git a/lib/new_ui/household_audit/household_audio_agree.dart b/lib/new_ui/household_audit/household_audio_agree.dart new file mode 100644 index 0000000..ef705e5 --- /dev/null +++ b/lib/new_ui/household_audit/household_audio_agree.dart @@ -0,0 +1,75 @@ +import 'package:aku_new_community_manager/style/app_style.dart'; +import 'package:aku_new_community_manager/tools/extensions/list_extension_tool.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:velocity_x/velocity_x.dart'; + +import '../../const/saas_api.dart'; +import '../../saas_models/household_audit/household_audit_list_model.dart'; +import '../../utils/network/net_util.dart'; +import 'household_audit_card.dart'; + +class HouseholdAudioAgree extends StatefulWidget { + final EasyRefreshController refreshController; + const HouseholdAudioAgree({Key? key, required this.refreshController}) : super(key: key); + + @override + _HouseholdAudioAgreeState createState() => _HouseholdAudioAgreeState(); +} + +class _HouseholdAudioAgreeState extends State { + List _models = []; + int _page = 1; + int _size = 10; + + @override + Widget build(BuildContext context) { + return EasyRefresh( + controller: widget.refreshController, + firstRefresh: true, + header: MaterialHeader(), + footer: MaterialFooter(), + onRefresh: () async { + _models = []; + _page = 1; + var base = + await NetUtil().getList(SAASAPI.householdAudit.list, params: { + 'pageNum': _page, + 'size': _size, + 'status': 3 + }); + _models = base.rows + .map((e) => HouseholdAuditListModel.fromJson(e)) + .toList(); + setState(() {}); + }, + onLoad: () async { + _page++; + var base = + await NetUtil().getList(SAASAPI.householdAudit.list, params: { + 'pageNum': _page, + 'size': _size, + 'status': 3 + }); + if (_models.length < base.total) { + _models.addAll(base.rows + .map((e) => HouseholdAuditListModel.fromJson(e)) + .toList()); + setState(() {}); + } else { + widget.refreshController.finishLoad(); + } + }, + child: ListView( + padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w), + children: _models + .mapIndexed((currentValue, index) => HouseholdAuditCard( + index: index, + refresh: () => widget.refreshController.callRefresh(), + model: currentValue, + )) + .toList() + .sepWidget(separate: 24.w.heightBox), + )); + } +} diff --git a/lib/new_ui/household_audit/household_audio_all.dart b/lib/new_ui/household_audit/household_audio_all.dart new file mode 100644 index 0000000..2a9f62b --- /dev/null +++ b/lib/new_ui/household_audit/household_audio_all.dart @@ -0,0 +1,78 @@ +import 'package:aku_new_community_manager/new_ui/household_audit/household_audit_card.dart'; +import 'package:aku_new_community_manager/style/app_style.dart'; +import 'package:aku_new_community_manager/tools/extensions/list_extension_tool.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:velocity_x/velocity_x.dart'; + +import '../../const/saas_api.dart'; +import '../../saas_models/household_audit/household_audit_list_model.dart'; +import '../../utils/network/net_util.dart'; + +class HouseholdAudioAll extends StatefulWidget { + final EasyRefreshController refreshController; + + HouseholdAudioAll( + {Key? key,required this.refreshController}) + : super(key: key); + + @override + _HouseholdAudioAllState createState() => _HouseholdAudioAllState(); +} + +class _HouseholdAudioAllState extends State { + List _models = []; + int _page = 1; + int _size = 10; + + @override + Widget build(BuildContext context) { + return EasyRefresh( + controller: widget.refreshController, + firstRefresh: true, + header: MaterialHeader(), + footer: MaterialFooter(), + onRefresh: () async { + _models = []; + _page = 1; + var base = + await NetUtil().getList(SAASAPI.householdAudit.list, params: { + 'pageNum': _page, + 'size': _size, + + }); + _models = base.rows + .map((e) => HouseholdAuditListModel.fromJson(e)) + .toList(); + setState(() {}); + }, + onLoad: () async { + _page++; + var base = + await NetUtil().getList(SAASAPI.householdAudit.list, params: { + 'pageNum': _page, + 'size': _size, + }); + if (_models.length < base.total) { + _models.addAll(base.rows + .map((e) => HouseholdAuditListModel.fromJson(e)) + .toList()); + setState(() {}); + } else { + widget.refreshController.finishLoad(); + } + }, + child: ListView( + padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w), + children: _models + .mapIndexed((currentValue, index) => HouseholdAuditCard( + index: index, + refresh: () => widget.refreshController.callRefresh(), + model: currentValue, + )) + .toList() + .sepWidget(separate: 24.w.heightBox), + )); + } +} diff --git a/lib/new_ui/household_audit/household_audio_reject.dart b/lib/new_ui/household_audit/household_audio_reject.dart new file mode 100644 index 0000000..3f24150 --- /dev/null +++ b/lib/new_ui/household_audit/household_audio_reject.dart @@ -0,0 +1,75 @@ +import 'package:aku_new_community_manager/style/app_style.dart'; +import 'package:aku_new_community_manager/tools/extensions/list_extension_tool.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:velocity_x/velocity_x.dart'; + +import '../../const/saas_api.dart'; +import '../../saas_models/household_audit/household_audit_list_model.dart'; +import '../../utils/network/net_util.dart'; +import 'household_audit_card.dart'; + +class HouseholdAudioReject extends StatefulWidget { + final EasyRefreshController refreshController; + const HouseholdAudioReject({Key? key, required this.refreshController}) : super(key: key); + + @override + _HouseholdAudioRejectState createState() => _HouseholdAudioRejectState(); +} + +class _HouseholdAudioRejectState extends State { + List _models = []; + int _page = 1; + int _size = 10; + + @override + Widget build(BuildContext context) { + return EasyRefresh( + controller: widget.refreshController, + firstRefresh: true, + header: MaterialHeader(), + footer: MaterialFooter(), + onRefresh: () async { + _models = []; + _page = 1; + var base = + await NetUtil().getList(SAASAPI.householdAudit.list, params: { + 'pageNum': _page, + 'size': _size, + 'status': 2 + }); + _models = base.rows + .map((e) => HouseholdAuditListModel.fromJson(e)) + .toList(); + setState(() {}); + }, + onLoad: () async { + _page++; + var base = + await NetUtil().getList(SAASAPI.householdAudit.list, params: { + 'pageNum': _page, + 'size': _size, + 'status': 2 + }); + if (_models.length < base.total) { + _models.addAll(base.rows + .map((e) => HouseholdAuditListModel.fromJson(e)) + .toList()); + setState(() {}); + } else { + widget.refreshController.finishLoad(); + } + }, + child: ListView( + padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w), + children: _models + .mapIndexed((currentValue, index) => HouseholdAuditCard( + index: index, + refresh: () => widget.refreshController.callRefresh(), + model: currentValue, + )) + .toList() + .sepWidget(separate: 24.w.heightBox), + )); + } +} diff --git a/lib/new_ui/household_audit/household_audio_verify.dart b/lib/new_ui/household_audit/household_audio_verify.dart new file mode 100644 index 0000000..5f59114 --- /dev/null +++ b/lib/new_ui/household_audit/household_audio_verify.dart @@ -0,0 +1,75 @@ +import 'package:aku_new_community_manager/style/app_style.dart'; +import 'package:aku_new_community_manager/tools/extensions/list_extension_tool.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:velocity_x/velocity_x.dart'; + +import '../../const/saas_api.dart'; +import '../../saas_models/household_audit/household_audit_list_model.dart'; +import '../../utils/network/net_util.dart'; +import 'household_audit_card.dart'; + +class HouseholdAudioVerify extends StatefulWidget { + final EasyRefreshController refreshController; + const HouseholdAudioVerify({Key? key, required this.refreshController}) : super(key: key); + + @override + _HouseholdAudioVerifyState createState() => _HouseholdAudioVerifyState(); +} + +class _HouseholdAudioVerifyState extends State { + List _models = []; + int _page = 1; + int _size = 10; + + @override + Widget build(BuildContext context) { + return EasyRefresh( + controller: widget.refreshController, + firstRefresh: true, + header: MaterialHeader(), + footer: MaterialFooter(), + onRefresh: () async { + _models = []; + _page = 1; + var base = + await NetUtil().getList(SAASAPI.householdAudit.list, params: { + 'pageNum': _page, + 'size': _size, + 'status': 1 + }); + _models = base.rows + .map((e) => HouseholdAuditListModel.fromJson(e)) + .toList(); + setState(() {}); + }, + onLoad: () async { + _page++; + var base = + await NetUtil().getList(SAASAPI.householdAudit.list, params: { + 'pageNum': _page, + 'size': _size, + 'status': 1 + }); + if (_models.length < base.total) { + _models.addAll(base.rows + .map((e) => HouseholdAuditListModel.fromJson(e)) + .toList()); + setState(() {}); + } else { + widget.refreshController.finishLoad(); + } + }, + child: ListView( + padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w), + children: _models + .mapIndexed((currentValue, index) => HouseholdAuditCard( + index: index, + refresh: () => widget.refreshController.callRefresh(), + model: currentValue, + )) + .toList() + .sepWidget(separate: 24.w.heightBox), + )); + } +} diff --git a/lib/new_ui/household_audit/household_audit_card.dart b/lib/new_ui/household_audit/household_audit_card.dart new file mode 100644 index 0000000..9fb6fa9 --- /dev/null +++ b/lib/new_ui/household_audit/household_audit_card.dart @@ -0,0 +1,184 @@ +import 'package:aku_new_community_manager/style/app_style.dart'; +import 'package:flutter/material.dart'; +import 'package:velocity_x/velocity_x.dart'; + +import '../../const/saas_api.dart'; +import '../../gen/assets.gen.dart'; +import '../../saas_models/household_audit/household_audit_list_model.dart'; +import '../../ui/widgets/common/bee_divider.dart'; +import '../../ui/widgets/common/car_bottom_button.dart'; +import '../../utils/network/net_util.dart'; + +class HouseholdAuditCard extends StatelessWidget { + final int index; + final HouseholdAuditListModel model; + final VoidCallback refresh; + + HouseholdAuditCard({Key? key, required this.model, required this.refresh, required this.index}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return Stack( + children: [ + Container( + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16.w), color: Colors.white), + child: Column( + children: [ + Container( + padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 16.w), + height: 77.w, + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + // stops: [ + // 0.4, + // 0.6, + // 0.8 + // ], + colors: [ + Color(0xFFFFEAC3).withOpacity(0.31), + Color(0xFFFEE1AE).withOpacity(0.24), + Color(0xFFFFFFFF), + ])), + child: Row( + children: [ + '${model.houseName}' + .text + .size(32.sp) + .color(Colors.black.withOpacity(0.85)) + .make(), + Spacer(), + '类型:${model.estateTypeName}' + .text + .size(24.sp) + .color(Colors.black.withOpacity(0.45)) + .make(), + ], + ), + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), + child: Column( + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + SizedBox( + width: 160.w, + child: '申请人' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.45)) + .make()), + model.name.text + .size(28.sp) + .color(Colors.black.withOpacity(0.85)) + .make(), + ], + ), + 24.w.heightBox, + Row( + children: [ + SizedBox( + width: 160.w, + child: '联系方式' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.45)) + .make()), + model.tel.text + .size(28.sp) + .color(Colors.black.withOpacity(0.85)) + .make(), + ], + ), + 24.w.heightBox, + Row( + children: [ + SizedBox( + width: 160.w, + child: '申请身份' + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.45)) + .make()), + _identity[model.identity]! + .text + .size(28.sp) + .color(Colors.black.withOpacity(0.85)) + .make(), + ], + ), + ], + ), + ), + Offstage( + offstage: model.status != 1, + child: Column( + children: [ + BeeDivider.horizontal(), + Padding( + padding: EdgeInsets.symmetric( + horizontal: 32.w, vertical: 24.w), + child: Row( + children: [ + Spacer(), + CardBottomButton.yellow( + text: '通过', + onPressed: () async { + var base = await NetUtil().post( + SAASAPI.householdAudit.review, + params: { + 'operate': 1, + 'estateReviewId': model.estateReviewId + }); + if (base.success) { + refresh(); + } + }), + 24.w.widthBox, + CardBottomButton.white( + text: '驳回', + onPressed: () async { + var base = await NetUtil().post( + SAASAPI.householdAudit.review, + params: { + 'operate': 2, + 'estateReviewId': model.estateReviewId + }); + if (base.success) { + refresh(); + } + }), + ], + ), + ), + ], + ), + ), + ], + ), + ), + Positioned( + right: 24.w, + bottom: 24.w, + child: Offstage( + offstage: model.status == 1, + child: Image.asset( + model.status == 2 + ? Assets.manage.rejected.path + : Assets.manage.passed.path, + width: 160.w, + height: 160.w, + ), + ), + ), + ], + ); + } + Map _identity = {1: '业主', 2: '业主亲属', 3: '租户', 4: '租户亲属'}; +} diff --git a/lib/new_ui/household_audit/household_audit_page.dart b/lib/new_ui/household_audit/household_audit_page.dart index 8dbbca5..3498563 100644 --- a/lib/new_ui/household_audit/household_audit_page.dart +++ b/lib/new_ui/household_audit/household_audit_page.dart @@ -1,5 +1,9 @@ import 'package:aku_new_community_manager/const/saas_api.dart'; import 'package:aku_new_community_manager/gen/assets.gen.dart'; +import 'package:aku_new_community_manager/new_ui/household_audit/household_audio_agree.dart'; +import 'package:aku_new_community_manager/new_ui/household_audit/household_audio_all.dart'; +import 'package:aku_new_community_manager/new_ui/household_audit/household_audio_reject.dart'; +import 'package:aku_new_community_manager/new_ui/household_audit/household_audio_verify.dart'; import 'package:aku_new_community_manager/saas_models/household_audit/household_audit_list_model.dart'; import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_new_community_manager/ui/widgets/common/bee_divider.dart'; @@ -26,9 +30,6 @@ class _HouseholdAuditPageState extends State List _tabs = ['全部', '待审核', '已驳回', '已同意']; List _refreshControllers = []; late TabController _tabController; - List _models = []; - int _page = 1; - int _size = 10; @override void initState() { @@ -58,218 +59,13 @@ class _HouseholdAuditPageState extends State )), body: TabBarView( controller: _tabController, - children: List.generate(_tabs.length, (index) => _getView(index))), + children: [ + HouseholdAudioAll(refreshController: _refreshControllers[0]), + HouseholdAudioVerify(refreshController: _refreshControllers[1]), + HouseholdAudioReject(refreshController: _refreshControllers[2]), + HouseholdAudioAgree(refreshController: _refreshControllers[3]), + ], + ), ); } - - Widget _getView(int index) { - return EasyRefresh( - controller: _refreshControllers[index], - firstRefresh: true, - header: MaterialHeader(), - footer: MaterialFooter(), - onRefresh: () async { - _models = []; - _page = 1; - var base = await NetUtil().getList(SAASAPI.householdAudit.list, - params: { - 'pageNum': _page, - 'size': _size, - 'status': index == 0 ? null : index - }); - _models = base.rows - .map((e) => HouseholdAuditListModel.fromJson(e)) - .toList(); - setState(() {}); - }, - onLoad: () async { - _page++; - var base = await NetUtil().getList(SAASAPI.householdAudit.list, - params: { - 'pageNum': _page, - 'size': _size, - 'status': index == 0 ? null : index - }); - if (_models.length < base.total) { - _models.addAll(base.rows - .map((e) => HouseholdAuditListModel.fromJson(e)) - .toList()); - setState(() {}); - } else { - _refreshControllers[index].finishLoad(); - } - }, - child: ListView( - padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w), - children: _models - .mapIndexed((currentValue, index) => _card(currentValue, index)) - .toList() - .sepWidget(separate: 24.w.heightBox), - )); - } - - Widget _card(HouseholdAuditListModel model, int index) { - return Stack( - children: [ - Container( - width: double.infinity, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(16.w), color: Colors.white), - child: Column( - children: [ - Container( - padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 16.w), - height: 77.w, - decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment.centerLeft, - end: Alignment.centerRight, - // stops: [ - // 0.4, - // 0.6, - // 0.8 - // ], - colors: [ - Color(0xFFFFEAC3).withOpacity(0.31), - Color(0xFFFEE1AE).withOpacity(0.24), - Color(0xFFFFFFFF), - ])), - child: Row( - children: [ - '${model.houseName}' - .text - .size(32.sp) - .color(Colors.black.withOpacity(0.85)) - .make(), - Spacer(), - '类型:${model.estateTypeName}' - .text - .size(24.sp) - .color(Colors.black.withOpacity(0.45)) - .make(), - ], - ), - ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), - child: Column( - children: [ - Row( - mainAxisSize: MainAxisSize.max, - children: [ - SizedBox( - width: 160.w, - child: '申请人' - .text - .size(28.sp) - .color(Colors.black.withOpacity(0.45)) - .make()), - model.name.text - .size(28.sp) - .color(Colors.black.withOpacity(0.85)) - .make(), - ], - ), - 24.w.heightBox, - Row( - children: [ - SizedBox( - width: 160.w, - child: '联系方式' - .text - .size(28.sp) - .color(Colors.black.withOpacity(0.45)) - .make()), - model.tel.text - .size(28.sp) - .color(Colors.black.withOpacity(0.85)) - .make(), - ], - ), - 24.w.heightBox, - Row( - children: [ - SizedBox( - width: 160.w, - child: '申请身份' - .text - .size(28.sp) - .color(Colors.black.withOpacity(0.45)) - .make()), - _identity[model.identity]! - .text - .size(28.sp) - .color(Colors.black.withOpacity(0.85)) - .make(), - ], - ) - ], - ), - ), - Offstage( - offstage: model.status != 1, - child: Column( - children: [ - BeeDivider.horizontal(), - Padding( - padding: EdgeInsets.symmetric( - horizontal: 32.w, vertical: 24.w), - child: Row( - children: [ - Spacer(), - CardBottomButton.yellow( - text: '通过', - onPressed: () async { - var base = await NetUtil().post( - SAASAPI.householdAudit.review, - params: { - 'operate': 1, - 'estateReviewId': model.estateReviewId - }); - if (base.success) { - _refreshControllers[index].callRefresh(); - } - }), - 24.w.widthBox, - CardBottomButton.white( - text: '驳回', - onPressed: () async { - var base = await NetUtil().post( - SAASAPI.householdAudit.review, - params: { - 'operate': 2, - 'estateReviewId': model.estateReviewId - }); - if (base.success) { - _refreshControllers[index].callRefresh(); - } - }), - ], - ), - ), - ], - ), - ) - ], - ), - ), - Positioned( - right: 24.w, - bottom: 24.w, - child: Offstage( - offstage: model.status == 1, - child: Image.asset( - model.status == 2 - ? Assets.manage.rejected.path - : Assets.manage.passed.path, - width: 160.w, - height: 160.w, - ), - ), - ) - ], - ); - } - - Map _identity = {1: '业主', 2: '业主亲属', 3: '租户', 4: '租户亲属'}; } diff --git a/pubspec.lock b/pubspec.lock index 7036f2a..b6a3240 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -618,6 +618,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.12.11" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" meta: dependency: transitive description: @@ -958,7 +965,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.3" + version: "0.4.8" time: dependency: transitive description: