diff --git a/assets/image/2x/invite_friends.webp b/assets/image/2x/invite_friends.webp new file mode 100644 index 00000000..81a73b6d Binary files /dev/null and b/assets/image/2x/invite_friends.webp differ diff --git a/assets/image/2x/week_coupons.webp b/assets/image/2x/week_coupons.webp index 83eddd92..5fb4ea25 100644 Binary files a/assets/image/2x/week_coupons.webp and b/assets/image/2x/week_coupons.webp differ diff --git a/assets/image/2x/welfare_spread.webp b/assets/image/2x/welfare_spread.webp new file mode 100644 index 00000000..3ff0cfb6 Binary files /dev/null and b/assets/image/2x/welfare_spread.webp differ diff --git a/assets/image/3x/invite_friends.webp b/assets/image/3x/invite_friends.webp new file mode 100644 index 00000000..db90f17d Binary files /dev/null and b/assets/image/3x/invite_friends.webp differ diff --git a/assets/image/3x/week_coupons.webp b/assets/image/3x/week_coupons.webp index 17851b1e..f16ec445 100644 Binary files a/assets/image/3x/week_coupons.webp and b/assets/image/3x/week_coupons.webp differ diff --git a/assets/image/3x/welfare_spread.webp b/assets/image/3x/welfare_spread.webp new file mode 100644 index 00000000..197cd747 Binary files /dev/null and b/assets/image/3x/welfare_spread.webp differ diff --git a/assets/image/invite_friends.webp b/assets/image/invite_friends.webp new file mode 100644 index 00000000..59df5b9a Binary files /dev/null and b/assets/image/invite_friends.webp differ diff --git a/assets/image/week_coupons.webp b/assets/image/week_coupons.webp index 29f70261..8c5fe8f0 100644 Binary files a/assets/image/week_coupons.webp and b/assets/image/week_coupons.webp differ diff --git a/assets/image/welfare_spread.webp b/assets/image/welfare_spread.webp new file mode 100644 index 00000000..db02b9b0 Binary files /dev/null and b/assets/image/welfare_spread.webp differ diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart index d344a6df..69731b8d 100644 --- a/lib/home/home_page.dart +++ b/lib/home/home_page.dart @@ -508,7 +508,7 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { ///特惠专区 DiscountZone(coupons), - ///推荐商品展示 + ///特惠专区-推荐商品展示 HomeRecommendGoods(), ///福利中心 @@ -578,9 +578,9 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { }, child: ClipRRect( child:Image.asset( - "assets/image/icon_story_td.webp", + "assets/image/welfare_spread.webp", width:double.infinity, - fit: BoxFit.cover, + fit: BoxFit.fill, height:80.h, ), borderRadius: BorderRadius.circular(6.w), diff --git a/lib/home/home_view/discount_zone.dart b/lib/home/home_view/discount_zone.dart index 81485dda..9e3c5995 100644 --- a/lib/home/home_view/discount_zone.dart +++ b/lib/home/home_view/discount_zone.dart @@ -34,38 +34,21 @@ class _DiscountZone extends State { Widget build(BuildContext context) { return Container( width: double.infinity, - margin: EdgeInsets.only(bottom: 12.h, top: 16.h), + margin: EdgeInsets.only(top: 24.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ Padding(padding:EdgeInsets.symmetric(horizontal: 14.w), - child: Row( - children: [ - Expanded(child: - Text( - "特惠专区", - style: TextStyle( - color: Color(0xFF0D0D0D), - fontSize: 15.sp, - fontWeight: FontWeight.bold, - ), - )), - GestureDetector( - onTap: (){ - Navigator.of(context).pushNamed('/router/welfare_page'); - }, - child: Text( - "更多好券", - style: TextStyle( - color: Color(0xFF4D4D4D), - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - ), - ), - ) - ], - ),), + child: Text( + "特惠专区", + style: TextStyle( + color: Color(0xFF0D0D0D), + fontSize: 15.sp, + fontWeight: FontWeight.bold, + ), + )), + if(widget.coupon.length != 0) Container( height: 91, margin: EdgeInsets.only(top: 10), @@ -74,9 +57,14 @@ class _DiscountZone extends State { physics: BouncingScrollPhysics(), padding: EdgeInsets.symmetric(horizontal: 10), itemBuilder: (context, position) { - return discountItem(widget.coupon[position]); + return GestureDetector( + onTap: (){ + Navigator.of(context).pushNamed('/router/welfare_page'); + }, + child: discountItem(widget.coupon[position]), + ); }, - itemCount:widget.coupon.length, + itemCount:widget.coupon.length>5?5:widget.coupon.length, ), ), ], @@ -104,8 +92,8 @@ class _DiscountZone extends State { child:Container( margin: EdgeInsets.only(top: 12,bottom: 12), child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded(child: Container( child:discountWidget(coupon), @@ -215,23 +203,18 @@ class _DiscountZone extends State { ); } else if (coupon.bizType == 3) { return Column( - mainAxisAlignment: MainAxisAlignment.start, + 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), - ), - ), - ], + padding: EdgeInsets.only(bottom:10,top: 7,left: 12), + child: Text( + S.of(context).duihuanquan, + style: TextStyle( + fontSize: 26.sp, + fontWeight: MyFontWeight.semi_bold, + color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), + ), ), ), Text( @@ -246,23 +229,18 @@ class _DiscountZone extends State { ); } else if (coupon.bizType == 5) { return Column( - mainAxisAlignment: MainAxisAlignment.start, + 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: 30.sp, - fontWeight: MyFontWeight.semi_bold, - color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), - ), - ), - ], + padding: EdgeInsets.only(bottom:10,top: 7,left: 12), + child: Text( + S.of(context).duihuanquan, + style: TextStyle( + fontSize: 26.sp, + fontWeight: MyFontWeight.semi_bold, + color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), + ), ), ), Text( @@ -277,7 +255,7 @@ class _DiscountZone extends State { ); } else { return Column( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Row( @@ -302,21 +280,13 @@ class _DiscountZone extends State { Text( "折", style: TextStyle( - fontSize: 20.sp, + fontSize: 14.sp, fontWeight: MyFontWeight.semi_bold, color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), ), ), ], ), - Text( - S.of(context).quanchangtongyong, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.semi_bold, - color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), - ), - ), ], ); } diff --git a/lib/home/home_view/home_recommend_goods.dart b/lib/home/home_view/home_recommend_goods.dart index d5deea38..191a53a9 100644 --- a/lib/home/home_view/home_recommend_goods.dart +++ b/lib/home/home_view/home_recommend_goods.dart @@ -40,7 +40,7 @@ class _HomeRecommendGoods extends State { borderRadius: BorderRadius.circular(6), color: Colors.white, ), - margin: EdgeInsets.only(left: 14.w,right: 14.w,top: 12.h,bottom: 24.h), + margin: EdgeInsets.only(left: 14.w,right: 14.w,top: 14.h,bottom: 24.h), child: ListView.builder( scrollDirection: Axis.horizontal, physics: BouncingScrollPhysics(), diff --git a/lib/home/welfare_page.dart b/lib/home/welfare_page.dart index d83a7dfd..90eeba29 100644 --- a/lib/home/welfare_page.dart +++ b/lib/home/welfare_page.dart @@ -5,6 +5,7 @@ import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:huixiang/generated/l10n.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/page.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:huixiang/view_widget/my_appbar.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:shared_preferences/shared_preferences.dart'; @@ -30,6 +35,9 @@ class _WelfarePage extends State { final RefreshController refreshController = RefreshController(); final ScrollController scrollController = ScrollController(); List goods = []; + List coupons = []; + // List coupon; + List> coupon=[]; String categoryId; bool orderDesc = true; int orderType = 1; @@ -41,7 +49,14 @@ class _WelfarePage extends State { SharedPreferences.getInstance().then((value) => { apiService = ApiService(Dio(), context: context, token: value.getString("token")), queryGoods(), + queryCoupon(), + }); + for(var i = 0;i < coupons.length~/3+1;i++){ + List con = []; + con = coupons.skip(i*3).take((i*3 { } } + queryCoupon() async { + BaseData> 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 Widget build(BuildContext context) { return Stack( @@ -177,7 +221,7 @@ class _WelfarePage extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: EdgeInsets.symmetric(horizontal: 12.w,vertical: 16.h), + padding: EdgeInsets.symmetric(horizontal: 17.w,vertical: 16.h), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -221,27 +265,14 @@ class _WelfarePage extends State { return Column( children: [ Container( - // height: 84.h, - // child: ListView.builder( - // scrollDirection: Axis.horizontal, - // physics: BouncingScrollPhysics(), - // padding: EdgeInsets.symmetric(horizontal: 12), - // itemCount:3, - // itemBuilder: (context, index) { - // return GestureDetector( - // onTap: () { - // - // }, - // child: weekItem(), - // ); - // }, - // ), - child: weekItem(), + child: weekList1(), + // weekList(testList2[position]), ), ], ); }, - itemCount:3, + itemCount:coupon.length, + // testList2.length, ), ) ], @@ -287,10 +318,31 @@ class _WelfarePage extends State { ); } - Widget weekItem() { + List testList = ["1","2","3","4","5","6","7","8","9","10","11"]; + + List> testList2 = []; + + Widget weekList(List 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( width:double.infinity, - height:100.h, + height:110.h, decoration: BoxDecoration( image: DecorationImage( fit: BoxFit.fill, @@ -298,12 +350,56 @@ class _WelfarePage extends State { ), ), 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: 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, children: [ Text.rich( @@ -336,22 +432,104 @@ class _WelfarePage extends State { 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: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded(child: Text( + Text( "新人满减30元", style: TextStyle( fontSize: 14.sp, fontWeight: MyFontWeight.semi_bold, color: Color(0xFF353535), ), - )), + ), SizedBox(height:4.h,), Text( "有效期至2022-09-10 12:00:00", @@ -381,29 +559,355 @@ class _WelfarePage extends State { ), ], )), - 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), + Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "¥", + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF32A060), + ), + ), + 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() { return Container( @@ -427,10 +931,10 @@ class _WelfarePage extends State { }, child:ClipRRect( child:Image.asset( - "assets/image/icon_story_td.webp", + "assets/image/welfare_spread.webp", width:double.infinity, - fit: BoxFit.cover, - height:80.h, + fit: BoxFit.fill, + height:100.h, ), borderRadius: BorderRadius.circular(6.w), ), @@ -732,5 +1236,32 @@ class _WelfarePage extends State { ); } + 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(); + }, + ); + } } diff --git a/lib/order/order_history_page.dart b/lib/order/order_history_page.dart index a31a6f5d..39bd79be 100644 --- a/lib/order/order_history_page.dart +++ b/lib/order/order_history_page.dart @@ -225,6 +225,16 @@ class _OrderHistoryList extends State }); } + String orderAllGoods(OrderInfo orderInfo){ + int count = 0; + if(orderInfo.productList != null){ + orderInfo.productList.forEach((element) { + count += element.buyNum; + }); + } + return count.toString(); + } + Widget orderItem(OrderInfo orderInfo) { return Container( margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 8.h), @@ -415,10 +425,7 @@ class _OrderHistoryList extends State ), ), TextSpan( - text: (orderInfo != null && - orderInfo.productList != null) - ? "${orderInfo.productList.length}" - : "0", + text: orderAllGoods(orderInfo), style: TextStyle( fontSize: 12.sp, fontWeight: FontWeight.bold, diff --git a/lib/order/order_view/order_commodity.dart b/lib/order/order_view/order_commodity.dart index a2044ad6..6c800981 100644 --- a/lib/order/order_view/order_commodity.dart +++ b/lib/order/order_view/order_commodity.dart @@ -389,6 +389,16 @@ class _OrderCommodity extends State { ); } + String buyNumAllGoods(){ + int count = 0; + if(widget.orderInfo != null){ + widget.orderInfo.productList.forEach((element) { + count += element.buyNum; + }); + } + return count.toString(); + } + Widget buildTotalPrice() { return Container( margin: EdgeInsets.only(top: 7.h, bottom: 11.h), @@ -399,10 +409,7 @@ class _OrderCommodity extends State { children: [ Expanded( child: Text( - S.of(context).gongjijianshangpin((widget.orderInfo != null && - widget.orderInfo.productList != null) - ? widget.orderInfo.productList.length - : "0"), + S.of(context).gongjijianshangpin(buyNumAllGoods()), style: TextStyle( fontSize: 10.sp, color: Color(0xFFA29E9E), diff --git a/lib/qr/invite_friends.dart b/lib/qr/invite_friends.dart index a609452c..627e42de 100644 --- a/lib/qr/invite_friends.dart +++ b/lib/qr/invite_friends.dart @@ -203,10 +203,10 @@ class _InviteFriends extends State { child:Column( children: [ Image.asset( - "assets/image/icon_story_td.webp", + "assets/image/invite_friends.webp", height: 300.h, width:double.infinity, - fit: BoxFit.cover, + fit: BoxFit.fill, ), SizedBox(height: 12.h,), Container( diff --git a/lib/settlement/settlement_view/settlement_order_commodity.dart b/lib/settlement/settlement_view/settlement_order_commodity.dart index a7bc89e2..5d98c2d8 100644 --- a/lib/settlement/settlement_view/settlement_order_commodity.dart +++ b/lib/settlement/settlement_view/settlement_order_commodity.dart @@ -318,6 +318,20 @@ class _SettlementOrderCommodity extends State { ); } + String countAllGoods(){ + int count = 0; + if(widget.minOrderInfo != null){ + widget.minOrderInfo.orderProductVOList.forEach((element) { + count += element.buyNum; + }); + }else if(widget.settleOrderInfo != null){ + widget.settleOrderInfo.orderProductList.forEach((element) { + count += element.buyNum; + }); + } + return count.toString(); + } + Widget buildTotalPrice() { return Container( margin: EdgeInsets.only(top: 7.h, bottom: 11.h), @@ -328,13 +342,7 @@ class _SettlementOrderCommodity extends State { children: [ Expanded( child: Text( - S.of(context).gongjijianshangpin((widget.minOrderInfo != null) - ? ((widget.minOrderInfo != null) - ? widget.minOrderInfo.orderProductVOList.length - : "0") - : (widget.settleOrderInfo != null) - ? widget.settleOrderInfo.orderProductList.length - : "0"), + S.of(context).gongjijianshangpin(countAllGoods()), style: TextStyle( fontSize: 10.sp, color: Color(0xFFA29E9E), diff --git a/lib/view_widget/new_coupon_widget.dart b/lib/view_widget/new_coupon_widget.dart index 0e0c6d54..939e6010 100644 --- a/lib/view_widget/new_coupon_widget.dart +++ b/lib/view_widget/new_coupon_widget.dart @@ -381,9 +381,10 @@ class NewCouponWidget extends StatelessWidget { ///首页优惠券ui Widget homeCoupon(BuildContext context) { return Container( - height: 100.h, + height: 110.h, width: double.infinity, margin: EdgeInsets.fromLTRB(14.w, 6.h, 14.w, 6.h), + padding:EdgeInsets.symmetric(horizontal: 12), decoration: BoxDecoration( image: DecorationImage( fit: BoxFit.fill, @@ -394,22 +395,8 @@ class NewCouponWidget extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded( - flex: 1, - child:Container( - margin: EdgeInsets.only(top: 12,bottom: 12), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded(child: Container( - child:homeWidget(context), - )), - ], - ), - )), - Container( - margin: EdgeInsets.only(top: 12,left: 12,bottom: 12), + Expanded(child: Container( + margin: EdgeInsets.only(top: 12,bottom: 12), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -472,13 +459,16 @@ class NewCouponWidget extends StatelessWidget { ) ], ), - ), + )), Column( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ + Expanded(child: Container( + child:homeWidget(context), + )), Container( - margin: EdgeInsets.only(right:12.w,bottom: 12), + margin: EdgeInsets.only(bottom: 12), child: homeBtn(context), ) ], @@ -539,7 +529,7 @@ class NewCouponWidget extends StatelessWidget { ); } else if (coupon.bizType == 3) { return Column( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( @@ -570,7 +560,7 @@ class NewCouponWidget extends StatelessWidget { ); } else if (coupon.bizType == 5) { return Column( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( @@ -581,7 +571,7 @@ class NewCouponWidget extends StatelessWidget { Text( S.of(context).duihuanquan, style: TextStyle( - fontSize: 30.sp, + fontSize: 26.sp, fontWeight: MyFontWeight.semi_bold, color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), ), @@ -601,7 +591,7 @@ class NewCouponWidget extends StatelessWidget { ); } else { return Column( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Row( @@ -633,14 +623,6 @@ class NewCouponWidget extends StatelessWidget { ), ], ), - Text( - S.of(context).quanchangtongyong, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.semi_bold, - color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060), - ), - ), ], ); } @@ -676,7 +658,7 @@ class NewCouponWidget extends StatelessWidget { return Align( alignment: Alignment.centerRight, child: Container( - padding: EdgeInsets.symmetric(horizontal: 14,vertical: 2), + padding: EdgeInsets.symmetric(horizontal:8,vertical: 2), decoration: BoxDecoration( borderRadius: BorderRadius.circular(3), color: Colors.grey, @@ -701,15 +683,16 @@ class NewCouponWidget extends StatelessWidget { callback(type); }, child: Container( - width: 56.w, + // 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(