diff --git a/lib/constants/api.dart b/lib/constants/api.dart index afd64b48..b28202ac 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -469,4 +469,8 @@ class _House { ///我的房屋:提交个人租赁信息 String get submitLeaseInfo => '/user/myHouse/submitPersonalLeaseInfo'; + + ///我的房屋:生成合同 + String get generateContract => '/user/myHouse/generateValidContract'; + } diff --git a/lib/ui/profile/house/contract_preview_page.dart b/lib/ui/profile/house/contract_preview_page.dart index 870b99c3..681dfa5c 100644 --- a/lib/ui/profile/house/contract_preview_page.dart +++ b/lib/ui/profile/house/contract_preview_page.dart @@ -18,7 +18,9 @@ import 'package:velocity_x/velocity_x.dart'; class ContractPreviewPage extends StatefulWidget { final String url; - ContractPreviewPage({Key? key, required this.url}) : super(key: key); + final int id; + ContractPreviewPage({Key? key, required this.url, required this.id}) + : super(key: key); @override _ContractPreviewPageState createState() => _ContractPreviewPageState(); @@ -75,8 +77,10 @@ class _ContractPreviewPageState extends State { if (_signFile != null) { Function cancel = BotToast.showLoading(); String result = await HouseFunc().uploadSignName(_signFile!); + String path = await HouseFunc() + .generateContract(widget.id, widget.url, result); Get.off(() => DownLoadContractPage( - path: result, + path: path, )); cancel(); } else { diff --git a/lib/ui/profile/house/house_func.dart b/lib/ui/profile/house/house_func.dart index 50568c86..e997cc67 100644 --- a/lib/ui/profile/house/house_func.dart +++ b/lib/ui/profile/house/house_func.dart @@ -126,6 +126,22 @@ class HouseFunc { } } + ///生成正式合同 + Future generateContract(int id, String pUrl, String url) async { + BaseModel baseModel = + await NetUtil().post(API.house.generateContract, params: { + "id": id, + "ContractPreviewImgUrl": pUrl, + "contractSignatureImgUrl": url, + }); + + if (baseModel.status ?? false) { + return baseModel.data; + } else { + return ''; + } + } + static Map getSex = { '男': 1, '女': 2, diff --git a/lib/ui/profile/house/house_information_check_page.dart b/lib/ui/profile/house/house_information_check_page.dart index d9f25310..99374b82 100644 --- a/lib/ui/profile/house/house_information_check_page.dart +++ b/lib/ui/profile/house/house_information_check_page.dart @@ -65,6 +65,7 @@ class _HouseInformationCheckPageState extends State { if (result.isNotEmpty) { Get.back(); Get.off(() => ContractPreviewPage( + id: widget.detailModel.id, url: result, )); }