From b88434f7fbe911832b328108da8ab2b705063958 Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Mon, 22 Nov 2021 23:40:34 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=AF=E5=88=86=E5=95=86=E5=9F=8E=E6=9B=B4?= =?UTF-8?q?=E6=94=B9,=E4=BC=9A=E5=91=98=E4=BD=93=E7=B3=BB=E6=9B=B4?= =?UTF-8?q?=E6=94=B9;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/image/2x/bianhao.png | Bin 0 -> 674 bytes assets/image/3x/bianhao.png | Bin 0 -> 1171 bytes assets/image/bianhao.png | Bin 0 -> 389 bytes lib/generated/intl/messages_en.dart | 3 + lib/generated/intl/messages_zh_CN.dart | 3 + lib/generated/intl/messages_zh_Hans_CN.dart | 3 + lib/generated/intl/messages_zh_Hant_CN.dart | 2 + lib/generated/intl/messages_zh_TW.dart | 3 + lib/generated/l10n.dart | 30 + lib/l10n/intl_en.arb | 4 + lib/l10n/intl_zh_CN.arb | 5 +- lib/l10n/intl_zh_Hans_CN.arb | 5 +- lib/l10n/intl_zh_Hant_CN.arb | 3 + lib/l10n/intl_zh_TW.arb | 5 + lib/main.dart | 5 +- lib/mine/mine_vip/binding_assistant_card.dart | 85 ++- lib/mine/mine_vip/legal_right_details.dart | 659 +++++++++--------- lib/mine/mine_vip/mine_attainment_page.dart | 506 +++++++------- lib/mine/mine_vip/mine_vip_core.dart | 173 +++-- lib/order/exchange_history_page.dart | 159 +++-- lib/order/exchange_order_page.dart | 152 +++- lib/order/exchange_write_off_page.dart | 290 ++++++++ lib/order/write_off_page.dart | 4 +- .../data/achievement_detail_list.dart | 191 +++++ lib/retrofit/data/exchange_order.dart | 12 + lib/retrofit/data/second_card_list.dart | 73 ++ lib/retrofit/data/vip_badges_list.dart | 147 ++++ lib/retrofit/data/vip_benefit_list.dart | 180 +++++ lib/retrofit/data/vip_rule_details.dart | 48 ++ lib/retrofit/retrofit_api.dart | 33 + lib/retrofit/retrofit_api.g.dart | 157 +++++ lib/store/store_order.dart | 5 +- lib/view_widget/mine_vip_view.dart | 44 +- lib/view_widget/vip_dialog.dart | 96 ++- 34 files changed, 2278 insertions(+), 807 deletions(-) create mode 100644 assets/image/2x/bianhao.png create mode 100644 assets/image/3x/bianhao.png create mode 100644 assets/image/bianhao.png create mode 100644 lib/order/exchange_write_off_page.dart create mode 100644 lib/retrofit/data/achievement_detail_list.dart create mode 100644 lib/retrofit/data/second_card_list.dart create mode 100644 lib/retrofit/data/vip_badges_list.dart create mode 100644 lib/retrofit/data/vip_benefit_list.dart create mode 100644 lib/retrofit/data/vip_rule_details.dart diff --git a/assets/image/2x/bianhao.png b/assets/image/2x/bianhao.png new file mode 100644 index 0000000000000000000000000000000000000000..ea6ad1b2f0880bd67da1b276d4408662f6c3d753 GIT binary patch literal 674 zcmV;T0$u%yP)Px%TuDShR9HvFmP>0CK@>*6+Zj#NT|iMpje??xqBE#_|AHG4GFB&p8)aMxS*Rd5 z1VKr%a}nt3Q3Mt87qW5XqkNzX$wKi(BDnK0gh^eQBr};uKdQPrWR_Jmb0(sxP0_K|l zwi~ATV{vmX|Ng@CLSua@fr2ltGGoGaA9DEitD=7+l|T%<2H-n@T>!TBCPTAIcxMv} zgu|H$sMP-az4PJn)89j$7#JijgHQoeu1(~t5^`@Mf#}Nlt`h#W?urZk$QZL8ZyTRi zLN?N|>w!o(f$KD|^Ih@&&u)R^)!}V@y6+bO{i}2K2^ch7O$oUr>?Gu+_y%D2$~?bR z!arr4fB}4Y+nkd-@Vq$vsaxXclhMKcfAxh{9}s5LMS0Fhz!bg$rH4v*!#zD9-6;l_ z*T$)$gm*nwzz)6|F5!`ezV)_Pojd)YG*s71V*p?3kkWKsjd+hE1(LwKD%Svf3q0O2oc!$6VPaJdzvun4N4JLSP9K7cgWGP_+4?Koh zNSMMy?}0QDHt@)sFo}dMJoa5+Bas9iE6`YAB9RnsBoHUD3{Yy4Rrltfy% zaRSZC+9k4pTMM)vheI>ad@pJ2fiI&Z&o7Jr823OHu%JEu1A>S)Fpn^zVgLXD07*qo IM6N<$f)8dZXaE2J literal 0 HcmV?d00001 diff --git a/assets/image/3x/bianhao.png b/assets/image/3x/bianhao.png new file mode 100644 index 0000000000000000000000000000000000000000..794d99aaeadd28653cd4e1201bbfabff9fc01501 GIT binary patch literal 1171 zcmV;E1Z?|>P)Px(O-V#SRA@u(ms@BYRT#(r|JiL~(xf#aUJw*7q-u#^w!w#jRP;@JGettWJDW;t zf;U?2lSoTTt%?^~ic(B=lC^>fLiN2^5ibFEtJSJ4Mp8jqFnP#!W0JkhCmRx*-R#Vs zxy1yW*ZIzz?{~i6`Q{vAjXzxD`Qv{82NmQ4LpvH9!u3ssT)qif{f&@(8w72j+yUTL z0d9dX3`mZ|EPx+L?Q00X2!&?HM!QdDD(4Hl0{0w!u71Py*{vedLBYKsS}D9+C^tbA z4WMKR?UMqEhku9-U0ezgI6%aR_X^|y$QFo%9aO9`vSM*#c8breg!qKme4rAq3#B01juSnnr$m{@7e8p@%+t`sPBuunz)V zfE%iT5KO1^M8tOhC)yA=BU-U99ZmjHndIi-&bs>P^<5y|2GFt`f2H|6)ovHu(mitj)CBp6&5Wrg`sT=dl9W+TYVW8!Cclp1Eu%3PM+uMGRB7i-gc&**nwYxs&7P5&&f(6`?`UblOrcFgjso&v6~J** z@W|5YDIMm#YGbj|Ccp~-zJ%~HHM3s8R+xAcl#Lc+PP4A=sZ`gA2}cTf)<&h}D8vwa zuUTZznYdB9?94y574Tgfg(Pi4azeaxHf9_v>q=Gw0@B6{!k-X4nT{LZDgmq(Z5BK! z-I2R7Q+F!0`$XOrV3lc8%5@TuzO+6#T&;X%dteo6GYRnJxyJ0t^V>&qH32%3J-doU z^G%hTloy$m#u7P*?3io(`;=Ak%eqj+&@Twksx(2cL6a2prsBrGM+U3u$`pzW>0M&t z4FIPx$KS@MER5(wik+DhxK@f)jKaD5>LC``(w6oJhd;t+`EVM}L?coyyL9HYpqLtta zcpH0*XruTH$z2mWiTDT-?94BBM~>ujxgbup?9TVi>SfIbOqH$Uo~@~Sz5a0%e6W$bLG zU>F8OT= routers = { ExchangeOrderSuccessPage(arguments: arguments), '/router/logistics_information_page': (context, {arguments}) => LogisticsInformationPage(arguments: arguments), + '/router/exchange_write_offPage': (context, {arguments}) => + ExchangeWriteOffPage(arguments: arguments), '/router/integral_store_page': (context, {arguments}) => IntegralStoreDetailsPage(arguments: arguments), '/router/manage_address_page': (context, {arguments}) => @@ -248,7 +251,7 @@ Map routers = { '/router/mine_vip_core': (context, {arguments}) => MineVipCore(arguments: arguments), '/router/legal_right_details': (context, {arguments}) => - LegalRightDetails(), + LegalRightDetails(arguments: arguments), '/router/binding_assistant_card': (context, {arguments}) => BindingAssistantCard(), '/router/order_history_page': (context, {arguments}) => diff --git a/lib/mine/mine_vip/binding_assistant_card.dart b/lib/mine/mine_vip/binding_assistant_card.dart index 0c9c8115..2dca7b69 100644 --- a/lib/mine/mine_vip/binding_assistant_card.dart +++ b/lib/mine/mine_vip/binding_assistant_card.dart @@ -35,6 +35,25 @@ class _BindingAssistantCard extends State { }); } + ///绑定副卡 + queryBindSecondCard(phone) async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData baseData = await apiService.bindSecondCard(phone); + if (baseData != null && baseData.isSuccess) { + SmartDialog.showToast("绑定成功", alignment: Alignment.center); + Navigator.of(context).pop(true); + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } + @override Widget build(BuildContext context) { return Scaffold( @@ -46,8 +65,7 @@ class _BindingAssistantCard extends State { ), body: Stack( children: [ - Expanded( - child: Column( + Column( children: [ Container( margin: EdgeInsets.only(bottom: 26.h), @@ -92,35 +110,35 @@ class _BindingAssistantCard extends State { height: 1, color: Color(0xFFF4F4F4), ), - Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - child: InkWell( - onTap: () {}, - child: editItem( - "验证码", - "", - S.of(context).qingshuruyanzhengma, - addressController, - false), - )), - Padding( - padding: EdgeInsets.only(right: 16, top: 10), - child: GestureDetector( - onTap: () {}, - child: Text( - "发送验证", - style: TextStyle( - fontSize: 14.sp, - fontWeight: FontWeight.bold, - color: Color(0xFF32A060), - ), - ), - )), - ], - ), + // Row( + // crossAxisAlignment: CrossAxisAlignment.center, + // mainAxisAlignment: MainAxisAlignment.start, + // children: [ + // Expanded( + // child: InkWell( + // onTap: () {}, + // child: editItem( + // "验证码", + // "", + // S.of(context).qingshuruyanzhengma, + // addressController, + // false), + // )), + // Padding( + // padding: EdgeInsets.only(right: 16, top: 10), + // child: GestureDetector( + // onTap: () {}, + // child: Text( + // "发送验证", + // style: TextStyle( + // fontSize: 14.sp, + // fontWeight: FontWeight.bold, + // color: Color(0xFF32A060), + // ), + // ), + // )), + // ], + // ), Container( margin: EdgeInsets.symmetric(horizontal: 16, vertical: 5), @@ -133,12 +151,13 @@ class _BindingAssistantCard extends State { ), ], ), - ), Align( alignment: Alignment.bottomCenter, child: InkWell( onTap: () { - + setState(() { + queryBindSecondCard(mobileController.text); + }); }, child: Container( color: Color(0xFF32A060), diff --git a/lib/mine/mine_vip/legal_right_details.dart b/lib/mine/mine_vip/legal_right_details.dart index b1e22e52..845e2bff 100644 --- a/lib/mine/mine_vip/legal_right_details.dart +++ b/lib/mine/mine_vip/legal_right_details.dart @@ -1,22 +1,28 @@ import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_html/flutter_html.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/retrofit/data/base_data.dart'; -import 'package:huixiang/retrofit/data/rank.dart'; +import 'package:huixiang/retrofit/data/second_card_list.dart'; +import 'package:huixiang/retrofit/data/vip_benefit_list.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; -import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/border_text.dart'; -import 'package:huixiang/view_widget/mine_vip_view.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/round_button.dart'; import 'package:shared_preferences/shared_preferences.dart'; class LegalRightDetails extends StatefulWidget { + final Map arguments; + + LegalRightDetails({this.arguments}); + @override State createState() { return _LegalRightDetails(); @@ -25,17 +31,66 @@ class LegalRightDetails extends StatefulWidget { class _LegalRightDetails extends State { ApiService apiService; - + List vipBenefitList = []; final SwiperController controller = SwiperController(); + int checkIndex = 0; + ScrollController _scrollController = ScrollController(); + List secondCardList = []; @override void initState() { super.initState(); - SharedPreferences.getInstance().then((value) { apiService = ApiService(Dio(), context: context, token: value.getString("token")); }); + vipBenefitList = widget.arguments["vipBenefitList"]; + querySecondCardList(); + } + + ///副卡列表 + querySecondCardList() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData> baseData = await apiService.secondCardList().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + setState(() { + secondCardList.clear(); + secondCardList.addAll(baseData.data); + if(secondCardList.length < 5){ + var isSecondCard = SecondCardList(); + isSecondCard.isAdd = true; + secondCardList.add(isSecondCard); + } + }); + } + EasyLoading.dismiss(); + } + + + ///解绑副卡 + queryUnbindSecondCard(phone) async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData baseData = await apiService.unbindSecondCard(phone); + if (baseData != null && baseData.isSuccess) { + querySecondCardList(); + SmartDialog.showToast("解绑成功", alignment: Alignment.center); + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } } @override @@ -49,299 +104,245 @@ class _LegalRightDetails extends State { background: Colors.transparent, leadingColor: Colors.white, ), - body: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Column( - children: [ - Container( - height: 130, - margin: EdgeInsets.only(top: 24), - child: ListView.builder( - scrollDirection: Axis.horizontal, - physics: BouncingScrollPhysics(), - padding: EdgeInsets.symmetric(horizontal: 10), - itemCount: 15, - itemBuilder: (context, position) { - return GestureDetector( - onTap: () { - setState(() {}); - }, - child: legalRightItem(), - ); - }, + body: Column( + children: [ + Container( + height: 130, + padding: EdgeInsets.only(top: 24), + margin: EdgeInsets.only( + left: (MediaQuery.of(context).size.width / 2 - + 48 - + checkIndex * 85) < + 0 + ? 0 + : (MediaQuery.of(context).size.width / 2 - + 48 - + checkIndex * 85)), + child: ListView.builder( + scrollDirection: Axis.horizontal, + physics: BouncingScrollPhysics(), + controller: _scrollController, + shrinkWrap: true, + padding: EdgeInsets.symmetric(horizontal: 10), + itemCount: vipBenefitList == null ? 0 : vipBenefitList.length, + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + setState(() { + checkIndex = position; + // _scrollController.animateTo((MediaQuery.of(context).size.width/2-48-checkIndex*85) + // >0?0:checkIndex*85, duration: new Duration(seconds: 1), curve: Curves.ease); + }); + }, + child: legalRightItem(vipBenefitList[position], position), + ); + }, + ), + ), + Container( + alignment: Alignment.center, + width: 33, + height: 16, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 0, + color: Color(0xFFFFF6E9), + ), ), ), - Container( - alignment: Alignment.center, + child: Image.asset( + "assets/image/jian_j.png", width: 33, height: 16, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 0, - color: Color(0xFFFFF6E9), - ), - ), - ), - child: Image.asset( - "assets/image/jian_j.png", - width: 33, - height: 16, - color: Color(0xFFFFF6E9), - fit: BoxFit.fill, - ), + color: Color(0xFFFFF6E9), + fit: BoxFit.fill, ), - Container( - padding: EdgeInsets.only(left: 16, right: 49), - decoration: BoxDecoration( - border: Border.all( - width: 0, - color: Color(0xFFFFF6E9), - ), + ), + Expanded(child: Container( + padding: EdgeInsets.only(left: 16, right: 49), + decoration: BoxDecoration( + border: Border.all( + width: 0, color: Color(0xFFFFF6E9), - borderRadius: new BorderRadius.only( - topLeft: Radius.circular(8.0), - topRight: Radius.circular(8.0), - ), ), - child: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 20, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Container( - width: 13.w, - height: 2.h, - color: Color(0xFF674119), - ), - SizedBox(height: 5.h), - Container( - width: 9.w, - height: 2.h, - color: Color(0xFF674119), - ), - SizedBox(height: 5.h), - Container( - width: 6.5.w, - height: 2.h, - color: Color(0xFF674119), - ), - ], - ), - SizedBox(width: 6.w), - Text( - "可绑定5位副卡", - style: TextStyle( - fontSize: 17.sp, - fontWeight: FontWeight.bold, + color: Color(0xFFFFF6E9), + borderRadius: new BorderRadius.only( + topLeft: Radius.circular(8.0), + topRight: Radius.circular(8.0), + ), + ), + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 20, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Container( + width: 13.w, + height: 2.h, color: Color(0xFF674119), ), - ), - SizedBox(width: 6.w), - Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - width: 13.w, - height: 2.h, - color: Color(0xFF674119), - ), - SizedBox(height: 5.h), - Container( - width: 9.w, - height: 2.h, - color: Color(0xFF674119), - ), - SizedBox(height: 5.h), - Container( - width: 6.5.w, - height: 2.h, - color: Color(0xFF674119), - ), - ], - ), - ], - ), - Text( - S.of(context).quanyijishao, - style: TextStyle( - fontWeight: MyFontWeight.semi_bold, - fontSize: 14.sp, - color: Color(0xFF674119), - ), - ), - SizedBox( - height: 8.h, - ), - Text( - "用户在成为金卡会员/共创会员之后,即可进行副卡绑定。点击添加新副卡,输入需要绑定用户的手机号,输入验证码," - "验证通过后,即可绑定成功。点击头像右下方的解除,出现提示弹窗,点击确认即可解除绑定。", - style: TextStyle( - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, - height: 1.5, - color: Color(0xFF674119), + SizedBox(height: 5.h), + Container( + width: 9.w, + height: 2.h, + color: Color(0xFF674119), + ), + SizedBox(height: 5.h), + Container( + width: 6.5.w, + height: 2.h, + color: Color(0xFF674119), + ), + ], ), - ), - SizedBox( - height: 20, - ), - Text( - S.of(context).quanyishuoming, - style: TextStyle( - fontWeight: MyFontWeight.semi_bold, - fontSize: 14.sp, - color: Color(0xFF674119), + SizedBox(width: 6.w), + Text( + vipBenefitList[checkIndex].name, + style: TextStyle( + fontSize: 17.sp, + fontWeight: FontWeight.bold, + color: Color(0xFF674119), + ), ), - ), - SizedBox( - height: 8, - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width: 6.w, - height: 6.h, - margin: EdgeInsets.fromLTRB(4.w, 7.h, 4.w, 7.h), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(3), - color: Color(0xFF79572D), + SizedBox(width: 6.w), + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: 13.w, + height: 2.h, + color: Color(0xFF674119), ), - ), - Text( - "副卡用户必须为平台注册用户", - style: TextStyle( - textBaseline: TextBaseline.alphabetic, - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, + SizedBox(height: 5.h), + Container( + width: 9.w, + height: 2.h, color: Color(0xFF674119), ), - ), - ], - ), - SizedBox( - height: 6, - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width: 6.w, - height: 6.h, - margin: EdgeInsets.fromLTRB(4.w, 7.h, 4.w, 7.h), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(3), - color: Color(0xFF79572D), + SizedBox(height: 5.h), + Container( + width: 6.5.w, + height: 2.h, + color: Color(0xFF674119), ), - ), - Text( - "每位主卡用户只可绑定5位副卡用户,同时,只能解绑3次", - style: TextStyle( - textBaseline: TextBaseline.alphabetic, - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, + ], + ), + ], + ), + Text( + S.of(context).quanyijishao, + style: TextStyle( + fontWeight: MyFontWeight.semi_bold, + fontSize: 14.sp, + color: Color(0xFF674119), + ), + ), + SizedBox( + height: 8.h, + ), + if (vipBenefitList[checkIndex]?.introduce != null && + vipBenefitList[checkIndex].introduce != "") + Container( + color: Color(0xFFFFF6E9), + child: Html( + data: vipBenefitList[checkIndex]?.describes ?? "", + style: { + "html": Style( color: Color(0xFF674119), ), - ), - ], + }, + customImageRenders: { + networkSourceMatcher(): networkImageRender( + loadingWidget: () { + return Container(); + }, + ), + }, + ), ), - SizedBox( - height: 6, + SizedBox( + height: 20, + ), + Text( + S.of(context).quanyishuoming, + style: TextStyle( + fontWeight: MyFontWeight.semi_bold, + fontSize: 14.sp, + color: Color(0xFF674119), ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - width: 6.w, - height: 6.h, - margin: EdgeInsets.fromLTRB(4.w, 7.h, 4.w, 7.h), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(3), - color: Color(0xFF79572D), - ), - ), - Text( - "副卡享受主卡的部分权益,主卡会员失效后,副卡也失效", - style: TextStyle( - textBaseline: TextBaseline.alphabetic, - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, + ), + SizedBox( + height: 8, + ), + if (vipBenefitList[checkIndex]?.describes != null && + vipBenefitList[checkIndex].describes != "") + Container( + color: Color(0xFFFFF6E9), + child: Html( + data: vipBenefitList[checkIndex]?.describes ?? "", + style: { + "html": Style( color: Color(0xFF674119), ), - ), - ], - ), - SizedBox( - height: 6, + }, + customImageRenders: { + networkSourceMatcher(): networkImageRender( + loadingWidget: () { + return Container(); + }, + ), + }, + ), ), - Row( + SizedBox( + height: 20, + ), + if(vipBenefitList[checkIndex].name == "副卡") + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, children: [ - Container( - width: 6.w, - height: 6.h, - margin: EdgeInsets.fromLTRB(4.w, 7.h, 4.w, 7.h), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(3), - color: Color(0xFF79572D), - ), - ), Text( - "副卡成为金卡会员后,自动与主卡解绑", + "${S.of(context).yibangfuka}(${secondCardList.length - (secondCardList.length >= 5 && !(secondCardList.last.isAdd ?? false) ? 0 :1 )}/5)", style: TextStyle( - textBaseline: TextBaseline.alphabetic, - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, + fontWeight: MyFontWeight.semi_bold, + fontSize: 14.sp, color: Color(0xFF674119), ), ), + SizedBox( + height: 8, + ), + assistant(), ], ), - SizedBox( - height: 20, - ), - Text( - "${S.of(context).yibangfuka}(0/5)", - style: TextStyle( - fontWeight: MyFontWeight.semi_bold, - fontSize: 14.sp, - color: Color(0xFF674119), - ), - ), - SizedBox( - height: 8, - ), - assistant(), - ], - ), + ), + ], ), - ) - ], - ), + ), + )) + ], ), ); } ///解除绑定弹窗 - unbindShowDeleteDialog() { + unbindShowDeleteDialog(phone) { showDialog( context: context, builder: (context) { @@ -410,7 +411,10 @@ class _LegalRightDetails extends State { fontWeight: FontWeight.bold, ), onTap: () { - Navigator.of(context).pop(); + setState(() { + queryUnbindSecondCard(phone); + Navigator.of(context).pop(); + }); }, ), flex: 1, @@ -426,44 +430,38 @@ class _LegalRightDetails extends State { } ///权益列表 - Widget legalRightItem() { - return Container( - margin: EdgeInsets.only(left: 20), - alignment: Alignment.center, - child: Column( - children: [ - Opacity( - opacity: 1, - // MImage( - // "assets/image/badge_img.png", - // width: 80, - // height: 80, - // fit: BoxFit.cover, - // errorSrc: "assets/image/default_1.png", - // fadeSrc: "assets/image/default_1.png", - // ), - child: Image.asset( - "assets/image/vip_qy.png", + Widget legalRightItem(VipBenefitList vipBenefitList, index) { + return Opacity( + opacity: index == checkIndex ? 1 : 0.6, + child: Container( + width: 80, + alignment: Alignment.center, + child: Column( + children: [ + MImage( + vipBenefitList.icon, width: 50, height: 50, fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", ), - ), - SizedBox( - height: 8.h, - ), - Text( - "储值优惠", - maxLines: 2, - overflow: TextOverflow.ellipsis, - textAlign: TextAlign.center, - style: TextStyle( - color: Colors.white, - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, + SizedBox( + height: 8.h, ), - ), - ], + Text( + vipBenefitList.name, + maxLines: 2, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white, + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + ), + ), + ], + ), ), ); } @@ -473,7 +471,7 @@ class _LegalRightDetails extends State { return Column( children: [ GridView.builder( - itemCount: 4, + itemCount:secondCardList == null ? 0 : secondCardList.length, shrinkWrap: true, physics: NeverScrollableScrollPhysics(), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( @@ -484,14 +482,12 @@ class _LegalRightDetails extends State { //垂直子Widget之间间距 mainAxisSpacing: 5, //子Widget宽高比例 - // childAspectRatio: AppUtils.textScale(context) > 1 - // ? (1 - ((AppUtils.textScale(context) - 1))) - // : 0.48, + childAspectRatio: 1.2, ), itemBuilder: (context, index) { return GestureDetector( onTap: () {}, - child: assistantItem(), + child: assistantItem(secondCardList[index]), ); }, ), @@ -499,25 +495,26 @@ class _LegalRightDetails extends State { ); } - Widget assistantItem() { + Widget assistantItem(SecondCardList secondCardList) { return Container( alignment: Alignment.center, - child: - Column( + child: !(secondCardList.isAdd ?? false) ? Column( children: [ Stack( alignment: Alignment.bottomRight, children: [ - Image.asset( - "assets/image/icon_idea_ya.png", + MImage( + secondCardList?.headimg ?? "", width: 50, height: 50, fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", ), GestureDetector( onTap: () { setState(() { - unbindShowDeleteDialog(); + unbindShowDeleteDialog(secondCardList.phone); }); }, child: Image.asset( @@ -533,7 +530,7 @@ class _LegalRightDetails extends State { height: 5.h, ), Text( - "123****6789", + secondCardList?.phone ?? "", style: TextStyle( color: Color(0xFF79572D), fontWeight: MyFontWeight.regular, @@ -541,30 +538,32 @@ class _LegalRightDetails extends State { ), ), ], + ): + GestureDetector( + onTap: (){ + Navigator.of(context).pushNamed('/router/binding_assistant_card').then((value) =>{ + querySecondCardList() + }); + }, + child:Column( + children: [ + Image.asset( + "assets/image/fuka_zj.png", + width:50, + height:50, + fit: BoxFit.cover, + ), + Text( + "添加新副卡", + style: TextStyle( + color: Color(0xFF79572D), + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + ), + ), + ], + ), ), - // GestureDetector( - // onTap: (){ - // Navigator.of(context).pushNamed('/router/binding_assistant_card'); - // }, - // child:Column( - // children: [ - // Image.asset( - // "assets/image/fuka_zj.png", - // width:50, - // height:50, - // fit: BoxFit.cover, - // ), - // Text( - // "添加新副卡", - // style: TextStyle( - // color: Color(0xFF79572D), - // fontWeight: MyFontWeight.regular, - // fontSize: 12.sp, - // ), - // ), - // ], - // ), - // ), ); } } diff --git a/lib/mine/mine_vip/mine_attainment_page.dart b/lib/mine/mine_vip/mine_attainment_page.dart index 1408a861..4ceb0a0a 100644 --- a/lib/mine/mine_vip/mine_attainment_page.dart +++ b/lib/mine/mine_vip/mine_attainment_page.dart @@ -1,17 +1,20 @@ +import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/retrofit/data/achievement_detail_list.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/user_info.dart'; +import 'package:huixiang/retrofit/data/vip_badges_list.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/font_weight.dart'; -import 'package:huixiang/view_widget/border_text.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; -import 'package:huixiang/view_widget/round_button.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:shared_preferences/shared_preferences.dart'; class MineAttainmentPage extends StatefulWidget { final Map arguments; @@ -28,7 +31,10 @@ class _MineAttainmentPage extends State { ApiService apiService; final RefreshController _refreshController = RefreshController(); UserInfo userInfo; - var checkIndex = 1; + List vipBadgesList = []; + List achievementDetail = []; + int checkPosition = 0; + int attainmentPoint = 0; @override void dispose() { @@ -40,115 +46,172 @@ class _MineAttainmentPage extends State { void initState() { super.initState(); userInfo = widget.arguments["userInfo"]; + queryAttainmentBadges(); + queryAchievementDetail("1460164746211753984"); + } + + ///成就徽章分类 + queryAttainmentBadges() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData> baseData = + await apiService.findBadges({}).catchError((error) { + _refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + vipBadgesList.clear(); + vipBadgesList.addAll(baseData.data); + setState(() { + _refreshController.refreshCompleted(); + }); + } else { + _refreshController.refreshFailed(); + } + } + + ///成就分类弹窗详情 + queryAchievementDetail(achievementCategoryId) async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData> baseData = await apiService + .getAchievementDetail(achievementCategoryId) + .catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + setState(() { + achievementDetail.clear(); + attainmentPoint = 0; + achievementDetail.addAll(baseData.data); + achievementDetail.forEach((element) { + if(element.actived) + attainmentPoint += 1; + }); + }); + } + EasyLoading.dismiss(); } @override Widget build(BuildContext context) { - return Container(decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage("assets/image/attainment_bj.png"), - ), - ),child:Scaffold( - backgroundColor: Colors.transparent, - appBar: MyAppBar( - title: "我的成就", - titleColor: Colors.black, - titleSize: 18.sp, - background: Colors.transparent, - leadingColor: Colors.black, + return Container( + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.fill, + image: AssetImage("assets/image/attainment_bj.png"), + ), ), - body: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Column( - children: [ - SizedBox(height: 24), - MImage( - userInfo?.headimg ?? "", - isCircle: true, - width: 58, - height: 58, - fit: BoxFit.cover, - errorSrc: "assets/image/default_user.png", - fadeSrc: "assets/image/default_user.png", - ), - SizedBox(height: 8), - Text( - userInfo?.nickname ?? S.of(context).denglu, - style: TextStyle( - fontSize: 16.sp, - fontWeight: FontWeight.bold, - color: Color(0xFF353535), - ), - ), - SizedBox(height: 28), - Container( - margin: EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8), - padding: EdgeInsets.all(20), - decoration: BoxDecoration( - color: Colors.white, - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ) - ], - borderRadius: BorderRadius.all(Radius.circular(8)), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( + child: Scaffold( + backgroundColor: Colors.transparent, + appBar: MyAppBar( + title: "我的成就", + titleColor: Colors.black, + titleSize: 18.sp, + background: Colors.transparent, + leadingColor: Colors.black, + ), + body: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + children: [ + SizedBox(height: 24), + MImage( + userInfo?.headimg ?? "", + isCircle: true, + width: 58, + height: 58, + fit: BoxFit.cover, + errorSrc: "assets/image/default_user.png", + fadeSrc: "assets/image/default_user.png", + ), + SizedBox(height: 8), + Text( + userInfo?.nickname ?? S.of(context).denglu, + style: TextStyle( + fontSize: 16.sp, + fontWeight: FontWeight.bold, + color: Color(0xFF353535), + ), + ), + SizedBox(height: 28), + Container( + margin: + EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8), + padding: EdgeInsets.all(20), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + borderRadius: BorderRadius.all(Radius.circular(8)), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - "成就徽章", - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 14.sp, - color: Color(0xFF353535)), - ), - SizedBox(width: 4), - Text( - "(", - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 14, - color: Color(0xFF353535)), - ), - Text( - "0", - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 14, - color: Color(0xFF32A060)), - ), - Text( - "/8)", - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 14, - color: Color(0xFF353535)), + Row( + children: [ + Text( + "成就徽章", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 14.sp, + color: Color(0xFF353535)), + ), + SizedBox(width: 4), + Text( + "(", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 14, + color: Color(0xFF353535)), + ), + Text( + attainmentPoint.toString(), + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 14, + color: Color(0xFF32A060)), + ), + Text( + "/${vipBadgesList.length})", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 14, + color: Color(0xFF353535)), + ), + ], ), + SizedBox(height: 12), + attainmentBadge(), ], ), - SizedBox(height: 12), - attainmentBadge(), - ], - ), + ), + ], ), - ], - ), - )), + )), ); } ///成就徽章列表 Widget attainmentBadge() { return GridView.builder( - itemCount: 8, + itemCount: vipBadgesList == null ? 0 : vipBadgesList.length, shrinkWrap: true, physics: NeverScrollableScrollPhysics(), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( @@ -166,38 +229,34 @@ class _MineAttainmentPage extends State { itemBuilder: (context, index) { return GestureDetector( onTap: () { - showDeleteDialog(); + setState(() { + showDeleteDialog(index); + }); }, - child: badgeItem(), + child: badgeItem(vipBadgesList[index]), ); }, ); } - Widget badgeItem() { + Widget badgeItem(VipBadgesList vipBadgesList) { return Container( alignment: Alignment.center, child: Column( children: [ - // MImage( - // "assets/image/badge_img.png", - // width: 80, - // height: 80, - // fit: BoxFit.cover, - // errorSrc: "assets/image/default_1.png", - // fadeSrc: "assets/image/default_1.png", - // ), - Image.asset( - "assets/image/badge_img.png", + MImage( + vipBadgesList?.icon ?? "", width: 80, height: 80, fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", ), SizedBox( height: 4.h, ), Text( - "签到", + vipBadgesList?.name ?? "", overflow: TextOverflow.ellipsis, style: TextStyle( color: Color(0xFF181818), @@ -211,18 +270,19 @@ class _MineAttainmentPage extends State { } ///徽章成就弹窗 - showDeleteDialog() { + showDeleteDialog(index) { showDialog( context: context, builder: (context) { - return StatefulBuilder(builder: (context, state) { + return StatefulBuilder(builder: ( + context, + state, + ) { return AlertDialog( content: Container( width: MediaQuery.of(context).size.width - 84, - height: 385.h, + height: 410.h, child: Column( - // mainAxisAlignment: MainAxisAlignment.spaceAround, - // crossAxisAlignment: CrossAxisAlignment.start, children: [ GestureDetector( onTap: () { @@ -239,14 +299,17 @@ class _MineAttainmentPage extends State { ], ), ), - Image.asset( - "assets/image/badge_img.png", + MImage( + this.vipBadgesList[index].icon, width: 150, height: 150, fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", ), + SizedBox(height: 10), Text( - "消费白银徽章", + "${vipBadgesList.length >index ?vipBadgesList[index].name :""}${achievementDetail.length > checkPosition ?achievementDetail[checkPosition].name:""}徽章", style: TextStyle( fontSize: 16.sp, fontWeight: MyFontWeight.semi_bold, @@ -257,7 +320,7 @@ class _MineAttainmentPage extends State { height: 6.h, ), Text( - "再消费268.4元即可升级", + "再${vipBadgesList.length >index ? vipBadgesList[index].name :""} ${achievementDetail.length > checkPosition ?achievementDetail[checkPosition].lessScore :""} 即可升级", style: TextStyle( fontSize: 12.sp, fontWeight: MyFontWeight.regular, @@ -287,7 +350,7 @@ class _MineAttainmentPage extends State { ), SizedBox(width: 4), Text( - "+ 10", + vipBadgesList[index].eachReward.toString(), style: TextStyle( fontWeight: MyFontWeight.regular, fontSize: 12.sp, @@ -296,137 +359,31 @@ class _MineAttainmentPage extends State { ], ), SizedBox(height: 5), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - GestureDetector( - onTap: () { - state(() { - checkIndex = 1; - }); - }, - child: Column( - children: [ - Image.asset( - "assets/image/qt_badge.png", - width: checkIndex != 1 ? 30 : 55, - height: checkIndex != 1 ? 30 : 55, - fit: BoxFit.cover, - ), - SizedBox(height: 10), - Text( - "青铜", - style: TextStyle( - fontSize: 10.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFFA3A3A3), - ), - ), - ], - ), - ), - Container( - width: 35.w, - height: 2.h, - decoration: new BoxDecoration( - color: Color(0xFFE1F2F7), - ), - ), - GestureDetector( - onTap: () { - state(() { - checkIndex = 2; - }); - }, - child: Column( - children: [ - Image.asset( - "assets/image/by_badge.png", - width: checkIndex != 2 ? 35 : 65, - height: checkIndex != 2 ? 35 : 65, - fit: BoxFit.cover, - ), - SizedBox(height: 10), - Text( - "白银", - style: TextStyle( - fontSize: 10.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFFA3A3A3), - ), - ), - ], - ), - ), - Container( - width: 35.w, - height: 2.h, - decoration: new BoxDecoration( - color: Color(0xFFE1F2F7), - ), - ), - GestureDetector( - onTap: () { - state(() { - checkIndex = 3; - }); - }, - child: Column( - children: [ - Image.asset( - "assets/image/hj_badge.png", - width: checkIndex != 3 ? 35 : 65, - height: checkIndex != 3 ? 35 : 65, - fit: BoxFit.cover, - ), - SizedBox(height: 10), - Text( - "黄金", - style: TextStyle( - fontSize: 10.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFFA3A3A3), - ), - ), - ], - ), - ), - Container( - width: 35.w, - height: 2.h, - decoration: new BoxDecoration( - color: Color(0xFFE1F2F7), - ), - ), - GestureDetector( - onTap: () { - state(() { - checkIndex = 4; - }); + Expanded( + child: Container( + height: double.maxFinite, + margin: EdgeInsets.only(top: 24), + child: ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.horizontal, + physics: BouncingScrollPhysics(), + itemCount: achievementDetail == null + ? 0 + : achievementDetail.length, + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + state(() { + checkPosition = position; + }); + }, + child: badgeGradeItem(achievementDetail[position], + position, achievementDetail.length), + ); }, - child: Column( - children: [ - Image.asset( - "assets/image/qt_badge.png", - width: checkIndex != 4 ? 35 : 65, - height: checkIndex != 4 ? 35 : 65, - fit: BoxFit.cover, - ), - SizedBox(height: 10), - Text( - "铂金", - style: TextStyle( - fontSize: 10.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFFA3A3A3), - ), - ), - ], - ), ), - ], - ), + ), + ) ], ), ), @@ -435,4 +392,53 @@ class _MineAttainmentPage extends State { }, ); } + + ///徽章级别列表 + Widget badgeGradeItem( + AchievementDetailList achievementDetail, var position, var size) { + return Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + MImage( + achievementDetail?.icon ?? "", + width: checkPosition == position ? 50 : 30, + height: checkPosition == position ? 50 : 30, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + SizedBox(height: 10), + Text( + achievementDetail?.name ?? "", + style: TextStyle( + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFFA3A3A3), + ), + ), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + if (position != size - 1) + Container( + width: 35.w, + height: 2.h, + // margin: EdgeInsets.only(top: 25), + decoration: new BoxDecoration( + color: Color(0xFFE1F2F7), + ), + ), + SizedBox(height: 20), + ]) + ], + ); + } } diff --git a/lib/mine/mine_vip/mine_vip_core.dart b/lib/mine/mine_vip/mine_vip_core.dart index 744cca61..01ef5ddc 100644 --- a/lib/mine/mine_vip/mine_vip_core.dart +++ b/lib/mine/mine_vip/mine_vip_core.dart @@ -1,14 +1,19 @@ import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_html/flutter_html.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/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/rank.dart'; +import 'package:huixiang/retrofit/data/vip_benefit_list.dart'; +import 'package:huixiang/retrofit/data/vip_rule_details.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/mine_vip_view.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; @@ -29,6 +34,8 @@ class MineVipCore extends StatefulWidget { class _MineVipCore extends State { ApiService apiService; List ranks = []; + List vipBenefitList = []; + VipRuleDetails vipRuleDetails; final SwiperController controller = SwiperController(); @@ -40,6 +47,8 @@ class _MineVipCore extends State { apiService = ApiService(Dio(), context: context, token: value.getString("token")); queryVipLevel(); + queryBenefitList(); + queryRuleDetails(); }); } @@ -56,6 +65,31 @@ class _MineVipCore extends State { } } + ///会员权益列表 + queryBenefitList() async { + BaseData> baseData = await apiService.benefitList().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + setState(() { + vipBenefitList.clear(); + vipBenefitList.addAll(baseData.data); + vipBenefitList.sort((a,b)=>(a.sort).compareTo(b.sort)); + }); + } + EasyLoading.dismiss(); + } + + ///会员权益介绍/规则/说明 + queryRuleDetails() async { + BaseData baseData = + await apiService.vipBenefit().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + setState(() { + vipRuleDetails = baseData.data; + }); + } + EasyLoading.dismiss(); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -204,19 +238,22 @@ class _MineVipCore extends State { SizedBox( height: 12.h, ), - Padding( - padding: EdgeInsets.only(left: 8), - child: Text( - "会员共分为3个等级,分别是银卡会员、金卡会员、共创会员。其中,银卡会员和金卡会员由用户的消费金额决定," - "消费金额越高,会员等级越高,享受到的会员权益也越多。而共创会员需要直接购买,但是它的权益包含银卡和金卡的,属于最高等级会员。", - style: TextStyle( - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, - height: 1.5, - color: Color(0xFF4C4C4C), + if (vipRuleDetails?.qa != null && + vipRuleDetails.qa != "") + Container( + color: Colors.white, + padding: EdgeInsets.only(left: 8), + child: Html( + data: vipRuleDetails?.qa??"", + customImageRenders: { + networkSourceMatcher(): networkImageRender( + loadingWidget: () { + return Container(); + }, + ), + }, ), ), - ), ], ), ), @@ -267,10 +304,12 @@ class _MineVipCore extends State { SizedBox( height: 12.h, ), - Image.asset( - "assets/image/vip_contrastive_table.png", + MImage( + vipRuleDetails?.contrast ?? "", width: double.infinity, height: 281, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", ), SizedBox( height: 16.h, @@ -330,40 +369,21 @@ class _MineVipCore extends State { SizedBox( height: 12.h, ), - Text( - "1.用户每消费1元可获得1个积分。", - style: TextStyle( - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, - color: Color(0xFF4C4C4C), - ), - ), - SizedBox( - height: 8.h, - ), - Text( - "2.通过完成积分详情-做任务得积分来获得积分。", - style: TextStyle( - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, - color: Color(0xFF4C4C4C), - ), - ), - SizedBox( - height: 8.h, - ), - Text( - "3.优惠金额无法累积积分,订单撤销或其他原因造成的未成功支付的订单,无法获得对应的积分。", - style: TextStyle( - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, - height: 1.5, - color: Color(0xFF4C4C4C), + if (vipRuleDetails?.rule != null && + vipRuleDetails.rule != "") + Container( + color: Colors.white, + child: Html( + data: vipRuleDetails?.rule??"", + customImageRenders: { + networkSourceMatcher(): networkImageRender( + loadingWidget: () { + return Container(); + }, + ), + }, ), ), - SizedBox( - height: 8.h, - ), ], ), ), @@ -406,6 +426,7 @@ class _MineVipCore extends State { ); } + ///vip Widget levelItem(Rank rank, rankOrigin, rankOriginMax) { return Container( margin: EdgeInsets.symmetric(vertical: 8.h), @@ -445,7 +466,7 @@ class _MineVipCore extends State { ///会员权益列表 Widget vipLegalRight() { return GridView.builder( - itemCount: 13, + itemCount:vipBenefitList == null ? 0 : vipBenefitList.length, shrinkWrap: true, physics: NeverScrollableScrollPhysics(), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( @@ -464,15 +485,15 @@ class _MineVipCore extends State { return GestureDetector( onTap: () { Navigator.of(context) - .pushNamed('/router/legal_right_details', arguments: {}); + .pushNamed('/router/legal_right_details', arguments: {"vipBenefitList": vipBenefitList,}); }, - child: vipLegalRightItem(), + child: vipLegalRightItem(vipBenefitList[index]), ); }, ); } - Widget vipLegalRightItem() { + Widget vipLegalRightItem(VipBenefitList vipBenefitList) { return Container( alignment: Alignment.center, child: Column( @@ -480,23 +501,15 @@ class _MineVipCore extends State { Stack( alignment: Alignment.bottomCenter, children: [ - Opacity( - opacity: 0.3, - // MImage( - // "assets/image/badge_img.png", - // width: 80, - // height: 80, - // fit: BoxFit.cover, - // errorSrc: "assets/image/default_1.png", - // fadeSrc: "assets/image/default_1.png", - // ), - child: Image.asset( - "assets/image/vip_qy.png", + MImage( + vipBenefitList?.icon ?? "", width: 36, height: 36, - fit: BoxFit.cover, + // fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", ), - ), + if(!vipBenefitList.actived) Container( decoration: new BoxDecoration( color: Color(0xFFA29E9E), @@ -516,21 +529,49 @@ class _MineVipCore extends State { Text( "暂未开放", style: TextStyle( - color: Color(0xFF181818), + color: Color(0xFFFFDCA1), fontWeight: MyFontWeight.regular, fontSize: 9.sp, ), ), ], ), - ) + ), + if(!vipBenefitList.actived && !vipBenefitList.have) + Container( + decoration: new BoxDecoration( + color: Color(0xFFA29E9E), + borderRadius: BorderRadius.circular(7.0), + ), + width: 52.w, + height: 15.h, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.lock, + color: Color(0xFFFFDCA1), + size: 10, + ), + Text( + "暂未解锁", + style: TextStyle( + color: Color(0xFFFFDCA1), + fontWeight: MyFontWeight.regular, + fontSize: 9.sp, + ), + ), + ], + ), + ), ], ), SizedBox( height: 5.h, ), Text( - "储值优惠", + vipBenefitList?.name ?? "", maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, diff --git a/lib/order/exchange_history_page.dart b/lib/order/exchange_history_page.dart index 1b77eaf3..4841b93b 100644 --- a/lib/order/exchange_history_page.dart +++ b/lib/order/exchange_history_page.dart @@ -263,12 +263,74 @@ class _ExchangeHistoryList extends State { SizedBox( height: 16.h, ), + exchangeOrder.useTyped == 1 ? + Container( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + S.of(context).zitidizhi + " :", + style: TextStyle( + color: Color(0xFF353535), + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + ), + ), + SizedBox( + width: 8.w, + ), + Expanded( + child: Text( + exchangeOrder.address ?? "", + style: TextStyle( + color: Colors.black, + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + ), + ), + ) + ], + ), + SizedBox( + height: 8.h, + ), + Row( + children: [ + Text( + S.of(context).zitishijian + " :", + style: TextStyle( + color: Color(0xFF353535), + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + ), + ), + SizedBox( + width: 8.h, + ), + Expanded( + child: Text( + S.of(context).duihuanhouwugegongzuori, + style: TextStyle( + color: Colors.black, + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + ), + ), + ) + ], + ), + ], + ), + ): Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - S.of(context).zitidizhi + " :", + S.of(context).shouhuodi + " :", style: TextStyle( color: Color(0xFF353535), fontWeight: MyFontWeight.regular, @@ -280,35 +342,7 @@ class _ExchangeHistoryList extends State { ), Expanded( child: Text( - exchangeOrder.address ?? "", - style: TextStyle( - color: Colors.black, - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, - ), - ), - ) - ], - ), - SizedBox( - height: 8.h, - ), - Row( - children: [ - Text( - S.of(context).zitishijian + " :", - style: TextStyle( - color: Color(0xFF353535), - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, - ), - ), - SizedBox( - width: 8.h, - ), - Expanded( - child: Text( - S.of(context).duihuanhouwugegongzuori, + exchangeOrder.recAddress ?? "", style: TextStyle( color: Colors.black, fontWeight: MyFontWeight.regular, @@ -423,8 +457,8 @@ class _ExchangeHistoryList extends State { crossAxisAlignment: CrossAxisAlignment.end, children: [ IconText( - S.of(context).youxiaoqizhi(exchangeOrder.updateTime), - leftImage: "assets/image/icon_order_time.png", + "${S.of(context).dingdanbianhao}: ${exchangeOrder.orderCode}", + leftImage: "assets/image/bianhao.png", iconSize: 16, textStyle: TextStyle( fontSize: 12.sp, @@ -432,16 +466,40 @@ class _ExchangeHistoryList extends State { color: Color(0xFF353535), ), ), + exchangeOrder.useTyped == 1 ? GestureDetector( onTap: () { - if (exchangeOrder.state == 1) { - receive2Card(exchangeOrder.id); - } else { - Navigator.of(context) - .pushNamed('/router/write_off_page', arguments: {}); - } + // if (exchangeOrder.state == 1) { + // receive2Card(exchangeOrder.id); + // } else { + // Navigator.of(context) + // .pushNamed('/router/write_off_page', arguments: {}); + // } + Navigator.of(context).pushNamed( + '/router/exchange_write_offPage', + arguments: { + "exchangeOrder": exchangeOrder.toJson(), + }); }, child: buildBtnStatus(exchangeOrder.state), + ): + GestureDetector( + onTap: () { + setState(() { + // Navigator.of(context).pushNamed( + // '/router/logistics_information_page', + // arguments: { + // "logisticsNum": orderInfo.logisticsNum, + // "logisticsName": orderInfo.logisticsName, + // "shipperCode": orderInfo.shipperCode, + // "productNum": orderInfo.productList.length, + // "skuImg": orderInfo.productList.length > 0 + // ? orderInfo.productList[0].skuImg + // : "" + // }); + }); + }, + child: buildBtnStatusTow(exchangeOrder.state), ), ], ) @@ -461,7 +519,30 @@ class _ExchangeHistoryList extends State { if (state == 1) { return RoundButton( padding: EdgeInsets.fromLTRB(8, 4, 8, 4), - text: S.of(context).lingqudaokabao, + text: S.of(context).chakanhexiaoma, + textColor: Colors.white, + fontSize: 12, + backgroup: Color(0xFF32A060), + radius: 2, + ); + } else { + return Container(); + // return BorderText( + // text: S.of(context).shanchudingdan, + // textColor: Color(0xFF32A060), + // borderWidth: 1, + // borderColor: Color(0xFF32A060), + // fontSize: 12, + // padding: EdgeInsets.fromLTRB(14, 4, 14, 4), + // ); + } + } + + Widget buildBtnStatusTow(state) { + if (state == 1) { + return RoundButton( + padding: EdgeInsets.fromLTRB(8, 4, 8, 4), + text: S.of(context).chakanwuliu, textColor: Colors.white, fontSize: 12, backgroup: Color(0xFF32A060), diff --git a/lib/order/exchange_order_page.dart b/lib/order/exchange_order_page.dart index 8d476471..73d875eb 100644 --- a/lib/order/exchange_order_page.dart +++ b/lib/order/exchange_order_page.dart @@ -227,6 +227,85 @@ class _ExchangeOrderPage extends State { ], ), ): + // Container( + // margin: + // EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8), + // padding: EdgeInsets.all(20), + // decoration: BoxDecoration( + // color: Colors.white, + // boxShadow: [ + // BoxShadow( + // color: Colors.black.withAlpha(12), + // offset: Offset(0, 3), + // blurRadius: 14, + // spreadRadius: 0, + // ) + // ], + // borderRadius: BorderRadius.all(Radius.circular(8)), + // ), + // child: Column( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Row( + // children: [ + // Image.asset( + // "assets/image/icon_order_exchange_info.png", + // width: 24, + // height: 24, + // ), + // SizedBox(width: 4), + // Text( + // S.of(context).duihuanxinxi, + // style: TextStyle( + // fontWeight: FontWeight.bold, + // fontSize: 16, + // color: Color(0xFF353535)), + // ), + // ], + // ), + // SizedBox( + // height: 18.h, + // ), + // Row( + // children: [ + // Text( + // S.of(context).lingqufangshi, + // style: TextStyle( + // fontSize: 14.sp, + // color: Color(0xFF353535), + // ), + // ), + // SizedBox( + // width: 12.w, + // ), + // Text( + // widget.arguments["useTyped"] == 1 + // ? S.of(context).ziti + // : widget.arguments["useTyped"] == 2 + // ? S.of(context).peisong + // : S.of(context).xianshangfafang, + // style: TextStyle( + // fontSize: 14.sp, + // color: Color(0xFF353535), + // ), + // ), + // ], + // ), + // SizedBox( + // height: 12.h, + // ), + // Text( + // "非实物商品兑换后领取到卡包即可使用!", + // style: TextStyle( + // fontSize: 14.sp, + // color: Color(0xFF32A060), + // fontWeight: MyFontWeight.medium + // ), + // ), + // ], + // ), + // ), Container( margin: EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8), @@ -244,8 +323,6 @@ class _ExchangeOrderPage extends State { borderRadius: BorderRadius.all(Radius.circular(8)), ), child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ @@ -292,16 +369,71 @@ class _ExchangeOrderPage extends State { ), ], ), - SizedBox( - height: 12.h, + Visibility( + child: SizedBox( + height: 13.h, + ), + visible: widget.arguments["useTyped"] != 3, ), - Text( - "非实物商品兑换后领取到卡包即可使用!", - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF32A060), - fontWeight: MyFontWeight.medium + Visibility( + child: Row( + children: [ + Text( + "收货地址", + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF353535), + ), + ), + SizedBox( + width: 12.w, + ), + Expanded( + child: GestureDetector( + onTap: () { + toAddressPicker(); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + child: Text( + (address != null && address != "") + ? address + : widget.arguments["useTyped"] == 1 + ? S.of(context).qingxuanzhemendian + : widget.arguments["useTyped"] == + 2 + ? S + .of(context) + .qingxuanzeshouhuodizhi + : S.of(context).xuni, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF32A060), + ), + ), + flex: 1, + ), + Icon( + Icons.keyboard_arrow_right, + size: 16, + color: Color(0xFF32A060), + ), + ], + ), + ), + flex: 1, + ), + ], ), + visible: widget.arguments["useTyped"] != 3, + ), + SizedBox( + height: 12.h, ), ], ), diff --git a/lib/order/exchange_write_off_page.dart b/lib/order/exchange_write_off_page.dart new file mode 100644 index 00000000..baccb983 --- /dev/null +++ b/lib/order/exchange_write_off_page.dart @@ -0,0 +1,290 @@ +import 'package:barcode_widget/barcode_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/retrofit/data/exchange_order.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:huixiang/view_widget/separator.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:qr_flutter/qr_flutter.dart'; + +class ExchangeWriteOffPage extends StatefulWidget { + final arguments; + + ExchangeWriteOffPage({this.arguments}); + + @override + State createState() { + return _ExchangeWriteOffPage(); + } +} + +class _ExchangeWriteOffPage extends State { + ExchangeOrder exchangeOrder; + + @override + void initState() { + super.initState(); + + exchangeOrder = ExchangeOrder.fromJson(widget.arguments["exchangeOrder"]); + if (mounted) setState(() {}); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Color(0xFF32A060), + appBar: MyAppBar( + title: S.of(context).hexiaomaxiangqing, + titleSize: 18.sp, + titleColor: Colors.white, + background: Color(0xFF32A060), + leadingColor: Colors.white, + ), + body: Container( + alignment: Alignment.topCenter, + child: Stack( + alignment: Alignment.topCenter, + children: [ + Image.asset( + "assets/image/icon_write_off_bg.png", + width: MediaQuery.of(context).size.width * 0.912, + fit: BoxFit.fill, + ), + LayoutBuilder(builder: (context, constraints) { + return Container( + width: constraints.constrainWidth() * 0.912, + child: Column( + children: [ + Expanded( + child: Container( + child: Column( + children: [ + Text( + exchangeOrder != null ? exchangeOrder.creditOrderDetailList[0].name : "", + style: TextStyle( + fontSize: 16.sp, + fontWeight: FontWeight.bold, + color: Color(0xFF353535)), + ), + SizedBox( + height: 8.h, + ), + Text( + (exchangeOrder.updateTime == null) ? "" : S.of(context).youxiaoqi( + "${exchangeOrder.updateTime}"), + style: TextStyle( + fontSize: 12.sp, + color: Color(0xFF353535), + ), + ), + ], + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + ), + alignment: Alignment.center, + ), + flex: 6, + ), + Container( + margin: EdgeInsets.only(left: 20.w, right: 20.w), + child: MySeparator( + width: 5.w, + height: 1.h, + color: Color(0xFFA29E9E), + ), + ), + Expanded( + child: Container( + alignment: Alignment.center, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + exchangeOrder != null + ? "${exchangeOrder.id.substring(0, 4)} " + "${exchangeOrder.id.substring(4, 8)} " + "${exchangeOrder.id.substring(8, 12)} " + "${exchangeOrder.id.substring(12, 16)} " + "${exchangeOrder.id.substring(16, exchangeOrder.id.length)}" + : "", + style: TextStyle( + fontSize: 14.sp, + wordSpacing: exchangeOrder == null + ? 10 + : (MediaQuery.of(context).size.width - + 64.w) / + (((exchangeOrder.id.length) * 4)), + letterSpacing: exchangeOrder == null + ? 8 + : (MediaQuery.of(context).size.width - + 64.w) / + (((exchangeOrder.id.length) * 4)), + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF353535), + ), + ), + SizedBox( + height: 12.h, + ), + BarcodeWidget( + barcode: Barcode.code128(useCode128C: true), + data: exchangeOrder != null ? exchangeOrder.id : "", + height: 72.h, + color: Colors.black, + drawText: false, + ), + SizedBox( + height: 16.h, + ), + Expanded(child: QrImage( + data: exchangeOrder != null ? exchangeOrder.id : "", + version: QrVersions.auto, + size: 200.w, + gapless: true, + ),), + SizedBox( + height: 35.h, + ), + ], + ), + margin: EdgeInsets.symmetric(horizontal: 20.w), + ), + flex: 27, + ), + Container( + child: MySeparator( + width: 5.w, + height: 1.h, + color: Color(0xFFA29E9E), + ), + margin: EdgeInsets.only(left: 20.w, right: 20.w), + ), + Expanded( + child: Container( + padding: EdgeInsets.fromLTRB(20.w, 15.h, 20.w, 24.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: 3.w, + height: 15.h, + margin: + EdgeInsets.fromLTRB(4.w, 7.h, 4.w, 7.h), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(3), + color: Color(0xFF20662A), + ), + ), + Text( + S.of(context).shiyongtiaojian, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 14.sp, + color: Color(0xFF353535), + ), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + width: 11.w, + ), + Expanded( + child: Text( + S + .of(context) + .qianwanghuixiangmendianduihuanhexiao, + style: TextStyle( + textBaseline: TextBaseline.alphabetic, + fontSize: 14.sp, + color: Color(0xFF353535)), + ), + flex: 1, + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: 3.w, + height: 15.h, + margin: EdgeInsets.fromLTRB(4, 7, 4, 7), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(3), + color: Color(0xFF20662A), + ), + ), + Text( + S.of(context).shiyongshuoming, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 14.sp, + color: Color(0xFF353535)), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + width: 11.w, + ), + Text( + S.of(context).zitiduihuanquan, + style: TextStyle( + textBaseline: TextBaseline.alphabetic, + fontSize: 14.sp, + color: Color(0xFF353535), + ), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + width: 11.w, + ), + Text( + S.of(context).huixiangrenyimendian, + style: TextStyle( + textBaseline: TextBaseline.alphabetic, + fontSize: 14.sp, + color: Color(0xFF353535), + ), + ), + ], + ), + ], + ), + ), + flex: 13, + ), + Expanded( + child: Container(), + flex: 3, + ), + ], + ), + ); + }) + ], + ), + ), + ); + } +} diff --git a/lib/order/write_off_page.dart b/lib/order/write_off_page.dart index 2f8428fb..6325dcb3 100644 --- a/lib/order/write_off_page.dart +++ b/lib/order/write_off_page.dart @@ -138,12 +138,12 @@ class _WriteOffPage extends State { SizedBox( height: 16.h, ), - QrImage( + Expanded(child: QrImage( data: coupon != null ? coupon.id : "", version: QrVersions.auto, size: 200.w, gapless: true, - ), + ),), SizedBox( height: 35.h, ), diff --git a/lib/retrofit/data/achievement_detail_list.dart b/lib/retrofit/data/achievement_detail_list.dart new file mode 100644 index 00000000..82b93ff0 --- /dev/null +++ b/lib/retrofit/data/achievement_detail_list.dart @@ -0,0 +1,191 @@ +/// id : "1460450874352310812" +/// createTime : "2021-11-12 11:42:08" +/// createUser : "123" +/// updateTime : "2021-11-17 17:49:17" +/// updateUser : "1" +/// categoryId : "1460164746211753984" +/// name : "青铜" +/// level : 0 +/// icon : "https://pos.upload.gznl.top/admin/2021/11/a83f895b-8159-455e-a54d-ac67068b28b7.jpg" +/// score : 10 +/// actived : true +/// sort : 0 +/// isDelete : 0 +/// lessScore : 0 +/// get : true +/// max : false + +class AchievementDetailList { + AchievementDetailList({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String categoryId, + String name, + int level, + String icon, + int score, + bool actived, + int sort, + int isDelete, + int lessScore, + bool get, + bool max,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _categoryId = categoryId; + _name = name; + _level = level; + _icon = icon; + _score = score; + _actived = actived; + _sort = sort; + _isDelete = isDelete; + _lessScore = lessScore; + _get = get; + _max = max; +} + + AchievementDetailList.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _categoryId = json['categoryId']; + _name = json['name']; + _level = json['level']; + _icon = json['icon']; + _score = json['score']; + _actived = json['actived']; + _sort = json['sort']; + _isDelete = json['isDelete']; + _lessScore = json['lessScore']; + _get = json['get']; + _max = json['max']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _categoryId; + String _name; + int _level; + String _icon; + int _score; + bool _actived; + int _sort; + int _isDelete; + int _lessScore; + bool _get; + bool _max; + + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get categoryId => _categoryId; + String get name => _name; + int get level => _level; + String get icon => _icon; + int get score => _score; + bool get actived => _actived; + int get sort => _sort; + int get isDelete => _isDelete; + int get lessScore => _lessScore; + bool get get => _get; + bool get max => _max; + + + set id(String value) { + _id = value; + } + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['categoryId'] = _categoryId; + map['name'] = _name; + map['level'] = _level; + map['icon'] = _icon; + map['score'] = _score; + map['actived'] = _actived; + map['sort'] = _sort; + map['isDelete'] = _isDelete; + map['lessScore'] = _lessScore; + map['get'] = _get; + map['max'] = _max; + return map; + } + + set createTime(String value) { + _createTime = value; + } + + set createUser(String value) { + _createUser = value; + } + + set updateTime(String value) { + _updateTime = value; + } + + set updateUser(String value) { + _updateUser = value; + } + + set categoryId(String value) { + _categoryId = value; + } + + set name(String value) { + _name = value; + } + + set level(int value) { + _level = value; + } + + set icon(String value) { + _icon = value; + } + + set score(int value) { + _score = value; + } + + set actived(bool value) { + _actived = value; + } + + set sort(int value) { + _sort = value; + } + + set isDelete(int value) { + _isDelete = value; + } + + set lessScore(int value) { + _lessScore = value; + } + + set get(bool value) { + _get = value; + } + + set max(bool value) { + _max = value; + } +} \ No newline at end of file diff --git a/lib/retrofit/data/exchange_order.dart b/lib/retrofit/data/exchange_order.dart index cd9fafe4..9204c407 100644 --- a/lib/retrofit/data/exchange_order.dart +++ b/lib/retrofit/data/exchange_order.dart @@ -12,7 +12,11 @@ class ExchangeOrder { String mid; String orderCode; String amount; + String money; + int payStatus; + int sendStatus; String address; + String recAddress; int state; int useTyped; int isDelete; @@ -28,7 +32,11 @@ class ExchangeOrder { ..mid = json['mid'] as String ..orderCode = json['orderCode'] as String ..amount = json['amount'] as String + ..money = json['money'] as String + ..payStatus = json['payStatus'] as int + ..sendStatus = json['sendStatus'] as int ..address = json['address'] as String + ..recAddress = json['recAddress'] as String ..state = json['state'] as int ..useTyped = json['useTyped'] as int ..isDelete = json['isDelete'] as int @@ -48,7 +56,11 @@ class ExchangeOrder { 'mid': this.mid, 'orderCode': this.orderCode, 'amount': this.amount, + 'money': this.money, + 'payStatus': this.payStatus, + 'sendStatus': this.sendStatus, 'address': this.address, + 'recAddress': this.recAddress, 'state': this.state, 'useTyped': this.useTyped, 'isDelete': this.isDelete, diff --git a/lib/retrofit/data/second_card_list.dart b/lib/retrofit/data/second_card_list.dart new file mode 100644 index 00000000..7bdc5682 --- /dev/null +++ b/lib/retrofit/data/second_card_list.dart @@ -0,0 +1,73 @@ +/// id : "1438426197401796608" +/// phone : "18672306891" +/// nickname : "冬天的秘密" +/// headimg : "" + +class SecondCardList { + SecondCardList({ + String id, + String phone, + String nickname, + String headimg, + bool isAdd, + }) { + _id = id; + _phone = phone; + _nickname = nickname; + _headimg = headimg; + _isAdd = isAdd; + } + + SecondCardList.fromJson(dynamic json) { + _id = json['id']; + _phone = json['phone']; + _nickname = json['nickname']; + _headimg = json['headimg']; + } + + String _id; + String _phone; + String _nickname; + String _headimg; + bool _isAdd; + + String get id => _id; + + String get phone => _phone; + + String get nickname => _nickname; + + String get headimg => _headimg; + + bool get isAdd => _isAdd; + + set id(String value) { + _id = value; + } + + Map toJson() { + final map = {}; + map['id'] = _id; + map['phone'] = _phone; + map['nickname'] = _nickname; + map['headimg'] = _headimg; + return map; + } + + set phone(String value) { + _phone = value; + } + + set nickname(String value) { + _nickname = value; + } + + set headimg(String value) { + _headimg = value; + } + + set isAdd(bool value) { + _isAdd = value; + } + +} diff --git a/lib/retrofit/data/vip_badges_list.dart b/lib/retrofit/data/vip_badges_list.dart new file mode 100644 index 00000000..56cc0c32 --- /dev/null +++ b/lib/retrofit/data/vip_badges_list.dart @@ -0,0 +1,147 @@ +/// id : "1460164746211753984" +/// createTime : "2021-11-15 16:36:19" +/// createUser : "1" +/// updateTime : "2021-11-17 11:39:54" +/// updateUser : "1" +/// name : "签到" +/// eachReward : 8 +/// code : "SIGN" +/// icon : "https://pos.upload.gznl.top/admin/2021/11/93853f8d-ca0e-4c75-855b-d6245e4f6743.jpg" +/// actived : true +/// sort : 0 +/// isDelete : 0 + +class VipBadgesList { + VipBadgesList({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String name, + int eachReward, + String code, + String icon, + bool actived, + int sort, + int isDelete,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _name = name; + _eachReward = eachReward; + _code = code; + _icon = icon; + _actived = actived; + _sort = sort; + _isDelete = isDelete; +} + + VipBadgesList.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _name = json['name']; + _eachReward = json['eachReward']; + _code = json['code']; + _icon = json['icon']; + _actived = json['actived']; + _sort = json['sort']; + _isDelete = json['isDelete']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _name; + int _eachReward; + String _code; + String _icon; + bool _actived; + int _sort; + int _isDelete; + + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get name => _name; + int get eachReward => _eachReward; + String get code => _code; + String get icon => _icon; + bool get actived => _actived; + int get sort => _sort; + int get isDelete => _isDelete; + + + set id(String value) { + _id = value; + } + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['name'] = _name; + map['eachReward'] = _eachReward; + map['code'] = _code; + map['icon'] = _icon; + map['actived'] = _actived; + map['sort'] = _sort; + map['isDelete'] = _isDelete; + return map; + } + + set createTime(String value) { + _createTime = value; + } + + set createUser(String value) { + _createUser = value; + } + + set updateTime(String value) { + _updateTime = value; + } + + set updateUser(String value) { + _updateUser = value; + } + + set name(String value) { + _name = value; + } + + set eachReward(int value) { + _eachReward = value; + } + + set code(String value) { + _code = value; + } + + set icon(String value) { + _icon = value; + } + + set actived(bool value) { + _actived = value; + } + + set sort(int value) { + _sort = value; + } + + set isDelete(int value) { + _isDelete = value; + } +} \ No newline at end of file diff --git a/lib/retrofit/data/vip_benefit_list.dart b/lib/retrofit/data/vip_benefit_list.dart new file mode 100644 index 00000000..647d607b --- /dev/null +++ b/lib/retrofit/data/vip_benefit_list.dart @@ -0,0 +1,180 @@ +/// id : "5" +/// createTime : "2021-11-18 14:11:34" +/// createUser : "1" +/// updateTime : "2021-11-18 17:10:24" +/// updateUser : "1" +/// code : "DEPUTY" +/// name : "副卡" +/// icon : "https://pos.upload.gznl.top/MDAwMA==/2021/11/fb1e46d2-6213-4164-abbc-9aa24da24faf.png" +/// iconGrey : "https://pos.upload.gznl.top/MDAwMA==/2021/11/f50d211a-3d52-4663-bf8a-c4dff4f79310.png" +/// introduce : "可绑定副卡" +/// describes : "可绑定副卡" +/// actived : true +/// sort : 4 +/// isDelete : 0 +/// have : false + +class VipBenefitList { + VipBenefitList({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String code, + String name, + String icon, + String iconGrey, + String introduce, + String describes, + bool actived, + int sort, + int isDelete, + bool have,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _code = code; + _name = name; + _icon = icon; + _iconGrey = iconGrey; + _introduce = introduce; + _describes = describes; + _actived = actived; + _sort = sort; + _isDelete = isDelete; + _have = have; +} + + VipBenefitList.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _code = json['code']; + _name = json['name']; + _icon = json['icon']; + _iconGrey = json['iconGrey']; + _introduce = json['introduce']; + _describes = json['describes']; + _actived = json['actived']; + _sort = json['sort']; + _isDelete = json['isDelete']; + _have = json['have']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _code; + String _name; + String _icon; + String _iconGrey; + String _introduce; + String _describes; + bool _actived; + int _sort; + int _isDelete; + bool _have; + + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get code => _code; + String get name => _name; + String get icon => _icon; + String get iconGrey => _iconGrey; + String get introduce => _introduce; + String get describes => _describes; + bool get actived => _actived; + int get sort => _sort; + int get isDelete => _isDelete; + bool get have => _have; + + + set id(String value) { + _id = value; + } + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['code'] = _code; + map['name'] = _name; + map['icon'] = _icon; + map['iconGrey'] = _iconGrey; + map['introduce'] = _introduce; + map['describes'] = _describes; + map['actived'] = _actived; + map['sort'] = _sort; + map['isDelete'] = _isDelete; + map['have'] = _have; + return map; + } + + set createTime(String value) { + _createTime = value; + } + + set createUser(String value) { + _createUser = value; + } + + set updateTime(String value) { + _updateTime = value; + } + + set updateUser(String value) { + _updateUser = value; + } + + set code(String value) { + _code = value; + } + + set name(String value) { + _name = value; + } + + set icon(String value) { + _icon = value; + } + + set iconGrey(String value) { + _iconGrey = value; + } + + set introduce(String value) { + _introduce = value; + } + + set describes(String value) { + _describes = value; + } + + set actived(bool value) { + _actived = value; + } + + set sort(int value) { + _sort = value; + } + + set isDelete(int value) { + _isDelete = value; + } + + set have(bool value) { + _have = value; + } +} \ No newline at end of file diff --git a/lib/retrofit/data/vip_rule_details.dart b/lib/retrofit/data/vip_rule_details.dart new file mode 100644 index 00000000..fce890ad --- /dev/null +++ b/lib/retrofit/data/vip_rule_details.dart @@ -0,0 +1,48 @@ +/// rule : "" +/// contrast : "" +/// qa : "" + +class VipRuleDetails { + VipRuleDetails({ + String rule, + String contrast, + String qa,}){ + _rule = rule; + _contrast = contrast; + _qa = qa; +} + + VipRuleDetails.fromJson(dynamic json) { + _rule = json['rule']; + _contrast = json['contrast']; + _qa = json['qa']; + } + String _rule; + String _contrast; + String _qa; + + String get rule => _rule; + String get contrast => _contrast; + String get qa => _qa; + + + set rule(String value) { + _rule = value; + } + + Map toJson() { + final map = {}; + map['rule'] = _rule; + map['contrast'] = _contrast; + map['qa'] = _qa; + return map; + } + + set contrast(String value) { + _contrast = value; + } + + set qa(String value) { + _qa = value; + } +} \ No newline at end of file diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 980493d7..7dff74f1 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -17,6 +17,7 @@ import 'package:huixiang/retrofit/data/order_info.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart'; import 'package:retrofit/retrofit.dart'; +import 'data/achievement_detail_list.dart'; import 'data/address.dart'; import 'data/banner.dart'; import 'data/brand_data.dart'; @@ -34,13 +35,17 @@ import 'data/member_comment_list.dart'; import 'data/message.dart'; import 'data/page.dart'; import 'data/rank.dart'; +import 'data/second_card_list.dart'; import 'data/sign_info.dart'; import 'data/social_info.dart'; import 'data/store.dart'; import 'data/upload_result.dart'; import 'data/user_bill.dart'; import 'data/user_info.dart'; +import 'data/vip_badges_list.dart'; +import 'data/vip_benefit_list.dart'; import 'data/vip_card.dart'; +import 'data/vip_rule_details.dart'; import 'data/wx_pay.dart'; part 'retrofit_api.g.dart'; @@ -426,4 +431,32 @@ abstract class ApiService { @GET("/course/likes/{courseId}") Future courseLikes(@Path("courseId") String courseId); + /// APP查询所有成就徽章 并显示会员完成的 + @POST("/app-memberAchievement/findBadges") + Future>> findBadges(@Body() Map map); + + ///查看一个成就大类详情 + @GET("/app-memberAchievement/getAchievementDetail?achievementCategoryId={achievementCategoryId}") + Future>> getAchievementDetail(@Path("achievementCategoryId") String achievementCategoryId); + + ///会员的权益列表 + @GET("/member/benefitList") + Future>> benefitList(); + + ///会员权益 + @GET("/home/vipBenefit") + Future> vipBenefit(); + + ///查询副卡列表 + @GET("/member/secondCardList") + Future>> secondCardList(); + + ///绑定副卡 + @GET("/member/bindSecondCard/{phone}") + Future bindSecondCard(@Path("phone") String phone); + + ///绑定副卡 + @GET("/member/unbindSecondCard/{phone}") + Future unbindSecondCard(@Path("phone") String phone); + } diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index c859fde0..99355c13 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -1531,4 +1531,161 @@ class _ApiService implements ApiService { return value; } + @override + Future>> findBadges(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('/app-memberAchievement/findBadges', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => (json as List) + .map((i) => VipBadgesList.fromJson(i as Map)) + .toList()); + return value; + } + + @override + Future>> getAchievementDetail(achievementCategoryId) async { + ArgumentError.checkNotNull(achievementCategoryId, 'achievementCategoryId'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/app-memberAchievement/getAchievementDetail?achievementCategoryId=$achievementCategoryId', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => (json as List) + .map((i) => AchievementDetailList.fromJson(i as Map)) + .toList()); + return value; + } + + + @override + Future>> benefitList() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/member/benefitList', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => (json as List) + .map((i) => VipBenefitList.fromJson(i as Map)) + .toList()); + return value; + } + + @override + Future> vipBenefit() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/home/vipBenefit', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => VipRuleDetails.fromJson(json), + ); + return value; + } + + + @override + Future>> secondCardList() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/member/secondCardList', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => (json as List) + .map((i) => SecondCardList.fromJson(i as Map)) + .toList()); + return value; + } + + @override + Future> bindSecondCard(phone) async { + ArgumentError.checkNotNull(phone, 'phone'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/member/bindSecondCard/$phone', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json as dynamic, + ); + return value; + } + + @override + Future> unbindSecondCard(phone) async { + ArgumentError.checkNotNull(phone, 'phone'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/member/unbindSecondCard/$phone', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json as dynamic, + ); + return value; + } + } diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index b6b58490..88857ccd 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -243,7 +243,7 @@ class _StoreOrderPage extends State child: Container( alignment: Alignment.centerRight, margin: EdgeInsets.only(left: 10), - padding: EdgeInsets.all(6), + padding: EdgeInsets.all(10), child: Icon( Icons.arrow_back_ios, color: Colors.black, @@ -254,8 +254,7 @@ class _StoreOrderPage extends State flexibleSpace: FlexibleSpaceBar( title: Title( controller, - storeInfo != null ? storeInfo.storeName : '', - ), + storeInfo != null ? storeInfo.storeName : ''), collapseMode: CollapseMode.pin, stretchModes: [ StretchMode.zoomBackground, diff --git a/lib/view_widget/mine_vip_view.dart b/lib/view_widget/mine_vip_view.dart index a2c69e2f..cba749ac 100644 --- a/lib/view_widget/mine_vip_view.dart +++ b/lib/view_widget/mine_vip_view.dart @@ -122,7 +122,7 @@ class MineVipView extends StatelessWidget { : EdgeInsets.fromLTRB(padding.w, 16.h, padding.w, 0), width: MediaQuery.of(context).size.width - 32.w, height: ((MediaQuery.of(context).size.width - 32.w) / - (isUserVip ? 1.88 : 2.3) * + (isUserVip ? 1.88 : 1.90) * AppUtils.textScale(context)), decoration: BoxDecoration( gradient: LinearGradient( @@ -267,28 +267,28 @@ class MineVipView extends StatelessWidget { ), ), // if (isUserVip) - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - S.of(context).kaitongriqi( - (createTime != null && createTime != "") - ? createTime.split(" ")[0] - : "$createTime"), - style: TextStyle( - color: textColor, - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, - ), - ), - Icon( - Icons.qr_code, - size: 24, - color:textColor, + Expanded(child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + S.of(context).kaitongriqi( + (createTime != null && createTime != "") + ? createTime.split(" ")[0] + : "$createTime"), + style: TextStyle( + color: textColor, + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, ), - ], - ), + ), + Icon( + Icons.qr_code, + size: 24, + color:textColor, + ), + ], + ),), ], ), ), diff --git a/lib/view_widget/vip_dialog.dart b/lib/view_widget/vip_dialog.dart index d7b2c959..7bf6c27a 100644 --- a/lib/view_widget/vip_dialog.dart +++ b/lib/view_widget/vip_dialog.dart @@ -4,6 +4,8 @@ import 'package:huixiang/utils/font_weight.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class VipDialog extends StatelessWidget { + int listCount = 9; + @override Widget build(BuildContext context) { return SimpleDialog( @@ -22,9 +24,7 @@ class VipDialog extends StatelessWidget { decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(8),), - child:SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Column( + child:Column( children: [ Container( alignment: Alignment.center, @@ -46,51 +46,49 @@ class VipDialog extends StatelessWidget { ), ), ), + Padding( + padding: EdgeInsets.only(top:16.h, bottom: 19.h), + child: Text( + S.of(context).huodequanyi, + style: TextStyle( + color: Colors.black, + fontSize: 14.sp, + fontWeight:MyFontWeight.medium, + ), + ), + ), + Container( + width: MediaQuery.of(context).size.width, + height: (((listCount~/3+(listCount%3>0?1:0))*90.h) > + MediaQuery.of(context).size.height/2 ? + MediaQuery.of(context).size.height/2 : + ((listCount~/3+(listCount%3>0?1:0))*90.h)).toDouble(),child:vipUpgrade()), Container( - child: Column( - children: [ - Padding( - padding: EdgeInsets.only(top:16.h, bottom: 19.h), - child: Text( - S.of(context).huodequanyi, - style: TextStyle( - color: Colors.black, - fontSize: 14.sp, - fontWeight:MyFontWeight.medium, - ), - ), - ), - // vipUpgrade(), - Container( - margin: EdgeInsets.only(left: 32,right: 32,bottom: 20), - decoration: BoxDecoration( - gradient: new LinearGradient( - begin: Alignment.centerLeft, - end: Alignment.centerRight, - colors: [ - Color(0xFFFFDCA1), - Color(0xFFFAE4C0), - ]), - borderRadius: BorderRadius.circular(22.5), - ), - width: MediaQuery.of(context).size.width, - height: 40, - alignment: Alignment.center, - child: Text( - S.of(context).chakanquanyi, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16.sp, - color: Color(0xFF4A4748), - ), - ), - ), - ], + margin: EdgeInsets.only(left: 32,right: 32,bottom: 20), + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + colors: [ + Color(0xFFFFDCA1), + Color(0xFFFAE4C0), + ]), + borderRadius: BorderRadius.circular(22.5), + ), + width: MediaQuery.of(context).size.width, + height: 40, + alignment: Alignment.center, + child: Text( + S.of(context).chakanquanyi, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16.sp, + color: Color(0xFF4A4748), + ), ), ), ], ), - ), ), Image.asset( "assets/image/vip_yk.png", @@ -107,22 +105,22 @@ class VipDialog extends StatelessWidget { ///会员升级权益列表 Widget vipUpgrade() { return GridView.builder( - itemCount:9, + itemCount:listCount, shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), + physics: BouncingScrollPhysics(), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( //一行的Widget数量 crossAxisCount:3, //水平子Widget之间间距 - crossAxisSpacing:10, + crossAxisSpacing:0, //垂直子Widget之间间距 - mainAxisSpacing: 10, + mainAxisSpacing: 0, + childAspectRatio: 1.5, ), itemBuilder: (context, index) { return GestureDetector( onTap: () { - Navigator.of(context) - .pushNamed('/router/legal_right_details', arguments: {}); + // Navigator.of(context).pushNamed('/router/legal_right_details', arguments: {}); }, child: vipUpgradeItem(), );