From 215df782faf278d7b33b672246a40335bd74d435 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Wed, 14 Jul 2021 15:59:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E6=88=BF=E5=B1=8B-=E7=BC=B4?= =?UTF-8?q?=E8=B4=B9=E6=9F=A5=E8=AF=A2-=E7=A7=9F=E9=87=91=E7=BC=B4?= =?UTF-8?q?=E7=BA=B3=20=E9=A1=B5=E9=9D=A2=E5=AE=8C=E6=88=90=20=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5=E5=85=B6=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/constants/api.dart | 7 + lib/models/house/lease_fee_list_model.dart | 3 + lib/ui/profile/house/house_func.dart | 13 ++ .../lease_pay_query_detail_page.dart | 179 ++++++++++++++++++ .../lease_pay_query/lease_pay_query_page.dart | 53 +++--- .../lease_relevation/contract_pay_page.dart | 22 ++- 6 files changed, 245 insertions(+), 32 deletions(-) create mode 100644 lib/ui/profile/house/lease_pay_query/lease_pay_query_detail_page.dart diff --git a/lib/constants/api.dart b/lib/constants/api.dart index 8b124a2b..bf59cc20 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -484,6 +484,13 @@ class _Pay { ///支付宝支付:房屋租赁-剩余需结清房租支付 向支付宝发起订单查询请求 String get leaseRentCheck => '/user/alipay/leaseRentOrderCheckAlipay'; + + ///支付宝支付:app 房屋租赁-租金账单支付 完成订单支付宝支付(生成 APP 支付订单信息) + String get leaseRentBillorder => '/user/alipay/leaseRentBillOrderAlipay'; + + ///支付宝支付:房屋租赁-租金账单支付 向支付宝发起订单查询请求 + String get leaseRentBillOrderCheck => + '/user/alipay/leaseRentBillOrderCheckAlipay'; } class _House { diff --git a/lib/models/house/lease_fee_list_model.dart b/lib/models/house/lease_fee_list_model.dart index 1ef1ac67..b01ba06c 100644 --- a/lib/models/house/lease_fee_list_model.dart +++ b/lib/models/house/lease_fee_list_model.dart @@ -1,4 +1,5 @@ import 'package:equatable/equatable.dart'; +import 'package:flustars/flustars.dart'; import 'package:json_annotation/json_annotation.dart'; part 'lease_fee_list_model.g.dart'; @@ -54,4 +55,6 @@ class LeaseFeeListModel extends Equatable { return '未知'; } } + + DateTime get createDateTime => DateUtil.getDateTime(this.createDate)!; } diff --git a/lib/ui/profile/house/house_func.dart b/lib/ui/profile/house/house_func.dart index 172954dd..f953cf78 100644 --- a/lib/ui/profile/house/house_func.dart +++ b/lib/ui/profile/house/house_func.dart @@ -234,6 +234,19 @@ class HouseFunc { } } + ///支付宝支付:app 房屋租赁-租金账单支付 完成订单支付宝支付(生成 APP 支付订单信息) + ///支付方式暂写死为1 + ///支付方式:1.支付宝 2.微信 3.现金 4.pos + Future leaseRentBillOrder(int id, int type, double price) async { + BaseModel baseModel = await NetUtil().post(API.pay.leaseRentBillorder, + params: {"sysLeaseRentId": id, "payType": type, "payPrice": price}); + if (baseModel.status ?? false) { + return baseModel.message!; + } else { + return ''; + } + } + static Map getSex = { '男': 1, '女': 2, diff --git a/lib/ui/profile/house/lease_pay_query/lease_pay_query_detail_page.dart b/lib/ui/profile/house/lease_pay_query/lease_pay_query_detail_page.dart new file mode 100644 index 00000000..ad4257fe --- /dev/null +++ b/lib/ui/profile/house/lease_pay_query/lease_pay_query_detail_page.dart @@ -0,0 +1,179 @@ +import 'package:aku_community/base/base_style.dart'; +import 'package:aku_community/constants/api.dart'; +import 'package:aku_community/models/house/lease_fee_list_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'; +import 'package:aku_community/widget/bee_divider.dart'; +import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:aku_community/widget/buttons/bottom_button.dart'; +import 'package:aku_community/widget/others/user_tool.dart'; +import 'package:bot_toast/bot_toast.dart'; +import 'package:flustars/flustars.dart'; +import 'package:flutter/material.dart'; +import 'package:aku_community/utils/headers.dart'; +import 'package:get/get.dart'; +import 'package:power_logger/power_logger.dart'; + +class LeasePayQueryDetailPage extends StatefulWidget { + final LeaseFeeListModel model; + LeasePayQueryDetailPage({Key? key, required this.model}) : super(key: key); + + @override + _LeasePayQueryDetailPageState createState() => + _LeasePayQueryDetailPageState(); +} + +class _LeasePayQueryDetailPageState extends State { + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '缴费详情', + bodyColor: Colors.white, + body: Center( + child: Column( + children: [ + 72.w.heightBox, + widget.model.price.text.size(48.sp).bold.black.make(), + 16.w.heightBox, + widget.model.payStatusString.text + .size(32.sp) + .color(widget.model.payStatus == 0 ? Colors.red : Colors.black) + .bold + .make(), + 80.w.heightBox, + _buildInfo(), + Offstage( + offstage: widget.model.payStatus == 0, + child: _buildFinishInfo(), + ) + ], + ), + ), + bottomNavi: Offstage( + offstage: widget.model.payStatus != 0, + child: BottomButton( + onPressed: () async { + Function cancel = BotToast.showLoading(); + bool result = false; + try { + String code = await HouseFunc().leaseRentBillOrder( + UserTool.appProveider.selectedHouse!.sysLeaseId!, + 1, //写死为支付宝 + widget.model.price.toDouble()); + result = await PayUtil() + .callAliPay(code, API.pay.leaseRentBillOrderCheck); + } catch (e) { + LoggerData.addData(e); + } + if (result) { + Get.off(() => PayFinishPage()); + } + cancel(); + }, + child: '立即支付'.text.size(32.sp).bold.black.make()), + ), + ); + } + + Widget _buildInfo() { + return Padding( + padding: EdgeInsets.symmetric(horizontal: 32.w), + child: Column( + children: [ + Row( + children: [ + '付款方式'.text.size(28.sp).color(ktextSubColor).make(), + Spacer(), + //暂时写死为支付宝 + '支付宝'.text.size(28.sp).black.make() + ], + ), + Row( + children: [ + '月份'.text.size(28.sp).color(ktextSubColor).make(), + Spacer(), + '${widget.model.createDateTime.month.toString()}月' + .text + .size(28.sp) + .black + .make() + ], + ), + Row( + children: [ + '类型'.text.size(28.sp).color(ktextSubColor).make(), + Spacer(), + widget.model.typeString.text.size(28.sp).black.make() + ], + ), + Row( + children: [ + '截止时间'.text.size(28.sp).color(ktextSubColor).make(), + Spacer(), + DateUtil.formatDate( + DateTime( + widget.model.createDateTime.year, + widget.model.createDateTime.month + 1, + 0, + ), + format: 'yyyy-MM-dd') + .toString() + .text + .size(28.sp) + .black + .make() + ], + ), + Row( + children: [ + '对应房屋'.text.size(28.sp).color(ktextSubColor).make(), + Spacer(), + '${S.of(context)!.tempPlotName}·${UserTool.appProveider.selectedHouse!.roomName}' + .text + .size(28.sp) + .black + .make() + ], + ), + ].sepWidget(separate: 32.w.heightBox), + ), + ); + } + + Widget _buildFinishInfo() { + return Padding( + padding: EdgeInsets.symmetric(horizontal: 32.w), + child: Column( + children: [ + 32.w.heightBox, + BeeDivider.horizontal(), + 32.w.heightBox, + Row( + children: [ + '缴费人'.text.size(28.sp).color(ktextSubColor).make(), + Spacer(), + '${UserTool.userProvider.userInfoModel!.name}' + .text + .size(28.sp) + .black + .make() + ], + ), + 32.w.heightBox, + Row( + children: [ + '缴纳时间'.text.size(28.sp).color(ktextSubColor).make(), + Spacer(), + '${DateUtil.formatDate(widget.model.createDateTime)}' + .text + .size(28.sp) + .black + .make() + ], + ), + ], + ), + ); + } +} diff --git a/lib/ui/profile/house/lease_pay_query/lease_pay_query_page.dart b/lib/ui/profile/house/lease_pay_query/lease_pay_query_page.dart index 7b931f8d..bdc80e56 100644 --- a/lib/ui/profile/house/lease_pay_query/lease_pay_query_page.dart +++ b/lib/ui/profile/house/lease_pay_query/lease_pay_query_page.dart @@ -1,6 +1,7 @@ import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/constants/api.dart'; import 'package:aku_community/models/house/lease_fee_list_model.dart'; +import 'package:aku_community/ui/profile/house/lease_pay_query/lease_pay_query_detail_page.dart'; import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/utils/network/base_list_model.dart'; import 'package:aku_community/utils/network/net_util.dart'; @@ -170,27 +171,29 @@ class _LeasePayQueryPageState extends State { } Widget _buildCard(LeaseFeeListModel model) { - return Column( - mainAxisSize: MainAxisSize.min, - children: [ - Row( - children: [ - model.typeString.text.size(28.sp).black.bold.make(), - Spacer(), - '${S.of(context)!.tempPlotName} ${UserTool.appProveider.selectedHouse!.roomName}' - .text - .size(24.sp) - .color(ktextSubColor) - .bold - .make(), - ], - ), - 12.w.heightBox, - GestureDetector( - onTap: () { - model.payStatus == 0 ? null : null; - }, - child: Row( + return GestureDetector( + onTap: () { + Get.to(() => LeasePayQueryDetailPage( + model: model, + )); + }, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + children: [ + model.typeString.text.size(28.sp).black.bold.make(), + Spacer(), + '${S.of(context)!.tempPlotName} ${UserTool.appProveider.selectedHouse!.roomName}' + .text + .size(24.sp) + .color(ktextSubColor) + .bold + .make(), + ], + ), + 12.w.heightBox, + Row( children: [ '${DateUtil.formatDateStr(model.createDate, format: 'MM/dd HH:mm')}' .text @@ -209,10 +212,10 @@ class _LeasePayQueryPageState extends State { .make(), ], ), - ), - 32.w.heightBox, - BeeDivider.horizontal(), - ], + 32.w.heightBox, + BeeDivider.horizontal(), + ], + ), ); } } diff --git a/lib/ui/profile/house/lease_relevation/contract_pay_page.dart b/lib/ui/profile/house/lease_relevation/contract_pay_page.dart index fbcd6b0a..433aff6c 100644 --- a/lib/ui/profile/house/lease_relevation/contract_pay_page.dart +++ b/lib/ui/profile/house/lease_relevation/contract_pay_page.dart @@ -1,8 +1,10 @@ +import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/cupertino.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'; import 'package:aku_community/base/base_style.dart'; @@ -81,15 +83,21 @@ class _ContractPayPageState extends State { bottomNavi: BottomButton( child: '点击支付'.text.size(32.sp).bold.color(ktextPrimary).make(), onPressed: () async { - String code = await HouseFunc() - .leaseAlipay(widget.id, 1, _model!.margin.toDouble()); - if (code.isNotEmpty) { - bool result = - await PayUtil().callAliPay(code, API.pay.leaseCheckAlipay); - if (result) { - Get.off(() => PayFinishPage()); + Function cancel = BotToast.showLoading(); + try { + String code = await HouseFunc() + .leaseAlipay(widget.id, 1, _model!.margin.toDouble()); + if (code.isNotEmpty) { + bool result = + await PayUtil().callAliPay(code, API.pay.leaseCheckAlipay); + if (result) { + Get.off(() => PayFinishPage()); + } } + } catch (e) { + LoggerData.addData(e); } + cancel(); }, ), );