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] =?UTF-8?q?=E7=A7=AF=E5=88=86=E5=95=86=E5=9F=8E:=E5=85=91?= =?UTF-8?q?=E6=8D=A2=E5=90=8E=E6=89=A3=E9=99=A4=E5=AF=B9=E5=BA=94=E7=A7=AF?= =?UTF-8?q?=E5=88=86=E9=87=91=E9=A2=9D,=20=E5=85=85=E5=80=BC=E6=9B=B4?= =?UTF-8?q?=E6=94=B9;=20=E4=BC=9A=E5=91=98=E8=B4=AD=E4=B9=B0=E6=9B=B4?= =?UTF-8?q?=E6=94=B9;=20=E8=AE=A2=E5=8D=95=E6=80=8E=E5=8A=A0=E4=BC=9A?= =?UTF-8?q?=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 +}