|
|
@ -1,14 +1,12 @@ |
|
|
|
import 'dart:convert'; |
|
|
|
import 'dart:convert'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
|
|
|
|
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
import 'package:huixiang/utils/font_weight.dart'; |
|
|
|
import 'package:huixiang/utils/font_weight.dart'; |
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
|
|
|
|
|
|
|
|
import '../../retrofit/data/min_order_info.dart'; |
|
|
|
import '../../retrofit/data/min_order_info.dart'; |
|
|
|
import '../../retrofit/data/settleOrderInfo.dart'; |
|
|
|
import '../../retrofit/data/settleOrderInfo.dart'; |
|
|
|
import '../../view_widget/settlement_tips_dialog.dart'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PayMethod extends StatefulWidget { |
|
|
|
class PayMethod extends StatefulWidget { |
|
|
|
final Function(int payChannel) payChannelCheck; |
|
|
|
final Function(int payChannel) payChannelCheck; |
|
|
@ -95,6 +93,17 @@ class _PayMethod extends State<PayMethod> { |
|
|
|
GestureDetector( |
|
|
|
GestureDetector( |
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
onTap: () { |
|
|
|
onTap: () { |
|
|
|
|
|
|
|
double m = double.parse(money); |
|
|
|
|
|
|
|
if (m == null) { |
|
|
|
|
|
|
|
m = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
double orderSum = double.parse(widget.settleOrderInfo?.orderSum ?? '0'); |
|
|
|
|
|
|
|
if (orderSum == null) { |
|
|
|
|
|
|
|
orderSum = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (orderSum > m) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
setState(() { |
|
|
|
setState(() { |
|
|
|
checkIndex = 1; |
|
|
|
checkIndex = 1; |
|
|
|
}); |
|
|
|
}); |
|
|
@ -104,7 +113,7 @@ class _PayMethod extends State<PayMethod> { |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
checkView(1), |
|
|
|
checkView(1, isHide: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(money) ?? 0)), |
|
|
|
Expanded( |
|
|
|
Expanded( |
|
|
|
child: Container(), |
|
|
|
child: Container(), |
|
|
|
flex: 1, |
|
|
|
flex: 1, |
|
|
@ -114,7 +123,7 @@ class _PayMethod extends State<PayMethod> { |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14.sp, |
|
|
|
fontSize: 14.sp, |
|
|
|
fontFamily: 'JDZhengHT', |
|
|
|
fontFamily: 'JDZhengHT', |
|
|
|
color: Color(0xff353535), |
|
|
|
color: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(money) ?? 0) ? Color(0x66353535) : Color(0xff353535), |
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
@ -125,7 +134,7 @@ class _PayMethod extends State<PayMethod> { |
|
|
|
S.of(context).huixiangqianbao, |
|
|
|
S.of(context).huixiangqianbao, |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14.sp, |
|
|
|
fontSize: 14.sp, |
|
|
|
color: Color(0xff353535), |
|
|
|
color: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(money) ?? 0) ? Color(0x66353535) : Color(0xff353535), |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
@ -140,6 +149,17 @@ class _PayMethod extends State<PayMethod> { |
|
|
|
GestureDetector( |
|
|
|
GestureDetector( |
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
onTap: () { |
|
|
|
onTap: () { |
|
|
|
|
|
|
|
double balanceMoney = double.parse(balance); |
|
|
|
|
|
|
|
if (balanceMoney == null) { |
|
|
|
|
|
|
|
balanceMoney = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
double orderSum = double.parse(widget.settleOrderInfo?.orderSum ?? '0'); |
|
|
|
|
|
|
|
if (orderSum == null) { |
|
|
|
|
|
|
|
orderSum = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (orderSum > balanceMoney) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
setState(() { |
|
|
|
setState(() { |
|
|
|
checkIndex = 2; |
|
|
|
checkIndex = 2; |
|
|
|
}); |
|
|
|
}); |
|
|
@ -149,7 +169,7 @@ class _PayMethod extends State<PayMethod> { |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
checkView(2), |
|
|
|
checkView(2, isHide: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(balance) ?? 0)), |
|
|
|
Expanded( |
|
|
|
Expanded( |
|
|
|
child: Container(), |
|
|
|
child: Container(), |
|
|
|
flex: 1, |
|
|
|
flex: 1, |
|
|
@ -159,7 +179,7 @@ class _PayMethod extends State<PayMethod> { |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14.sp, |
|
|
|
fontSize: 14.sp, |
|
|
|
fontFamily: 'JDZhengHT', |
|
|
|
fontFamily: 'JDZhengHT', |
|
|
|
color: Color(0xff353535), |
|
|
|
color: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(balance) ?? 0) ? Color(0x66353535) : Color(0xff353535), |
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
@ -170,7 +190,7 @@ class _PayMethod extends State<PayMethod> { |
|
|
|
S.of(context).mendianyue, |
|
|
|
S.of(context).mendianyue, |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14.sp, |
|
|
|
fontSize: 14.sp, |
|
|
|
color: Color(0xff353535), |
|
|
|
color: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(balance) ?? 0) ? Color(0x66353535) : Color(0xff353535), |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
@ -189,7 +209,11 @@ class _PayMethod extends State<PayMethod> { |
|
|
|
if (greenMoney == null) { |
|
|
|
if (greenMoney == null) { |
|
|
|
greenMoney = 0; |
|
|
|
greenMoney = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
if (widget.settleOrderInfo.orderNum > greenMoney) { |
|
|
|
double orderSum = double.parse(widget.settleOrderInfo?.orderSum ?? '0'); |
|
|
|
|
|
|
|
if (orderSum == null) { |
|
|
|
|
|
|
|
orderSum = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (orderSum > greenMoney) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
setState(() { |
|
|
|
setState(() { |
|
|
@ -215,14 +239,14 @@ class _PayMethod extends State<PayMethod> { |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
checkView(3), |
|
|
|
checkView(3, isHide: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(mGreenMoney) ?? 0)), |
|
|
|
Spacer(flex: 1,), |
|
|
|
Spacer(flex: 1,), |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
"¥$mGreenMoney", |
|
|
|
"¥$mGreenMoney", |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14.sp, |
|
|
|
fontSize: 14.sp, |
|
|
|
fontFamily: 'JDZhengHT', |
|
|
|
fontFamily: 'JDZhengHT', |
|
|
|
color: Color(0xff353535), |
|
|
|
color: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(mGreenMoney) ?? 0) ? Color(0x66353535) : Color(0xff353535), |
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
@ -233,7 +257,7 @@ class _PayMethod extends State<PayMethod> { |
|
|
|
S.of(context).lvbizhifu, |
|
|
|
S.of(context).lvbizhifu, |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14.sp, |
|
|
|
fontSize: 14.sp, |
|
|
|
color: widget.settleOrderInfo.orderNum > (double.parse(mGreenMoney) ?? 0) ? Color(0x66353535) : Color(0xff353535), |
|
|
|
color: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(mGreenMoney) ?? 0) ? Color(0x66353535) : Color(0xff353535), |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
@ -248,17 +272,28 @@ class _PayMethod extends State<PayMethod> { |
|
|
|
GestureDetector( |
|
|
|
GestureDetector( |
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
onTap: () { |
|
|
|
onTap: () { |
|
|
|
setState(() { |
|
|
|
double raiseMoney = double.parse(mRaiseMoney); |
|
|
|
checkIndex = 4; |
|
|
|
if (raiseMoney == null) { |
|
|
|
if(widget.promotions != "" || widget.coupons != "" || widget.useVipPriceSelect || widget.useBenefitSelect){ |
|
|
|
raiseMoney = 0; |
|
|
|
SmartDialog.show( |
|
|
|
} |
|
|
|
widget: SettlementTips( |
|
|
|
double orderSum = double.parse(widget.settleOrderInfo?.orderSum ?? '0'); |
|
|
|
() {}, |
|
|
|
if (orderSum == null) { |
|
|
|
text: "助农积分不参与任何活动优惠,请重新选择支付方式", |
|
|
|
orderSum = 0; |
|
|
|
), |
|
|
|
} |
|
|
|
); |
|
|
|
if (orderSum > raiseMoney) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
setState(() { |
|
|
|
|
|
|
|
checkIndex = 4; |
|
|
|
|
|
|
|
// if(widget.promotions != "" || widget.coupons != "" || widget.useVipPriceSelect || widget.useBenefitSelect){ |
|
|
|
|
|
|
|
// SmartDialog.show( |
|
|
|
|
|
|
|
// widget: SettlementTips( |
|
|
|
|
|
|
|
// () {}, |
|
|
|
|
|
|
|
// text: "助农积分不参与任何活动优惠,请重新选择支付方式", |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// ); |
|
|
|
|
|
|
|
// return; |
|
|
|
|
|
|
|
// } |
|
|
|
}); |
|
|
|
}); |
|
|
|
widget.payChannelCheck(7); |
|
|
|
widget.payChannelCheck(7); |
|
|
|
}, |
|
|
|
}, |
|
|
@ -266,9 +301,8 @@ class _PayMethod extends State<PayMethod> { |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
checkView(4), |
|
|
|
checkView(4, isHide: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(mRaiseMoney) ?? 0)), |
|
|
|
Expanded( |
|
|
|
Spacer( |
|
|
|
child: Container(), |
|
|
|
|
|
|
|
flex: 1, |
|
|
|
flex: 1, |
|
|
|
), |
|
|
|
), |
|
|
|
Text( |
|
|
|
Text( |
|
|
@ -276,7 +310,7 @@ class _PayMethod extends State<PayMethod> { |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14.sp, |
|
|
|
fontSize: 14.sp, |
|
|
|
fontFamily: 'JDZhengHT', |
|
|
|
fontFamily: 'JDZhengHT', |
|
|
|
color: Color(0xff353535), |
|
|
|
color: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(mRaiseMoney) ?? 0) ? Color(0x66353535) : Color(0xff353535), |
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
@ -287,7 +321,7 @@ class _PayMethod extends State<PayMethod> { |
|
|
|
S.of(context).zhunongjifen, |
|
|
|
S.of(context).zhunongjifen, |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14.sp, |
|
|
|
fontSize: 14.sp, |
|
|
|
color: Color(0xff353535), |
|
|
|
color: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(mRaiseMoney) ?? 0) ? Color(0x66353535) : Color(0xff353535), |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
@ -333,7 +367,15 @@ class _PayMethod extends State<PayMethod> { |
|
|
|
|
|
|
|
|
|
|
|
var checkIndex = 5; |
|
|
|
var checkIndex = 5; |
|
|
|
|
|
|
|
|
|
|
|
Widget checkView(var index) { |
|
|
|
Widget checkView(var index, {bool isHide = false}) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isHide) { |
|
|
|
|
|
|
|
return Container( |
|
|
|
|
|
|
|
padding: EdgeInsets.only(right:36.w), |
|
|
|
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return Container( |
|
|
|
return Container( |
|
|
|
padding: EdgeInsets.only(right:36.w), |
|
|
|
padding: EdgeInsets.only(right:36.w), |
|
|
|
alignment: Alignment.center, |
|
|
|
alignment: Alignment.center, |
|
|
|