From 28d94c170f71405e13f9052a02b5739ef8bb1273 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Tue, 13 Jul 2021 10:11:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BC=B4=E8=B4=B9=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E9=A1=B5=E9=9D=A2=20=E4=BF=AE=E6=94=B9=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E8=85=BE=E7=A9=BA=E5=8D=95=E5=8F=AF=E4=B8=BA=E5=A4=9A?= =?UTF-8?q?=E4=B8=AA=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/constants/api.dart | 3 + lib/generated_plugin_registrant.dart | 3 +- lib/models/house/lease_fee_list_model.dart | 57 +++++ lib/models/house/lease_fee_list_model.g.dart | 17 ++ .../contract_stop/upload_empty_list_page.dart | 74 ++++-- lib/ui/profile/house/house_func.dart | 12 +- lib/ui/profile/house/house_owners_page.dart | 5 +- .../lease_pay_query/lease_pay_query_page.dart | 218 ++++++++++++++++++ lib/utils/network/net_util.dart | 8 +- 9 files changed, 368 insertions(+), 29 deletions(-) create mode 100644 lib/models/house/lease_fee_list_model.dart create mode 100644 lib/models/house/lease_fee_list_model.g.dart create mode 100644 lib/ui/profile/house/lease_pay_query/lease_pay_query_page.dart diff --git a/lib/constants/api.dart b/lib/constants/api.dart index 7fe1d300..f77d7177 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -503,4 +503,7 @@ class _House { ///我的房屋-合同终止:保证金退还申请 String get refundApplication => '/user/myHouse/depositRefundApplication'; + + ///我的房屋-缴费查询:查询所有的缴费查询(包含搜索条件) + String get leaseFeesQuery => '/user/myHouse/findLeaseRentList'; } diff --git a/lib/generated_plugin_registrant.dart b/lib/generated_plugin_registrant.dart index 8e0b1cb0..222a4e7a 100644 --- a/lib/generated_plugin_registrant.dart +++ b/lib/generated_plugin_registrant.dart @@ -6,12 +6,13 @@ import 'package:device_info_plus_web/device_info_plus_web.dart'; import 'package:firebase_core_web/firebase_core_web.dart'; -import 'package:flutter_web_plugins/flutter_web_plugins.dart'; import 'package:image_picker_for_web/image_picker_for_web.dart'; import 'package:package_info_plus_web/package_info_plus_web.dart'; import 'package:shared_preferences_web/shared_preferences_web.dart'; import 'package:url_launcher_web/url_launcher_web.dart'; +import 'package:flutter_web_plugins/flutter_web_plugins.dart'; + // ignore: public_member_api_docs void registerPlugins(Registrar registrar) { DeviceInfoPlusPlugin.registerWith(registrar); diff --git a/lib/models/house/lease_fee_list_model.dart b/lib/models/house/lease_fee_list_model.dart new file mode 100644 index 00000000..1ef1ac67 --- /dev/null +++ b/lib/models/house/lease_fee_list_model.dart @@ -0,0 +1,57 @@ +import 'package:equatable/equatable.dart'; +import 'package:json_annotation/json_annotation.dart'; +part 'lease_fee_list_model.g.dart'; + +@JsonSerializable() +class LeaseFeeListModel extends Equatable { + final int id; + final num price; + final int payStatus; + final String createDate; + final int type; + LeaseFeeListModel({ + required this.id, + required this.price, + required this.payStatus, + required this.createDate, + required this.type, + }); + factory LeaseFeeListModel.fromJson(Map json) => + _$LeaseFeeListModelFromJson(json); + @override + List get props { + return [ + id, + price, + payStatus, + createDate, + type, + ]; + } + + String get typeString { + switch (this.type) { + case 1: + return '保证金'; + case 2: + return '租金'; + case 3: + return '剩余需结清租金'; + default: + return '未知'; + } + } + + String get payStatusString { + switch (this.payStatus) { + case 0: + return '未缴纳'; + case 1: + return '已缴纳'; + case 2: + return '已结算'; + default: + return '未知'; + } + } +} diff --git a/lib/models/house/lease_fee_list_model.g.dart b/lib/models/house/lease_fee_list_model.g.dart new file mode 100644 index 00000000..d2fb7bf0 --- /dev/null +++ b/lib/models/house/lease_fee_list_model.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'lease_fee_list_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +LeaseFeeListModel _$LeaseFeeListModelFromJson(Map json) { + return LeaseFeeListModel( + id: json['id'] as int, + price: json['price'] as num, + payStatus: json['payStatus'] as int, + createDate: json['createDate'] as String, + type: json['type'] as int, + ); +} diff --git a/lib/ui/profile/house/contract_stop/upload_empty_list_page.dart b/lib/ui/profile/house/contract_stop/upload_empty_list_page.dart index 3ddd4d4b..6aba3a3b 100644 --- a/lib/ui/profile/house/contract_stop/upload_empty_list_page.dart +++ b/lib/ui/profile/house/contract_stop/upload_empty_list_page.dart @@ -1,11 +1,14 @@ import 'dart:io'; +import 'package:aku_community/widget/views/doc_view.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:bot_toast/bot_toast.dart'; import 'package:flustars/flustars.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:open_file/open_file.dart'; import 'package:velocity_x/velocity_x.dart'; import 'package:aku_community/base/base_style.dart'; @@ -17,6 +20,7 @@ import 'package:aku_community/widget/others/house_head_card.dart'; import 'package:aku_community/widget/others/upload_widget.dart'; import 'package:aku_community/widget/others/user_tool.dart'; import 'package:aku_community/widget/picker/bee_date_picker.dart'; +import 'package:aku_community/extensions/widget_list_ext.dart'; class UploadEmptyListPage extends StatefulWidget { UploadEmptyListPage({Key? key}) : super(key: key); @@ -26,7 +30,7 @@ class UploadEmptyListPage extends StatefulWidget { } class _UploadEmptyListPageState extends State { - File? _file; + List _files = []; List _urls = []; int get sysLeaseId => UserTool.appProveider.selectedHouse!.sysLeaseId ?? 0; DateTime? _date = DateTime.now(); @@ -64,19 +68,39 @@ class _UploadEmptyListPageState extends State { 40.w.heightBox, '上传腾空单'.text.size(28.sp).color(ktextPrimary).make(), 24.w.heightBox, - _file != null - ? Image.file( - _file!, - width: 480.w, - height: 480.w, - fit: BoxFit.cover, - ) - : UploadWidget( - sheetTitle: '上传腾空单', - onPicked: (file) { - _file = file; - setState(() {}); - }), + UploadWidget( + sheetTitle: '上传腾空单', + onPicked: (file) { + _files.add(file); + setState(() {}); + }), + 64.w.heightBox, + Padding( + padding: EdgeInsets.symmetric(horizontal: 60.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + ..._files + .map( + (e) => DocViw( + title: e.path.split('/').last, + margin: EdgeInsets.zero, + onLongPress: () async { + await Get.bottomSheet(_deleteSheet(() { + _files.remove(e); + Get.back(); + setState(() {}); + })); + }, + onPressed: () async { + await OpenFile.open(e.path); + }, + ), + ) + .toList() + ].sepWidget(separate: 12.w.heightBox), + ), + ) ], ), ) @@ -85,8 +109,8 @@ class _UploadEmptyListPageState extends State { bottomNavi: BottomButton( onPressed: () async { Function cancel = BotToast.showLoading(); - if (_file != null) { - _urls.add(await HouseFunc().uploadClearingSingle(_file!)); + if (_files.isNotEmpty) { + _urls.addAll(await HouseFunc().uploadClearingSingle(_files)); } else { BotToast.showText(text: '请先选择腾空单'); } @@ -104,4 +128,22 @@ class _UploadEmptyListPageState extends State { child: '提交审核'.text.size(32.sp).bold.color(ktextPrimary).make()), ); } + + Widget _deleteSheet(VoidCallback onTap) { + return CupertinoActionSheet( + title: + '删除文件'.text.size(28.sp).bold.isIntrinsic.color(ktextPrimary).make(), + actions: [ + CupertinoActionSheetAction( + onPressed: onTap, + child: '删除' + .text + .size(32.sp) + .isIntrinsic + .bold + .color(kDangerColor) + .make()) + ], + ); + } } diff --git a/lib/ui/profile/house/house_func.dart b/lib/ui/profile/house/house_func.dart index 754a95ee..172954dd 100644 --- a/lib/ui/profile/house/house_func.dart +++ b/lib/ui/profile/house/house_func.dart @@ -186,14 +186,10 @@ class HouseFunc { } ///上传腾空单 - Future uploadClearingSingle(File file) async { - BaseFileModel baseFileModel = - await NetUtil().upload(API.upload.uploadClearingSingle, file); - if (baseFileModel.status ?? false) { - return baseFileModel.url!; - } else { - return ''; - } + Future> uploadClearingSingle(List files) async { + List urls = + await NetUtil().uploadFiles(files, API.upload.uploadClearingSingle); + return urls; } ///我的房屋终止合同:提交终止申请 diff --git a/lib/ui/profile/house/house_owners_page.dart b/lib/ui/profile/house/house_owners_page.dart index f6296eaa..7ae15a97 100644 --- a/lib/ui/profile/house/house_owners_page.dart +++ b/lib/ui/profile/house/house_owners_page.dart @@ -1,3 +1,4 @@ +import 'package:aku_community/ui/profile/house/lease_pay_query/lease_pay_query_page.dart'; import 'package:flutter/material.dart'; import 'package:bot_toast/bot_toast.dart'; @@ -206,7 +207,9 @@ class _HouseOwnersPageState extends State { mainAxisSpacing: 32.w, crossAxisSpacing: 32.w, children: [ - _cardBuild(R.ASSETS_ICONS_PAY_PNG, '缴费查询', '查看租金及保证金情况', () {}), + _cardBuild(R.ASSETS_ICONS_PAY_PNG, '缴费查询', '查看租金及保证金情况', () { + Get.to(() => LeasePayQueryPage(id:UserTool.appProveider.selectedHouse!.sysLeaseId!,)); + }), _cardBuild(R.ASSETS_ICONS_CHANGE_PNG, '合同变更', '变更合同信息、重新签约', () {}), _cardBuild(R.ASSETS_ICONS_CONTRACT_PNG, '合同续签', '到期前线上办理续签手续', () {}), _cardBuild(R.ASSETS_ICONS_FINISH_PNG, '合同终止', '线上申请终止合同', () async { diff --git a/lib/ui/profile/house/lease_pay_query/lease_pay_query_page.dart b/lib/ui/profile/house/lease_pay_query/lease_pay_query_page.dart new file mode 100644 index 00000000..7b931f8d --- /dev/null +++ b/lib/ui/profile/house/lease_pay_query/lease_pay_query_page.dart @@ -0,0 +1,218 @@ +import 'package:aku_community/base/base_style.dart'; +import 'package:aku_community/constants/api.dart'; +import 'package:aku_community/models/house/lease_fee_list_model.dart'; +import 'package:aku_community/utils/headers.dart'; +import 'package:aku_community/utils/network/base_list_model.dart'; +import 'package:aku_community/utils/network/net_util.dart'; +import 'package:aku_community/widget/bee_divider.dart'; +import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:aku_community/widget/others/user_tool.dart'; +import 'package:flustars/flustars.dart'; +import 'package:flutter/cupertino.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'; + +class LeasePayQueryPage extends StatefulWidget { + final int id; + LeasePayQueryPage({Key? key, required this.id}) : super(key: key); + + @override + _LeasePayQueryPageState createState() => _LeasePayQueryPageState(); +} + +class _LeasePayQueryPageState extends State { + int _page = 1; + int _size = 10; + int _years = DateTime.now().year; + List _models = []; + late EasyRefreshController _controller; + @override + void initState() { + super.initState(); + _controller = EasyRefreshController(); + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + Widget header = Container( + width: double.infinity, + padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w), + height: 200.w, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage(R.ASSETS_STATIC_HOUSE_AUTH_FAIL_WEBP), + fit: BoxFit.fitWidth)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + MaterialButton( + color: Colors.white, + height: 60.w, + padding: EdgeInsets.symmetric(horizontal: 24.w), + shape: RoundedRectangleBorder( + side: BorderSide(color: Color(0xFFC4C4C4)), + borderRadius: BorderRadius.circular(30.w)), + onPressed: () async { + Get.bottomSheet(_yearsPicker()); + }, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + _years.text.size(24.sp).color(ktextSubColor).make(), + 12.widthBox, + Icon( + CupertinoIcons.arrowtriangle_down_fill, + size: 24.w, + ), + ], + ), + ), + //暂时去掉总金额 + // 26.w.heightBox, + // ' 累计缴纳 ¥${_models.length}' + // .text + // .size(24.sp) + // .color(ktextSubColor) + // .make(), + ], + ), + ); + return BeeScaffold( + title: '缴费查询', + body: Column( + children: [ + header, + EasyRefresh( + header: MaterialHeader(), + footer: MaterialFooter(), + firstRefresh: true, + controller: _controller, + onRefresh: () async { + _page = 1; + BaseListModel baseListModel = await NetUtil() + .getList(API.house.leaseFeesQuery, params: { + "pageNum": _page, + "size": _size, + "sysLeaseId": widget.id, + "years": _years + }); + _models.clear(); + _models = baseListModel.tableList! + .map((e) => LeaseFeeListModel.fromJson(e)) + .toList(); + setState(() {}); + }, + onLoad: () async { + _page++; + BaseListModel baseListModel = await NetUtil() + .getList(API.house.leaseFeesQuery, params: { + "pageNum": _page, + "size": _size, + "sysLeaseId": widget.id, + "years": _years + }); + if (baseListModel.pageCount! >= _page) { + _models.addAll(baseListModel.tableList! + .map((e) => LeaseFeeListModel.fromJson(e)) + .toList()); + setState(() {}); + } + }, + child: ListView( + padding: EdgeInsets.symmetric( + horizontal: 24.w, + vertical: 32.w, + ), + children: _models + .map((e) => _buildCard(e)) + .toList() + .sepWidget(separate: 32.w.heightBox), + ), + ).expand(), + ], + ), + ); + } + + Widget _yearsPicker() { + int _nowYear = DateTime.now().year; + List years = [ + _nowYear, + _nowYear - 1, + _nowYear - 2, + _nowYear - 3, + _nowYear - 4, + _nowYear - 5 + ]; + return CupertinoActionSheet( + title: '选择年份'.text.size(32.sp).bold.isIntrinsic.black.make(), + actions: years + .map((e) => CupertinoActionSheetAction( + onPressed: () { + _years = e; + Get.back(); + _controller.callRefresh(); + setState(() {}); + }, + child: + e.toString().text.size(28.sp).black.isIntrinsic.bold.make())) + .toList(), + ); + } + + Widget _buildCard(LeaseFeeListModel model) { + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + children: [ + model.typeString.text.size(28.sp).black.bold.make(), + Spacer(), + '${S.of(context)!.tempPlotName} ${UserTool.appProveider.selectedHouse!.roomName}' + .text + .size(24.sp) + .color(ktextSubColor) + .bold + .make(), + ], + ), + 12.w.heightBox, + GestureDetector( + onTap: () { + model.payStatus == 0 ? null : null; + }, + child: Row( + children: [ + '${DateUtil.formatDateStr(model.createDate, format: 'MM/dd HH:mm')}' + .text + .color(ktextSubColor) + .make(), + Spacer(), + model.payStatus == 0 + ? '未缴纳'.text.size(26.sp).color(Colors.red).make() + : SizedBox(), + 12.w.widthBox, + '¥ ${model.price.toStringAsFixed(2)}' + .text + .size(26.sp) + .black + .bold + .make(), + ], + ), + ), + 32.w.heightBox, + BeeDivider.horizontal(), + ], + ); + } +} diff --git a/lib/utils/network/net_util.dart b/lib/utils/network/net_util.dart index cc0125ef..b29921ae 100644 --- a/lib/utils/network/net_util.dart +++ b/lib/utils/network/net_util.dart @@ -139,14 +139,16 @@ class NetUtil { return BaseFileModel.err(); } - Future> uploadFiles(List files, String api) async { - List urls = []; + Future> uploadFiles(List files, String api) async { + List urls = []; if (files.isEmpty) { return []; } else { for (var item in files) { BaseFileModel model = await NetUtil().upload(api, item); - urls.add(model.url); + if (model.url != null) { + urls.add(model.url!); + } } }