|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:huixiang/utils/font_weight.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
|
|
|
import '../../generated/l10n.dart';
|
|
|
|
import '../../retrofit/data/vip_card_home.dart';
|
|
|
|
import '../../utils/flutter_utils.dart';
|
|
|
|
import '../../view_widget/custom_image.dart';
|
|
|
|
|
|
|
|
class VipGoodsDiscount extends StatefulWidget {
|
|
|
|
final VipCardHome vipCardHome;
|
|
|
|
|
|
|
|
VipGoodsDiscount(this.vipCardHome);
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return _VipGoodsDiscount();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _VipGoodsDiscount extends State<VipGoodsDiscount> {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.symmetric(vertical: 25.h, horizontal: 14.w),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
(widget?.vipCardHome?.member?.isVip ?? false)
|
|
|
|
? Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
"assets/image/vip_discount_left.webp",
|
|
|
|
width: 21.w,
|
|
|
|
height: 39.h,
|
|
|
|
fit: BoxFit.fill,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 11.w,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
S.of(context).huixiangvipkazhuanxiang,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xff32A060),
|
|
|
|
fontSize: 15.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 11.w,
|
|
|
|
),
|
|
|
|
Image.asset(
|
|
|
|
"assets/image/vip_discount_right.webp",
|
|
|
|
width: 21.w,
|
|
|
|
height: 39.h,
|
|
|
|
fit: BoxFit.fill,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
"assets/image/vip_lock.webp",
|
|
|
|
width: 20,
|
|
|
|
height: 20,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 2.w,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
S.of(context).kaitonghuixianghuoququanyi,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.black,
|
|
|
|
fontSize: 15.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
vipGoodsRecommend(),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget vipGoodsRecommend() {
|
|
|
|
return Container(
|
|
|
|
margin: EdgeInsets.only(top: 12.h),
|
|
|
|
height: 260.h,
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.only(top: 20.h, left: 13.h),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(6.w),
|
|
|
|
color: Colors.white,
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Colors.black.withAlpha(12),
|
|
|
|
offset: Offset(0, 3),
|
|
|
|
blurRadius: 14,
|
|
|
|
spreadRadius: 0,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
SizedBox(
|
|
|
|
width: 7.w,
|
|
|
|
),
|
|
|
|
Image.asset(
|
|
|
|
"assets/image/vip_title.webp",
|
|
|
|
fit: BoxFit.fill, //填充剩余空间
|
|
|
|
height: 13.h,
|
|
|
|
width: 27.w,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 4.w,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
S.of(context).huiyuanzhuanxiangjiage,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.black,
|
|
|
|
fontSize: 15.sp,
|
|
|
|
fontWeight: MyFontWeight.semi_bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
GestureDetector(
|
|
|
|
behavior: HitTestBehavior.translucent,
|
|
|
|
onTap: () {
|
|
|
|
showAlertDialog();
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: 8.w, right: 30.w, top: 3.h, bottom: 3.h),
|
|
|
|
child: Image.asset(
|
|
|
|
"assets/image/vip_tips.webp",
|
|
|
|
fit: BoxFit.fill, //填充剩余空间
|
|
|
|
height: 14,
|
|
|
|
width: 14,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 15.h,
|
|
|
|
),
|
|
|
|
vipGoodsRecommendList(),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget vipGoodsRecommendList() {
|
|
|
|
return Container(
|
|
|
|
height: 200.h,
|
|
|
|
child: ListView.builder(
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
itemCount: widget.vipCardHome?.productVips?.length ?? 0,
|
|
|
|
itemBuilder: (context, position) {
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
'/router/store_order',
|
|
|
|
arguments: {
|
|
|
|
"id": widget?.vipCardHome?.productVips[position].storeId,
|
|
|
|
"tenant":
|
|
|
|
widget?.vipCardHome?.productVips[position].tenantCode,
|
|
|
|
"storeName":
|
|
|
|
widget?.vipCardHome?.productVips[position].supplierName
|
|
|
|
},
|
|
|
|
);
|
|
|
|
},
|
|
|
|
child:
|
|
|
|
vipGoodsRecommendItem(widget.vipCardHome.productVips[position]),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget vipGoodsRecommendItem(ProductVips productVips) {
|
|
|
|
return Container(
|
|
|
|
width: 116.w,
|
|
|
|
margin: EdgeInsets.only(right: 4.w, left: 3.w),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Stack(
|
|
|
|
alignment: Alignment.topRight,
|
|
|
|
children: [
|
|
|
|
MImage(
|
|
|
|
productVips.image ?? "",
|
|
|
|
width: 116,
|
|
|
|
height: 116,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
radius: BorderRadius.circular(6),
|
|
|
|
errorSrc: "assets/image/default_1.webp",
|
|
|
|
fadeSrc: "assets/image/default_1.webp",
|
|
|
|
),
|
|
|
|
if (productVips.vipDiscount != "0.00")
|
|
|
|
Container(
|
|
|
|
// width:53.w,
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 2.h, horizontal: 8.w),
|
|
|
|
margin: EdgeInsets.only(left: 5.w),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0xffF96519),
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
topLeft: Radius.circular(0),
|
|
|
|
topRight: Radius.circular(6),
|
|
|
|
bottomLeft: Radius.circular(12),
|
|
|
|
bottomRight: Radius.circular(0),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Text(
|
|
|
|
"省${AppUtils.calculateDouble(double.tryParse(productVips.vipDiscount ?? "0"))}元",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.white,
|
|
|
|
fontSize: 13.sp,
|
|
|
|
fontFamily: 'JDZhengHT',
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(top: 10.h, bottom: 7.h),
|
|
|
|
child: Text(
|
|
|
|
productVips.productName ?? "",
|
|
|
|
maxLines: 1,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xff0D0D0D),
|
|
|
|
fontSize: 13.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"¥${AppUtils.calculateDouble(double.tryParse(productVips.vipPrice ?? "0.00"))}",
|
|
|
|
textAlign: TextAlign.end,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xff32A060),
|
|
|
|
fontSize: 16.sp,
|
|
|
|
fontFamily: 'JDZhengHT',
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 4.w,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"¥${AppUtils.calculateDouble(double.tryParse(productVips.applyPrice ?? "0.00"))}",
|
|
|
|
textAlign: TextAlign.end,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xffB2B2B2),
|
|
|
|
fontSize: 10.sp,
|
|
|
|
fontFamily: 'JDZhengHT',
|
|
|
|
decoration: TextDecoration.lineThrough,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///会员专享价格规则弹窗
|
|
|
|
showAlertDialog() {
|
|
|
|
showModalBottomSheet(
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
return StatefulBuilder(builder: (
|
|
|
|
context,
|
|
|
|
state,
|
|
|
|
) {
|
|
|
|
return WillPopScope(
|
|
|
|
///点击背景不收起弹窗;
|
|
|
|
// onWillPop: () async => false,
|
|
|
|
child: Stack(
|
|
|
|
alignment: Alignment.topRight,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: 370.h,
|
|
|
|
padding:
|
|
|
|
EdgeInsets.symmetric(horizontal: 14.w, vertical: 16.h),
|
|
|
|
decoration: new BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
topLeft: Radius.circular(8),
|
|
|
|
topRight: Radius.circular(8),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.only(right: 18.w),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
SizedBox(
|
|
|
|
height: 10.h,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"VIP会员专享价格"
|
|
|
|
"\n*用户开通回乡VIP卡,可享以专享优惠价格购买一心回乡APP入驻商户部分门店商品的会员权益。"
|
|
|
|
"\n*权益适用产品及专享价格,以会员权益页面公示为准。"
|
|
|
|
"\n为满足不同用户的需求,一心回乡将可能适时调整权益适用产品及专享价格,具体权益内容以会员权益页面公示为准。",
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
height: 1.7.h,
|
|
|
|
color: Colors.black,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(right: 14.w, top: 16.h),
|
|
|
|
child: Image.asset(
|
|
|
|
"assets/image/cancel.webp",
|
|
|
|
width: 24,
|
|
|
|
height: 24,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
));
|
|
|
|
});
|
|
|
|
},
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
context: context);
|
|
|
|
}
|
|
|
|
}
|