|
|
|
@ -10,6 +10,12 @@ import 'package:project_telephony/utils/headers.dart';
|
|
|
|
|
import 'package:tobias/tobias.dart';
|
|
|
|
|
import 'package:fluwx/fluwx.dart' as fluwx;
|
|
|
|
|
|
|
|
|
|
import '../../constants/api.dart';
|
|
|
|
|
import '../../model/network/api_client.dart';
|
|
|
|
|
import '../../model/pay/wx_pay_model.dart';
|
|
|
|
|
import '../../utils/pay_util.dart';
|
|
|
|
|
import '../../utils/toast/cloud_toast.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MembersPage extends StatefulWidget {
|
|
|
|
|
const MembersPage({Key? key}) : super(key: key);
|
|
|
|
@ -40,9 +46,9 @@ List payWay = [
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
class _MembersPageState extends State<MembersPage> {
|
|
|
|
|
@override
|
|
|
|
|
|
|
|
|
|
int nowPrice=1;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
body: Stack(
|
|
|
|
@ -84,15 +90,16 @@ class _MembersPageState extends State<MembersPage> {
|
|
|
|
|
if(!result){
|
|
|
|
|
Get.snackbar('提示', "请先安装支付宝");
|
|
|
|
|
}else{
|
|
|
|
|
aliPay("paySign").then((payResult) {
|
|
|
|
|
// map["paySign"]是请求接口返回的字符串直接放进去就好了
|
|
|
|
|
print("支付宝:$payResult");
|
|
|
|
|
if (payResult['resultStatus'] == '9000') {
|
|
|
|
|
Get.snackbar('提示', "充值成功");
|
|
|
|
|
} else {
|
|
|
|
|
Get.snackbar('提示', payResult['memo']);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
_aliPay();
|
|
|
|
|
// aliPay("paySign").then((payResult) {
|
|
|
|
|
// // map["paySign"]是请求接口返回的字符串直接放进去就好了
|
|
|
|
|
// print("支付宝:$payResult");
|
|
|
|
|
// if (payResult['resultStatus'] == '9000') {
|
|
|
|
|
// Get.snackbar('提示', "充值成功");
|
|
|
|
|
// } else {
|
|
|
|
|
// Get.snackbar('提示', payResult['memo']);
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -206,20 +213,7 @@ class _MembersPageState extends State<MembersPage> {
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
//调起支付
|
|
|
|
|
fluwx.payWithWeChat(
|
|
|
|
|
appId: "wxd930ea5d5a228f5f",
|
|
|
|
|
partnerId: "partnerId",
|
|
|
|
|
prepayId: "prepayId",
|
|
|
|
|
packageValue: "packageValue",
|
|
|
|
|
nonceStr: "nonceStr",
|
|
|
|
|
timeStamp: 1597927308,
|
|
|
|
|
sign: "sign");
|
|
|
|
|
fluwx.weChatResponseEventHandler.listen((event) { if(event.isSuccessful){
|
|
|
|
|
BotToast.showText(text: "微信支付成功");
|
|
|
|
|
}else{
|
|
|
|
|
BotToast.showText(text: "微信支付失败");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
_wxPay();
|
|
|
|
|
// var wxPayModel = WxPayModel.fromJson({
|
|
|
|
|
// "prepayId": "wx121434071826969924754d7d3309520000",
|
|
|
|
|
// "partnerId": "1622850618",
|
|
|
|
@ -253,22 +247,31 @@ class _MembersPageState extends State<MembersPage> {
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// Future _aliPayFunc() async {
|
|
|
|
|
// var base = await apiClient.request(API.user.wallet.assessRecharge, data: {
|
|
|
|
|
// 'count': widget.count,
|
|
|
|
|
// 'payType': 1,
|
|
|
|
|
// });
|
|
|
|
|
// if (base.code == 0) {
|
|
|
|
|
// var re = await PayUtil().callAliPay(base.data['content']);
|
|
|
|
|
// if (re) {
|
|
|
|
|
// _paySuccess();
|
|
|
|
|
// } else {
|
|
|
|
|
// BotToast.closeAllLoading();
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// CloudToast.show(base.msg);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
Future _aliPay() async {
|
|
|
|
|
var base = await apiClient.request(API.pay.alipay, data: {
|
|
|
|
|
// 'amount': nowPrice,//注释
|
|
|
|
|
'amount': 0.01,
|
|
|
|
|
});
|
|
|
|
|
if (base.code == 0) {
|
|
|
|
|
await PayUtil().callAliPay(base.data);
|
|
|
|
|
} else {
|
|
|
|
|
CloudToast.show(base.msg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Future _wxPay() async {
|
|
|
|
|
var base = await apiClient.request(API.pay.wxpay, data: {
|
|
|
|
|
// 'amount': nowPrice,//注释
|
|
|
|
|
'amount': 0.1,
|
|
|
|
|
});
|
|
|
|
|
if (base.code == 0) {
|
|
|
|
|
var wxPayModel = WxPayModel.fromJson(base.data);
|
|
|
|
|
await PayUtil().callWxPay(
|
|
|
|
|
payModel: wxPayModel,
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
CloudToast.show(base.msg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//充值金额
|
|
|
|
|
_getRecharge() {
|
|
|
|
@ -289,7 +292,7 @@ class _MembersPageState extends State<MembersPage> {
|
|
|
|
|
mainAxisSpacing: 20.w,
|
|
|
|
|
callback: (item, index) {
|
|
|
|
|
_chooseItem = item;
|
|
|
|
|
// print(_piceList[index].pice);
|
|
|
|
|
nowPrice=_piceList[index].pice;
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
pickItem: _chooseItem,
|
|
|
|
|