Browse Source

PayMethod 修改

dart3
wurong 7 months ago
parent
commit
e1491699ad
  1. 473
      lib/settlement/settlement_view/pay_method.dart

473
lib/settlement/settlement_view/pay_method.dart

@ -1,15 +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/data/min_order_info.dart'; import 'package:huixiang/data/min_order_info.dart';
import 'package:huixiang/data/settle_order_info.dart'; import 'package:huixiang/data/settle_order_info.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 '../../view_widget/settlement_tips_dialog.dart';
class PayMethod extends StatefulWidget { class PayMethod extends StatefulWidget {
final Function(int payChannel) payChannelCheck; final Function(int payChannel) payChannelCheck;
final String coupons; final String coupons;
@ -92,232 +89,277 @@ class _PayMethod extends State<PayMethod> {
), ),
), ),
), ),
if(widget.tableId > 0 ? !(widget.minOrderInfo?.isRaise ?? false) : !(widget.settleOrderInfo?.isRaise ?? false)) if(widget.tableId > 0 ? !(widget?.minOrderInfo?.isRaise ?? false) : !(widget?.settleOrderInfo?.isRaise ?? false))
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
setState(() { double m = double.parse(money);
checkIndex = 1; if (m == null) {
}); m = 0;
widget.payChannelCheck(4); }
}, double orderSum = double.parse(widget.settleOrderInfo?.orderSum ?? '0');
child: Row( if (orderSum == null) {
mainAxisAlignment: MainAxisAlignment.center, orderSum = 0;
crossAxisAlignment: CrossAxisAlignment.center, }
children: [ if (orderSum > m) {
checkView(1), return;
Expanded( }
child: Container(), setState(() {
flex: 1, checkIndex = 1;
), });
Text( widget.payChannelCheck(4);
"¥$money", },
style: TextStyle( child: Row(
fontSize: 14.sp, mainAxisAlignment: MainAxisAlignment.center,
fontFamily: 'JDZhengHT', crossAxisAlignment: CrossAxisAlignment.center,
color: Color(0xff353535), children: [
fontWeight: MyFontWeight.medium, checkView(1, isHide: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(money) ?? 0)),
Expanded(
child: Container(),
flex: 1,
), ),
), Text(
SizedBox( "¥$money",
width: 10, style: TextStyle(
), fontSize: 14.sp,
Text( fontFamily: 'JDZhengHT',
S.of(context).huixiangqianbao, color: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(money) ?? 0) ? Color(0x66353535) : Color(0xff353535),
style: TextStyle( fontWeight: MyFontWeight.medium,
fontSize: 14.sp, ),
color: Color(0xff353535),
fontWeight: MyFontWeight.semi_bold,
), ),
), SizedBox(
], width: 10,
),
),
if(widget.tableId > 0 ? !(widget.minOrderInfo?.isRaise ?? false) : !(widget.settleOrderInfo?.isRaise ?? false))
SizedBox(
height: 10,
),
if(widget.tableId > 0 ? !(widget.minOrderInfo?.isRaise ?? false) : !(widget.settleOrderInfo?.isRaise ?? false))
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
checkIndex = 2;
});
widget.payChannelCheck(3);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
checkView(2),
Expanded(
child: Container(),
flex: 1,
),
Text(
"¥$balance",
style: TextStyle(
fontSize: 14.sp,
fontFamily: 'JDZhengHT',
color: Color(0xff353535),
fontWeight: MyFontWeight.medium,
), ),
), Text(
SizedBox( S.of(context).huixiangqianbao,
width: 10, style: TextStyle(
), fontSize: 14.sp,
Text( color: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(money) ?? 0) ? Color(0x66353535) : Color(0xff353535),
S.of(context).mendianyue, fontWeight: MyFontWeight.semi_bold,
style: TextStyle( ),
fontSize: 14.sp,
color: Color(0xff353535),
fontWeight: MyFontWeight.semi_bold,
), ),
), ],
], ),
), ),
), if(widget.tableId > 0 ? !(widget?.minOrderInfo?.isRaise ?? false) : !(widget?.settleOrderInfo?.isRaise ?? false))
if(widget.tableId > 0 ? !(widget.minOrderInfo?.isRaise ?? false) : !(widget.settleOrderInfo?.isRaise ?? false)) SizedBox(
SizedBox( height: 10,
height: 10, ),
), if(widget.tableId > 0 ? !(widget?.minOrderInfo?.isRaise ?? false) : !(widget?.settleOrderInfo?.isRaise ?? false))
if(mGreenMoney!="0.00" && (widget.tableId > 0 ? !(widget.minOrderInfo?.isRaise ?? false) : !(widget.settleOrderInfo?.isRaise ?? false))) GestureDetector(
GestureDetector( behavior: HitTestBehavior.opaque,
behavior: HitTestBehavior.opaque, onTap: () {
onTap: () { double balanceMoney = double.parse(balance);
setState(() { if (balanceMoney == null) {
checkIndex = 3; balanceMoney = 0;
if(widget.promotions != "" || widget.coupons != "" || widget.useVipPriceSelect || widget.useBenefitSelect){ }
SmartDialog.show( double orderSum = double.parse(widget.settleOrderInfo?.orderSum ?? '0');
widget: SettlementTips( if (orderSum == null) {
() { orderSum = 0;
}, }
text: "绿币支付不参与任何活动优惠,请重新选择支付方式", if (orderSum > balanceMoney) {
));
return; return;
} }
}); setState(() {
widget.payChannelCheck(5); checkIndex = 2;
}, });
child: Row( widget.payChannelCheck(3);
mainAxisAlignment: MainAxisAlignment.center, },
crossAxisAlignment: CrossAxisAlignment.center, child: Row(
children: [ mainAxisAlignment: MainAxisAlignment.center,
checkView(3), crossAxisAlignment: CrossAxisAlignment.center,
Expanded( children: [
child: Container(), checkView(2, isHide: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(balance) ?? 0)),
flex: 1, Expanded(
), child: Container(),
Text( flex: 1,
"¥$mGreenMoney",
style: TextStyle(
fontSize: 14.sp,
fontFamily: 'JDZhengHT',
color: Color(0xff353535),
fontWeight: MyFontWeight.medium,
), ),
), Text(
SizedBox( "¥$balance",
width: 10, style: TextStyle(
), fontSize: 14.sp,
Text( fontFamily: 'JDZhengHT',
S.of(context).lvbizhifu, color: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(balance) ?? 0) ? Color(0x66353535) : Color(0xff353535),
style: TextStyle( fontWeight: MyFontWeight.medium,
fontSize: 14.sp, ),
color: Color(0xff353535),
fontWeight: MyFontWeight.semi_bold,
), ),
), SizedBox(
], width: 10,
),
Text(
S.of(context).mendianyue,
style: TextStyle(
fontSize: 14.sp,
color: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(balance) ?? 0) ? Color(0x66353535) : Color(0xff353535),
fontWeight: MyFontWeight.semi_bold,
),
),
],
),
), ),
), if(widget.tableId > 0 ? !(widget?.minOrderInfo?.isRaise ?? false) : !(widget?.settleOrderInfo?.isRaise ?? false))
if(mGreenMoney!="0.00" && (widget.tableId > 0 ? !(widget.minOrderInfo?.isRaise ?? false) : !(widget.settleOrderInfo?.isRaise ?? false))) SizedBox(
SizedBox( height: 10,
height: 10, ),
), if(mGreenMoney!="0.00" && (widget.tableId > 0 ? !(widget?.minOrderInfo?.isRaise ?? false) : !(widget?.settleOrderInfo?.isRaise ?? false)))
if(mRaiseMoney!="0" && (widget.tableId > 0? (widget.minOrderInfo?.isRaise ?? false) : (widget.settleOrderInfo?.isRaise ?? false))) GestureDetector(
GestureDetector( behavior: HitTestBehavior.opaque,
behavior: HitTestBehavior.opaque, onTap: () {
onTap: () { double greenMoney = double.parse(mGreenMoney);
setState(() { if (greenMoney == null) {
checkIndex = 4; greenMoney = 0;
if(widget.promotions != "" || widget.coupons != "" || widget.useVipPriceSelect || widget.useBenefitSelect){ }
SmartDialog.show( double orderSum = double.parse(widget.settleOrderInfo?.orderSum ?? '0');
widget: SettlementTips( if (orderSum == null) {
() { orderSum = 0;
}, }
text: "助农积分不参与任何活动优惠,请重新选择支付方式", if (orderSum > greenMoney) {
));
return; return;
} }
}); setState(() {
widget.payChannelCheck(7); checkIndex = 3;
}, // if(widget.promotions != "" || widget.coupons != "" || widget.useVipPriceSelect || widget.useBenefitSelect){
child: Row( // print("discount-promotions: ${widget.promotions}");
mainAxisAlignment: MainAxisAlignment.center, // print("discount-coupons: ${widget.coupons}");
crossAxisAlignment: CrossAxisAlignment.center, // print("discount-useVipPriceSelect: ${widget.useVipPriceSelect}");
children: [ // print("discount-useBenefitSelect: ${widget.useBenefitSelect}");
checkView(4), // SmartDialog.show(
Expanded( // widget: SettlementTips(
child: Container(), // () {
flex: 1, // },
), // text: "绿币支付不参与任何活动优惠,请重新选择支付方式",
Text( // ));
"¥$mRaiseMoney", // return;
style: TextStyle( // }
fontSize: 14.sp, });
fontFamily: 'JDZhengHT', print("discount-payChannelCheck: 5");
color: Color(0xff353535), widget.payChannelCheck(5);
fontWeight: MyFontWeight.medium, },
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
checkView(3, isHide: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(mGreenMoney) ?? 0)),
Spacer(flex: 1,),
Text(
"¥$mGreenMoney",
style: TextStyle(
fontSize: 14.sp,
fontFamily: 'JDZhengHT',
color: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(mGreenMoney) ?? 0) ? Color(0x66353535) : Color(0xff353535),
fontWeight: MyFontWeight.medium,
),
), ),
), SizedBox(
SizedBox( width: 10,
width: 10,
),
Text(
S.of(context).zhunongjifen,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xff353535),
fontWeight: MyFontWeight.semi_bold,
), ),
), Text(
], S.of(context).lvbizhifu,
style: TextStyle(
fontSize: 14.sp,
color: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(mGreenMoney) ?? 0) ? Color(0x66353535) : Color(0xff353535),
fontWeight: MyFontWeight.semi_bold,
),
),
],
),
), ),
), if(mGreenMoney != "0.00" && (widget.tableId > 0 ? !(widget?.minOrderInfo?.isRaise ?? false) : !(widget?.settleOrderInfo?.isRaise ?? false)))
if(mRaiseMoney !="0" && (widget.tableId > 0 ? !(widget.minOrderInfo?.isRaise ?? false) : !(widget.settleOrderInfo?.isRaise ?? false))) SizedBox(
height: 10,
if(widget.tableId > 0 ? !(widget.minOrderInfo?.isRaise ?? false) : !(widget.settleOrderInfo?.isRaise ?? false)) ),
GestureDetector( if(mRaiseMoney != "0" && (widget.tableId > 0 ? (widget?.minOrderInfo?.isRaise ?? false) : (widget?.settleOrderInfo?.isRaise ?? false)))
behavior: HitTestBehavior.opaque, GestureDetector(
onTap: () { behavior: HitTestBehavior.opaque,
setState(() { onTap: () {
checkIndex = 5; double raiseMoney = double.parse(mRaiseMoney);
widget.payChannelCheck(1); if (raiseMoney == null) {
}); raiseMoney = 0;
}, }
child: Row( double orderSum = double.parse(widget.settleOrderInfo?.orderSum ?? '0');
mainAxisAlignment: MainAxisAlignment.spaceBetween, if (orderSum == null) {
crossAxisAlignment: CrossAxisAlignment.start, orderSum = 0;
children: [ }
checkView(5), if (orderSum > raiseMoney) {
Spacer(), return;
Image.asset("assets/image/icon_we_chat.webp"), }
Padding( setState(() {
padding: EdgeInsets.only(left: 8.w), checkIndex = 4;
child: Text( // if(widget.promotions != "" || widget.coupons != "" || widget.useVipPriceSelect || widget.useBenefitSelect){
S.of(context).weixinzhifu, // SmartDialog.show(
// widget: SettlementTips(
// () {},
// text: "助农积分不参与任何活动优惠,请重新选择支付方式",
// ),
// );
// return;
// }
});
widget.payChannelCheck(7);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
checkView(4, isHide: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(mRaiseMoney) ?? 0)),
Spacer(
flex: 1,
),
Text(
"¥$mRaiseMoney",
style: TextStyle(
fontSize: 14.sp,
fontFamily: 'JDZhengHT',
color: (double.parse(widget.settleOrderInfo?.orderSum ?? '0') ?? 0) > (double.parse(mRaiseMoney) ?? 0) ? Color(0x66353535) : Color(0xff353535),
fontWeight: MyFontWeight.medium,
),
),
SizedBox(
width: 10,
),
Text(
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,
), ),
), ),
), ],
], ),
), ),
), if(mRaiseMoney !="0" && (widget.tableId > 0 ? !(widget?.minOrderInfo?.isRaise ?? false) : !(widget?.settleOrderInfo?.isRaise ?? false)))
if(widget.tableId > 0 ? !(widget?.minOrderInfo?.isRaise ?? false) : !(widget?.settleOrderInfo?.isRaise ?? false))
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
checkIndex = 5;
widget.payChannelCheck(1);
});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
checkView(5),
Spacer(),
Image.asset("assets/image/icon_we_chat.webp"),
Padding(
padding: EdgeInsets.only(left: 8.w),
child: Text(
S.of(context).weixinzhifu,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xff353535),
fontWeight: MyFontWeight.semi_bold,
),
),
),
],
),
),
], ],
), ),
); );
@ -325,7 +367,20 @@ 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,
child: Image.asset(
"assets/image/disenable_seletor.png",
width: 15.w,
height: 15.h,
),
);
}
return Container( return Container(
padding: EdgeInsets.only(right:36.w), padding: EdgeInsets.only(right:36.w),
alignment: Alignment.center, alignment: Alignment.center,

Loading…
Cancel
Save