You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

198 lines
6.7 KiB

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/data/settle_order_info.dart';
import 'package:huixiang/utils/font_weight.dart';
import '../../data/min_order_info.dart';
import '../../data/store_info.dart';
import '../../view_widget/settlement_tips_dialog.dart';
class VipDiscountsSelect extends StatefulWidget {
final Function(int vipSelect) vipSelectCheck;
final SettleOrderInfo? settleOrderInfo;
final MinOrderInfo? minOrderInfo;
final int payChannel;
final StoreInfo? storeInfo;
VipDiscountsSelect(this.vipSelectCheck,this.settleOrderInfo,this.minOrderInfo,this.payChannel,this.storeInfo);
@override
State<StatefulWidget> createState() {
return _VipDiscountsSelect();
}
}
class _VipDiscountsSelect extends State<VipDiscountsSelect> {
var selectVip = 0;
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Color(0x0D000000),
offset: Offset(0, 1),
blurRadius: 8,
spreadRadius: 0,
),
],
borderRadius: BorderRadius.circular(8),
),
margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 14.h, bottom: 14.h),
padding: EdgeInsets.only(
left: 16.w,
right: 16.w,
top: 14.h,
bottom: 14.h,
),
child: Column(
children: [
Padding(padding:EdgeInsets.only(bottom: (widget.storeInfo?.usePlatformVip ?? false) == true ? 14.h :0),
child: GestureDetector(
onTap: (){
setState(() {
if (widget.settleOrderInfo?.usePlateMoney == false || widget.payChannel == 5) {
SmartDialog.show(
widget: SettlementTips(
() {},
text: widget.payChannel == 5
? "该支付余额为特殊活动充值, 不可参与任何活动"
: "该用户平台余额为特殊活动充值, 不可参与任何活动",
));
return;
} else {
selectVip = 1;
widget.vipSelectCheck(1);
}
});},
child: Row(
children: [
Image.asset(
"assets/image/vip_level_logo.webp",
fit: BoxFit.fill,
width: 20,
height: 20,
),
SizedBox(
width: 8.w,
),
Expanded(child:Text(
"会员等级优惠",
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
color: Color(0xFF868686),
),
)),
vipCheckView(1)
],
),
),),
if((widget.settleOrderInfo?.isVipDay?? false) == true || (widget.storeInfo?.usePlatformVip ?? false) == true)
Padding(padding:EdgeInsets.only(bottom: 14.h),
child: GestureDetector(
onTap: (){
setState(() {
if (widget.settleOrderInfo?.usePlateMoney == false || widget.payChannel == 5) {
SmartDialog.show(
widget: SettlementTips(
() {},
text: widget.payChannel == 5
? "该支付余额为特殊活动充值, 不可参与任何活动"
: "该用户平台余额为特殊活动充值, 不可参与任何活动",
));
return;
} else {
selectVip = 2;
widget.vipSelectCheck(2);
}
});},
child: Row(
children: [
Image.asset(
"assets/image/vip_day_logo.webp",
fit: BoxFit.fill,
width: 20,
height: 20,
),
SizedBox(
width: 8.w,
),
Expanded(child:Text(
"会员日",
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
color: Color(0xFF868686),
),
)),
vipCheckView(2)
],
),
),),
if((widget.storeInfo?.usePlatformVip ?? false) == true)
GestureDetector(
onTap: (){
setState(() {
if (widget.settleOrderInfo?.usePlateMoney == false || widget.payChannel == 5) {
SmartDialog.show(
widget: SettlementTips(
() {},
text: widget.payChannel == 5
? "该支付余额为特殊活动充值, 不可参与任何活动"
: "该用户平台余额为特殊活动充值, 不可参与任何活动",
));
return;
} else {
selectVip = 3;
widget.vipSelectCheck(3);
}
});},
child: Row(
children: [
Image.asset(
"assets/image/vip_equity_logo.webp",
fit: BoxFit.fill,
width: 20,
height: 20,
),
SizedBox(
width: 8.w,
),
Expanded(child:Text(
"会员卡优惠",
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
color: Color(0xFF868686),
),
)),
vipCheckView(3)
],
),
),
],
),
);
}
Widget vipCheckView(var index) {
return Image.asset(
((widget.settleOrderInfo?.discountType) == "MEMBER_RANK"
? 1
: ((widget.settleOrderInfo?.discountType) == "SURPRISE"
? 2
: ((widget.settleOrderInfo?.discountType ) == "VIP"
? 3
: 0))) !=
index
? "assets/image/icon_radio_unselected.webp"
: "assets/image/icon_radio_selected.webp",
width: 15.w,
height: 15.h,
);
}
}