对接信息补充页面接口

hmxc
张萌 3 years ago
parent 8e8bf2aaf2
commit a387be6b89

@ -0,0 +1,91 @@
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:aku_community/model/common/img_model.dart';
part 'lease_detail_model.g.dart';
@JsonSerializable()
class LeaseDetailModel extends Equatable {
final int id;
final String code;
final String name;
final int sex;
final String idCard;
final String roomName;
final int type;
final String estateType;
final num rentStandard;
final num margin;
final String leaseDateStart;
final String leaseDateEnd;
final List<ImgModel>? imgUrls;
final int status;
final String? reviewerName;
final String? auditDate;
final String createName;
final String? emergencyContact;
final String? emergencyContactNumber;
final String? correspondenceAddress;
final String? workUnits;
final String? payBank;
final String? bankAccountName;
final String? bankAccount;
LeaseDetailModel({
required this.id,
required this.code,
required this.name,
required this.sex,
required this.idCard,
required this.roomName,
required this.type,
required this.estateType,
required this.rentStandard,
required this.margin,
required this.leaseDateStart,
required this.leaseDateEnd,
required this.imgUrls,
required this.status,
required this.reviewerName,
required this.auditDate,
required this.createName,
required this.emergencyContact,
required this.emergencyContactNumber,
required this.correspondenceAddress,
required this.workUnits,
required this.payBank,
required this.bankAccountName,
required this.bankAccount,
});
factory LeaseDetailModel.fromJson(Map<String, dynamic> json) =>
_$LeaseDetailModelFromJson(json);
@override
List<Object?> get props {
return [
id,
code,
name,
sex,
idCard,
roomName,
type,
estateType,
rentStandard,
margin,
leaseDateStart,
leaseDateEnd,
imgUrls,
status,
reviewerName,
auditDate,
createName,
emergencyContact,
emergencyContactNumber,
correspondenceAddress,
workUnits,
payBank,
bankAccountName,
bankAccount,
];
}
}

@ -0,0 +1,38 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'lease_detail_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
LeaseDetailModel _$LeaseDetailModelFromJson(Map<String, dynamic> json) {
return LeaseDetailModel(
id: json['id'] as int,
code: json['code'] as String,
name: json['name'] as String,
sex: json['sex'] as int,
idCard: json['idCard'] as String,
roomName: json['roomName'] as String,
type: json['type'] as int,
estateType: json['estateType'] as String,
rentStandard: json['rentStandard'] as num,
margin: json['margin'] as num,
leaseDateStart: json['leaseDateStart'] as String,
leaseDateEnd: json['leaseDateEnd'] as String,
imgUrls: (json['imgUrls'] as List<dynamic>?)
?.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
status: json['status'] as int,
reviewerName: json['reviewerName'] as String?,
auditDate: json['auditDate'] as String?,
createName: json['createName'] as String,
emergencyContact: json['emergencyContact'] as String?,
emergencyContactNumber: json['emergencyContactNumber'] as String?,
correspondenceAddress: json['correspondenceAddress'] as String?,
workUnits: json['workUnits'] as String?,
payBank: json['payBank'] as String?,
bankAccountName: json['bankAccountName'] as String?,
bankAccount: json['bankAccount'] as String?,
);
}

@ -1,5 +1,6 @@
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/model/user/house_model.dart';
import 'package:aku_community/models/house/lease_detail_model.dart';
import 'package:aku_community/models/house/lease_echo_model.dart';
import 'package:aku_community/models/user/passed_house_list_model.dart';
import 'package:aku_community/utils/network/base_model.dart';
@ -54,9 +55,25 @@ class HouseFunc {
}
}
///
Future<LeaseDetailModel?> leaseDetail(int leaseId) async {
BaseModel baseModel = await NetUtil().get(API.house.leaseFindByld, params: {
"leaseId": leaseId,
});
if (baseModel.status ?? false) {
return LeaseDetailModel.fromJson(baseModel.data);
} else {
return null;
}
}
Map<String, int> getSex = {
static Map<String, int> getSex = {
'': 1,
'': 2,
};
static Map<int, String> toSex = {
1: '',
2: '',
};
}

@ -0,0 +1,196 @@
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/models/house/lease_list_model.dart';
import 'package:aku_community/ui/profile/house/contract_pay_page.dart';
import 'package:aku_community/ui/profile/house/download_contract_page.dart';
import 'package:aku_community/ui/profile/house/supplement_information_page.dart';
import 'package:aku_community/ui/profile/house/upload_contracts_page.dart';
import 'package:aku_community/widget/buttons/card_bottom_button.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community/const/resource.dart';
class LeaseHouseCard extends StatelessWidget {
final LeaseListModel model;
const LeaseHouseCard({Key? key, required this.model}) : super(key: key);
@override
Widget build(BuildContext context) {
var buttons = getButtons(model.status);
var bottom = Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end,
children: [
model.getTypeString.text.size(28.sp).color(ktextSubColor).make(),
8.w.heightBox,
model.estateType.text.size(28.sp).color(ktextSubColor).make(),
],
).expand(),
buttons
],
);
return Container(
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16.w),
gradient: LinearGradient(
colors: _getColors(1),
begin: Alignment.topLeft,
end: Alignment.bottomRight),
),
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Image.asset(
R.ASSETS_ICONS_LEASE_HOUSE_PNG,
width: 40.w,
height: 40.w,
),
16.w.widthBox,
'南宁金融人才公寓'.text.size(32.sp).color(ktextPrimary).make().expand(),
model.statusString.text
.size(32.sp)
.color(ktextPrimary)
.bold
.make(),
],
),
12.w.heightBox,
Row(
children: [
model.roomName.text
.size(40.sp)
.color(ktextPrimary)
.bold
.make()
.expand(),
],
),
56.w.heightBox,
bottom,
],
),
);
}
Row getButtons(int status) {
switch (status) {
case 1:
return Row(
children: [
CardBottomButton.yellow(
text: '填写信息',
onPressed: () {
Get.to(() => SupplementInformationPage(leaseId: model.id,));
})
],
);
case 2:
return Row(
children: [
CardBottomButton.yellow(
text: '重新填写',
onPressed: () {
Get.to(() => SupplementInformationPage(leaseId: model.id,));
}),
CardBottomButton.yellow(
text: '上传合同',
onPressed: () {
Get.to(() => UploadContractsPage());
}),
CardBottomButton.white(
text: '下载合同',
onPressed: () {
Get.to(() => DownLoadContractPage(firstRoute: false));
}),
],
);
case 3:
return Row(
children: [],
);
case 4:
return Row(
children: [
CardBottomButton.yellow(
text: '重新上传',
onPressed: () {
Get.to(() => UploadContractsPage());
}),
CardBottomButton.white(
text: '修改信息',
onPressed: () {
Get.to(() => SupplementInformationPage(leaseId: model.id,));
}),
],
);
case 5:
return Row(
children: [
CardBottomButton.yellow(
text: '去支付',
onPressed: () {
Get.to(() => ContractPayPage());
})
],
);
case 6:
return Row(
children: [
CardBottomButton.yellow(
text: '租户页面',
onPressed: () {
Get.back();
})
],
);
default:
return Row();
}
}
List<Color> _getColors(int type) {
switch (type) {
case 1:
return [
Color(0xFFFFE5D2),
Color(0xFFFFFFFF),
];
case 2:
return [
Color(0xFFFFEEBB),
Color(0xFFFFF4D2),
];
case 3:
return [
Color(0xFFFFEEBB),
Color(0xFFFFF4D2),
];
case 4:
return [
Color(0xFFFFEEBB),
Color(0xFFFFF4D2),
];
case 5:
return [
Color(0xFFFFEEBB),
Color(0xFFFFF4D2),
];
case 6:
return [
Color(0xFFFFEEBB),
Color(0xFFFFF4D2),
];
default:
return [Colors.white, Colors.white];
}
}
}

@ -1,9 +1,15 @@
import 'dart:io';
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/models/house/lease_detail_model.dart';
import 'package:aku_community/ui/profile/house/house_func.dart';
import 'package:aku_community/ui/profile/house/house_information_check_page.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/buttons/bottom_button.dart';
import 'package:aku_community/widget/others/bee_input_row.dart';
import 'package:aku_community/widget/others/user_tool.dart';
import 'package:aku_community/widget/picker/identify_card_picker.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:aku_community/extensions/widget_list_ext.dart';
@ -12,7 +18,9 @@ import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
class SupplementInformationPage extends StatefulWidget {
SupplementInformationPage({Key? key}) : super(key: key);
final int leaseId;
SupplementInformationPage({Key? key, required this.leaseId})
: super(key: key);
@override
_SupplementInformationPageState createState() =>
@ -20,19 +28,61 @@ class SupplementInformationPage extends StatefulWidget {
}
class _SupplementInformationPageState extends State<SupplementInformationPage> {
///
TextEditingController _nameController = TextEditingController();
String _sex = '请选择性别';
TextEditingController _phoneController = TextEditingController();
///
String _tel = UserTool.userProvider.userInfoModel!.tel!;
///
TextEditingController _codeController = TextEditingController();
///
TextEditingController _emergencyContactController = TextEditingController();
///
TextEditingController _emergencyPhoneController = TextEditingController();
///
TextEditingController _addressController = TextEditingController();
///
TextEditingController _workUnitController = TextEditingController();
///
TextEditingController _bankNameController = TextEditingController();
///
TextEditingController _bankCodeController = TextEditingController();
///
File? _idCardFront;
///
File? _idCardBack;
@override
void initState() {
Future.delayed(Duration(milliseconds: 300), () async {
LeaseDetailModel? model = await HouseFunc().leaseDetail(widget.leaseId);
if (model != null) {
initModel(model);
setState(() {});
}
});
super.initState();
}
@override
void dispose() {
_nameController.dispose();
_codeController.dispose();
_emergencyContactController.dispose();
_emergencyPhoneController.dispose();
_addressController.dispose();
_workUnitController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
@ -44,7 +94,7 @@ class _SupplementInformationPageState extends State<SupplementInformationPage> {
BeeInputRow(
title: '承租人',
controller: _nameController,
hintText: '杨赟',
hintText: '',
isRequire: true,
),
BeeInputRow.button(
@ -56,46 +106,90 @@ class _SupplementInformationPageState extends State<SupplementInformationPage> {
hintText: _sex,
isRequire: true,
),
BeeInputRow(
BeeInputRow.button(
title: '手机号码',
controller: _phoneController,
hintText: '13742494159',
hintText: _tel,
onPressed: () {},
isRequire: true,
),
BeeInputRow(
title: '身份证号',
controller: _codeController,
hintText: 'hintText',
hintText: '',
isRequire: true,
),
BeeInputRow(
title: '紧急联系人',
controller: _emergencyContactController,
hintText: 'hintText'),
hintText: '填写紧急联系人'),
BeeInputRow(
title: '紧急联系人电话',
controller: _emergencyPhoneController,
hintText: 'hintText'),
hintText: '填写紧急联系人电话'),
BeeInputRow(
title: '通讯地址(含诉讼送达地址)',
controller: _addressController,
hintText: 'hintText'),
hintText: '填写地址'),
BeeInputRow(
title: '工作单位',
controller: _workUnitController,
hintText: 'hintText'),
IdentifyCardPicker.front((file) => () {}),
IdentifyCardPicker.back((file) => () {}),
hintText: '填写工作单位'),
BeeInputRow(
title: '代缴银行',
controller: _bankNameController,
hintText: '填写代缴银行'),
BeeInputRow(
title: '代缴银行账户',
controller: _bankCodeController,
hintText: '填写代缴银行账户'),
IdentifyCardPicker.front((file) => () {
_idCardFront = file;
}),
IdentifyCardPicker.back((file) => () {
_idCardBack = file;
}),
].sepWidget(separate: 24.w.heightBox),
),
bottomNavi: BottomButton(
onPressed: () {
if (canSubmit) {
Get.to(() => HouseInformationCheckPage());
}
},
child: '下一步'.text.size(32.sp).bold.color(ktextPrimary).make()),
);
}
//model,
initModel(LeaseDetailModel? model) {
if (model != null) {
_nameController.text = model.name;
_sex = HouseFunc.toSex[model.sex]!;
_codeController.text = model.idCard;
if (!model.emergencyContact.isEmptyOrNull) {
_emergencyContactController.text = model.emergencyContact!;
}
if (!model.emergencyContactNumber.isEmptyOrNull) {
_emergencyPhoneController.text = model.emergencyContactNumber!;
}
if (!model.bankAccountName.isEmptyOrNull) {
_bankNameController.text = model.bankAccountName!;
}
if (!model.bankAccount.isEmptyOrNull) {
_bankCodeController.text = model.bankAccount!;
}
if (!model.workUnits.isEmptyOrNull) {
_workUnitController.text = model.workUnits!;
}
if (!model.correspondenceAddress.isEmptyOrNull) {
_addressController.text = model.correspondenceAddress!;
}
}
}
Widget _sexBottomSheet() {
return CupertinoActionSheet(
title:
@ -119,4 +213,55 @@ class _SupplementInformationPageState extends State<SupplementInformationPage> {
],
);
}
bool get canSubmit {
if (_nameController.text.isEmpty) {
BotToast.showText(text: '姓名不能为空!');
return false;
}
if (_codeController.text.isEmpty) {
BotToast.showText(text: '身份证号码不能为空!');
return false;
}
if (_sex == '请选择性别') {
BotToast.showText(text: '请先选择性别');
return false;
}
if (_addressController.text.isEmpty) {
BotToast.showText(text: '请填写地址');
return false;
}
if (_bankNameController.text.isEmpty) {
BotToast.showText(text: '请填写代缴银行名称');
return false;
}
if (_bankCodeController.text.isEmpty) {
BotToast.showText(text: '请填写代缴银行账户');
return false;
}
if (_addressController.text.isEmpty) {
BotToast.showText(text: '请填写地址');
return false;
}
if (_workUnitController.text.isEmpty) {
BotToast.showText(text: '请填写单位名称');
}
if (_emergencyContactController.text.isEmpty) {
BotToast.showText(text: '请填写紧急联系人');
return false;
}
if (_emergencyPhoneController.text.isEmpty) {
BotToast.showText(text: '请填写紧急联系人电话');
return false;
}
if (_idCardFront == null) {
BotToast.showText(text: '请选择身份证正面照片');
return false;
}
if (_idCardBack == null) {
BotToast.showText(text: '请选择身份证背面照片');
return false;
}
return true;
}
}

@ -1,18 +1,11 @@
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/const/resource.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/models/house/lease_list_model.dart';
import 'package:aku_community/pages/things_page/widget/bee_list_view.dart';
import 'package:aku_community/ui/profile/house/contract_pay_page.dart';
import 'package:aku_community/ui/profile/house/download_contract_page.dart';
import 'package:aku_community/ui/profile/house/supplement_information_page.dart';
import 'package:aku_community/ui/profile/house/upload_contracts_page.dart';
import 'package:aku_community/ui/profile/house/lease_house_card.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/buttons/card_bottom_button.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 TenantHouseListPage extends StatefulWidget {
@ -23,7 +16,6 @@ class TenantHouseListPage extends StatefulWidget {
}
class _TenantHouseListPageState extends State<TenantHouseListPage> {
bool _onload = true;
late EasyRefreshController _refreshController;
@override
void initState() {
@ -41,21 +33,6 @@ class _TenantHouseListPageState extends State<TenantHouseListPage> {
Widget build(BuildContext context) {
return BeeScaffold(
title: '可选房屋',
// body: EasyRefresh(
// firstRefresh: true,
// header: MaterialHeader(),
// controller: _refreshController,
// onRefresh: () async {
// _onload = false;
// setState(() {});
// },
// child: _onload
// ? Container()
// : ListView(
// padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
// children: [houseCard()],
// ),
// ),
body: BeeListView(
path: API.house.leaseList,
controller: _refreshController,
@ -68,7 +45,7 @@ class _TenantHouseListPageState extends State<TenantHouseListPage> {
return ListView.separated(
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
itemBuilder: (context, index) {
return houseCard(items[index]);
return LeaseHouseCard(model:items[index]);
},
separatorBuilder: (_, __) {
return 24.w.heightBox;
@ -78,175 +55,5 @@ class _TenantHouseListPageState extends State<TenantHouseListPage> {
);
}
List<Color> _getColors(int type) {
switch (type) {
case 1:
return [
Color(0xFFFFE5D2),
Color(0xFFFFFFFF),
];
case 2:
return [
Color(0xFFFFEEBB),
Color(0xFFFFF4D2),
];
case 3:
return [
Color(0xFFFFEEBB),
Color(0xFFFFF4D2),
];
case 4:
return [
Color(0xFFFFEEBB),
Color(0xFFFFF4D2),
];
case 5:
return [
Color(0xFFFFEEBB),
Color(0xFFFFF4D2),
];
case 6:
return [
Color(0xFFFFEEBB),
Color(0xFFFFF4D2),
];
default:
return [Colors.white, Colors.white];
}
}
Widget houseCard(LeaseListModel model) {
var buttons = getButtons(model.status);
var bottom = Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end,
children: [
model.getTypeString.text.size(28.sp).color(ktextSubColor).make(),
8.w.heightBox,
model.estateType.text.size(28.sp).color(ktextSubColor).make(),
],
).expand(),
buttons
],
);
return Container(
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16.w),
gradient: LinearGradient(
colors: _getColors(1),
begin: Alignment.topLeft,
end: Alignment.bottomRight),
),
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Image.asset(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
width: 40.w,
height: 40.w,
),
16.w.widthBox,
'南宁金融人才公寓'.text.size(32.sp).color(ktextPrimary).make().expand(),
model.statusString.text
.size(32.sp)
.color(ktextPrimary)
.bold
.make(),
],
),
12.w.heightBox,
Row(
children: [
model.roomName.text
.size(40.sp)
.color(ktextPrimary)
.bold
.make()
.expand(),
],
),
56.w.heightBox,
bottom,
],
),
);
}
Row getButtons(int status) {
switch (status) {
case 1:
return Row(
children: [
CardBottomButton.yellow(
text: '填写信息',
onPressed: () {
Get.to(() => SupplementInformationPage());
})
],
);
case 2:
return Row(
children: [
CardBottomButton.yellow(
text: '上传合同',
onPressed: () {
Get.to(() => UploadContractsPage());
}),
CardBottomButton.white(
text: '下载合同',
onPressed: () {
Get.to(() => DownLoadContractPage(firstRoute: false));
}),
],
);
case 3:
return Row(
children: [],
);
case 4:
return Row(
children: [
CardBottomButton.yellow(
text: '重新上传',
onPressed: () {
Get.to(() => UploadContractsPage());
}),
CardBottomButton.white(
text: '修改信息',
onPressed: () {
Get.to(() => SupplementInformationPage());
}),
],
);
case 5:
return Row(
children: [
CardBottomButton.yellow(
text: '去支付',
onPressed: () {
Get.to(() => ContractPayPage());
})
],
);
case 6:
return Row(
children: [
CardBottomButton.yellow(
text: '租户页面',
onPressed: () {
Get.back();
})
],
);
default:
return Row();
}
}
}

@ -36,16 +36,7 @@ class _UserIdentifyPageState extends State<UserIdentifyPage> {
_nameController.text = _model.name!;
}
if (_model.sex != null) {
switch (_model.sex) {
case 1:
_sex = '';
break;
case 2:
_sex = '';
break;
default:
break;
}
HouseFunc.toSex[_model.sex];
}
if (_model.tel.isNotEmpty) {
_tel = _model.tel;

@ -10,7 +10,7 @@ class SignNameBoard extends StatefulWidget {
SignatureController _signatureController = SignatureController(
penColor: Colors.black,
penStrokeWidth: 5.w,
exportBackgroundColor: Colors.white,
exportBackgroundColor: Colors.transparent,
);
return await navigator!.push(
PageRouteBuilder(

@ -16,7 +16,7 @@ class IdentifyCardPicker extends StatefulWidget {
24.w.heightBox,
IdentifyCardPicker(
onChange: onChange,
path: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
path: R.ASSETS_STATIC_ID_CARD_FRONT_PNG,
)
],
);
@ -29,7 +29,7 @@ class IdentifyCardPicker extends StatefulWidget {
'上传身份证背面'.text.size(28.sp).color(ktextPrimary).make(),
24.w.heightBox,
IdentifyCardPicker(
onChange: onChange, path: R.ASSETS_IMAGES_PLACEHOLDER_WEBP)
onChange: onChange, path: R.ASSETS_STATIC_ID_CARD_BACK_PNG)
],
);
}
@ -50,8 +50,10 @@ class _IdentifyCardPickerState extends State<IdentifyCardPicker> {
return GestureDetector(
onTap: () async {
_file = await BeeImagePicker.pick(title: '选择身份证照片');
if (_file != null) {
setState(() {});
widget.onChange(_file);
}
},
child: Container(
width: 350.w,

Loading…
Cancel
Save