添加缴费查询页面

修改上传腾空单可为多个文件
hmxc
张萌 3 years ago
parent 0e0945a006
commit 28d94c170f

@ -503,4 +503,7 @@ class _House {
///-退 ///-退
String get refundApplication => '/user/myHouse/depositRefundApplication'; String get refundApplication => '/user/myHouse/depositRefundApplication';
///-
String get leaseFeesQuery => '/user/myHouse/findLeaseRentList';
} }

@ -6,12 +6,13 @@
import 'package:device_info_plus_web/device_info_plus_web.dart'; import 'package:device_info_plus_web/device_info_plus_web.dart';
import 'package:firebase_core_web/firebase_core_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:image_picker_for_web/image_picker_for_web.dart';
import 'package:package_info_plus_web/package_info_plus_web.dart'; import 'package:package_info_plus_web/package_info_plus_web.dart';
import 'package:shared_preferences_web/shared_preferences_web.dart'; import 'package:shared_preferences_web/shared_preferences_web.dart';
import 'package:url_launcher_web/url_launcher_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 // ignore: public_member_api_docs
void registerPlugins(Registrar registrar) { void registerPlugins(Registrar registrar) {
DeviceInfoPlusPlugin.registerWith(registrar); DeviceInfoPlusPlugin.registerWith(registrar);

@ -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<String, dynamic> json) =>
_$LeaseFeeListModelFromJson(json);
@override
List<Object> 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 '未知';
}
}
}

@ -0,0 +1,17 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'lease_fee_list_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
LeaseFeeListModel _$LeaseFeeListModelFromJson(Map<String, dynamic> 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,
);
}

@ -1,11 +1,14 @@
import 'dart:io'; import 'dart:io';
import 'package:aku_community/widget/views/doc_view.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:flustars/flustars.dart'; import 'package:flustars/flustars.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:open_file/open_file.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community/base/base_style.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/upload_widget.dart';
import 'package:aku_community/widget/others/user_tool.dart'; import 'package:aku_community/widget/others/user_tool.dart';
import 'package:aku_community/widget/picker/bee_date_picker.dart'; import 'package:aku_community/widget/picker/bee_date_picker.dart';
import 'package:aku_community/extensions/widget_list_ext.dart';
class UploadEmptyListPage extends StatefulWidget { class UploadEmptyListPage extends StatefulWidget {
UploadEmptyListPage({Key? key}) : super(key: key); UploadEmptyListPage({Key? key}) : super(key: key);
@ -26,7 +30,7 @@ class UploadEmptyListPage extends StatefulWidget {
} }
class _UploadEmptyListPageState extends State<UploadEmptyListPage> { class _UploadEmptyListPageState extends State<UploadEmptyListPage> {
File? _file; List<File> _files = [];
List<String> _urls = []; List<String> _urls = [];
int get sysLeaseId => UserTool.appProveider.selectedHouse!.sysLeaseId ?? 0; int get sysLeaseId => UserTool.appProveider.selectedHouse!.sysLeaseId ?? 0;
DateTime? _date = DateTime.now(); DateTime? _date = DateTime.now();
@ -64,19 +68,39 @@ class _UploadEmptyListPageState extends State<UploadEmptyListPage> {
40.w.heightBox, 40.w.heightBox,
'上传腾空单'.text.size(28.sp).color(ktextPrimary).make(), '上传腾空单'.text.size(28.sp).color(ktextPrimary).make(),
24.w.heightBox, 24.w.heightBox,
_file != null UploadWidget(
? Image.file( sheetTitle: '上传腾空单',
_file!, onPicked: (file) {
width: 480.w, _files.add(file);
height: 480.w, setState(() {});
fit: BoxFit.cover, }),
) 64.w.heightBox,
: UploadWidget( Padding(
sheetTitle: '上传腾空单', padding: EdgeInsets.symmetric(horizontal: 60.w),
onPicked: (file) { child: Column(
_file = file; crossAxisAlignment: CrossAxisAlignment.center,
setState(() {}); children: <Widget>[
}), ..._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<UploadEmptyListPage> {
bottomNavi: BottomButton( bottomNavi: BottomButton(
onPressed: () async { onPressed: () async {
Function cancel = BotToast.showLoading(); Function cancel = BotToast.showLoading();
if (_file != null) { if (_files.isNotEmpty) {
_urls.add(await HouseFunc().uploadClearingSingle(_file!)); _urls.addAll(await HouseFunc().uploadClearingSingle(_files));
} else { } else {
BotToast.showText(text: '请先选择腾空单'); BotToast.showText(text: '请先选择腾空单');
} }
@ -104,4 +128,22 @@ class _UploadEmptyListPageState extends State<UploadEmptyListPage> {
child: '提交审核'.text.size(32.sp).bold.color(ktextPrimary).make()), 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())
],
);
}
} }

@ -186,14 +186,10 @@ class HouseFunc {
} }
/// ///
Future<String> uploadClearingSingle(File file) async { Future<List<String>> uploadClearingSingle(List<File> files) async {
BaseFileModel baseFileModel = List<String> urls =
await NetUtil().upload(API.upload.uploadClearingSingle, file); await NetUtil().uploadFiles(files, API.upload.uploadClearingSingle);
if (baseFileModel.status ?? false) { return urls;
return baseFileModel.url!;
} else {
return '';
}
} }
/// ///

@ -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:flutter/material.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
@ -206,7 +207,9 @@ class _HouseOwnersPageState extends State<HouseOwnersPage> {
mainAxisSpacing: 32.w, mainAxisSpacing: 32.w,
crossAxisSpacing: 32.w, crossAxisSpacing: 32.w,
children: [ 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_CHANGE_PNG, '合同变更', '变更合同信息、重新签约', () {}),
_cardBuild(R.ASSETS_ICONS_CONTRACT_PNG, '合同续签', '到期前线上办理续签手续', () {}), _cardBuild(R.ASSETS_ICONS_CONTRACT_PNG, '合同续签', '到期前线上办理续签手续', () {}),
_cardBuild(R.ASSETS_ICONS_FINISH_PNG, '合同终止', '线上申请终止合同', () async { _cardBuild(R.ASSETS_ICONS_FINISH_PNG, '合同终止', '线上申请终止合同', () async {

@ -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<LeasePayQueryPage> {
int _page = 1;
int _size = 10;
int _years = DateTime.now().year;
List<LeaseFeeListModel> _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<int> 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(),
],
);
}
}

@ -139,14 +139,16 @@ class NetUtil {
return BaseFileModel.err(); return BaseFileModel.err();
} }
Future<List<String?>> uploadFiles(List<File> files, String api) async { Future<List<String>> uploadFiles(List<File> files, String api) async {
List<String?> urls = []; List<String> urls = [];
if (files.isEmpty) { if (files.isEmpty) {
return []; return [];
} else { } else {
for (var item in files) { for (var item in files) {
BaseFileModel model = await NetUtil().upload(api, item); BaseFileModel model = await NetUtil().upload(api, item);
urls.add(model.url); if (model.url != null) {
urls.add(model.url!);
}
} }
} }

Loading…
Cancel
Save