|
|
@ -41,6 +41,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> { |
|
|
|
UserInfo userInfo; |
|
|
|
UserInfo userInfo; |
|
|
|
dynamic payListen; |
|
|
|
dynamic payListen; |
|
|
|
dynamic mBalance = 0; |
|
|
|
dynamic mBalance = 0; |
|
|
|
|
|
|
|
String happyBean; |
|
|
|
|
|
|
|
String points; |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
void initState() { |
|
|
|
void initState() { |
|
|
@ -49,8 +51,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> { |
|
|
|
SharedPreferences.getInstance().then((value) => { |
|
|
|
SharedPreferences.getInstance().then((value) => { |
|
|
|
apiService = ApiService(Dio(), |
|
|
|
apiService = ApiService(Dio(), |
|
|
|
context: context, token: value.getString("token")), |
|
|
|
context: context, token: value.getString("token")), |
|
|
|
points = |
|
|
|
points = UserInfo.fromJson(jsonDecode(value.getString('user'))).points, |
|
|
|
UserInfo.fromJson(jsonDecode(value.getString('user'))).points, |
|
|
|
happyBean = UserInfo.fromJson(jsonDecode(value.getString('user'))).happyBean, |
|
|
|
queryUserBalance(), |
|
|
|
queryUserBalance(), |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -66,6 +68,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> { |
|
|
|
? realPay.substring(0, realPay.indexOf("积分")) |
|
|
|
? realPay.substring(0, realPay.indexOf("积分")) |
|
|
|
: "0", |
|
|
|
: "0", |
|
|
|
"points": points, |
|
|
|
"points": points, |
|
|
|
|
|
|
|
"happyBean":happyBean, |
|
|
|
"realPay": realPay, |
|
|
|
"realPay": realPay, |
|
|
|
"payChannel": widget.arguments["payChannel"], |
|
|
|
"payChannel": widget.arguments["payChannel"], |
|
|
|
}, |
|
|
|
}, |
|
|
@ -93,8 +96,6 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String points; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
|
Widget build(BuildContext context) { |
|
|
|
return Scaffold( |
|
|
|
return Scaffold( |
|
|
@ -639,7 +640,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> { |
|
|
|
// : (widget.arguments["payType"] == 2 ?"${(double.parse(widget.arguments["onePrice"]) * buyNum).toInt()}积分" |
|
|
|
// : (widget.arguments["payType"] == 2 ?"${(double.parse(widget.arguments["onePrice"]) * buyNum).toInt()}积分" |
|
|
|
// :((widget.arguments["price"] == null || |
|
|
|
// :((widget.arguments["price"] == null || |
|
|
|
// widget.arguments["price"] == "0" |
|
|
|
// widget.arguments["price"] == "0" |
|
|
|
// ? (widget.arguments["oneBean"] != "0" && double.parse(userInfo?.points ?? "0") <= double.parse(widget.arguments["oneBean"] ??"0") |
|
|
|
// ? (widget.arguments["oneBean"] != "0" && double.parse(userInfo?.happyBean ?? "0") <= double.parse(widget.arguments["oneBean"] ??"0") |
|
|
|
// ? "${AppUtils.calculateDouble(double.parse(widget.arguments["oneBean"] ?? "0") * buyNum)}印章" |
|
|
|
// ? "${AppUtils.calculateDouble(double.parse(widget.arguments["oneBean"] ?? "0") * buyNum)}印章" |
|
|
|
// :(widget.arguments["onePrice"] != "0" && double.parse(userInfo?.points ?? "0") <= double.parse(widget.arguments["onePrice"]) |
|
|
|
// :(widget.arguments["onePrice"] != "0" && double.parse(userInfo?.points ?? "0") <= double.parse(widget.arguments["onePrice"]) |
|
|
|
// ?"${AppUtils.calculateDouble(double.parse(widget.arguments["onePrice"]) * buyNum)}积分" |
|
|
|
// ?"${AppUtils.calculateDouble(double.parse(widget.arguments["onePrice"]) * buyNum)}积分" |
|
|
@ -679,7 +680,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> { |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
payableAmount().contains("印章")? "现金抵扣印章":"现金抵扣积分", |
|
|
|
payableAmount().contains("集换卡")? "现金抵扣集换卡":"现金抵扣积分", |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14, |
|
|
|
fontSize: 14, |
|
|
|
color: Color(0xFF353535), |
|
|
|
color: Color(0xFF353535), |
|
|
@ -785,7 +786,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> { |
|
|
|
? (double.parse(widget |
|
|
|
? (double.parse(widget |
|
|
|
.arguments["oneBean"]) * |
|
|
|
.arguments["oneBean"]) * |
|
|
|
(buyNum + 1)) > |
|
|
|
(buyNum + 1)) > |
|
|
|
double.parse(points) |
|
|
|
double.parse(happyBean) |
|
|
|
: (widget.arguments["payType"] == 2 |
|
|
|
: (widget.arguments["payType"] == 2 |
|
|
|
? (double.parse(widget.arguments[ |
|
|
|
? (double.parse(widget.arguments[ |
|
|
|
"onePrice"]) * |
|
|
|
"onePrice"]) * |
|
|
@ -901,7 +902,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> { |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox( |
|
|
|
SizedBox( |
|
|
|
height: 10, |
|
|
|
height: 10.h, |
|
|
|
), |
|
|
|
), |
|
|
|
// GestureDetector( |
|
|
|
// GestureDetector( |
|
|
|
// onTap: () { |
|
|
|
// onTap: () { |
|
|
@ -941,7 +942,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> { |
|
|
|
// ), |
|
|
|
// ), |
|
|
|
// ), |
|
|
|
// ), |
|
|
|
SizedBox( |
|
|
|
SizedBox( |
|
|
|
height: 10, |
|
|
|
height: 10.h, |
|
|
|
), |
|
|
|
), |
|
|
|
GestureDetector( |
|
|
|
GestureDetector( |
|
|
|
onTap: () { |
|
|
|
onTap: () { |
|
|
@ -1069,14 +1070,14 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> { |
|
|
|
String payableAmount() { |
|
|
|
String payableAmount() { |
|
|
|
if (widget.arguments["payType"] == 0) return ""; |
|
|
|
if (widget.arguments["payType"] == 0) return ""; |
|
|
|
if (widget.arguments["payType"] == 1) { |
|
|
|
if (widget.arguments["payType"] == 1) { |
|
|
|
return "${(double.parse(widget.arguments["oneBean"] ?? "0") * buyNum).toInt()}印章"; |
|
|
|
return "${(double.parse(widget.arguments["oneBean"] ?? "0") * buyNum).toInt()}集换卡"; |
|
|
|
} else if (widget.arguments["payType"] == 2) { |
|
|
|
} else if (widget.arguments["payType"] == 2) { |
|
|
|
return "${(double.parse(widget.arguments["onePrice"]) * buyNum).toInt()}积分"; |
|
|
|
return "${(double.parse(widget.arguments["onePrice"]) * buyNum).toInt()}积分"; |
|
|
|
} else if (widget.arguments["payType"] == 3) { |
|
|
|
} else if (widget.arguments["payType"] == 3) { |
|
|
|
return "${(double.parse(widget.arguments["price"]) * buyNum).toInt()}积分" + " + ${AppUtils.calculateDouble(double.tryParse(widget.arguments["money"]) * buyNum) ?? 0}元"; |
|
|
|
return "${(double.parse(widget.arguments["price"]) * buyNum).toInt()}积分" + " + ${AppUtils.calculateDouble(double.tryParse(widget.arguments["money"]) * buyNum) ?? 0}元"; |
|
|
|
} else if (widget.arguments["payType"] == 4) { |
|
|
|
} else if (widget.arguments["payType"] == 4) { |
|
|
|
if ((widget.arguments["oneBean"] ?? "0") != "0") { |
|
|
|
if ((widget.arguments["oneBean"] ?? "0") != "0") { |
|
|
|
return "${AppUtils.calculateDouble(double.parse(widget.arguments["oneBean"] ?? "0") * buyNum)}印章"; |
|
|
|
return "${AppUtils.calculateDouble(double.parse(widget.arguments["oneBean"] ?? "0") * buyNum)}集换卡"; |
|
|
|
} else if (widget.arguments["onePrice"] != "0") { |
|
|
|
} else if (widget.arguments["onePrice"] != "0") { |
|
|
|
return "${AppUtils.calculateDouble(double.parse(widget.arguments["onePrice"]) * buyNum)}积分"; |
|
|
|
return "${AppUtils.calculateDouble(double.parse(widget.arguments["onePrice"]) * buyNum)}积分"; |
|
|
|
} else if ((widget.arguments["price"] != null || widget.arguments["price"] != "0") && (widget.arguments["money"] != null || widget.arguments["money"] != "0.00")) { |
|
|
|
} else if ((widget.arguments["price"] != null || widget.arguments["price"] != "0") && (widget.arguments["money"] != null || widget.arguments["money"] != "0.00")) { |
|
|
@ -1092,7 +1093,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> { |
|
|
|
String handleNeedPay() { |
|
|
|
String handleNeedPay() { |
|
|
|
if (widget.arguments["payType"] == 0) return ""; |
|
|
|
if (widget.arguments["payType"] == 0) return ""; |
|
|
|
if (widget.arguments["payType"] == 1) { |
|
|
|
if (widget.arguments["payType"] == 1) { |
|
|
|
return "${(double.parse(widget.arguments["oneBean"]) * buyNum).toInt()}印章"; |
|
|
|
return "${(double.parse(widget.arguments["oneBean"]) * buyNum).toInt()}集换卡"; |
|
|
|
} |
|
|
|
} |
|
|
|
if (widget.arguments["payType"] == 2) { |
|
|
|
if (widget.arguments["payType"] == 2) { |
|
|
|
return S.of(context).jifen_( |
|
|
|
return S.of(context).jifen_( |
|
|
@ -1214,11 +1215,11 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> { |
|
|
|
: "0", |
|
|
|
: "0", |
|
|
|
"realPay": realPay, |
|
|
|
"realPay": realPay, |
|
|
|
"points": points, |
|
|
|
"points": points, |
|
|
|
|
|
|
|
"happyBean":happyBean, |
|
|
|
"payChannel": widget.arguments["payChannel"], |
|
|
|
"payChannel": widget.arguments["payChannel"], |
|
|
|
"id": baseDate.data |
|
|
|
"id": baseDate.data |
|
|
|
}); |
|
|
|
}); |
|
|
|
points = |
|
|
|
points = "${int.tryParse(points) - int.tryParse(widget.arguments["price"])}"; |
|
|
|
"${int.tryParse(points) - int.tryParse(widget.arguments["price"])}"; |
|
|
|
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
Navigator.of(context).pop(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
SmartDialog.showToast(baseDate.msg, alignment: Alignment.center); |
|
|
|
SmartDialog.showToast(baseDate.msg, alignment: Alignment.center); |
|
|
|