|
|
|
@ -39,33 +39,23 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
List<Goods> goods = []; |
|
|
|
|
Goods goodsPrice; |
|
|
|
|
List<Coupon> coupons = []; |
|
|
|
|
List<List<Coupon>> coupon=[]; |
|
|
|
|
List<List<Coupon>> coupon = []; |
|
|
|
|
String categoryId; |
|
|
|
|
bool orderDesc = true; |
|
|
|
|
int orderType = 1; |
|
|
|
|
int type = 1; |
|
|
|
|
int couponIndex = 0; |
|
|
|
|
int swiperIndex = 0; |
|
|
|
|
int _loadCount = 0; |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
void initState() { |
|
|
|
|
super.initState(); |
|
|
|
|
SharedPreferences.getInstance().then((value) => { |
|
|
|
|
apiService = ApiService(Dio(), context: context, token: value.getString("token")), |
|
|
|
|
_onRefresh(), |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
_onRefresh(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
queryGoods() async { |
|
|
|
|
if (apiService == null) { |
|
|
|
|
SharedPreferences value = await SharedPreferences.getInstance(); |
|
|
|
|
apiService = ApiService( |
|
|
|
|
Dio(), |
|
|
|
|
context: context, |
|
|
|
|
token: value.getString("token"), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
var param = { |
|
|
|
|
"categoryId": categoryId ?? "", |
|
|
|
|
"orderDesc": orderDesc, |
|
|
|
@ -81,27 +71,16 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
}); |
|
|
|
|
EasyLoading.dismiss(); |
|
|
|
|
if (pageGoods != null && pageGoods.isSuccess) { |
|
|
|
|
setState(() { |
|
|
|
|
goods.clear(); |
|
|
|
|
goods.addAll(pageGoods.data.list); |
|
|
|
|
}); |
|
|
|
|
refreshController.refreshCompleted(); |
|
|
|
|
refreshController.loadComplete(); |
|
|
|
|
} else { |
|
|
|
|
refreshController.loadFailed(); |
|
|
|
|
refreshController.refreshFailed(); |
|
|
|
|
} |
|
|
|
|
} finally { |
|
|
|
|
addLoadCount(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
queryCoupon() async { |
|
|
|
|
if (apiService == null) { |
|
|
|
|
SharedPreferences value = await SharedPreferences.getInstance(); |
|
|
|
|
apiService = ApiService( |
|
|
|
|
Dio(), |
|
|
|
|
context: context, |
|
|
|
|
token: value.getString("token"), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
try{ |
|
|
|
|
BaseData<PageInfo<Coupon>> baseData = await apiService.queryCoupon({ |
|
|
|
|
"centre": true, |
|
|
|
|
"pageNum": 1, |
|
|
|
@ -111,35 +90,47 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
}).catchError((onError) { |
|
|
|
|
SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type), |
|
|
|
|
alignment: Alignment.center); |
|
|
|
|
refreshController.refreshFailed(); |
|
|
|
|
refreshController.loadFailed(); |
|
|
|
|
}); |
|
|
|
|
coupons.clear(); |
|
|
|
|
coupon.clear(); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
coupons.addAll(baseData.data.list); |
|
|
|
|
for(var i = 0;i < coupons.length~/3+1;i++){ |
|
|
|
|
for (var i = 0; i < coupons.length ~/ 3 + 1; i++) { |
|
|
|
|
List<Coupon> con = []; |
|
|
|
|
con = coupons.skip(i*3).take((i*3<coupons.length)?3:(coupons.length - (i*3))).toList(); |
|
|
|
|
con = coupons |
|
|
|
|
.skip(i * 3) |
|
|
|
|
.take((i * 3 < coupons.length) ? 3 : (coupons.length - (i * 3))) |
|
|
|
|
.toList(); |
|
|
|
|
coupon.add(con); |
|
|
|
|
} |
|
|
|
|
if(coupon.length > 0 && coupon[coupon.length - 1].isEmpty) |
|
|
|
|
coupon.removeAt(coupon.length-1); |
|
|
|
|
refreshController.refreshCompleted(); |
|
|
|
|
refreshController.loadComplete(); |
|
|
|
|
if (coupon.length > 0 && coupon[coupon.length - 1].isEmpty) |
|
|
|
|
coupon.removeAt(coupon.length - 1); |
|
|
|
|
setState(() {}); |
|
|
|
|
} else { |
|
|
|
|
refreshController.refreshFailed(); |
|
|
|
|
refreshController.loadFailed(); |
|
|
|
|
}}finally{ |
|
|
|
|
addLoadCount(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_onRefresh(){ |
|
|
|
|
_onRefresh() async{ |
|
|
|
|
EasyLoading.show(status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); |
|
|
|
|
if (apiService == null) { |
|
|
|
|
SharedPreferences value = await SharedPreferences.getInstance(); |
|
|
|
|
apiService = |
|
|
|
|
ApiService(Dio(), context: context, token: value.getString("token")); |
|
|
|
|
} |
|
|
|
|
queryGoods(); |
|
|
|
|
queryCoupon(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
addLoadCount() { |
|
|
|
|
_loadCount += 1; |
|
|
|
|
if (_loadCount == 2) { |
|
|
|
|
_loadCount = 0; |
|
|
|
|
EasyLoading.dismiss(); |
|
|
|
|
if (refreshController.isRefresh) refreshController.refreshCompleted(); |
|
|
|
|
if (mounted) setState(() {}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
@ -157,7 +148,10 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
width: double.infinity, |
|
|
|
|
height: 236.h, |
|
|
|
|
), |
|
|
|
|
Expanded(child: Container(color: Colors.white,)) |
|
|
|
|
Expanded( |
|
|
|
|
child: Container( |
|
|
|
|
color: Colors.white, |
|
|
|
|
)) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
Scaffold( |
|
|
|
@ -170,7 +164,7 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
titleSize: 18.sp, |
|
|
|
|
brightness: Brightness.dark, |
|
|
|
|
), |
|
|
|
|
body:SmartRefresher( |
|
|
|
|
body: SmartRefresher( |
|
|
|
|
controller: refreshController, |
|
|
|
|
enablePullDown: true, |
|
|
|
|
enablePullUp: false, |
|
|
|
@ -180,18 +174,15 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
return MyFooter(mode); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
onRefresh:(){ |
|
|
|
|
setState(() { |
|
|
|
|
_onRefresh(); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
onRefresh:_onRefresh, |
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
scrollController: ScrollController(), |
|
|
|
|
child: Container( |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
borderRadius: BorderRadius.only( |
|
|
|
|
topLeft: Radius.circular(6), |
|
|
|
|
topRight: Radius.circular(6),), |
|
|
|
|
topRight: Radius.circular(6), |
|
|
|
|
), |
|
|
|
|
color: Colors.white, |
|
|
|
|
boxShadow: [ |
|
|
|
|
BoxShadow( |
|
|
|
@ -213,12 +204,10 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
|
|
|
|
|
Container( |
|
|
|
|
color: Colors.white, |
|
|
|
|
padding: EdgeInsets.only(left: 14,right: 14), |
|
|
|
|
child:Column( |
|
|
|
|
padding: EdgeInsets.only(left: 14, right: 14), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
|
|
|
|
|
inviteFriends(), |
|
|
|
|
|
|
|
|
|
benefitExchange(), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
@ -242,7 +231,8 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
borderRadius: BorderRadius.only( |
|
|
|
|
topLeft: Radius.circular(6), |
|
|
|
|
topRight: Radius.circular(6),), |
|
|
|
|
topRight: Radius.circular(6), |
|
|
|
|
), |
|
|
|
|
color: Colors.white, |
|
|
|
|
boxShadow: [ |
|
|
|
|
BoxShadow( |
|
|
|
@ -258,9 +248,8 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 17.w,vertical: 16.h), |
|
|
|
|
child: |
|
|
|
|
Row( |
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 17.w, vertical: 16.h), |
|
|
|
|
child: Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
@ -282,16 +271,17 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
)), |
|
|
|
|
coupon.length == 0? |
|
|
|
|
NoDataView( |
|
|
|
|
coupon.length == 0 |
|
|
|
|
? NoDataView( |
|
|
|
|
src: "assets/image/ka.webp", |
|
|
|
|
isShowBtn: false, |
|
|
|
|
text: S.of(context).haimeiyouyouhuiquankeyilingqu, |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
): AspectRatio( |
|
|
|
|
) |
|
|
|
|
: AspectRatio( |
|
|
|
|
aspectRatio: 1.10, |
|
|
|
|
child: Swiper( |
|
|
|
|
onIndexChanged: (it){ |
|
|
|
|
onIndexChanged: (it) { |
|
|
|
|
swiperIndex = it; |
|
|
|
|
}, |
|
|
|
|
index: couponIndex, |
|
|
|
@ -318,23 +308,23 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
], |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
itemCount:coupon.length ?? 0, |
|
|
|
|
itemCount: coupon.length ?? 0, |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
) |
|
|
|
|
); |
|
|
|
|
)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Widget weekList(List<Coupon> cops){ |
|
|
|
|
Widget weekList(List<Coupon> cops) { |
|
|
|
|
return Expanded( |
|
|
|
|
child:(cops == null && cops.length == 0)? |
|
|
|
|
NoDataView( |
|
|
|
|
child: (cops == null && cops.length == 0) |
|
|
|
|
? NoDataView( |
|
|
|
|
src: "assets/image/ka.webp", |
|
|
|
|
isShowBtn: false, |
|
|
|
|
text: S.of(context).haimeiyouyouhuiquankeyilingqu, |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
):ListView.builder( |
|
|
|
|
) |
|
|
|
|
: ListView.builder( |
|
|
|
|
padding: EdgeInsets.zero, |
|
|
|
|
itemCount: cops.length, |
|
|
|
|
scrollDirection: Axis.vertical, |
|
|
|
@ -342,12 +332,12 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
itemBuilder: (context, position) { |
|
|
|
|
return GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
}, |
|
|
|
|
onTap: () {}, |
|
|
|
|
child: weekCoupon(cops[position]), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
),); |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
///优惠券列表 |
|
|
|
@ -355,8 +345,8 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
return Container( |
|
|
|
|
height: 95.h, |
|
|
|
|
width: double.infinity, |
|
|
|
|
margin: EdgeInsets.only(bottom:10), |
|
|
|
|
padding:EdgeInsets.symmetric(horizontal: 12), |
|
|
|
|
margin: EdgeInsets.only(bottom: 10), |
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 12), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
image: DecorationImage( |
|
|
|
|
fit: BoxFit.fill, |
|
|
|
@ -367,8 +357,9 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
Expanded(child: Container( |
|
|
|
|
margin: EdgeInsets.only(top: 12,bottom: 12), |
|
|
|
|
Expanded( |
|
|
|
|
child: Container( |
|
|
|
|
margin: EdgeInsets.only(top: 12, bottom: 12), |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
@ -383,31 +374,37 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
color: Color(0xFF0D0D0D), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox(height: 12,), |
|
|
|
|
(cop.status == 0)? |
|
|
|
|
Text( |
|
|
|
|
SizedBox( |
|
|
|
|
height: 12, |
|
|
|
|
), |
|
|
|
|
(cop.status == 0) |
|
|
|
|
? Text( |
|
|
|
|
"发放时间: ${cop?.publishStartTime ?? ""}", |
|
|
|
|
maxLines: 1, |
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
color: cop.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D), |
|
|
|
|
color: cop.status == 3 |
|
|
|
|
? Color(0xFFB3B3B3) |
|
|
|
|
: Color(0xFF4D4D4D), |
|
|
|
|
), |
|
|
|
|
):Text( |
|
|
|
|
) |
|
|
|
|
: Text( |
|
|
|
|
"有效期至 ${cop?.useEndTime ?? ""}", |
|
|
|
|
maxLines:1, |
|
|
|
|
maxLines: 1, |
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
color: cop.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D), |
|
|
|
|
color: cop.status == 3 |
|
|
|
|
? Color(0xFFB3B3B3) |
|
|
|
|
: Color(0xFF4D4D4D), |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
)), |
|
|
|
|
|
|
|
|
|
Column( |
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.end, |
|
|
|
@ -441,7 +438,8 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), |
|
|
|
|
color: |
|
|
|
|
cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
@ -456,20 +454,19 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 24.sp, |
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), |
|
|
|
|
color: |
|
|
|
|
cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
S.of(context).manyuankeyong(coupon != null |
|
|
|
|
? ("${cop.fullAmount}" ?? "0") |
|
|
|
|
.toString() |
|
|
|
|
: ""), |
|
|
|
|
S.of(context).manyuankeyong( |
|
|
|
|
coupon != null ? ("${cop.fullAmount}" ?? "0").toString() : ""), |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), |
|
|
|
|
color: cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
@ -489,7 +486,8 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 22.sp, |
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
color:cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), |
|
|
|
|
color: |
|
|
|
|
cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
@ -500,7 +498,7 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), |
|
|
|
|
color: cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
@ -511,7 +509,7 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
Container( |
|
|
|
|
padding: EdgeInsets.only(bottom:10,top: 7), |
|
|
|
|
padding: EdgeInsets.only(bottom: 10, top: 7), |
|
|
|
|
child: Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
@ -520,7 +518,8 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 26.sp, |
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), |
|
|
|
|
color: |
|
|
|
|
cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
@ -531,7 +530,7 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), |
|
|
|
|
color: cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
@ -547,31 +546,35 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
textBaseline: TextBaseline.alphabetic, |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
cop.limitAmount != "0.00"?"¥":"", |
|
|
|
|
cop.limitAmount != "0.00" ? "¥" : "", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), |
|
|
|
|
color: |
|
|
|
|
cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 4.h, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
cop.limitAmount != "0.00"?(coupon != null |
|
|
|
|
cop.limitAmount != "0.00" |
|
|
|
|
? (coupon != null |
|
|
|
|
? "${AppUtils.calculateDouble(double.tryParse(cop.limitAmount) ?? 0)}" |
|
|
|
|
: "") :"", |
|
|
|
|
: "") |
|
|
|
|
: "", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 24.sp, |
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), |
|
|
|
|
color: |
|
|
|
|
cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
); |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
return Column( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
@ -582,25 +585,29 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
textBaseline: TextBaseline.alphabetic, |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
cop.discountPercent != 0 ? (coupon != null |
|
|
|
|
cop.discountPercent != 0 |
|
|
|
|
? (coupon != null |
|
|
|
|
? "${(cop.discountPercent / 10.0 >= 10) ? 10 : cop.discountPercent / 10.0}" ?? |
|
|
|
|
"0" |
|
|
|
|
: ""):"", |
|
|
|
|
: "") |
|
|
|
|
: "", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 30.sp, |
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), |
|
|
|
|
color: |
|
|
|
|
cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 4.h, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
cop.discountPercent != 0 ? "折" :"", |
|
|
|
|
cop.discountPercent != 0 ? "折" : "", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), |
|
|
|
|
color: |
|
|
|
|
cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
@ -612,7 +619,7 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
|
|
|
|
|
///优惠券领取状态 |
|
|
|
|
Widget weekBtn(Coupon cop) { |
|
|
|
|
if(cop.status == 0) |
|
|
|
|
if (cop.status == 0) |
|
|
|
|
return Align( |
|
|
|
|
alignment: Alignment.centerRight, |
|
|
|
|
child: InkWell( |
|
|
|
@ -620,7 +627,7 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
receiveCoupon(cop.id); |
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 12.w,vertical: 2.h), |
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 2.h), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
borderRadius: BorderRadius.circular(3), |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
@ -636,15 +643,14 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
if(cop.status == 1 || cop.status == 2) |
|
|
|
|
if (cop.status == 1 || cop.status == 2) |
|
|
|
|
return Align( |
|
|
|
|
alignment: Alignment.centerRight, |
|
|
|
|
child: InkWell( |
|
|
|
|
onTap: () { |
|
|
|
|
if (cop.bizType == 5 || cop.bizType == 3) { |
|
|
|
|
Navigator.of(context).pushNamed( |
|
|
|
|
'/router/write_off_page', |
|
|
|
|
arguments: { |
|
|
|
|
Navigator.of(context) |
|
|
|
|
.pushNamed('/router/write_off_page', arguments: { |
|
|
|
|
"couponId": cop.id, |
|
|
|
|
"coupon": jsonEncode(cop.toJson()), |
|
|
|
|
}); |
|
|
|
@ -654,7 +660,7 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|
// height: 19.h, |
|
|
|
|
padding: EdgeInsets.symmetric(horizontal:8.w,vertical: 1.h), |
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 1.h), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
borderRadius: BorderRadius.circular(3), |
|
|
|
|
border: Border.all( |
|
|
|
@ -662,7 +668,7 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
color: Colors.transparent, |
|
|
|
|
), |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
child:Text( |
|
|
|
|
child: Text( |
|
|
|
|
S.of(context).qushiyong, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
@ -682,8 +688,8 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
queryCoupon(); |
|
|
|
|
showAlertDialog(); |
|
|
|
|
}else{ |
|
|
|
|
SmartDialog.showToast(baseData?.msg,alignment: Alignment.center); |
|
|
|
|
} else { |
|
|
|
|
SmartDialog.showToast(baseData?.msg, alignment: Alignment.center); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -710,8 +716,8 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
///邀请好友 |
|
|
|
|
Widget inviteFriends() { |
|
|
|
|
return Container( |
|
|
|
|
margin: EdgeInsets.only(top:24.h,bottom:20.h), |
|
|
|
|
child:Column( |
|
|
|
|
margin: EdgeInsets.only(top: 24.h, bottom: 20.h), |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
@ -723,17 +729,19 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
color: Color(0xFF0D0D0D), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox(height: 12,), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 12, |
|
|
|
|
), |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: (){ |
|
|
|
|
onTap: () { |
|
|
|
|
Navigator.of(context).pushNamed('/router/invite_friends'); |
|
|
|
|
}, |
|
|
|
|
child:ClipRRect( |
|
|
|
|
child:Image.asset( |
|
|
|
|
child: ClipRRect( |
|
|
|
|
child: Image.asset( |
|
|
|
|
"assets/image/welfare_spread.webp", |
|
|
|
|
width:double.infinity, |
|
|
|
|
width: double.infinity, |
|
|
|
|
fit: BoxFit.fill, |
|
|
|
|
height:80.h, |
|
|
|
|
height: 80.h, |
|
|
|
|
), |
|
|
|
|
borderRadius: BorderRadius.circular(6.w), |
|
|
|
|
), |
|
|
|
@ -747,28 +755,29 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
Widget benefitExchange() { |
|
|
|
|
return Container( |
|
|
|
|
width: double.infinity, |
|
|
|
|
margin: EdgeInsets.only(top:24.h,bottom:20.h), |
|
|
|
|
child:Column( |
|
|
|
|
margin: EdgeInsets.only(top: 24.h, bottom: 20.h), |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: (){ |
|
|
|
|
onTap: () { |
|
|
|
|
Navigator.of(context).pushNamed('/router/welfare_exchange'); |
|
|
|
|
}, |
|
|
|
|
child: Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
Expanded(child: |
|
|
|
|
Text( |
|
|
|
|
Expanded( |
|
|
|
|
child: Text( |
|
|
|
|
S.of(context).fuliduihuan, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 15.sp, |
|
|
|
|
fontWeight: MyFontWeight.bold, |
|
|
|
|
color: Color(0xFF0D0D0D), |
|
|
|
|
), |
|
|
|
|
),), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
S.of(context).gengduo, |
|
|
|
|
style: TextStyle( |
|
|
|
@ -785,16 +794,19 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox(height: 12,), |
|
|
|
|
(goods == null || goods.length == 0)? NoDataView( |
|
|
|
|
SizedBox( |
|
|
|
|
height: 12, |
|
|
|
|
), |
|
|
|
|
(goods == null || goods.length == 0) |
|
|
|
|
? NoDataView( |
|
|
|
|
src: "assets/image/xiao_fei.webp", |
|
|
|
|
isShowBtn: false, |
|
|
|
|
text: "暂无商品可兑换", |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
margin: EdgeInsets.all(60.h), |
|
|
|
|
) |
|
|
|
|
:GridView.builder( |
|
|
|
|
itemCount:goods.length>6?6:goods.length, |
|
|
|
|
: GridView.builder( |
|
|
|
|
itemCount: goods.length > 6 ? 6 : goods.length, |
|
|
|
|
padding: EdgeInsets.only( |
|
|
|
|
// left: 16.w, |
|
|
|
|
// right: 16.w, |
|
|
|
@ -811,8 +823,8 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
//垂直子Widget之间间距 |
|
|
|
|
mainAxisSpacing: 16.w, |
|
|
|
|
//子Widget宽高比例 0.59 |
|
|
|
|
childAspectRatio: |
|
|
|
|
200 / (285 / 2 + (285 / 2) * AppUtils.textScale(context)), |
|
|
|
|
childAspectRatio: 200 / |
|
|
|
|
(285 / 2 + (285 / 2) * AppUtils.textScale(context)), |
|
|
|
|
), |
|
|
|
|
itemBuilder: (context, index) { |
|
|
|
|
return GestureDetector( |
|
|
|
@ -871,10 +883,8 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
margin: EdgeInsets.only( |
|
|
|
|
right: 12.w, |
|
|
|
|
top: 10.h, |
|
|
|
|
),padding: EdgeInsets.only( |
|
|
|
|
bottom: 8, |
|
|
|
|
left: 8 |
|
|
|
|
), |
|
|
|
|
padding: EdgeInsets.only(bottom: 8, left: 8), |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
@ -912,16 +922,22 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String pointPrice(Goods goodsPrice){ |
|
|
|
|
if(goodsPrice == null) |
|
|
|
|
return ""; |
|
|
|
|
if(goodsPrice?.oneBean!=null && goodsPrice?.oneBean!="0"){ |
|
|
|
|
String pointPrice(Goods goodsPrice) { |
|
|
|
|
if (goodsPrice == null) return ""; |
|
|
|
|
if (goodsPrice?.oneBean != null && goodsPrice?.oneBean != "0") { |
|
|
|
|
return "${goodsPrice?.oneBean}印章"; |
|
|
|
|
} else if(goodsPrice?.onePrice!=null && goodsPrice?.onePrice!="0"){ |
|
|
|
|
} else if (goodsPrice?.onePrice != null && goodsPrice?.onePrice != "0") { |
|
|
|
|
return S.of(context).jifen_(goodsPrice?.onePrice); |
|
|
|
|
}else if((goodsPrice?.onePrice == null || goodsPrice?.onePrice == "0") && ((goodsPrice?.price != null && goodsPrice?.price != "0") || (goodsPrice?.money != null && goodsPrice?.money != "0.00"))){ |
|
|
|
|
return (goodsPrice?.price== "0"|| goodsPrice?.price == null ? "" : S.of(context).jifen_(goodsPrice?.price)) + (goodsPrice?.money== "0"|| goodsPrice?.money == null ? "" : " + ${AppUtils.calculateDouble(double.tryParse(goodsPrice?.money) ?? 0)}元"); |
|
|
|
|
}else if(goodsPrice.oneMoney != null && goodsPrice.oneMoney != "0.00"){ |
|
|
|
|
} else if ((goodsPrice?.onePrice == null || goodsPrice?.onePrice == "0") && |
|
|
|
|
((goodsPrice?.price != null && goodsPrice?.price != "0") || |
|
|
|
|
(goodsPrice?.money != null && goodsPrice?.money != "0.00"))) { |
|
|
|
|
return (goodsPrice?.price == "0" || goodsPrice?.price == null |
|
|
|
|
? "" |
|
|
|
|
: S.of(context).jifen_(goodsPrice?.price)) + |
|
|
|
|
(goodsPrice?.money == "0" || goodsPrice?.money == null |
|
|
|
|
? "" |
|
|
|
|
: " + ${AppUtils.calculateDouble(double.tryParse(goodsPrice?.money) ?? 0)}元"); |
|
|
|
|
} else if (goodsPrice.oneMoney != null && goodsPrice.oneMoney != "0.00") { |
|
|
|
|
return "${AppUtils.calculateDouble(double.tryParse(goodsPrice.oneMoney) ?? 0)}元"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -929,8 +945,10 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
///活动任务 |
|
|
|
|
Widget activityTask() { |
|
|
|
|
return Container( |
|
|
|
|
margin: EdgeInsets.only(bottom:20.h,), |
|
|
|
|
child:Column( |
|
|
|
|
margin: EdgeInsets.only( |
|
|
|
|
bottom: 20.h, |
|
|
|
|
), |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
@ -956,17 +974,18 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
SizedBox(height: 12.h,), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 12.h, |
|
|
|
|
), |
|
|
|
|
ListView.builder( |
|
|
|
|
padding: EdgeInsets.zero, |
|
|
|
|
itemCount:6, |
|
|
|
|
itemCount: 6, |
|
|
|
|
scrollDirection: Axis.vertical, |
|
|
|
|
shrinkWrap: true, |
|
|
|
|
physics: NeverScrollableScrollPhysics(), |
|
|
|
|
itemBuilder: (context, position) { |
|
|
|
|
return GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
}, |
|
|
|
|
onTap: () {}, |
|
|
|
|
child: taskItem(), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
@ -978,8 +997,8 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
|
|
|
|
|
Widget taskItem() { |
|
|
|
|
return Container( |
|
|
|
|
width:double.infinity, |
|
|
|
|
height:95.h, |
|
|
|
|
width: double.infinity, |
|
|
|
|
height: 95.h, |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
borderRadius: BorderRadius.circular(6), |
|
|
|
|
color: Colors.white, |
|
|
|
@ -992,13 +1011,14 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 12.w,vertical: 12.h), |
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 12.h), |
|
|
|
|
margin: EdgeInsets.only(bottom: 10.h), |
|
|
|
|
child: Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end, |
|
|
|
|
children: [ |
|
|
|
|
Expanded(child:Column( |
|
|
|
|
Expanded( |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
@ -1017,7 +1037,8 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
color: Color(0xFF4D4D4D), |
|
|
|
|
), |
|
|
|
|
), Text( |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
"购买任意3杯新品", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 10.sp, |
|
|
|
@ -1026,7 +1047,8 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
),), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Container( |
|
|
|
|
width: 55.w, |
|
|
|
|
height: 21.h, |
|
|
|
@ -1037,13 +1059,14 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
colors: [ |
|
|
|
|
Color(0xFFFF2700), |
|
|
|
|
Color(0xFFFF4F00), |
|
|
|
|
],), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
// border: Border.all(color: Colors.white,width: 0.5), |
|
|
|
|
shape: BoxShape.rectangle, |
|
|
|
|
borderRadius: BorderRadius.circular(3), |
|
|
|
|
), |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
child:Text( |
|
|
|
|
child: Text( |
|
|
|
|
"领取", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
@ -1056,5 +1079,4 @@ class _WelfarePage extends State<WelfarePage> {
|
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|