From d7e608e0a5596a0239756c638d067c354e6e2447 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Thu, 22 Jul 2021 14:08:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=20=E5=AE=B6=E6=94=BF?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E6=94=AF=E4=BB=98=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/constants/api.dart | 8 +++++ .../house_keeping_detail_page.dart | 33 +++++++++++++++++-- .../house_keeping/house_keeping_func.dart | 13 ++++++++ 3 files changed, 51 insertions(+), 3 deletions(-) diff --git a/lib/constants/api.dart b/lib/constants/api.dart index 9c20a711..59489166 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -519,6 +519,14 @@ class _Pay { ///支付宝支付:生活缴费-预充值支付 向支付宝发起订单查询请求 String get dailPaymentPrePayCheck => '/user/alipay/advancePaymentOrderCheckAlipay'; + + ///支付宝支付:app 家政服务-服务费用支付 完成订单支付宝支付(生成 APP 支付订单信息) + String get houseKeepingServiceOrderAlipay => + '/user/alipay/housekeepingServiceOrderAlipay'; + + ///支付宝支付:家政服务-服务费用支付 向支付宝发起订单查询请求 + String get houseKeepingServieceOrderCheck => + '/user/alipay/housekeepingServiceOrderCheckAlipay'; } class _House { 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 06f90640..eed00208 100644 --- a/lib/ui/manager/house_keeping/house_keeping_detail_page.dart +++ b/lib/ui/manager/house_keeping/house_keeping_detail_page.dart @@ -1,4 +1,8 @@ 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/ui/manager/house_keeping/house_keeping_func.dart'; +import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -6,6 +10,7 @@ import 'package:flustars/flustars.dart'; import 'package:flutter_rating_bar/flutter_rating_bar.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'; @@ -22,8 +27,12 @@ import 'package:aku_community/widget/views/bee_grid_image_view.dart'; class HouseKeepingDetailPage extends StatefulWidget { final HouseKeepingListModel model; final List processModels; + final VoidCallback callRefresh; HouseKeepingDetailPage( - {Key? key, required this.model, required this.processModels}) + {Key? key, + required this.model, + required this.processModels, + required this.callRefresh}) : super(key: key); @override @@ -49,7 +58,7 @@ class _HouseKeepingDetailPageState extends State { _serviceFeedBack(), ], ), - + 16.w.heightBox, Container( padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), color: Colors.white, @@ -65,6 +74,7 @@ class _HouseKeepingDetailPageState extends State { ], ), ), + 16.w.heightBox, if (widget.model.evaluationTime != null) Column( children: [ @@ -87,7 +97,23 @@ class _HouseKeepingDetailPageState extends State { case 3: case 4: return BottomButton( - onPressed: () {}, child: '立即支付'.text.size(32.sp).bold.black.make()); + onPressed: () async { + Function cancel = BotToast.showLoading(); + try { + String code = await HouseKeepingFunc.houseKeepingOrderAlipay( + widget.model.id, 1, widget.model.payFee ?? 0); + bool result = await PayUtil() + .callAliPay(code, API.pay.houseKeepingServieceOrderCheck); + if (result) { + Get.off(() => PayFinishPage()); + widget.callRefresh(); + } + } catch (e) { + LoggerData.addData(e); + } + cancel(); + }, + child: '立即支付'.text.size(32.sp).bold.black.make()); case 5: return BottomButton( onPressed: () { @@ -244,6 +270,7 @@ class _HouseKeepingDetailPageState extends State { color: Colors.white, padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 24.w), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ '服务反馈'.text.size(36.sp).bold.black.make(), 40.w.heightBox, diff --git a/lib/ui/manager/house_keeping/house_keeping_func.dart b/lib/ui/manager/house_keeping/house_keeping_func.dart index f59002d8..91326bf1 100644 --- a/lib/ui/manager/house_keeping/house_keeping_func.dart +++ b/lib/ui/manager/house_keeping/house_keeping_func.dart @@ -77,4 +77,17 @@ class HouseKeepingFunc { }); return baseModel.status ?? false; } + + ///支付宝支付:app 家政服务-服务费用支付 完成订单支付宝支付(生成 APP 支付订单信息) + ///支付方式暂写死为1 + ///支付方式:1.支付宝 2.微信 3.现金 4.pos + static Future houseKeepingOrderAlipay(int id, int type, double price) async { + BaseModel baseModel = await NetUtil().post(API.pay.houseKeepingServiceOrderAlipay, + params: {"housekeepingServiceId": id, "payType": type, "payPrice": price}); + if (baseModel.status ?? false) { + return baseModel.message!; + } else { + return ''; + } + } }