diff --git a/lib/ui/profile/house/contract_pay_page.dart b/lib/ui/profile/house/contract_pay_page.dart index 1065c20b..28d090ea 100644 --- a/lib/ui/profile/house/contract_pay_page.dart +++ b/lib/ui/profile/house/contract_pay_page.dart @@ -1,5 +1,6 @@ import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/constants/api.dart'; +import 'package:aku_community/models/house/lease_detail_model.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'; @@ -23,20 +24,25 @@ class ContractPayPage extends StatefulWidget { } class _ContractPayPageState extends State { - late TextEditingController _contractCodeController; - late TextEditingController _payTotalController; + String _contractCode = ''; + num _payTotal = 0; + LeaseDetailModel? _model; String _payMethod = '选择支付方式'; @override void initState() { super.initState(); - _contractCodeController = TextEditingController(); - _payTotalController = TextEditingController(); + Future.delayed(Duration(milliseconds: 300), () async { + _model = (await HouseFunc().leaseDetail(widget.id)); + if (_model != null) { + _contractCode = _model!.code; + _payTotal = _model!.margin; + } + setState(() {}); + }); } @override void dispose() { - _contractCodeController.dispose(); - _payTotalController.dispose(); super.dispose(); } @@ -47,16 +53,16 @@ class _ContractPayPageState extends State { body: ListView( padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), children: [ - BeeInputRow( - controller: _contractCodeController, - hintText: '请填写合同编号', + BeeInputRow.button( + onPressed: () {}, + hintText: _contractCode, title: '合同编号', isRequire: true, ), - BeeInputRow( + BeeInputRow.button( title: '保证金金额(元)', - controller: _payTotalController, - hintText: '填写保证金金额'), + onPressed: () {}, + hintText: _payTotal.toStringAsFixed(2)), BeeInputRow.button( title: '支付方式', hintText: _payMethod, diff --git a/lib/ui/profile/house/contract_preview_page.dart b/lib/ui/profile/house/contract_preview_page.dart index 3f715585..736636fc 100644 --- a/lib/ui/profile/house/contract_preview_page.dart +++ b/lib/ui/profile/house/contract_preview_page.dart @@ -14,6 +14,7 @@ import 'package:dotted_border/dotted_border.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 ContractPreviewPage extends StatefulWidget { @@ -76,13 +77,17 @@ class _ContractPreviewPageState extends State { onPressed: () async { 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: path, - id: widget.id, - )); + try { + String result = await HouseFunc().uploadSignName(_signFile!); + String path = await HouseFunc() + .generateContract(widget.id, widget.url, result); + Get.off(() => DownLoadContractPage( + path: path, + id: widget.id, + )); + } catch (e) { + LoggerData.addData(e); + } cancel(); } else { BotToast.showText(text: '请先签名!'); diff --git a/lib/ui/profile/house/upload_contracts_page.dart b/lib/ui/profile/house/upload_contracts_page.dart index 4c66e741..97ba372d 100644 --- a/lib/ui/profile/house/upload_contracts_page.dart +++ b/lib/ui/profile/house/upload_contracts_page.dart @@ -101,8 +101,11 @@ class _UploadContractsPageState extends State { bool result = await HouseFunc().submitFormalContract(widget.id, _urls); if (result) { - Get.to(() => ContractPayPage(id: widget.id,)); + Get.to(() => ContractPayPage( + id: widget.id, + )); } + cancel(); }, child: '提交审核'.text.size(32.sp).color(ktextPrimary).bold.make()), );