|
|
|
@ -1,11 +1,16 @@
|
|
|
|
|
import 'package:bot_toast/bot_toast.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:project_telephony/base/base_style.dart';
|
|
|
|
|
import 'package:project_telephony/ui/user/members_page.dart';
|
|
|
|
|
import 'package:project_telephony/ui/widget/check_radio.dart';
|
|
|
|
|
import 'package:project_telephony/ui/widget/plone_back_button.dart';
|
|
|
|
|
import 'package:project_telephony/ui/widget/plone_bottom.dart';
|
|
|
|
|
import 'package:project_telephony/ui/widget/putup_widget.dart';
|
|
|
|
|
import 'package:project_telephony/utils/headers.dart';
|
|
|
|
|
import 'package:tobias/tobias.dart';
|
|
|
|
|
import 'package:fluwx/fluwx.dart' as fluwx;
|
|
|
|
|
import '../../model/pay/wx_pay_model.dart';
|
|
|
|
|
import '../../utils/pay_util.dart';
|
|
|
|
|
|
|
|
|
|
class MembersPage extends StatefulWidget {
|
|
|
|
|
const MembersPage({Key? key}) : super(key: key);
|
|
|
|
@ -34,10 +39,11 @@ List payWay = [
|
|
|
|
|
},
|
|
|
|
|
{'payName': '支付宝支付', 'payUrl': Assets.icons.zhifubao.path}
|
|
|
|
|
];
|
|
|
|
|
Map a = {};
|
|
|
|
|
|
|
|
|
|
class _MembersPageState extends State<MembersPage> {
|
|
|
|
|
@override
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
body: Stack(
|
|
|
|
@ -69,7 +75,28 @@ class _MembersPageState extends State<MembersPage> {
|
|
|
|
|
PloneBottom(
|
|
|
|
|
border: true,
|
|
|
|
|
onTap: () async {
|
|
|
|
|
if (_selectIndex == 0) {}
|
|
|
|
|
if(_chooseItem == null){
|
|
|
|
|
Get.snackbar('提示', "请先选择充值月份");
|
|
|
|
|
}else{
|
|
|
|
|
if (_selectIndex == 0) {
|
|
|
|
|
_wxPayFunc();
|
|
|
|
|
}else{
|
|
|
|
|
var result = await isAliPayInstalled(); // 这里判断是否安装支付宝
|
|
|
|
|
if(!result){
|
|
|
|
|
Get.snackbar('提示', "请先安装支付宝");
|
|
|
|
|
}else{
|
|
|
|
|
aliPay("paySign").then((payResult) {
|
|
|
|
|
// map["paySign"]是请求接口返回的字符串直接放进去就好了
|
|
|
|
|
print("支付宝:" + payResult.toString());
|
|
|
|
|
if (payResult['resultStatus'] == '9000') {
|
|
|
|
|
Get.snackbar('提示', "充值成功");
|
|
|
|
|
} else {
|
|
|
|
|
Get.snackbar('提示', payResult['memo']);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
textColor: const Color(0xFF333333),
|
|
|
|
|
text: "立即开通",
|
|
|
|
@ -172,21 +199,61 @@ class _MembersPageState extends State<MembersPage> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Future _wxPayFunc() async {
|
|
|
|
|
// var base = await apiClient.request(API.user.wallet.assessRecharge, data: {
|
|
|
|
|
// 'count': widget.count,
|
|
|
|
|
// 'payType': 2,
|
|
|
|
|
// });
|
|
|
|
|
// if (base.code == 0) {
|
|
|
|
|
// var wxPayModel = WxPayModel.fromJson(base.data['content']);
|
|
|
|
|
// await PayUtil().callWxPay(
|
|
|
|
|
// payModel: wxPayModel,
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
|
|
Future _wxPayFunc() async{
|
|
|
|
|
bool isInstalled=await fluwx.isWeChatInstalled;
|
|
|
|
|
if(!isInstalled){
|
|
|
|
|
BotToast.showText(text: "请先安装微信");
|
|
|
|
|
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: "微信支付失败");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// var wxPayModel = WxPayModel.fromJson({
|
|
|
|
|
// "prepayId": "wx121434071826969924754d7d3309520000",
|
|
|
|
|
// "partnerId": "1622850618",
|
|
|
|
|
// "timeStamp": "1660286047",
|
|
|
|
|
// "nonceStr": "W14Z6RbKcHcI6QTETFyrxteD3m2P7ZaF",
|
|
|
|
|
// "package": "Sign=WXPay",
|
|
|
|
|
// "sign": "i4LDk+FlAfXukLPet6oFdtVkAXHv8aKkajO4i2tiXETBqudWJPzYAaziPH3eBo1yCvkMOyoVddWDKqHXhwrN2uvubz8YpSICt9yZBcndVaXOK+X9hY765sYoFV6sGHz5iuPljTRUWWrmc8GYMEs8TlLDB5Q50NenzJSChdfDtZRV4kXtVK6xY9b0y++eUo/snzpmq/X6GwS9n0auKkT0TKW1C30/Hzpw3SMziXPP02TvBvbqj57f6rHuGJS/LUX2ZwCR8iFZsfuiXo+7lyHHsimr4jVczdS6VtobeekrPq4vTe72d/HU/ECEZRSYxsL5DbyS2TvSNzFA6Z7wGDzkpQ=="
|
|
|
|
|
// });
|
|
|
|
|
// await PayUtil().callWxPay(
|
|
|
|
|
// payModel: wxPayModel,
|
|
|
|
|
// );
|
|
|
|
|
}
|
|
|
|
|
// base ={
|
|
|
|
|
// "content": {
|
|
|
|
|
// "prepayId": "wx121434071826969924754d7d3309520000",
|
|
|
|
|
// "partnerId": "1622850618",
|
|
|
|
|
// "timeStamp": "1660286047",
|
|
|
|
|
// "nonceStr": "W14Z6RbKcHcI6QTETFyrxteD3m2P7ZaF",
|
|
|
|
|
// "package": "Sign=WXPay",
|
|
|
|
|
// "sign": "i4LDk+FlAfXukLPet6oFdtVkAXHv8aKkajO4i2tiXETBqudWJPzYAaziPH3eBo1yCvkMOyoVddWDKqHXhwrN2uvubz8YpSICt9yZBcndVaXOK+X9hY765sYoFV6sGHz5iuPljTRUWWrmc8GYMEs8TlLDB5Q50NenzJSChdfDtZRV4kXtVK6xY9b0y++eUo/snzpmq/X6GwS9n0auKkT0TKW1C30/Hzpw3SMziXPP02TvBvbqj57f6rHuGJS/LUX2ZwCR8iFZsfuiXo+7lyHHsimr4jVczdS6VtobeekrPq4vTe72d/HU/ECEZRSYxsL5DbyS2TvSNzFA6Z7wGDzkpQ=="
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
// await apiClient.request(API.user.wallet.assessRecharge, data: {
|
|
|
|
|
// 'count': widget.count,
|
|
|
|
|
// 'payType': 2,
|
|
|
|
|
// });
|
|
|
|
|
// if (base.code ==null) {
|
|
|
|
|
//
|
|
|
|
|
// } else {
|
|
|
|
|
// BotToast.showText(text: "${base.msg}");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Future _aliPayFunc() async {
|
|
|
|
|
// var base = await apiClient.request(API.user.wallet.assessRecharge, data: {
|
|
|
|
|
// 'count': widget.count,
|
|
|
|
|