|
|
|
@ -62,7 +62,9 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
'/router/exchange_order_success_page', |
|
|
|
|
arguments: { |
|
|
|
|
"id": widget.arguments["goodsId"], |
|
|
|
|
"price": realPay.contains("积分") ? realPay.substring(0,realPay.indexOf("积分")) : "0", |
|
|
|
|
"price": realPay.contains("积分") |
|
|
|
|
? realPay.substring(0, realPay.indexOf("积分")) |
|
|
|
|
: "0", |
|
|
|
|
"points": points, |
|
|
|
|
"realPay": realPay, |
|
|
|
|
"payChannel": widget.arguments["payChannel"], |
|
|
|
@ -73,18 +75,17 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
void dispose() { |
|
|
|
|
super.dispose(); |
|
|
|
|
if(payListen!=null) |
|
|
|
|
payListen.cancel(); |
|
|
|
|
if (payListen != null) payListen.cancel(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
queryUserBalance() async { |
|
|
|
|
BaseData<UserInfo> baseData = await apiService.queryInfo().catchError((onError) {}); |
|
|
|
|
BaseData<UserInfo> baseData = |
|
|
|
|
await apiService.queryInfo().catchError((onError) {}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
userInfo = baseData.data; |
|
|
|
|
mBalance = double.tryParse(userInfo.money); |
|
|
|
@ -125,8 +126,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
spreadRadius: 0, |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
borderRadius: |
|
|
|
|
BorderRadius.all(Radius.circular(8)), |
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(8)), |
|
|
|
|
), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
@ -213,16 +213,14 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
toAddressPicker(); |
|
|
|
|
}, |
|
|
|
|
child: Row( |
|
|
|
|
mainAxisAlignment: |
|
|
|
|
MainAxisAlignment.end, |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end, |
|
|
|
|
crossAxisAlignment: |
|
|
|
|
CrossAxisAlignment.end, |
|
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
|
children: [ |
|
|
|
|
Expanded( |
|
|
|
|
child: Text( |
|
|
|
|
(address != null && |
|
|
|
|
address != "") |
|
|
|
|
(address != null && address != "") |
|
|
|
|
? address |
|
|
|
|
: widget.arguments[ |
|
|
|
|
"useTyped"] == |
|
|
|
@ -236,11 +234,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
? 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), |
|
|
|
@ -268,8 +263,7 @@ 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( |
|
|
|
@ -278,24 +272,20 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
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)), |
|
|
|
|
), |
|
|
|
@ -644,20 +634,30 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
width: 12, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
widget.arguments["payType"] == 1 |
|
|
|
|
? "${(double.parse(widget.arguments["onePrice"]) * buyNum).toInt()}积分" |
|
|
|
|
: ((widget.arguments["price"] == null || |
|
|
|
|
widget.arguments["price"] == "0" |
|
|
|
|
? "" |
|
|
|
|
: "${(double.parse(widget.arguments["price"]) * buyNum).toInt()}积分") + |
|
|
|
|
(widget.arguments["money"] == null || |
|
|
|
|
widget.arguments["money"] == |
|
|
|
|
"0.00" |
|
|
|
|
? "" |
|
|
|
|
: " + ${AppUtils.calculateDouble(double.tryParse(widget.arguments["money"]) * buyNum) ?? 0}元")), |
|
|
|
|
// widget.arguments["payType"] == 1 |
|
|
|
|
// ? "${(double.parse(widget.arguments["oneBean"] ?? "0") * buyNum).toInt()}印章" |
|
|
|
|
// : (widget.arguments["payType"] == 2 ?"${(double.parse(widget.arguments["onePrice"]) * buyNum).toInt()}积分" |
|
|
|
|
// :((widget.arguments["price"] == null || |
|
|
|
|
// widget.arguments["price"] == "0" |
|
|
|
|
// ? (widget.arguments["oneBean"] != "0" && double.parse(userInfo?.points ?? "0") <= double.parse(widget.arguments["oneBean"] ??"0") |
|
|
|
|
// ? "${AppUtils.calculateDouble(double.parse(widget.arguments["oneBean"] ?? "0") * buyNum)}印章" |
|
|
|
|
// :(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["oneMoney"]) * buyNum)}元")) |
|
|
|
|
// : "${(double.parse(widget.arguments["price"]) * buyNum).toInt()}积分") + |
|
|
|
|
// (widget.arguments["money"] == null || |
|
|
|
|
// widget.arguments["money"] == |
|
|
|
|
// "0.00" |
|
|
|
|
// ? "" |
|
|
|
|
// : " + ${AppUtils.calculateDouble(double.tryParse(widget.arguments["money"]) * buyNum) ?? 0}元"))), |
|
|
|
|
payableAmount(), |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12, |
|
|
|
|
decoration: (widget.arguments["payType"] == 3) |
|
|
|
|
decoration: (widget.arguments["payType"] == |
|
|
|
|
4 && |
|
|
|
|
((widget.arguments["price"] != "0" && widget.arguments["money"] != "0.00" |
|
|
|
|
|| (widget.arguments["oneBean"] ?? "0") != "0" |
|
|
|
|
|| widget.arguments["onePrice"] != "0"))) |
|
|
|
|
? TextDecoration.lineThrough |
|
|
|
|
: TextDecoration.none, |
|
|
|
|
fontFamily: 'JDZhengHT', |
|
|
|
@ -669,13 +669,17 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
SizedBox( |
|
|
|
|
height: 12, |
|
|
|
|
), |
|
|
|
|
if (widget.arguments["payType"] == 3) |
|
|
|
|
if (widget.arguments["payType"] == 4 && |
|
|
|
|
(widget.arguments["price"] != "0" && |
|
|
|
|
widget.arguments["money"] != "0.00" || |
|
|
|
|
(widget.arguments["oneBean"] ?? "0") != "0" || |
|
|
|
|
widget.arguments["onePrice"] != "0")) |
|
|
|
|
Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
"现金抵扣积分", |
|
|
|
|
payableAmount().contains("印章")? "现金抵扣印章":"现金抵扣积分", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14, |
|
|
|
|
color: Color(0xFF353535), |
|
|
|
@ -685,7 +689,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
width: 12, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
"${double.parse(widget.arguments["oneMoney"]) * buyNum}元", |
|
|
|
|
"${AppUtils.calculateDouble(double.parse(widget.arguments["oneMoney"]) * buyNum)}元", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12, |
|
|
|
|
fontFamily: 'JDZhengHT', |
|
|
|
@ -715,7 +719,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
handleNeedPay(), |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontFamily: 'JDZhengHT', |
|
|
|
|
fontSize: 12.sp, color: Color(0xFF32A060)), |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
color: Color(0xFF32A060)), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
@ -778,16 +783,23 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
setState(() { |
|
|
|
|
if (widget.arguments["payType"] == 1 |
|
|
|
|
? (double.parse(widget |
|
|
|
|
.arguments["onePrice"]) * |
|
|
|
|
.arguments["oneBean"]) * |
|
|
|
|
(buyNum + 1)) > |
|
|
|
|
double.parse(points) |
|
|
|
|
: (widget.arguments["price"] == null || |
|
|
|
|
widget.arguments["price"] == "0" |
|
|
|
|
: (widget.arguments["payType"] == 2 |
|
|
|
|
? (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))) { |
|
|
|
|
double.parse(points)))) { |
|
|
|
|
SmartDialog.showToast("您的积分不足", |
|
|
|
|
alignment: Alignment.center); |
|
|
|
|
return; |
|
|
|
@ -806,8 +818,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
if (widget.arguments["payType"] == 3 || |
|
|
|
|
(widget.arguments["payType"] == 2 && |
|
|
|
|
if (widget.arguments["payType"] == 4 || |
|
|
|
|
(widget.arguments["payType"] == 3 && |
|
|
|
|
widget.arguments["money"] != "0.00")) |
|
|
|
|
Container( |
|
|
|
|
width: double.infinity, |
|
|
|
@ -962,7 +974,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox(height:100.h) |
|
|
|
|
SizedBox(height: 100.h) |
|
|
|
|
], |
|
|
|
|
)), |
|
|
|
|
Align( |
|
|
|
@ -971,11 +983,10 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
height: 54.h, |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: Colors.white, |
|
|
|
|
borderRadius: BorderRadius.circular( |
|
|
|
|
45 |
|
|
|
|
borderRadius: BorderRadius.circular(45), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
margin: EdgeInsets.only(bottom:20.h,left: 16.w,right: 16.w), |
|
|
|
|
margin: |
|
|
|
|
EdgeInsets.only(bottom: 20.h, left: 16.w, right: 16.w), |
|
|
|
|
child: Row( |
|
|
|
|
children: [ |
|
|
|
|
Spacer(), |
|
|
|
@ -1019,8 +1030,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
child: Text( |
|
|
|
|
widget.arguments["payType"] == 3 || |
|
|
|
|
(widget.arguments["payType"] == 2 && |
|
|
|
|
widget.arguments["payType"] == 4 || |
|
|
|
|
(widget.arguments["payType"] == 3 && |
|
|
|
|
widget.arguments["money"] != "0.00") |
|
|
|
|
? S.current.jiesuan |
|
|
|
|
: S.current.duihuan, |
|
|
|
@ -1029,7 +1040,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
color: Colors.white, |
|
|
|
|
), |
|
|
|
|
),), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
@ -1053,12 +1065,39 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
///应付数额价格显示 |
|
|
|
|
String payableAmount() { |
|
|
|
|
if (widget.arguments["payType"] == 0) return ""; |
|
|
|
|
if (widget.arguments["payType"] == 1) { |
|
|
|
|
return "${(double.parse(widget.arguments["oneBean"] ?? "0") * buyNum).toInt()}印章"; |
|
|
|
|
} else if (widget.arguments["payType"] == 2) { |
|
|
|
|
return "${(double.parse(widget.arguments["onePrice"]) * buyNum).toInt()}积分"; |
|
|
|
|
} else if (widget.arguments["payType"] == 3) { |
|
|
|
|
return "${(double.parse(widget.arguments["price"]) * buyNum).toInt()}积分" + " + ${AppUtils.calculateDouble(double.tryParse(widget.arguments["money"]) * buyNum) ?? 0}元"; |
|
|
|
|
} else if (widget.arguments["payType"] == 4) { |
|
|
|
|
if ((widget.arguments["oneBean"] ?? "0") != "0") { |
|
|
|
|
return "${AppUtils.calculateDouble(double.parse(widget.arguments["oneBean"] ?? "0") * buyNum)}印章"; |
|
|
|
|
} else if (widget.arguments["onePrice"] != "0") { |
|
|
|
|
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")) { |
|
|
|
|
if(widget.arguments["price"] == "0"){ |
|
|
|
|
return "${AppUtils.calculateDouble(double.parse(widget.arguments["oneMoney"]) * buyNum)}元"; |
|
|
|
|
} |
|
|
|
|
return "${(double.parse(widget.arguments["price"]) * buyNum).toInt()}积分" + " + ${AppUtils.calculateDouble(double.tryParse(widget.arguments["money"]) * buyNum) ?? 0}元"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
///总价支付价格 |
|
|
|
|
String handleNeedPay() { |
|
|
|
|
if(widget.arguments["payType"] == 0) |
|
|
|
|
return ""; |
|
|
|
|
if(widget.arguments["payType"] == 1){ |
|
|
|
|
return S.of(context).jifen_((double.parse(widget.arguments["onePrice"]) * buyNum).toInt()); |
|
|
|
|
}else if(widget.arguments["payType"] ==2){ |
|
|
|
|
if (widget.arguments["payType"] == 0) return ""; |
|
|
|
|
if (widget.arguments["payType"] == 1) { |
|
|
|
|
return "${(double.parse(widget.arguments["oneBean"]) * buyNum).toInt()}印章"; |
|
|
|
|
} |
|
|
|
|
if (widget.arguments["payType"] == 2) { |
|
|
|
|
return S.of(context).jifen_( |
|
|
|
|
(double.parse(widget.arguments["onePrice"]) * buyNum).toInt()); |
|
|
|
|
} else if (widget.arguments["payType"] == 3) { |
|
|
|
|
return (widget.arguments["price"] == null || |
|
|
|
|
widget.arguments["price"] == "0" |
|
|
|
|
? "" |
|
|
|
@ -1067,7 +1106,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
widget.arguments["money"] == "0.00" |
|
|
|
|
? "" |
|
|
|
|
: " + ${AppUtils.calculateDouble(double.tryParse(widget.arguments["money"]) * buyNum) ?? 0}元"); |
|
|
|
|
}else if(widget.arguments["payType"] == 3){ |
|
|
|
|
} else if (widget.arguments["payType"] == 4) { |
|
|
|
|
return "${AppUtils.calculateDouble(double.tryParse(widget.arguments["oneMoney"]) * buyNum) ?? 0}元"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1123,8 +1162,13 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
} |
|
|
|
|
BaseData baseDate = await apiService.creditOrder({ |
|
|
|
|
"goodsId": widget.arguments["goodsId"], |
|
|
|
|
"isOneSell": widget.arguments["payType"] != 2, |
|
|
|
|
"isPoints": !handleNeedPay().contains("元"), |
|
|
|
|
"isOneSell": widget.arguments["payType"] != 3, |
|
|
|
|
|
|
|
|
|
///增加集换卡,该字段去掉改用payType |
|
|
|
|
// "isPoints": !handleNeedPay().contains("元"), |
|
|
|
|
"payType": (widget.arguments["payType"] == 1) |
|
|
|
|
? 2 |
|
|
|
|
: ((widget.arguments["payType"] == 2) ? 1 : 3), |
|
|
|
|
"number": buyNum, |
|
|
|
|
"useTyped": widget.arguments["useTyped"], |
|
|
|
|
"payChannel": |
|
|
|
@ -1134,8 +1178,8 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
}); |
|
|
|
|
if (baseDate.isSuccess) { |
|
|
|
|
String realPay = handleNeedPay(); |
|
|
|
|
if ((widget.arguments["payType"] == 3 || |
|
|
|
|
(widget.arguments["payType"] == 2 && |
|
|
|
|
if ((widget.arguments["payType"] == 4 || |
|
|
|
|
(widget.arguments["payType"] == 3 && |
|
|
|
|
widget.arguments["money"] != "0.00")) && |
|
|
|
|
checkIndex == 3) { |
|
|
|
|
// if(Platform.isAndroid){ |
|
|
|
@ -1165,7 +1209,9 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
|
|
|
|
|
} |
|
|
|
|
await Navigator.of(context) |
|
|
|
|
.pushNamed('/router/exchange_order_success_page', arguments: { |
|
|
|
|
"price": realPay.contains("积分") ? realPay.substring(0,realPay.indexOf("积分")) : "0", |
|
|
|
|
"price": realPay.contains("积分") |
|
|
|
|
? realPay.substring(0, realPay.indexOf("积分")) |
|
|
|
|
: "0", |
|
|
|
|
"realPay": realPay, |
|
|
|
|
"points": points, |
|
|
|
|
"payChannel": widget.arguments["payChannel"], |
|
|
|
|