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