完成生活缴费 预缴充值功能

hmxc
张萌 3 years ago
parent f8cfca794d
commit 7d2cbdc4b7

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

@ -113,6 +113,10 @@ class R {
/// ![preview](file:///Users/zhangmeng/aku_community/assets/icons/alarm.png)
static const String ASSETS_ICONS_ALARM_PNG = 'assets/icons/alarm.png';
/// ![preview](file:///Users/zhangmeng/aku_community/assets/icons/alipay_round.png)
static const String ASSETS_ICONS_ALIPAY_ROUND_PNG =
'assets/icons/alipay_round.png';
/// ![preview](file:///Users/zhangmeng/aku_community/assets/icons/app_add.png)
static const String ASSETS_ICONS_APP_ADD_PNG = 'assets/icons/app_add.png';

@ -209,6 +209,10 @@ class _Manager {
///
String get findEstatelsPament => '/user/dailyPayment/findEstateIsPayment';
///id
String get dailyPaymentPrePay =>
'/user/dailyPayment/findAdvancePaymentPriceByEstateId';
///app
String get enventVotingList => '/user/eventVoting/list';
@ -501,6 +505,13 @@ class _Pay {
///-app -( 0 )
String get leaseRentOrderNegative => '/user/myHouse/leaseRentOrderAlipay';
///app - ( APP )
String get dailPaymentPrePay => '/user/alipay/advancePaymentOrderAlipay';
///-
String get dailPaymentPrePayCheck =>
'/user/alipay/advancePaymentOrderCheckAlipay';
}
class _House {

@ -1,4 +1,5 @@
import 'package:aku_community/pages/life_pay/life_pre_pay_page.dart';
import 'package:aku_community/widget/others/user_tool.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -47,6 +48,7 @@ class _LifePayPageState extends State<LifePayPage> {
List<LifePayListModel> _models = []; //model,
int _page = 0;
int _size = 10;
double _prePrice = 0;
List<LifePayListModel> _selectModels = []; //models
@ -232,7 +234,7 @@ class _LifePayPageState extends State<LifePayPage> {
children: [
'¥'.text.size(28.sp).black.make(),
16.w.widthBox,
'2300'.text.size(40.sp).black.bold.make(),
_prePrice.text.size(40.sp).black.bold.make(),
Spacer(),
MaterialButton(
elevation: 0,
@ -243,7 +245,7 @@ class _LifePayPageState extends State<LifePayPage> {
side: BorderSide(color: Color(0xFF979797), width: 1.w)),
color: Colors.white,
onPressed: () {
Get.to(() => LifePrePayPage());
Get.to(() => LifePrePayPage(prePay: _prePrice,));
},
child: '预缴充值'.text.size(28.sp).black.make(),
)
@ -254,6 +256,18 @@ class _LifePayPageState extends State<LifePayPage> {
);
}
Future<double> _dailyPaymentPrePay() async {
BaseModel baseModel =
await NetUtil().get(API.manager.dailyPaymentPrePay, params: {
"estateId": UserTool.appProveider.selectedHouse!.estateId,
});
if (baseModel.status ?? false) {
return (baseModel.data as num).toDouble();
} else {
return 0;
}
}
@override
Widget build(BuildContext context) {
final appProvider = Provider.of<AppProvider>(context);
@ -295,6 +309,7 @@ class _LifePayPageState extends State<LifePayPage> {
for (var i = 0; i < _selectModels.length; i++) {
_selectYears.add(i);
}
_prePrice = await _dailyPaymentPrePay();
if (mounted) setState(() {});
},
child: Column(

@ -1,18 +1,26 @@
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/utils/network/base_model.dart';
import 'package:aku_community/utils/network/net_util.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:aku_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.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';
import 'package:power_logger/power_logger.dart';
class LifePrePayPage extends StatefulWidget {
LifePrePayPage({Key? key}) : super(key: key);
final double prePay;
LifePrePayPage({Key? key, required this.prePay}) : super(key: key);
@override
_LifePrePayPageState createState() => _LifePrePayPageState();
@ -72,7 +80,10 @@ class _LifePrePayPageState extends State<LifePrePayPage> {
fontWeight: FontWeight.bold,
color: Colors.black,
),
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
inputFormatters: [
FilteringTextInputFormatter.allow(
RegExp(r"^[0-9][\.\d]*(,\d+)?$"))
],
keyboardType: TextInputType.number,
).expand(),
],
@ -83,7 +94,8 @@ class _LifePrePayPageState extends State<LifePrePayPage> {
'当前房屋下的预缴金额为 '
.richText
.withTextSpanChildren([
'2300'
widget.prePay
.toDoubleStringAsFixed()
.textSpan
.bold
.size(28.sp)
@ -104,45 +116,64 @@ class _LifePrePayPageState extends State<LifePrePayPage> {
),
),
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(() {});
}));
}),
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(),
Image.asset(
R.ASSETS_ICONS_ALIPAY_ROUND_PNG,
width: 48.w,
height: 48.w,
),
16.w.widthBox,
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,
),
],
),
),
],
),
bottomNavi: BottomButton(
onPressed: () {}, child: '立即充值'.text.size(32.sp).bold.black.make()),
onPressed: () async {
Function cancel = BotToast.showLoading();
try {
BaseModel baseModel =
await NetUtil().post(API.pay.dailPaymentPrePay, params: {
"estateId": UserTool.appProveider.selectedHouse!.estateId,
"payType": 1,
"payPrice": _editingController.text
});
if (baseModel.status ?? false) {
bool result = await PayUtil().callAliPay(
baseModel.message!, API.pay.dailPaymentPrePayCheck);
if (result) {
Get.off(() => PayFinishPage());
}
} else {
BotToast.showText(text: baseModel.message??"");
}
} catch (e) {
LoggerData.addData(e);
}
cancel();
},
child: '立即充值'.text.size(32.sp).bold.black.make()),
);
}
}

@ -18,7 +18,7 @@ class PayMethodBottomSheet extends StatelessWidget {
'支付方式'.text.size(32.sp).bold.color(ktextPrimary).isIntrinsic.make(),
actions: [
CupertinoActionSheetAction(
onPressed: onChoose('支付宝'),
onPressed:()=> onChoose('支付宝'),
child:
'支付宝'.text.size(32.sp).color(ktextPrimary).isIntrinsic.make())
],

Loading…
Cancel
Save