对接 上传合同

对接 支付接口
hmxc
张萌 3 years ago
parent 20678c59ca
commit 86700747fb

@ -386,6 +386,9 @@ class _Upload {
/// ///
String get uploadSignName => '/user/upload/uploadLeaseContractSignaturePhoto'; String get uploadSignName => '/user/upload/uploadLeaseContractSignaturePhoto';
///pdf
String get uploadFormalContract => '/user/upload/uploadLeaseContractValidPdf';
} }
class _Message { class _Message {
@ -452,6 +455,12 @@ class _Pay {
/// ///
String get reportReapirCheck => '/user/alipay/reportRepairCheckAlipay'; String get reportReapirCheck => '/user/alipay/reportRepairCheckAlipay';
///app ()
String get leaseAlipay => '/user/alipay/leaseAlipay';
///
String get leaseCheckAlipay => '/user/alipay/leaseCheckAlipay';
} }
class _House { class _House {
@ -472,5 +481,7 @@ class _House {
/// ///
String get generateContract => '/user/myHouse/generateValidContract'; String get generateContract => '/user/myHouse/generateValidContract';
///
String get submitFormalContract => '/user/myHouse/submitAudit';
} }

@ -1,6 +1,8 @@
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
import 'package:aku_community/model/common/img_model.dart'; import 'package:aku_community/model/common/img_model.dart';
part 'lease_detail_model.g.dart'; part 'lease_detail_model.g.dart';
@JsonSerializable() @JsonSerializable()
@ -13,6 +15,9 @@ class LeaseDetailModel extends Equatable {
final String roomName; final String roomName;
final int type; final int type;
final String estateType; final String estateType;
final String estateStructure;
final num constructionArea;
final num indoorArea;
final num rentStandard; final num rentStandard;
final num margin; final num margin;
final String leaseDateStart; final String leaseDateStart;
@ -38,6 +43,9 @@ class LeaseDetailModel extends Equatable {
required this.roomName, required this.roomName,
required this.type, required this.type,
required this.estateType, required this.estateType,
required this.estateStructure,
required this.constructionArea,
required this.indoorArea,
required this.rentStandard, required this.rentStandard,
required this.margin, required this.margin,
required this.leaseDateStart, required this.leaseDateStart,
@ -87,5 +95,4 @@ class LeaseDetailModel extends Equatable {
bankAccount, bankAccount,
]; ];
} }
} }

@ -16,6 +16,9 @@ LeaseDetailModel _$LeaseDetailModelFromJson(Map<String, dynamic> json) {
roomName: json['roomName'] as String, roomName: json['roomName'] as String,
type: json['type'] as int, type: json['type'] as int,
estateType: json['estateType'] as String, estateType: json['estateType'] as String,
estateStructure: json['estateStructure'] as String,
constructionArea: json['constructionArea'] as num,
indoorArea: json['indoorArea'] as num,
rentStandard: json['rentStandard'] as num, rentStandard: json['rentStandard'] as num,
margin: json['margin'] as num, margin: json['margin'] as num,
leaseDateStart: json['leaseDateStart'] as String, leaseDateStart: json['leaseDateStart'] as String,

@ -51,14 +51,14 @@ class PayUtil {
String _resultStatus = ''; String _resultStatus = '';
/// ///
Future<bool> callAliPay(String order, String path) async { Future<bool> callAliPay(String order, String apiPath) async {
Map<dynamic, dynamic> result = await aliPay(order); Map<dynamic, dynamic> result = await aliPay(order);
_resultStatus = result['resultStatus']; _resultStatus = result['resultStatus'];
if (_resultStatus == '9000') { if (_resultStatus == '9000') {
String _res = result['result']; String _res = result['result'];
PayModel _model = PayModel.fromJson(jsonDecode(_res)); PayModel _model = PayModel.fromJson(jsonDecode(_res));
bool _confirmResult = await _confirmPayResult( bool _confirmResult = await _confirmPayResult(
path, _model.aliPayTradeAppPayResponse.outTradeNo); apiPath, _model.aliPayTradeAppPayResponse.outTradeNo);
return _confirmResult; return _confirmResult;
} else { } else {
resultSatus(_resultStatus); resultSatus(_resultStatus);

@ -1,5 +1,8 @@
import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/pages/life_pay/pay_finish_page.dart'; import 'package:aku_community/pages/life_pay/pay_finish_page.dart';
import 'package:aku_community/pages/life_pay/pay_util.dart';
import 'package:aku_community/ui/profile/house/house_func.dart';
import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/buttons/bottom_button.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/bee_input_row.dart';
@ -11,7 +14,9 @@ import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community/extensions/widget_list_ext.dart'; import 'package:aku_community/extensions/widget_list_ext.dart';
class ContractPayPage extends StatefulWidget { class ContractPayPage extends StatefulWidget {
ContractPayPage({Key? key}) : super(key: key); final int id;
ContractPayPage({Key? key, required this.id}) : super(key: key);
@override @override
_ContractPayPageState createState() => _ContractPayPageState(); _ContractPayPageState createState() => _ContractPayPageState();
@ -64,8 +69,13 @@ class _ContractPayPageState extends State<ContractPayPage> {
), ),
bottomNavi: BottomButton( bottomNavi: BottomButton(
child: '点击支付'.text.size(32.sp).bold.color(ktextPrimary).make(), child: '点击支付'.text.size(32.sp).bold.color(ktextPrimary).make(),
onPressed: () { onPressed: () async {
Get.off(() => PayFinishPage()); String code = await HouseFunc().leaseAlipay(widget.id, 1, 0.01);
bool result =
await PayUtil().callAliPay(code, API.pay.leaseCheckAlipay);
if (result) {
Get.off(() => PayFinishPage());
}
}, },
), ),
); );

@ -81,6 +81,7 @@ class _ContractPreviewPageState extends State<ContractPreviewPage> {
.generateContract(widget.id, widget.url, result); .generateContract(widget.id, widget.url, result);
Get.off(() => DownLoadContractPage( Get.off(() => DownLoadContractPage(
path: path, path: path,
id: widget.id,
)); ));
cancel(); cancel();
} else { } else {

@ -11,9 +11,11 @@ import 'package:velocity_x/velocity_x.dart';
class DownLoadContractPage extends StatefulWidget { class DownLoadContractPage extends StatefulWidget {
final String path; final String path;
final int id;
DownLoadContractPage({ DownLoadContractPage({
Key? key, Key? key,
required this.path, required this.path,
required this.id,
}) : super(key: key); }) : super(key: key);
@override @override
@ -66,7 +68,9 @@ class _DownLoadContractPageState extends State<DownLoadContractPage> {
elevation: 0, elevation: 0,
color: kPrimaryColor, color: kPrimaryColor,
onPressed: () { onPressed: () {
Get.to(() => UploadContractsPage()); Get.to(() => UploadContractsPage(
id: widget.id,
));
}, },
child: child:
'上传文件'.text.size(32.sp).bold.color(ktextPrimary).make(), '上传文件'.text.size(32.sp).bold.color(ktextPrimary).make(),

@ -96,7 +96,7 @@ class HouseFunc {
/// ///
Future<String> submitLeaseInfo(SubmitModel model) async { Future<String> submitLeaseInfo(SubmitModel model) async {
BaseModel baseModel = BaseModel baseModel =
await NetUtil().get(API.house.submitLeaseInfo, params: { await NetUtil().post(API.house.submitLeaseInfo, params: {
"id": model.id, "id": model.id,
"emergencyContact": model.emergencyContact, "emergencyContact": model.emergencyContact,
"emergencyContactNumber": model.emergencyContactNumber, "emergencyContactNumber": model.emergencyContactNumber,
@ -126,7 +126,7 @@ class HouseFunc {
} }
} }
/// ///
Future<String> generateContract(int id, String pUrl, String url) async { Future<String> generateContract(int id, String pUrl, String url) async {
BaseModel baseModel = BaseModel baseModel =
await NetUtil().post(API.house.generateContract, params: { await NetUtil().post(API.house.generateContract, params: {
@ -142,6 +142,43 @@ class HouseFunc {
} }
} }
///
Future<String> uploadFormalContract(File file) async {
BaseFileModel baseModel =
await NetUtil().upload(API.upload.uploadFormalContract, file);
if (baseModel.status ?? false) {
return baseModel.url!;
} else {
return '';
}
}
///
Future<bool> submitFormalContract(int id, List<String> urls) async {
BaseModel baseModel =
await NetUtil().post(API.house.submitFormalContract, params: {
"id": id,
"leaseContractValidPdfUrl": urls,
});
return baseModel.status!;
}
///
///1
///12 3 4pos
Future<String> leaseAlipay(int id, int type, double price) async {
BaseModel baseModel = await NetUtil().post(API.pay.leaseAlipay, params: {
"sysLeaseId": id,
"payType": 1,
"payPrice": price,
});
if (baseModel.status ?? false) {
return baseModel.message!;
} else {
return '';
}
}
static Map<String, int> getSex = { static Map<String, int> getSex = {
'': 1, '': 1,
'': 2, '': 2,

@ -46,9 +46,10 @@ class _HouseInformationCheckPageState extends State<HouseInformationCheckPage> {
_houseHead(), _houseHead(),
_textTile('认定人才类型', HouseFunc.toType[widget.detailModel.type]!), _textTile('认定人才类型', HouseFunc.toType[widget.detailModel.type]!),
_textTile('房屋户型', widget.detailModel.estateType), _textTile('房屋户型', widget.detailModel.estateType),
_textTile('房屋结构', '两房两卫一厅'), _textTile('房屋结构', widget.detailModel.estateStructure),
_textTile('建筑面积', '90平米'), _textTile(
_textTile('使用面积', '78平米'), '建筑面积', widget.detailModel.constructionArea.toStringAsFixed(2)),
_textTile('使用面积', widget.detailModel.indoorArea.toStringAsFixed(2)),
_textTile('租赁期限', _textTile('租赁期限',
'${widget.detailModel.leaseDateStart}————${widget.detailModel.leaseDateEnd}'), '${widget.detailModel.leaseDateStart}————${widget.detailModel.leaseDateEnd}'),
].sepWidget(separate: 24.w.heightBox), ].sepWidget(separate: 24.w.heightBox),
@ -59,13 +60,13 @@ class _HouseInformationCheckPageState extends State<HouseInformationCheckPage> {
try { try {
_submitModel.idCardFrontImgUrl.add(await HouseFunc() _submitModel.idCardFrontImgUrl.add(await HouseFunc()
.uploadIdCardFront(_submitModel.idCardFrontFile!)); .uploadIdCardFront(_submitModel.idCardFrontFile!));
_submitModel.idCardFrontImgUrl.add(await HouseFunc() _submitModel.idCardBackImgUrl.add(await HouseFunc()
.uploadIdCardBack(_submitModel.idCardBackFile!)); .uploadIdCardBack(_submitModel.idCardBackFile!));
String result = await HouseFunc().submitLeaseInfo(_submitModel); String result = await HouseFunc().submitLeaseInfo(_submitModel);
if (result.isNotEmpty) { if (result.isNotEmpty) {
Get.back(); Get.back();
Get.off(() => ContractPreviewPage( Get.off(() => ContractPreviewPage(
id: widget.detailModel.id, id: widget.detailModel.id,
url: result, url: result,
)); ));
} }

@ -104,7 +104,7 @@ class LeaseHouseCard extends StatelessWidget {
CardBottomButton.yellow( CardBottomButton.yellow(
text: '上传合同', text: '上传合同',
onPressed: () { onPressed: () {
Get.to(() => UploadContractsPage()); Get.to(() => UploadContractsPage(id: model.id,));
}), }),
CardBottomButton.white( CardBottomButton.white(
text: '下载合同', text: '下载合同',
@ -129,7 +129,7 @@ class LeaseHouseCard extends StatelessWidget {
CardBottomButton.yellow( CardBottomButton.yellow(
text: '重新上传', text: '重新上传',
onPressed: () { onPressed: () {
Get.to(() => UploadContractsPage()); Get.to(() => UploadContractsPage(id: model.id,));
}), }),
CardBottomButton.white( CardBottomButton.white(
text: '修改信息', text: '修改信息',
@ -144,7 +144,7 @@ class LeaseHouseCard extends StatelessWidget {
CardBottomButton.yellow( CardBottomButton.yellow(
text: '去支付', text: '去支付',
onPressed: () { onPressed: () {
Get.to(() => ContractPayPage()); Get.to(() => ContractPayPage(id: model.id,));
}) })
], ],
); );

@ -144,12 +144,14 @@ class _SupplementInformationPageState extends State<SupplementInformationPage> {
title: '代缴银行账户', title: '代缴银行账户',
controller: _bankCodeController, controller: _bankCodeController,
hintText: '填写代缴银行账户'), hintText: '填写代缴银行账户'),
IdentifyCardPicker.front((file) => () { IdentifyCardPicker.front((file) {
_idCardFront = file; _idCardFront = file;
}), setState(() {});
IdentifyCardPicker.back((file) => () { }),
_idCardBack = file; IdentifyCardPicker.back((file) {
}), _idCardBack = file;
setState(() {});
}),
].sepWidget(separate: 24.w.heightBox), ].sepWidget(separate: 24.w.heightBox),
), ),
bottomNavi: BottomButton( bottomNavi: BottomButton(

@ -3,10 +3,12 @@ import 'dart:io';
import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/painters/upload_painter.dart'; import 'package:aku_community/painters/upload_painter.dart';
import 'package:aku_community/ui/profile/house/contract_pay_page.dart'; import 'package:aku_community/ui/profile/house/contract_pay_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/bee_scaffold.dart';
import 'package:aku_community/widget/buttons/bottom_button.dart'; import 'package:aku_community/widget/buttons/bottom_button.dart';
import 'package:aku_community/widget/picker/bee_image_picker.dart'; import 'package:aku_community/widget/picker/bee_image_picker.dart';
import 'package:aku_community/widget/views/doc_view.dart'; import 'package:aku_community/widget/views/doc_view.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:dotted_border/dotted_border.dart'; import 'package:dotted_border/dotted_border.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -17,7 +19,8 @@ import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community/extensions/widget_list_ext.dart'; import 'package:aku_community/extensions/widget_list_ext.dart';
class UploadContractsPage extends StatefulWidget { class UploadContractsPage extends StatefulWidget {
UploadContractsPage({Key? key}) : super(key: key); final int id;
UploadContractsPage({Key? key, required this.id}) : super(key: key);
@override @override
_UploadContractsPageState createState() => _UploadContractsPageState(); _UploadContractsPageState createState() => _UploadContractsPageState();
@ -25,6 +28,7 @@ class UploadContractsPage extends StatefulWidget {
class _UploadContractsPageState extends State<UploadContractsPage> { class _UploadContractsPageState extends State<UploadContractsPage> {
List<File> _files = []; List<File> _files = [];
List<String> _urls = [];
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BeeScaffold( return BeeScaffold(
@ -86,8 +90,19 @@ class _UploadContractsPageState extends State<UploadContractsPage> {
], ],
), ),
bottomNavi: BottomButton( bottomNavi: BottomButton(
onPressed: () { onPressed: () async {
Get.to(() => ContractPayPage()); Function cancel = BotToast.showLoading();
await _files.map((e) async {
String result = await HouseFunc().uploadFormalContract(e);
if (result.isNotEmpty) {
_urls.add(result);
}
});
bool result =
await HouseFunc().submitFormalContract(widget.id, _urls);
if (result) {
Get.to(() => ContractPayPage(id: widget.id,));
}
}, },
child: '提交审核'.text.size(32.sp).color(ktextPrimary).bold.make()), child: '提交审核'.text.size(32.sp).color(ktextPrimary).bold.make()),
); );

@ -51,7 +51,6 @@ class _IdentifyCardPickerState extends State<IdentifyCardPicker> {
onTap: () async { onTap: () async {
_file = await BeeImagePicker.pick(title: '选择身份证照片'); _file = await BeeImagePicker.pick(title: '选择身份证照片');
if (_file != null) { if (_file != null) {
setState(() {});
widget.onChange(_file); widget.onChange(_file);
} }
}, },

Loading…
Cancel
Save