对接身份证照片上传

对接生成合同预览
对接签名照片上传
对接 正式合同生成
对接 合同下载
hmxc
张萌 3 years ago
parent a387be6b89
commit 9d920e246b

@ -383,6 +383,9 @@ class _Upload {
///
String get uploadCardBack => '/user/upload/uploadAppIdCardBack';
///
String get uploadSignName => '/user/upload/uploadLeaseContractSignaturePhoto';
}
class _Message {

@ -0,0 +1,44 @@
import 'dart:io';
class SubmitModel {
int id;
String emergencyContact;
String emergencyContactNumber;
String correspondenceAddress;
String workUnits;
String payBank;
String bankAccountName;
String bankAccount;
List<String> idCardFrontImgUrl;
List<String> idCardBackImgUrl;
File? idCardFrontFile;
File? idCardBackFile;
SubmitModel({
required this.id,
required this.emergencyContact,
required this.emergencyContactNumber,
required this.correspondenceAddress,
required this.workUnits,
required this.payBank,
required this.bankAccountName,
required this.bankAccount,
required this.idCardFrontImgUrl,
required this.idCardBackImgUrl,
required this.idCardFrontFile,
required this.idCardBackFile,
});
factory SubmitModel.init() => SubmitModel(
id: 0,
emergencyContact: '',
emergencyContactNumber: '',
correspondenceAddress: '',
workUnits: '',
payBank: '',
bankAccountName: '',
bankAccount: '',
idCardFrontImgUrl: [],
idCardBackImgUrl: [], idCardBackFile: null, idCardFrontFile: null);
}

@ -3,10 +3,13 @@ import 'dart:typed_data';
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/ui/profile/house/download_contract_page.dart';
import 'package:aku_community/ui/profile/house/house_func.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/buttons/bottom_button.dart';
import 'package:aku_community/widget/others/sign_name_board.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:dotted_border/dotted_border.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -14,7 +17,8 @@ import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
class ContractPreviewPage extends StatefulWidget {
ContractPreviewPage({Key? key}) : super(key: key);
final String url;
ContractPreviewPage({Key? key, required this.url}) : super(key: key);
@override
_ContractPreviewPageState createState() => _ContractPreviewPageState();
@ -56,7 +60,7 @@ class _ContractPreviewPageState extends State<ContractPreviewPage> {
children: [
FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: 'image'),
image: API.image(widget.url)),
Positioned(
right: 70.w,
bottom: 200.w,
@ -67,8 +71,17 @@ class _ContractPreviewPageState extends State<ContractPreviewPage> {
],
),
bottomNavi: BottomButton(
onPressed: () {
Get.off(() => DownLoadContractPage(firstRoute: true));
onPressed: () async {
if (_signFile != null) {
Function cancel = BotToast.showLoading();
String result = await HouseFunc().uploadSignName(_signFile!);
Get.off(() => DownLoadContractPage(
path: result,
));
cancel();
} else {
BotToast.showText(text: '请先签名!');
}
},
child: '生成合同'.text.size(32.sp).color(ktextPrimary).make()),
);

@ -2,14 +2,19 @@ import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/ui/profile/house/upload_contracts_page.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/others/finish_result_image.dart';
import 'package:aku_community/widget/views/%20bee_download_view.dart';
import 'package:flutter/material.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';
class DownLoadContractPage extends StatefulWidget {
final bool firstRoute;
DownLoadContractPage({Key? key, required this.firstRoute}) : super(key: key);
final String path;
DownLoadContractPage({
Key? key,
required this.path,
}) : super(key: key);
@override
_DownLoadContractPageState createState() => _DownLoadContractPageState();
@ -26,11 +31,7 @@ class _DownLoadContractPageState extends State<DownLoadContractPage> {
80.w.heightBox,
FinishResultImage(status: true),
48.w.heightBox,
'${widget.firstRoute ? '生成成功' : '合同已生成'}'
.text
.size(36.sp)
.color(ktextPrimary)
.make(),
'${'生成成功'}'.text.size(36.sp).color(ktextPrimary).make(),
24.w.heightBox,
'请下载合同'.text.size(26.sp).color(ktextSubColor).make(),
'完善信息并盖章后再上传合同'.text.size(26.sp).color(ktextSubColor).make(),
@ -48,7 +49,12 @@ class _DownLoadContractPageState extends State<DownLoadContractPage> {
side: BorderSide(color: Color(0xFF666666), width: 1.w)),
padding:
EdgeInsets.symmetric(vertical: 16.w, horizontal: 78.w),
onPressed: () {},
onPressed: () async {
String? result = await Get.dialog(BeeDownloadView(
file: widget.path,
));
if (result != null) OpenFile.open(result);
},
child:
'下载合同'.text.size(32.sp).bold.color(ktextPrimary).make(),
),

@ -1,8 +1,12 @@
import 'dart:io';
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/house/submit_model.dart';
import 'package:aku_community/models/user/passed_house_list_model.dart';
import 'package:aku_community/utils/network/base_file_model.dart';
import 'package:aku_community/utils/network/base_model.dart';
import 'package:aku_community/utils/network/net_util.dart';
import 'package:bot_toast/bot_toast.dart';
@ -67,6 +71,61 @@ class HouseFunc {
}
}
///
Future<String> uploadIdCardFront(File file) async {
BaseFileModel baseFileModel =
await NetUtil().upload(API.upload.uploadCardFront, file);
if (baseFileModel.status ?? false) {
return baseFileModel.url!;
} else {
return '';
}
}
///
Future<String> uploadIdCardBack(File file) async {
BaseFileModel baseFileModel =
await NetUtil().upload(API.upload.uploadCardBack, file);
if (baseFileModel.status ?? false) {
return baseFileModel.url!;
} else {
return '';
}
}
///
Future<String> submitLeaseInfo(SubmitModel model) async {
BaseModel baseModel =
await NetUtil().get(API.house.submitLeaseInfo, params: {
"id": model.id,
"emergencyContact": model.emergencyContact,
"emergencyContactNumber": model.emergencyContactNumber,
"correspondenceAddress": model.correspondenceAddress,
"workUnits": model.workUnits,
"payBank": model.payBank,
"bankAccountName": model.bankAccountName,
"bankAccount": model.bankAccount,
"idCardFrontImgUrl": model.idCardFrontImgUrl,
"idCardBackImgUrl": model.idCardBackImgUrl,
});
if (baseModel.status ?? false) {
return baseModel.data;
} else {
return '';
}
}
///
Future<String> uploadSignName(File file) async {
BaseFileModel baseFileModel =
await NetUtil().upload(API.upload.uploadSignName, file);
if (baseFileModel.status ?? false) {
return baseFileModel.url!;
} else {
return '';
}
}
static Map<String, int> getSex = {
'': 1,
'': 2,
@ -76,4 +135,6 @@ class HouseFunc {
1: '',
2: '',
};
static Map<int, String> toType = {1: '一类人才', 2: '二类人才', 3: '三类人才'};
}

@ -1,17 +1,26 @@
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/const/resource.dart';
import 'package:aku_community/models/house/lease_detail_model.dart';
import 'package:aku_community/models/house/submit_model.dart';
import 'package:aku_community/ui/profile/house/contract_preview_page.dart';
import 'package:aku_community/ui/profile/house/house_func.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/widget/bee_divider.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/buttons/bottom_button.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:power_logger/power_logger.dart';
import 'package:velocity_x/velocity_x.dart';
class HouseInformationCheckPage extends StatefulWidget {
HouseInformationCheckPage({Key? key}) : super(key: key);
final SubmitModel submitModel;
final LeaseDetailModel detailModel;
HouseInformationCheckPage(
{Key? key, required this.submitModel, required this.detailModel})
: super(key: key);
@override
_HouseInformationCheckPageState createState() =>
@ -19,6 +28,13 @@ class HouseInformationCheckPage extends StatefulWidget {
}
class _HouseInformationCheckPageState extends State<HouseInformationCheckPage> {
late SubmitModel _submitModel;
@override
void initState() {
super.initState();
_submitModel = widget.submitModel;
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
@ -28,18 +44,34 @@ class _HouseInformationCheckPageState extends State<HouseInformationCheckPage> {
padding: EdgeInsets.only(bottom: 24.w, left: 32.w, right: 32.w),
children: [
_houseHead(),
_textTile('认定人才类型', '二类人才'),
_textTile('房屋户型', 'B座C1户型'),
_textTile('认定人才类型', HouseFunc.toType[widget.detailModel.type]!),
_textTile('房屋户型', widget.detailModel.estateType),
_textTile('房屋结构', '两房两卫一厅'),
_textTile('建筑面积', '90平米'),
_textTile('使用面积', '78平米'),
_textTile('租赁期限', '2020-10-26 ———— 2023-10-25'),
_textTile('租赁期限',
'${widget.detailModel.leaseDateStart}————${widget.detailModel.leaseDateEnd}'),
].sepWidget(separate: 24.w.heightBox),
),
bottomNavi: BottomButton(
onPressed: () {
onPressed: () async {
Function cancel = BotToast.showLoading();
try {
_submitModel.idCardFrontImgUrl.add(await HouseFunc()
.uploadIdCardFront(_submitModel.idCardFrontFile!));
_submitModel.idCardFrontImgUrl.add(await HouseFunc()
.uploadIdCardBack(_submitModel.idCardBackFile!));
String result = await HouseFunc().submitLeaseInfo(_submitModel);
if (result.isNotEmpty) {
Get.back();
Get.off(() => ContractPreviewPage());
Get.off(() => ContractPreviewPage(
url: result,
));
}
} catch (e) {
LoggerData.addData(e);
}
cancel();
},
child: '确认'.text.size(32.sp).bold.color(ktextPrimary).make(),
),
@ -90,9 +122,7 @@ class _HouseInformationCheckPageState extends State<HouseInformationCheckPage> {
.bold
.make(),
10.w.heightBox,
'appProvider.selectedHouse!'
.text
.black
widget.detailModel.roomName.text.black
.size(32.sp)
.bold
.make()

@ -2,9 +2,9 @@
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/utils/headers.dart';
import 'package:aku_community/widget/buttons/card_bottom_button.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@ -55,7 +55,7 @@ class LeaseHouseCard extends StatelessWidget {
height: 40.w,
),
16.w.widthBox,
'南宁金融人才公寓'.text.size(32.sp).color(ktextPrimary).make().expand(),
S.of(context)!.tempPlotName.text.size(32.sp).color(ktextPrimary).make().expand(),
model.statusString.text
.size(32.sp)
.color(ktextPrimary)
@ -108,8 +108,13 @@ class LeaseHouseCard extends StatelessWidget {
}),
CardBottomButton.white(
text: '下载合同',
onPressed: () {
Get.to(() => DownLoadContractPage(firstRoute: false));
onPressed: () async{
//TODO:
// String? result = await Get.dialog(BeeDownloadView(
// file:
// ));
// if (result != null) OpenFile.open(result);
}),
],
);

@ -2,6 +2,7 @@ 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/models/house/submit_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';
@ -58,16 +59,17 @@ class _SupplementInformationPageState extends State<SupplementInformationPage> {
///
File? _idCardFront;
///
File? _idCardBack;
SubmitModel _submitModel = SubmitModel.init();
LeaseDetailModel? _model;
@override
void initState() {
Future.delayed(Duration(milliseconds: 300), () async {
LeaseDetailModel? model = await HouseFunc().leaseDetail(widget.leaseId);
if (model != null) {
initModel(model);
_model = await HouseFunc().leaseDetail(widget.leaseId);
initHinText(_model);
setState(() {});
}
});
super.initState();
}
@ -153,17 +155,34 @@ class _SupplementInformationPageState extends State<SupplementInformationPage> {
bottomNavi: BottomButton(
onPressed: () {
if (canSubmit) {
Get.to(() => HouseInformationCheckPage());
updateSubmitModel();
Get.to(() => HouseInformationCheckPage(
submitModel: _submitModel,
detailModel: _model!,
));
}
},
child: '下一步'.text.size(32.sp).bold.color(ktextPrimary).make()),
);
}
//model
updateSubmitModel() {
_submitModel.bankAccountName = _nameController.text;
_submitModel.emergencyContact = _emergencyContactController.text;
_submitModel.emergencyContactNumber = _emergencyPhoneController.text;
_submitModel.correspondenceAddress = _addressController.text;
_submitModel.workUnits = _workUnitController.text;
_submitModel.payBank = _bankNameController.text;
_submitModel.bankAccount = _bankCodeController.text;
_submitModel.idCardFrontFile = _idCardFront;
_submitModel.idCardBackFile = _idCardBack;
}
//model,
initModel(LeaseDetailModel? model) {
initHinText(LeaseDetailModel? model) {
if (model != null) {
_submitModel.id = model.id;
_nameController.text = model.name;
_sex = HouseFunc.toSex[model.sex]!;
_codeController.text = model.idCard;
@ -188,8 +207,6 @@ class _SupplementInformationPageState extends State<SupplementInformationPage> {
}
}
Widget _sexBottomSheet() {
return CupertinoActionSheet(
title:

@ -226,6 +226,7 @@ class _UserIdentifyPageState extends State<UserIdentifyPage> {
onPressed: () {
// Get.back();
// Get.back();
//TODO:
Get.to(() => TenantHouseListPage());
},
child: '回到首页'

Loading…
Cancel
Save