|
|
@ -5,6 +5,7 @@ import 'package:flutter_easyloading/flutter_easyloading.dart'; |
|
|
|
import 'package:flutter_swiper/flutter_swiper.dart'; |
|
|
|
import 'package:flutter_swiper/flutter_swiper.dart'; |
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart'; |
|
|
|
|
|
|
|
import 'package:huixiang/retrofit/data/coupon.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/goods.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/goods.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/page.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/page.dart'; |
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart'; |
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart'; |
|
|
@ -15,6 +16,10 @@ import 'package:huixiang/view_widget/custom_image.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
import 'package:huixiang/view_widget/my_appbar.dart'; |
|
|
|
import 'package:huixiang/view_widget/my_appbar.dart'; |
|
|
|
import 'package:huixiang/view_widget/my_footer.dart'; |
|
|
|
import 'package:huixiang/view_widget/my_footer.dart'; |
|
|
|
|
|
|
|
import 'package:huixiang/view_widget/new_coupon_widget.dart'; |
|
|
|
|
|
|
|
import 'package:huixiang/view_widget/no_data_view.dart'; |
|
|
|
|
|
|
|
import 'package:huixiang/view_widget/receive_success.dart'; |
|
|
|
|
|
|
|
import 'package:huixiang/view_widget/selector_store_dialog.dart'; |
|
|
|
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
|
|
|
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
|
|
|
|
|
|
|
@ -30,6 +35,9 @@ class _WelfarePage extends State<WelfarePage> { |
|
|
|
final RefreshController refreshController = RefreshController(); |
|
|
|
final RefreshController refreshController = RefreshController(); |
|
|
|
final ScrollController scrollController = ScrollController(); |
|
|
|
final ScrollController scrollController = ScrollController(); |
|
|
|
List<Goods> goods = []; |
|
|
|
List<Goods> goods = []; |
|
|
|
|
|
|
|
List<Coupon> coupons = []; |
|
|
|
|
|
|
|
// List<Coupon> coupon; |
|
|
|
|
|
|
|
List<List<Coupon>> coupon=[]; |
|
|
|
String categoryId; |
|
|
|
String categoryId; |
|
|
|
bool orderDesc = true; |
|
|
|
bool orderDesc = true; |
|
|
|
int orderType = 1; |
|
|
|
int orderType = 1; |
|
|
@ -41,7 +49,14 @@ class _WelfarePage extends State<WelfarePage> { |
|
|
|
SharedPreferences.getInstance().then((value) => { |
|
|
|
SharedPreferences.getInstance().then((value) => { |
|
|
|
apiService = ApiService(Dio(), context: context, token: value.getString("token")), |
|
|
|
apiService = ApiService(Dio(), context: context, token: value.getString("token")), |
|
|
|
queryGoods(), |
|
|
|
queryGoods(), |
|
|
|
|
|
|
|
queryCoupon(), |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
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(); |
|
|
|
|
|
|
|
coupon.add(con); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
queryGoods() async { |
|
|
|
queryGoods() async { |
|
|
@ -79,6 +94,35 @@ class _WelfarePage extends State<WelfarePage> { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
queryCoupon() async { |
|
|
|
|
|
|
|
BaseData<PageInfo<Coupon>> baseData = await apiService.queryCoupon({ |
|
|
|
|
|
|
|
"centre": true, |
|
|
|
|
|
|
|
"pageNum": pageNum, |
|
|
|
|
|
|
|
"pageSize": 10, |
|
|
|
|
|
|
|
"searchKey": "", |
|
|
|
|
|
|
|
"state": 0 |
|
|
|
|
|
|
|
}).catchError((onError) { |
|
|
|
|
|
|
|
refreshController.refreshFailed(); |
|
|
|
|
|
|
|
refreshController.loadFailed(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
if (pageNum == 1) coupons.clear(); |
|
|
|
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
|
|
|
coupons.addAll(baseData.data.list); |
|
|
|
|
|
|
|
refreshController.refreshCompleted(); |
|
|
|
|
|
|
|
refreshController.loadComplete(); |
|
|
|
|
|
|
|
if (baseData.data.pageNum == baseData.data.pages) { |
|
|
|
|
|
|
|
refreshController.loadNoData(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
pageNum += 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
setState(() {}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
refreshController.refreshFailed(); |
|
|
|
|
|
|
|
refreshController.loadFailed(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
|
Widget build(BuildContext context) { |
|
|
|
return Stack( |
|
|
|
return Stack( |
|
|
@ -177,7 +221,7 @@ class _WelfarePage extends State<WelfarePage> { |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
Padding( |
|
|
|
Padding( |
|
|
|
padding: EdgeInsets.symmetric(horizontal: 12.w,vertical: 16.h), |
|
|
|
padding: EdgeInsets.symmetric(horizontal: 17.w,vertical: 16.h), |
|
|
|
child: |
|
|
|
child: |
|
|
|
Row( |
|
|
|
Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
@ -221,27 +265,14 @@ class _WelfarePage extends State<WelfarePage> { |
|
|
|
return Column( |
|
|
|
return Column( |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
Container( |
|
|
|
Container( |
|
|
|
// height: 84.h, |
|
|
|
child: weekList1(), |
|
|
|
// child: ListView.builder( |
|
|
|
// weekList(testList2[position]), |
|
|
|
// scrollDirection: Axis.horizontal, |
|
|
|
|
|
|
|
// physics: BouncingScrollPhysics(), |
|
|
|
|
|
|
|
// padding: EdgeInsets.symmetric(horizontal: 12), |
|
|
|
|
|
|
|
// itemCount:3, |
|
|
|
|
|
|
|
// itemBuilder: (context, index) { |
|
|
|
|
|
|
|
// return GestureDetector( |
|
|
|
|
|
|
|
// onTap: () { |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
// }, |
|
|
|
|
|
|
|
// child: weekItem(), |
|
|
|
|
|
|
|
// ); |
|
|
|
|
|
|
|
// }, |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
child: weekItem(), |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
); |
|
|
|
); |
|
|
|
}, |
|
|
|
}, |
|
|
|
itemCount:3, |
|
|
|
itemCount:coupon.length, |
|
|
|
|
|
|
|
// testList2.length, |
|
|
|
), |
|
|
|
), |
|
|
|
) |
|
|
|
) |
|
|
|
], |
|
|
|
], |
|
|
@ -287,10 +318,31 @@ class _WelfarePage extends State<WelfarePage> { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Widget weekItem() { |
|
|
|
List<String> testList = ["1","2","3","4","5","6","7","8","9","10","11"]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<List<String>> testList2 = []; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget weekList(List<String> list){ |
|
|
|
|
|
|
|
return Expanded(child: ListView.builder( |
|
|
|
|
|
|
|
padding: EdgeInsets.zero, |
|
|
|
|
|
|
|
itemCount: list.length, |
|
|
|
|
|
|
|
scrollDirection: Axis.vertical, |
|
|
|
|
|
|
|
shrinkWrap: true, |
|
|
|
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
|
|
|
itemBuilder: (context, position) { |
|
|
|
|
|
|
|
return GestureDetector( |
|
|
|
|
|
|
|
onTap: () { |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
child: weekItem(list[position]), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget weekItem(String cnt) { |
|
|
|
return Container( |
|
|
|
return Container( |
|
|
|
width:double.infinity, |
|
|
|
width:double.infinity, |
|
|
|
height:100.h, |
|
|
|
height:110.h, |
|
|
|
decoration: BoxDecoration( |
|
|
|
decoration: BoxDecoration( |
|
|
|
image: DecorationImage( |
|
|
|
image: DecorationImage( |
|
|
|
fit: BoxFit.fill, |
|
|
|
fit: BoxFit.fill, |
|
|
@ -298,12 +350,56 @@ 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), |
|
|
|
child: Row( |
|
|
|
child: Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.end, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.end, |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
|
|
|
|
Expanded(child: |
|
|
|
Column( |
|
|
|
Column( |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
cnt, |
|
|
|
|
|
|
|
// "新人满减30元", |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
|
|
|
color: Color(0xFF353535), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
SizedBox(height:4.h,), |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
"有效期至2022-09-10 12:00:00", |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
|
|
|
color: Color(0xFF4D4D4D), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
SizedBox(height:5.h,), |
|
|
|
|
|
|
|
Row( |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
"使用详情", |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
|
|
|
color: Color(0xFF4D4D4D), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Icon( |
|
|
|
|
|
|
|
Icons.keyboard_arrow_right, |
|
|
|
|
|
|
|
color: Color(0xFF4D4D4D), |
|
|
|
|
|
|
|
size: 20, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
)), |
|
|
|
|
|
|
|
Column( |
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
Text.rich( |
|
|
|
Text.rich( |
|
|
@ -336,22 +432,104 @@ class _WelfarePage extends State<WelfarePage> { |
|
|
|
color: Color(0xFF32A060), |
|
|
|
color: Color(0xFF32A060), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
SizedBox(height: 8,), |
|
|
|
|
|
|
|
Container( |
|
|
|
|
|
|
|
width: 50.w, |
|
|
|
|
|
|
|
height: 19.h, |
|
|
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
|
|
|
shape: BoxShape.rectangle, |
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(3), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
|
|
|
child:Text( |
|
|
|
|
|
|
|
"领取", |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
|
|
|
color: Color(0xFFFFFFFF), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
) |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox(width: 30,), |
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget weekList1(){ |
|
|
|
|
|
|
|
return Expanded(child: (coupons != null && coupons.length > 0) |
|
|
|
|
|
|
|
? ListView.builder( |
|
|
|
|
|
|
|
itemBuilder: (context, position) { |
|
|
|
|
|
|
|
return GestureDetector( |
|
|
|
|
|
|
|
child: NewCouponWidget( |
|
|
|
|
|
|
|
coupons[position], |
|
|
|
|
|
|
|
(type) { |
|
|
|
|
|
|
|
if (type == 1) { |
|
|
|
|
|
|
|
receiveCoupon(coupons[position].id); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (coupons[position].bizType == 5 || coupons[position].bizType == 3) { |
|
|
|
|
|
|
|
Navigator.of(context).pushNamed( |
|
|
|
|
|
|
|
'/router/write_off_page', |
|
|
|
|
|
|
|
arguments: { |
|
|
|
|
|
|
|
"couponId": coupons[position].id, |
|
|
|
|
|
|
|
"coupon": coupons[position].toJson() |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
showStoreSelector(coupons[position].storeList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
() { |
|
|
|
|
|
|
|
setState((){ |
|
|
|
|
|
|
|
coupons[position].isEx = !coupons[position].isEx; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
type: 1, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
itemCount: (coupons != null && coupons.length > 0) ? coupons.length : 0, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
: NoDataView( |
|
|
|
|
|
|
|
src: "assets/image/ka.webp", |
|
|
|
|
|
|
|
isShowBtn: false, |
|
|
|
|
|
|
|
text: S.of(context).haimeiyouyouhuiquankeyilingqu, |
|
|
|
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
|
|
|
)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget weekItem1() { |
|
|
|
|
|
|
|
return Container( |
|
|
|
|
|
|
|
width:double.infinity, |
|
|
|
|
|
|
|
height:110.h, |
|
|
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
|
|
image: DecorationImage( |
|
|
|
|
|
|
|
fit: BoxFit.fill, |
|
|
|
|
|
|
|
image: AssetImage("assets/image/week_coupons.webp"), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 12.w,vertical: 12.h), |
|
|
|
|
|
|
|
margin: EdgeInsets.only(bottom:10), |
|
|
|
|
|
|
|
child: Row( |
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end, |
|
|
|
|
|
|
|
children: [ |
|
|
|
Expanded(child: |
|
|
|
Expanded(child: |
|
|
|
Column( |
|
|
|
Column( |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
Expanded(child: Text( |
|
|
|
Text( |
|
|
|
"新人满减30元", |
|
|
|
"新人满减30元", |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14.sp, |
|
|
|
fontSize: 14.sp, |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
color: Color(0xFF353535), |
|
|
|
color: Color(0xFF353535), |
|
|
|
), |
|
|
|
), |
|
|
|
)), |
|
|
|
), |
|
|
|
SizedBox(height:4.h,), |
|
|
|
SizedBox(height:4.h,), |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
"有效期至2022-09-10 12:00:00", |
|
|
|
"有效期至2022-09-10 12:00:00", |
|
|
@ -381,29 +559,355 @@ class _WelfarePage extends State<WelfarePage> { |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
)), |
|
|
|
)), |
|
|
|
Container( |
|
|
|
Column( |
|
|
|
width: 50.w, |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
|
|
height: 19.h, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
decoration: BoxDecoration( |
|
|
|
children: [ |
|
|
|
color: Color(0xFF32A060), |
|
|
|
Text.rich( |
|
|
|
shape: BoxShape.rectangle, |
|
|
|
TextSpan( |
|
|
|
borderRadius: BorderRadius.circular(3), |
|
|
|
children: [ |
|
|
|
), |
|
|
|
TextSpan( |
|
|
|
alignment: Alignment.center, |
|
|
|
text: "¥", |
|
|
|
child:Text( |
|
|
|
style: TextStyle( |
|
|
|
"领取", |
|
|
|
fontSize: 16.sp, |
|
|
|
style: TextStyle( |
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
fontSize: 12.sp, |
|
|
|
color: Color(0xFF32A060), |
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
), |
|
|
|
color: Color(0xFFFFFFFF), |
|
|
|
), |
|
|
|
|
|
|
|
TextSpan( |
|
|
|
|
|
|
|
text: "30", |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontSize: 26.sp, |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
Text( |
|
|
|
) |
|
|
|
"满30.1可用", |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
SizedBox(height: 8,), |
|
|
|
|
|
|
|
Container( |
|
|
|
|
|
|
|
width: 50.w, |
|
|
|
|
|
|
|
height: 19.h, |
|
|
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
|
|
|
shape: BoxShape.rectangle, |
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(3), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
|
|
|
child:Text( |
|
|
|
|
|
|
|
"领取", |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
|
|
|
color: Color(0xFFFFFFFF), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget weekWidget(Coupon coupon) { |
|
|
|
|
|
|
|
if (coupon.bizType == 1) { |
|
|
|
|
|
|
|
return Column( |
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Row( |
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.baseline, |
|
|
|
|
|
|
|
textBaseline: TextBaseline.alphabetic, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
"¥", |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
|
|
|
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
SizedBox( |
|
|
|
|
|
|
|
height: 4.h, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
coupon != null |
|
|
|
|
|
|
|
? double.tryParse("${coupon.discountAmount}" ?? "0") |
|
|
|
|
|
|
|
.toInt() |
|
|
|
|
|
|
|
.toString() |
|
|
|
|
|
|
|
: "", |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontSize: 26.sp, |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
|
|
|
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
S.of(context).manyuankeyong(coupon != null |
|
|
|
|
|
|
|
? ("${coupon.fullAmount}" ?? "0") |
|
|
|
|
|
|
|
.toString() |
|
|
|
|
|
|
|
: ""), |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
|
|
|
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} else if (coupon.bizType == 3) { |
|
|
|
|
|
|
|
return Column( |
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Container( |
|
|
|
|
|
|
|
padding: EdgeInsets.only(bottom:10,top: 7), |
|
|
|
|
|
|
|
child: Row( |
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
S.of(context).duihuanquan, |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontSize: 26.sp, |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
|
|
|
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
S.of(context).xianshangshiyong, |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
|
|
|
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} else if (coupon.bizType == 5) { |
|
|
|
|
|
|
|
return Column( |
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Container( |
|
|
|
|
|
|
|
padding: EdgeInsets.only(bottom:10,top: 7), |
|
|
|
|
|
|
|
child: Row( |
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
S.of(context).duihuanquan, |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontSize: 26.sp, |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
|
|
|
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
S.of(context).xianxiashiyong, |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
|
|
|
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return Column( |
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Row( |
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.baseline, |
|
|
|
|
|
|
|
textBaseline: TextBaseline.alphabetic, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
coupon != null |
|
|
|
|
|
|
|
? "${(coupon.discountPercent / 10.0 >= 10) ? 10 : coupon.discountPercent / 10.0}" ?? |
|
|
|
|
|
|
|
"0" |
|
|
|
|
|
|
|
: "", |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontSize: 30.sp, |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
|
|
|
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
SizedBox( |
|
|
|
|
|
|
|
height: 4.h, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
"折", |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
|
|
|
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Widget weekBtn(Coupon coupon) { |
|
|
|
|
|
|
|
// if (type == 1) { |
|
|
|
|
|
|
|
// if (coupon != null && coupon.status == 0) { |
|
|
|
|
|
|
|
// return Align( |
|
|
|
|
|
|
|
// alignment: Alignment.centerRight, |
|
|
|
|
|
|
|
// child: InkWell( |
|
|
|
|
|
|
|
// onTap: () { |
|
|
|
|
|
|
|
// callback(type); |
|
|
|
|
|
|
|
// }, |
|
|
|
|
|
|
|
// child: Container( |
|
|
|
|
|
|
|
// padding: EdgeInsets.symmetric(horizontal: 14,vertical: 2), |
|
|
|
|
|
|
|
// decoration: BoxDecoration( |
|
|
|
|
|
|
|
// borderRadius: BorderRadius.circular(3), |
|
|
|
|
|
|
|
// color: Color(0xFF32A060), |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// child: Text( |
|
|
|
|
|
|
|
// S.of(context).lingqu, |
|
|
|
|
|
|
|
// style: TextStyle( |
|
|
|
|
|
|
|
// fontSize: 12.sp, |
|
|
|
|
|
|
|
// fontWeight: MyFontWeight.medium, |
|
|
|
|
|
|
|
// color: Colors.white, |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// ); |
|
|
|
|
|
|
|
// } else { |
|
|
|
|
|
|
|
// return Align( |
|
|
|
|
|
|
|
// alignment: Alignment.centerRight, |
|
|
|
|
|
|
|
// child: Container( |
|
|
|
|
|
|
|
// padding: EdgeInsets.symmetric(horizontal:8,vertical: 2), |
|
|
|
|
|
|
|
// decoration: BoxDecoration( |
|
|
|
|
|
|
|
// borderRadius: BorderRadius.circular(3), |
|
|
|
|
|
|
|
// color: Colors.grey, |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// child: Text( |
|
|
|
|
|
|
|
// S.of(context).yilingqu, |
|
|
|
|
|
|
|
// style: TextStyle( |
|
|
|
|
|
|
|
// fontSize: 12.sp, |
|
|
|
|
|
|
|
// fontWeight: MyFontWeight.medium, |
|
|
|
|
|
|
|
// color: Colors.white, |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// ); |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// } else { |
|
|
|
|
|
|
|
// if (coupon != null && coupon.status == 1) { |
|
|
|
|
|
|
|
// return Align( |
|
|
|
|
|
|
|
// alignment: Alignment.centerRight, |
|
|
|
|
|
|
|
// child: InkWell( |
|
|
|
|
|
|
|
// onTap: () { |
|
|
|
|
|
|
|
// callback(type); |
|
|
|
|
|
|
|
// }, |
|
|
|
|
|
|
|
// child: Container( |
|
|
|
|
|
|
|
// // width: 56.w, |
|
|
|
|
|
|
|
// height: 19.h, |
|
|
|
|
|
|
|
// // padding: EdgeInsets.symmetric(horizontal:8,vertical: 2), |
|
|
|
|
|
|
|
// decoration: BoxDecoration( |
|
|
|
|
|
|
|
// color: Color(0xFF32A060), |
|
|
|
|
|
|
|
// borderRadius: BorderRadius.circular(3), |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// alignment: Alignment.center, |
|
|
|
|
|
|
|
// child:Text( |
|
|
|
|
|
|
|
// S.of(context).qushiyong, |
|
|
|
|
|
|
|
// maxLines: 1, |
|
|
|
|
|
|
|
// overflow: TextOverflow.ellipsis, |
|
|
|
|
|
|
|
// style: TextStyle( |
|
|
|
|
|
|
|
// fontSize: 12.sp, |
|
|
|
|
|
|
|
// fontWeight: MyFontWeight.regular, |
|
|
|
|
|
|
|
// color: Color(0xFFFFFFFF), |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// // Container( |
|
|
|
|
|
|
|
// // padding: EdgeInsets.fromLTRB(16.w, 2.h, 16.w, 2.h), |
|
|
|
|
|
|
|
// // decoration: BoxDecoration( |
|
|
|
|
|
|
|
// // borderRadius: BorderRadius.circular(10.5), |
|
|
|
|
|
|
|
// // color: Color(0xFF32A060), |
|
|
|
|
|
|
|
// // ), |
|
|
|
|
|
|
|
// // child: Text( |
|
|
|
|
|
|
|
// // (coupon.bizType == 5 || coupon.bizType == 3) |
|
|
|
|
|
|
|
// // ? S.of(context).quhexiao |
|
|
|
|
|
|
|
// // : S.of(context).qushiyong, |
|
|
|
|
|
|
|
// // style: TextStyle( |
|
|
|
|
|
|
|
// // fontSize: 12.sp, |
|
|
|
|
|
|
|
// // fontWeight: MyFontWeight.medium, |
|
|
|
|
|
|
|
// // color: Colors.white, |
|
|
|
|
|
|
|
// // ), |
|
|
|
|
|
|
|
// // ), |
|
|
|
|
|
|
|
// // ), |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// ); |
|
|
|
|
|
|
|
// } else if (coupon != null && coupon.status == 2) { |
|
|
|
|
|
|
|
// return Align( |
|
|
|
|
|
|
|
// alignment: Alignment.centerRight, |
|
|
|
|
|
|
|
// child: Container( |
|
|
|
|
|
|
|
// padding: EdgeInsets.symmetric(horizontal: 14,vertical: 2), |
|
|
|
|
|
|
|
// decoration: BoxDecoration( |
|
|
|
|
|
|
|
// borderRadius: BorderRadius.circular(3), |
|
|
|
|
|
|
|
// // border: Border.all( |
|
|
|
|
|
|
|
// // width: 1, color: Color(0xFFA0A0A0), style: BorderStyle.solid) |
|
|
|
|
|
|
|
// color: Color(0xFFA0A0A0), |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// child: Text( |
|
|
|
|
|
|
|
// S.of(context).yishiyong, |
|
|
|
|
|
|
|
// style: TextStyle( |
|
|
|
|
|
|
|
// fontSize: 12.sp, |
|
|
|
|
|
|
|
// fontWeight: MyFontWeight.medium, |
|
|
|
|
|
|
|
// color: Colors.white, |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// ); |
|
|
|
|
|
|
|
// } else { |
|
|
|
|
|
|
|
// return Align( |
|
|
|
|
|
|
|
// alignment: Alignment.centerRight, |
|
|
|
|
|
|
|
// child: Container( |
|
|
|
|
|
|
|
// padding: EdgeInsets.symmetric(horizontal: 14,vertical: 2), |
|
|
|
|
|
|
|
// // decoration: BoxDecoration( |
|
|
|
|
|
|
|
// // borderRadius: BorderRadius.circular(10.5), |
|
|
|
|
|
|
|
// // // border: Border.all( |
|
|
|
|
|
|
|
// // // width: 1, color: Color(0xFFA0A0A0), style: BorderStyle.solid) |
|
|
|
|
|
|
|
// // color: Color(0xFFA0A0A0), |
|
|
|
|
|
|
|
// // ), |
|
|
|
|
|
|
|
// child: Text( |
|
|
|
|
|
|
|
// S.of(context).yishixiao, |
|
|
|
|
|
|
|
// style: TextStyle( |
|
|
|
|
|
|
|
// fontSize: 12.sp, |
|
|
|
|
|
|
|
// fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
|
|
|
// color: Color(0xFFB3B3B3), |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// ), |
|
|
|
|
|
|
|
// ); |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
///邀请好友 |
|
|
|
///邀请好友 |
|
|
|
Widget inviteFriends() { |
|
|
|
Widget inviteFriends() { |
|
|
|
return Container( |
|
|
|
return Container( |
|
|
@ -427,10 +931,10 @@ class _WelfarePage extends State<WelfarePage> { |
|
|
|
}, |
|
|
|
}, |
|
|
|
child:ClipRRect( |
|
|
|
child:ClipRRect( |
|
|
|
child:Image.asset( |
|
|
|
child:Image.asset( |
|
|
|
"assets/image/icon_story_td.webp", |
|
|
|
"assets/image/welfare_spread.webp", |
|
|
|
width:double.infinity, |
|
|
|
width:double.infinity, |
|
|
|
fit: BoxFit.cover, |
|
|
|
fit: BoxFit.fill, |
|
|
|
height:80.h, |
|
|
|
height:100.h, |
|
|
|
), |
|
|
|
), |
|
|
|
borderRadius: BorderRadius.circular(6.w), |
|
|
|
borderRadius: BorderRadius.circular(6.w), |
|
|
|
), |
|
|
|
), |
|
|
@ -732,5 +1236,32 @@ class _WelfarePage extends State<WelfarePage> { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
receiveCoupon(couponId) async { |
|
|
|
|
|
|
|
BaseData baseData = await apiService.receiveCoupon(couponId); |
|
|
|
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
|
|
|
queryCoupon(); |
|
|
|
|
|
|
|
showAlertDialog(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showStoreSelector(storeList) { |
|
|
|
|
|
|
|
showModalBottomSheet( |
|
|
|
|
|
|
|
context: context, |
|
|
|
|
|
|
|
backgroundColor: Colors.transparent, |
|
|
|
|
|
|
|
builder: (context) { |
|
|
|
|
|
|
|
return SelectorStoreWidget(storeList); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showAlertDialog() { |
|
|
|
|
|
|
|
//显示对话框 |
|
|
|
|
|
|
|
showDialog( |
|
|
|
|
|
|
|
context: context, |
|
|
|
|
|
|
|
builder: (BuildContext context) { |
|
|
|
|
|
|
|
return ReceiveSuccess(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|