对接 上传合同

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

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

@ -1,6 +1,8 @@
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()
@ -13,6 +15,9 @@ class LeaseDetailModel extends Equatable {
final String roomName;
final int type;
final String estateType;
final String estateStructure;
final num constructionArea;
final num indoorArea;
final num rentStandard;
final num margin;
final String leaseDateStart;
@ -38,6 +43,9 @@ class LeaseDetailModel extends Equatable {
required this.roomName,
required this.type,
required this.estateType,
required this.estateStructure,
required this.constructionArea,
required this.indoorArea,
required this.rentStandard,
required this.margin,
required this.leaseDateStart,
@ -87,5 +95,4 @@ class LeaseDetailModel extends Equatable {
bankAccount,
];
}
}

@ -16,6 +16,9 @@ LeaseDetailModel _$LeaseDetailModelFromJson(Map<String, dynamic> json) {
roomName: json['roomName'] as String,
type: json['type'] as int,
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,
margin: json['margin'] as num,
leaseDateStart: json['leaseDateStart'] as String,

@ -51,14 +51,14 @@ class PayUtil {
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);
_resultStatus = result['resultStatus'];
if (_resultStatus == '9000') {
String _res = result['result'];
PayModel _model = PayModel.fromJson(jsonDecode(_res));
bool _confirmResult = await _confirmPayResult(
path, _model.aliPayTradeAppPayResponse.outTradeNo);
apiPath, _model.aliPayTradeAppPayResponse.outTradeNo);
return _confirmResult;
} else {
resultSatus(_resultStatus);

@ -1,5 +1,8 @@
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_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/buttons/bottom_button.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';
class ContractPayPage extends StatefulWidget {
ContractPayPage({Key? key}) : super(key: key);
final int id;
ContractPayPage({Key? key, required this.id}) : super(key: key);
@override
_ContractPayPageState createState() => _ContractPayPageState();
@ -64,8 +69,13 @@ class _ContractPayPageState extends State<ContractPayPage> {
),
bottomNavi: BottomButton(
child: '点击支付'.text.size(32.sp).bold.color(ktextPrimary).make(),
onPressed: () {
Get.off(() => PayFinishPage());
onPressed: () async {
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);
Get.off(() => DownLoadContractPage(
path: path,
id: widget.id,
));
cancel();
} else {

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

@ -96,7 +96,7 @@ class HouseFunc {
///
Future<String> submitLeaseInfo(SubmitModel model) async {
BaseModel baseModel =
await NetUtil().get(API.house.submitLeaseInfo, params: {
await NetUtil().post(API.house.submitLeaseInfo, params: {
"id": model.id,
"emergencyContact": model.emergencyContact,
"emergencyContactNumber": model.emergencyContactNumber,
@ -126,7 +126,7 @@ class HouseFunc {
}
}
///
///
Future<String> generateContract(int id, String pUrl, String url) async {
BaseModel baseModel =
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 = {
'': 1,
'': 2,

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

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

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

@ -3,10 +3,12 @@ import 'dart:io';
import 'package:aku_community/base/base_style.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/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/picker/bee_image_picker.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:flutter/cupertino.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';
class UploadContractsPage extends StatefulWidget {
UploadContractsPage({Key? key}) : super(key: key);
final int id;
UploadContractsPage({Key? key, required this.id}) : super(key: key);
@override
_UploadContractsPageState createState() => _UploadContractsPageState();
@ -25,6 +28,7 @@ class UploadContractsPage extends StatefulWidget {
class _UploadContractsPageState extends State<UploadContractsPage> {
List<File> _files = [];
List<String> _urls = [];
@override
Widget build(BuildContext context) {
return BeeScaffold(
@ -86,8 +90,19 @@ class _UploadContractsPageState extends State<UploadContractsPage> {
],
),
bottomNavi: BottomButton(
onPressed: () {
Get.to(() => ContractPayPage());
onPressed: () async {
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()),
);

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

Loading…
Cancel
Save