|
|
|
@ -9,8 +9,10 @@ import 'package:huixiang/generated/l10n.dart';
|
|
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/user_info.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/wx_pay.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/min_api.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart'; |
|
|
|
|
import 'package:huixiang/utils/font_weight.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/custom_image.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/my_appbar.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/receiving_method_dialog.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/round_button.dart'; |
|
|
|
@ -31,33 +33,33 @@ class ExchangeOrderPage extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
class _ExchangeOrderPage extends State<ExchangeOrderPage> { |
|
|
|
|
ApiService apiService; |
|
|
|
|
String money = "0"; |
|
|
|
|
String balance = "0"; |
|
|
|
|
int buyNum = 1; |
|
|
|
|
var checkIndex = 1; |
|
|
|
|
UserInfo userInfo; |
|
|
|
|
dynamic mBalance = 0; |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
void initState() { |
|
|
|
|
super.initState(); |
|
|
|
|
|
|
|
|
|
SharedPreferences.getInstance().then((value) { |
|
|
|
|
if(value.getString("minMember") == null){ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
Map<String, dynamic> memberInfo = |
|
|
|
|
jsonDecode(value.getString("minMember")); |
|
|
|
|
balance = memberInfo["balance"]; |
|
|
|
|
money = memberInfo["money"]; |
|
|
|
|
setState(() {}); |
|
|
|
|
}); |
|
|
|
|
SharedPreferences.getInstance().then((value) => { |
|
|
|
|
apiService = ApiService(Dio(), |
|
|
|
|
context: context, token: value.getString("token")), |
|
|
|
|
points = |
|
|
|
|
UserInfo.fromJson(jsonDecode(value.getString('user'))).points, |
|
|
|
|
queryUserBalance(), |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
queryUserBalance() async { |
|
|
|
|
BaseData<UserInfo> baseData = await apiService.queryInfo().catchError((onError) {}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
userInfo = baseData.data; |
|
|
|
|
mBalance = double.tryParse(userInfo.money); |
|
|
|
|
if (mounted) setState(() {}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String points; |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@ -70,15 +72,16 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
background: Color(0xFFFAFAFA), |
|
|
|
|
leadingColor: Colors.black, |
|
|
|
|
), |
|
|
|
|
body: Stack(children: [ |
|
|
|
|
body: Stack( |
|
|
|
|
children: [ |
|
|
|
|
SingleChildScrollView( |
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
widget.arguments["useTyped"] == 1? |
|
|
|
|
Container( |
|
|
|
|
margin: |
|
|
|
|
EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8), |
|
|
|
|
widget.arguments["useTyped"] == 1 |
|
|
|
|
? Container( |
|
|
|
|
margin: EdgeInsets.only( |
|
|
|
|
left: 16, right: 16, top: 26, bottom: 8), |
|
|
|
|
padding: EdgeInsets.all(20), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: Colors.white, |
|
|
|
@ -90,7 +93,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
spreadRadius: 0, |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(8)), |
|
|
|
|
borderRadius: |
|
|
|
|
BorderRadius.all(Radius.circular(8)), |
|
|
|
|
), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
@ -114,7 +118,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
SizedBox( |
|
|
|
|
height: 18.h, |
|
|
|
|
), |
|
|
|
|
GestureDetector(onTap: (){ |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
setState(() { |
|
|
|
|
showAlertDialog(); |
|
|
|
|
}); |
|
|
|
@ -131,7 +136,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
SizedBox( |
|
|
|
|
width: 12.w, |
|
|
|
|
), |
|
|
|
|
Expanded(child:Text( |
|
|
|
|
Expanded( |
|
|
|
|
child: Text( |
|
|
|
|
widget.arguments["useTyped"] == 1 |
|
|
|
|
? S.of(context).ziti |
|
|
|
|
: widget.arguments["useTyped"] == 2 |
|
|
|
@ -148,7 +154,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
),), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Visibility( |
|
|
|
|
child: SizedBox( |
|
|
|
|
height: 13.h, |
|
|
|
@ -174,23 +181,34 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
toAddressPicker(); |
|
|
|
|
}, |
|
|
|
|
child: Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end, |
|
|
|
|
mainAxisAlignment: |
|
|
|
|
MainAxisAlignment.end, |
|
|
|
|
crossAxisAlignment: |
|
|
|
|
CrossAxisAlignment.end, |
|
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
|
children: [ |
|
|
|
|
Expanded( |
|
|
|
|
child: Text( |
|
|
|
|
(address != null && address != "") |
|
|
|
|
(address != null && |
|
|
|
|
address != "") |
|
|
|
|
? address |
|
|
|
|
: widget.arguments["useTyped"] == 1 |
|
|
|
|
? S.of(context).qingxuanzhemendian |
|
|
|
|
: widget.arguments["useTyped"] == |
|
|
|
|
: widget.arguments[ |
|
|
|
|
"useTyped"] == |
|
|
|
|
1 |
|
|
|
|
? S |
|
|
|
|
.of(context) |
|
|
|
|
.qingxuanzhemendian |
|
|
|
|
: widget.arguments[ |
|
|
|
|
"useTyped"] == |
|
|
|
|
2 |
|
|
|
|
? S |
|
|
|
|
.of(context) |
|
|
|
|
.qingxuanzeshouhuodizhi |
|
|
|
|
: S.of(context).xuni, |
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
: S |
|
|
|
|
.of(context) |
|
|
|
|
.xuni, |
|
|
|
|
overflow: |
|
|
|
|
TextOverflow.ellipsis, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
@ -218,28 +236,34 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
Row( |
|
|
|
|
children: [ |
|
|
|
|
Visibility( |
|
|
|
|
visible: widget.arguments["useTyped"] != 3, |
|
|
|
|
visible: |
|
|
|
|
widget.arguments["useTyped"] != 3, |
|
|
|
|
child: Text( |
|
|
|
|
S.of(context).zitishijian, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14.sp, color: Color(0xFF353535)), |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
color: Color(0xFF353535)), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Visibility( |
|
|
|
|
visible: widget.arguments["useTyped"] != 3, |
|
|
|
|
visible: |
|
|
|
|
widget.arguments["useTyped"] != 3, |
|
|
|
|
child: SizedBox( |
|
|
|
|
width: 12.w, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
widget.arguments["useTyped"] == 1 |
|
|
|
|
? S.of(context).duihuanhouwugegongzuori |
|
|
|
|
? S |
|
|
|
|
.of(context) |
|
|
|
|
.duihuanhouwugegongzuori |
|
|
|
|
: widget.arguments["useTyped"] == 2 |
|
|
|
|
? S.of(context).duihuanhoufahuo |
|
|
|
|
: S.of(context).feishiwushangpin, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
color: widget.arguments["useTyped"] == 3 |
|
|
|
|
color: |
|
|
|
|
widget.arguments["useTyped"] == 3 |
|
|
|
|
? Color(0xFF32A060) |
|
|
|
|
: Color(0xFF353535)), |
|
|
|
|
), |
|
|
|
@ -247,7 +271,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
): |
|
|
|
|
) |
|
|
|
|
: |
|
|
|
|
// Container( |
|
|
|
|
// margin: |
|
|
|
|
// EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8), |
|
|
|
@ -328,8 +353,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
Container( |
|
|
|
|
margin: |
|
|
|
|
EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8), |
|
|
|
|
margin: EdgeInsets.only( |
|
|
|
|
left: 16, right: 16, top: 26, bottom: 8), |
|
|
|
|
padding: EdgeInsets.all(20), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: Colors.white, |
|
|
|
@ -341,7 +366,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
spreadRadius: 0, |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(8)), |
|
|
|
|
borderRadius: |
|
|
|
|
BorderRadius.all(Radius.circular(8)), |
|
|
|
|
), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
@ -365,7 +391,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
SizedBox( |
|
|
|
|
height: 18.h, |
|
|
|
|
), |
|
|
|
|
GestureDetector(onTap: (){ |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
setState(() { |
|
|
|
|
showAlertDialog(); |
|
|
|
|
}); |
|
|
|
@ -382,7 +409,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
SizedBox( |
|
|
|
|
width: 12.w, |
|
|
|
|
), |
|
|
|
|
Expanded(child:Text( |
|
|
|
|
Expanded( |
|
|
|
|
child: Text( |
|
|
|
|
widget.arguments["useTyped"] == 1 |
|
|
|
|
? S.of(context).ziti |
|
|
|
|
: widget.arguments["useTyped"] == 2 |
|
|
|
@ -399,7 +427,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
),), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Visibility( |
|
|
|
|
child: SizedBox( |
|
|
|
|
height: 13.h, |
|
|
|
@ -425,23 +454,34 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
toAddressPicker(); |
|
|
|
|
}, |
|
|
|
|
child: Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end, |
|
|
|
|
mainAxisAlignment: |
|
|
|
|
MainAxisAlignment.end, |
|
|
|
|
crossAxisAlignment: |
|
|
|
|
CrossAxisAlignment.end, |
|
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
|
children: [ |
|
|
|
|
Expanded( |
|
|
|
|
child: Text( |
|
|
|
|
(address != null && address != "") |
|
|
|
|
(address != null && |
|
|
|
|
address != "") |
|
|
|
|
? address |
|
|
|
|
: widget.arguments["useTyped"] == 1 |
|
|
|
|
? S.of(context).qingxuanzhemendian |
|
|
|
|
: widget.arguments["useTyped"] == |
|
|
|
|
: widget.arguments[ |
|
|
|
|
"useTyped"] == |
|
|
|
|
1 |
|
|
|
|
? S |
|
|
|
|
.of(context) |
|
|
|
|
.qingxuanzhemendian |
|
|
|
|
: widget.arguments[ |
|
|
|
|
"useTyped"] == |
|
|
|
|
2 |
|
|
|
|
? S |
|
|
|
|
.of(context) |
|
|
|
|
.qingxuanzeshouhuodizhi |
|
|
|
|
: S.of(context).xuni, |
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
: S |
|
|
|
|
.of(context) |
|
|
|
|
.xuni, |
|
|
|
|
overflow: |
|
|
|
|
TextOverflow.ellipsis, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
@ -470,8 +510,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Container( |
|
|
|
|
margin: |
|
|
|
|
EdgeInsets.only(left: 16, right: 16, top: 8, bottom: 16), |
|
|
|
|
margin: EdgeInsets.only( |
|
|
|
|
left: 16, right: 16, top: 8, bottom: 16), |
|
|
|
|
padding: EdgeInsets.all(20), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: Colors.white, |
|
|
|
@ -513,19 +553,13 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
mainAxisSize: MainAxisSize.max, |
|
|
|
|
children: [ |
|
|
|
|
if (widget.arguments["image"] != null) |
|
|
|
|
Image.network( |
|
|
|
|
widget.arguments["image"], |
|
|
|
|
fit: BoxFit.cover, |
|
|
|
|
MImage( |
|
|
|
|
widget?.arguments["image"] ?? "", |
|
|
|
|
width: 80, |
|
|
|
|
height: 80, |
|
|
|
|
) |
|
|
|
|
else |
|
|
|
|
Image.asset( |
|
|
|
|
"assets/image/default_1.png", |
|
|
|
|
fit: BoxFit.cover, |
|
|
|
|
width: 80, |
|
|
|
|
height: 80, |
|
|
|
|
errorSrc: "assets/image/default_1.png", |
|
|
|
|
fadeSrc: "assets/image/default_1.png", |
|
|
|
|
), |
|
|
|
|
Expanded( |
|
|
|
|
child: Container( |
|
|
|
@ -537,6 +571,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
widget.arguments["name"], |
|
|
|
|
maxLines: 2, |
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
@ -567,23 +603,31 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
"应付数额", |
|
|
|
|
style: |
|
|
|
|
TextStyle(fontSize: 14, color: Color(0xFF353535),fontWeight: MyFontWeight.regular), |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14, |
|
|
|
|
color: Color(0xFF353535), |
|
|
|
|
fontWeight: MyFontWeight.regular), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
width: 12, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
widget.arguments["payType"] == 1 ? "${double.parse(widget.arguments["onePrice"])*buyNum}积分": |
|
|
|
|
((widget.arguments["price"] == null || widget.arguments["price"] == "0" |
|
|
|
|
widget.arguments["payType"] == 1 |
|
|
|
|
? "${double.parse(widget.arguments["onePrice"]) * buyNum}积分" |
|
|
|
|
: ((widget.arguments["price"] == null || |
|
|
|
|
widget.arguments["price"] == "0" |
|
|
|
|
? "" |
|
|
|
|
: "${double.parse(widget.arguments["price"]) * buyNum}积分") + |
|
|
|
|
(widget.arguments["money"] == null || widget.arguments["money"] == "0.00" |
|
|
|
|
(widget.arguments["money"] == null || |
|
|
|
|
widget.arguments["money"] == |
|
|
|
|
"0.00" |
|
|
|
|
? "" |
|
|
|
|
: " + ${double.parse(widget.arguments["money"]) * buyNum}元")), |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12, |
|
|
|
|
decoration:(widget.arguments["payType"] == 3) ? TextDecoration.lineThrough:TextDecoration.none, |
|
|
|
|
decoration: (widget.arguments["payType"] == 3) |
|
|
|
|
? TextDecoration.lineThrough |
|
|
|
|
: TextDecoration.none, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
@ -599,8 +643,10 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
"现金抵扣积分", |
|
|
|
|
style: |
|
|
|
|
TextStyle(fontSize: 14, color: Color(0xFF353535),fontWeight: MyFontWeight.regular), |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14, |
|
|
|
|
color: Color(0xFF353535), |
|
|
|
|
fontWeight: MyFontWeight.regular), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
width: 12, |
|
|
|
@ -624,7 +670,9 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
Text( |
|
|
|
|
"合计", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14.sp, color: Color(0xFF353535),fontWeight: MyFontWeight.regular), |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
color: Color(0xFF353535), |
|
|
|
|
fontWeight: MyFontWeight.regular), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
width: 12.w, |
|
|
|
@ -640,8 +688,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Container( |
|
|
|
|
margin: |
|
|
|
|
EdgeInsets.only(left: 16, right: 16, bottom: 8), |
|
|
|
|
margin: EdgeInsets.only(left: 16, right: 16, bottom: 8), |
|
|
|
|
padding: EdgeInsets.all(20), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: Colors.white, |
|
|
|
@ -659,7 +706,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
children: [ |
|
|
|
|
Row( |
|
|
|
|
children: [ |
|
|
|
|
Expanded(child: Text( |
|
|
|
|
Expanded( |
|
|
|
|
child: Text( |
|
|
|
|
"兑换数量", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
@ -669,8 +717,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
InkWell( |
|
|
|
|
onTap: () { |
|
|
|
|
setState(() { |
|
|
|
|
if(buyNum > 1) |
|
|
|
|
buyNum -= 1; |
|
|
|
|
if (buyNum > 1) buyNum -= 1; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
child: Image.asset( |
|
|
|
@ -694,13 +741,20 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
InkWell( |
|
|
|
|
onTap: () { |
|
|
|
|
setState(() { |
|
|
|
|
if(widget.arguments["payType"] == 1 ? |
|
|
|
|
(double.parse(widget.arguments["onePrice"])*(buyNum+1)) |
|
|
|
|
> double.parse(points): |
|
|
|
|
(widget.arguments["price"] == null || widget.arguments["price"] == "0" |
|
|
|
|
if (widget.arguments["payType"] == 1 |
|
|
|
|
? (double.parse(widget |
|
|
|
|
.arguments["onePrice"]) * |
|
|
|
|
(buyNum + 1)) > |
|
|
|
|
double.parse(points) |
|
|
|
|
: (widget.arguments["price"] == null || |
|
|
|
|
widget.arguments["price"] == "0" |
|
|
|
|
? false |
|
|
|
|
: (double.parse(widget.arguments["price"])*(buyNum+1)) > double.parse(points))){ |
|
|
|
|
SmartDialog.showToast("您的积分不足", alignment: Alignment.center); |
|
|
|
|
: (double.parse(widget |
|
|
|
|
.arguments["price"]) * |
|
|
|
|
(buyNum + 1)) > |
|
|
|
|
double.parse(points))) { |
|
|
|
|
SmartDialog.showToast("您的积分不足", |
|
|
|
|
alignment: Alignment.center); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
buyNum += 1; |
|
|
|
@ -777,7 +831,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
flex: 1, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
"¥$money", |
|
|
|
|
"¥$mBalance", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
color: Color(0xff353535), |
|
|
|
@ -848,7 +902,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
child: Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
|
mainAxisAlignment: |
|
|
|
|
MainAxisAlignment.spaceBetween, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
checkPayView(3), |
|
|
|
@ -874,14 +929,16 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
SizedBox(height: 40) |
|
|
|
|
], |
|
|
|
|
)), |
|
|
|
|
Align(alignment: Alignment.bottomCenter,child: |
|
|
|
|
Container( |
|
|
|
|
Align( |
|
|
|
|
alignment: Alignment.bottomCenter, |
|
|
|
|
child: Container( |
|
|
|
|
height: 54.h, |
|
|
|
|
color: Colors.white, |
|
|
|
|
child: Row( |
|
|
|
|
children: [ |
|
|
|
|
Spacer(), |
|
|
|
|
Padding(padding: EdgeInsets.only(top: 7,right: 16), |
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsets.only(top: 7, right: 16), |
|
|
|
|
child: Column( |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
@ -893,7 +950,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
color: Colors.black, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Text(handleNeedPay(), |
|
|
|
|
Text( |
|
|
|
|
handleNeedPay(), |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
@ -912,8 +970,9 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
height: 54.h, |
|
|
|
|
text: widget.arguments["payType"] == 3 || |
|
|
|
|
(widget.arguments["payType"] == 2 && |
|
|
|
|
widget.arguments["money"] != "0.00") ? |
|
|
|
|
S.current.jiesuan : S.current.duihuan, |
|
|
|
|
widget.arguments["money"] != "0.00") |
|
|
|
|
? S.current.jiesuan |
|
|
|
|
: S.current.duihuan, |
|
|
|
|
textColor: Colors.white, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
backgroup: Color(0xFF32A060), |
|
|
|
@ -925,8 +984,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
)) |
|
|
|
|
],) |
|
|
|
|
); |
|
|
|
|
], |
|
|
|
|
)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
///领取方式弹窗 |
|
|
|
@ -945,12 +1004,18 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String handleNeedPay() { |
|
|
|
|
return widget.arguments["payType"] == 1 ? |
|
|
|
|
"${double.parse(widget.arguments["onePrice"])*buyNum}积分".toString() : (widget.arguments["payType"] == 2 |
|
|
|
|
? ((widget.arguments["price"] == null || widget.arguments["price"] == "0" |
|
|
|
|
? "" : "${double.parse(widget.arguments["price"]) * buyNum}积分") + |
|
|
|
|
(widget.arguments["money"] == null || widget.arguments["money"] == "0.00" |
|
|
|
|
? "" : " + ${double.parse(widget.arguments["money"])*buyNum}元")):"${double.parse(widget.arguments["oneMoney"])*buyNum}元"); |
|
|
|
|
return widget.arguments["payType"] == 1 |
|
|
|
|
? "${double.parse(widget.arguments["onePrice"]) * buyNum}积分".toString() |
|
|
|
|
: (widget.arguments["payType"] == 2 |
|
|
|
|
? ((widget.arguments["price"] == null || |
|
|
|
|
widget.arguments["price"] == "0" |
|
|
|
|
? "" |
|
|
|
|
: "${double.parse(widget.arguments["price"]) * buyNum}积分") + |
|
|
|
|
(widget.arguments["money"] == null || |
|
|
|
|
widget.arguments["money"] == "0.00" |
|
|
|
|
? "" |
|
|
|
|
: " + ${double.parse(widget.arguments["money"]) * buyNum}元")) |
|
|
|
|
: "${double.parse(widget.arguments["oneMoney"]) * buyNum}元"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Widget checkPayView(var index) { |
|
|
|
@ -1008,11 +1073,13 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
"isPoints": !handleNeedPay().contains("元"), |
|
|
|
|
"number": buyNum, |
|
|
|
|
"useTyped": widget.arguments["useTyped"], |
|
|
|
|
"payChannel":handleNeedPay().contains("元") ? (checkIndex == 3?"1":"4") : "0", |
|
|
|
|
"payChannel": |
|
|
|
|
handleNeedPay().contains("元") ? (checkIndex == 3 ? "1" : "4") : "0", |
|
|
|
|
if (widget.arguments["useTyped"] == 1) "storeId": storeId, |
|
|
|
|
if (widget.arguments["useTyped"] == 2) "userAddressId": userAddressId, |
|
|
|
|
}); |
|
|
|
|
if (baseDate.isSuccess) { |
|
|
|
|
String realPay = handleNeedPay(); |
|
|
|
|
if ((widget.arguments["payType"] == 3 || |
|
|
|
|
(widget.arguments["payType"] == 2 && |
|
|
|
|
widget.arguments["money"] != "0.00")) && |
|
|
|
@ -1045,13 +1112,9 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
'/router/exchange_order_success_page', |
|
|
|
|
arguments: { |
|
|
|
|
"id": widget.arguments["goodsId"], |
|
|
|
|
"price": (widget.arguments["payType"] == 1 ? |
|
|
|
|
(double.parse(widget.arguments["onePrice"])*buyNum).toString(): |
|
|
|
|
(widget.arguments["price"] == null || widget.arguments["price"] == "0" |
|
|
|
|
? "0" |
|
|
|
|
: (double.parse(widget.arguments["price"])*buyNum).toString())), |
|
|
|
|
"price": realPay.contains("积分") ? realPay.substring(0,realPay.indexOf("积分")) : "0", |
|
|
|
|
"points": points, |
|
|
|
|
"realPay":handleNeedPay(), |
|
|
|
|
"realPay": realPay, |
|
|
|
|
"payChannel": widget.arguments["payChannel"], |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
@ -1059,18 +1122,13 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
SmartDialog.showToast("支付失败", alignment: Alignment.center); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
await Navigator.of(context) |
|
|
|
|
.pushNamed('/router/exchange_order_success_page', arguments: { |
|
|
|
|
"price": (widget.arguments["payType"] == 1 ? |
|
|
|
|
(double.parse(widget.arguments["onePrice"])*buyNum).toString(): |
|
|
|
|
(widget.arguments["price"] == null || widget.arguments["price"] == "0" |
|
|
|
|
? "0" |
|
|
|
|
: (double.parse(widget.arguments["price"])*buyNum).toString())), |
|
|
|
|
"realPay":handleNeedPay(), |
|
|
|
|
"price": realPay.contains("积分") ? realPay.substring(0,realPay.indexOf("积分")) : "0", |
|
|
|
|
"realPay": realPay, |
|
|
|
|
"points": points, |
|
|
|
|
"payChannel": widget.arguments["payChannel"], |
|
|
|
|
"id": baseDate.data |
|
|
|
|