diff --git a/lib/constants/api.dart b/lib/constants/api.dart index e5208a8e..3e817404 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -498,6 +498,9 @@ class _Pay { ///支付宝支付:房屋租赁-租金账单支付 向支付宝发起订单查询请求 String get leaseRentBillOrderCheck => '/user/alipay/leaseRentBillOrderCheckAlipay'; + + ///我的房屋-合同终止:app 房屋租赁-剩余需结清租金支付(当剩余需结清租金 小于等于 0 时调用): + String get leaseRentOrderNegative => '/user/myHouse/leaseRentOrderAlipay'; } class _House { diff --git a/lib/pages/life_pay/life_pay_page.dart b/lib/pages/life_pay/life_pay_page.dart index c6df3b71..90372392 100644 --- a/lib/pages/life_pay/life_pay_page.dart +++ b/lib/pages/life_pay/life_pay_page.dart @@ -1,3 +1,4 @@ +import 'package:aku_community/pages/life_pay/life_pre_pay_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -163,7 +164,6 @@ class _LifePayPageState extends State { GestureDetector( onTap: () async { if (_selectYears.contains(index)) {} - dynamic payMent = await (Get.to(() => LifePayDetailPage( model: _models[index], selectModel: _selectModels[index], @@ -209,7 +209,7 @@ class _LifePayPageState extends State { bool result = await PayUtil() .callAliPay(baseModel.message!, API.pay.dailPayMentCheck); if (result) { - Get.off(()=>PayFinishPage()); + Get.off(() => PayFinishPage()); } } cancel(); @@ -218,6 +218,42 @@ class _LifePayPageState extends State { ); } + Widget _buildPrePayment() { + return Container( + padding: EdgeInsets.symmetric(vertical: 32.w, horizontal: 32.w), + width: double.infinity, + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + '当前预缴'.text.size(28.sp).color(ktextSubColor).make(), + 30.w.heightBox, + Row( + children: [ + '¥'.text.size(28.sp).black.make(), + 16.w.widthBox, + '2300'.text.size(40.sp).black.bold.make(), + Spacer(), + MaterialButton( + elevation: 0, + height: 50.w, + padding: EdgeInsets.symmetric(vertical: 8.w, horizontal: 25.w), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(24.w), + side: BorderSide(color: Color(0xFF979797), width: 1.w)), + color: Colors.white, + onPressed: () { + Get.to(() => LifePrePayPage()); + }, + child: '预缴充值'.text.size(28.sp).black.make(), + ) + ], + ), + ], + ), + ); + } + @override Widget build(BuildContext context) { final appProvider = Provider.of(context); @@ -269,6 +305,8 @@ class _LifePayPageState extends State { }, context: context), 16.w.heightBox, + _buildPrePayment(), + 16.w.heightBox, Container( padding: EdgeInsets.all(32.w), width: double.infinity, diff --git a/lib/pages/life_pay/life_pre_pay_page.dart b/lib/pages/life_pay/life_pre_pay_page.dart new file mode 100644 index 00000000..8188b735 --- /dev/null +++ b/lib/pages/life_pay/life_pre_pay_page.dart @@ -0,0 +1,148 @@ +import 'package:aku_community/base/base_style.dart'; +import 'package:aku_community/widget/bee_divider.dart'; +import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:aku_community/widget/bottom_sheets/pay_mothod_bottom_sheet.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/house_head_card.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:aku_community/utils/headers.dart'; +import 'package:flutter/services.dart'; +import 'package:get/get.dart'; + +class LifePrePayPage extends StatefulWidget { + LifePrePayPage({Key? key}) : super(key: key); + + @override + _LifePrePayPageState createState() => _LifePrePayPageState(); +} + +class _LifePrePayPageState extends State { + late TextEditingController _editingController; + String _payMethod = '支付宝'; + @override + void initState() { + super.initState(); + _editingController = TextEditingController(); + } + + @override + void dispose() { + _editingController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '预缴充值', + body: ListView( + children: [ + HouseHeadCard(context: context), + 16.w.heightBox, + Container( + padding: EdgeInsets.symmetric(vertical: 32.w, horizontal: 32.w), + width: double.infinity, + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + '预缴金额'.text.size(28.sp).black.make(), + 30.w.heightBox, + Row( + children: [ + '¥'.text.size(28.sp).black.bold.make(), + 16.w.widthBox, + TextField( + controller: _editingController, + decoration: InputDecoration( + hintText: '0.0', + hintStyle: TextStyle( + fontSize: 56.sp, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + border: InputBorder.none, + isDense: true, + contentPadding: EdgeInsets.zero, + ), + style: TextStyle( + fontSize: 56.sp, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + inputFormatters: [FilteringTextInputFormatter.digitsOnly], + keyboardType: TextInputType.number, + ).expand(), + ], + ), + 16.w.heightBox, + BeeDivider.horizontal(), + 16.w.heightBox, + '当前房屋下的预缴金额为 ' + .richText + .withTextSpanChildren([ + '2300' + .textSpan + .bold + .size(28.sp) + .color(kPrimaryColor) + .make(), + ' 元'.textSpan.size(28.sp).black.make() + ]) + .black + .size(28.sp) + .make(), + 16.w.heightBox, + '当账单到期时,将会自动从当前房屋下的预缴金额中扣除相应费用。' + .text + .size(24.sp) + .color(ktextSubColor) + .make(), + ], + ), + ), + 16.w.heightBox, + // Container( + // width: double.infinity, + // color: Colors.white, + // padding: EdgeInsets.symmetric(vertical: 32.w, horizontal: 32.w), + // child: Row( + // children: [ + // '缴费方式'.text.size(28.sp).black.make(), + // Spacer(), + // TextButton( + // onPressed: () async { + // Get.bottomSheet(PayMethodBottomSheet(onChoose: (value) { + // _paymethod = value; + // Get.back(); + // setState(() {}); + // })); + // }, + // child: _paymethod.text.size(28.sp).black.make()), + // 24.w.widthBox, + // Icon( + // CupertinoIcons.chevron_right, + // size: 40.w, + // ), + // ], + // ), + // ), + BeeInputRow.button( + title: '支付方式', + hintText: _payMethod, + onPressed: () { + Get.bottomSheet(PayMethodBottomSheet(onChoose: (value) { + _payMethod = value; + Get.back(); + setState(() {}); + })); + }), + ], + ), + bottomNavi: BottomButton( + onPressed: () {}, child: '立即充值'.text.size(32.sp).bold.black.make()), + ); + } +} diff --git a/lib/ui/manager/house_keeping/house_keeping_detail_page.dart b/lib/ui/manager/house_keeping/house_keeping_detail_page.dart index 28c0d116..395241ba 100644 --- a/lib/ui/manager/house_keeping/house_keeping_detail_page.dart +++ b/lib/ui/manager/house_keeping/house_keeping_detail_page.dart @@ -72,7 +72,9 @@ class _HouseKeepingDetailPageState extends State { _buildEvaluate(), ], ), - ) + ), + // 40.w.heightBox, + // _background(), ], ), bottomNavi: _getBottomButton(), @@ -290,4 +292,92 @@ class _HouseKeepingDetailPageState extends State { ), ); } + + // int _airPlane = 1; + // int _train = 2; + // int _xxx = 3; + // int _select = 1; + + // Widget _background() { + // return Center( + // child: Container( + // width: 600.w, + // height: 600.w, + // decoration: BoxDecoration( + // color: Colors.transparent, + // borderRadius: BorderRadius.circular(16.w)), + // child: Column( + // children: [ + // Row( + // children: [ + // _header( + // _airPlane, + // _select, + // 'aaa', + // 'left' + // ).expand(), + // _header(_train, _select, 'bbb', 'mid').expand(), + // _header(_xxx, _select, 'ccc', 'right').expand(), + // ], + // ), + // Container( + // width: double.infinity, + // alignment: Alignment.center, + // child: 'xxxxxxxx'.text.size(36.sp).black.make(), + // color: Colors.white, + // ).expand(), + // ], + // ), + // ), + // ); + // } + + // Widget _header(int value, int selectValue, String title, String position) { + // bool isSelect = value == selectValue; + // return Column( + // children: [ + // isSelect + // ? Container( + // height: 40.w, + // decoration: BoxDecoration( + // color: Colors.white, + // borderRadius: BorderRadius.only( + // topLeft: position == 'left' + // ? Radius.zero + // : Radius.circular(20.w), + // topRight: position == 'right' + // ? Radius.zero + // : Radius.circular(20.w))), + // ) + // : Container(height: 40.w, color: Colors.transparent), + // isSelect + // ? Container( + // height: 120.w, + // alignment: Alignment.center, + // width: double.infinity, + // child: title.text.size(32.sp).red500.make(), + // color: Colors.white, + // ) + // : GestureDetector( + // onTap: () { + // _select = value; + // setState(() {}); + // }, + // child: Container( + // height: 120.w, + // width: double.infinity, + // alignment: Alignment.center, + // child: title.text.size(30.sp).black.make(), + // decoration: BoxDecoration( + // color: Colors.pinkAccent, + // borderRadius: BorderRadius.only( + // topLeft:!(position=='right')? Radius.circular(16.w):Radius.zero, + // topRight: !(position=='left')?Radius.circular(16.w):Radius.zero, + // bottomLeft: !(position=='left')?Radius.circular(16.w):Radius.zero, + // bottomRight:!(position=='right')?Radius.circular(16.w):Radius.zero)), + // ), + // ), + // ], + // ); + // } } diff --git a/lib/ui/profile/house/contract_stop/pay_surplus_rent_page.dart b/lib/ui/profile/house/contract_stop/pay_surplus_rent_page.dart index 677eddb9..25d3ecba 100644 --- a/lib/ui/profile/house/contract_stop/pay_surplus_rent_page.dart +++ b/lib/ui/profile/house/contract_stop/pay_surplus_rent_page.dart @@ -79,7 +79,7 @@ class _PaySuerplusRentPageState extends State { onPressed: () async { Function cancel = BotToast.showLoading(); try { - if (widget.amount <= 0) { + if (widget.amount > 0) { String code = await HouseFunc() .leaseRentOrder(widget.id, 1, widget.amount.toDouble()); bool result = @@ -88,13 +88,26 @@ class _PaySuerplusRentPageState extends State { Get.back(); Get.off(() => PayFinishPage()); } - } else {} + } else { + bool result = await HouseFunc().leaseRentOrderNegative( + widget.id, widget.amount.toDouble()); + if (result) { + Get.back(); + Get.back(); + BotToast.showText(text: '退款成功'); + } + } } catch (e) { LoggerData.addData(e); } cancel(); }, - child: '点击支付'.text.size(32.sp).color(ktextPrimary).bold.make()), + child: '${widget.amount > 0 ? '点击支付' : '点击退款'}' + .text + .size(32.sp) + .color(ktextPrimary) + .bold + .make()), ); } } diff --git a/lib/ui/profile/house/contract_stop/refund_bond_page.dart b/lib/ui/profile/house/contract_stop/refund_bond_page.dart index a122a83f..aed9db5c 100644 --- a/lib/ui/profile/house/contract_stop/refund_bond_page.dart +++ b/lib/ui/profile/house/contract_stop/refund_bond_page.dart @@ -11,6 +11,7 @@ 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'; import 'package:aku_community/widget/others/house_head_card.dart'; +import 'package:aku_community/extensions/widget_list_ext.dart'; class RefundBondPage extends StatefulWidget { final String name; @@ -48,7 +49,7 @@ class _RefundBondPageState extends State { onPressed: () {}), BeeInputRow.button( title: '保证金缴纳时间', hintText: widget.date, onPressed: () {}), - ], + ].sepWidget(separate: 24.w.heightBox), ).paddingSymmetric(horizontal: 32.w) ], ), diff --git a/lib/ui/profile/house/contract_stop/refund_bond_result_page.dart b/lib/ui/profile/house/contract_stop/refund_bond_result_page.dart index e0e53413..df6c0eee 100644 --- a/lib/ui/profile/house/contract_stop/refund_bond_result_page.dart +++ b/lib/ui/profile/house/contract_stop/refund_bond_result_page.dart @@ -74,7 +74,7 @@ class _RefundBondResultPageState extends State { id: widget.id)); }, child: - '申请保证金退还'.text.color(ktextPrimary).size(36.sp).make(), + '重新申请'.text.color(ktextPrimary).size(36.sp).make(), ) : SizedBox(), ], diff --git a/lib/ui/profile/house/house_func.dart b/lib/ui/profile/house/house_func.dart index f953cf78..056be86f 100644 --- a/lib/ui/profile/house/house_func.dart +++ b/lib/ui/profile/house/house_func.dart @@ -221,6 +221,16 @@ class HouseFunc { } } + ///我的房屋-合同终止:app 房屋租赁-剩余需结清租金支付(当剩余需结清租金 小于等于 0 时调用): + Future leaseRentOrderNegative(int id, double price) async { + BaseModel baseModel = + await NetUtil().post(API.pay.leaseRentOrderNegative, params: { + "sysLeaseId": id, + "payPrice": price, + }); + return baseModel.status ?? false; + } + ///我的房屋-合同终止:保证金退还申请 Future refundBond(int id) async { BaseModel baseModel = diff --git a/lib/ui/profile/house/house_owners_page.dart b/lib/ui/profile/house/house_owners_page.dart index 7ae15a97..15eb1fa1 100644 --- a/lib/ui/profile/house/house_owners_page.dart +++ b/lib/ui/profile/house/house_owners_page.dart @@ -243,7 +243,7 @@ class _HouseOwnersPageState extends State { Get.to(() => PayResultPage( name: model.name, bond: model.margin.toDouble(), - date: DateUtil.formatDateStr(model.marginPayDate!), + date: DateUtil.formatDateStr(model.marginPayDate??''), id: model.id, )); break; @@ -254,7 +254,7 @@ class _HouseOwnersPageState extends State { status: model.status, name: model.name, bond: model.margin.toDouble(), - date: DateUtil.formatDateStr(model.marginPayDate!), + date: DateUtil.formatDateStr(model.marginPayDate??''), id: model.id, )); break;