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 1/4] =?UTF-8?q?=E7=A7=AF=E5=88=86=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E6=9B=B4=E6=94=B9,=E4=BC=9A=E5=91=98=E4=BD=93=E7=B3=BB?= =?UTF-8?q?=E6=9B=B4=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(), ); From 2366783edb4e9b14e76bd59f8d084f11ec321c80 Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Thu, 25 Nov 2021 18:13:41 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E7=A7=AF=E5=88=86=E5=95=86=E5=9F=8E:?= =?UTF-8?q?=E5=85=91=E6=8D=A2=E5=90=8E=E6=89=A3=E9=99=A4=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E9=87=91=E9=A2=9D,=20=E5=85=85=E5=80=BC?= =?UTF-8?q?=E6=9B=B4=E6=94=B9;=20=E4=BC=9A=E5=91=98=E8=B4=AD=E4=B9=B0?= =?UTF-8?q?=E6=9B=B4=E6=94=B9;=20=E8=AE=A2=E5=8D=95=E6=80=8E=E5=8A=A0?= =?UTF-8?q?=E4=BC=9A=E5=91=98=E4=BC=98=E6=83=A0=E9=87=91=E9=A2=9D;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/community/community_details.dart | 6 +- lib/generated/intl/messages_en.dart | 1 + lib/generated/intl/messages_zh_CN.dart | 1 + lib/generated/intl/messages_zh_Hans_CN.dart | 1 + lib/generated/intl/messages_zh_Hant_CN.dart | 1 + lib/generated/intl/messages_zh_TW.dart | 1 + lib/generated/l10n.dart | 10 + lib/integral/intergra_view/integral_vip.dart | 2 +- lib/l10n/intl_en.arb | 1 + lib/l10n/intl_zh_CN.arb | 1 + lib/l10n/intl_zh_Hans_CN.arb | 1 + lib/l10n/intl_zh_Hant_CN.arb | 1 + lib/l10n/intl_zh_TW.arb | 1 + lib/mine/mine_page.dart | 17 +- lib/mine/mine_view/community_follow.dart | 2 +- lib/mine/mine_vip/legal_right_details.dart | 82 +++- lib/mine/mine_vip/mine_attainment_page.dart | 51 ++- lib/mine/mine_vip/mine_vip_core.dart | 104 ++++- lib/mine/recharge_page.dart | 376 ++++++++++++------ lib/order/exchange_history_page.dart | 20 +- lib/order/exchange_order_page.dart | 34 +- lib/order/exchange_order_success_page.dart | 2 +- lib/order/logistics_information_page.dart | 59 ++- lib/retrofit/data/goods.dart | 6 + lib/retrofit/data/rank.dart | 10 +- lib/retrofit/data/settleOrderInfo.dart | 3 + lib/retrofit/data/social_info.dart | 12 +- lib/retrofit/data/user_info.dart | 9 + lib/retrofit/data/vip_benefit_list.dart | 79 +--- lib/retrofit/data/vip_rule_details.dart | 11 +- lib/retrofit/retrofit_api.dart | 26 +- lib/retrofit/retrofit_api.g.dart | 54 ++- lib/settlement/settlement.dart | 2 +- .../activity_coupon_remarks.dart | 156 +++++--- lib/utils/flutter_utils.dart | 6 + lib/view_widget/badge_attainment_dialog.dart | 104 +++++ lib/view_widget/cupertino_date_picker.dart | 4 +- lib/view_widget/item_input_widget.dart | 72 +++- lib/view_widget/mine_vip_view.dart | 8 +- lib/view_widget/vip_dialog.dart | 283 ++++++++----- 40 files changed, 1141 insertions(+), 479 deletions(-) create mode 100644 lib/view_widget/badge_attainment_dialog.dart diff --git a/lib/community/community_details.dart b/lib/community/community_details.dart index 59ddd16b..776df1fa 100644 --- a/lib/community/community_details.dart +++ b/lib/community/community_details.dart @@ -205,13 +205,13 @@ class _CommunityDetails extends State with WidgetsBindingObser } } - ///发布评论 + ///动态发布评论 _queryMemberComment(String content) async { BaseData baseData = await apiService.memberComment({ "content": content, "parentId": parenId, "relationalId": comunity.id, - "relationalType": 1 + "relationalType":4 }).catchError((error) {}); if (baseData != null && baseData.isSuccess) { CommentListState state = commentKey.currentState; @@ -296,7 +296,7 @@ class _CommunityDetails extends State with WidgetsBindingObser "pageNum": 1, "pageSize": 100, "relationalId": comunity.id, - "relationalType": 1, + "relationalType":1, }).catchError((error) {}); if (baseData != null && baseData.isSuccess) { commentTotal = baseData.data.size; diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart index a7284b8e..ef4445db 100644 --- a/lib/generated/intl/messages_en.dart +++ b/lib/generated/intl/messages_en.dart @@ -158,6 +158,7 @@ class MessageLookup extends MessageLookupByLibrary { "dangqiandengji" : MessageLookupByLibrary.simpleMessage("当前等级"), "dangqianjifen" : MessageLookupByLibrary.simpleMessage("当前积分:"), "dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("当前商品兑换核销码已核销完成"), + "dangqianzhukadengji" : MessageLookupByLibrary.simpleMessage("当前主卡等级"), "daodianziqu" : MessageLookupByLibrary.simpleMessage("到店自取"), "daopinglunliebiaodingbu" : MessageLookupByLibrary.simpleMessage("到评论列表顶部"), "daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等级"), diff --git a/lib/generated/intl/messages_zh_CN.dart b/lib/generated/intl/messages_zh_CN.dart index 0cc8ce8b..86c7b3f9 100644 --- a/lib/generated/intl/messages_zh_CN.dart +++ b/lib/generated/intl/messages_zh_CN.dart @@ -158,6 +158,7 @@ class MessageLookup extends MessageLookupByLibrary { "dangqiandengji" : MessageLookupByLibrary.simpleMessage("当前等级"), "dangqianjifen" : MessageLookupByLibrary.simpleMessage("当前积分:"), "dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("当前商品兑换核销码已核销完成"), + "dangqianzhukadengji" : MessageLookupByLibrary.simpleMessage("当前主卡等级"), "daodianziqu" : MessageLookupByLibrary.simpleMessage("到店自取"), "daopinglunliebiaodingbu" : MessageLookupByLibrary.simpleMessage("到评论列表顶部"), "daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等级"), diff --git a/lib/generated/intl/messages_zh_Hans_CN.dart b/lib/generated/intl/messages_zh_Hans_CN.dart index 745a1513..beb46271 100644 --- a/lib/generated/intl/messages_zh_Hans_CN.dart +++ b/lib/generated/intl/messages_zh_Hans_CN.dart @@ -158,6 +158,7 @@ class MessageLookup extends MessageLookupByLibrary { "dangqiandengji" : MessageLookupByLibrary.simpleMessage("当前等级"), "dangqianjifen" : MessageLookupByLibrary.simpleMessage("当前积分:"), "dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("当前商品兑换核销码已核销完成"), + "dangqianzhukadengji" : MessageLookupByLibrary.simpleMessage("当前主卡等级"), "daodianziqu" : MessageLookupByLibrary.simpleMessage("到店自取"), "daopinglunliebiaodingbu" : MessageLookupByLibrary.simpleMessage("到评论列表顶部"), "daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等级"), diff --git a/lib/generated/intl/messages_zh_Hant_CN.dart b/lib/generated/intl/messages_zh_Hant_CN.dart index ada38171..5cbc21e4 100644 --- a/lib/generated/intl/messages_zh_Hant_CN.dart +++ b/lib/generated/intl/messages_zh_Hant_CN.dart @@ -158,6 +158,7 @@ class MessageLookup extends MessageLookupByLibrary { "dangqiandengji" : MessageLookupByLibrary.simpleMessage("當前等級"), "dangqianjifen" : MessageLookupByLibrary.simpleMessage("當前積分:"), "dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("當前商品兌換核銷碼已核銷完成 "), + "dangqianzhukadengji" : MessageLookupByLibrary.simpleMessage("當前主卡等級"), "daodianziqu" : MessageLookupByLibrary.simpleMessage("到店自取"), "daopinglunliebiaodingbu" : MessageLookupByLibrary.simpleMessage("到評論列表頂部"), "daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等級"), diff --git a/lib/generated/intl/messages_zh_TW.dart b/lib/generated/intl/messages_zh_TW.dart index 1b30c07d..b17142c0 100644 --- a/lib/generated/intl/messages_zh_TW.dart +++ b/lib/generated/intl/messages_zh_TW.dart @@ -158,6 +158,7 @@ class MessageLookup extends MessageLookupByLibrary { "dangqiandengji" : MessageLookupByLibrary.simpleMessage("當前等級"), "dangqianjifen" : MessageLookupByLibrary.simpleMessage("當前積分:"), "dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("當前商品兌換核銷碼已核銷完成 "), + "dangqianzhukadengji" : MessageLookupByLibrary.simpleMessage("當前主卡等級"), "daodianziqu" : MessageLookupByLibrary.simpleMessage("到店自取"), "daopinglunliebiaodingbu" : MessageLookupByLibrary.simpleMessage("到評論列表頂部"), "daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等級"), diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index f9ec78fd..ace97d9c 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -5525,6 +5525,16 @@ class S { ); } + /// `当前主卡等级` + String get dangqianzhukadengji { + return Intl.message( + '当前主卡等级', + name: 'dangqianzhukadengji', + desc: '', + args: [], + ); + } + /// `并使用本机号码登录` String get privacy_policy4 { return Intl.message( diff --git a/lib/integral/intergra_view/integral_vip.dart b/lib/integral/intergra_view/integral_vip.dart index e465bc1e..04ddbf76 100644 --- a/lib/integral/intergra_view/integral_vip.dart +++ b/lib/integral/intergra_view/integral_vip.dart @@ -68,7 +68,7 @@ class _IntegralVip extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( - (widget.signInfo != null && widget.signInfo.rank != null) + (widget?.signInfo?.rank?.rankName != null) ? "${widget.signInfo.rank.rankName.replaceAll("会员", "")}" : "", style: TextStyle( diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 559f0bff..af4bf910 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -573,6 +573,7 @@ "shouhuodi": "收货地址", "chakanhexiaoma": "查看核销码", "chakanwuliu": "查看物流", + "dangqianzhukadengji": "当前主卡等级", diff --git a/lib/l10n/intl_zh_CN.arb b/lib/l10n/intl_zh_CN.arb index 2e0d0178..461bca21 100644 --- a/lib/l10n/intl_zh_CN.arb +++ b/lib/l10n/intl_zh_CN.arb @@ -571,6 +571,7 @@ "shouhuodi": "收货地址", "chakanhexiaoma": "查看核销码", "chakanwuliu": "查看物流", + "dangqianzhukadengji": "当前主卡等级", diff --git a/lib/l10n/intl_zh_Hans_CN.arb b/lib/l10n/intl_zh_Hans_CN.arb index b2bae66c..e098d2c7 100644 --- a/lib/l10n/intl_zh_Hans_CN.arb +++ b/lib/l10n/intl_zh_Hans_CN.arb @@ -571,6 +571,7 @@ "shouhuodi": "收货地址", "chakanhexiaoma": "查看核销码", "chakanwuliu": "查看物流", + "dangqianzhukadengji": "当前主卡等级", diff --git a/lib/l10n/intl_zh_Hant_CN.arb b/lib/l10n/intl_zh_Hant_CN.arb index 3697c1fe..fd6171b0 100644 --- a/lib/l10n/intl_zh_Hant_CN.arb +++ b/lib/l10n/intl_zh_Hant_CN.arb @@ -565,6 +565,7 @@ "dingdanbianhao": "訂單編號", "chakanhexiaoma": "查看核銷碼", "chakanwuliu": "查看物流", + "dangqianzhukadengji": "當前主卡等級", diff --git a/lib/l10n/intl_zh_TW.arb b/lib/l10n/intl_zh_TW.arb index 5fb52333..111be521 100644 --- a/lib/l10n/intl_zh_TW.arb +++ b/lib/l10n/intl_zh_TW.arb @@ -565,6 +565,7 @@ "shouhuodi": "收貨地址", "chakanhexiaoma": "查看核銷碼", "chakanwuliu": "查看物流", + "dangqianzhukadengji": "當前主卡等級", diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index 3050b5ff..c0e69e05 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -118,7 +118,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { EasyLoading.dismiss(); } - ///个人社交信息(粉丝/关注数量) + ///个人社交信息(粉丝/关注数量/成就数量) querySocialInfo() async { SharedPreferences value = await SharedPreferences.getInstance(); apiService = ApiService( @@ -197,15 +197,10 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { ranks: ranks, userInfo: userInfo, rank: (userInfo != null) - ? int.tryParse(userInfo.points) + ? int.tryParse(userInfo.expendAmount) : 0, - rankMax: (userInfo != null && - userInfo.memberRankVo != null) - ? userInfo.memberRankVo.rankOrigin - : 0, - createTime: (userInfo != null) - ? userInfo.createTime - : "", + rankMax: userInfo?.memberRankVo?.rankOrigin??0, + createTime: userInfo?.createTime??"", ), ], ), @@ -305,7 +300,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { ); } - ///关注度/粉丝/发布 + ///关注度/粉丝/成就数量 Widget attention(){ return Container( margin: EdgeInsets.only(left: 16,top: 10), @@ -400,7 +395,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { ), SizedBox(width: 5,), Text( - "1", + infoNumber != null ?infoNumber.achievementNumber.toString() :"0", style: TextStyle( color: Color(0xFF000000), fontSize: 15.sp, diff --git a/lib/mine/mine_view/community_follow.dart b/lib/mine/mine_view/community_follow.dart index e12dbfd0..76381d92 100644 --- a/lib/mine/mine_view/community_follow.dart +++ b/lib/mine/mine_view/community_follow.dart @@ -31,7 +31,7 @@ class _CommunityFollow extends State querySocialInfo(); } - ///个人社交信息(粉丝/关注数量) + ///个人社交信息(粉丝/关注数量/成就数量) querySocialInfo() async { SharedPreferences value = await SharedPreferences.getInstance(); apiService = ApiService( diff --git a/lib/mine/mine_vip/legal_right_details.dart b/lib/mine/mine_vip/legal_right_details.dart index 845e2bff..6cc6eff0 100644 --- a/lib/mine/mine_vip/legal_right_details.dart +++ b/lib/mine/mine_vip/legal_right_details.dart @@ -10,6 +10,7 @@ import 'package:huixiang/retrofit/data/base_data.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/custom_image.dart'; @@ -311,7 +312,7 @@ class _LegalRightDetails extends State { SizedBox( height: 20, ), - if(vipBenefitList[checkIndex].name == "副卡") + if(vipBenefitList[checkIndex].name == "副卡" && vipBenefitList[checkIndex].actived && vipBenefitList[checkIndex].have) Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -438,14 +439,76 @@ class _LegalRightDetails extends State { 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", + Stack( + alignment: Alignment.bottomCenter, + children: [ + MImage( + vipBenefitList?.icon ?? "", + width: 50, + height: 50, + // 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), + 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, + ), + ), + ], + ), + ), + 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: 8.h, ), @@ -507,6 +570,7 @@ class _LegalRightDetails extends State { secondCardList?.headimg ?? "", width: 50, height: 50, + isCircle: true, fit: BoxFit.cover, errorSrc: "assets/image/default_1.png", fadeSrc: "assets/image/default_1.png", @@ -530,7 +594,7 @@ class _LegalRightDetails extends State { height: 5.h, ), Text( - secondCardList?.phone ?? "", + AppUtils.phoneEncode(secondCardList?.phone ?? ""), style: TextStyle( color: Color(0xFF79572D), fontWeight: MyFontWeight.regular, diff --git a/lib/mine/mine_vip/mine_attainment_page.dart b/lib/mine/mine_vip/mine_attainment_page.dart index 4ceb0a0a..44888956 100644 --- a/lib/mine/mine_vip/mine_attainment_page.dart +++ b/lib/mine/mine_vip/mine_attainment_page.dart @@ -5,11 +5,13 @@ 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/social_info.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/badge_attainment_dialog.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; @@ -34,7 +36,7 @@ class _MineAttainmentPage extends State { List vipBadgesList = []; List achievementDetail = []; int checkPosition = 0; - int attainmentPoint = 0; + SocialInfo infoNumber; @override void dispose() { @@ -47,7 +49,7 @@ class _MineAttainmentPage extends State { super.initState(); userInfo = widget.arguments["userInfo"]; queryAttainmentBadges(); - queryAchievementDetail("1460164746211753984"); + querySocialInfo(); } ///成就徽章分类 @@ -76,7 +78,7 @@ class _MineAttainmentPage extends State { } ///成就分类弹窗详情 - queryAchievementDetail(achievementCategoryId) async { + queryAchievementDetail(index) async { if (apiService == null) { SharedPreferences value = await SharedPreferences.getInstance(); apiService = ApiService( @@ -86,17 +88,33 @@ class _MineAttainmentPage extends State { ); } BaseData> baseData = await apiService - .getAchievementDetail(achievementCategoryId) + .getAchievementDetail(vipBadgesList[index].id) .catchError((onError) {}); if (baseData != null && baseData.isSuccess) { setState(() { achievementDetail.clear(); - attainmentPoint = 0; achievementDetail.addAll(baseData.data); - achievementDetail.forEach((element) { - if(element.actived) - attainmentPoint += 1; - }); + showDeleteDialog(index); + }); + } + EasyLoading.dismiss(); + } + + ///个人社交信息(粉丝/关注数量/成就数量) + querySocialInfo() async { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + showLoading: false, + ); + + BaseData baseData = + await apiService.socialInfo().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + setState(() { + infoNumber = baseData.data; }); } EasyLoading.dismiss(); @@ -182,7 +200,7 @@ class _MineAttainmentPage extends State { color: Color(0xFF353535)), ), Text( - attainmentPoint.toString(), + infoNumber != null ? infoNumber.achievementNumber.toString() :"0", style: TextStyle( fontWeight: MyFontWeight.medium, fontSize: 14, @@ -230,7 +248,7 @@ class _MineAttainmentPage extends State { return GestureDetector( onTap: () { setState(() { - showDeleteDialog(index); + queryAchievementDetail(index); }); }, child: badgeItem(vipBadgesList[index]), @@ -441,4 +459,15 @@ class _MineAttainmentPage extends State { ], ); } + + ///成就徽章弹窗(暂无接口字段判断该功能实现) + showAlertDialog() { + //显示对话框 + showDialog( + context: context, + builder: (BuildContext context) { + return BadgeAttainmentDialog(); + }, + ); + } } diff --git a/lib/mine/mine_vip/mine_vip_core.dart b/lib/mine/mine_vip/mine_vip_core.dart index 01ef5ddc..c442a0c1 100644 --- a/lib/mine/mine_vip/mine_vip_core.dart +++ b/lib/mine/mine_vip/mine_vip_core.dart @@ -5,11 +5,13 @@ 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:fluwx/fluwx.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/data/wx_pay.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/font_weight.dart'; @@ -36,6 +38,7 @@ class _MineVipCore extends State { List ranks = []; List vipBenefitList = []; VipRuleDetails vipRuleDetails; + int checkIndex = 0; final SwiperController controller = SwiperController(); @@ -44,6 +47,16 @@ class _MineVipCore extends State { super.initState(); 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); + } apiService = ApiService(Dio(), context: context, token: value.getString("token")); queryVipLevel(); @@ -78,7 +91,7 @@ class _MineVipCore extends State { EasyLoading.dismiss(); } - ///会员权益介绍/规则/说明 + ///会员权益介绍/规则/说明/储值说明 queryRuleDetails() async { BaseData baseData = await apiService.vipBenefit().catchError((onError) {}); @@ -90,6 +103,52 @@ class _MineVipCore extends State { EasyLoading.dismiss(); } + ///购买会员等级 + buyRank() async { + + // if (!(await Min.isInitialize())) { + // 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调, + // 然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针, + // 故而在此初始化一下 + // await Min.initialize(); + // } + + BaseData baseData = + await apiService.rankBuy({"buyType": 2, "rankId":ranks[checkIndex].id}); + if (baseData != null && baseData.isSuccess) { + WxPay wxPay = WxPay.fromJson(baseData.data); + await registerWxApi( + appId: wxPay.appId, + doOnAndroid: true, + universalLink: "https://hx.lotus-wallet.com/app/", + ); + payWithWeChat( + appId: wxPay.appId, + partnerId: wxPay.partnerId, + prepayId: wxPay.prepayId, + packageValue: wxPay.packageValue, + nonceStr: wxPay.nonceStr, + timeStamp: int.tryParse(wxPay.timeStamp), + sign: wxPay.sign, + ); + weChatResponseEventHandler.listen((event) async { + print("payCallback: ${event.errCode}"); + if(event.errCode == 0){ + widget.arguments["rankLevel"] = ranks[checkIndex].level; + queryVipLevel(); + showAlertDialog(ranks[checkIndex].rankName); + } + else{ + SmartDialog.showToast("支付失败", alignment: Alignment.center); + return; + } + }); + } + else{ + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } + @override Widget build(BuildContext context) { return Scaffold( @@ -99,6 +158,23 @@ class _MineVipCore extends State { titleSize: 18.sp, background: Colors.transparent, leadingColor: Colors.black, + action:widget?.arguments["userInfo"] != null ? Container( + alignment: Alignment.center, + margin: EdgeInsets.only(right: 16.w), + child: GestureDetector( + onTap: () { + Navigator.of(context).pushNamed('/router/integral_detailed_page'); + }, + child: Text( + "${S.of(context).dangqianzhukadengji} : ${widget?.arguments["userInfo"]??""}", + style: TextStyle( + color: Colors.black, + fontSize: 16.sp, + fontWeight: MyFontWeight.bold, + ), + ), + ), + ) : SizedBox(), ), body: SingleChildScrollView( physics: BouncingScrollPhysics(), @@ -114,6 +190,11 @@ class _MineVipCore extends State { loop: false, physics: BouncingScrollPhysics(), controller: controller, + onIndexChanged: (index){ + setState(() { + checkIndex = index; + }); + }, itemBuilder: (context, position) { return MineVipView( vipLevel: !(ranks != null && ranks.isNotEmpty) @@ -127,7 +208,7 @@ class _MineVipCore extends State { padding: 6.w, rank: !(ranks != null && ranks.isNotEmpty) ? 0 - : widget.arguments["points"], + : widget.arguments["expendAmount"], rankMax: !(ranks != null && ranks.isNotEmpty) ? 0 : (position < (ranks.length - 1)) @@ -387,10 +468,12 @@ class _MineVipCore extends State { ], ), ), - InkWell( + if( + ranks.length > checkIndex && widget.arguments["rankLevel"] < ranks[checkIndex].level && ranks[checkIndex].price != "0.00") + InkWell( onTap: () { setState(() { - showAlertDialog(); + buyRank(); }); }, child: Container( @@ -408,7 +491,7 @@ class _MineVipCore extends State { height: 54, alignment: Alignment.center, child: Text( - "${S.of(context).lijikaitong}¥20000/永久", + "${S.of(context).lijikaitong}¥${ranks.length>checkIndex?ranks[checkIndex].price:""}/永久", style: TextStyle( fontWeight: FontWeight.bold, fontSize: 16.sp, @@ -416,7 +499,7 @@ class _MineVipCore extends State { ), ), ), - ) + ), ], ), ), @@ -570,7 +653,7 @@ class _MineVipCore extends State { SizedBox( height: 5.h, ), - Text( + Expanded(child: Text( vipBenefitList?.name ?? "", maxLines: 2, overflow: TextOverflow.ellipsis, @@ -580,19 +663,20 @@ class _MineVipCore extends State { fontWeight: MyFontWeight.regular, fontSize: 12.sp, ), - ), + )) + , ], ), ); } ///会员升级弹窗 - showAlertDialog() { + showAlertDialog(vipName) { //显示对话框 showDialog( context: context, builder: (BuildContext context) { - return VipDialog(); + return VipDialog(vipName); }, ); } diff --git a/lib/mine/recharge_page.dart b/lib/mine/recharge_page.dart index 4ffa6e1b..08935bec 100644 --- a/lib/mine/recharge_page.dart +++ b/lib/mine/recharge_page.dart @@ -1,12 +1,17 @@ import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.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:fluwx/fluwx.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/vip_benefit_list.dart'; +import 'package:huixiang/retrofit/data/vip_rule_details.dart'; import 'package:huixiang/retrofit/data/wx_pay.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/min.dart'; import 'package:huixiang/view_widget/item_input_widget.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -23,10 +28,11 @@ class RechargePage extends StatefulWidget { class _RechargePage extends State { ApiService apiService; - TextEditingController controller = TextEditingController(); - + VipRuleDetails vipRuleDetails; + List vipBenefitList = []; Color color = Colors.black; + double discount = 100; @override void initState() { @@ -35,9 +41,42 @@ class _RechargePage extends State { SharedPreferences.getInstance().then((value) { apiService = ApiService(Dio(), context: context, token: value.getString("token"), pay: true); + queryBenefitList(); + queryRuleDetails(); }); } + + ///会员权益列表 + queryBenefitList() async { + BaseData> baseData = await apiService.benefitList().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + setState(() { + vipBenefitList.clear(); + vipBenefitList.addAll(baseData.data); + vipBenefitList.forEach((element) { + if(element.have && element.config != null && element.code == "RECHARGE"){ + discount = double.parse(element.config); + } + + }); + }); + } + 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( @@ -48,137 +87,217 @@ class _RechargePage extends State { background: Color(0xFFFFFFFF), leadingColor: Colors.black, ), - body: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - child: Column( - children: [ - ItemInputWidget( - S.of(context).qingshuruchongzhijine, - hintText: "", - controller: controller, - padding: EdgeInsets.all(20), - errorText: S.of(context).chongzhizuixiaojine(10), - titleColor: Color(0xFF727272), - errorTextColor: Color(0xFF32A060), - radius: 8, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 27.sp, - color: color, - ), - inputLimit: 6, - textInputType: TextInputType.number, - textInputFormatter: FilteringTextInputFormatter.digitsOnly, - onChanged: (value) { - if (value != null && - value != "" && - double.tryParse(value) < 10) { - color = Colors.red; - } else { - color = Colors.black; - } - setState(() {}); - }, - ), - Container( - width: double.infinity, - margin: EdgeInsets.only( - left: 20.w, - right: 20.w, - top: 12.h, - bottom: 4.h, - ), - padding: EdgeInsets.only( - left: 20.w, - right: 16.w, - top: 20.h, - bottom: 20.h, - ), - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Color(0x000000).withAlpha(25), - offset: Offset(0, 1), - blurRadius: 12.0, - ), - ], - color: Colors.white, - borderRadius: BorderRadius.circular(4), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(bottom: 16.h), - child: Text( - S.of(context).zhifufangshi, + body:Stack( + children: [ + SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Container( + child: Column( + children: [ + Container( + child: Column(children: [ + ItemInputWidget( + S.of(context).qingshuruchongzhijine, + hintText: "", + controller: controller, + padding: EdgeInsets.all(20), + errorText: S.of(context).chongzhizuixiaojine(0.1), + titleColor: Color(0xFF727272), + errorTextColor: Color(0xFF32A060), + radius: 8, + discount: discount/10, style: TextStyle( - fontSize: 16.sp, - color: Colors.black, fontWeight: FontWeight.bold, + fontSize: 27.sp, + color: color, ), + inputLimit: 6, + textInputType: TextInputType.number, + textInputFormatter: FilteringTextInputFormatter.digitsOnly, + onChanged: (value) { + if (value != null && + value != "" && + double.tryParse(value) < 10) { + color = Colors.red; + } else { + color = Colors.black; + } + setState(() {}); + }, ), - ), - GestureDetector( - onTap: () { - setState(() { - checkIndex = 1; - }); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, + Row( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - Image.asset("assets/image/icon_we_chat.png"), - Expanded( - flex: 1, - child: Padding( - padding: EdgeInsets.only(left: 8.w), - child: Text( - S.of(context).weixinzhifu, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xff353535), - ), + if (vipRuleDetails?.recharge != null && + vipRuleDetails.recharge != "") + Expanded(child:Container( + color: Colors.white, + padding: EdgeInsets.only(left: 8), + child: Html( + data: "注意:${vipRuleDetails?.recharge??""}", + customImageRenders: { + networkSourceMatcher(): networkImageRender( + loadingWidget: () { + return Container(); + }, + ), + }, ), - ), - ), - checkView(1), + ),) ], ), + ],), + ), + Container( + width: double.infinity, + margin: EdgeInsets.only( + left: 0.w, + right: 0.w, + top: 16.h, + bottom: 4.h, + ), + padding: EdgeInsets.only( + left: 20.w, + right: 16.w, + top: 20.h, + bottom: 20.h, + ), + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Color(0x000000).withAlpha(25), + offset: Offset(0, 1), + blurRadius: 12.0, + ), + ], + color: Colors.white, + // borderRadius: BorderRadius.circular(4), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 16.h), + child: Text( + S.of(context).zhifufangshi, + style: TextStyle( + fontSize: 16.sp, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + ), + GestureDetector( + onTap: () { + setState(() { + checkIndex = 1; + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Image.asset("assets/image/icon_we_chat.png"), + Expanded( + flex: 1, + child: Padding( + padding: EdgeInsets.only(left: 8.w), + child: Text( + S.of(context).weixinzhifu, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xff353535), + ), + ), + ), + ), + checkView(1), + ], + ), + ), + ], ), - ], - ), - ), - InkWell( - onTap: () { - recharge(); - }, - child: Container( - margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 26.h), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - RoundButton( - width: double.infinity, - height: 46.h, - text: S.of(context).querenchongzhi, - textColor: Colors.white, - fontSize: 14.sp, - backgroup: Color(0xff32A060), - fontWeight: FontWeight.bold, - ), - ], ), - ), + // InkWell( + // onTap: () { + // recharge(); + // }, + // child: Container( + // // margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 26.h), + // child: Column( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // RoundButton( + // width: double.infinity, + // height: 46.h, + // text: S.of(context).querenchongzhi, + // textColor: Colors.white, + // fontSize: 14.sp, + // backgroup: Color(0xff32A060), + // fontWeight: FontWeight.bold, + // ), + // ], + // ), + // ), + // ), + ], ), - ], + ), ), - ), + Align(alignment: Alignment.bottomCenter,child: + Container( + height: 54.h, + color: Colors.white, + child: Row( + children: [ + Spacer(), + Padding(padding: EdgeInsets.only(top: 7,right: 16), + child:Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + S.of(context).heji, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.black, + ), + ), + Text( + controller.text == "" ? "" :(double.parse(controller.text) * (discount/100)).toString(), + style: TextStyle( + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF32A060), + ), + ), + ], + )), + GestureDetector( + onTap: () { + recharge(); + }, + child: RoundButton( + width: 103.w, + height: 54.h, + text: S.of(context).chongzhi, + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFF32A060), + radius: 0, + fontSize: 16.sp, + padding: EdgeInsets.symmetric(vertical: 5.h), + ), + ), + ], + ), + )) + ], ), + ); } @@ -207,8 +326,8 @@ class _RechargePage extends State { } int amount = int.tryParse(money); if (checkIndex == 1) { - if (amount < 10) { - SmartDialog.showToast(S.of(context).chongzhizuixiaojine(10), + if (amount < 0.001) { + SmartDialog.showToast(S.of(context).chongzhizuixiaojine(0.001), alignment: Alignment.center); return; } @@ -220,10 +339,10 @@ class _RechargePage extends State { // await Min.initialize(); // } - BaseData baseData = + BaseData baseData = await apiService.recharge({"amount": amount, "rechargeType": 2}); if (baseData != null && baseData.isSuccess) { - WxPay wxPay = baseData.data; + WxPay wxPay = WxPay.fromJson(baseData.data); await registerWxApi( appId: wxPay.appId, doOnAndroid: true, @@ -240,8 +359,19 @@ class _RechargePage extends State { ); weChatResponseEventHandler.listen((event) async { print("payCallback: ${event.errCode}"); + if(event.errCode == 0){ + Navigator.of(context).pop(); + SmartDialog.showToast("充值成功", alignment: Alignment.center); + } + else{ + SmartDialog.showToast("充值失败", alignment: Alignment.center); + return; + } }); } + else{ + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } } } } diff --git a/lib/order/exchange_history_page.dart b/lib/order/exchange_history_page.dart index 4841b93b..805d9822 100644 --- a/lib/order/exchange_history_page.dart +++ b/lib/order/exchange_history_page.dart @@ -486,17 +486,15 @@ class _ExchangeHistoryList extends 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 - // : "" - // }); + Navigator.of(context).pushNamed( + '/router/logistics_information_page', + arguments: { + "orderId": exchangeOrder.creditOrderDetailList[0].orderId, + "logisticsNum": "", + "logisticsName": "", + "productNum": exchangeOrder.creditOrderDetailList[0].goodsNumber, + "skuImg":exchangeOrder.creditOrderDetailList[0].goodsMainImg + }); }); }, child: buildBtnStatusTow(exchangeOrder.state), diff --git a/lib/order/exchange_order_page.dart b/lib/order/exchange_order_page.dart index 73d875eb..ba689bd9 100644 --- a/lib/order/exchange_order_page.dart +++ b/lib/order/exchange_order_page.dart @@ -993,19 +993,26 @@ class _ExchangeOrderPage extends State { ); weChatResponseEventHandler.listen((event) async { print("payCallback: ${event.errCode}"); - Navigator.of(context).popAndPushNamed( - '/router/exchange_order_success_page', - arguments: { - "id": widget.arguments["goodsId"], - "price": (widget.arguments["payType"] == 1 ? - (double.parse(widget.arguments["onePrice"])*buyNum).toString(): - (widget.arguments["price"] == null || widget.arguments["price"] == "0" - ? "0" - : (double.parse(widget.arguments["price"])*buyNum).toString())), - "points": points, - "payChannel":widget.arguments["payChannel"], - }, - ); + if(event.errCode == 0){ + Navigator.of(context).popAndPushNamed( + '/router/exchange_order_success_page', + arguments: { + "id": widget.arguments["goodsId"], + "price": (widget.arguments["payType"] == 1 ? + (double.parse(widget.arguments["onePrice"])*buyNum).toString(): + (widget.arguments["price"] == null || widget.arguments["price"] == "0" + ? "0" + : (double.parse(widget.arguments["price"])*buyNum).toString())), + "points": points, + "realPay":handleNeedPay(), + "payChannel":widget.arguments["payChannel"], + }, + ); + }else { + SmartDialog.showToast("支付失败", alignment: Alignment.center); + return; + } + }); return; } @@ -1016,6 +1023,7 @@ class _ExchangeOrderPage extends State { (widget.arguments["price"] == null || widget.arguments["price"] == "0" ? "0" : (double.parse(widget.arguments["price"])*buyNum).toString())), + "realPay":handleNeedPay(), "points": points, "payChannel":widget.arguments["payChannel"], "id": baseDate.data diff --git a/lib/order/exchange_order_success_page.dart b/lib/order/exchange_order_success_page.dart index ae2f076a..0f2a4228 100644 --- a/lib/order/exchange_order_success_page.dart +++ b/lib/order/exchange_order_success_page.dart @@ -87,7 +87,7 @@ class _ExchangeOrderSuccessPage extends State { child: Column( children: [ Text( - widget.arguments["price"], + widget.arguments["realPay"], style: TextStyle( color: Colors.black, fontSize: 21.sp, diff --git a/lib/order/logistics_information_page.dart b/lib/order/logistics_information_page.dart index b2799d7e..2b70548d 100644 --- a/lib/order/logistics_information_page.dart +++ b/lib/order/logistics_information_page.dart @@ -6,6 +6,7 @@ import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/logistics.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/view_widget/no_data_view.dart'; @@ -35,8 +36,12 @@ class _LogisticsInformationPage extends State { SharedPreferences.getInstance().then((value) { apiService = ApiService(Dio(), context: context, token: value.getString("token")); - getShippingTrace(widget.arguments["shipperCode"] ?? "", + if((widget.arguments["shipperCode"]??"") != "" && + (widget.arguments["logisticsNum"]??"") != "") + getShippingTrace(widget.arguments["shipperCode"] ?? "", widget.arguments["logisticsNum"] ?? ""); + else + queryAppShippingTrace(widget.arguments["orderId"]); }); } @@ -63,6 +68,27 @@ class _LogisticsInformationPage extends State { } } + queryAppShippingTrace(orderId) async { + BaseData baseData = + await apiService.getAppShippingTrace(orderId).catchError((error) { + _refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + Logistics lgs = baseData.data; + logistics.clear(); + logistics.addAll(lgs.traces.reversed); + setState(() { + shipStatus = logisticsStatus(lgs.state); + widget.arguments["logisticsName"] = lgs.shipperCode; + widget.arguments["logisticsNum"] = lgs.logisticCode; + if (logistics.length > 0) logistics[0].acceptStation += shipStatus; + _refreshController.refreshCompleted(); + }); + } else { + _refreshController.refreshFailed(); + } + } + @override Widget build(BuildContext context) { return Scaffold( @@ -115,12 +141,13 @@ class _LogisticsInformationPage extends State { color: Color(0xff353535)), ), ), - SizedBox( - height: 500.h, + Container( child: (logistics != null && logistics.length > 0) ? ListView.builder( itemCount: logistics != null ? logistics.length : 0, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), itemBuilder: (context, position) { return orderTrackItem(logistics[position], position, logistics.length); @@ -166,20 +193,14 @@ class _LogisticsInformationPage extends State { Stack( alignment: Alignment.bottomCenter, children: [ - if (widget.arguments["skuImg"] != null) - Image.network( - widget.arguments["skuImg"], - width: 95.w, - height: 95.h, - fit: BoxFit.cover, - ) - else - Image.asset( - "assets/image/default_1.png", - width: 95.w, - height: 95.h, - fit: BoxFit.cover, - ), + MImage( + widget.arguments["skuImg"] != null ? widget.arguments["skuImg"] : "", + width: 95, + height: 95, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), Container( padding: EdgeInsets.only( left: 32.w, right: 32.w, top: 5.h, bottom: 5.h), @@ -409,7 +430,7 @@ class _LogisticsInformationPage extends State { String tripStatus = "assets/image/icon_sign.png"; if (type.contains("已签收")) { tripStatus = "assets/image/icon_sign.png"; - } else if (type.contains("派送中")) { + } else if (type.contains("派送中") || type.contains("派件中")) { tripStatus = "assets/image/icon_delivery.png"; } else if (type.contains("运输中") || type.contains("发往")) { tripStatus = "assets/image/icon_transport.png"; @@ -425,7 +446,7 @@ class _LogisticsInformationPage extends State { String logisticsTripStatus = ""; if (state.contains("已签收")) { logisticsTripStatus = "已签收"; - } else if (state.contains("派送中")) { + } else if (state.contains("派送中") || state.contains("派件中")) { logisticsTripStatus = "派送中"; } else if (state.contains("运输中") || state.contains("发往")) { logisticsTripStatus = "运输中"; diff --git a/lib/retrofit/data/goods.dart b/lib/retrofit/data/goods.dart index 20a75811..983278a5 100644 --- a/lib/retrofit/data/goods.dart +++ b/lib/retrofit/data/goods.dart @@ -42,6 +42,7 @@ class Goods { String money, String onePrice, String oneMoney, + String orderId, int stock, int sales, bool isHot, @@ -68,6 +69,7 @@ class Goods { _money = money; _onePrice = onePrice; _oneMoney = oneMoney; + _orderId = orderId; _stock = stock; _sales = sales; _isHot = isHot; @@ -97,6 +99,7 @@ class Goods { _money = json['money']; _onePrice = json['onePrice']; _oneMoney = json['oneMoney']; + _orderId = json['orderId']; _stock = json['stock']; _sales = json['sales']; _isHot = json['isHot']; @@ -124,6 +127,7 @@ class Goods { String _money; String _onePrice; String _oneMoney; + String _orderId; int _stock; int _sales; bool _isHot; @@ -151,6 +155,7 @@ class Goods { String get money => _money; String get onePrice => _onePrice; String get oneMoney => _oneMoney; + String get orderId => _orderId; int get stock => _stock; int get sales => _sales; bool get isHot => _isHot; @@ -180,6 +185,7 @@ class Goods { map['money'] = _money; map['onePrice'] = _onePrice; map['oneMoney'] = _oneMoney; + map['orderId'] = _orderId; map['stock'] = _stock; map['sales'] = _sales; map['isHot'] = _isHot; diff --git a/lib/retrofit/data/rank.dart b/lib/retrofit/data/rank.dart index 2b9a3402..1f7c8bc0 100644 --- a/lib/retrofit/data/rank.dart +++ b/lib/retrofit/data/rank.dart @@ -18,6 +18,7 @@ class Rank { String _rankImg; String _rankName; int _rankOrigin; + int _level; bool _status; String _updateTime; String _updateUser; @@ -30,6 +31,7 @@ class Rank { String get rankImg => _rankImg; String get rankName => _rankName; int get rankOrigin => _rankOrigin; + int get level => _level; bool get status => _status; String get updateTime => _updateTime; String get updateUser => _updateUser; @@ -41,8 +43,9 @@ class Rank { String rankContent, String rankImg, String rankName, - int rankOrigin, - bool status, + int rankOrigin, + int level, + bool status, String updateTime, String updateUser}){ _createTime = createTime; @@ -53,6 +56,7 @@ class Rank { _rankImg = rankImg; _rankName = rankName; _rankOrigin = rankOrigin; + _level = level; _status = status; _updateTime = updateTime; _updateUser = updateUser; @@ -67,6 +71,7 @@ class Rank { _rankImg = json["rankImg"]; _rankName = json["rankName"]; _rankOrigin = json["rankOrigin"]; + _level = json["level"]; _status = json["status"]; _updateTime = json["updateTime"]; _updateUser = json["updateUser"]; @@ -82,6 +87,7 @@ class Rank { map["rankImg"] = _rankImg; map["rankName"] = _rankName; map["rankOrigin"] = _rankOrigin; + map["level"] = _level; map["status"] = _status; map["updateTime"] = _updateTime; map["updateUser"] = _updateUser; diff --git a/lib/retrofit/data/settleOrderInfo.dart b/lib/retrofit/data/settleOrderInfo.dart index 1346d9f8..bb92977d 100644 --- a/lib/retrofit/data/settleOrderInfo.dart +++ b/lib/retrofit/data/settleOrderInfo.dart @@ -8,6 +8,7 @@ class SettleOrderInfo { dynamic memberVO; String postAge; String price; + String benefitDiscountAmount; String orderSum; String discountAmount; List promotionInfoList; @@ -25,6 +26,7 @@ class SettleOrderInfo { settleOrderInfoBean.memberVO = map['memberVO']; settleOrderInfoBean.postAge = map['postAge']; settleOrderInfoBean.price = map['price']; + settleOrderInfoBean.benefitDiscountAmount = map['benefitDiscountAmount']; settleOrderInfoBean.orderSum = map['orderSum']; settleOrderInfoBean.discountAmount = map['discountAmount']; settleOrderInfoBean.promotionInfoList = List()..addAll( @@ -48,6 +50,7 @@ class SettleOrderInfo { "memberVO": memberVO, "postAge": postAge, "price": price, + "benefitDiscountAmount": benefitDiscountAmount, "orderSum": orderSum, "discountAmount": discountAmount, "promotionInfoList": promotionInfoList, diff --git a/lib/retrofit/data/social_info.dart b/lib/retrofit/data/social_info.dart index a35c27af..252dec8a 100644 --- a/lib/retrofit/data/social_info.dart +++ b/lib/retrofit/data/social_info.dart @@ -4,20 +4,25 @@ class SocialInfo { SocialInfo({ int fans, - int follow,}){ + int follow, + int achievementNumber}){ _fans = fans; _follow = follow; + _achievementNumber = achievementNumber; } SocialInfo.fromJson(dynamic json) { _fans = json['fans']; _follow = json['follow']; + _achievementNumber = json['achievementNumber']; } int _fans; int _follow; + int _achievementNumber; int get fans => _fans; int get follow => _follow; + int get achievementNumber => _achievementNumber; set fans(int value) { @@ -28,10 +33,15 @@ class SocialInfo { final map = {}; map['fans'] = _fans; map['follow'] = _follow; + map['achievementNumber'] = _achievementNumber; return map; } set follow(int value) { _follow = value; } + + set achievementNumber(int value) { + _achievementNumber = value; + } } \ No newline at end of file diff --git a/lib/retrofit/data/user_info.dart b/lib/retrofit/data/user_info.dart index ac9698f1..51a39e55 100644 --- a/lib/retrofit/data/user_info.dart +++ b/lib/retrofit/data/user_info.dart @@ -32,8 +32,11 @@ class UserInfo { String birth; dynamic balance; String money; + String expendAmount; String points; bool isBind; + String masterId; + String masterCardRankName; MemberRank memberRankVo; factory UserInfo.fromJson(Map json) => @@ -51,8 +54,11 @@ class UserInfo { ..birth = json['birth'] as String ..balance = json['balance'] ..money = json['money'] as String + ..expendAmount = json['expendAmount'] as String ..points = json['points'] as String ..isBind = json['isBind'] as bool + ..masterId = json['masterId'] as String + ..masterCardRankName = json['masterCardRankName'] as String ..memberRankVo = json['memberRankVo'] == null ? null : MemberRank.fromJson(json['memberRankVo'] as Map); @@ -71,8 +77,11 @@ class UserInfo { 'birth': this.birth, 'balance': this.balance, 'money': this.money, + 'expendAmount': this.expendAmount, 'points': this.points, 'isBind': this.isBind, + 'masterId': this.masterId, + 'masterCardRankName': this.masterCardRankName, 'memberRankVo': this.memberRankVo == null ? "" : this.memberRankVo.toJson(), }; } diff --git a/lib/retrofit/data/vip_benefit_list.dart b/lib/retrofit/data/vip_benefit_list.dart index 647d607b..7ef9304f 100644 --- a/lib/retrofit/data/vip_benefit_list.dart +++ b/lib/retrofit/data/vip_benefit_list.dart @@ -1,18 +1,19 @@ /// id : "5" /// createTime : "2021-11-18 14:11:34" /// createUser : "1" -/// updateTime : "2021-11-18 17:10:24" +/// updateTime : "2021-11-24 14:37:30" /// 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 +/// introduce : "

用户在成为金卡会员/共创会员之后, 即可经行副卡绑定。点击添加新副卡,输入需要绑定的用户手机号,输入需要绑定用户的手机号,输入验证码,验证通过后,即可绑定成功。点击头像右下方的解除,出现提示弹窗,点击确认即可解除绑定。

" +/// describes : "
    \n
  • 副卡用户必须为平台注册用户
  • \n
  • 每位主卡用户只可绑定5位副卡用户,同时,只能解绑3次
  • \n
  • 副卡享受主卡的部分权益,主卡会员失效之后,副卡也失效
  • \n
  • 副卡成为金卡会员后,自动与主卡解绑
  • \n
" +/// actived : false /// sort : 4 /// isDelete : 0 -/// have : false +/// have : true +/// config : "5" class VipBenefitList { VipBenefitList({ @@ -30,7 +31,8 @@ class VipBenefitList { bool actived, int sort, int isDelete, - bool have,}){ + bool have, + String config,}){ _id = id; _createTime = createTime; _createUser = createUser; @@ -46,6 +48,7 @@ class VipBenefitList { _sort = sort; _isDelete = isDelete; _have = have; + _config = config; } VipBenefitList.fromJson(dynamic json) { @@ -64,6 +67,7 @@ class VipBenefitList { _sort = json['sort']; _isDelete = json['isDelete']; _have = json['have']; + _config = json['config']; } String _id; String _createTime; @@ -80,6 +84,7 @@ class VipBenefitList { int _sort; int _isDelete; bool _have; + String _config; String get id => _id; String get createTime => _createTime; @@ -96,11 +101,7 @@ class VipBenefitList { int get sort => _sort; int get isDelete => _isDelete; bool get have => _have; - - - set id(String value) { - _id = value; - } + String get config => _config; Map toJson() { final map = {}; @@ -119,62 +120,8 @@ class VipBenefitList { map['sort'] = _sort; map['isDelete'] = _isDelete; map['have'] = _have; + map['config'] = _config; 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 index fce890ad..4bba102a 100644 --- a/lib/retrofit/data/vip_rule_details.dart +++ b/lib/retrofit/data/vip_rule_details.dart @@ -6,24 +6,29 @@ class VipRuleDetails { VipRuleDetails({ String rule, String contrast, - String qa,}){ + String qa, + String recharge,}){ _rule = rule; _contrast = contrast; _qa = qa; + _recharge = recharge; } VipRuleDetails.fromJson(dynamic json) { _rule = json['rule']; _contrast = json['contrast']; _qa = json['qa']; + _recharge = json['recharge']; } String _rule; String _contrast; String _qa; + String _recharge; String get rule => _rule; String get contrast => _contrast; String get qa => _qa; + String get recharge => _recharge; set rule(String value) { @@ -45,4 +50,8 @@ class VipRuleDetails { set qa(String value) { _qa = value; } + + set recharge(String value) { + _recharge = value; + } } \ No newline at end of file diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 7dff74f1..26e0ed25 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -53,15 +53,15 @@ part 'retrofit_api.g.dart'; // const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 // const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 -// const base_url = "http://192.168.10.236:8766/app/"; ///费韬 -// const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 +const base_url = "http://192.168.10.236:8766/app/"; ///费韬 +const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 // const base_url = "http://192.168.10.37:8766/app/"; // const baseUrl = "http://192.168.10.37:8766/app/"; -const base_url = "http://192.168.10.130:8766/app/";///詹云久 -const baseUrl = "http://192.168.10.130:8766/app/";///詹云久 +// const base_url = "http://192.168.10.130:8766/app/";///詹云久 +// const baseUrl = "http://192.168.10.130:8766/app/";///詹云久 @RestApi(baseUrl: baseUrl) abstract class ApiService { @@ -71,7 +71,7 @@ abstract class ApiService { BuildContext context, String token, bool showLoading = true, - bool pay = false, + bool pay = true, }) { Map headers = (token == null || token == "") ? {} : {'token': "Bearer $token"}; @@ -204,9 +204,9 @@ abstract class ApiService { @GET("/member/signIn") Future signIn(); - ///会员充值 + ///平台充值 @POST("/wallet/recharge") - Future> recharge(@Body() Map param); + Future> recharge(@Body() Map param); ///领取优惠券 @GET("/coupon/receive?couponId={couponId}") @@ -399,7 +399,7 @@ abstract class ApiService { @DELETE("/information/trend/{id}") Future deleteTrend(@Path("id") String id); - ///个人社交信息(粉丝/关注数量) + ///个人社交信息(粉丝/关注数量/成就数量) @GET("/member/socialInfo") Future> socialInfo(); @@ -455,8 +455,16 @@ abstract class ApiService { @GET("/member/bindSecondCard/{phone}") Future bindSecondCard(@Path("phone") String phone); - ///绑定副卡 + ///解绑副卡 @GET("/member/unbindSecondCard/{phone}") Future unbindSecondCard(@Path("phone") String phone); + ///查看积分订单物流 + @GET("/creditOrder/getAppShippingTrace?orderId={orderId}") + Future> getAppShippingTrace(@Path("orderId") String orderId); + + ///购买会员等级 + @POST("/member/rankBuy") + Future> rankBuy(@Body() Map param); + } diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index 99355c13..0b363086 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -9,7 +9,7 @@ part of 'retrofit_api.dart'; class _ApiService implements ApiService { _ApiService(this._dio, {this.baseUrl}) { ArgumentError.checkNotNull(_dio, '_dio'); - baseUrl ??= 'http://192.168.10.130:8766/app/'; + baseUrl ??= 'http://192.168.10.236:8766/app/'; } final Dio _dio; @@ -271,7 +271,7 @@ class _ApiService implements ApiService { } @override - Future> recharge(param) async { + Future> recharge(param) async { ArgumentError.checkNotNull(param, 'param'); const _extra = {}; final queryParameters = {}; @@ -285,9 +285,9 @@ class _ApiService implements ApiService { extra: _extra, baseUrl: baseUrl), data: _data); - final value = BaseData.fromJson( + final value = BaseData.fromJson( _result.data, - (json) => WxPay.fromJson(json), + (json) => json as dynamic, ); return value; } @@ -1577,7 +1577,6 @@ class _ApiService implements ApiService { return value; } - @override Future>> benefitList() async { const _extra = {}; @@ -1621,7 +1620,6 @@ class _ApiService implements ApiService { return value; } - @override Future>> secondCardList() async { const _extra = {}; @@ -1688,4 +1686,48 @@ class _ApiService implements ApiService { return value; } + @override + Future> getAppShippingTrace(orderId) async { + ArgumentError.checkNotNull(orderId, 'orderId'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/creditOrder/getAppShippingTrace?orderId=$orderId', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => Logistics.fromJson(json), + ); + return value; + } + + @override + Future> rankBuy(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('/member/rankBuy', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json as dynamic, + ); + return value; + } + } diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index 6768187b..a23103f8 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -397,7 +397,7 @@ class _Settlement extends State { minOrderInfo, ), - ///优惠券/备注 + ///优惠券/备注/会员优惠金额 ActivityCouponRemarks( couponCart, activityCart, diff --git a/lib/settlement/settlement_view/activity_coupon_remarks.dart b/lib/settlement/settlement_view/activity_coupon_remarks.dart index af832969..b7014d7b 100644 --- a/lib/settlement/settlement_view/activity_coupon_remarks.dart +++ b/lib/settlement/settlement_view/activity_coupon_remarks.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; +import 'package:huixiang/retrofit/data/store_info.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -24,8 +25,8 @@ class ActivityCouponRemarks extends StatefulWidget { this.promotions, this.couponCount, this.placeOrder, - this.remark, - this.editRemark, + this.remark, + this.editRemark, ); @override @@ -35,7 +36,6 @@ class ActivityCouponRemarks extends StatefulWidget { } class _ActivityCouponRemarks extends State { - @override Widget build(BuildContext context) { return Container( @@ -51,7 +51,7 @@ class _ActivityCouponRemarks extends State { ], borderRadius: BorderRadius.circular(8), ), - height: 122.h / (!widget.placeOrder ? 2 : 1), + // height: 122.h / (!widget.placeOrder ? 2 : 1), margin: EdgeInsets.only( left: 16, right: 16, @@ -67,19 +67,17 @@ class _ActivityCouponRemarks extends State { mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.center, children: [ - if (widget.placeOrder) - InkWell( - onTap: () { - widget.activityCart(); - }, - child: Row( + if (widget.placeOrder && widget?.settleOrderInfo?.benefitDiscountAmount != null && widget?.settleOrderInfo?.benefitDiscountAmount != "0") + Container( + margin:EdgeInsets.only(bottom: 13), + child:Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( flex: 1, child: Text( - S.of(context).huodong, + "会员优惠金额", style: TextStyle( fontWeight: MyFontWeight.regular, fontSize: 14.sp, @@ -88,7 +86,7 @@ class _ActivityCouponRemarks extends State { ), ), Text( - activityText(), + widget.settleOrderInfo.benefitDiscountAmount, textAlign: TextAlign.end, style: TextStyle( fontSize: 14.sp, @@ -96,57 +94,89 @@ class _ActivityCouponRemarks extends State { fontWeight: MyFontWeight.semi_bold, ), ), - Icon( - Icons.keyboard_arrow_right, - size: 16, - ), ], ), ), if (widget.placeOrder) - SizedBox( - height: 13, - ), + InkWell( + onTap: () { + widget.activityCart(); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 1, + child: Text( + S.of(context).huodong, + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 14.sp, + color: Color(0xFF353535), + ), + ), + ), + Text( + activityText(), + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF32A060), + fontWeight: MyFontWeight.semi_bold, + ), + ), + Icon( + Icons.keyboard_arrow_right, + size: 16, + ), + ], + ), + ), if (widget.placeOrder) - InkWell( - onTap: () { - widget.couponCart(); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Expanded( - flex: 1, - child: Text( - S.of(context).youhuiquan, + SizedBox( + height: 13, + ), + if (widget.placeOrder) + InkWell( + onTap: () { + widget.couponCart(); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 1, + child: Text( + S.of(context).youhuiquan, + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 14.sp, + color: Color(0xFF353535), + ), + ), + ), + Text( + couponText(), + textAlign: TextAlign.end, style: TextStyle( - fontWeight: MyFontWeight.regular, fontSize: 14.sp, - color: Color(0xFF353535), + color: Color(0xFF32A060), + fontWeight: MyFontWeight.semi_bold, ), ), - ), - Text( - couponText(), - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF32A060), - fontWeight: MyFontWeight.semi_bold, + Icon( + Icons.keyboard_arrow_right, + size: 16, ), - ), - Icon( - Icons.keyboard_arrow_right, - size: 16, - ), - ], + ], + ), ), - ), if (widget.placeOrder) - SizedBox( - height: 13, - ), + SizedBox( + height: 13, + ), InkWell( onTap: () { widget.editRemark(); @@ -166,15 +196,17 @@ class _ActivityCouponRemarks extends State { ), ), ), - Expanded(child:Text( - widget.remark, - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF353535), - fontWeight: MyFontWeight.semi_bold, + Expanded( + child: Text( + widget.remark, + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 14.sp, + color: Color(0xFF353535), + fontWeight: MyFontWeight.semi_bold, + ), ), - ),), + ), Icon( Icons.keyboard_arrow_right, size: 16, @@ -191,7 +223,8 @@ class _ActivityCouponRemarks extends State { String promotion = ""; if (widget.promotions == null || widget.promotions == "") { promotion = "未选择任何活动"; - if (widget.settleOrderInfo == null || widget.settleOrderInfo.promotionInfoList == null) { + if (widget.settleOrderInfo == null || + widget.settleOrderInfo.promotionInfoList == null) { promotion = "暂无可选活动"; } else if (widget.coupons != null && widget.coupons != "") { promotion = "活动与优惠券不可同享"; @@ -206,7 +239,8 @@ class _ActivityCouponRemarks extends State { String coupon = ""; if (widget.coupons == null || widget.coupons == "") { coupon = "未选择任何优惠券"; - if (widget.settleOrderInfo == null || widget.settleOrderInfo.couponList == null) { + if (widget.settleOrderInfo == null || + widget.settleOrderInfo.couponList == null) { coupon = "暂无可选优惠券"; } else if (widget.promotions != null && widget.promotions != "") { coupon = "优惠券与活动不可同享"; diff --git a/lib/utils/flutter_utils.dart b/lib/utils/flutter_utils.dart index 95a524be..d9b016bc 100644 --- a/lib/utils/flutter_utils.dart +++ b/lib/utils/flutter_utils.dart @@ -29,6 +29,12 @@ class AppUtils { return exp.hasMatch(mobile); } + static String phoneEncode(String phone){ + if(phone == null || phone.length != 11) + return phone; + return phone.substring(0,3) + "****" + phone.substring(phone.length-4); + } + static double textScale(context) { double textScaleFactor = MediaQuery.of(context).textScaleFactor; // print("textScaleFactor: $textScaleFactor"); diff --git a/lib/view_widget/badge_attainment_dialog.dart b/lib/view_widget/badge_attainment_dialog.dart new file mode 100644 index 00000000..e093c7c5 --- /dev/null +++ b/lib/view_widget/badge_attainment_dialog.dart @@ -0,0 +1,104 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/utils/flutter_utils.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/round_button.dart'; + +import 'custom_image.dart'; +import 'my_appbar.dart'; + +class BadgeAttainmentDialog extends StatefulWidget { + + @override + State createState() { + return _BadgeAttainmentDialog(); + } + +} + +class _BadgeAttainmentDialog extends State { + Widget build(BuildContext context) { + return Scaffold( + backgroundColor:Colors.transparent, + appBar: MyAppBar( + title:"", + titleColor: Colors.white, + leadingColor: Colors.white, + background: Colors.transparent, + ), + body: Container( + alignment:Alignment.center, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "恭喜您解锁新成就", + style: TextStyle( + color: Color(0xFFFFFFFF), + fontSize: 20.sp, + fontWeight: MyFontWeight.regular, + ), + ), + MImage( + "assets/image/by_badge.png", + width: 248, + height: 248, + // fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + Text( + "累计消费¥500", + style: TextStyle( + color: Color(0xFFFFFFFF), + fontSize: 24.sp, + fontWeight: MyFontWeight.semi_bold, + ), + ), + Text( + "获得消费白银徽章", + style: TextStyle( + color: Color(0xFFFFFFFF), + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + ), + ), + Container( + margin: EdgeInsets.only(top:16), + width: 76, + height: 26.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(18), + color: Colors.white, + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + "assets/image/icon_gold_coin.png", + width: 20, + height: 20, + ), + Text( + "+10", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF634815), + ), + ), + ], + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/view_widget/cupertino_date_picker.dart b/lib/view_widget/cupertino_date_picker.dart index ae9f77cd..08994d87 100644 --- a/lib/view_widget/cupertino_date_picker.dart +++ b/lib/view_widget/cupertino_date_picker.dart @@ -65,7 +65,7 @@ class CupertinoDatePickerWidget extends StatelessWidget { height: 2.h, color: Color(0xFFF4F4F4), ), - Container( + Expanded(child:Container( height: 200.h, child: CupertinoDatePicker( mode: CupertinoDatePickerMode.date, @@ -77,7 +77,7 @@ class CupertinoDatePickerWidget extends StatelessWidget { dateTime = data; }, ), - ), + ),), ], ), ); diff --git a/lib/view_widget/item_input_widget.dart b/lib/view_widget/item_input_widget.dart index 336cdfb6..265a9ca1 100644 --- a/lib/view_widget/item_input_widget.dart +++ b/lib/view_widget/item_input_widget.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/retrofit/data/vip_benefit_list.dart'; import 'package:huixiang/utils/font_weight.dart'; class ItemInputWidget extends StatelessWidget { @@ -15,7 +16,7 @@ class ItemInputWidget extends StatelessWidget { final Function(String value) onChanged; final Function() onTap; - + final double discount; final int inputLimit; final bool isShowBtn; @@ -41,6 +42,7 @@ class ItemInputWidget extends StatelessWidget { this.style = const TextStyle(), this.radius = 4, this.onTap, + this.discount, this.textInputType, this.errorText = "", this.errorTextColor = const Color(0xFFFF441A), @@ -68,30 +70,60 @@ class ItemInputWidget extends StatelessWidget { ); return Container( - margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 12.h, bottom: 4.h), + // margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 12.h, bottom: 4.h), padding: padding, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Color(0x000000).withAlpha(25), - offset: Offset(0, 1), - blurRadius: 12.0, - ), - ], - color: Colors.white, - borderRadius: BorderRadius.circular(radius), - ), + color: Colors.white, + // decoration: BoxDecoration( + // boxShadow: [ + // BoxShadow( + // color: Color(0x000000).withAlpha(25), + // offset: Offset(0, 1), + // blurRadius: 12.0, + // ), + // ], + // color: Colors.white, + // borderRadius: BorderRadius.circular(radius), + // ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - title, - style: TextStyle( - fontSize: 14.sp, - fontWeight: FontWeight.bold, - color: titleColor, - ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + title, + style: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.bold, + color: titleColor, + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + width: 85, + height: 20.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(9), + topRight: Radius.circular(9), + bottomLeft: Radius.circular(0), + bottomRight: Radius.circular(9), + ), + color: Color(0xFF32A060), + ), + child: Text( + "当前折扣:${discount.toString()}折", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ), + ], ), SizedBox( height: 5.h, diff --git a/lib/view_widget/mine_vip_view.dart b/lib/view_widget/mine_vip_view.dart index cba749ac..ee114bc4 100644 --- a/lib/view_widget/mine_vip_view.dart +++ b/lib/view_widget/mine_vip_view.dart @@ -32,7 +32,7 @@ class MineVipView extends StatelessWidget { }); String topLeft = ""; - String levelText = ""; + String levelText = "普通用户"; @override Widget build(BuildContext context) { @@ -58,7 +58,6 @@ class MineVipView extends StatelessWidget { } else { topLeft = S.of(context).zanweikaitong; } - switch (vipLevel) { case 1: { @@ -220,7 +219,7 @@ class MineVipView extends StatelessWidget { // : "${S.of(context).jifen_(rankMax - rank)} ${S.of(context).daoxiayidengji}", rank > rankMax ? S.of(context).dangqiandengji - : "消费¥20000 升级为金卡", + : "消费¥${rankMax - rank}元 ${S.of(context).daoxiayidengji}", overflow: TextOverflow.ellipsis, style: TextStyle( color: textColor, @@ -316,8 +315,9 @@ class MineVipView extends StatelessWidget { Navigator.of(context) .pushNamed('/router/mine_vip_core', arguments: { "rankLevel": curLevel, + "userInfo":userInfo.masterCardRankName, "createTime": (userInfo != null) ? "${userInfo.createTime}" : "", - "points": (userInfo != null) ? int.tryParse(userInfo.points) : 0, + "expendAmount": (userInfo != null) ? int.tryParse(userInfo.expendAmount) : 0, }); }); } diff --git a/lib/view_widget/vip_dialog.dart b/lib/view_widget/vip_dialog.dart index 7bf6c27a..5e3d5bf7 100644 --- a/lib/view_widget/vip_dialog.dart +++ b/lib/view_widget/vip_dialog.dart @@ -1,10 +1,55 @@ +import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/vip_benefit_list.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:shared_preferences/shared_preferences.dart'; -class VipDialog extends StatelessWidget { - int listCount = 9; +import 'custom_image.dart'; + +class VipDialog extends StatefulWidget { + final String vipName; + + VipDialog(this.vipName); + + @override + State createState() { + return _VipDialog(); + } +} + +class _VipDialog extends State { + ApiService apiService; + List vipBenefitList = []; + + @override + void initState() { + super.initState(); + + SharedPreferences.getInstance().then((value) { + apiService = + ApiService(Dio(), context: context, token: value.getString("token")); + queryBenefitList(); + }); + } + + ///会员权益列表 + 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(); + } @override Widget build(BuildContext context) { @@ -23,48 +68,82 @@ class VipDialog extends StatelessWidget { margin: EdgeInsets.only(top: 40.h), decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.circular(8),), - child:Column( - children: [ - Container( - alignment: Alignment.center, - width:double.infinity, - height: 92, - padding: EdgeInsets.only(top: 50.h, bottom: 19.h), - decoration: BoxDecoration( - color: Colors.black, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8), - topRight: Radius.circular(8), - ),), - child:Text( - "${S.of(context).gongxinchengwei}银卡会员", - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.bold, - ), + borderRadius: BorderRadius.circular(8), + ), + child: Column( + children: [ + Container( + alignment: Alignment.center, + width: double.infinity, + height: 92, + padding: EdgeInsets.only(top: 50.h, bottom: 19.h), + decoration: BoxDecoration( + color: Colors.black, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + topRight: Radius.circular(8), ), ), - 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, - ), + child: Text( + "${S.of(context).gongxinchengwei}${widget.vipName}", + style: TextStyle( + color: Colors.white, + fontSize: 18.sp, + fontWeight: FontWeight.bold, + ), + ), + ), + 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( - margin: EdgeInsets.only(left: 32,right: 32,bottom: 20), + ), + Container( + width: MediaQuery.of(context).size.width, + height: ((((vipBenefitList == null + ? 0 + : vipBenefitList.length) ~/ + 3 + + ((vipBenefitList == null + ? 0 + : vipBenefitList + .length) % + 3 > + 0 + ? 1 + : 0)) * + 90.h) > + MediaQuery.of(context).size.height / 2 + ? MediaQuery.of(context).size.height / 2 + : (((vipBenefitList == null + ? 0 + : vipBenefitList.length) ~/ + 3 + + ((vipBenefitList == null + ? 0 + : vipBenefitList.length) % + 3 > + 0 + ? 1 + : 0)) * + 90.h)) + .toDouble(), + child: vipUpgrade()), + GestureDetector( + onTap: () { + Navigator.of(context) + .pushNamed('/router/legal_right_details', arguments: { + "vipBenefitList": vipBenefitList, + }); + }, + child: Container( + margin: EdgeInsets.only(left: 32, right: 32, bottom: 20), decoration: BoxDecoration( gradient: new LinearGradient( begin: Alignment.centerLeft, @@ -87,8 +166,9 @@ class VipDialog extends StatelessWidget { ), ), ), - ], - ), + ), + ], + ), ), Image.asset( "assets/image/vip_yk.png", @@ -105,30 +185,28 @@ class VipDialog extends StatelessWidget { ///会员升级权益列表 Widget vipUpgrade() { return GridView.builder( - itemCount:listCount, + itemCount: vipBenefitList == null ? 0 : vipBenefitList.length, shrinkWrap: true, physics: BouncingScrollPhysics(), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( //一行的Widget数量 - crossAxisCount:3, + crossAxisCount: 3, //水平子Widget之间间距 - crossAxisSpacing:0, + crossAxisSpacing: 0, //垂直子Widget之间间距 mainAxisSpacing: 0, childAspectRatio: 1.5, ), itemBuilder: (context, index) { return GestureDetector( - onTap: () { - // Navigator.of(context).pushNamed('/router/legal_right_details', arguments: {}); - }, - child: vipUpgradeItem(), + onTap: () {}, + child: vipUpgradeItem(vipBenefitList[index]), ); }, ); } - Widget vipUpgradeItem() { + Widget vipUpgradeItem(VipBenefitList vipBenefitList) { return Container( alignment: Alignment.center, child: Column( @@ -136,57 +214,77 @@ class VipDialog extends StatelessWidget { 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", - width: 36, - height: 36, - fit: BoxFit.cover, - ), + MImage( + vipBenefitList?.icon ?? "", + width: 36, + height: 36, + // fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", ), - Container( - decoration: new BoxDecoration( - color: Color(0xFFA29E9E), - borderRadius: BorderRadius.circular(7.0), + if (!vipBenefitList.actived) + 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, + ), + ), + ], + ), ), - 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(0xFF181818), - 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, @@ -200,5 +298,4 @@ class VipDialog extends StatelessWidget { ), ); } - -} \ No newline at end of file +} From 2afde85a5aa7accfbb468cb00aec830a6b89c12c Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Tue, 30 Nov 2021 11:49:04 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=96=87=E7=AB=A0=E5=90=88=E9=9B=86?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0;=20=E7=A7=AF=E5=88=86=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=AE=A2=E5=8D=95=E6=8E=A5=E5=8F=A3=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=A2=9E=E5=8A=A0;=20=E4=BC=9A=E5=91=98=E6=9D=83?= =?UTF-8?q?=E7=9B=8A=E8=AF=A6=E6=83=85=E7=82=B9=E5=87=BB=E6=9B=B4=E6=94=B9?= =?UTF-8?q?;=20=E6=88=90=E5=B0=B1=E5=BC=B9=E7=AA=97=E5=AE=9E=E4=BD=93?= =?UTF-8?q?=E7=B1=BB=E6=9B=B4=E6=94=B9,=E5=A2=9E=E5=8A=A0=E5=A5=96?= =?UTF-8?q?=E5=8A=B1=E5=88=97=E8=A1=A8;=20=E4=BC=9A=E5=91=98=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E6=A0=B7=E5=BC=8F=E6=9B=B4=E6=94=B9;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/address/edit_address_page.dart | 5 +- lib/article/hot_article_item.dart | 107 ++- lib/community/community_page.dart | 4 +- .../community_view/class_details.dart | 1 - lib/community/community_view/home_class.dart | 1 - lib/community/headlines/article_list.dart | 176 ++++ lib/community/headlines/article_page.dart | 239 +++++ lib/community/headlines/headlines_banner.dart | 119 +++ .../headlines/headlines_collection.dart | 166 ++++ .../headlines/headlines_column_details.dart | 344 +++++++ lib/main.dart | 4 +- lib/mine/mine_page.dart | 6 +- lib/mine/mine_vip/legal_right_details.dart | 558 ++++++------ lib/mine/mine_vip/mine_attainment_page.dart | 49 +- lib/mine/mine_vip/mine_vip_core.dart | 850 ++++++++++-------- lib/mine/mine_vip_level_page.dart | 2 +- lib/mine/recharge_page.dart | 7 - lib/order/exchange_order_page.dart | 173 ++-- lib/order/order_view/order_commodity.dart | 77 +- .../data/achievement_detail_list.dart | 203 +++-- lib/retrofit/data/headlines_list.dart | 99 ++ lib/retrofit/data/headlines_list_details.dart | 99 ++ lib/retrofit/data/order_info.dart | 5 + lib/retrofit/data/settleOrderInfo.dart | 8 + lib/retrofit/data/shoppingCart.dart | 264 ++++++ lib/retrofit/retrofit_api.dart | 19 +- lib/retrofit/retrofit_api.g.dart | 69 +- lib/settlement/settlement.dart | 3 +- lib/store/store_order.dart | 20 +- lib/view_widget/item_input_widget.dart | 2 +- lib/view_widget/mine_vip_view.dart | 16 +- lib/view_widget/receiving_method_dialog.dart | 131 +++ lib/view_widget/vip_dialog.dart | 4 +- 33 files changed, 2915 insertions(+), 915 deletions(-) create mode 100644 lib/community/headlines/article_list.dart create mode 100644 lib/community/headlines/article_page.dart create mode 100644 lib/community/headlines/headlines_banner.dart create mode 100644 lib/community/headlines/headlines_collection.dart create mode 100644 lib/community/headlines/headlines_column_details.dart create mode 100644 lib/retrofit/data/headlines_list.dart create mode 100644 lib/retrofit/data/headlines_list_details.dart create mode 100644 lib/view_widget/receiving_method_dialog.dart diff --git a/lib/address/edit_address_page.dart b/lib/address/edit_address_page.dart index b7e550f5..a89c5c57 100644 --- a/lib/address/edit_address_page.dart +++ b/lib/address/edit_address_page.dart @@ -82,7 +82,7 @@ class _EditAddressPage extends State { bottomRight: Radius.circular(8), ), ), - child: Column( + child: Expanded(child:Column( children: [ editItem( S.of(context).xingming, @@ -114,7 +114,8 @@ class _EditAddressPage extends State { houseNumberController, false), ], - ), + ),), + ), InkWell( onTap: () { diff --git a/lib/article/hot_article_item.dart b/lib/article/hot_article_item.dart index da2e7b54..921bb401 100644 --- a/lib/article/hot_article_item.dart +++ b/lib/article/hot_article_item.dart @@ -1,26 +1,31 @@ import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/article.dart'; +import 'package:huixiang/retrofit/data/banner.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/hot_item.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_footer.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -class HotArticlePage extends StatefulWidget { +class TouTiao extends StatefulWidget { @override State createState() { - return _HotArticlePage(); + return _TouTiao(); } } -class _HotArticlePage extends State { +class _TouTiao extends State { ApiService apiService; + List bannerData = []; @override void dispose() { @@ -33,9 +38,9 @@ class _HotArticlePage extends State { super.initState(); SharedPreferences.getInstance().then((value) => { - apiService = ApiService(Dio(), context: context, token: value.getString("token")), - queryArticle(), - }); + apiService = ApiService(Dio(), context: context, token: value.getString("token")), + queryArticle(), + }); } int pageNum = 1; @@ -78,6 +83,33 @@ class _HotArticlePage extends State { } } + ///banner + queryCourseBanner() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData> baseData = + await apiService.queryBanner({ + "model": {"type": "COURSE_BANNER"}, + }).catchError((onError) { + refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + bannerData.clear(); + bannerData.addAll(baseData.data.records); + refreshController.refreshCompleted(); + } else { + refreshController.refreshFailed(); + // SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + EasyLoading.dismiss(); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -89,35 +121,40 @@ class _HotArticlePage extends State { // titleSize: 18.sp, // ), body: Container( - child: SmartRefresher( - controller: refreshController, - enablePullDown: true, - enablePullUp: true, - physics: BouncingScrollPhysics(), - header: MyHeader(), - footer: CustomFooter( - builder: (context, mode) { - return MyFooter(mode); - }, - ), - onRefresh: _onRefresh, - onLoading: queryArticle, - child: ListView.builder( - itemCount: articles.length, - physics: NeverScrollableScrollPhysics(), - scrollDirection: Axis.vertical, - itemBuilder: (context, position) { - return AspectRatio( - aspectRatio: position == 0 ? 1.38 : 2.56, - child: Container( - height: position == 0 ? 247.h : 96.h, - margin: EdgeInsets.symmetric(vertical:6.h, horizontal: 16.w), - child: - HotArticleItem(article: articles[position], isHot: position == 0), - ), - ); - }, - ), + child: Column( + children: [ + + SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: true, + physics: BouncingScrollPhysics(), + header: MyHeader(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: _onRefresh, + onLoading: queryArticle, + child: ListView.builder( + itemCount: articles.length, + physics: NeverScrollableScrollPhysics(), + scrollDirection: Axis.vertical, + itemBuilder: (context, position) { + return AspectRatio( + aspectRatio: position == 0 ? 1.38 : 2.56, + child: Container( + height: position == 0 ? 247.h : 96.h, + margin: EdgeInsets.symmetric(vertical:6.h, horizontal: 16.w), + child: + HotArticleItem(article: articles[position], isHot: position == 0), + ), + ); + }, + ), + ), + ], ), ), ); diff --git a/lib/community/community_page.dart b/lib/community/community_page.dart index a67e7df8..399124ff 100644 --- a/lib/community/community_page.dart +++ b/lib/community/community_page.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:huixiang/article/hot_article_item.dart'; import 'package:huixiang/community/community_child_page.dart'; import 'package:huixiang/home/huixiang_brand_page.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; @@ -8,6 +7,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/view_widget/my_tab.dart'; import 'community_course.dart'; +import 'headlines/article_page.dart'; class CommunityPage extends StatefulWidget { @override @@ -97,7 +97,7 @@ class _CommunityPage extends State if (e == "关于我们") { return BrandPage(); }else if(e == "头条"){ - return HotArticlePage(); + return ArticlePage(); }else if(e == "课程"){ return CommunityCourse(); } diff --git a/lib/community/community_view/class_details.dart b/lib/community/community_view/class_details.dart index d1e0742c..d97f7d26 100644 --- a/lib/community/community_view/class_details.dart +++ b/lib/community/community_view/class_details.dart @@ -335,7 +335,6 @@ class _ClassDetails extends State with WidgetsBindingObserver { ), flex: 1, ), - /// 富文本评论的输入框 InputComment( inputKey, diff --git a/lib/community/community_view/home_class.dart b/lib/community/community_view/home_class.dart index 937a949d..6a26b38e 100644 --- a/lib/community/community_view/home_class.dart +++ b/lib/community/community_view/home_class.dart @@ -225,7 +225,6 @@ class _HomeClass extends State { ), ), ],), - ], ), Expanded(child: diff --git a/lib/community/headlines/article_list.dart b/lib/community/headlines/article_list.dart new file mode 100644 index 00000000..8560deac --- /dev/null +++ b/lib/community/headlines/article_list.dart @@ -0,0 +1,176 @@ +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/retrofit/data/article.dart'; +import 'package:huixiang/retrofit/data/banner.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/page.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/custom_image.dart'; +import 'package:huixiang/view_widget/hot_item.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:huixiang/view_widget/my_footer.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class ArticleList extends StatefulWidget { + final List
articles; + + ArticleList(this.articles,); + + @override + State createState() { + return _ArticleList(); + } +} + +class _ArticleList extends State { + ApiService apiService; + + @override + void initState() { + super.initState(); + + SharedPreferences.getInstance().then((value) => { + apiService = ApiService(Dio(), + context: context, token: value.getString("token")), + }); + } + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.only(top:20,left:16,right: 16), + child:Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Padding(padding:EdgeInsets.only(bottom: 12), + child:Text( + "最新文章", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.medium, + color: Colors.black, + ), + )), + ListView.builder( + padding: EdgeInsets.zero, + itemCount: widget.articles.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + Navigator.of(context).pushNamed( + '/router/web_page', + arguments: {"articleId": widget.articles[position].id}); + widget.articles[position].viewers = (widget.articles[position].viewers + 1); + setState(() {}); + }, + child: articleItem(widget.articles[position],position), + ); + }, + ), + ], + )); + } + + Widget articleItem(Article articles,position) { + return Container( + width: double.infinity, + padding: EdgeInsets.all(16), + margin: EdgeInsets.only(bottom: 12), + color: Colors.white, + child:Row( + children: [ + Expanded(child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Text( + widget?.articles[position]?.mainTitle ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Colors.black, + ), + ), + SizedBox(height:5), + Text( + widget?.articles[position]?.viceTitle ?? "", + // overflow: TextOverflow.ellipsis, + // maxLines: 1, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + SizedBox(height: 10), + Row( + children: [ + Text( + (widget.articles[position] != null && + widget.articles[position].author != null) + ? widget.articles[position].author.name + : "", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF8E8E8E), + ), + ), + SizedBox(width:8), + Image.asset( + "assets/image/browse.png", + width: 14, + height: 14, + color: Color(0xFF808080), + ), + Expanded(child: Text( + "${widget?.articles[position]?.viewers}" + ?? "", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF8D8D8D), + ), + )), + Text( + widget?.articles[position]?.createTime?.split(" ")[0] + ?? "", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF8D8D8D), + ), + ), + ], + ), + ], + ),), + SizedBox(width:12), + MImage( + widget?.articles[position]?.coverImg ?? "", + fit: BoxFit.cover, + radius: BorderRadius.all(Radius.circular(2)), + width:96, + height:96, + ), + ], + ), + ); + } + +} diff --git a/lib/community/headlines/article_page.dart b/lib/community/headlines/article_page.dart new file mode 100644 index 00000000..8785cb79 --- /dev/null +++ b/lib/community/headlines/article_page.dart @@ -0,0 +1,239 @@ +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:huixiang/community/headlines/headlines_banner.dart'; +import 'package:huixiang/community/headlines/headlines_collection.dart'; +import 'package:huixiang/main.dart'; +import 'package:huixiang/retrofit/data/article.dart'; +import 'package:huixiang/retrofit/data/banner.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/brand.dart'; +import 'package:huixiang/retrofit/data/category_select_list.dart'; +import 'package:huixiang/retrofit/data/collect_class_list.dart'; +import 'package:huixiang/retrofit/data/course_list.dart'; +import 'package:huixiang/retrofit/data/headlines_list.dart'; +import 'package:huixiang/retrofit/data/headlines_list_details.dart'; +import 'package:huixiang/retrofit/data/page.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/event_type.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/view_widget/store_title_tab.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import 'article_list.dart'; + +class ArticlePage extends StatefulWidget { + @override + State createState() { + return _ArticlePage(); + } +} + +class _ArticlePage extends State + with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin { + final ScrollController scrollController = ScrollController(); + final RefreshController refreshController = RefreshController(); + + ApiService apiService; + List globaKeys = []; + List brands = []; + List bannerData = []; + List
articles = []; + List headlines = []; + int pageNum = 1; + + @override + void initState() { + super.initState(); + + eventBus.on().listen((event) { + print("object: ArticlePage"); + if (event.type < 3) { + setState(() {}); + } + }); + queryArticleList(); + queryHeadlinesBanner(); + queryHeadlinesList(); + } + + @override + void dispose() { + super.dispose(); + refreshController.dispose(); + } + + ///banner + queryHeadlinesBanner() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData> baseData = + await apiService.queryBanner({ + "model": {"type": "INFORMATION"}, + }).catchError((onError) { + refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + bannerData.clear(); + bannerData.addAll(baseData.data.records); + refreshController.refreshCompleted(); + } else { + refreshController.refreshFailed(); + // SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + EasyLoading.dismiss(); + } + + ///文章列表 + queryArticleList() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData> baseData = await apiService.queryArticle({ + "pageNum": pageNum, + "pageSize": 10, + "searchKey": "", + "state": 1, + "type": 2 + }).catchError((onError){ + refreshController.refreshFailed(); + refreshController.loadFailed(); + }); + if (baseData != null && baseData.isSuccess) { + refreshController.refreshCompleted(); + refreshController.loadComplete(); + if(pageNum == 1) { + articles.clear(); + } + articles.addAll(baseData.data.list); + if (baseData.data.pageNum == baseData.data.pages) { + refreshController.loadNoData(); + } else { + pageNum += 1; + } + setState(() {}); + } else { + refreshController.refreshFailed(); + refreshController.loadFailed(); + } + } + + ///文章合集列表 + queryHeadlinesList() async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData> baseData = await apiService.headlinesList().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + setState(() { + headlines.clear(); + headlines.addAll(baseData.data); + headlines.forEach((element) { + // collectCourse(element.id); + }); + }); + } + EasyLoading.dismiss(); + } + + _onRefresh(){ + queryHeadlinesBanner(); + queryHeadlinesList();//分类列表 + } + + @override + Widget build(BuildContext context) { + super.build(context); + return + Stack( + children: [ + Positioned( + child: Container( + child: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + physics: ClampingScrollPhysics(), + onRefresh: _onRefresh, + scrollController: scrollController, + child: Container( + child: SingleChildScrollView( + physics: NeverScrollableScrollPhysics(), + child: Container( + color: Color(0xFFF7F7F7), + margin: EdgeInsets.only(top: 16.h), + child: Column( + children: classChildItem(), + ), + ), + ), + ), + ), + ), + bottom:0, + top: 0, + left: 0, + right: 0, + ), + if (brands != null && brands.length > 0) + Positioned( + child: Container( + color: Colors.white, + child: StoreTitleTab( + brands, + globaKeys, + scrollController, + isScroll: true, + ), + ), + top: 0, + left: 0, + right: 0, + ), + ], + ); + } + + List classChildItem() { + var widgets = [ + ///课程banner + HeadlinesBanner(bannerData,), + + SizedBox(height: 28), + + ///头条合集列表 + HeadlinesCollection(headlines,articles), + + ///文章列表 + ArticleList(articles), + + + ]; + + return widgets; + } + + @override + bool get wantKeepAlive => true; +} diff --git a/lib/community/headlines/headlines_banner.dart b/lib/community/headlines/headlines_banner.dart new file mode 100644 index 00000000..09a7401b --- /dev/null +++ b/lib/community/headlines/headlines_banner.dart @@ -0,0 +1,119 @@ + +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:flutter_swiper/flutter_swiper.dart'; +import 'package:huixiang/retrofit/data/banner.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/page.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; + +class HeadlinesBanner extends StatefulWidget { + + final List bannerData; + + HeadlinesBanner(this.bannerData); + + @override + State createState() { + return _HeadlinesBanner(); + } + +} + +class _HeadlinesBanner extends State { + ApiService apiService; + final RefreshController refreshController = RefreshController(); + List bannerData = []; + + + @override + Widget build(BuildContext context) { + return Container( + child: AspectRatio( + aspectRatio: 2.08, + child: Swiper( + viewportFraction: 0.88, + scale: 0.93, + pagination: SwiperPagination( + alignment: Alignment.bottomCenter, + builder: DotSwiperPaginationBuilder( + size: 8, + activeSize: 8, + space: 5, + activeColor: Colors.black, + color: Colors.black.withAlpha(76), + ), + ), + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return InkWell( + onTap: () { + bannerClick(widget.bannerData[position]); + }, + child: MImage( + (widget.bannerData != null && position < widget.bannerData.length) + ? widget.bannerData[position].imgUrl + : "", + fit: BoxFit.cover, + radius: BorderRadius.circular(8), + errorSrc: "assets/image/default_2_1.png", + fadeSrc: "assets/image/default_2_1.png", + ), + ); + }, + itemCount: (widget.bannerData != null && widget.bannerData.length > 0) + ? widget.bannerData.length + : 1), + ), + ); + } + + /// contentType 跳转类型(0:不跳转,1:积分商品,2:活动,3:文章,4:页面跳转,5:课程) + bannerClick(BannerData bannerData) async { + switch (bannerData.contentType) { + case 1: + Navigator.of(context).pushNamed('/router/integral_store_page', + arguments: {"goodsId": bannerData.content}); + break; + case 2: + Navigator.of(context) + .pushNamed('/router/web_page', arguments: { + "activityId": bannerData.content, + }); + break; + case 3: + Navigator.of(context) + .pushNamed('/router/web_page', arguments: { + "articleId": bannerData.content, + }); + break; + case 4: + String router = bannerData.content; + if (router.contains("?")) { + String params = router.substring(router.indexOf("?")); + params = params.replaceAll("?", ""); + Map map = jsonDecode(params); + Navigator.of(context).pushNamed(router, arguments: map); + } else { + Navigator.of(context).pushNamed(router); + } + break; + case 5: + Navigator.of(context) + .pushNamed('/router/class_details', arguments: { + "id": bannerData.content, + }); + break; + } + } +} + + + + + + + diff --git a/lib/community/headlines/headlines_collection.dart b/lib/community/headlines/headlines_collection.dart new file mode 100644 index 00000000..c14f1bbd --- /dev/null +++ b/lib/community/headlines/headlines_collection.dart @@ -0,0 +1,166 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; +import 'package:huixiang/retrofit/data/article.dart'; +import 'package:huixiang/retrofit/data/collect_class_list.dart'; +import 'package:huixiang/retrofit/data/course_list.dart'; +import 'package:huixiang/retrofit/data/headlines_list.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class HeadlinesCollection extends StatefulWidget { + final List headlines; + final List
articles; + + HeadlinesCollection(this.headlines,this.articles); + + @override + State createState() { + return _HeadlinesCollection(); + } +} + +class _HeadlinesCollection extends State { + ApiService apiService; + BMFCoordinate latLng; + + final TextEditingController editingController = TextEditingController(); + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Container( + height: 100, + margin: EdgeInsets.only(top:10), + child: ListView.builder( + scrollDirection: Axis.horizontal, + physics: BouncingScrollPhysics(), + padding: EdgeInsets.symmetric(horizontal: 10), + itemCount:widget.headlines == null ? 0 : widget.headlines.length, + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + Navigator.of(context).pushNamed( + '/router/headlines_column_details', + arguments: {"id":widget.headlines[position].id, + "articles":widget.articles}); + }, + child: headlinesCollectionItem(widget.headlines[position]), + ); + }, + ), + ); + } + + Widget headlinesCollectionItem(HeadlinesList headlines) { + return Container( + width: 225.w, + height:110.h, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(10), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ], + color: Colors.black, + ), + margin: EdgeInsets.symmetric( + horizontal:6, + ), + child: Stack( + children: [ + ClipRRect( + child: Opacity( + opacity: 0.8, + child: MImage( + headlines?.coverImg ?? "", + width: 225.w, + height: 110.h, + fit: BoxFit.fill, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + ), + borderRadius: BorderRadius.vertical( + top: Radius.circular(4), + ), + ), + Container( + padding: EdgeInsets.all(12), + child: Column(children: [ + Expanded(child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( + margin: EdgeInsets.only(right:4), + padding:EdgeInsets.only(left:2,right:2), + height: 16.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(2), + color: Color(0xFF32A060), + ), + child: Text( + "专栏", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ), + Expanded(child:Text( + headlines?.name ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.white, + ), + ),), + ],)), + Row( + children: [ + Expanded(child:Text( + "更新3篇", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + )), + Text( + "查看专栏", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Colors.white, + ), + ), + SizedBox(width: 2), + Image.asset( + "assets/image/t_right.png", + width: 14, + height: 14, + ), + ],), + ],), + ), + ], + ), + ); + } +} diff --git a/lib/community/headlines/headlines_column_details.dart b/lib/community/headlines/headlines_column_details.dart new file mode 100644 index 00000000..c15bb927 --- /dev/null +++ b/lib/community/headlines/headlines_column_details.dart @@ -0,0 +1,344 @@ +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:huixiang/retrofit/data/article.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/headlines_list.dart'; +import 'package:huixiang/retrofit/data/headlines_list_details.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +class HeadlinesColumnDetails extends StatefulWidget { + final Map arguments; + + HeadlinesColumnDetails({this.arguments}); + + @override + State createState() { + return _HeadlinesColumnDetails(); + } +} + +class _HeadlinesColumnDetails extends State + with WidgetsBindingObserver { + ApiService apiService; + List
articles; + HeadlinesListDetails headlinesListDetails; + List headlines = []; + + @override + void initState() { + super.initState(); + articles = widget.arguments["articles"]; + WidgetsBinding.instance.addObserver(this); + queryHeadlinesDetails(widget.arguments["id"]); + queryHeadlinesList(widget.arguments["id"]); + } + + ///文章合集详情 + queryHeadlinesDetails(id) async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData baseData = + await apiService.headlinesDetails(id).catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + setState(() { + headlinesListDetails = baseData.data; + }); + } + } + + ///文章合集列表 + queryHeadlinesList(id) async { + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + } + BaseData> baseData = await apiService.headlinesList().catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + setState(() { + headlines.clear(); + headlines.addAll(baseData.data); + headlines.forEach((element) { + // collectCourse(element.id); + }); + }); + } + EasyLoading.dismiss(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Container( + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + children: [ + Stack( + alignment: Alignment.bottomCenter, + children: [ + Stack( + children: [ + Positioned(child: + MImage( + headlinesListDetails?.coverImg ?? "", + width:double.infinity, + height: 260.h, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + ), + Container( + margin: EdgeInsets.only( + top: 50.h, left: 16.w, right: 16.w), + decoration: BoxDecoration( + color: Colors.transparent, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + child: Image.asset( + "assets/image/integral_return.png", + width: 24, + height: 24, + ), + onTap: () { + Navigator.of(context).pop(); + }, + ), + ], + ), + ), + ], + ), + Container( + child: Column( + children: [ + Padding(padding:EdgeInsets.only(left: 16), + child:Row( + children: [ + Container( + margin: EdgeInsets.only(right:4), + padding:EdgeInsets.only(left:2,right:2), + height:20.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(2), + color: Color(0xFF32A060), + ), + child: Text( + "专栏", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ), + SizedBox( + width: 6.w, + ), + Expanded( + child: Text( + headlinesListDetails?.name ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.white, + ), + ), + flex: 1, + ) + ], + ),), + Container( + width: double.infinity, + decoration: BoxDecoration( + border: Border.all( + width: 0, + color: Colors.white, + ), + color: Colors.white, + borderRadius: new BorderRadius.only( + topLeft: Radius.circular(8.0), + topRight: Radius.circular(8.0), + ), + ), + margin: EdgeInsets.only(top: 16), + // padding: EdgeInsets.all(16), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding(padding:EdgeInsets.all(16), + child: Text( + "简介:${headlinesListDetails?.introduce ?? ""}", + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium , + color: Colors.black, + ), + )), + ], + ), + ), + ], + ), + ), + ], + ), + ListView.builder( + padding: EdgeInsets.zero, + itemCount:headlines == null ? 0 : headlines.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + Navigator.of(context).pushNamed( + '/router/web_page', + arguments: {"articleId": articles[position].id}); + articles[position].viewers = (articles[position].viewers + 1); + setState(() {} + ); + }, + child: articleColumnItem(articles[position]), + ); + }, + ), + ], + ), + ), + flex: 1, + ), + ], + ), + ), + ); + } + + Widget articleColumnItem(Article articles) { + return Container( + width: double.infinity, + // padding: EdgeInsets.all(16), + color: Colors.white, + child:Column( + children: [ + Container( + // margin: EdgeInsets.only(top: 16,bottom: 16), + width: double.infinity, + height: 0.5.h, + color: Color(0xFFF5F5F5), + ), + Padding(padding: EdgeInsets.all(16), + child:Row( + children: [ + Expanded(child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Text( + articles?.mainTitle ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 1, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Colors.black, + ), + ), + SizedBox(height:5), + Text( + articles?.viceTitle ?? "", + // overflow: TextOverflow.ellipsis, + // maxLines: 1, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF353535), + ), + ), + SizedBox(height: 10), + Row( + children: [ + Text( + (articles != null && + articles.author != null) + ? articles.author.name + : "", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF8E8E8E), + ), + ), + SizedBox(width:8), + Image.asset( + "assets/image/browse.png", + width: 14, + height: 14, + color: Color(0xFF808080), + ), + Expanded(child: Text( + "${articles?.viewers}" + ?? "", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF8D8D8D), + ), + )), + Text( + articles?.createTime ?? "", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF8D8D8D), + ), + ), + ], + ), + ], + ),), + SizedBox(width:12), + MImage( + articles?.coverImg ?? "", + fit: BoxFit.cover, + radius: BorderRadius.all(Radius.circular(2)), + width:96, + height:96, + ), + ], + )), + ], + ), + ); + } +} diff --git a/lib/main.dart b/lib/main.dart index 2d7f74fa..c5af21f7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -71,6 +71,7 @@ import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; import 'community/community_view/class_details.dart'; +import 'community/headlines/headlines_column_details.dart'; import 'home/guide_page.dart'; import 'home/home_view/activity_list.dart'; import 'main_page.dart'; @@ -298,7 +299,7 @@ Map routers = { '/router/founder_story_page': (context, {arguments}) => FounderStoryPage(), '/router/system_msg_page': (context, {arguments}) => SystemMessagePage(), '/router/edit_remarks_page': (context, {arguments}) => EditRemarksPage(), - '/router/hot_article_page': (context, {arguments}) => HotArticlePage(), + // '/router/hot_article_page': (context, {arguments}) => HotArticlePage(), '/router/address_map_page': (context, {arguments}) => AddressMapPage(), '/router/roll_center_page': (context, {arguments}) => RollCenterPage(), '/router/release_dynamic': (context, {arguments}) => ReleaseDynamic(), @@ -324,4 +325,5 @@ Map routers = { '/router/activity_list': (context, {arguments}) => ActivityList(), '/router/class_details': (context, {arguments}) => ClassDetails(arguments: arguments), '/router/mine_attainment_page': (context, {arguments}) => MineAttainmentPage(arguments: arguments), + '/router/headlines_column_details': (context, {arguments}) => HeadlinesColumnDetails(arguments: arguments), }; diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index c0e69e05..5fbcc9d8 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -196,10 +196,8 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { tag: "vip", ranks: ranks, userInfo: userInfo, - rank: (userInfo != null) - ? int.tryParse(userInfo.expendAmount) - : 0, - rankMax: userInfo?.memberRankVo?.rankOrigin??0, + rank: double.tryParse(userInfo?.expendAmount??"0").toInt(), + rankMax: userInfo?.memberRankVo?.nextOrigin??0, createTime: userInfo?.createTime??"", ), ], diff --git a/lib/mine/mine_vip/legal_right_details.dart b/lib/mine/mine_vip/legal_right_details.dart index 6cc6eff0..89fc8c3a 100644 --- a/lib/mine/mine_vip/legal_right_details.dart +++ b/lib/mine/mine_vip/legal_right_details.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -37,6 +39,7 @@ class _LegalRightDetails extends State { int checkIndex = 0; ScrollController _scrollController = ScrollController(); List secondCardList = []; + bool offsetOnEnd = false; @override void initState() { @@ -45,7 +48,7 @@ class _LegalRightDetails extends State { apiService = ApiService(Dio(), context: context, token: value.getString("token")); }); - vipBenefitList = widget.arguments["vipBenefitList"]; + vipBenefitList.addAll(widget.arguments["vipBenefitList"]); querySecondCardList(); } @@ -59,12 +62,13 @@ class _LegalRightDetails extends State { token: value.getString("token"), ); } - BaseData> baseData = await apiService.secondCardList().catchError((onError) {}); + BaseData> baseData = + await apiService.secondCardList().catchError((onError) {}); if (baseData != null && baseData.isSuccess) { setState(() { secondCardList.clear(); secondCardList.addAll(baseData.data); - if(secondCardList.length < 5){ + if (secondCardList.length < 5) { var isSecondCard = SecondCardList(); isSecondCard.isAdd = true; secondCardList.add(isSecondCard); @@ -74,7 +78,6 @@ class _LegalRightDetails extends State { EasyLoading.dismiss(); } - ///解绑副卡 queryUnbindSecondCard(phone) async { if (apiService == null) { @@ -110,18 +113,18 @@ class _LegalRightDetails extends State { 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)), + // 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(), + physics: NeverScrollableScrollPhysics(), controller: _scrollController, shrinkWrap: true, padding: EdgeInsets.symmetric(horizontal: 10), @@ -130,9 +133,30 @@ class _LegalRightDetails extends State { 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); + if (checkIndex == position) return; + offsetOnEnd = position - checkIndex < 0 && position != 0; + int jumpIndex = (position - checkIndex).abs(); + int maxCountInWidth = + MediaQuery.of(context).size.width ~/ 80; + int tempPosition = checkIndex; + for (var i = 0; i < jumpIndex; i++) { + if (position - checkIndex < 0) + tempPosition -= 1; + else + tempPosition += 1; + checkIndex = tempPosition; + if (tempPosition <= + vipBenefitList.length - maxCountInWidth) { + if (tempPosition != 0) + _scrollController.jumpTo((_scrollController.offset + + (offsetOnEnd ? -85 : 85)) + .toDouble()); + } else { + _scrollController.jumpTo( + ((vipBenefitList.length - maxCountInWidth) * 85) + .toDouble()); + } + } }); }, child: legalRightItem(vipBenefitList[position], position), @@ -140,28 +164,8 @@ class _LegalRightDetails extends State { }, ), ), - Container( - alignment: Alignment.center, - 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, - ), - ), - Expanded(child: Container( - padding: EdgeInsets.only(left: 16, right: 49), + Expanded( + child: Container( decoration: BoxDecoration( border: Border.all( width: 0, @@ -244,82 +248,48 @@ class _LegalRightDetails extends State { ), ], ), - 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: 20, - ), - Text( - S.of(context).quanyishuoming, - style: TextStyle( - fontWeight: MyFontWeight.semi_bold, - fontSize: 14.sp, - color: Color(0xFF674119), - ), - ), - 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), - ), - }, - customImageRenders: { - networkSourceMatcher(): networkImageRender( - loadingWidget: () { - return Container(); - }, - ), - }, - ), - ), - SizedBox( - height: 20, - ), - if(vipBenefitList[checkIndex].name == "副卡" && vipBenefitList[checkIndex].actived && vipBenefitList[checkIndex].have) Container( + padding: EdgeInsets.only(left: 16, right: 49), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "${S.of(context).yibangfuka}(${secondCardList.length - (secondCardList.length >= 5 && !(secondCardList.last.isAdd ?? false) ? 0 :1 )}/5)", + 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: 20, + ), + Text( + S.of(context).quanyishuoming, style: TextStyle( fontWeight: MyFontWeight.semi_bold, fontSize: 14.sp, @@ -329,7 +299,52 @@ class _LegalRightDetails extends State { SizedBox( height: 8, ), - assistant(), + if (vipBenefitList[checkIndex]?.describes != null && + vipBenefitList[checkIndex].describes != "") + Container( + color: Color(0xFFFFF6E9), + child: Html( + data: vipBenefitList[checkIndex]?.describes ?? "", + style: { + "html": Style( + color: Color(0xFF674119), + ), + }, + customImageRenders: { + networkSourceMatcher(): networkImageRender( + loadingWidget: () { + return Container(); + }, + ), + }, + ), + ), + SizedBox( + height: 20, + ), + if (vipBenefitList[checkIndex].name == "副卡" && + vipBenefitList[checkIndex].actived && + vipBenefitList[checkIndex].have) + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + "${S.of(context).yibangfuka}(${secondCardList.length - (secondCardList.length >= 5 && !(secondCardList.last.isAdd ?? false) ? 0 : 1)}/5)", + style: TextStyle( + fontWeight: MyFontWeight.semi_bold, + fontSize: 14.sp, + color: Color(0xFF674119), + ), + ), + SizedBox( + height: 8, + ), + assistant(), + ], + ), + ), ], ), ), @@ -432,100 +447,124 @@ class _LegalRightDetails extends State { ///权益列表 Widget legalRightItem(VipBenefitList vipBenefitList, index) { - return Opacity( - opacity: index == checkIndex ? 1 : 0.6, - child: Container( - width: 80, - alignment: Alignment.center, - child: Column( - children: [ - Stack( - alignment: Alignment.bottomCenter, + return Column( + children: [ + Expanded( + child: 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", - ), - if(!vipBenefitList.actived) - Container( - decoration: new BoxDecoration( - color: Color(0xFFA29E9E), - borderRadius: BorderRadius.circular(7.0), + Stack( + alignment: Alignment.bottomCenter, + children: [ + MImage( + vipBenefitList?.icon ?? "", + width: 50, + height: 50, + // fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", ), - width: 52.w, - height: 15.h, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - Icons.lock, - color: Color(0xFFFFDCA1), - size: 10, + if (!vipBenefitList.actived) + Container( + decoration: new BoxDecoration( + color: Color(0xFFA29E9E), + borderRadius: BorderRadius.circular(7.0), ), - Text( - "暂未开放", - style: TextStyle( - color: Color(0xFFFFDCA1), - fontWeight: MyFontWeight.regular, - fontSize: 9.sp, - ), + 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, + ), + ), + ], ), - ], - ), - ), - 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, + ), + if (!vipBenefitList.actived && !vipBenefitList.have) + Container( + decoration: new BoxDecoration( + color: Color(0xFFA29E9E), + borderRadius: BorderRadius.circular(7.0), ), - Text( - "暂未解锁", - style: TextStyle( - color: Color(0xFFFFDCA1), - fontWeight: MyFontWeight.regular, - fontSize: 9.sp, - ), + 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: 8.h, + ), + Text( + vipBenefitList.name, + 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, + ), + )), + if (index == checkIndex) + Container( + 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, + ), + ), + ], ); } @@ -534,7 +573,7 @@ class _LegalRightDetails extends State { return Column( children: [ GridView.builder( - itemCount:secondCardList == null ? 0 : secondCardList.length, + itemCount: secondCardList == null ? 0 : secondCardList.length, shrinkWrap: true, physics: NeverScrollableScrollPhysics(), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( @@ -561,73 +600,74 @@ class _LegalRightDetails extends State { Widget assistantItem(SecondCardList secondCardList) { return Container( alignment: Alignment.center, - child: !(secondCardList.isAdd ?? false) ? Column( - children: [ - Stack( - alignment: Alignment.bottomRight, - children: [ - MImage( - secondCardList?.headimg ?? "", - width: 50, - height: 50, - isCircle: true, - fit: BoxFit.cover, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", - ), - GestureDetector( - onTap: () { - setState(() { - unbindShowDeleteDialog(secondCardList.phone); - }); - }, - child: Image.asset( - "assets/image/fuka_j.png", - width: 24, - height: 24, - fit: BoxFit.cover, + child: !(secondCardList.isAdd ?? false) + ? Column( + children: [ + Stack( + alignment: Alignment.bottomRight, + children: [ + MImage( + secondCardList?.headimg ?? "", + width: 50, + height: 50, + isCircle: true, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + GestureDetector( + onTap: () { + setState(() { + unbindShowDeleteDialog(secondCardList.phone); + }); + }, + child: Image.asset( + "assets/image/fuka_j.png", + width: 24, + height: 24, + fit: BoxFit.cover, + ), + ), + ], ), - ), - ], - ), - SizedBox( - height: 5.h, - ), - Text( - AppUtils.phoneEncode(secondCardList?.phone ?? ""), - style: TextStyle( - color: Color(0xFF79572D), - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, - ), - ), - ], - ): - 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, + SizedBox( + height: 5.h, + ), + Text( + AppUtils.phoneEncode(secondCardList?.phone ?? ""), + style: TextStyle( + color: Color(0xFF79572D), + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + ), + ), + ], + ) + : 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, + ), + ), + ], ), ), - ], - ), - ), ); } } diff --git a/lib/mine/mine_vip/mine_attainment_page.dart b/lib/mine/mine_vip/mine_attainment_page.dart index 44888956..208c52b9 100644 --- a/lib/mine/mine_vip/mine_attainment_page.dart +++ b/lib/mine/mine_vip/mine_attainment_page.dart @@ -38,6 +38,7 @@ class _MineAttainmentPage extends State { int checkPosition = 0; SocialInfo infoNumber; + @override void dispose() { super.dispose(); @@ -132,7 +133,7 @@ class _MineAttainmentPage extends State { child: Scaffold( backgroundColor: Colors.transparent, appBar: MyAppBar( - title: "我的成就", + title:S.of(context).wodechengjiu, titleColor: Colors.black, titleSize: 18.sp, background: Colors.transparent, @@ -299,7 +300,7 @@ class _MineAttainmentPage extends State { return AlertDialog( content: Container( width: MediaQuery.of(context).size.width - 84, - height: 410.h, + height: 430.h, child: Column( children: [ GestureDetector( @@ -318,7 +319,8 @@ class _MineAttainmentPage extends State { ), ), MImage( - this.vipBadgesList[index].icon, + // this.vipBadgesList[index].icon, + achievementDetail[checkPosition].icon, width: 150, height: 150, fit: BoxFit.cover, @@ -360,27 +362,28 @@ class _MineAttainmentPage extends State { color: Color(0xFF515151)), ), SizedBox(width: 8), - Image.asset( - "assets/image/icon_gold_coin.png", - width: 14, - height: 14, - fit: BoxFit.cover, - ), - SizedBox(width: 4), - Text( - vipBadgesList[index].eachReward.toString(), - style: TextStyle( - fontWeight: MyFontWeight.regular, - fontSize: 12.sp, - color: Color(0xFF515151)), + Column( + crossAxisAlignment:CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: + achievementDetail[checkPosition].rewardList != null + ? achievementDetail[checkPosition].rewardList.map((e) { + return Text( + rewardStr(e), + style: TextStyle( + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + color: Color(0xFF515151)), + ); + }).toList() + : [], ), ], ), - SizedBox(height: 5), Expanded( child: Container( height: double.maxFinite, - margin: EdgeInsets.only(top: 24), + margin: EdgeInsets.only(top:14), child: ListView.builder( shrinkWrap: true, scrollDirection: Axis.horizontal, @@ -411,6 +414,16 @@ class _MineAttainmentPage extends State { ); } + String rewardStr(RewardList rewardList){ + if(rewardList.rewardType == 1) + return "积分:${rewardList.refId}"; + else if(rewardList.rewardType == 2) + return "平台余额:${rewardList.refId}"; + else if(rewardList.rewardType == 3) + return "平台兑换券:${rewardList.couponName}"; + return ""; + } + ///徽章级别列表 Widget badgeGradeItem( AchievementDetailList achievementDetail, var position, var size) { diff --git a/lib/mine/mine_vip/mine_vip_core.dart b/lib/mine/mine_vip/mine_vip_core.dart index c442a0c1..da6fae11 100644 --- a/lib/mine/mine_vip/mine_vip_core.dart +++ b/lib/mine/mine_vip/mine_vip_core.dart @@ -47,13 +47,16 @@ class _MineVipCore extends State { super.initState(); SharedPreferences.getInstance().then((value) { - if(widget.arguments["rankLevel"] == 1 && !(value.getBool("FirstYinKa")??false)){ + if (widget.arguments["rankLevel"] == 1 && + !(value.getBool("FirstYinKa") ?? false)) { showAlertDialog("银卡会员"); value.setBool("FirstYinKa", true); - }else if(widget.arguments["rankLevel"] == 2 && !(value.getBool("FirstJinKa")??false)){ + } 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)){ + } else if (widget.arguments["rankLevel"] == 3 && + !(value.getBool("FirstGongC") ?? false)) { showAlertDialog("共创会员"); value.setBool("FirstGongC", true); } @@ -80,12 +83,13 @@ class _MineVipCore extends State { ///会员权益列表 queryBenefitList() async { - BaseData> baseData = await apiService.benefitList().catchError((onError) {}); + 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)); + vipBenefitList.sort((a, b) => (a.sort).compareTo(b.sort)); }); } EasyLoading.dismiss(); @@ -94,7 +98,7 @@ class _MineVipCore extends State { ///会员权益介绍/规则/说明/储值说明 queryRuleDetails() async { BaseData baseData = - await apiService.vipBenefit().catchError((onError) {}); + await apiService.vipBenefit().catchError((onError) {}); if (baseData != null && baseData.isSuccess) { setState(() { vipRuleDetails = baseData.data; @@ -105,7 +109,6 @@ class _MineVipCore extends State { ///购买会员等级 buyRank() async { - // if (!(await Min.isInitialize())) { // 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调, // 然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针, @@ -113,8 +116,8 @@ class _MineVipCore extends State { // await Min.initialize(); // } - BaseData baseData = - await apiService.rankBuy({"buyType": 2, "rankId":ranks[checkIndex].id}); + BaseData baseData = await apiService + .rankBuy({"buyType": 2, "rankId": ranks[checkIndex].id}); if (baseData != null && baseData.isSuccess) { WxPay wxPay = WxPay.fromJson(baseData.data); await registerWxApi( @@ -133,380 +136,433 @@ class _MineVipCore extends State { ); weChatResponseEventHandler.listen((event) async { print("payCallback: ${event.errCode}"); - if(event.errCode == 0){ + if (event.errCode == 0) { widget.arguments["rankLevel"] = ranks[checkIndex].level; queryVipLevel(); showAlertDialog(ranks[checkIndex].rankName); - } - else{ + } else { SmartDialog.showToast("支付失败", alignment: Alignment.center); return; } }); - } - else{ + } else { SmartDialog.showToast(baseData.msg, alignment: Alignment.center); } } @override Widget build(BuildContext context) { - return Scaffold( - appBar: MyAppBar( - title: S.of(context).huiyuanzhongxin, - titleColor: Colors.black, - titleSize: 18.sp, - background: Colors.transparent, - leadingColor: Colors.black, - action:widget?.arguments["userInfo"] != null ? Container( - alignment: Alignment.center, - margin: EdgeInsets.only(right: 16.w), - child: GestureDetector( - onTap: () { - Navigator.of(context).pushNamed('/router/integral_detailed_page'); - }, - child: Text( - "${S.of(context).dangqianzhukadengji} : ${widget?.arguments["userInfo"]??""}", - style: TextStyle( - color: Colors.black, - fontSize: 16.sp, - fontWeight: MyFontWeight.bold, - ), + return Stack( + children: [ + Container( + // padding: EdgeInsets.only(top: 40.h), + height:260.h, + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.bottomCenter, + end: Alignment.topCenter, + colors: [ + Color(0xFF000000), + Color(0xFF585858), + ]), + // border: Border.all(color: Colors.white,width: 0.5), + shape: BoxShape.rectangle, + borderRadius: BorderRadius.only( + bottomRight: Radius.circular(35), + bottomLeft: Radius.circular(35), ), ), - ) : SizedBox(), - ), - body: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Column( - children: [ - ///会员卡 - Container( - height: (MediaQuery.of(context).size.width) / - 1.78 * - AppUtils.textScale(context), - child: Swiper( - viewportFraction: 0.95, - loop: false, - physics: BouncingScrollPhysics(), - controller: controller, - onIndexChanged: (index){ - setState(() { - checkIndex = index; - }); - }, - 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"], - rankMax: !(ranks != null && ranks.isNotEmpty) - ? 0 - : (position < (ranks.length - 1)) - ? ranks[position + 1].rankOrigin - : ranks[position].rankOrigin, - createTime: widget.arguments["createTime"], - ); - }, - itemCount: - (ranks != null && ranks.isNotEmpty) ? ranks.length : 1, - ), - ), + ), + Column( + children: [ + SizedBox(height: 40), - ///会员权益 - Container( - margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0), - padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8), - topRight: Radius.circular(8), - ), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( + Container( + child:Row( children: [ - Container( - width: 4, - height: 18, - decoration: BoxDecoration( - gradient: new LinearGradient( - begin: Alignment.bottomCenter, - end: Alignment.topCenter, - colors: [ - Color(0xFF000000), - Color(0xFF585858), - ]), - ), - ), - SizedBox( - width: 4.w, - ), - Text( - S.of(context).huiyuanquanyi, - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 16.sp, - color: Colors.black, - ), + Expanded( + child: GestureDetector( + onTap: () { + Navigator.of(context).pop(); + }, + child: Padding( + padding: EdgeInsets.only(left: 16.h, bottom: 10.h), + child: Row( + children: [ + Icon( + Icons.arrow_back_ios, + size: 24, + color: Colors.white, + ), + Text( + S.of(context).huiyuanzhongxin, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 18.sp, + color: Colors.white, + ), + ), + ], + ), + )), ), + if(widget?.arguments["userInfo"] != null) + Container( + alignment: Alignment.center, + margin: EdgeInsets.only(right: 16.w), + child: GestureDetector( + onTap: () { + // Navigator.of(context).pushNamed('/router/integral_detailed_page'); + }, + child: Text( + "${S.of(context).dangqianzhukadengji} : ${widget?.arguments["userInfo"]??""}", + style: TextStyle( + color: Colors.white, + fontSize: 16.sp, + fontWeight: MyFontWeight.medium, + ), + ), + ), + ) ], ), - SizedBox( - height: 12.h, - ), - vipLegalRight(), - ], - ), - ), - - ///会员规则说明 - Container( - margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0), - padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8), - topRight: Radius.circular(8), ), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( + Expanded(child: + SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( children: [ + ///会员卡 Container( - width: 4, - height: 18, - decoration: BoxDecoration( - gradient: new LinearGradient( - begin: Alignment.bottomCenter, - end: Alignment.topCenter, - colors: [ - Color(0xFF000000), - Color(0xFF585858), - ]), + height: (MediaQuery.of(context).size.width) / + 1.78 * + AppUtils.textScale(context), + child: Swiper( + viewportFraction: 0.95, + loop: false, + physics: BouncingScrollPhysics(), + controller: controller, + onIndexChanged: (index) { + setState(() { + checkIndex = index; + }); + }, + 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 + : (position < (ranks.length - 1)) + ? ranks[position + 1].rankOrigin + : ranks[position].rankOrigin, + createTime: widget.arguments["createTime"], + ); + }, + itemCount: + (ranks != null && ranks.isNotEmpty) ? ranks.length : 1, ), ), - SizedBox( - width: 4.w, - ), - Text( - S.of(context).huiyuanguize, - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 16.sp, - color: Colors.black, - ), - ), - ], - ), - SizedBox( - height: 12.h, - ), - 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(); - }, + + ///会员权益 + Container( + margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0), + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + topRight: Radius.circular(8), ), - }, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + width: 4, + height: 18, + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.bottomCenter, + end: Alignment.topCenter, + colors: [ + Color(0xFF000000), + Color(0xFF585858), + ]), + ), + ), + SizedBox( + width: 4.w, + ), + Text( + S.of(context).huiyuanquanyi, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + color: Colors.black, + ), + ), + ], + ), + SizedBox( + height: 12.h, + ), + vipLegalRight(), + ], + ), ), - ), - ], - ), - ), - ///会员级别对照表 - Container( - margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0), - padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8), - topRight: Radius.circular(8), - ), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ + ///会员规则说明 Container( - width: 4, - height: 18, + margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0), + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), decoration: BoxDecoration( - gradient: new LinearGradient( - begin: Alignment.bottomCenter, - end: Alignment.topCenter, - colors: [ - Color(0xFF000000), - Color(0xFF585858), - ]), + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + topRight: Radius.circular(8), + ), ), - ), - SizedBox( - width: 4.w, - ), - Text( - S.of(context).huiyuanjibieduizhao, - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 16.sp, - color: Colors.black, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + width: 4, + height: 18, + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.bottomCenter, + end: Alignment.topCenter, + colors: [ + Color(0xFF000000), + Color(0xFF585858), + ]), + ), + ), + SizedBox( + width: 4.w, + ), + Text( + S.of(context).huiyuanguize, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + color: Colors.black, + ), + ), + ], + ), + SizedBox( + height: 12.h, + ), + 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(); + }, + ), + }, + ), + ), + ], ), ), - ], - ), - SizedBox( - height: 12.h, - ), - MImage( - vipRuleDetails?.contrast ?? "", - width: double.infinity, - height: 281, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", - ), - SizedBox( - height: 16.h, - ), - ], - ), - ), - ///会员如何获得积分 - Container( - margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8), - topRight: Radius.circular(8), - ), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( + ///会员级别对照表 + Container( + margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0), + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + topRight: Radius.circular(8), + ), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: 4, - height: 18, - decoration: BoxDecoration( - gradient: new LinearGradient( - begin: Alignment.bottomCenter, - end: Alignment.topCenter, - colors: [ - Color(0xFF000000), - Color(0xFF585858), - ]), - ), + Row( + children: [ + Container( + width: 4, + height: 18, + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.bottomCenter, + end: Alignment.topCenter, + colors: [ + Color(0xFF000000), + Color(0xFF585858), + ]), + ), + ), + SizedBox( + width: 4.w, + ), + Text( + S.of(context).huiyuanjibieduizhao, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + color: Colors.black, + ), + ), + ], ), SizedBox( - width: 4.w, + height: 12.h, ), - Text( - S.of(context).huiyuanhuodejifen, - style: TextStyle( - fontWeight: MyFontWeight.medium, - fontSize: 16.sp, - color: Colors.black, - ), + MImage( + vipRuleDetails?.contrast ?? "", + width: double.infinity, + height: 281, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + SizedBox( + height: 16.h, ), ], ), - SizedBox( - height: 12.h, - ), - if (vipRuleDetails?.rule != null && - vipRuleDetails.rule != "") - Container( + ), + + ///会员如何获得积分 + Container( + margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0), + decoration: BoxDecoration( color: Colors.white, - child: Html( - data: vipRuleDetails?.rule??"", - customImageRenders: { - networkSourceMatcher(): networkImageRender( - loadingWidget: () { - return Container(); - }, - ), - }, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(8), + topRight: Radius.circular(8), ), ), - ], - ), - ), - if( - ranks.length > checkIndex && widget.arguments["rankLevel"] < ranks[checkIndex].level && ranks[checkIndex].price != "0.00") - InkWell( - onTap: () { - setState(() { - buyRank(); - }); - }, - child: Container( - decoration: BoxDecoration( - gradient: new LinearGradient( - begin: Alignment.centerLeft, - end: Alignment.centerRight, - colors: [ - Color(0xFFFFDCA1), - Color(0xFFFAE4C0), - ]), - ), - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.all(16), - height: 54, - alignment: Alignment.center, - child: Text( - "${S.of(context).lijikaitong}¥${ranks.length>checkIndex?ranks[checkIndex].price:""}/永久", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16.sp, - color: Color(0xFF4A4748), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + width: 4, + height: 18, + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.bottomCenter, + end: Alignment.topCenter, + colors: [ + Color(0xFF000000), + Color(0xFF585858), + ]), + ), + ), + SizedBox( + width: 4.w, + ), + Text( + S.of(context).huiyuanhuodejifen, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 16.sp, + color: Colors.black, + ), + ), + ], + ), + SizedBox( + height: 12.h, + ), + if (vipRuleDetails?.rule != null && + vipRuleDetails.rule != "") + Container( + color: Colors.white, + child: Html( + data: vipRuleDetails?.rule ?? "", + customImageRenders: { + networkSourceMatcher(): networkImageRender( + loadingWidget: () { + return Container(); + }, + ), + }, + ), + ), + ], + ), + ), + if (ranks.length > checkIndex && + widget.arguments["rankLevel"] < ranks[checkIndex].level && + ranks[checkIndex].price != "0.00") + InkWell( + onTap: () { + setState(() { + buyRank(); + }); + }, + child: Container( + decoration: BoxDecoration( + gradient: new LinearGradient( + begin: Alignment.centerLeft, + end: Alignment.centerRight, + colors: [ + Color(0xFFFFDCA1), + Color(0xFFFAE4C0), + ]), + ), + width: MediaQuery.of(context).size.width, + padding: EdgeInsets.all(16), + height: 54, + alignment: Alignment.center, + child: Text( + "${S.of(context).lijikaitong}¥${ranks.length > checkIndex ? ranks[checkIndex].price : ""}/永久", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16.sp, + color: Color(0xFF4A4748), + ), + ), + ), + ), + ], ), ), - ), + ], ), - ], - ), + )), + ], ), - ], - ), - ), + ], ); + } ///vip @@ -549,7 +605,7 @@ class _MineVipCore extends State { ///会员权益列表 Widget vipLegalRight() { return GridView.builder( - itemCount:vipBenefitList == null ? 0 : vipBenefitList.length, + itemCount: vipBenefitList == null ? 0 : vipBenefitList.length, shrinkWrap: true, physics: NeverScrollableScrollPhysics(), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( @@ -568,7 +624,9 @@ class _MineVipCore extends State { return GestureDetector( onTap: () { Navigator.of(context) - .pushNamed('/router/legal_right_details', arguments: {"vipBenefitList": vipBenefitList,}); + .pushNamed('/router/legal_right_details', arguments: { + "vipBenefitList": vipBenefitList, + }); }, child: vipLegalRightItem(vipBenefitList[index]), ); @@ -585,75 +643,76 @@ class _MineVipCore extends State { alignment: Alignment.bottomCenter, children: [ MImage( - vipBenefitList?.icon ?? "", - width: 36, - height: 36, - // 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), - 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( + vipBenefitList?.icon ?? "", + width: 36, + height: 36, + // 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), + 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), - fontWeight: MyFontWeight.regular, - fontSize: 9.sp, + size: 10, ), - ), - ], - ), - ), - if(!vipBenefitList.actived && !vipBenefitList.have) - Container( - decoration: new BoxDecoration( - color: Color(0xFFA29E9E), - borderRadius: BorderRadius.circular(7.0), + Text( + "暂未开放", + style: TextStyle( + color: Color(0xFFFFDCA1), + fontWeight: MyFontWeight.regular, + fontSize: 9.sp, + ), + ), + ], + ), ), - 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( + 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), - fontWeight: MyFontWeight.regular, - fontSize: 9.sp, + size: 10, ), - ), - ], + Text( + "暂未解锁", + style: TextStyle( + color: Color(0xFFFFDCA1), + fontWeight: MyFontWeight.regular, + fontSize: 9.sp, + ), + ), + ], + ), ), - ), ], ), SizedBox( height: 5.h, ), - Expanded(child: Text( + Expanded( + child: Text( vipBenefitList?.name ?? "", maxLines: 2, overflow: TextOverflow.ellipsis, @@ -663,8 +722,7 @@ class _MineVipCore extends State { fontWeight: MyFontWeight.regular, fontSize: 12.sp, ), - )) - , + )), ], ), ); diff --git a/lib/mine/mine_vip_level_page.dart b/lib/mine/mine_vip_level_page.dart index 817c160c..59690df6 100644 --- a/lib/mine/mine_vip_level_page.dart +++ b/lib/mine/mine_vip_level_page.dart @@ -81,7 +81,7 @@ class _MineVipLevelPage extends State { 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["points"], + rank: !(ranks != null && ranks.isNotEmpty) ? 0 : widget.arguments["points"]??0, rankMax: !(ranks != null && ranks.isNotEmpty) ? 0 : (position < (ranks.length - 1)) ? ranks[position + 1].rankOrigin : ranks[position].rankOrigin, diff --git a/lib/mine/recharge_page.dart b/lib/mine/recharge_page.dart index 08935bec..bbf3946a 100644 --- a/lib/mine/recharge_page.dart +++ b/lib/mine/recharge_page.dart @@ -164,13 +164,6 @@ class _RechargePage extends State { bottom: 20.h, ), decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Color(0x000000).withAlpha(25), - offset: Offset(0, 1), - blurRadius: 12.0, - ), - ], color: Colors.white, // borderRadius: BorderRadius.circular(4), ), diff --git a/lib/order/exchange_order_page.dart b/lib/order/exchange_order_page.dart index ba689bd9..22ecde99 100644 --- a/lib/order/exchange_order_page.dart +++ b/lib/order/exchange_order_page.dart @@ -12,6 +12,7 @@ import 'package:huixiang/retrofit/data/wx_pay.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:huixiang/view_widget/receiving_method_dialog.dart'; import 'package:huixiang/view_widget/round_button.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -39,6 +40,16 @@ class _ExchangeOrderPage extends State { void initState() { super.initState(); + SharedPreferences.getInstance().then((value) { + if(value.getString("minMember") == null){ + return; + } + Map memberInfo = + jsonDecode(value.getString("minMember")); + balance = memberInfo["balance"]; + money = memberInfo["money"]; + setState(() {}); + }); SharedPreferences.getInstance().then((value) => { apiService = ApiService(Dio(), context: context, token: value.getString("token")), @@ -103,7 +114,12 @@ class _ExchangeOrderPage extends State { SizedBox( height: 18.h, ), - Row( + GestureDetector(onTap: (){ + setState(() { + showAlertDialog(); + }); + }, + child: Row( children: [ Text( S.of(context).lingqufangshi, @@ -115,7 +131,7 @@ class _ExchangeOrderPage extends State { SizedBox( width: 12.w, ), - Text( + Expanded(child:Text( widget.arguments["useTyped"] == 1 ? S.of(context).ziti : widget.arguments["useTyped"] == 2 @@ -125,9 +141,14 @@ class _ExchangeOrderPage extends State { fontSize: 14.sp, color: Color(0xFF353535), ), + )), + Icon( + Icons.keyboard_arrow_right, + size: 16, + color: Color(0xFF32A060), ), ], - ), + ),), Visibility( child: SizedBox( height: 13.h, @@ -344,31 +365,41 @@ class _ExchangeOrderPage extends State { SizedBox( height: 18.h, ), - Row( - children: [ - Text( - S.of(context).lingqufangshi, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xFF353535), + GestureDetector(onTap: (){ + setState(() { + showAlertDialog(); + }); + }, + child: 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( + width: 12.w, ), - ), - ], - ), + Expanded(child: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), + ), + )), + Icon( + Icons.keyboard_arrow_right, + size: 16, + color: Color(0xFF32A060), + ), + ], + ),), Visibility( child: SizedBox( height: 13.h, @@ -770,43 +801,43 @@ class _ExchangeOrderPage extends State { SizedBox( height: 10, ), - GestureDetector( - onTap: () { - setState(() { - checkIndex = 2; - }); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - checkPayView(2), - Expanded( - child: Container(), - flex: 1, - ), - Text( - "¥$balance", - style: TextStyle( - fontSize: 14.sp, - color: Color(0xff353535), - fontWeight: MyFontWeight.semi_bold, - ), - ), - SizedBox( - width: 10, - ), - Text( - S.of(context).dianpuyue, - style: TextStyle( - fontSize: 14.sp, - color: Color(0xff353535), - fontWeight: MyFontWeight.semi_bold, - ), - ), - ], - ), - ), + // GestureDetector( + // onTap: () { + // setState(() { + // checkIndex = 2; + // }); + // }, + // child: Row( + // mainAxisAlignment: MainAxisAlignment.center, + // crossAxisAlignment: CrossAxisAlignment.center, + // children: [ + // checkPayView(2), + // Expanded( + // child: Container(), + // flex: 1, + // ), + // Text( + // "¥$balance", + // style: TextStyle( + // fontSize: 14.sp, + // color: Color(0xff353535), + // fontWeight: MyFontWeight.semi_bold, + // ), + // ), + // SizedBox( + // width: 10, + // ), + // Text( + // S.of(context).dianpuyue, + // style: TextStyle( + // fontSize: 14.sp, + // color: Color(0xff353535), + // fontWeight: MyFontWeight.semi_bold, + // ), + // ), + // ], + // ), + // ), SizedBox( height: 10, ), @@ -898,6 +929,21 @@ class _ExchangeOrderPage extends State { ); } + ///领取方式弹窗 + showAlertDialog() { + //显示对话框 + showDialog( + context: context, + builder: (BuildContext context) { + return ReceivingMethodDialog(widget.arguments["useTyped"],(value){ + setState(() { + widget.arguments["useTyped"] = value; + }); + }); + }, + ); + } + String handleNeedPay(){ return widget.arguments["payType"] == 1 ? "${double.parse(widget.arguments["onePrice"])*buyNum}积分".toString() : (widget.arguments["payType"] == 2 @@ -959,6 +1005,7 @@ class _ExchangeOrderPage extends State { BaseData baseDate = await apiService.creditOrder({ "goodsId": widget.arguments["goodsId"], "isOneSell":widget.arguments["payType"] != 2, + "isPoints":!handleNeedPay().contains("元"), "number": buyNum, "useTyped": widget.arguments["useTyped"], "payChannel":handleNeedPay().contains("元") ? (checkIndex == 3?"1":"4") : "0", diff --git a/lib/order/order_view/order_commodity.dart b/lib/order/order_view/order_commodity.dart index 3e41e806..bc9911a5 100644 --- a/lib/order/order_view/order_commodity.dart +++ b/lib/order/order_view/order_commodity.dart @@ -87,9 +87,21 @@ class _OrderCommodity extends State { ); } + if (widget.orderInfo.benefitDiscountAmount != "0.00") { + // 优惠券 + widgets.add( + vipItem( + Color(0xFFFF7A1A), + "会员优惠金额", + widget?.orderInfo?.benefitDiscountAmount ?? "0.00", + ), + ); + } + + if (widget.orderInfo.orderDetail != null && widget.orderInfo.orderDetail.couponDTO != null) { - // 配送费 + // 优惠券 widgets.add( discountItem( Color(0xFFFF7A1A), @@ -99,10 +111,11 @@ class _OrderCommodity extends State { ), ); } + if (widget.orderInfo.orderDetail != null && widget.orderInfo.orderDetail.activityPrice != null && double.tryParse(widget.orderInfo.orderDetail.activityPrice ?? "0") > 0) { - // 配送费 + // 活动 widgets.add( discountItem( Color(0xFFFF7A1A), @@ -136,6 +149,7 @@ class _OrderCommodity extends State { return widgets; } + Widget commodityItem(OrderProductVOList productList) { return Container( margin: EdgeInsets.only(top: 8.h, bottom: 8.h), @@ -265,6 +279,45 @@ class _OrderCommodity extends State { ); } + Widget vipItem(Color color, textName,amount) { + return Container( + margin: EdgeInsets.only(top: 9.h, bottom: 9.h), + child: Row( + children: [ + Container( + padding: EdgeInsets.fromLTRB(4.w, 2.h, 4.w, 2.h), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(2)), + border: Border.all( + width: 1, + color: color, + style: BorderStyle.solid, + ), + ), + child: Text( + textName, + style: TextStyle( + fontSize: 10.sp, + color: color, + ), + ), + ), + SizedBox( + width: 27.w, + ), + Spacer(), + Text( + S.of(context).yuan_("$amount"), + style: TextStyle( + fontSize: 12.sp, + color: color, + ), + ), + ], + ), + ); + } + Widget buildQrCode() { return Container( margin: EdgeInsets.only(right: 16.w), @@ -357,16 +410,16 @@ class _OrderCommodity extends State { ), flex: 1, ), - Container( - child: Text( - "已优惠:¥${widget.orderInfo.orderDetail.activityPrice}", - style: TextStyle( - fontSize: 12.sp, - color: Color(0xFF7B7B7B), - fontWeight: MyFontWeight.medium, - ), - ), - ), + // Container( + // child: Text( + // "已优惠:¥${widget.orderInfo.orderDetail.activityPrice}", + // style: TextStyle( + // fontSize: 12.sp, + // color: Color(0xFF7B7B7B), + // fontWeight: MyFontWeight.medium, + // ), + // ), + // ), SizedBox( width: 15.w, ), diff --git a/lib/retrofit/data/achievement_detail_list.dart b/lib/retrofit/data/achievement_detail_list.dart index 82b93ff0..2677c888 100644 --- a/lib/retrofit/data/achievement_detail_list.dart +++ b/lib/retrofit/data/achievement_detail_list.dart @@ -1,19 +1,20 @@ -/// id : "1460450874352310812" +/// id : "1460450874352317701" /// createTime : "2021-11-12 11:42:08" /// createUser : "123" -/// updateTime : "2021-11-17 17:49:17" +/// updateTime : "2021-11-19 13:59:36" /// updateUser : "1" -/// categoryId : "1460164746211753984" +/// categoryId : "1460904379451179008" /// name : "青铜" /// level : 0 -/// icon : "https://pos.upload.gznl.top/admin/2021/11/a83f895b-8159-455e-a54d-ac67068b28b7.jpg" -/// score : 10 +/// icon : "https://pos.upload.gznl.top/MDAwMA==/2021/11/dd1bd6f1-6079-46ab-8d0f-6a946048db9d.png" +/// score : 1 /// actived : true /// sort : 0 /// isDelete : 0 -/// lessScore : 0 -/// get : true +/// lessScore : "1" +/// rewardList : [{"id":"1464064141143572480","createTime":"2021-11-26 10:51:07","createUser":"1","updateTime":"2021-11-26 10:51:07","updateUser":"1","categoryId":"1460904379451179008","achievementId":"1460450874352317701","rewardType":2,"refId":"10","isDelete":0,"achievementCategoryName":null,"achievementName":null,"couponName":null},{"id":"1464064181471805440","createTime":"2021-11-26 10:51:17","createUser":"1","updateTime":"2021-11-26 10:51:17","updateUser":"1","categoryId":"1460904379451179008","achievementId":"1460450874352317701","rewardType":2,"refId":"20","isDelete":0,"achievementCategoryName":null,"achievementName":null,"couponName":null},{"id":"1464136057103581184","createTime":"2021-11-26 15:36:53","createUser":"1","updateTime":"2021-11-26 15:36:53","updateUser":"1","categoryId":"1460904379451179008","achievementId":"1460450874352317701","rewardType":1,"refId":"888","isDelete":0,"achievementCategoryName":null,"achievementName":null,"couponName":null}] /// max : false +/// get : false class AchievementDetailList { AchievementDetailList({ @@ -30,9 +31,10 @@ class AchievementDetailList { bool actived, int sort, int isDelete, - int lessScore, - bool get, - bool max,}){ + String lessScore, + List rewardList, + bool max, + bool get,}){ _id = id; _createTime = createTime; _createUser = createUser; @@ -47,8 +49,9 @@ class AchievementDetailList { _sort = sort; _isDelete = isDelete; _lessScore = lessScore; - _get = get; + _rewardList = rewardList; _max = max; + _get = get; } AchievementDetailList.fromJson(dynamic json) { @@ -66,8 +69,14 @@ class AchievementDetailList { _sort = json['sort']; _isDelete = json['isDelete']; _lessScore = json['lessScore']; - _get = json['get']; + if (json['rewardList'] != null) { + _rewardList = []; + json['rewardList'].forEach((v) { + _rewardList.add(RewardList.fromJson(v)); + }); + } _max = json['max']; + _get = json['get']; } String _id; String _createTime; @@ -82,9 +91,10 @@ class AchievementDetailList { bool _actived; int _sort; int _isDelete; - int _lessScore; - bool _get; + String _lessScore; + List _rewardList; bool _max; + bool _get; String get id => _id; String get createTime => _createTime; @@ -99,14 +109,10 @@ class AchievementDetailList { bool get actived => _actived; int get sort => _sort; int get isDelete => _isDelete; - int get lessScore => _lessScore; - bool get get => _get; + String get lessScore => _lessScore; + List get rewardList => _rewardList; bool get max => _max; - - - set id(String value) { - _id = value; - } + bool get get => _get; Map toJson() { final map = {}; @@ -124,68 +130,119 @@ class AchievementDetailList { map['sort'] = _sort; map['isDelete'] = _isDelete; map['lessScore'] = _lessScore; - map['get'] = _get; + if (_rewardList != null) { + map['rewardList'] = _rewardList.map((v) => v.toJson()).toList(); + } map['max'] = _max; + map['get'] = _get; 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; - } +/// id : "1464064141143572480" +/// createTime : "2021-11-26 10:51:07" +/// createUser : "1" +/// updateTime : "2021-11-26 10:51:07" +/// updateUser : "1" +/// categoryId : "1460904379451179008" +/// achievementId : "1460450874352317701" +/// rewardType : 2 +/// refId : "10" +/// isDelete : 0 +/// achievementCategoryName : null +/// achievementName : null +/// couponName : null - set sort(int value) { - _sort = value; - } +class RewardList { + RewardList({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String categoryId, + String achievementId, + int rewardType, + String refId, + int isDelete, + dynamic achievementCategoryName, + dynamic achievementName, + dynamic couponName,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _categoryId = categoryId; + _achievementId = achievementId; + _rewardType = rewardType; + _refId = refId; + _isDelete = isDelete; + _achievementCategoryName = achievementCategoryName; + _achievementName = achievementName; + _couponName = couponName; +} - set isDelete(int value) { - _isDelete = value; + RewardList.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _categoryId = json['categoryId']; + _achievementId = json['achievementId']; + _rewardType = json['rewardType']; + _refId = json['refId']; + _isDelete = json['isDelete']; + _achievementCategoryName = json['achievementCategoryName']; + _achievementName = json['achievementName']; + _couponName = json['couponName']; } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _categoryId; + String _achievementId; + int _rewardType; + String _refId; + int _isDelete; + dynamic _achievementCategoryName; + dynamic _achievementName; + dynamic _couponName; - set lessScore(int value) { - _lessScore = value; - } + 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 achievementId => _achievementId; + int get rewardType => _rewardType; + String get refId => _refId; + int get isDelete => _isDelete; + dynamic get achievementCategoryName => _achievementCategoryName; + dynamic get achievementName => _achievementName; + dynamic get couponName => _couponName; - set get(bool value) { - _get = value; + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['categoryId'] = _categoryId; + map['achievementId'] = _achievementId; + map['rewardType'] = _rewardType; + map['refId'] = _refId; + map['isDelete'] = _isDelete; + map['achievementCategoryName'] = _achievementCategoryName; + map['achievementName'] = _achievementName; + map['couponName'] = _couponName; + return map; } - set max(bool value) { - _max = value; - } } \ No newline at end of file diff --git a/lib/retrofit/data/headlines_list.dart b/lib/retrofit/data/headlines_list.dart new file mode 100644 index 00000000..55bef87f --- /dev/null +++ b/lib/retrofit/data/headlines_list.dart @@ -0,0 +1,99 @@ +/// id : "1463790611994771456" +/// createTime : "2021-11-25 16:44:12" +/// createUser : "1" +/// updateTime : "2021-11-25 16:45:55" +/// updateUser : "1" +/// name : "一心回乡" +/// introduce : "22" +/// coverImg : "https://pos.upload.gznl.top/0000/2021/11/899b578b-f594-42f7-91e1-cebc5dbc39da.png" +/// bannerImg : "https://pos.upload.gznl.top/0000/2021/11/7a41ebe2-d3b1-44ea-9cda-2e952b58d54c.png" +/// sort : 0 +/// isDelete : 0 +/// tenantCode : "admin" + +class HeadlinesList { + HeadlinesList({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String name, + String introduce, + String coverImg, + String bannerImg, + int sort, + int isDelete, + String tenantCode,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _name = name; + _introduce = introduce; + _coverImg = coverImg; + _bannerImg = bannerImg; + _sort = sort; + _isDelete = isDelete; + _tenantCode = tenantCode; +} + + HeadlinesList.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _name = json['name']; + _introduce = json['introduce']; + _coverImg = json['coverImg']; + _bannerImg = json['bannerImg']; + _sort = json['sort']; + _isDelete = json['isDelete']; + _tenantCode = json['tenantCode']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _name; + String _introduce; + String _coverImg; + String _bannerImg; + int _sort; + int _isDelete; + String _tenantCode; + + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get name => _name; + String get introduce => _introduce; + String get coverImg => _coverImg; + String get bannerImg => _bannerImg; + int get sort => _sort; + int get isDelete => _isDelete; + String get tenantCode => _tenantCode; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['name'] = _name; + map['introduce'] = _introduce; + map['coverImg'] = _coverImg; + map['bannerImg'] = _bannerImg; + map['sort'] = _sort; + map['isDelete'] = _isDelete; + map['tenantCode'] = _tenantCode; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/headlines_list_details.dart b/lib/retrofit/data/headlines_list_details.dart new file mode 100644 index 00000000..eebed291 --- /dev/null +++ b/lib/retrofit/data/headlines_list_details.dart @@ -0,0 +1,99 @@ +/// id : "1463790611994771456" +/// createTime : "2021-11-25 16:44:12" +/// createUser : "1" +/// updateTime : "2021-11-25 16:45:55" +/// updateUser : "1" +/// name : "一心回乡" +/// introduce : "22" +/// coverImg : "https://pos.upload.gznl.top/0000/2021/11/899b578b-f594-42f7-91e1-cebc5dbc39da.png" +/// bannerImg : "https://pos.upload.gznl.top/0000/2021/11/7a41ebe2-d3b1-44ea-9cda-2e952b58d54c.png" +/// sort : 0 +/// isDelete : 0 +/// tenantCode : "admin" + +class HeadlinesListDetails { + HeadlinesListDetails({ + String id, + String createTime, + String createUser, + String updateTime, + String updateUser, + String name, + String introduce, + String coverImg, + String bannerImg, + int sort, + int isDelete, + String tenantCode,}){ + _id = id; + _createTime = createTime; + _createUser = createUser; + _updateTime = updateTime; + _updateUser = updateUser; + _name = name; + _introduce = introduce; + _coverImg = coverImg; + _bannerImg = bannerImg; + _sort = sort; + _isDelete = isDelete; + _tenantCode = tenantCode; +} + + HeadlinesListDetails.fromJson(dynamic json) { + _id = json['id']; + _createTime = json['createTime']; + _createUser = json['createUser']; + _updateTime = json['updateTime']; + _updateUser = json['updateUser']; + _name = json['name']; + _introduce = json['introduce']; + _coverImg = json['coverImg']; + _bannerImg = json['bannerImg']; + _sort = json['sort']; + _isDelete = json['isDelete']; + _tenantCode = json['tenantCode']; + } + String _id; + String _createTime; + String _createUser; + String _updateTime; + String _updateUser; + String _name; + String _introduce; + String _coverImg; + String _bannerImg; + int _sort; + int _isDelete; + String _tenantCode; + + String get id => _id; + String get createTime => _createTime; + String get createUser => _createUser; + String get updateTime => _updateTime; + String get updateUser => _updateUser; + String get name => _name; + String get introduce => _introduce; + String get coverImg => _coverImg; + String get bannerImg => _bannerImg; + int get sort => _sort; + int get isDelete => _isDelete; + String get tenantCode => _tenantCode; + + Map toJson() { + final map = {}; + map['id'] = _id; + map['createTime'] = _createTime; + map['createUser'] = _createUser; + map['updateTime'] = _updateTime; + map['updateUser'] = _updateUser; + map['name'] = _name; + map['introduce'] = _introduce; + map['coverImg'] = _coverImg; + map['bannerImg'] = _bannerImg; + map['sort'] = _sort; + map['isDelete'] = _isDelete; + map['tenantCode'] = _tenantCode; + return map; + } + +} \ No newline at end of file diff --git a/lib/retrofit/data/order_info.dart b/lib/retrofit/data/order_info.dart index 6b7eff3c..c65d1a83 100644 --- a/lib/retrofit/data/order_info.dart +++ b/lib/retrofit/data/order_info.dart @@ -110,6 +110,7 @@ class OrderInfo { String payNum; String promotionId; String couponId; + String benefitDiscountAmount; int isDelete; int isTakeOut; int batch; @@ -172,6 +173,7 @@ class OrderInfo { String payNum, String promotionId, String couponId, + String benefitDiscountAmount, int isDelete, int isTakeOut, int batch, @@ -232,6 +234,7 @@ class OrderInfo { this.payNum = payNum; this.promotionId = promotionId; this.couponId = couponId; + this.benefitDiscountAmount =benefitDiscountAmount; this.isDelete = isDelete; this.isTakeOut = isTakeOut; this.batch = batch; @@ -297,6 +300,7 @@ class OrderInfo { this.payNum = json["payNum"]; this.promotionId = json["promotionId"]; this.couponId = json["couponId"]; + this.benefitDiscountAmount = json["benefitDiscountAmount"]; this.isDelete = json["isDelete"]; this.isTakeOut = json["isTakeOut"]; this.batch = json["batch"]; @@ -371,6 +375,7 @@ class OrderInfo { map["payNum"] = this.payNum; map["promotionId"] = this.promotionId; map["couponId"] = this.couponId; + map["benefitDiscountAmount"] = this.benefitDiscountAmount; map["isDelete"] = this.isDelete; map["isTakeOut"] = this.isTakeOut; map["batch"] = this.batch; diff --git a/lib/retrofit/data/settleOrderInfo.dart b/lib/retrofit/data/settleOrderInfo.dart index bb92977d..b4fb5077 100644 --- a/lib/retrofit/data/settleOrderInfo.dart +++ b/lib/retrofit/data/settleOrderInfo.dart @@ -205,6 +205,7 @@ class SettleOrderInfo { /// promotionName : "��10-8" /// usable : true /// allProduct : true +/// isMaxCoupon:true /// productList : null class CouponListBean { @@ -231,6 +232,7 @@ class CouponListBean { String promotionName; bool usable; bool allProduct; + bool isMaxCoupon; dynamic productList; bool isEx; @@ -261,6 +263,7 @@ class CouponListBean { couponListBean.promotionName = map['promotionName']; couponListBean.usable = map['usable']; couponListBean.allProduct = map['allProduct']; + couponListBean.isMaxCoupon = map['isMaxCoupon']; couponListBean.productList = map['productList']; return couponListBean; } @@ -289,6 +292,7 @@ class CouponListBean { "promotionName": promotionName, "usable": usable, "allProduct": allProduct, + "isMaxCoupon": isMaxCoupon, "productList": productList, }; @@ -321,6 +325,7 @@ class CouponListBean { /// isDelete : 0 /// tenantCode : "1175" /// canPartake : true +/// isMaxPromotion : true /// promotionProuctList : null class PromotionInfoListBean { @@ -351,6 +356,7 @@ class PromotionInfoListBean { int isDelete; String tenantCode; bool canPartake; + bool isMaxPromotion; dynamic promotionProuctList; static PromotionInfoListBean fromJson(Map map) { @@ -387,6 +393,7 @@ class PromotionInfoListBean { promotionInfoListBean.isDelete = map['isDelete']; promotionInfoListBean.tenantCode = map['tenantCode']; promotionInfoListBean.canPartake = map['canPartake']; + promotionInfoListBean.isMaxPromotion = map['isMaxPromotion']; promotionInfoListBean.promotionProuctList = map['promotionProuctList']; return promotionInfoListBean; } @@ -419,6 +426,7 @@ class PromotionInfoListBean { "isDelete": isDelete, "tenantCode": tenantCode, "canPartake": canPartake, + "isMaxPromotion": isMaxPromotion, "promotionProuctList": promotionProuctList, }; } diff --git a/lib/retrofit/data/shoppingCart.dart b/lib/retrofit/data/shoppingCart.dart index 01b6ec19..2126eb88 100644 --- a/lib/retrofit/data/shoppingCart.dart +++ b/lib/retrofit/data/shoppingCart.dart @@ -1,4 +1,7 @@ +import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; + /// cartSum : 0 +/// selectDiscount:2 /// numberOfPeople : 0 /// selected : 0 /// shoppingCartSkuItemList : [{"buyNum":0,"createTime":"","groupId":0,"id":0,"platterList":[{"deleted":true,"id":0,"productId":0,"required":true,"skuId":0}],"productId":0,"productName":"","selected":0,"skuImg":"","skuName":"","skuPrice":0,"skuStock":0,"storeId":0,"tableId":0}] @@ -12,8 +15,11 @@ class ShoppingCart { int selected; List shoppingCartSkuItemList; String storeId; + int selectDiscount; String storeName; String tableId; + List promotionInfoList; + List couponList; static ShoppingCart fromJson(Map map) { if (map == null) return null; @@ -26,7 +32,14 @@ class ShoppingCart { ); shoppingCartBean.storeId = map['storeId']; shoppingCartBean.storeName = map['storeName']; + shoppingCartBean.selectDiscount = map['selectDiscount']; shoppingCartBean.tableId = map['tableId']; + shoppingCartBean.promotionInfoList = List()..addAll( + (map['promotionInfoList'] as List ?? []).map((o) => PromotionInfoListBean.fromJson(o)) + ); + shoppingCartBean.couponList = List()..addAll( + (map['couponList'] as List ?? []).map((o) => CouponListBean.fromJson(o)) + ); return shoppingCartBean; } @@ -37,7 +50,9 @@ class ShoppingCart { "shoppingCartSkuItemList": shoppingCartSkuItemList == null ? null : shoppingCartSkuItemList.map((e) => e.toJson()).toList(), "storeId": storeId, "storeName": storeName, + "selectDiscount" : selectDiscount, "tableId": tableId, + "promotionInfoList": promotionInfoList, }; } @@ -146,4 +161,253 @@ class PlatterListBean { "required": required, "skuId": skuId, }; +} + +/// id : "1437254523520286720" +/// createTime : "2021-09-13 11:19:16" +/// createUser : "1333246101196636160" +/// updateTime : "2021-09-13 17:30:00" +/// updateUser : "0" +/// storeId : "1433719074906439680" +/// name : "�����ŵ�" +/// image : "https://pos.upload.gznl.top/1175/2021/09/44d60dab-0ae3-4d07-b624-50b8ab99d0fc.jpg" +/// description : "1" +/// status : 4 +/// applyStartTime : "2021-09-13 11:19:16" +/// applyEndTime : "2021-09-13 11:19:16" +/// activityStartTime : "2021-09-01 00:00:00" +/// activityEndTime : "2021-10-30 00:00:00" +/// doStartTime : null +/// doEndTime : null +/// isNeedSecurityDeposit : 0 +/// securityDeposit : "0" +/// tag : "11" +/// promotionType : 1 +/// promotionPlan : 0 +/// promotionDetail : [{"limitTime":"0","discountRate":"0","discountAmount":"0","fullAmount":"0","collageNumber":"0","fullNumber":"1"}] +/// channels : ["MINI","POS"] +/// isVip : false +/// isDelete : 0 +/// tenantCode : "1175" +/// canPartake : true +/// isMaxPromotion : true +/// promotionProuctList : null + +class PromotionInfoListBean { + String id; + String createTime; + String createUser; + String updateTime; + String updateUser; + String storeId; + String name; + String image; + String description; + int status; + String applyStartTime; + String applyEndTime; + String activityStartTime; + String activityEndTime; + dynamic doStartTime; + dynamic doEndTime; + int isNeedSecurityDeposit; + String securityDeposit; + String tag; + int promotionType; + int promotionPlan; + List promotionDetail; + List channels; + bool isVip; + int isDelete; + String tenantCode; + bool canPartake; + bool isMaxPromotion; + dynamic promotionProuctList; + + static PromotionInfoListBean fromJson(Map map) { + if (map == null) return null; + PromotionInfoListBean promotionInfoListBean = PromotionInfoListBean(); + promotionInfoListBean.id = map['id']; + promotionInfoListBean.createTime = map['createTime']; + promotionInfoListBean.createUser = map['createUser']; + promotionInfoListBean.updateTime = map['updateTime']; + promotionInfoListBean.updateUser = map['updateUser']; + promotionInfoListBean.storeId = map['storeId']; + promotionInfoListBean.name = map['name']; + promotionInfoListBean.image = map['image']; + promotionInfoListBean.description = map['description']; + promotionInfoListBean.status = map['status']; + promotionInfoListBean.applyStartTime = map['applyStartTime']; + promotionInfoListBean.applyEndTime = map['applyEndTime']; + promotionInfoListBean.activityStartTime = map['activityStartTime']; + promotionInfoListBean.activityEndTime = map['activityEndTime']; + promotionInfoListBean.doStartTime = map['doStartTime']; + promotionInfoListBean.doEndTime = map['doEndTime']; + promotionInfoListBean.isNeedSecurityDeposit = map['isNeedSecurityDeposit']; + promotionInfoListBean.securityDeposit = map['securityDeposit']; + promotionInfoListBean.tag = map['tag']; + promotionInfoListBean.promotionType = map['promotionType']; + promotionInfoListBean.promotionPlan = map['promotionPlan']; + promotionInfoListBean.promotionDetail = List()..addAll( + (map['promotionDetail'] as List ?? []).map((o) => PromotionDetailBean.fromJson(o)) + ); + promotionInfoListBean.channels = List()..addAll( + (map['channels'] as List ?? []).map((o) => o.toString()) + ); + promotionInfoListBean.isVip = map['isVip']; + promotionInfoListBean.isDelete = map['isDelete']; + promotionInfoListBean.tenantCode = map['tenantCode']; + promotionInfoListBean.canPartake = map['canPartake']; + promotionInfoListBean.isMaxPromotion = map['isMaxPromotion']; + promotionInfoListBean.promotionProuctList = map['promotionProuctList']; + return promotionInfoListBean; + } + + Map toJson() => { + "id": id, + "createTime": createTime, + "createUser": createUser, + "updateTime": updateTime, + "updateUser": updateUser, + "storeId": storeId, + "name": name, + "image": image, + "description": description, + "status": status, + "applyStartTime": applyStartTime, + "applyEndTime": applyEndTime, + "activityStartTime": activityStartTime, + "activityEndTime": activityEndTime, + "doStartTime": doStartTime, + "doEndTime": doEndTime, + "isNeedSecurityDeposit": isNeedSecurityDeposit, + "securityDeposit": securityDeposit, + "tag": tag, + "promotionType": promotionType, + "promotionPlan": promotionPlan, + "promotionDetail": promotionDetail, + "channels": channels, + "isVip": isVip, + "isDelete": isDelete, + "tenantCode": tenantCode, + "canPartake": canPartake, + "isMaxPromotion": isMaxPromotion, + "promotionProuctList": promotionProuctList, + }; +} + +/// id : "1448907890034212864" +/// storeId : "1333246101343436800" +/// bizType : 1 +/// fullAmount : "10.00" +/// discountAmount : "8.00" +/// fullNumber : 1 +/// discountPercent : 100 +/// bizId : "" +/// publishStartTime : "2021-10-01" +/// publishEndTime : "2021-10-29" +/// useStartTime : "2021-10-02" +/// useEndTime : "2021-10-31" +/// promotionId : "0" +/// mid : "1438443365845696512" +/// couponId : "1448902034085380096" +/// receiveTime : "2021-10-15" +/// useTime : null +/// status : 1 +/// tenantCode : "1175" +/// type : 1 +/// promotionName : "��10-8" +/// usable : true +/// allProduct : true +/// isMaxCoupon:true +/// productList : null + +class CouponListBean { + String id; + String storeId; + int bizType; + String fullAmount; + String discountAmount; + int fullNumber; + int discountPercent; + String bizId; + String publishStartTime; + String publishEndTime; + String useStartTime; + String useEndTime; + String promotionId; + String mid; + String couponId; + String receiveTime; + dynamic useTime; + int status; + String tenantCode; + int type; + String promotionName; + bool usable; + bool allProduct; + bool isMaxCoupon; + dynamic productList; + bool isEx; + + + static CouponListBean fromJson(Map map) { + if (map == null) return null; + CouponListBean couponListBean = CouponListBean(); + couponListBean.id = map['id']; + couponListBean.storeId = map['storeId']; + couponListBean.bizType = map['bizType']; + couponListBean.fullAmount = map['fullAmount']; + couponListBean.discountAmount = map['discountAmount']; + couponListBean.fullNumber = map['fullNumber']; + couponListBean.discountPercent = map['discountPercent']; + couponListBean.bizId = map['bizId']; + couponListBean.publishStartTime = map['publishStartTime']; + couponListBean.publishEndTime = map['publishEndTime']; + couponListBean.useStartTime = map['useStartTime']; + couponListBean.useEndTime = map['useEndTime']; + couponListBean.promotionId = map['promotionId']; + couponListBean.mid = map['mid']; + couponListBean.couponId = map['couponId']; + couponListBean.receiveTime = map['receiveTime']; + couponListBean.useTime = map['useTime']; + couponListBean.status = map['status']; + couponListBean.tenantCode = map['tenantCode']; + couponListBean.type = map['type']; + couponListBean.promotionName = map['promotionName']; + couponListBean.usable = map['usable']; + couponListBean.allProduct = map['allProduct']; + couponListBean.isMaxCoupon = map['isMaxCoupon']; + couponListBean.productList = map['productList']; + return couponListBean; + } + + Map toJson() => { + "id": id, + "storeId": storeId, + "bizType": bizType, + "fullAmount": fullAmount, + "discountAmount": discountAmount, + "fullNumber": fullNumber, + "discountPercent": discountPercent, + "bizId": bizId, + "publishStartTime": publishStartTime, + "publishEndTime": publishEndTime, + "useStartTime": useStartTime, + "useEndTime": useEndTime, + "promotionId": promotionId, + "mid": mid, + "couponId": couponId, + "receiveTime": receiveTime, + "useTime": useTime, + "status": status, + "tenantCode": tenantCode, + "type": type, + "promotionName": promotionName, + "usable": usable, + "allProduct": allProduct, + "isMaxCoupon": isMaxCoupon, + "productList": productList, + + }; } \ No newline at end of file diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 26e0ed25..1b78be14 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -30,6 +30,8 @@ import 'data/exchange_order.dart'; import 'data/follow_list.dart'; import 'data/goods.dart'; import 'data/goods_category.dart'; +import 'data/headlines_list.dart'; +import 'data/headlines_list_details.dart'; import 'data/logistics.dart'; import 'data/member_comment_list.dart'; import 'data/message.dart'; @@ -53,15 +55,15 @@ part 'retrofit_api.g.dart'; // const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 // const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 -const base_url = "http://192.168.10.236:8766/app/"; ///费韬 -const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 +// const base_url = "http://192.168.10.236:8766/app/"; ///费韬 +// const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 // const base_url = "http://192.168.10.37:8766/app/"; // const baseUrl = "http://192.168.10.37:8766/app/"; -// const base_url = "http://192.168.10.130:8766/app/";///詹云久 -// const baseUrl = "http://192.168.10.130:8766/app/";///詹云久 +const base_url = "http://192.168.10.130:8766/app/";///詹云久 +const baseUrl = "http://192.168.10.130:8766/app/";///詹云久 @RestApi(baseUrl: baseUrl) abstract class ApiService { @@ -467,4 +469,13 @@ abstract class ApiService { @POST("/member/rankBuy") Future> rankBuy(@Body() Map param); + ///文章合集列表 + @GET("/information/categoryList") + Future>> headlinesList(); + + ///文章合集详情 + @GET("/information/category/{id}") + Future> headlinesDetails(@Path("id") String id); + + } diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index 0b363086..05bf5876 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -9,7 +9,7 @@ part of 'retrofit_api.dart'; class _ApiService implements ApiService { _ApiService(this._dio, {this.baseUrl}) { ArgumentError.checkNotNull(_dio, '_dio'); - baseUrl ??= 'http://192.168.10.236:8766/app/'; + baseUrl ??= 'http://192.168.10.130:8766/app/'; } final Dio _dio; @@ -1393,29 +1393,6 @@ class _ApiService implements ApiService { return value; } - // - // @override - // Future> catalogList(courseId) async { - // ArgumentError.checkNotNull(courseId, 'courseId'); - // const _extra = {}; - // final queryParameters = {}; - // final _data = {}; - // final _result = await _dio.request>( - // '/course/catalogList/$courseId', - // 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>> courseList(map) async { ArgumentError.checkNotNull(map, 'map'); @@ -1730,4 +1707,48 @@ class _ApiService implements ApiService { return value; } + @override + Future>> headlinesList() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/information/categoryList', + 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) => HeadlinesList.fromJson(i as Map)) + .toList()); + return value; + } + + @override + Future> headlinesDetails(id) async { + ArgumentError.checkNotNull(id, 'id'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/information/category/$id', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => HeadlinesListDetails.fromJson(json), + ); + return value; + } + } diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index a23103f8..ed321d52 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -72,7 +72,8 @@ class _Settlement extends State { parentId = widget.arguments["parentId"] ?? ""; storeInfo = widget.arguments["storeInfo"]; numberOfPeople = widget.arguments["numberOfPeople"] ?? 0; - + promotions=widget.arguments["pid"]??""; + coupons=widget.arguments["cid"]??""; if (tableId == 0) { placeOrder = true; } diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index 88857ccd..975a42bf 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -62,6 +62,8 @@ class _StoreOrderPage extends State int numberOfPeople = 0; ///小程序token String minToken; + String pid; + String cid; @override void initState() { @@ -545,7 +547,6 @@ class _StoreOrderPage extends State return; } } - await Navigator.of(context).pushNamed( '/router/settlement', arguments: { @@ -553,6 +554,8 @@ class _StoreOrderPage extends State "tableId": tableId, "parentCode": parentCode, "parentId": parentId, + "pid":pid, + "cid":cid, "shoppingCart": shopCarGoods, "numberOfPeople": numberOfPeople, }, @@ -730,12 +733,27 @@ class _StoreOrderPage extends State ///查询购物车 Future queryShopCar() async { + pid=""; + cid=""; BaseData> baseDate = await minService.getShoppingCart(tableId); if (baseDate != null && baseDate.isSuccess && baseDate.data != null && baseDate.data.length > 0) { + if( baseDate.data[0].selectDiscount ==1){ + baseDate.data[0].couponList.forEach((element) { + if(element.isMaxCoupon){ + cid = element.promotionName; + } + }); + }else if(baseDate.data[0].selectDiscount==2){ + baseDate.data[0].promotionInfoList.forEach((element) { + if(element.isMaxPromotion){ + pid=element.name; + } + }); + } return baseDate.data[0]; } else { return null; diff --git a/lib/view_widget/item_input_widget.dart b/lib/view_widget/item_input_widget.dart index 265a9ca1..c79ba14f 100644 --- a/lib/view_widget/item_input_widget.dart +++ b/lib/view_widget/item_input_widget.dart @@ -102,9 +102,9 @@ class ItemInputWidget extends StatelessWidget { ), Container( margin: EdgeInsets.only(left: 5), - width: 85, height: 20.h, alignment: Alignment.center, + padding: EdgeInsets.only(left:3,right:4), decoration: BoxDecoration( borderRadius: BorderRadius.only( topLeft: Radius.circular(9), diff --git a/lib/view_widget/mine_vip_view.dart b/lib/view_widget/mine_vip_view.dart index ee114bc4..452b80ab 100644 --- a/lib/view_widget/mine_vip_view.dart +++ b/lib/view_widget/mine_vip_view.dart @@ -217,9 +217,9 @@ class MineVipView extends StatelessWidget { // rank > rankMax // ? S.of(context).dangqiandengji // : "${S.of(context).jifen_(rankMax - rank)} ${S.of(context).daoxiayidengji}", - rank > rankMax + (vipLevel < curLevel)?"":(((rank ?? 0) > rankMax || curLevel == 3) ? S.of(context).dangqiandengji - : "消费¥${rankMax - rank}元 ${S.of(context).daoxiayidengji}", + : "消费¥${rankMax - (rank ?? 0)}元 ${S.of(context).daoxiayidengji}"), overflow: TextOverflow.ellipsis, style: TextStyle( color: textColor, @@ -233,14 +233,14 @@ class MineVipView extends StatelessWidget { TextSpan( children: [ TextSpan( - text: "$rank", + text: (vipLevel < curLevel)?rankMax.toString():rank.toString(), style: TextStyle( fontSize: 26.sp, fontWeight: MyFontWeight.semi_bold, color: textColor, ), ), - if (rank <= rankMax) + if ((rank ?? 0) <= rankMax) TextSpan( text: rankMax > 0 ? "/$rankMax" : "/0", style: TextStyle( @@ -259,7 +259,7 @@ class MineVipView extends StatelessWidget { child: ClipRRect( borderRadius: BorderRadius.circular(6.5), child: LinearProgressIndicator( - value: rankMax > 0 ? rank / rankMax : 0, + value: rankMax > (rank ?? 0) ? ((vipLevel < curLevel) ? rankMax/rankMax:(rank ?? 0) / rankMax) : 0, backgroundColor: Colors.white, color: levelColor, ), @@ -274,7 +274,9 @@ class MineVipView extends StatelessWidget { S.of(context).kaitongriqi( (createTime != null && createTime != "") ? createTime.split(" ")[0] - : "$createTime"), + : "$createTime" + // createTime ?? "" + ), style: TextStyle( color: textColor, fontWeight: MyFontWeight.regular, @@ -317,7 +319,7 @@ class MineVipView extends StatelessWidget { "rankLevel": curLevel, "userInfo":userInfo.masterCardRankName, "createTime": (userInfo != null) ? "${userInfo.createTime}" : "", - "expendAmount": (userInfo != null) ? int.tryParse(userInfo.expendAmount) : 0, + "expendAmount": double.tryParse(userInfo?.expendAmount??"0").toInt(), }); }); } diff --git a/lib/view_widget/receiving_method_dialog.dart b/lib/view_widget/receiving_method_dialog.dart new file mode 100644 index 00000000..9007d97e --- /dev/null +++ b/lib/view_widget/receiving_method_dialog.dart @@ -0,0 +1,131 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/utils/flutter_utils.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/round_button.dart'; + +import 'custom_image.dart'; +import 'my_appbar.dart'; + +class ReceivingMethodDialog extends StatefulWidget { + final int takeType; + final Function changeTakeType; + + ReceivingMethodDialog(this.takeType,this.changeTakeType); + + @override + State createState() { + return _ReceivingMethodDialog(); + } + +} + +class _ReceivingMethodDialog extends State { + + + Widget build(BuildContext context) { + return Container( + alignment:Alignment.bottomCenter, + child: Column( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + margin: + EdgeInsets.only(top: 26, bottom: 8), + // alignment: Alignment.center, + padding: EdgeInsets.only(top: 20,bottom: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( + children: [ + Text( + "请选择商品的领取方式", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFFA29E9E), + ), + ), + Container( + margin: EdgeInsets.only(top:20,bottom: 20), + height:1, + color:Color(0xFFF4F4F4), + ), + GestureDetector( + onTap:(){ + widget.changeTakeType(1); + Navigator.of(context).pop(); + }, + child: Text( + S.of(context).ziti, + style: TextStyle( + fontSize: 16.sp, + fontWeight: widget.takeType == 1 ? MyFontWeight.semi_bold : MyFontWeight.medium, + color: widget.takeType == 1 ? Color(0xFF32A060):Color(0xFFA29E9E), + ), + ), + ), + Container( + margin: EdgeInsets.only(top: 20,bottom: 20), + height:1, + color:Color(0xFFF4F4F4), + ), + GestureDetector( + onTap:(){ + widget.changeTakeType(2); + Navigator.of(context).pop(); + }, + child:Text( + "物流配送", + style: TextStyle( + fontSize: 16.sp, + fontWeight: widget.takeType == 2 ? MyFontWeight.semi_bold : MyFontWeight.medium, + color: widget.takeType == 2 ? Color(0xFF32A060):Color(0xFFA29E9E), + ), + ), + ), + ], + ), + ), + GestureDetector( + onTap: (){ + Navigator.of(context).pop(); + }, + child:Container( + margin: EdgeInsets.only(top:16), + height:68.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(18), + color: Color(0xFF32A060), + ), + child: + Text( + S.of(context).quxiao, + style: TextStyle( + fontSize: 18.sp, + fontWeight: MyFontWeight.semi_bold, + color: Colors.white, + ), + ) + ), + ), + ], + ), + ); + } +} diff --git a/lib/view_widget/vip_dialog.dart b/lib/view_widget/vip_dialog.dart index 5e3d5bf7..3d25b7a9 100644 --- a/lib/view_widget/vip_dialog.dart +++ b/lib/view_widget/vip_dialog.dart @@ -65,7 +65,7 @@ class _VipDialog extends State { alignment: Alignment.topCenter, children: [ Container( - margin: EdgeInsets.only(top: 40.h), + margin: EdgeInsets.only(top:50.h), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(8), @@ -76,7 +76,7 @@ class _VipDialog extends State { alignment: Alignment.center, width: double.infinity, height: 92, - padding: EdgeInsets.only(top: 50.h, bottom: 19.h), + padding: EdgeInsets.only(top: 40.h, bottom: 19.h), decoration: BoxDecoration( color: Colors.black, borderRadius: BorderRadius.only( From b4fcf5b80aa1d673978cc964b0aa781e6d261a61 Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Tue, 30 Nov 2021 11:49:19 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=96=87=E7=AB=A0=E5=90=88=E9=9B=86?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0;=20=E7=A7=AF=E5=88=86=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=AE=A2=E5=8D=95=E6=8E=A5=E5=8F=A3=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=A2=9E=E5=8A=A0;=20=E4=BC=9A=E5=91=98=E6=9D=83?= =?UTF-8?q?=E7=9B=8A=E8=AF=A6=E6=83=85=E7=82=B9=E5=87=BB=E6=9B=B4=E6=94=B9?= =?UTF-8?q?;=20=E6=88=90=E5=B0=B1=E5=BC=B9=E7=AA=97=E5=AE=9E=E4=BD=93?= =?UTF-8?q?=E7=B1=BB=E6=9B=B4=E6=94=B9,=E5=A2=9E=E5=8A=A0=E5=A5=96?= =?UTF-8?q?=E5=8A=B1=E5=88=97=E8=A1=A8;=20=E4=BC=9A=E5=91=98=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E6=A0=B7=E5=BC=8F=E6=9B=B4=E6=94=B9;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/image/2x/t_right.png | Bin 0 -> 522 bytes assets/image/3x/t_right.png | Bin 0 -> 924 bytes assets/image/t_right.png | Bin 0 -> 274 bytes 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 assets/image/2x/t_right.png create mode 100644 assets/image/3x/t_right.png create mode 100644 assets/image/t_right.png diff --git a/assets/image/2x/t_right.png b/assets/image/2x/t_right.png new file mode 100644 index 0000000000000000000000000000000000000000..5bebd770ff9f4e94c2a9595f739e5bf9187edec3 GIT binary patch literal 522 zcmV+l0`>igP)Px$#7RU!R7gw3*1eC7K@`XF&om@n;wcbjzyf=L70ZNm@?SX8hyDeYGQJzKvuK9vxQI<- zEGTxmrz>wC7@aok%-)9(JMjt|$AHeIl%m7^0hVrjP?6vfPGA>aVts|C3ppO$o60@= zFh=V~L!HEK#Cfl)gvOQG5x_&3*GUx#?&EYR@pG)L&_u{o0B3NyQqT{(i?i5|XIN8_ zVQ=k1ZNn}*O^JKMe~av^R(S)Yd*ZYv&%WRd!EWJ!^gCH zfD1JIOdE^QD{VUy)q}RPiTwf4%m@!aJF9=Jn5@ODei+|)nnqgv-&88T%L~(7^#A|> M07*qoM6N<$g2&47zyJUM literal 0 HcmV?d00001 diff --git a/assets/image/3x/t_right.png b/assets/image/3x/t_right.png new file mode 100644 index 0000000000000000000000000000000000000000..99457d04c21169e46eccc24108bcf2a4a707ac14 GIT binary patch literal 924 zcmV;N17rM&P)Px&R!KxbR9HvVncIs`Q545NOX7_rB}IvpOYWECmMD1;Nl8k|ix)8z4@`1<@PG$} z7b!A>L~={agG+gE$xQeQG?~%l_Q1F;eYJn%_!)EdIcI+Q{r2lwd+qPp`@6qut-XvK z!`=G>gMp#Id|(DJ9vB7;2rfSWt-uT55pWN94Rn}UXVzsc%LI4t3oHVb0`q_gK)*;I zUx4Spec&e0WMPX-ppRc_(=uo?mFU)z_tJ| z#&4{R03QNQm{~_pll}?R-SurEum@NkyK+vuE5L4`#mu}rA3Xt`4x9`;%zMnSxJ3u? zcY~QdjshBXavE?47#O=!FWJ2Z76VVpclNIxb@xfY>2T~Z>+7i6f>g!Wr`fas>&&b< zY4``waB+0p%OY>JKuT)rbs>VDrU6O&E*e}7H0ZiufhWMS=c~iIqt?oVwxByHpNCRIj%^~>^SC0pnN~8K$Y=`XH)WeOUx74+rTQ|6EG(D9$moqQ>l=E z>H<8>kOjr8sUKIAX?ORrfcP)YrsfviI9Jv+TR`i8!!fI8u=yImZB_mW%n3TH3@p#6 z6VL`=O`h2)a|BkxE#IPq66@>0@EmJ33g|OHVY5=>qS8dAaUnd52I6iO8Z-;2qRWs< zp#;RSGr)G>9k38Mm2qd^2(OFYKYv$-{<}&>+d6I_S z$aslL9BvRtw*W_CSsiIt5y7uS2$iragtql&2(6igNCX`VRe?v+TK6)KfF7Rhmc zC(Z$=9>0o|BC56Yno`+PB!HECRCjS#k{ow0S}vap6=;#;F2U)(Tn@Xcm%HkJfCyl# z|4AnRRYF_+k7NnHR`;`G0%&bKYP)Px#%t=H+R5(wi(xFa6K@f%EZ=fV790m=NN5M4V0eFLIJXi>V;DC_SG{F#_07o4t z0tSt%X%$O`+$Nh#8=ze^nLYo^+1UxzDWzLYSkKddf1oZOcGf5*ZLu++*`@Sm6b Y3wdT