diff --git a/assets/image/2x/my_trading.webp b/assets/image/2x/my_trading.webp new file mode 100644 index 00000000..7240a438 Binary files /dev/null and b/assets/image/2x/my_trading.webp differ diff --git a/assets/image/2x/trading_detail.webp b/assets/image/2x/trading_detail.webp new file mode 100644 index 00000000..91afce70 Binary files /dev/null and b/assets/image/2x/trading_detail.webp differ diff --git a/assets/image/2x/trading_history.webp b/assets/image/2x/trading_history.webp new file mode 100644 index 00000000..f00a188b Binary files /dev/null and b/assets/image/2x/trading_history.webp differ diff --git a/assets/image/2x/trading_logo.webp b/assets/image/2x/trading_logo.webp new file mode 100644 index 00000000..f961a524 Binary files /dev/null and b/assets/image/2x/trading_logo.webp differ diff --git a/assets/image/2x/trading_text.webp b/assets/image/2x/trading_text.webp new file mode 100644 index 00000000..9dfcb0d8 Binary files /dev/null and b/assets/image/2x/trading_text.webp differ diff --git a/assets/image/2x/vip_cz.webp b/assets/image/2x/vip_cz.webp new file mode 100644 index 00000000..38dd9d09 Binary files /dev/null and b/assets/image/2x/vip_cz.webp differ diff --git a/assets/image/2x/welfare_yz.webp b/assets/image/2x/welfare_yz.webp new file mode 100644 index 00000000..8a01148f Binary files /dev/null and b/assets/image/2x/welfare_yz.webp differ diff --git a/assets/image/3x/my_trading.webp b/assets/image/3x/my_trading.webp new file mode 100644 index 00000000..f3342502 Binary files /dev/null and b/assets/image/3x/my_trading.webp differ diff --git a/assets/image/3x/trading_detail.webp b/assets/image/3x/trading_detail.webp new file mode 100644 index 00000000..71935eae Binary files /dev/null and b/assets/image/3x/trading_detail.webp differ diff --git a/assets/image/3x/trading_history.webp b/assets/image/3x/trading_history.webp new file mode 100644 index 00000000..8687b821 Binary files /dev/null and b/assets/image/3x/trading_history.webp differ diff --git a/assets/image/3x/trading_logo.webp b/assets/image/3x/trading_logo.webp new file mode 100644 index 00000000..b75ee79a Binary files /dev/null and b/assets/image/3x/trading_logo.webp differ diff --git a/assets/image/3x/trading_text.webp b/assets/image/3x/trading_text.webp new file mode 100644 index 00000000..455dd3bc Binary files /dev/null and b/assets/image/3x/trading_text.webp differ diff --git a/assets/image/3x/vip_cz.webp b/assets/image/3x/vip_cz.webp new file mode 100644 index 00000000..9816e2a0 Binary files /dev/null and b/assets/image/3x/vip_cz.webp differ diff --git a/assets/image/3x/welfare_yz.webp b/assets/image/3x/welfare_yz.webp new file mode 100644 index 00000000..314fa564 Binary files /dev/null and b/assets/image/3x/welfare_yz.webp differ diff --git a/assets/image/my_trading.webp b/assets/image/my_trading.webp new file mode 100644 index 00000000..50f22266 Binary files /dev/null and b/assets/image/my_trading.webp differ diff --git a/assets/image/trading_detail.webp b/assets/image/trading_detail.webp new file mode 100644 index 00000000..a2d8e4e7 Binary files /dev/null and b/assets/image/trading_detail.webp differ diff --git a/assets/image/trading_history.webp b/assets/image/trading_history.webp new file mode 100644 index 00000000..60be2592 Binary files /dev/null and b/assets/image/trading_history.webp differ diff --git a/assets/image/trading_logo.webp b/assets/image/trading_logo.webp new file mode 100644 index 00000000..cb06d3ac Binary files /dev/null and b/assets/image/trading_logo.webp differ diff --git a/assets/image/trading_text.webp b/assets/image/trading_text.webp new file mode 100644 index 00000000..2dff605d Binary files /dev/null and b/assets/image/trading_text.webp differ diff --git a/assets/image/vip_cz.webp b/assets/image/vip_cz.webp new file mode 100644 index 00000000..52daeb87 Binary files /dev/null and b/assets/image/vip_cz.webp differ diff --git a/assets/image/welfare_yz.webp b/assets/image/welfare_yz.webp new file mode 100644 index 00000000..0cf94b3a Binary files /dev/null and b/assets/image/welfare_yz.webp differ diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart index 2bf1bf38..7d2968d0 100644 --- a/lib/generated/intl/messages_en.dart +++ b/lib/generated/intl/messages_en.dart @@ -260,6 +260,7 @@ class MessageLookup extends MessageLookupByLibrary { "gengduo" : MessageLookupByLibrary.simpleMessage("更多"), "gengduohaoquan" : MessageLookupByLibrary.simpleMessage("更多好券"), "gengduoyouhuiquan" : MessageLookupByLibrary.simpleMessage("更多优惠券"), + "genggaibangdingshoujihao" : MessageLookupByLibrary.simpleMessage("更改绑定手机号"), "genghuanbeijing" : MessageLookupByLibrary.simpleMessage("更换背景"), "genghuantouxiang" : MessageLookupByLibrary.simpleMessage("更换头像"), "gengyouhui" : MessageLookupByLibrary.simpleMessage("更优惠"), diff --git a/lib/generated/intl/messages_en_US.dart b/lib/generated/intl/messages_en_US.dart index e4ad1928..c0f7c5af 100644 --- a/lib/generated/intl/messages_en_US.dart +++ b/lib/generated/intl/messages_en_US.dart @@ -260,6 +260,7 @@ class MessageLookup extends MessageLookupByLibrary { "gengduo" : MessageLookupByLibrary.simpleMessage("more"), "gengduohaoquan" : MessageLookupByLibrary.simpleMessage("more good coupons"), "gengduoyouhuiquan" : MessageLookupByLibrary.simpleMessage("more coupons"), + "genggaibangdingshoujihao" : MessageLookupByLibrary.simpleMessage("modify bind phone"), "genghuanbeijing" : MessageLookupByLibrary.simpleMessage("Changing the background"), "genghuantouxiang" : MessageLookupByLibrary.simpleMessage("Changing the avatar"), "gengyouhui" : MessageLookupByLibrary.simpleMessage("More preferential"), diff --git a/lib/generated/intl/messages_zh_CN.dart b/lib/generated/intl/messages_zh_CN.dart index e0b906f7..4c5a3f81 100644 --- a/lib/generated/intl/messages_zh_CN.dart +++ b/lib/generated/intl/messages_zh_CN.dart @@ -260,6 +260,7 @@ class MessageLookup extends MessageLookupByLibrary { "gengduo" : MessageLookupByLibrary.simpleMessage("更多"), "gengduohaoquan" : MessageLookupByLibrary.simpleMessage("更多好券"), "gengduoyouhuiquan" : MessageLookupByLibrary.simpleMessage("更多优惠券"), + "genggaibangdingshoujihao" : MessageLookupByLibrary.simpleMessage("更改绑定手机号"), "genghuanbeijing" : MessageLookupByLibrary.simpleMessage("更换背景"), "genghuantouxiang" : MessageLookupByLibrary.simpleMessage("更换头像"), "gengyouhui" : MessageLookupByLibrary.simpleMessage("更优惠"), diff --git a/lib/generated/intl/messages_zh_Hans_CN.dart b/lib/generated/intl/messages_zh_Hans_CN.dart index e93be828..18dd5d2c 100644 --- a/lib/generated/intl/messages_zh_Hans_CN.dart +++ b/lib/generated/intl/messages_zh_Hans_CN.dart @@ -260,6 +260,7 @@ class MessageLookup extends MessageLookupByLibrary { "gengduo" : MessageLookupByLibrary.simpleMessage("更多"), "gengduohaoquan" : MessageLookupByLibrary.simpleMessage("更多好券"), "gengduoyouhuiquan" : MessageLookupByLibrary.simpleMessage("更多优惠券"), + "genggaibangdingshoujihao" : MessageLookupByLibrary.simpleMessage("更改绑定手机号"), "genghuanbeijing" : MessageLookupByLibrary.simpleMessage("更换背景"), "genghuantouxiang" : MessageLookupByLibrary.simpleMessage("更换头像"), "gengyouhui" : MessageLookupByLibrary.simpleMessage("更优惠"), diff --git a/lib/generated/intl/messages_zh_Hant_CN.dart b/lib/generated/intl/messages_zh_Hant_CN.dart index 84878f8e..4d9a3ac2 100644 --- a/lib/generated/intl/messages_zh_Hant_CN.dart +++ b/lib/generated/intl/messages_zh_Hant_CN.dart @@ -256,6 +256,7 @@ class MessageLookup extends MessageLookupByLibrary { "gengduo" : MessageLookupByLibrary.simpleMessage("更多"), "gengduohaoquan" : MessageLookupByLibrary.simpleMessage("更多好券"), "gengduoyouhuiquan" : MessageLookupByLibrary.simpleMessage("更多優惠券"), + "genggaibangdingshoujihao" : MessageLookupByLibrary.simpleMessage("更改綁定手機號"), "genghuanbeijing" : MessageLookupByLibrary.simpleMessage("更換背景"), "genghuantouxiang" : MessageLookupByLibrary.simpleMessage("更换头像"), "gengyouhui" : MessageLookupByLibrary.simpleMessage("更優惠"), diff --git a/lib/generated/intl/messages_zh_TW.dart b/lib/generated/intl/messages_zh_TW.dart index e21ed8d7..ab37c6d0 100644 --- a/lib/generated/intl/messages_zh_TW.dart +++ b/lib/generated/intl/messages_zh_TW.dart @@ -258,6 +258,7 @@ class MessageLookup extends MessageLookupByLibrary { "gengduo" : MessageLookupByLibrary.simpleMessage("更多"), "gengduohaoquan" : MessageLookupByLibrary.simpleMessage("更多好券"), "gengduoyouhuiquan" : MessageLookupByLibrary.simpleMessage("更多優惠券"), + "genggaibangdingshoujihao" : MessageLookupByLibrary.simpleMessage("更改綁定手機號"), "genghuanbeijing" : MessageLookupByLibrary.simpleMessage("更換背景"), "genghuantouxiang" : MessageLookupByLibrary.simpleMessage("更換頭像"), "gengyouhui" : MessageLookupByLibrary.simpleMessage("更優惠"), diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index e334b77a..c670ed50 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -7135,6 +7135,16 @@ class S { ); } + /// `更改绑定手机号` + String get genggaibangdingshoujihao { + return Intl.message( + '更改绑定手机号', + name: 'genggaibangdingshoujihao', + desc: '', + args: [], + ); + } + /// `并使用本机号码登录` String get privacy_policy4 { return Intl.message( diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart index e93687b5..d5a996c4 100644 --- a/lib/home/home_page.dart +++ b/lib/home/home_page.dart @@ -602,26 +602,55 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin { Widget spread(){ return Container( width: double.infinity, - height: 80.h, - margin: EdgeInsets.symmetric(horizontal: 14.w), - child: GestureDetector( - onTap: (){ - Navigator.of(context).pushNamed('/router/invite_friends'); - // Navigator.of(context).pushNamed('/router/mine_greenery'); - }, - child: ClipRRect( - child:Image.asset( - "assets/image/welfare_spread.webp", - width:double.infinity, - fit: BoxFit.fill, - height:double.infinity, + height: 85.h, + child: Swiper( + pagination: SwiperPagination( + alignment: Alignment.bottomCenter, + margin: EdgeInsets.only(top: 5.h), + builder: DotSwiperPaginationBuilder( + size: 8.w, + activeSize: 8.w, + space: 5.w, + activeColor: Colors.white, + color: Colors.white.withAlpha(76), ), - borderRadius: BorderRadius.circular(6.w), ), + autoplay:true, + duration: 1000, + autoplayDelay: 2000, + itemBuilder: (context, position) { + return GestureDetector( + onTap: (){ + if(position == 0){ + Navigator.of(context).pushNamed('/router/invite_friends'); + }else if(position == 1){ + Navigator.of(context).pushNamed('/router/trading_card_page'); + } + }, + child:Container( + margin: EdgeInsets.symmetric(horizontal:14.w), + child: ClipRRect( + child:Image.asset( + spreadItem[position], + width:double.infinity, + fit: BoxFit.fill, + height:double.infinity, + ), + borderRadius: BorderRadius.circular(6.w), + ), + ), + ); + }, + itemCount:2, ), ); } + final List spreadItem = [ + "assets/image/welfare_spread.webp", + "assets/image/welfare_yz.webp", + ]; + ///扫码 toScan() async { if (await Permission.camera.isPermanentlyDenied) { diff --git a/lib/home/trading_card_page.dart b/lib/home/trading_card_page.dart new file mode 100644 index 00000000..49ba44b6 --- /dev/null +++ b/lib/home/trading_card_page.dart @@ -0,0 +1,316 @@ +import 'dart:convert'; + +import 'package:dio/dio.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import '../retrofit/data/user_info.dart'; +import '../view_widget/classic_header.dart'; +import '../view_widget/my_footer.dart'; + +class TradingCardPage extends StatefulWidget { + @override + State createState() { + return _TradingCardPage(); + } +} + +class _TradingCardPage extends State { + ApiService apiService; + final RefreshController refreshController = RefreshController(); + UserInfo userInfo; + + @override + void initState() { + super.initState(); + SharedPreferences.getInstance().then((value) { + apiService = + ApiService(Dio(), context: context, token: value.getString("token")); + queryUserBalance(); + }); + } + + ///查询会员信息 + queryUserBalance() async { + BaseData baseData = + await apiService.queryInfo().catchError((onError) { + refreshController.refreshFailed(); + refreshController.loadFailed();}); + if (baseData != null && baseData.isSuccess) { + userInfo = baseData.data; + if (mounted) setState(() {}); + refreshController.refreshCompleted(); + refreshController.loadComplete(); + }else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + refreshController.refreshFailed(); + refreshController.loadFailed(); + } + } + + @override + Widget build(BuildContext context) { + return Container( + color: Colors.white, + child: Stack( + children: [ + Container( + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.fill, + image: AssetImage("assets/image/settlement_bg.webp"), + ), + ), + width: double.infinity, + height: 306.h, + ), + Scaffold( + backgroundColor: Colors.transparent, + appBar: MyAppBar( + title: "", + titleColor: Colors.white, + background: Colors.transparent, + leadingColor: Colors.white, + brightness: Brightness.dark, + ), + body: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader( + color: Colors.white, + ), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: () { + queryUserBalance(); + }, + physics: BouncingScrollPhysics(), + scrollController: ScrollController(), + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child:Container( + margin: EdgeInsets.symmetric(horizontal:14.w), + child:Column( + children: [ + Container( + width: double.infinity, + padding:EdgeInsets.only(top:24.h,bottom: 27.h) , + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 4), + blurRadius: 8, + spreadRadius: 8, + ) + ], + ), + child: Column( + children:[ + Image.asset( + "assets/image/my_trading.webp", + width:200.w, + fit: BoxFit.fill, + height:22.h, + ), + SizedBox(height:28.h), + Image.asset( + "assets/image/trading_logo.webp", + width:196.w, + fit: BoxFit.fill, + height:150.h, + ), + Padding(padding:EdgeInsets.only(top: 21.h,bottom: 17.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "我已收集", + style: TextStyle( + color: Colors.black, + fontSize: 14.sp, + fontWeight: MyFontWeight.regular), + ), + SizedBox(width: 12.w,), + Text( + (userInfo?.happyBean ?? 0).toString(), + style: TextStyle( + color: Color(0xFF32A060), + fontSize: 18.sp, + fontWeight: MyFontWeight.regular), + ) + ], + ),), + Padding(padding:EdgeInsets.only(bottom:31.h), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding(padding:EdgeInsets.only(right:1.w), + child: GestureDetector( + onTap: (){ + Navigator.of(context).pushNamed('/router/welfare_exchange'); + }, + child: Text( + "兑换区逛逛", + style: TextStyle( + color: Color(0xFF32A060), + fontSize: 15.sp, + fontWeight: MyFontWeight.regular), + ), + )), + Image.asset( + "assets/image/icon_right_z.webp", + width:16, + fit: BoxFit.fill, + height:16, + color: Color(0xFF32A060), + ) + ], + ),), + Image.asset( + "assets/image/trading_text.webp", + width:314.w, + fit: BoxFit.cover, + height:98.h, + ), + ] + ), + ), + Container( + width: double.infinity, + padding:EdgeInsets.symmetric(vertical: 17.h,horizontal: 32.w) , + margin: EdgeInsets.only(top:16.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 4), + blurRadius: 8, + spreadRadius: 8, + ) + ], + ), + child: Row( + children: [ + Image.asset( + "assets/image/trading_history.webp", + width:16.h, + fit: BoxFit.fill, + height:16.h, + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap:(){ + Navigator.of(context) + .pushNamed('/router/exchange_history_page'); + }, + child: Padding(padding:EdgeInsets.only(left: 4.w), + child: Text( + "兑换记录", + style: TextStyle( + color: Color(0xFF0D0D0D), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular), + )), + ), + Spacer(), + Container( + width: 1.w, + height: 35.5.h, + margin: EdgeInsets.symmetric(), + color:Color(0xFFD8D8D8)), + Spacer(), + Image.asset( + "assets/image/trading_detail.webp", + width:16.h, + fit: BoxFit.fill, + height:16.h, + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + Navigator.of(context).pushNamed('/router/integral_detailed_page',arguments:{"titleType":1}); + }, + child: Padding(padding:EdgeInsets.only(left: 4.w), + child: Text( + "印章明细", + style: TextStyle( + color: Color(0xFF0D0D0D), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular), + )),) + ], + ), + ), + Container( + width: double.infinity, + padding:EdgeInsets.symmetric(vertical:12.h,horizontal: 11.w) , + margin: EdgeInsets.only(top:16.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 4), + blurRadius: 8, + spreadRadius: 8, + ) + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding(padding:EdgeInsets.only(bottom:14.h), + child: Text( + "规则介绍", + style: TextStyle( + color: Color(0xFF0D0D0D), + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold), + ),), + Padding(padding:EdgeInsets.only(bottom:12.h), + child: Text( + "(1) 商品中所要求的印章达到方可兑换", + style: TextStyle( + color: Color(0xFF353535), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular), + ),), + Text( + "(2) 印章卡仅兑换商城指定商品,不能折算现金或兑换其他非指定商品项目", + style: TextStyle( + color: Color(0xFF353535), + fontSize: 12.sp, + height: 1.5.h, + fontWeight: MyFontWeight.regular), + ), + ], + ), + ) + ], + ), + ), + ), + ), + ) + ], + ), + ); + } +} diff --git a/lib/home/welfare_exchange.dart b/lib/home/welfare_exchange.dart index 1b99ed80..003d1f26 100644 --- a/lib/home/welfare_exchange.dart +++ b/lib/home/welfare_exchange.dart @@ -323,7 +323,7 @@ class _WelfareExchange extends State userInfo.nickname, style: TextStyle( fontSize: 16.sp, - fontWeight: MyFontWeight.medium, + fontWeight: MyFontWeight.bold, color: Color(0xFF353535), ), ), @@ -365,65 +365,71 @@ class _WelfareExchange extends State height: 50.h, child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - GestureDetector( - onTap: () { - Navigator.of(context) - .pushNamed('/router/integral_detailed_page'); - }, - child: Row( - children: [ - Text( - S.of(context).jifenmingxi, - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF4C4C4C), - ), + Row( + children: [ + Text( + "总积分", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF4C4C4C), ), - Container( - width: 20, - height: 20, - margin: EdgeInsets.only(left: 4), - decoration: BoxDecoration( - color: Color(0xFF32A060), - borderRadius: BorderRadius.circular(10), - ), - child: Icon( - Icons.keyboard_arrow_right, - size: 20, - color: Colors.white, - ), + ), + Padding(padding:EdgeInsets.only(left:2.w), + child: Text( + (userInfo != null) ? "${userInfo.points}" : "", + style: TextStyle( + fontSize: 16.sp, + color: Color(0xFF32A060), + fontFamily: 'JDZhengHT', + fontWeight: MyFontWeight.medium, ), - ], - ), + ),), + SizedBox( + width: 4.w, + ), + Image.asset( + "assets/image/icon_gold_coin.webp", + width: 18, + height: 18, + ) + ], ), SizedBox( height: 4.h, ), - Expanded( - child: Row( + Row( children: [ Text( - (userInfo != null) ? "${userInfo.points}" : "", + "总印章", style: TextStyle( - fontSize: 16.sp, - color: Color(0xFF32A060), - fontFamily: 'JDZhengHT', + fontSize: 14.sp, fontWeight: MyFontWeight.medium, + color: Color(0xFF4C4C4C), ), ), + Padding(padding:EdgeInsets.only(left:2.w), + child: Text( + (userInfo != null) ? "${userInfo?.happyBean ?? 0}" : "", + style: TextStyle( + fontSize: 16.sp, + color: Color(0xFF32A060), + fontFamily: 'JDZhengHT', + fontWeight: MyFontWeight.medium, + ), + ),), SizedBox( - width: 6.w, + width:4.w, ), Image.asset( - "assets/image/icon_gold_coin.webp", + "assets/image/trading_logo.webp", width: 18, height: 18, ) ], - )) + ), ], ), ) diff --git a/lib/integral/integral_detailed_page.dart b/lib/integral/integral_detailed_page.dart index 0f6e7990..c557eac6 100644 --- a/lib/integral/integral_detailed_page.dart +++ b/lib/integral/integral_detailed_page.dart @@ -10,14 +10,18 @@ import 'package:huixiang/retrofit/data/user_info.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/classic_header.dart'; -import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_footer.dart'; import 'package:huixiang/view_widget/my_tab.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import '../view_widget/no_data_view.dart'; + class IntegralDetailedPage extends StatefulWidget { + final arguments; + IntegralDetailedPage({this.arguments}); + @override State createState() { return _IntegralDetailedPage(); @@ -34,19 +38,19 @@ class _IntegralDetailedPage extends State super.didChangeDependencies(); _tabs = [ MyTab( - text: S.of(context).huode, + text: widget.arguments["titleType"] == 1 ? "印章获得" : S.of(context).huode, ), MyTab( - text: S.of(context).xiaofei, + text: widget.arguments["titleType"] == 1 ? "印章使用" : S.of(context).xiaofei, ), ]; tabController = TabController(length: 2, vsync: this) ..addListener(() { current = 1; if (tabController.index == 0) { - queryDetail("bill_cate_point_get"); + queryDetail(widget.arguments["titleType"] == 1 ? "" : "bill_cate_point_get",widget.arguments["titleType"] == 1 ?"BILL_TYPE_BEAN_ADD" :""); } else { - queryDetail("bill_cate_point_sub"); + queryDetail(widget.arguments["titleType"] == 1 ? "" : "bill_cate_point_sub",widget.arguments["titleType"] == 1 ?"BILL_TYPE_BEAN_SUB" :""); } }); } @@ -67,17 +71,17 @@ class _IntegralDetailedPage extends State apiService = ApiService(Dio(), context: context, token: value.getString("token")), userInfo = UserInfo.fromJson(jsonDecode(value.getString('user'))), - queryDetail("bill_cate_point_get"), + queryDetail(widget.arguments["titleType"] == 1 ? "" : "bill_cate_point_get",widget.arguments["titleType"] == 1 ?"BILL_TYPE_BEAN_ADD" :""), }); } int current = 1; List userBill = []; - queryDetail(category) async { + queryDetail(category,type) async { BaseData> baseData = await apiService.queryBillInfo({ "current": current, - "model": {"category": category, "title": "bill_title_point", "type": ""}, + "model": {"category": category, "title": widget.arguments["titleType"] == 1 ? "":"bill_title_point", "type": type}, "order": "descending", "size": 10, "sort": "id" @@ -107,17 +111,17 @@ class _IntegralDetailedPage extends State _onRefresh() { current = 1; if (tabController.index == 0) { - queryDetail("bill_cate_point_get"); + queryDetail(widget.arguments["titleType"] == 1 ? "" : "bill_cate_point_get",widget.arguments["titleType"] == 1 ?"BILL_TYPE_BEAN_ADD" :""); } else { - queryDetail("bill_cate_point_sub"); + queryDetail(widget.arguments["titleType"] == 1 ? "" : "bill_cate_point_sub",widget.arguments["titleType"] == 1 ?"BILL_TYPE_BEAN_SUB" :""); } } _loadMore() { if (tabController.index == 0) { - queryDetail("bill_cate_point_get"); + queryDetail(widget.arguments["titleType"] == 1 ? "" : "bill_cate_point_get",widget.arguments["titleType"] == 1 ?"BILL_TYPE_BEAN_SUB" :""); } else { - queryDetail("bill_cate_point_sub"); + queryDetail(widget.arguments["titleType"] == 1 ? "" : "bill_cate_point_sub",widget.arguments["titleType"] == 1 ?"BILL_TYPE_BEAN_SUB" :""); } } @@ -155,29 +159,39 @@ class _IntegralDetailedPage extends State titleSpacing: 2, leadingWidth: 56, flexibleSpace: FlexibleSpaceBar( - background: Container( - alignment: Alignment.center, - margin: EdgeInsets.only(top: 56.h), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - userInfo != null ? userInfo.points : "0", - style: TextStyle( - color: Colors.white, - fontWeight: MyFontWeight.medium, - fontSize: 48.sp), - ), - Text( - S.of(context).wodejifenzhi, - style: TextStyle( - color: Color(0xFFF2F2F2), - fontSize: 12.sp, - fontWeight: MyFontWeight.regular), + background: Stack( + children: [ + Image.asset( + "assets/image/ming_xi.webp", + width:double.infinity, + fit: BoxFit.fill, + height:259.h, + ), + Container( + alignment: Alignment.center, + margin: EdgeInsets.only(top: 56.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + userInfo != null ? (widget.arguments["titleType"] == 1 ? (userInfo?.happyBean ?? 0) : userInfo.points) : "0", + style: TextStyle( + color: Colors.white, + fontWeight: MyFontWeight.medium, + fontSize: 48.sp), + ), + Text( + widget.arguments["titleType"] == 1 ? "我的集卡券" : S.of(context).wodejifenzhi, + style: TextStyle( + color: Color(0xFFF2F2F2), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular), + ), + ], ), - ], - ), + ) + ], ), ), expandedHeight: 228, @@ -220,74 +234,125 @@ class _IntegralDetailedPage extends State ), onRefresh: _onRefresh, onLoading: _loadMore, - child: ListView.builder( + child: (userBill == null || userBill.length == 0) + ? NoDataView( + src: "assets/image/xiao_fei.webp", + isShowBtn: false, + text: "当前暂无记录哦~", + fontSize: 16.sp, + margin: EdgeInsets.all(60.h), + ):ListView.builder( itemCount: userBill != null ? userBill.length : 0, padding: EdgeInsets.only(top: 8, bottom: 8), itemBuilder: (context, position) { return Container( margin: EdgeInsets.fromLTRB(16, 8, 16, 8), - padding: EdgeInsets.fromLTRB(14, 7, 16, 7), + padding: EdgeInsets.all(12), decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(2)), + borderRadius: BorderRadius.all(Radius.circular(6)), boxShadow: [ BoxShadow( color: Colors.black.withAlpha(25), - offset: Offset(0, 1), - blurRadius: 12, + offset: Offset(0, 2), + blurRadius: 3, spreadRadius: 0, ) ]), child: Row( mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Image.asset( - "assets/image/icon_intergral_sign.webp", - width: 36.w, - height: 34.h, - ), - SizedBox( - width: 15, - ), Expanded( child: Container( - // height: 34.h, - alignment: Alignment.centerLeft, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - userBill[position].name ?? "", - // S.of(context).qiandao, - style: TextStyle( - color: Colors.black, - fontSize: 12.sp, - fontWeight: FontWeight.w400), + // height: 34.h, + alignment: Alignment.centerLeft, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding(padding: EdgeInsets.only(bottom: 8.h), + child: Text( + userBill[position].type ?? "", + // S.of(context).qiandao, + style: TextStyle( + color: Colors.black, + fontSize: 14.sp, + fontWeight: FontWeight.bold), + ),), + Text( + userBill[position].createTime ?? "", + style: TextStyle( + color: Color(0xFF4D4D4D), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular), + ) + ], ), - Text( - userBill[position].createTime ?? "", - style: TextStyle( - color: Color(0xFF727272), - fontSize: 10.sp, - fontWeight: MyFontWeight.regular), - ) - ], - ), - )), + )), Container( margin: EdgeInsets.only(top: 2.h), child: Text( "${tabController.index == 0 ? "+" : "-"}${double.tryParse(userBill[position].number ?? "0").toInt().toString()}", style: TextStyle( - color: Color(0xFF727272), - fontSize: 12.sp, + color: Color(0xFF4D4D4D), + fontSize: 14.sp, + fontFamily: 'JDZhengHT', fontWeight: MyFontWeight.regular), ), ) ], - ), + ) + // Row( + // mainAxisAlignment: MainAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // Image.asset( + // "assets/image/icon_intergral_sign.webp", + // width: 36.w, + // height: 34.h, + // ), + // SizedBox( + // width: 15, + // ), + // Expanded( + // child: Container( + // // height: 34.h, + // alignment: Alignment.centerLeft, + // child: Column( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Text( + // userBill[position].type ?? "", + // // S.of(context).qiandao, + // style: TextStyle( + // color: Colors.black, + // fontSize: 12.sp, + // fontWeight: FontWeight.w400), + // ), + // Text( + // userBill[position].createTime ?? "", + // style: TextStyle( + // color: Color(0xFF727272), + // fontSize: 10.sp, + // fontWeight: MyFontWeight.regular), + // ) + // ], + // ), + // )), + // Container( + // margin: EdgeInsets.only(top: 2.h), + // child: Text( + // "${tabController.index == 0 ? "+" : "-"}${double.tryParse(userBill[position].number ?? "0").toInt().toString()}", + // style: TextStyle( + // color: Color(0xFF727272), + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular), + // ), + // ) + // ], + // ), ); }), ), diff --git a/lib/integral/integral_page.dart b/lib/integral/integral_page.dart index fe3d9724..06ae97a7 100644 --- a/lib/integral/integral_page.dart +++ b/lib/integral/integral_page.dart @@ -124,7 +124,7 @@ class _IntegralPage extends State { margin: EdgeInsets.only(right: 16.w), child: GestureDetector( onTap: () { - Navigator.of(context).pushNamed('/router/integral_detailed_page'); + Navigator.of(context).pushNamed('/router/integral_detailed_page',arguments:{"titleType":2}); }, child: Text( S.of(context).mingxi, diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 492222f7..a76bd403 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -742,6 +742,7 @@ "pingtaizhifumima":"平台支付密码", "xiugai":"修改", "bangdingshouji":"绑定手机", + "genggaibangdingshoujihao":"更改绑定手机号", diff --git a/lib/l10n/intl_en_US.arb b/lib/l10n/intl_en_US.arb index 4aa9e181..bc843241 100644 --- a/lib/l10n/intl_en_US.arb +++ b/lib/l10n/intl_en_US.arb @@ -743,6 +743,7 @@ "pingtaizhifumima":"Platform payment password", "xiugai":"modify", "bangdingshouji":"bind phone", + "genggaibangdingshoujihao":"modify bind phone", diff --git a/lib/l10n/intl_zh_CN.arb b/lib/l10n/intl_zh_CN.arb index 43660f3d..e512dfa7 100644 --- a/lib/l10n/intl_zh_CN.arb +++ b/lib/l10n/intl_zh_CN.arb @@ -743,6 +743,7 @@ "pingtaizhifumima":"平台支付密码", "xiugai":"修改", "bangdingshouji":"绑定手机", + "genggaibangdingshoujihao":"更改绑定手机号", diff --git a/lib/l10n/intl_zh_Hans_CN.arb b/lib/l10n/intl_zh_Hans_CN.arb index 643335af..a044111d 100644 --- a/lib/l10n/intl_zh_Hans_CN.arb +++ b/lib/l10n/intl_zh_Hans_CN.arb @@ -743,6 +743,7 @@ "pingtaizhifumima":"平台支付密码", "xiugai":"修改", "bangdingshouji":"绑定手机", + "genggaibangdingshoujihao":"更改绑定手机号", diff --git a/lib/l10n/intl_zh_Hant_CN.arb b/lib/l10n/intl_zh_Hant_CN.arb index 2aca223e..de7201af 100644 --- a/lib/l10n/intl_zh_Hant_CN.arb +++ b/lib/l10n/intl_zh_Hant_CN.arb @@ -734,6 +734,7 @@ "pingtaizhifumima":"平臺支付密碼", "xiugai":"修改", "bangdingshouji":"綁定手機", + "genggaibangdingshoujihao":"更改綁定手機號", diff --git a/lib/l10n/intl_zh_TW.arb b/lib/l10n/intl_zh_TW.arb index ed3d7386..658a8398 100644 --- a/lib/l10n/intl_zh_TW.arb +++ b/lib/l10n/intl_zh_TW.arb @@ -736,6 +736,7 @@ "pingtaizhifumima":"平臺支付密碼", "xiugai":"修改", "bangdingshouji":"綁定手機", + "genggaibangdingshoujihao":"更改綁定手機號", diff --git a/lib/main.dart b/lib/main.dart index 6ad2cd4a..ad3481b1 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -95,6 +95,7 @@ import 'home/guide_page.dart'; import 'home/help_farmers/help_farmers_page.dart'; import 'home/home_view/activity_list.dart'; import 'home/start_page.dart'; +import 'home/trading_card_page.dart'; import 'home/welfare_exchange.dart'; import 'home/welfare_page.dart'; import 'login/login_store_select.dart'; @@ -310,7 +311,7 @@ Map routers = { '/router/settlement': (context, {arguments}) => Settlement(arguments: arguments), '/router/integral_detailed_page': (context, {arguments}) => - IntegralDetailedPage(), + IntegralDetailedPage(arguments:arguments), '/router/write_off_success_page': (context, {arguments}) => WriteOffSuccessPage(), '/router/exchange_history_page': (context, {arguments}) => @@ -437,4 +438,6 @@ Map routers = { LoginStoreSelect(arguments:arguments), '/router/binding_phone_page': (context, {arguments}) => BindingPhonePage(arguments:arguments), + '/router/trading_card_page': (context, {arguments}) => + TradingCardPage(), }; diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index a3e73b64..c1e2f4e8 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -5,6 +5,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/main.dart'; import 'package:huixiang/mine/mine_view/mine_calendar.dart'; @@ -427,24 +428,57 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { ///推广图 Widget spreadImage() { return Container( - margin: EdgeInsets.only(right: 14.w, bottom: 30.h, left: 14.w), - child: GestureDetector( - onTap: () { - Navigator.of(context).pushNamed('/router/invite_friends'); - }, - child: ClipRRect( - child: Image.asset( - "assets/image/welfare_spread.webp", - width: double.infinity, - fit: BoxFit.fill, - height: 80.h, + margin: EdgeInsets.only(bottom: 30.h,), + width: double.infinity, + height: 85.h, + child: Swiper( + pagination: SwiperPagination( + alignment: Alignment.bottomCenter, + margin: EdgeInsets.only(top: 5.h), + builder: DotSwiperPaginationBuilder( + size: 8.w, + activeSize: 8.w, + space: 5.w, + activeColor: Colors.white, + color: Colors.white.withAlpha(76), ), - borderRadius: BorderRadius.circular(6.w), ), + autoplay:true, + duration: 1000, + autoplayDelay: 2000, + itemBuilder: (context, position) { + return GestureDetector( + onTap: (){ + if(position == 0){ + Navigator.of(context).pushNamed('/router/invite_friends'); + }else if(position == 1){ + Navigator.of(context).pushNamed('/router/trading_card_page'); + } + }, + child:Container( + margin: EdgeInsets.symmetric(horizontal:14.w), + child: ClipRRect( + child:Image.asset( + spreadItem[position], + width:double.infinity, + fit: BoxFit.fill, + height:double.infinity, + ), + borderRadius: BorderRadius.circular(6.w), + ), + ), + ); + }, + itemCount:2, ), ); } + final List spreadItem = [ + "assets/image/welfare_spread.webp", + "assets/image/welfare_yz.webp", + ]; + ///横向的提示 Widget buildNotice() { return Container( diff --git a/lib/mine/mine_vip/mine_vip_core.dart b/lib/mine/mine_vip/mine_vip_core.dart index 82d7f446..3f4f0bd1 100644 --- a/lib/mine/mine_vip/mine_vip_core.dart +++ b/lib/mine/mine_vip/mine_vip_core.dart @@ -25,6 +25,8 @@ import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/vip_dialog.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import '../../retrofit/data/user_info.dart'; + class MineVipCore extends StatefulWidget { final Map arguments; @@ -42,27 +44,29 @@ class _MineVipCore extends State { List vipBenefitList = []; VipRuleDetails vipRuleDetails; int checkIndex = 0; + UserInfo userInfo; + int rankNameIndex; final SwiperController controller = SwiperController(); @override void initState() { super.initState(); - + userInfo = widget.arguments["userInfo"]; SharedPreferences.getInstance().then((value) { - if (widget.arguments["rankLevel"] == 1 && - !(value.getBool("FirstYinKa") ?? false)) { - showAlertDialog("银卡会员"); - value.setBool("FirstYinKa", true); - } else if (widget.arguments["rankLevel"] == 2 && - !(value.getBool("FirstJinKa") ?? false)) { - showAlertDialog("金卡会员"); - value.setBool("FirstJinKa", true); - } else if (widget.arguments["rankLevel"] == 3 && - !(value.getBool("FirstGongC") ?? false)) { - showAlertDialog("共创会员"); - value.setBool("FirstGongC", true); - } + // if (widget.arguments["rankLevel"] == 1 && + // !(value.getBool("FirstYinKa") ?? false)) { + // showAlertDialog("银卡会员"); + // value.setBool("FirstYinKa", true); + // } else if (widget.arguments["rankLevel"] == 2 && + // !(value.getBool("FirstJinKa") ?? false)) { + // showAlertDialog("金卡会员"); + // value.setBool("FirstJinKa", true); + // } else if (widget.arguments["rankLevel"] == 3 && + // !(value.getBool("FirstGongC") ?? false)) { + // showAlertDialog("共创会员"); + // value.setBool("FirstGongC", true); + // } apiService = ApiService(Dio(), context: context, token: value.getString("token")); queryVipLevel(); @@ -82,17 +86,36 @@ class _MineVipCore extends State { }); } + String levelTipsName(int position){ + if(userInfo.memberRankVo.rankName == ranks[position].rankName) + return S.of(context).dangqiandengji; + else { + int userLevelIndex = ranks.indexWhere((element) => element.rankName == userInfo.memberRankVo.rankName); + if(userLevelIndex+1 == position) + return "下一等级"; + else if(userLevelIndex-1 > position) + return "已达到"; + else if(userLevelIndex-1 == position) + return "上一等级"; + else + return S.of(context).zanweikaitong; + } + } + ///会员等级列表 queryVipLevel() async { BaseData> rankData = await apiService.rankList().catchError((onError) {}); if (rankData != null && rankData.isSuccess) { ranks.clear(); ranks.addAll(rankData.data); + rankNameIndex = ranks.indexWhere((element) => element.rankName == userInfo.memberRankVo.rankName); + if(rankNameIndex != -1) + checkIndex = rankNameIndex; setState(() { controller.move((widget.arguments["rankLevel"] - 1), animation: false); }); } else { - SmartDialog.showToast(rankData.msg, alignment: Alignment.center); + SmartDialog.showToast(rankData?.msg??"", alignment: Alignment.center); } } @@ -214,7 +237,7 @@ class _MineVipCore extends State { ), )), ), - if(widget?.arguments["userInfo"] != null) + if(userInfo.masterCardRankName != null) Container( alignment: Alignment.center, margin: EdgeInsets.only(right: 16.w), @@ -223,7 +246,7 @@ class _MineVipCore extends State { // Navigator.of(context).pushNamed('/router/integral_detailed_page'); }, child: Text( - "${S.of(context).dangqianzhukadengji} : ${widget?.arguments["userInfo"]??""}", + "${S.of(context).dangqianzhukadengji} : ${userInfo.masterCardRankName??""}", style: TextStyle( color: Colors.white, fontSize: 16.sp, @@ -250,6 +273,7 @@ class _MineVipCore extends State { viewportFraction: 0.95, loop: false, physics: BouncingScrollPhysics(), + index: checkIndex, controller: controller, onIndexChanged: (index) { setState(() { @@ -257,28 +281,29 @@ class _MineVipCore extends State { }); }, itemBuilder: (context, position) { - return MineVipView( - vipLevel: !(ranks != null && ranks.isNotEmpty) - ? widget.arguments["rankLevel"] - : position + 1, - curLevel: widget.arguments["rankLevel"], - tag: (widget.arguments["rankLevel"] == (position + 1) || - !(ranks != null && ranks.isNotEmpty)) - ? "vip" - : "", - padding: 6.w, - // rank: !(ranks != null && ranks.isNotEmpty) - // ? 0 - // : widget.arguments["expendAmount"] ?? 0, - rankMax: !(ranks != null && ranks.isNotEmpty) - ? 0 - : ranks[position].rankOrigin, - createTime: widget.arguments["createTime"], - showRank: false, - price: !(ranks != null && ranks.isNotEmpty) - ? "0" - : ranks[position].price, - ); + return vipCar(position); + // MineVipView( + // vipLevel: !(ranks != null && ranks.isNotEmpty) + // ? widget.arguments["rankLevel"] + // : position + 1, + // curLevel: widget.arguments["rankLevel"], + // tag: (widget.arguments["rankLevel"] == (position + 1) || + // !(ranks != null && ranks.isNotEmpty)) + // ? "vip" + // : "", + // padding: 6.w, + // // rank: !(ranks != null && ranks.isNotEmpty) + // // ? 0 + // // : widget.arguments["expendAmount"] ?? 0, + // rankMax: !(ranks != null && ranks.isNotEmpty) + // ? 0 + // : ranks[position].rankOrigin, + // createTime: widget.arguments["createTime"], + // showRank: false, + // price: !(ranks != null && ranks.isNotEmpty) + // ? "0" + // : ranks[position].price, + // ); }, itemCount: (ranks != null && ranks.isNotEmpty) ? ranks.length : 1, @@ -286,6 +311,7 @@ class _MineVipCore extends State { ), ///会员权益 + if(vipBenefitList != null) Container( margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0), padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), @@ -337,6 +363,7 @@ class _MineVipCore extends State { ), ///会员规则说明 + if(vipRuleDetails != null) Container( margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0), padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), @@ -402,6 +429,7 @@ class _MineVipCore extends State { ), ///会员级别对照表 + if(vipRuleDetails != null) Container( margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0), padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), @@ -462,6 +490,7 @@ class _MineVipCore extends State { ), ///会员如何获得积分 + if(vipRuleDetails != null) Container( margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0), decoration: BoxDecoration( @@ -560,7 +589,6 @@ class _MineVipCore extends State { ]), ), width: MediaQuery.of(context).size.width, - padding: EdgeInsets.all(16), height: 54.h, alignment: Alignment.center, child: Text( @@ -580,7 +608,7 @@ class _MineVipCore extends State { ); } - Widget vipCar(){ + Widget vipCar(int position){ return Container( margin:EdgeInsets.fromLTRB(16.w, 16.h, 8.w, 8.h), width: MediaQuery.of(context).size.width - 32.w, @@ -588,7 +616,15 @@ class _MineVipCore extends State { 2.11 * AppUtils.textScale(context)), decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), + gradient: LinearGradient( + colors: [ + AppUtils.getLighterColor(ranks[position]?.color ?? ""), + Color(int.parse((ranks[position]?.color ?? "").replaceAll("#", "FF"), radix: 16)), + ], + begin: Alignment.topLeft, + end: Alignment.bottomRight, + ), + borderRadius:BorderRadius.circular(8), boxShadow: [ BoxShadow( color: Colors.black.withAlpha(12), @@ -601,46 +637,6 @@ class _MineVipCore extends State { child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - // Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - // crossAxisAlignment: CrossAxisAlignment.start, - // children: [ - // Container( - // padding: EdgeInsets.fromLTRB(9.w, 4.h, 8.w, 4.h), - // decoration: BoxDecoration( - // color: levelColor, - // borderRadius: BorderRadius.only( - // topLeft: Radius.circular(8), - // bottomRight: Radius.circular(8), - // ), - // ), - // child: Text( - // topLeft, - // style: TextStyle( - // fontSize: 12.sp, - // fontWeight: MyFontWeight.semi_bold, - // color: Colors.white, - // ), - // ), - // ), - // Container( - // padding: EdgeInsets.fromLTRB(9.w, 4.h, 8.w, 4.h), - // margin: EdgeInsets.only(top: 10,right: 10), - // decoration: BoxDecoration( - // color: levelColor, - // borderRadius: BorderRadius.circular(10), - // ), - // child: Text( - // S.of(context).chakanquanyi, - // style: TextStyle( - // fontSize: 12.sp, - // fontWeight: MyFontWeight.semi_bold, - // color: Color(0xFFF5EEE9), - // ), - // ), - // ) - // ], - // ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, @@ -654,27 +650,26 @@ class _MineVipCore extends State { Container( padding: EdgeInsets.fromLTRB(9.w, 4.h, 8.w, 4.h), decoration: BoxDecoration( - color: Colors.red, + color: Color(int.parse((ranks[position]?.color ?? "").replaceAll("#", "FF"), radix: 16)), borderRadius: BorderRadius.only( topLeft: Radius.circular(8), bottomRight: Radius.circular(8), ), ), - child: Text( - "111", + child: Text(levelTipsName(position), style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.semi_bold, - color: Colors.white, + color: Color(int.parse((ranks[position]?.textColor ?? "").replaceAll("#", "FF"), radix: 16)), ), ), ), Container( margin: EdgeInsets.only(left: 13.w), child: Text( - "hhh", + "VIP ${ranks[position].rankName ?? ""}", style: TextStyle( - color: Colors.grey, + color: Color(int.parse((ranks[position]?.textColor ?? "").replaceAll("#", "FF"), radix: 16)), fontWeight: MyFontWeight.semi_bold, fontSize:22.sp, ), @@ -702,61 +697,97 @@ class _MineVipCore extends State { bottom: 12.h, ), child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, + mainAxisAlignment: + (userInfo?.memberRankVo?.rankName != ranks[position].rankName || (userInfo?.memberRankVo?.rankName == "共创会员" && ranks[position].rankName == "共创会员"))? + MainAxisAlignment.spaceAround: + MainAxisAlignment.end, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.baseline, - textBaseline: TextBaseline.alphabetic, + if(userInfo?.memberRankVo?.rankName != ranks[position].rankName || (userInfo?.memberRankVo?.rankName == "共创会员" && ranks[position].rankName == "共创会员")) + Align(alignment: Alignment.centerRight, + child: Text( + (ranks[position].rankName == "共创会员") ? "¥${AppUtils.calculateDouble(double.tryParse(ranks[position].price??""))}/永久" : (ranks[position]?.originScore ?? 0).toString(), + overflow: TextOverflow.ellipsis, + style: TextStyle( + color:Color(int.parse((ranks[position]?.textColor ?? "").replaceAll("#", "FF"), radix: 16)), + fontWeight: ranks[position].rankName == "共创会员" ? MyFontWeight.regular : MyFontWeight.bold, + fontSize: ranks[position].rankName == "共创会员" ? 14.sp : 20.sp, + ), + ),), + if(userInfo?.memberRankVo?.rankName == ranks[position].rankName && (userInfo?.memberRankVo?.rankName != "共创会员" && ranks[position].rankName != "共创会员")) + Padding(padding:EdgeInsets.only(bottom: 12.h), + child: Row( children: [ - Expanded( - child: Text( - "消费¥", - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Colors.black, - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, - ), + Expanded(child: + Text( + "消费满 ¥${userInfo.memberRankVo.nextOrigin ?? "0"} 升级为 ${userInfo?.memberRankVo?.nextName ?? ""}", + overflow: TextOverflow.ellipsis, + style: TextStyle( + color:Color(int.parse((ranks[position]?.textColor ?? "").replaceAll("#", "FF"), radix: 16)), + fontWeight:MyFontWeight.regular, + fontSize: 14.sp, ), - flex: 1, + ) ), Text.rich( TextSpan( children: [ TextSpan( - text:"555", + text:"${AppUtils.calculateDouble(double.tryParse(userInfo.expendAmount??"0"))}", style: TextStyle( - fontSize: 20.sp, - fontWeight: MyFontWeight.semi_bold, + fontSize: 26.sp, + fontWeight: MyFontWeight.medium, + color: Color(int.parse((ranks[position]?.textColor ?? "").replaceAll("#", "FF"), radix: 16)), + ), + ), + TextSpan( + text: "/${userInfo.memberRankVo.nextOrigin ?? "0"}", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + color: Color(int.parse((ranks[position]?.textColor ?? "").replaceAll("#", "FF"), radix: 16)), ), ), ], ), ), ], - ), - - // if (isUserVip) - Expanded(child: Row( + ),), + // if(userInfo?.memberRankVo?.rankName == ranks[position].rankName && (userInfo?.memberRankVo?.rankName != "共创会员" && ranks[position].rankName != "共创会员")) + // Container( + // height: 8.h, + // child: ClipRRect( + // borderRadius: BorderRadius.circular(6.5), + // child: LinearProgressIndicator( + // value: (userInfo?.memberRankVo?.nextOrigin ?? 0) > (double.tryParse(userInfo?.expendAmount ?? "0").toInt())? ((checkIndex < rankNameIndex) ? + // (userInfo?.memberRankVo?.nextOrigin ?? 0)/(userInfo?.memberRankVo?.nextOrigin ?? 0): (double.tryParse(userInfo?.expendAmount ?? "0").toInt()) / (userInfo?.memberRankVo?.nextOrigin ?? 0)) : 0, + // backgroundColor: Colors.white, + // color: AppUtils.getLighterColor(ranks[position]?.color ?? ""), + // ), + // ), + // ), + Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( S.of(context).kaitongriqi( - "2021-01-01" + (widget.arguments["createTime"] != null && widget.arguments["createTime"] != "") + ? widget.arguments["createTime"].split(" ")[0] + : widget.arguments["createTime"] ), style: TextStyle( fontWeight: MyFontWeight.regular, fontSize: 12.sp, + color: Color(int.parse((ranks[position]?.textColor ?? "").replaceAll("#", "FF"), radix: 16)) ), ), Icon( Icons.qr_code, size: 24, + color: Color(int.parse((ranks[position]?.textColor ?? "").replaceAll("#", "FF"), radix: 16)), ), ], - ),), + ), ], ), ), diff --git a/lib/retrofit/data/rank.dart b/lib/retrofit/data/rank.dart index 1f7c8bc0..0c1ab3b1 100644 --- a/lib/retrofit/data/rank.dart +++ b/lib/retrofit/data/rank.dart @@ -22,6 +22,10 @@ class Rank { bool _status; String _updateTime; String _updateUser; + String _color; + String _textColor; + int _originScore; + int _demotionScore; String get createTime => _createTime; String get createUser => _createUser; @@ -35,14 +39,18 @@ class Rank { bool get status => _status; String get updateTime => _updateTime; String get updateUser => _updateUser; + String get color => _color; + String get textColor => _textColor; + int get originScore => _originScore; + int get demotionScore => _demotionScore; Rank({ String createTime, String createUser, String id, - String rankContent, - String rankImg, - String rankName, + String rankContent, + String rankImg, + String rankName, int rankOrigin, int level, bool status, @@ -60,6 +68,10 @@ class Rank { _status = status; _updateTime = updateTime; _updateUser = updateUser; + _color = color; + _textColor = textColor; + _originScore = originScore; + _demotionScore = demotionScore; } Rank.fromJson(dynamic json) { @@ -75,6 +87,10 @@ class Rank { _status = json["status"]; _updateTime = json["updateTime"]; _updateUser = json["updateUser"]; + _color = json["color"]; + _textColor = json["textColor"]; + _originScore = json["originScore"]; + _demotionScore = json["demotionScore"]; } Map toJson() { @@ -91,6 +107,10 @@ class Rank { map["status"] = _status; map["updateTime"] = _updateTime; map["updateUser"] = _updateUser; + map["color"] = _color; + map["textColor"] = _textColor; + map["originScore"] = _originScore; + map["demotionScore"] = _demotionScore; return map; } diff --git a/lib/retrofit/data/user_info.dart b/lib/retrofit/data/user_info.dart index 22a44cf2..ed70e0cd 100644 --- a/lib/retrofit/data/user_info.dart +++ b/lib/retrofit/data/user_info.dart @@ -50,6 +50,7 @@ class UserInfo { String background; bool hasPayPassword; String happyBean; + bool isVip; factory UserInfo.fromJson(Map json) => UserInfo() @@ -83,6 +84,7 @@ class UserInfo { ..background = json['background'] as String ..hasPayPassword = json['hasPayPassword'] as bool ..happyBean = json['happyBean'] as String + ..isVip = json['isVip'] as bool ..memberRankVo = json['memberRankVo'] == null ? null : MemberRank.fromJson(json['memberRankVo'] as Map); @@ -118,6 +120,7 @@ class UserInfo { 'background' : this.background, 'hasPayPassword' : this.hasPayPassword, 'happyBean':this.happyBean, + 'isVip':this.isVip, 'memberRankVo': this.memberRankVo == null ? "" : this.memberRankVo.toJson(), }; } diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index dc0384e3..286a292b 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -27,7 +27,7 @@ import 'data/shopping_home_config.dart'; part 'min_api.g.dart'; const localBaseUrl = "http://192.168.10.78:8765/app/";///本地 -// const localBaseUrl = "https://2946-27-19-77-115.jp.ngrok.io/app/";///本地 +// const localBaseUrl = "http://pos-test.api.lotus-wallet.com/app/";///测试 const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线上 diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 0eb0ff9f..78a38906 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -67,7 +67,7 @@ import 'data/wx_pay.dart'; part 'retrofit_api.g.dart'; const localBaseUrl = "http://192.168.10.78:8766/app/";///本地 -// const localBaseUrl = "https://2946-27-19-77-115.jp.ngrok.io/app/";///本地 +// const localBaseUrl = "http://platform.test.api.lotus-wallet.com/app/";///测试 const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线上 @RestApi(baseUrl: localBaseUrl) diff --git a/lib/setting/binding_phone_page.dart b/lib/setting/binding_phone_page.dart index c753a57e..497dc562 100644 --- a/lib/setting/binding_phone_page.dart +++ b/lib/setting/binding_phone_page.dart @@ -10,7 +10,6 @@ import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/user_info.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; -import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -182,7 +181,7 @@ class _BindingPhonePage extends State { Navigator.of(context).pop(); }), title: Text( - "更换绑定手机号", + S.of(context).genggaibangdingshoujihao, style: TextStyle( fontWeight: MyFontWeight.regular, fontSize: 17.sp, diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index ed3c53ba..f2e8e254 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -1275,15 +1275,16 @@ class _Settlement extends State { productSkuId ?? "", actProductId ?? "", actProductSkuId ?? "", - (settleOrderInfo.isRaise || payChannel == 5) - ? "NONE" - : ((useVipPriceSelect == false && - couponListBean?.id != "" && - ((promotion?.id ?? productId) != "")) - ? "MEMBER_RANK" - : (isVips == false && vipLevelName == "黄金会员") - ? "MEMBER_RANK" - : "AUTO"), + // (settleOrderInfo.isRaise || payChannel == 5) + // ? "NONE" + // : ((useVipPriceSelect == false && + // couponListBean?.id != "" && + // ((promotion?.id ?? productId) != "")) + // ? "MEMBER_RANK" + // : (isVips == false && vipLevelName == "黄金会员") + // ? "MEMBER_RANK" + // : "AUTO"), + preferentialType(), // (settleOrderInfo.isRaise || payChannel == 5 || ((payChannel == 4 && settleOrderInfo.usePlateMoney == false))) ? false :useVipPriceSelect, // (settleOrderInfo.isRaise || payChannel == 5 || ((payChannel == 4 && settleOrderInfo.usePlateMoney == false)) || useVipPriceSelect == true) ? false :useBenefitSelect, count1, @@ -1292,6 +1293,22 @@ class _Settlement extends State { } } + String preferentialType(){ + if(settleOrderInfo.isRaise || payChannel == 5) + return "NONE"; + if((((promotion?.id ?? productId) ?? "") != "")){ + return "ACTIVITY"; + }else if((couponListBean?.id ?? "") != ""){ + return "COUPON"; + }else if(useVipPriceSelect == true && couponListBean?.id == "" && ((promotion?.id ?? productId) == "")){ + return "VIP"; + }if(useVipPriceSelect == false && couponListBean?.id == "" && ((promotion?.id ?? productId) == "")){ + return "MEMBER_RANK"; + }else { + return "AUTO"; + } + } + vipPriceSelect(bool useVipPriceSelect) { this.useVipPriceSelect = useVipPriceSelect; if (tableId > 0) { diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index 8d5236f8..5fcddbc3 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -657,8 +657,8 @@ class _StoreOrderPage extends State "shoppingCart": shopCarGoods, "numberOfPeople": numberOfPeople, "distance": widget.arguments["distance"], - "vipLevelName": memberVo.memberRankVo.rankName, - "isVips": memberVo.isVip, + "vipLevelName": memberVo?.memberRankVo?.rankName ??"", + "isVips": memberVo?.isVip ?? false, "distance": widget.arguments["distance"], "subscribeParam": miNiDetail?.subscribeParam, }, diff --git a/lib/utils/flutter_utils.dart b/lib/utils/flutter_utils.dart index f78045f0..2811d185 100644 --- a/lib/utils/flutter_utils.dart +++ b/lib/utils/flutter_utils.dart @@ -31,12 +31,12 @@ class AppUtils { ///使用16进制色值并返回对应色值的方法 static Color getLighterColor(String hexColor) { // 将16进制颜色值转换为Color对象 - Color color = Color(int.parse(hexColor.replaceAll("#", ""), radix: 16)); + Color color = Color(int.parse(hexColor.replaceAll("#", "FF"), radix: 16)); // 计算颜色的RGB值 - int red = color.red + 39; - int green = color.green + 52; - int blue = color.blue + 86; + int red = color.red + 95; + int green = color.green + 95; + int blue = color.blue + 95; // 确保RGB值不超过255 red = red > 255 ? 255 : red; diff --git a/lib/view_widget/mine_vip_entry.dart b/lib/view_widget/mine_vip_entry.dart index 932d2bd1..2adabee6 100644 --- a/lib/view_widget/mine_vip_entry.dart +++ b/lib/view_widget/mine_vip_entry.dart @@ -39,206 +39,315 @@ class MineVipEntry extends StatelessWidget { @override Widget build(BuildContext context) { if (userInfo != null && - userInfo.memberRankVo != null && - ranks != null && - ranks.length > 0) { - curLevel = (ranks.indexWhere((element) => element.id == userInfo.memberRankVo.id) + 1); - vipLevel = curLevel; - } + userInfo.memberRankVo != null && + ranks != null && + ranks.length > 0) { + curLevel = (ranks + .indexWhere((element) => element.id == userInfo.memberRankVo.id) + + 1); + vipLevel = curLevel; + } - if (curLevel == vipLevel) { - topLeft = S.of(context).dangqiandengji; - } else if (vipLevel < curLevel) { - topLeft = S.of(context).shangyidengji; - } else { - topLeft = S.of(context).zanweikaitong; - } + if (curLevel == vipLevel) { + topLeft = S.of(context).dangqiandengji; + } else if (vipLevel < curLevel) { + topLeft = S.of(context).shangyidengji; + } else { + topLeft = S.of(context).zanweikaitong; + } switch (vipLevel) { - case 1: + case 2: { - levelText = "${S.of(context).yinkahuiyuan}"; - logoColor = Color(0xFFA0C4E7); - levelTextColor = Color(0xFF61ABF3); - levelTextBackdrop = Color(0xFFC1DBF4); + levelText = ranks[1].rankName; + logoColor = Color(int.parse( + (ranks[1].textColor ?? "").replaceAll("#", "FF"), + radix: 16)); + levelTextColor = Color(int.parse( + (ranks[1].textColor ?? "").replaceAll("#", "FF"), + radix: 16)); + levelTextBackdrop = Color(int.parse( + (ranks[1].color ?? "").replaceAll("#", "FF"), + radix: 16)); break; } - case 2: + case 3: { - levelText = "${S.of(context).jinkahuiyuan}"; - logoColor = Color(0xFFFBB43A); - levelTextColor = Color(0xFFFBB43A); - levelTextBackdrop = Color(0xFFFFECD2); + levelText = ranks[2].rankName; + logoColor = Color(int.parse( + (ranks[2].textColor ?? "").replaceAll("#", "FF"), + radix: 16)); + levelTextColor = Color(int.parse( + (ranks[2].textColor ?? "").replaceAll("#", "FF"), + radix: 16)); + levelTextBackdrop = Color(int.parse( + (ranks[2].color ?? "").replaceAll("#", "FF"), + radix: 16)); break; } - case 3: + case 4: + { + levelText = ranks[3].rankName; + logoColor = Color(int.parse( + (ranks[3].textColor ?? "").replaceAll("#", "FF"), + radix: 16)); + levelTextColor = Color(int.parse( + (ranks[3].textColor ?? "").replaceAll("#", "FF"), + radix: 16)); + levelTextBackdrop = Color(int.parse( + (ranks[3].color ?? "").replaceAll("#", "FF"), + radix: 16)); + break; + } + case 5: { - levelText = "${S.of(context).gongchuanghuiyuan}"; - logoColor = Color(0xFF352822); - levelTextColor = Color(0xFF92755D); - levelTextBackdrop = Color(0xFFFFECD2); + levelText = ranks[4].rankName; + logoColor = Color(int.parse( + (ranks[4].textColor ?? "").replaceAll("#", "FF"), + radix: 16)); + levelTextColor = Color(int.parse( + (ranks[4].textColor ?? "").replaceAll("#", "FF"), + radix: 16)); + levelTextBackdrop = Color(int.parse( + (ranks[4].color ?? "").replaceAll("#", "FF"), + radix: 16)); break; } } - Widget widget = Container( - height:20.h, - width: double.infinity, - child: Row( - children: [ - Container( - height: double.infinity, - padding: EdgeInsets.symmetric(horizontal:3.w,vertical:4.h), - decoration: BoxDecoration( - color: logoColor, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(4), - bottomLeft: Radius.circular(4),), - boxShadow: [ - BoxShadow( - color: Color(0x08213303).withAlpha(12), - offset: Offset(0, 2), - blurRadius: 4, - spreadRadius: 0, - ), - ], - ), - child: Image.asset( - "assets/image/mine_vip_logo.webp", - fit: BoxFit.cover, - // width: 13.w, - // height: 11.h, - ), - ), - Container( - height: double.infinity, - padding: EdgeInsets.symmetric(horizontal:3.w,vertical:3.h), - decoration: BoxDecoration( - color: levelTextBackdrop, - borderRadius: BorderRadius.only( - topRight: Radius.circular(4), - bottomRight: Radius.circular(4),), - boxShadow: [ - BoxShadow( - color: Color(0x08213303).withAlpha(12), - offset: Offset(0, 2), - blurRadius: 4, - spreadRadius: 0, + Widget widget = userInfo.memberRankVo.rankName != null + ? Container( + height: 20.h, + width: double.infinity, + child: Row( + children: [ + Container( + height: double.infinity, + padding: EdgeInsets.symmetric(horizontal: 3.w, vertical: 4.h), + decoration: BoxDecoration( + color: logoColor, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(4), + bottomLeft: Radius.circular(4), + ), + boxShadow: [ + BoxShadow( + color: Color(0x08213303).withAlpha(12), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ), + ], + ), + child: Image.asset( + "assets/image/mine_vip_logo.webp", + fit: BoxFit.cover, + // width: 13.w, + // height: 11.h, + ), ), + Container( + height: double.infinity, + padding: EdgeInsets.symmetric(horizontal: 3.w, vertical: 3.h), + decoration: BoxDecoration( + color: levelTextBackdrop, + borderRadius: BorderRadius.only( + topRight: Radius.circular(4), + bottomRight: Radius.circular(4), + ), + boxShadow: [ + BoxShadow( + color: Color(0x08213303).withAlpha(12), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ), + ], + ), + child: Row( + children: [ + Text( + levelText, + textAlign: TextAlign.center, + style: TextStyle( + color: levelTextColor, + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + ), + ), + Image.asset( + "assets/image/icon_right.webp", + fit: BoxFit.cover, + width: 8, + height: 8, + color: levelTextColor, + ), + ], + ), + ) ], ), - child:Row( + ) + : Container( + height: 20.h, + width: double.infinity, + child: Row( children: [ - Text( - levelText, - textAlign: TextAlign.center, - style: TextStyle( - color: levelTextColor, - fontSize: 10.sp, - fontWeight: MyFontWeight.regular, + Container( + height: double.infinity, + padding: EdgeInsets.symmetric(horizontal: 3.w, vertical: 4.h), + decoration: BoxDecoration( + color: Color(0xFFCACACA), + borderRadius: BorderRadius.only( + topLeft: Radius.circular(4), + bottomLeft: Radius.circular(4), + ), + boxShadow: [ + BoxShadow( + color: Color(0x08213303).withAlpha(12), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ), + ], + ), + child: Image.asset( + "assets/image/mine_vip_logo.webp", + fit: BoxFit.cover, + // width: 13.w, + // height: 11.h, ), ), - Image.asset( - "assets/image/icon_right.webp", - fit: BoxFit.cover, - width: 8, - height: 8, - color: levelTextColor, - ), + Container( + height: double.infinity, + padding: EdgeInsets.symmetric(horizontal: 3.w, vertical: 3.h), + decoration: BoxDecoration( + color: Color(0xFFFFF8EC), + borderRadius: BorderRadius.only( + topRight: Radius.circular(4), + bottomRight: Radius.circular(4), + ), + boxShadow: [ + BoxShadow( + color: Color(0x08213303).withAlpha(12), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ), + ], + ), + child: Row( + children: [ + Text( + "开通会员", + textAlign: TextAlign.center, + style: TextStyle( + color: Color(0xFFCACACA), + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + ), + ), + Image.asset( + "assets/image/icon_right.webp", + fit: BoxFit.cover, + width: 8, + height: 8, + color: Color(0xFFCACACA), + ), + ], + ), + ) ], ), - ) - ], - ), - ); - // Container( - // width: double.infinity, - // padding: EdgeInsets.only(top: 12.h, bottom: 22.h, left: 12.w, right: 12.w), - // margin: EdgeInsets.only(top: 23.h,left: 13.5.w,right: 13.5.w,bottom:15.h), - // decoration: BoxDecoration( - // color: Color(0xFF3D3D5D), - // borderRadius: BorderRadius.circular(6), - // 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: [ - // Image.asset( - // "assets/image/vip_logo.webp", - // width: 24, - // height: 24, - // ), - // SizedBox( - // width: 5.w, - // ), - // Expanded( - // child: Text( - // levelText, - // style: TextStyle( - // fontSize: 16.sp, - // fontWeight: MyFontWeight.semi_bold, - // color: Color(0xFFFFEAD2)), - // )), - // Container( - // padding: EdgeInsets.fromLTRB(9.w, 4.h, 8.w, 4.h), - // decoration: BoxDecoration( - // color: Color(0xFFFFECD2), - // borderRadius: BorderRadius.circular(10), - // ), - // child: Text( - // S.of(context).chakanquanyi, - // style: TextStyle( - // fontSize: 12.sp, - // fontWeight: MyFontWeight.semi_bold, - // color: Color(0xFF92755D), - // ), - // ), - // ) - // ], - // ), - // SizedBox( - // height: 16.h, - // ), - // Container( - // height: 4.h, - // child: ClipRRect( - // borderRadius: BorderRadius.circular(6.5), - // child: LinearProgressIndicator( - // value: rankMax > (rank ?? 0) - // ? ((vipLevel < curLevel) - // ? rankMax / rankMax - // : (rank ?? 0) / rankMax) - // : 0, - // backgroundColor: Color(0xFF222233), - // color: Color(0xFFFFECD2), - // ), - // ), - // ), - // SizedBox( - // height: 8.h, - // ), - // Text( - // rank > rankMax - // ? S.of(context).dangqiandengji - // : "消费金额¥${rank.toStringAsFixed(2).toString()} 距${S.of(context).xiayidengji}还需¥${(rankMax - (rank ?? 0)).toStringAsFixed(2)}", - // style: TextStyle( - // color: Color(0xFFFFEAD2), - // fontWeight: MyFontWeight.light, - // fontFamily: 'JDZhengHT', - // fontSize: 14.sp, - // ), - // ) - // ], - // )); + ); + // Container( + // width: double.infinity, + // padding: EdgeInsets.only(top: 12.h, bottom: 22.h, left: 12.w, right: 12.w), + // margin: EdgeInsets.only(top: 23.h,left: 13.5.w,right: 13.5.w,bottom:15.h), + // decoration: BoxDecoration( + // color: Color(0xFF3D3D5D), + // borderRadius: BorderRadius.circular(6), + // 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: [ + // Image.asset( + // "assets/image/vip_logo.webp", + // width: 24, + // height: 24, + // ), + // SizedBox( + // width: 5.w, + // ), + // Expanded( + // child: Text( + // levelText, + // style: TextStyle( + // fontSize: 16.sp, + // fontWeight: MyFontWeight.semi_bold, + // color: Color(0xFFFFEAD2)), + // )), + // Container( + // padding: EdgeInsets.fromLTRB(9.w, 4.h, 8.w, 4.h), + // decoration: BoxDecoration( + // color: Color(0xFFFFECD2), + // borderRadius: BorderRadius.circular(10), + // ), + // child: Text( + // S.of(context).chakanquanyi, + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.semi_bold, + // color: Color(0xFF92755D), + // ), + // ), + // ) + // ], + // ), + // SizedBox( + // height: 16.h, + // ), + // Container( + // height: 4.h, + // child: ClipRRect( + // borderRadius: BorderRadius.circular(6.5), + // child: LinearProgressIndicator( + // value: rankMax > (rank ?? 0) + // ? ((vipLevel < curLevel) + // ? rankMax / rankMax + // : (rank ?? 0) / rankMax) + // : 0, + // backgroundColor: Color(0xFF222233), + // color: Color(0xFFFFECD2), + // ), + // ), + // ), + // SizedBox( + // height: 8.h, + // ), + // Text( + // rank > rankMax + // ? S.of(context).dangqiandengji + // : "消费金额¥${rank.toStringAsFixed(2).toString()} 距${S.of(context).xiayidengji}还需¥${(rankMax - (rank ?? 0)).toStringAsFixed(2)}", + // style: TextStyle( + // color: Color(0xFFFFEAD2), + // fontWeight: MyFontWeight.light, + // fontFamily: 'JDZhengHT', + // fontSize: 14.sp, + // ), + // ) + // ], + // )); return GestureDetector( onTap: () { @@ -258,7 +367,7 @@ class MineVipEntry extends StatelessWidget { Navigator.of(context) .pushNamed('/router/mine_vip_core', arguments: { "rankLevel": curLevel, - "userInfo": userInfo.masterCardRankName, + "userInfo": userInfo, "createTime": (userInfo != null) ? "${userInfo.createTime}" : "", "expendAmount": double.tryParse(userInfo?.expendAmount ?? "0").toInt(), diff --git a/lib/vip/vip_page.dart b/lib/vip/vip_page.dart index 2b4939b6..cddee8a4 100644 --- a/lib/vip/vip_page.dart +++ b/lib/vip/vip_page.dart @@ -11,9 +11,12 @@ import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import '../generated/l10n.dart'; import '../retrofit/data/base_data.dart'; +import '../retrofit/data/user_info.dart'; import '../retrofit/retrofit_api.dart'; import '../utils/flutter_utils.dart'; +import '../utils/font_weight.dart'; import '../view_widget/my_appbar.dart'; @@ -30,6 +33,7 @@ class _VipPageState extends State with AutomaticKeepAliveClientMixin { final RefreshController _refreshController = RefreshController(); ApiService apiService; VipCardHome vipHome; + UserInfo userInfo; @override @@ -41,9 +45,41 @@ class _VipPageState extends State with AutomaticKeepAliveClientMixin { @override void initState() { super.initState(); - queryVipHome(); + // queryVipHome(); + queryUserBalance(); + } + ///查询会员信息 + queryUserBalance() async { + try{ + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + showLoading: true + ); + } + BaseData baseData = + await apiService.queryInfo().catchError((onError) { + _refreshController.refreshFailed(); + _refreshController.loadFailed();}); + if (baseData != null && baseData.isSuccess) { + userInfo = baseData.data; + if (mounted) setState(() {}); + _refreshController.refreshCompleted(); + _refreshController.loadComplete(); + }else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + _refreshController.refreshFailed(); + _refreshController.loadFailed(); + } + }finally{ + setState((){}); + } } + ///Vip季卡,月卡,首页接口(暂不用) queryVipHome() async { try{ if (apiService == null) { @@ -68,6 +104,8 @@ class _VipPageState extends State with AutomaticKeepAliveClientMixin { _refreshController.loadComplete(); }else{ SmartDialog.showToast(baseData.msg ?? "", alignment: Alignment.center); + _refreshController.loadFailed(); + _refreshController.refreshFailed(); } }finally{ setState((){}); @@ -88,7 +126,7 @@ class _VipPageState extends State with AutomaticKeepAliveClientMixin { header: MyHeader(), physics: BouncingScrollPhysics(), onRefresh: () { - queryVipHome(); + queryUserBalance(); }, child: SingleChildScrollView( child: Container( @@ -96,14 +134,16 @@ class _VipPageState extends State with AutomaticKeepAliveClientMixin { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - VipTop(vipHome,(){ - queryVipHome(); - }), + VipTop(vipHome, + // (){queryVipHome();} + ), + + // if(vipHome !=null) + // VipGoodsDiscount(vipHome), - if(vipHome !=null) - VipGoodsDiscount(vipHome), + ExclusiveCoupon(userInfo), - ExclusiveCoupon(), + vipRule(), SizedBox(height: 24.h,) ], @@ -115,6 +155,83 @@ class _VipPageState extends State with AutomaticKeepAliveClientMixin { ); } + ///会员卡规则说明 + Widget vipRule(){ + return Container( + margin: EdgeInsets.only(left: 14.w, right: 14.w, bottom:40.h,top:8.h), + width: double.infinity, + padding: EdgeInsets.only(top:14.h, left:20.h, bottom:8.h, right:20.w), + 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( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Image.asset( + "assets/image/vip_title.webp", + fit: BoxFit.fill, //填充剩余空间 + height: 13.h, + width: 27.w, + ), + SizedBox( + width: 4.w, + ), + Text( + "会员卡说明", + style: TextStyle( + color: Colors.black, + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + ), + ), + ], + ), + SizedBox(height: 12.h,), + Padding(padding:EdgeInsets.symmetric(vertical: 12.h), + child:Text( + "1.仅限使用储值金额消费时享受VIP权益(使用优惠券及其他支付方式均不享受VIP权益);", + style: TextStyle( + color: Color(0xFF6A6A6A), + fontSize: 13.sp, + height: 1.5.h, + fontWeight: MyFontWeight.regular, + ), + )), + Padding(padding:EdgeInsets.symmetric(vertical:6.h), + child:Text( + "2.储值余额不足时不享受VIP权益;", + style: TextStyle( + color: Color(0xFF6A6A6A), + fontSize: 13.sp, + height: 1.5.h, + fontWeight: MyFontWeight.regular, + ), + )), + Padding(padding:EdgeInsets.symmetric(vertical: 12.h), + child:Text( + "3.2023年6月1日前储值余额不享受VIP价格;", + style: TextStyle( + color: Color(0xFF6A6A6A), + fontSize: 13.sp, + height: 1.5.h, + fontWeight: MyFontWeight.regular, + ), + )), + ], + ),); + } + @override bool get wantKeepAlive => true; } diff --git a/lib/vip/vip_view/exclusive_coupon.dart b/lib/vip/vip_view/exclusive_coupon.dart index a755ffaf..5d6691d5 100644 --- a/lib/vip/vip_view/exclusive_coupon.dart +++ b/lib/vip/vip_view/exclusive_coupon.dart @@ -4,9 +4,13 @@ import 'package:huixiang/utils/font_weight.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import '../../generated/l10n.dart'; +import '../../retrofit/data/user_info.dart'; import '../../view_widget/my_appbar.dart'; class ExclusiveCoupon extends StatefulWidget { + final UserInfo userInfo; + + ExclusiveCoupon(this.userInfo); @override State createState() { return _ExclusiveCoupon(); @@ -16,291 +20,351 @@ class ExclusiveCoupon extends StatefulWidget { class _ExclusiveCoupon extends State { @override Widget build(BuildContext context) { - return Container( - margin: EdgeInsets.only(left: 14.w, right: 14.w, bottom: 40.h), - width: double.infinity, - padding: - EdgeInsets.only(top: 20.h, left: 20.h, bottom: 10.h, right: 20.w), - 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, + return Column( + children: [ + (widget?.userInfo?.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, ), - Text( - S.of(context).zhuanxiangyouhuiquan, - style: TextStyle( - color: Colors.black, - 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( + "解锁回乡VIP卡获取更多权益", + 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", + ), + ], + ), + Container( + margin: EdgeInsets.only(left: 14.w, right: 14.w, bottom:16.h,top: 17.h), + width: double.infinity, + padding: + EdgeInsets.only(top: 20.h, left: 20.h, bottom: 10.h, right: 20.w), + 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: 14, - width: 14, + height: 13.h, + width: 27.w, ), - ), + SizedBox( + width: 4.w, + ), + Text( + "会员卡专享", + 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: 10.h, - ), - Container( - height: 124.h, - margin: EdgeInsets.only(bottom: 16.h), - child: Stack( - children: [ - Image.asset( - "assets/image/vip_shop_bj.webp", - fit: BoxFit.fill, //填充剩余空间 - height: double.infinity, - width: double.infinity, - ), - Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - child: Padding( - padding: EdgeInsets.only(top: 25.h, left: 19.w), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "海峡姐妹饮品券", - style: TextStyle( - color: Color(0xff32A060), - fontSize: 15.sp, - fontWeight: MyFontWeight.semi_bold, - ), - ), - SizedBox( - height: 5.h, - ), - Text.rich( - TextSpan( - children: [ - TextSpan( - text: "6", - style: TextStyle( - fontWeight: MyFontWeight.extra_bold, - fontSize: 36.sp, - fontFamily: 'JDZhengHT', - color: Color(0xffFF7E12), + SizedBox( + height: 10.h, + ), + Container( + height: 124.h, + margin: EdgeInsets.only(bottom: 16.h), + child: Stack( + children: [ + Image.asset( + "assets/image/vip_shop_bj.webp", + fit: BoxFit.fill, //填充剩余空间 + height: double.infinity, + width: double.infinity, + ), + Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.only(top: 25.h, left: 19.w), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "海峡姐妹饮品券", + style: TextStyle( + color: Color(0xff32A060), + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + ), ), - ), - TextSpan( - text: " 折", - style: TextStyle( - fontSize: 24.sp, - color: Color(0xffFF7E12), - fontWeight: MyFontWeight.semi_bold, + SizedBox( + height: 5.h, ), - ), - ], - ), - textDirection: TextDirection.ltr, - ), - ], - ), - )), - Image.asset( - "assets/image/vip_shop_hx.webp", - fit: BoxFit.fill, //填充剩余空间 - height: 85, - width: 85, + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "6", + style: TextStyle( + fontWeight: MyFontWeight.extra_bold, + fontSize: 36.sp, + fontFamily: 'JDZhengHT', + color: Color(0xffFF7E12), + ), + ), + TextSpan( + text: " 折", + style: TextStyle( + fontSize: 24.sp, + color: Color(0xffFF7E12), + fontWeight: MyFontWeight.semi_bold, + ), + ), + ], + ), + textDirection: TextDirection.ltr, + ), + ], + ), + )), + Image.asset( + "assets/image/vip_shop_hx.webp", + fit: BoxFit.fill, //填充剩余空间 + height: 85, + width: 85, + ), + ], ), - ], - ), - ) - ], - ), - ), - Container( - height: 124.h, - margin: EdgeInsets.only(bottom: 16.h), - child: Stack( - children: [ - Image.asset( - "assets/image/vip_shop_bj.webp", - fit: BoxFit.fill, //填充剩余空间 - height: double.infinity, - width: double.infinity, + ) + ], ), - Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - child: Padding( - padding: EdgeInsets.only(top: 25.h, left: 19.w), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "前进麦味烘焙券", - style: TextStyle( - color: Color(0xff32A060), - fontSize: 15.sp, - fontWeight: MyFontWeight.semi_bold, - ), - ), - SizedBox( - height: 5.h, - ), - Text.rich( - TextSpan( - children: [ - TextSpan( - text: "7", - style: TextStyle( - fontWeight: MyFontWeight.extra_bold, - fontSize: 36.sp, - fontFamily: 'JDZhengHT', - color: Color(0xffFF7E12), + ), + Container( + height: 124.h, + margin: EdgeInsets.only(bottom: 16.h), + child: Stack( + children: [ + Image.asset( + "assets/image/vip_shop_bj.webp", + fit: BoxFit.fill, //填充剩余空间 + height: double.infinity, + width: double.infinity, + ), + Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.only(top: 25.h, left: 19.w), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "前进麦味烘焙券", + style: TextStyle( + color: Color(0xff32A060), + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + ), ), - ), - TextSpan( - text: " 折", - style: TextStyle( - fontSize: 24.sp, - color: Color(0xffFF7E12), - fontWeight: MyFontWeight.semi_bold, + SizedBox( + height: 5.h, ), - ), - ], - ), - textDirection: TextDirection.ltr, - ), - ], - ), - )), - Image.asset( - "assets/image/vip_shop_qj.webp", - fit: BoxFit.fill, //填充剩余空间 - height: 85, - width: 85, + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "7", + style: TextStyle( + fontWeight: MyFontWeight.extra_bold, + fontSize: 36.sp, + fontFamily: 'JDZhengHT', + color: Color(0xffFF7E12), + ), + ), + TextSpan( + text: " 折", + style: TextStyle( + fontSize: 24.sp, + color: Color(0xffFF7E12), + fontWeight: MyFontWeight.semi_bold, + ), + ), + ], + ), + textDirection: TextDirection.ltr, + ), + ], + ), + )), + Image.asset( + "assets/image/vip_shop_qj.webp", + fit: BoxFit.fill, //填充剩余空间 + height: 85, + width: 85, + ), + ], ), - ], - ), - ) - ], - ), - ), - Container( - height: 124.h, - margin: EdgeInsets.only(bottom: 22.h), - child: Stack( - children: [ - Image.asset( - "assets/image/vip_shop_bj.webp", - fit: BoxFit.fill, //填充剩余空间 - height: double.infinity, - width: double.infinity, + ) + ], ), - Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - child: Padding( - padding: EdgeInsets.only(top: 25.h, left: 19.w), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "门店火锅券", - style: TextStyle( - color: Color(0xff32A060), - fontSize: 15.sp, - fontWeight: MyFontWeight.semi_bold, - ), - ), - SizedBox( - height: 5.h, - ), - Text.rich( - TextSpan( - children: [ - TextSpan( - text: "8", - style: TextStyle( - fontWeight: MyFontWeight.extra_bold, - fontSize: 36.sp, - fontFamily: 'JDZhengHT', - color: Color(0xffFF7E12), + ), + Container( + height: 124.h, + margin: EdgeInsets.only(bottom: 22.h), + child: Stack( + children: [ + Image.asset( + "assets/image/vip_shop_bj.webp", + fit: BoxFit.fill, //填充剩余空间 + height: double.infinity, + width: double.infinity, + ), + Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.only(top: 25.h, left: 19.w), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "门店火锅券", + style: TextStyle( + color: Color(0xff32A060), + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + ), ), - ), - TextSpan( - text: " 折", - style: TextStyle( - fontSize: 24.sp, - color: Color(0xffFF7E12), - fontWeight: MyFontWeight.semi_bold, + SizedBox( + height: 5.h, ), - ), - ], - ), - textDirection: TextDirection.ltr, - ), - ], - ), - )), - Image.asset( - "assets/image/vip_shop_hg.webp", - fit: BoxFit.fill, //填充剩余空间 - height: 85, - width: 85, + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "8", + style: TextStyle( + fontWeight: MyFontWeight.extra_bold, + fontSize: 36.sp, + fontFamily: 'JDZhengHT', + color: Color(0xffFF7E12), + ), + ), + TextSpan( + text: " 折", + style: TextStyle( + fontSize: 24.sp, + color: Color(0xffFF7E12), + fontWeight: MyFontWeight.semi_bold, + ), + ), + ], + ), + textDirection: TextDirection.ltr, + ), + ], + ), + )), + Image.asset( + "assets/image/vip_shop_hg.webp", + fit: BoxFit.fill, //填充剩余空间 + height: 85, + width: 85, + ), + ], ), - ], - ), - ) - ], - ), + ) + ], + ), + ), + ], ), - ], - ), + ) + ], ); } diff --git a/lib/vip/vip_view/vip_top.dart b/lib/vip/vip_view/vip_top.dart index 7ec08ba6..5fa77df1 100644 --- a/lib/vip/vip_view/vip_top.dart +++ b/lib/vip/vip_view/vip_top.dart @@ -20,9 +20,9 @@ import 'package:tobias/tobias.dart' as tobias; class VipTop extends StatefulWidget { final VipCardHome vipCardHome; - final Function queryVipHome; + // final Function queryVipHome; - VipTop(this.vipCardHome, this.queryVipHome); + VipTop(this.vipCardHome); @override State createState() { @@ -39,16 +39,16 @@ class _VipTop extends State { @override void initState() { super.initState(); - payListen = weChatResponseEventHandler.listen((event) async { - print("payCallback: ${event.errCode}"); - if (event.errCode == 0) { - widget.queryVipHome(); - SmartDialog.showToast("支付成功", alignment: Alignment.center); - } else { - SmartDialog.showToast("支付失败", alignment: Alignment.center); - return; - } - }); + // payListen = weChatResponseEventHandler.listen((event) async { + // print("payCallback: ${event.errCode}"); + // if (event.errCode == 0) { + // widget.queryVipHome(); + // SmartDialog.showToast("支付成功", alignment: Alignment.center); + // } else { + // SmartDialog.showToast("支付失败", alignment: Alignment.center); + // return; + // } + // }); } rechargeVIP() async { @@ -96,7 +96,7 @@ class _VipTop extends State { tobias.aliPay(baseData.data["body"]).then((payRes) { if (payRes['resultStatus'] == 9000 || payRes['resultStatus'] == '9000') { - widget.queryVipHome(); + // widget.queryVipHome(); SmartDialog.showToast("支付成功", alignment: Alignment.center); } else { @@ -129,131 +129,132 @@ class _VipTop extends State { child: Column( children: [ vipCard(), - if(widget?.vipCardHome?.cards?.length != 0) - SizedBox( - height: 15.h, - ), - (!(widget?.vipCardHome?.member?.isVip ?? false)) - ? (widget?.vipCardHome?.cards?.length == 0 ? Container():vipCardList()) - : Padding( - padding: EdgeInsets.symmetric(horizontal: 16.w), - child: Row( - children: [ - Expanded( - child: Container( - alignment: Alignment.center, - padding: EdgeInsets.symmetric( - horizontal: 10.w, vertical: 15.h), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4.w), - color: Color(0xffffffff), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ) - ], - ), - child: Text.rich( - TextSpan( - children: [ - TextSpan( - text: S - .of(context) - .yixianghuiyuanquanyi, - style: TextStyle( - fontWeight: MyFontWeight.semi_bold, - fontSize: 15.sp, - color: Color(0xff32A060), - ), - ), - TextSpan( - text: widget?.vipCardHome?.member - ?.vipDuration - .toString() ?? - "0", - style: TextStyle( - fontWeight: MyFontWeight.semi_bold, - fontSize: 18.sp, - color: Color(0xffF96519), - ), - ), - TextSpan( - text: " 天", - style: TextStyle( - fontWeight: MyFontWeight.semi_bold, - fontSize: 15.sp, - color: Color(0xff32A060), - ), - ), - ], - ), - textDirection: TextDirection.ltr, - ))), - SizedBox( - width: 10.w, - ), - Expanded( - child: GestureDetector( - onTap: () { - setState(() { - vipRenewShowBottomSheet(); - }); - }, - child: Container( - alignment: Alignment.center, - padding: EdgeInsets.symmetric( - horizontal: 10.w, vertical: 15.h), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(4.w), - color: Color(0xffffffff), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ) - ], - ), - child: Row( - mainAxisAlignment: - MainAxisAlignment.center, - crossAxisAlignment: - CrossAxisAlignment.center, - children: [ - Text( - "${(widget?.vipCardHome?.member?.isVipSubscribe ?? false) ? "已开通自动续费" : "续费回乡VIP"}", - style: TextStyle( - color: Color((widget - ?.vipCardHome - ?.member - ?.isVipSubscribe ?? - false) - ? 0xff3A3936 - : 0xff32A060), - fontSize: 15.sp, - fontWeight: MyFontWeight.semi_bold, - ), - ), - SizedBox( - width: 6.w, - ), - Image.asset( - "${(widget?.vipCardHome?.member?.isVipSubscribe ?? false) ? "assets/image/vip_xf.webp" : "assets/image/icon_right.webp"}", - width: 16, - height: 16, - fit: BoxFit.fill, - color: Color(0xff32A060), - ), - ], - ))), - ) - ], - ), - ), + // if(widget?.vipCardHome?.cards?.length != 0) + // SizedBox( + // height: 15.h, + // ), + // (!(widget?.vipCardHome?.member?.isVip ?? false)) + // ? (widget?.vipCardHome?.cards?.length == 0 ? Container():vipCardList()) + // : Padding( + // padding: EdgeInsets.symmetric(horizontal: 16.w), + // child: Row( + // children: [ + // Expanded( + // child: Container( + // alignment: Alignment.center, + // padding: EdgeInsets.symmetric( + // horizontal: 10.w, vertical: 15.h), + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(4.w), + // color: Color(0xffffffff), + // boxShadow: [ + // BoxShadow( + // color: Colors.black.withAlpha(12), + // offset: Offset(0, 3), + // blurRadius: 14, + // spreadRadius: 0, + // ) + // ], + // ), + // child: Text.rich( + // TextSpan( + // children: [ + // TextSpan( + // text: S + // .of(context) + // .yixianghuiyuanquanyi, + // style: TextStyle( + // fontWeight: MyFontWeight.semi_bold, + // fontSize: 15.sp, + // color: Color(0xff32A060), + // ), + // ), + // TextSpan( + // text: widget?.vipCardHome?.member + // ?.vipDuration + // .toString() ?? + // "0", + // style: TextStyle( + // fontWeight: MyFontWeight.semi_bold, + // fontSize: 18.sp, + // color: Color(0xffF96519), + // ), + // ), + // TextSpan( + // text: " 天", + // style: TextStyle( + // fontWeight: MyFontWeight.semi_bold, + // fontSize: 15.sp, + // color: Color(0xff32A060), + // ), + // ), + // ], + // ), + // textDirection: TextDirection.ltr, + // ))), + // SizedBox( + // width: 10.w, + // ), + // Expanded( + // child: GestureDetector( + // onTap: () { + // setState(() { + // vipRenewShowBottomSheet(); + // }); + // }, + // child: Container( + // alignment: Alignment.center, + // padding: EdgeInsets.symmetric( + // horizontal: 10.w, vertical: 15.h), + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(4.w), + // color: Color(0xffffffff), + // boxShadow: [ + // BoxShadow( + // color: Colors.black.withAlpha(12), + // offset: Offset(0, 3), + // blurRadius: 14, + // spreadRadius: 0, + // ) + // ], + // ), + // child: Row( + // mainAxisAlignment: + // MainAxisAlignment.center, + // crossAxisAlignment: + // CrossAxisAlignment.center, + // children: [ + // Text( + // "${(widget?.vipCardHome?.member?.isVipSubscribe ?? false) ? "已开通自动续费" : "续费回乡VIP"}", + // style: TextStyle( + // color: Color((widget + // ?.vipCardHome + // ?.member + // ?.isVipSubscribe ?? + // false) + // ? 0xff3A3936 + // : 0xff32A060), + // fontSize: 15.sp, + // fontWeight: MyFontWeight.semi_bold, + // ), + // ), + // SizedBox( + // width: 6.w, + // ), + // Image.asset( + // "${(widget?.vipCardHome?.member?.isVipSubscribe ?? false) ? "assets/image/vip_xf.webp" : "assets/image/icon_right.webp"}", + // width: 16, + // height: 16, + // fit: BoxFit.fill, + // color: Color(0xff32A060), + // ), + // ], + // ))), + // ) + // ], + // ), + // ), + rechargeGuide(), ], ), ) @@ -261,6 +262,136 @@ class _VipTop extends State { ); } + ///充值引导 + Widget rechargeGuide() { + return Container( + margin: EdgeInsets.only(left: 14.w, right: 14.w, bottom:21.h,top:16.h), + width: double.infinity, + padding: EdgeInsets.only(top:14.h, left:12.h, bottom:8.h, right:14.w), + 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: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded(child: + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: "充值", + style: TextStyle( + fontWeight: MyFontWeight.extra_bold, + fontSize: 18.sp, + fontFamily: 'JDZhengHT', + color: Color(0xFF262626), + ), + ), + TextSpan( + text: "¥200以上", + style: TextStyle( + fontSize: 18.sp, + color: Color(0xffFF7E12), + fontWeight: MyFontWeight.semi_bold, + ), + ), + TextSpan( + text: "即开通回乡VIP卡", + style: TextStyle( + fontSize: 18.sp, + color: Color(0xFF262626), + fontWeight: MyFontWeight.semi_bold, + ), + ), + ], + ), + textDirection: TextDirection.ltr, + ), + Padding( + padding: EdgeInsets.only(top: 6.h, bottom: 10.h), + child: Text( + "享受多门店商品9.2折优惠价!", + style: TextStyle( + color: Color(0xFF32A060), + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + ), + )), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "*活动一切解释权归海峡姐妹品牌公司所有", + style: TextStyle( + color: Color(0xFF151515), + fontSize: 8.sp, + fontWeight: MyFontWeight.semi_bold, + ), + ), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + Navigator.of(context).pushNamed('/router/recharge_page'); + }, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(100)), + border: Border.all( + width: 1.w, + color: Color(0xFF32A060), + style: BorderStyle.solid, + ), + color: Color(0xFFFFFFFF), + ), + padding: EdgeInsets.symmetric(vertical: 4.h,horizontal: 12.w), + child: Row(children: [ + Text( + "去储值", + style: TextStyle( + color: Color(0xFF32A060), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + ), + Image.asset( + "assets/image/icon_right.webp", + width:13, + fit: BoxFit.fill, + height:13, + color: Color(0xFF32A060), + ) + ]), + ), + ) + ], + ) + ], + )), + SizedBox(width: 11.h,), + Padding(padding:EdgeInsets.only(top:4.h), + child: Image.asset( + "assets/image/vip_cz.webp", + fit: BoxFit.fill, //填充剩余空间 + height:50.w, + width: 54.h, + ),) + ], + ), + ); + } + ///vip卡 Widget vipCard() { return Container( diff --git a/lib/web/web_view/comment_list.dart b/lib/web/web_view/comment_list.dart index af98aa55..b5ae3473 100644 --- a/lib/web/web_view/comment_list.dart +++ b/lib/web/web_view/comment_list.dart @@ -128,7 +128,7 @@ class CommentListState extends State { ); }, ), - if (memberList != null && memberList.length > 10) + // if (memberList != null && memberList.length > 10) Container( decoration: BoxDecoration( color: Color(0xFFF2F2F2),