|
|
|
@ -48,7 +48,7 @@ class _RechargePage extends State<RechargePage> {
|
|
|
|
|
}); |
|
|
|
|
weChatResponseEventHandler.listen((event) async { |
|
|
|
|
print("payCallback: ${event.errCode}"); |
|
|
|
|
if(event.errCode == 0){ |
|
|
|
|
if (event.errCode == 0) { |
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
SmartDialog.showToast("充值成功", alignment: Alignment.center); |
|
|
|
|
} |
|
|
|
@ -59,19 +59,20 @@ class _RechargePage extends State<RechargePage> {
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///会员权益列表 |
|
|
|
|
queryBenefitList() async { |
|
|
|
|
BaseData<List<VipBenefitList>> baseData = await apiService.benefitList().catchError((onError) {}); |
|
|
|
|
BaseData<List<VipBenefitList>> baseData = |
|
|
|
|
await apiService.benefitList().catchError((onError) {}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
setState(() { |
|
|
|
|
vipBenefitList.clear(); |
|
|
|
|
vipBenefitList.addAll(baseData.data); |
|
|
|
|
vipBenefitList.forEach((element) { |
|
|
|
|
if(element.have && element.config != null && element.code == "RECHARGE"){ |
|
|
|
|
if (element.have && |
|
|
|
|
element.config != null && |
|
|
|
|
element.code == "RECHARGE") { |
|
|
|
|
discount = double.parse(element.config); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -100,55 +101,110 @@ class _RechargePage extends State<RechargePage> {
|
|
|
|
|
background: Color(0xFFFFFFFF), |
|
|
|
|
leadingColor: Colors.black, |
|
|
|
|
), |
|
|
|
|
body:Stack( |
|
|
|
|
body: Container( |
|
|
|
|
color: Color(0xFFFFFFFF), |
|
|
|
|
child: Stack( |
|
|
|
|
children: [ |
|
|
|
|
SingleChildScrollView( |
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
child: Container( |
|
|
|
|
margin: EdgeInsets.only(left: 16, right: 16), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
Container( |
|
|
|
|
child: Column(children: [ |
|
|
|
|
ItemInputWidget( |
|
|
|
|
S.of(context).qingshuruchongzhijine, |
|
|
|
|
hintText: "", |
|
|
|
|
controller: controller, |
|
|
|
|
padding: EdgeInsets.all(20), |
|
|
|
|
errorText: S.of(context).chongzhizuixiaojine(100), |
|
|
|
|
titleColor: Color(0xFF727272), |
|
|
|
|
errorTextColor: Color(0xFF32A060), |
|
|
|
|
radius: 8, |
|
|
|
|
discount: discount/10, |
|
|
|
|
Column( |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
// ItemInputWidget( |
|
|
|
|
// S.of(context).qingshuruchongzhijine, |
|
|
|
|
// hintText: "", |
|
|
|
|
// controller: controller, |
|
|
|
|
// padding: EdgeInsets.all(20), |
|
|
|
|
// errorText: S.of(context).chongzhizuixiaojine(100), |
|
|
|
|
// titleColor: Color(0xFF727272), |
|
|
|
|
// errorTextColor: Color(0xFF32A060), |
|
|
|
|
// radius: 8, |
|
|
|
|
// discount: discount / 10, |
|
|
|
|
// style: TextStyle( |
|
|
|
|
// fontWeight: FontWeight.bold, |
|
|
|
|
// fontSize: 27.sp, |
|
|
|
|
// color: color, |
|
|
|
|
// ), |
|
|
|
|
// inputLimit: 6, |
|
|
|
|
// textInputType: TextInputType.number, |
|
|
|
|
// textInputFormatter: |
|
|
|
|
// FilteringTextInputFormatter.digitsOnly, |
|
|
|
|
// onChanged: (value) { |
|
|
|
|
// if (value != null && |
|
|
|
|
// value != "" && |
|
|
|
|
// double.tryParse(value) < 100) { |
|
|
|
|
// color = Colors.red; |
|
|
|
|
// } else { |
|
|
|
|
// color = Colors.black; |
|
|
|
|
// } |
|
|
|
|
// setState(() {}); |
|
|
|
|
// }, |
|
|
|
|
// ), |
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsets.only(top: 26, bottom: 28), |
|
|
|
|
child: Text( |
|
|
|
|
S.of(context).chongzhi, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
fontSize: 27.sp, |
|
|
|
|
color: color, |
|
|
|
|
), |
|
|
|
|
inputLimit: 6, |
|
|
|
|
textInputType: TextInputType.number, |
|
|
|
|
textInputFormatter: FilteringTextInputFormatter.digitsOnly, |
|
|
|
|
onChanged: (value) { |
|
|
|
|
if (value != null && |
|
|
|
|
value != "" && |
|
|
|
|
double.tryParse(value) < 100) { |
|
|
|
|
color = Colors.red; |
|
|
|
|
} else { |
|
|
|
|
color = Colors.black; |
|
|
|
|
} |
|
|
|
|
setState(() {}); |
|
|
|
|
}, |
|
|
|
|
fontSize: 28.sp, |
|
|
|
|
color: Color(0xFF181818), |
|
|
|
|
fontWeight: MyFontWeight.semi_bold), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Row( |
|
|
|
|
children: [ |
|
|
|
|
Expanded( |
|
|
|
|
child: Text( |
|
|
|
|
S.of(context).zhanghuyue, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 15.sp, |
|
|
|
|
color: Color(0xFF181818), |
|
|
|
|
fontWeight: MyFontWeight.semi_bold), |
|
|
|
|
)), |
|
|
|
|
Text.rich( |
|
|
|
|
TextSpan(children: [ |
|
|
|
|
TextSpan( |
|
|
|
|
text: "0.00", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 26.sp, |
|
|
|
|
color: Color(0xFF181818), |
|
|
|
|
fontWeight: MyFontWeight.semi_bold), |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
|
text: "元", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 15.sp, |
|
|
|
|
color: Color(0xFF181818), |
|
|
|
|
fontWeight: MyFontWeight.semi_bold), |
|
|
|
|
), |
|
|
|
|
]), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
SizedBox(height: 28), |
|
|
|
|
rechargeList(), |
|
|
|
|
SizedBox(height:22), |
|
|
|
|
Row( |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
|
|
|
children: [ |
|
|
|
|
if (vipRuleDetails?.recharge != null && |
|
|
|
|
vipRuleDetails.recharge != "") |
|
|
|
|
Expanded(child:Container( |
|
|
|
|
Expanded( |
|
|
|
|
child: Container( |
|
|
|
|
color: Colors.white, |
|
|
|
|
padding: EdgeInsets.only(left: 8), |
|
|
|
|
child: Html( |
|
|
|
|
data: "注意:${vipRuleDetails?.recharge??""}", |
|
|
|
|
data: "注意:${vipRuleDetails?.recharge ?? ""}", |
|
|
|
|
style:{ |
|
|
|
|
"html":Style( |
|
|
|
|
color: Color(0xFF000000), |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
) |
|
|
|
|
}, |
|
|
|
|
customImageRenders: { |
|
|
|
|
networkSourceMatcher(): networkImageRender( |
|
|
|
|
loadingWidget: () { |
|
|
|
@ -157,29 +213,26 @@ class _RechargePage extends State<RechargePage> {
|
|
|
|
|
), |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
),) |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
],), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
Container( |
|
|
|
|
width: double.infinity, |
|
|
|
|
margin: EdgeInsets.only( |
|
|
|
|
left: 0.w, |
|
|
|
|
right: 0.w, |
|
|
|
|
top: 16.h, |
|
|
|
|
bottom: 4.h, |
|
|
|
|
), |
|
|
|
|
padding: EdgeInsets.only( |
|
|
|
|
left: 20.w, |
|
|
|
|
right: 16.w, |
|
|
|
|
top: 20.h, |
|
|
|
|
bottom: 20.h, |
|
|
|
|
), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: Colors.white, |
|
|
|
|
// decoration: BoxDecoration( |
|
|
|
|
// color: Colors.white, |
|
|
|
|
// borderRadius: BorderRadius.circular(4), |
|
|
|
|
), |
|
|
|
|
// ), |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
@ -226,140 +279,214 @@ class _RechargePage extends State<RechargePage> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
// InkWell( |
|
|
|
|
// onTap: () { |
|
|
|
|
// recharge(); |
|
|
|
|
// }, |
|
|
|
|
// child: Container( |
|
|
|
|
// // margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 26.h), |
|
|
|
|
// child: Column( |
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
// children: [ |
|
|
|
|
// RoundButton( |
|
|
|
|
// width: double.infinity, |
|
|
|
|
// height: 46.h, |
|
|
|
|
// text: S.of(context).querenchongzhi, |
|
|
|
|
// textColor: Colors.white, |
|
|
|
|
// fontSize: 14.sp, |
|
|
|
|
// backgroup: Color(0xff32A060), |
|
|
|
|
// fontWeight: FontWeight.bold, |
|
|
|
|
// ), |
|
|
|
|
// ], |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Align(alignment: Alignment.bottomCenter,child: |
|
|
|
|
Container( |
|
|
|
|
Align( |
|
|
|
|
alignment: Alignment.bottomCenter, |
|
|
|
|
child: GestureDetector( |
|
|
|
|
onTap: (){ |
|
|
|
|
recharge(); |
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|
height: 56.h, |
|
|
|
|
color: Colors.white, |
|
|
|
|
child: Row( |
|
|
|
|
children: [ |
|
|
|
|
Expanded(child:Container( |
|
|
|
|
padding:EdgeInsets.only(top: 7.h,left:16), |
|
|
|
|
child:Column( |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
Row( |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
S.of(context).heji, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
color: Colors.black, |
|
|
|
|
), |
|
|
|
|
width: double.infinity, |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
borderRadius: BorderRadius.circular(27), |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
controller.text, |
|
|
|
|
margin: EdgeInsets.only(left: 16,right: 16,bottom: 21), |
|
|
|
|
child: Text( |
|
|
|
|
S.of(context).querenchongzhi, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
color: Colors.white, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
if(controller.text != "") |
|
|
|
|
Text.rich( |
|
|
|
|
TextSpan( |
|
|
|
|
children: [ |
|
|
|
|
TextSpan( |
|
|
|
|
text: "充值", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize:12.sp, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
color: Color(0xFFADADAD), |
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
// Container( |
|
|
|
|
// height: 56.h, |
|
|
|
|
// color: Colors.white, |
|
|
|
|
// child: Row( |
|
|
|
|
// children: [ |
|
|
|
|
// Expanded(child:Container( |
|
|
|
|
// padding:EdgeInsets.only(top: 7.h,left:16), |
|
|
|
|
// child:Column( |
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
// children: [ |
|
|
|
|
// Row( |
|
|
|
|
// children: [ |
|
|
|
|
// Text( |
|
|
|
|
// S.of(context).heji, |
|
|
|
|
// style: TextStyle( |
|
|
|
|
// fontSize: 14.sp, |
|
|
|
|
// fontWeight: MyFontWeight.regular, |
|
|
|
|
// color: Colors.black, |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
// Text( |
|
|
|
|
// controller.text, |
|
|
|
|
// style: TextStyle( |
|
|
|
|
// fontSize: 16.sp, |
|
|
|
|
// fontWeight: MyFontWeight.medium, |
|
|
|
|
// color: Color(0xFF32A060), |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
// ], |
|
|
|
|
// ), |
|
|
|
|
// if(controller.text != "") |
|
|
|
|
// Text.rich( |
|
|
|
|
// TextSpan( |
|
|
|
|
// children: [ |
|
|
|
|
// TextSpan( |
|
|
|
|
// text: "充值", |
|
|
|
|
// style: TextStyle( |
|
|
|
|
// fontSize:12.sp, |
|
|
|
|
// fontWeight: MyFontWeight.regular, |
|
|
|
|
// color: Color(0xFFADADAD), |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
// TextSpan( |
|
|
|
|
// text:"¥${controller.text}", |
|
|
|
|
// style: TextStyle( |
|
|
|
|
// fontSize: 12.sp, |
|
|
|
|
// fontWeight: MyFontWeight.regular, |
|
|
|
|
// color:Color(0xff3541C9), |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
// TextSpan( |
|
|
|
|
// text: "赠送", |
|
|
|
|
// style: TextStyle( |
|
|
|
|
// fontSize:12.sp, |
|
|
|
|
// fontWeight: MyFontWeight.regular, |
|
|
|
|
// color: Color(0xFFADADAD), |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
// TextSpan( |
|
|
|
|
// text:"¥${((double.tryParse(controller.text)??0) - ((double.tryParse(controller.text)??0) * (discount/100))).toStringAsFixed(2)}", |
|
|
|
|
// style: TextStyle( |
|
|
|
|
// fontSize: 12.sp, |
|
|
|
|
// fontWeight: MyFontWeight.regular, |
|
|
|
|
// color: Color(0xff3541C9), |
|
|
|
|
// ), |
|
|
|
|
// ),TextSpan( |
|
|
|
|
// text: "元", |
|
|
|
|
// style: TextStyle( |
|
|
|
|
// fontSize:12.sp, |
|
|
|
|
// fontWeight: MyFontWeight.regular, |
|
|
|
|
// color: Color(0xFFADADAD), |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
// ], |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
// ], |
|
|
|
|
// )) |
|
|
|
|
// ), |
|
|
|
|
// GestureDetector( |
|
|
|
|
// onTap: () { |
|
|
|
|
// recharge(); |
|
|
|
|
// }, |
|
|
|
|
// child: RoundButton( |
|
|
|
|
// width: 103.w, |
|
|
|
|
// height: 54.h, |
|
|
|
|
// text: S.of(context).chongzhi, |
|
|
|
|
// textColor: Colors.white, |
|
|
|
|
// fontWeight: MyFontWeight.regular, |
|
|
|
|
// backgroup: Color(0xFF32A060), |
|
|
|
|
// radius: 0, |
|
|
|
|
// fontSize: 16.sp, |
|
|
|
|
// padding: EdgeInsets.symmetric(vertical: 5.h), |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
// ], |
|
|
|
|
// ), |
|
|
|
|
// ) |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
|
text:"¥${controller.text}", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
color:Color(0xff3541C9), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var checkIndex = 1; |
|
|
|
|
|
|
|
|
|
Widget rechargeList() { |
|
|
|
|
return GridView.builder( |
|
|
|
|
itemCount: 6, |
|
|
|
|
shrinkWrap: true, |
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( |
|
|
|
|
//一行的Widget数量 |
|
|
|
|
crossAxisCount: 3, |
|
|
|
|
//水平子Widget之间间距 |
|
|
|
|
crossAxisSpacing:11, |
|
|
|
|
//垂直子Widget之间间距 |
|
|
|
|
mainAxisSpacing: 0, |
|
|
|
|
childAspectRatio: 1.5, |
|
|
|
|
), |
|
|
|
|
itemBuilder: (context, index) { |
|
|
|
|
return GestureDetector( |
|
|
|
|
onTap: () {}, |
|
|
|
|
child: rechargeItem(), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Widget rechargeItem() { |
|
|
|
|
return Stack( |
|
|
|
|
alignment: Alignment.bottomRight, |
|
|
|
|
children: [ |
|
|
|
|
Container( |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
height: 69.h, |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: Color(0xFFFAFAFA), |
|
|
|
|
// color: Color(0x2432A060), |
|
|
|
|
borderRadius: BorderRadius.circular(4), |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
|
text: "赠送", |
|
|
|
|
// margin: EdgeInsets.only(right: 11,bottom: 16), |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
"100元", |
|
|
|
|
textAlign: TextAlign.center, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize:12.sp, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
color: Color(0xFFADADAD), |
|
|
|
|
color: Color(0xFF868686), |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
fontSize: 21.sp, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
|
text:"¥${((double.tryParse(controller.text)??0) - ((double.tryParse(controller.text)??0) * (discount/100))).toStringAsFixed(2)}", |
|
|
|
|
SizedBox(height:2,), |
|
|
|
|
Text( |
|
|
|
|
"实际到账:120元", |
|
|
|
|
textAlign: TextAlign.center, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
color: Color(0xFF868686), |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
color: Color(0xff3541C9), |
|
|
|
|
), |
|
|
|
|
),TextSpan( |
|
|
|
|
text: "元", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize:12.sp, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
color: Color(0xFFADADAD), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
)) |
|
|
|
|
), |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
recharge(); |
|
|
|
|
}, |
|
|
|
|
child: RoundButton( |
|
|
|
|
width: 103.w, |
|
|
|
|
height: 54.h, |
|
|
|
|
text: S.of(context).chongzhi, |
|
|
|
|
textColor: Colors.white, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
backgroup: Color(0xFF32A060), |
|
|
|
|
radius: 0, |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 5.h), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
Image.asset( |
|
|
|
|
"assets/image/recharge.png", |
|
|
|
|
width: 20, |
|
|
|
|
height:20, |
|
|
|
|
), |
|
|
|
|
)) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var checkIndex = 1; |
|
|
|
|
|
|
|
|
|
Widget checkView(var index) { |
|
|
|
|
return Container( |
|
|
|
|
padding: EdgeInsets.only(right: 16.w), |
|
|
|
@ -389,16 +516,17 @@ class _RechargePage extends State<RechargePage> {
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(Platform.isAndroid){ |
|
|
|
|
if (Platform.isAndroid) { |
|
|
|
|
if (!(await Min.isInitialize())) { |
|
|
|
|
// 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调, |
|
|
|
|
// 然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针, |
|
|
|
|
// 故而在此初始化一下 |
|
|
|
|
await Min.initialize(); |
|
|
|
|
}} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
BaseData<dynamic> baseData = |
|
|
|
|
await apiService.recharge({"amount": amount, "rechargeType": 2}).catchError((error) {}); |
|
|
|
|
BaseData<dynamic> baseData = await apiService.recharge( |
|
|
|
|
{"amount": amount, "rechargeType": 2}).catchError((error) {}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
WxPay wxPay = WxPay.fromJson(baseData.data); |
|
|
|
|
await registerWxApi( |
|
|
|
@ -415,8 +543,7 @@ class _RechargePage extends State<RechargePage> {
|
|
|
|
|
timeStamp: int.tryParse(wxPay.timeStamp), |
|
|
|
|
sign: wxPay.sign, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
} else { |
|
|
|
|
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|