Browse Source

积分商城:兑换后扣除对应积分金额,

充值更改;
会员购买更改;
订单怎加会员优惠金额;
ff_new
w-R 3 years ago
parent
commit
2366783edb
  1. 6
      lib/community/community_details.dart
  2. 1
      lib/generated/intl/messages_en.dart
  3. 1
      lib/generated/intl/messages_zh_CN.dart
  4. 1
      lib/generated/intl/messages_zh_Hans_CN.dart
  5. 1
      lib/generated/intl/messages_zh_Hant_CN.dart
  6. 1
      lib/generated/intl/messages_zh_TW.dart
  7. 10
      lib/generated/l10n.dart
  8. 2
      lib/integral/intergra_view/integral_vip.dart
  9. 1
      lib/l10n/intl_en.arb
  10. 1
      lib/l10n/intl_zh_CN.arb
  11. 1
      lib/l10n/intl_zh_Hans_CN.arb
  12. 1
      lib/l10n/intl_zh_Hant_CN.arb
  13. 1
      lib/l10n/intl_zh_TW.arb
  14. 17
      lib/mine/mine_page.dart
  15. 2
      lib/mine/mine_view/community_follow.dart
  16. 82
      lib/mine/mine_vip/legal_right_details.dart
  17. 51
      lib/mine/mine_vip/mine_attainment_page.dart
  18. 104
      lib/mine/mine_vip/mine_vip_core.dart
  19. 376
      lib/mine/recharge_page.dart
  20. 20
      lib/order/exchange_history_page.dart
  21. 34
      lib/order/exchange_order_page.dart
  22. 2
      lib/order/exchange_order_success_page.dart
  23. 59
      lib/order/logistics_information_page.dart
  24. 6
      lib/retrofit/data/goods.dart
  25. 10
      lib/retrofit/data/rank.dart
  26. 3
      lib/retrofit/data/settleOrderInfo.dart
  27. 12
      lib/retrofit/data/social_info.dart
  28. 9
      lib/retrofit/data/user_info.dart
  29. 79
      lib/retrofit/data/vip_benefit_list.dart
  30. 11
      lib/retrofit/data/vip_rule_details.dart
  31. 26
      lib/retrofit/retrofit_api.dart
  32. 54
      lib/retrofit/retrofit_api.g.dart
  33. 2
      lib/settlement/settlement.dart
  34. 156
      lib/settlement/settlement_view/activity_coupon_remarks.dart
  35. 6
      lib/utils/flutter_utils.dart
  36. 104
      lib/view_widget/badge_attainment_dialog.dart
  37. 4
      lib/view_widget/cupertino_date_picker.dart
  38. 72
      lib/view_widget/item_input_widget.dart
  39. 8
      lib/view_widget/mine_vip_view.dart
  40. 283
      lib/view_widget/vip_dialog.dart

6
lib/community/community_details.dart

@ -205,13 +205,13 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
} }
} }
/// ///
_queryMemberComment(String content) async { _queryMemberComment(String content) async {
BaseData baseData = await apiService.memberComment({ BaseData baseData = await apiService.memberComment({
"content": content, "content": content,
"parentId": parenId, "parentId": parenId,
"relationalId": comunity.id, "relationalId": comunity.id,
"relationalType": 1 "relationalType":4
}).catchError((error) {}); }).catchError((error) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
CommentListState state = commentKey.currentState; CommentListState state = commentKey.currentState;
@ -296,7 +296,7 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
"pageNum": 1, "pageNum": 1,
"pageSize": 100, "pageSize": 100,
"relationalId": comunity.id, "relationalId": comunity.id,
"relationalType": 1, "relationalType":1,
}).catchError((error) {}); }).catchError((error) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
commentTotal = baseData.data.size; commentTotal = baseData.data.size;

1
lib/generated/intl/messages_en.dart

@ -158,6 +158,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dangqiandengji" : MessageLookupByLibrary.simpleMessage("当前等级"), "dangqiandengji" : MessageLookupByLibrary.simpleMessage("当前等级"),
"dangqianjifen" : MessageLookupByLibrary.simpleMessage("当前积分:"), "dangqianjifen" : MessageLookupByLibrary.simpleMessage("当前积分:"),
"dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("当前商品兑换核销码已核销完成"), "dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("当前商品兑换核销码已核销完成"),
"dangqianzhukadengji" : MessageLookupByLibrary.simpleMessage("当前主卡等级"),
"daodianziqu" : MessageLookupByLibrary.simpleMessage("到店自取"), "daodianziqu" : MessageLookupByLibrary.simpleMessage("到店自取"),
"daopinglunliebiaodingbu" : MessageLookupByLibrary.simpleMessage("到评论列表顶部"), "daopinglunliebiaodingbu" : MessageLookupByLibrary.simpleMessage("到评论列表顶部"),
"daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等级"), "daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等级"),

1
lib/generated/intl/messages_zh_CN.dart

@ -158,6 +158,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dangqiandengji" : MessageLookupByLibrary.simpleMessage("当前等级"), "dangqiandengji" : MessageLookupByLibrary.simpleMessage("当前等级"),
"dangqianjifen" : MessageLookupByLibrary.simpleMessage("当前积分:"), "dangqianjifen" : MessageLookupByLibrary.simpleMessage("当前积分:"),
"dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("当前商品兑换核销码已核销完成"), "dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("当前商品兑换核销码已核销完成"),
"dangqianzhukadengji" : MessageLookupByLibrary.simpleMessage("当前主卡等级"),
"daodianziqu" : MessageLookupByLibrary.simpleMessage("到店自取"), "daodianziqu" : MessageLookupByLibrary.simpleMessage("到店自取"),
"daopinglunliebiaodingbu" : MessageLookupByLibrary.simpleMessage("到评论列表顶部"), "daopinglunliebiaodingbu" : MessageLookupByLibrary.simpleMessage("到评论列表顶部"),
"daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等级"), "daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等级"),

1
lib/generated/intl/messages_zh_Hans_CN.dart

@ -158,6 +158,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dangqiandengji" : MessageLookupByLibrary.simpleMessage("当前等级"), "dangqiandengji" : MessageLookupByLibrary.simpleMessage("当前等级"),
"dangqianjifen" : MessageLookupByLibrary.simpleMessage("当前积分:"), "dangqianjifen" : MessageLookupByLibrary.simpleMessage("当前积分:"),
"dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("当前商品兑换核销码已核销完成"), "dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("当前商品兑换核销码已核销完成"),
"dangqianzhukadengji" : MessageLookupByLibrary.simpleMessage("当前主卡等级"),
"daodianziqu" : MessageLookupByLibrary.simpleMessage("到店自取"), "daodianziqu" : MessageLookupByLibrary.simpleMessage("到店自取"),
"daopinglunliebiaodingbu" : MessageLookupByLibrary.simpleMessage("到评论列表顶部"), "daopinglunliebiaodingbu" : MessageLookupByLibrary.simpleMessage("到评论列表顶部"),
"daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等级"), "daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等级"),

1
lib/generated/intl/messages_zh_Hant_CN.dart

@ -158,6 +158,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dangqiandengji" : MessageLookupByLibrary.simpleMessage("當前等級"), "dangqiandengji" : MessageLookupByLibrary.simpleMessage("當前等級"),
"dangqianjifen" : MessageLookupByLibrary.simpleMessage("當前積分:"), "dangqianjifen" : MessageLookupByLibrary.simpleMessage("當前積分:"),
"dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("當前商品兌換核銷碼已核銷完成 "), "dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("當前商品兌換核銷碼已核銷完成 "),
"dangqianzhukadengji" : MessageLookupByLibrary.simpleMessage("當前主卡等級"),
"daodianziqu" : MessageLookupByLibrary.simpleMessage("到店自取"), "daodianziqu" : MessageLookupByLibrary.simpleMessage("到店自取"),
"daopinglunliebiaodingbu" : MessageLookupByLibrary.simpleMessage("到評論列表頂部"), "daopinglunliebiaodingbu" : MessageLookupByLibrary.simpleMessage("到評論列表頂部"),
"daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等級"), "daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等級"),

1
lib/generated/intl/messages_zh_TW.dart

@ -158,6 +158,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dangqiandengji" : MessageLookupByLibrary.simpleMessage("當前等級"), "dangqiandengji" : MessageLookupByLibrary.simpleMessage("當前等級"),
"dangqianjifen" : MessageLookupByLibrary.simpleMessage("當前積分:"), "dangqianjifen" : MessageLookupByLibrary.simpleMessage("當前積分:"),
"dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("當前商品兌換核銷碼已核銷完成 "), "dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("當前商品兌換核銷碼已核銷完成 "),
"dangqianzhukadengji" : MessageLookupByLibrary.simpleMessage("當前主卡等級"),
"daodianziqu" : MessageLookupByLibrary.simpleMessage("到店自取"), "daodianziqu" : MessageLookupByLibrary.simpleMessage("到店自取"),
"daopinglunliebiaodingbu" : MessageLookupByLibrary.simpleMessage("到評論列表頂部"), "daopinglunliebiaodingbu" : MessageLookupByLibrary.simpleMessage("到評論列表頂部"),
"daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等級"), "daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等級"),

10
lib/generated/l10n.dart

@ -5525,6 +5525,16 @@ class S {
); );
} }
/// ``
String get dangqianzhukadengji {
return Intl.message(
'当前主卡等级',
name: 'dangqianzhukadengji',
desc: '',
args: [],
);
}
/// `使` /// `使`
String get privacy_policy4 { String get privacy_policy4 {
return Intl.message( return Intl.message(

2
lib/integral/intergra_view/integral_vip.dart

@ -68,7 +68,7 @@ class _IntegralVip extends State<IntegralVip> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text( Text(
(widget.signInfo != null && widget.signInfo.rank != null) (widget?.signInfo?.rank?.rankName != null)
? "${widget.signInfo.rank.rankName.replaceAll("会员", "")}" ? "${widget.signInfo.rank.rankName.replaceAll("会员", "")}"
: "", : "",
style: TextStyle( style: TextStyle(

1
lib/l10n/intl_en.arb

@ -573,6 +573,7 @@
"shouhuodi": "收货地址", "shouhuodi": "收货地址",
"chakanhexiaoma": "查看核销码", "chakanhexiaoma": "查看核销码",
"chakanwuliu": "查看物流", "chakanwuliu": "查看物流",
"dangqianzhukadengji": "当前主卡等级",

1
lib/l10n/intl_zh_CN.arb

@ -571,6 +571,7 @@
"shouhuodi": "收货地址", "shouhuodi": "收货地址",
"chakanhexiaoma": "查看核销码", "chakanhexiaoma": "查看核销码",
"chakanwuliu": "查看物流", "chakanwuliu": "查看物流",
"dangqianzhukadengji": "当前主卡等级",

1
lib/l10n/intl_zh_Hans_CN.arb

@ -571,6 +571,7 @@
"shouhuodi": "收货地址", "shouhuodi": "收货地址",
"chakanhexiaoma": "查看核销码", "chakanhexiaoma": "查看核销码",
"chakanwuliu": "查看物流", "chakanwuliu": "查看物流",
"dangqianzhukadengji": "当前主卡等级",

1
lib/l10n/intl_zh_Hant_CN.arb

@ -565,6 +565,7 @@
"dingdanbianhao": "訂單編號", "dingdanbianhao": "訂單編號",
"chakanhexiaoma": "查看核銷碼", "chakanhexiaoma": "查看核銷碼",
"chakanwuliu": "查看物流", "chakanwuliu": "查看物流",
"dangqianzhukadengji": "當前主卡等級",

1
lib/l10n/intl_zh_TW.arb

@ -565,6 +565,7 @@
"shouhuodi": "收貨地址", "shouhuodi": "收貨地址",
"chakanhexiaoma": "查看核銷碼", "chakanhexiaoma": "查看核銷碼",
"chakanwuliu": "查看物流", "chakanwuliu": "查看物流",
"dangqianzhukadengji": "當前主卡等級",

17
lib/mine/mine_page.dart

@ -118,7 +118,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
///(/) ///(//)
querySocialInfo() async { querySocialInfo() async {
SharedPreferences value = await SharedPreferences.getInstance(); SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService( apiService = ApiService(
@ -197,15 +197,10 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
ranks: ranks, ranks: ranks,
userInfo: userInfo, userInfo: userInfo,
rank: (userInfo != null) rank: (userInfo != null)
? int.tryParse(userInfo.points) ? int.tryParse(userInfo.expendAmount)
: 0, : 0,
rankMax: (userInfo != null && rankMax: userInfo?.memberRankVo?.rankOrigin??0,
userInfo.memberRankVo != null) createTime: userInfo?.createTime??"",
? userInfo.memberRankVo.rankOrigin
: 0,
createTime: (userInfo != null)
? userInfo.createTime
: "",
), ),
], ],
), ),
@ -305,7 +300,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
); );
} }
///// /////
Widget attention(){ Widget attention(){
return Container( return Container(
margin: EdgeInsets.only(left: 16,top: 10), margin: EdgeInsets.only(left: 16,top: 10),
@ -400,7 +395,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
), ),
SizedBox(width: 5,), SizedBox(width: 5,),
Text( Text(
"1", infoNumber != null ?infoNumber.achievementNumber.toString() :"0",
style: TextStyle( style: TextStyle(
color: Color(0xFF000000), color: Color(0xFF000000),
fontSize: 15.sp, fontSize: 15.sp,

2
lib/mine/mine_view/community_follow.dart

@ -31,7 +31,7 @@ class _CommunityFollow extends State<CommunityFollow>
querySocialInfo(); querySocialInfo();
} }
///(/) ///(//)
querySocialInfo() async { querySocialInfo() async {
SharedPreferences value = await SharedPreferences.getInstance(); SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService( apiService = ApiService(

82
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/second_card_list.dart';
import 'package:huixiang/retrofit/data/vip_benefit_list.dart'; import 'package:huixiang/retrofit/data/vip_benefit_list.dart';
import 'package:huixiang/retrofit/retrofit_api.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/utils/font_weight.dart';
import 'package:huixiang/view_widget/border_text.dart'; import 'package:huixiang/view_widget/border_text.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
@ -311,7 +312,7 @@ class _LegalRightDetails extends State<LegalRightDetails> {
SizedBox( SizedBox(
height: 20, height: 20,
), ),
if(vipBenefitList[checkIndex].name == "副卡") if(vipBenefitList[checkIndex].name == "副卡" && vipBenefitList[checkIndex].actived && vipBenefitList[checkIndex].have)
Container( Container(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -438,14 +439,76 @@ class _LegalRightDetails extends State<LegalRightDetails> {
alignment: Alignment.center, alignment: Alignment.center,
child: Column( child: Column(
children: [ children: [
MImage( Stack(
vipBenefitList.icon, alignment: Alignment.bottomCenter,
width: 50, children: [
height: 50, MImage(
fit: BoxFit.cover, vipBenefitList?.icon ?? "",
errorSrc: "assets/image/default_1.png", width: 50,
fadeSrc: "assets/image/default_1.png", 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( SizedBox(
height: 8.h, height: 8.h,
), ),
@ -507,6 +570,7 @@ class _LegalRightDetails extends State<LegalRightDetails> {
secondCardList?.headimg ?? "", secondCardList?.headimg ?? "",
width: 50, width: 50,
height: 50, height: 50,
isCircle: true,
fit: BoxFit.cover, fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png", errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png", fadeSrc: "assets/image/default_1.png",
@ -530,7 +594,7 @@ class _LegalRightDetails extends State<LegalRightDetails> {
height: 5.h, height: 5.h,
), ),
Text( Text(
secondCardList?.phone ?? "", AppUtils.phoneEncode(secondCardList?.phone ?? ""),
style: TextStyle( style: TextStyle(
color: Color(0xFF79572D), color: Color(0xFF79572D),
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,

51
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/generated/l10n.dart';
import 'package:huixiang/retrofit/data/achievement_detail_list.dart'; import 'package:huixiang/retrofit/data/achievement_detail_list.dart';
import 'package:huixiang/retrofit/data/base_data.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/user_info.dart';
import 'package:huixiang/retrofit/data/vip_badges_list.dart'; import 'package:huixiang/retrofit/data/vip_badges_list.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.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/custom_image.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
@ -34,7 +36,7 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
List<VipBadgesList> vipBadgesList = []; List<VipBadgesList> vipBadgesList = [];
List<AchievementDetailList> achievementDetail = []; List<AchievementDetailList> achievementDetail = [];
int checkPosition = 0; int checkPosition = 0;
int attainmentPoint = 0; SocialInfo infoNumber;
@override @override
void dispose() { void dispose() {
@ -47,7 +49,7 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
super.initState(); super.initState();
userInfo = widget.arguments["userInfo"]; userInfo = widget.arguments["userInfo"];
queryAttainmentBadges(); queryAttainmentBadges();
queryAchievementDetail("1460164746211753984"); querySocialInfo();
} }
/// ///
@ -76,7 +78,7 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
} }
/// ///
queryAchievementDetail(achievementCategoryId) async { queryAchievementDetail(index) async {
if (apiService == null) { if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance(); SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService( apiService = ApiService(
@ -86,17 +88,33 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
); );
} }
BaseData<List<AchievementDetailList>> baseData = await apiService BaseData<List<AchievementDetailList>> baseData = await apiService
.getAchievementDetail(achievementCategoryId) .getAchievementDetail(vipBadgesList[index].id)
.catchError((onError) {}); .catchError((onError) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
setState(() { setState(() {
achievementDetail.clear(); achievementDetail.clear();
attainmentPoint = 0;
achievementDetail.addAll(baseData.data); achievementDetail.addAll(baseData.data);
achievementDetail.forEach((element) { showDeleteDialog(index);
if(element.actived) });
attainmentPoint += 1; }
}); EasyLoading.dismiss();
}
///(//)
querySocialInfo() async {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
showLoading: false,
);
BaseData<SocialInfo> baseData =
await apiService.socialInfo().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
infoNumber = baseData.data;
}); });
} }
EasyLoading.dismiss(); EasyLoading.dismiss();
@ -182,7 +200,7 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
color: Color(0xFF353535)), color: Color(0xFF353535)),
), ),
Text( Text(
attainmentPoint.toString(), infoNumber != null ? infoNumber.achievementNumber.toString() :"0",
style: TextStyle( style: TextStyle(
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
fontSize: 14, fontSize: 14,
@ -230,7 +248,7 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
showDeleteDialog(index); queryAchievementDetail(index);
}); });
}, },
child: badgeItem(vipBadgesList[index]), child: badgeItem(vipBadgesList[index]),
@ -441,4 +459,15 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
], ],
); );
} }
///()
showAlertDialog() {
//
showDialog(
context: context,
builder: (BuildContext context) {
return BadgeAttainmentDialog();
},
);
}
} }

104
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_html/flutter_html.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:fluwx/fluwx.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/rank.dart'; import 'package:huixiang/retrofit/data/rank.dart';
import 'package:huixiang/retrofit/data/vip_benefit_list.dart'; import 'package:huixiang/retrofit/data/vip_benefit_list.dart';
import 'package:huixiang/retrofit/data/vip_rule_details.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/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
@ -36,6 +38,7 @@ class _MineVipCore extends State<MineVipCore> {
List<Rank> ranks = []; List<Rank> ranks = [];
List<VipBenefitList> vipBenefitList = []; List<VipBenefitList> vipBenefitList = [];
VipRuleDetails vipRuleDetails; VipRuleDetails vipRuleDetails;
int checkIndex = 0;
final SwiperController controller = SwiperController(); final SwiperController controller = SwiperController();
@ -44,6 +47,16 @@ class _MineVipCore extends State<MineVipCore> {
super.initState(); super.initState();
SharedPreferences.getInstance().then((value) { 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 =
ApiService(Dio(), context: context, token: value.getString("token")); ApiService(Dio(), context: context, token: value.getString("token"));
queryVipLevel(); queryVipLevel();
@ -78,7 +91,7 @@ class _MineVipCore extends State<MineVipCore> {
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
///// //////
queryRuleDetails() async { queryRuleDetails() async {
BaseData<VipRuleDetails> baseData = BaseData<VipRuleDetails> baseData =
await apiService.vipBenefit().catchError((onError) {}); await apiService.vipBenefit().catchError((onError) {});
@ -90,6 +103,52 @@ class _MineVipCore extends State<MineVipCore> {
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
///
buyRank() async {
// if (!(await Min.isInitialize())) {
// app的充值支付使用同一个WXPayEntryActivity回调
// getPackage空指针
//
// await Min.initialize();
// }
BaseData<dynamic> 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -99,6 +158,23 @@ class _MineVipCore extends State<MineVipCore> {
titleSize: 18.sp, titleSize: 18.sp,
background: Colors.transparent, background: Colors.transparent,
leadingColor: Colors.black, 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( body: SingleChildScrollView(
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
@ -114,6 +190,11 @@ class _MineVipCore extends State<MineVipCore> {
loop: false, loop: false,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
controller: controller, controller: controller,
onIndexChanged: (index){
setState(() {
checkIndex = index;
});
},
itemBuilder: (context, position) { itemBuilder: (context, position) {
return MineVipView( return MineVipView(
vipLevel: !(ranks != null && ranks.isNotEmpty) vipLevel: !(ranks != null && ranks.isNotEmpty)
@ -127,7 +208,7 @@ class _MineVipCore extends State<MineVipCore> {
padding: 6.w, padding: 6.w,
rank: !(ranks != null && ranks.isNotEmpty) rank: !(ranks != null && ranks.isNotEmpty)
? 0 ? 0
: widget.arguments["points"], : widget.arguments["expendAmount"],
rankMax: !(ranks != null && ranks.isNotEmpty) rankMax: !(ranks != null && ranks.isNotEmpty)
? 0 ? 0
: (position < (ranks.length - 1)) : (position < (ranks.length - 1))
@ -387,10 +468,12 @@ class _MineVipCore extends State<MineVipCore> {
], ],
), ),
), ),
InkWell( if(
ranks.length > checkIndex && widget.arguments["rankLevel"] < ranks[checkIndex].level && ranks[checkIndex].price != "0.00")
InkWell(
onTap: () { onTap: () {
setState(() { setState(() {
showAlertDialog(); buyRank();
}); });
}, },
child: Container( child: Container(
@ -408,7 +491,7 @@ class _MineVipCore extends State<MineVipCore> {
height: 54, height: 54,
alignment: Alignment.center, alignment: Alignment.center,
child: Text( child: Text(
"${S.of(context).lijikaitong}20000/永久", "${S.of(context).lijikaitong}${ranks.length>checkIndex?ranks[checkIndex].price:""}/永久",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 16.sp, fontSize: 16.sp,
@ -416,7 +499,7 @@ class _MineVipCore extends State<MineVipCore> {
), ),
), ),
), ),
) ),
], ],
), ),
), ),
@ -570,7 +653,7 @@ class _MineVipCore extends State<MineVipCore> {
SizedBox( SizedBox(
height: 5.h, height: 5.h,
), ),
Text( Expanded(child: Text(
vipBenefitList?.name ?? "", vipBenefitList?.name ?? "",
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@ -580,19 +663,20 @@ class _MineVipCore extends State<MineVipCore> {
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
fontSize: 12.sp, fontSize: 12.sp,
), ),
), ))
,
], ],
), ),
); );
} }
/// ///
showAlertDialog() { showAlertDialog(vipName) {
// //
showDialog( showDialog(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return VipDialog(); return VipDialog(vipName);
}, },
); );
} }

376
lib/mine/recharge_page.dart

@ -1,12 +1,17 @@
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.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:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:fluwx/fluwx.dart'; import 'package:fluwx/fluwx.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.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/data/wx_pay.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/utils/min.dart'; import 'package:huixiang/utils/min.dart';
import 'package:huixiang/view_widget/item_input_widget.dart'; import 'package:huixiang/view_widget/item_input_widget.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -23,10 +28,11 @@ class RechargePage extends StatefulWidget {
class _RechargePage extends State<RechargePage> { class _RechargePage extends State<RechargePage> {
ApiService apiService; ApiService apiService;
TextEditingController controller = TextEditingController(); TextEditingController controller = TextEditingController();
VipRuleDetails vipRuleDetails;
List<VipBenefitList> vipBenefitList = [];
Color color = Colors.black; Color color = Colors.black;
double discount = 100;
@override @override
void initState() { void initState() {
@ -35,9 +41,42 @@ class _RechargePage extends State<RechargePage> {
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
apiService = ApiService(Dio(), apiService = ApiService(Dio(),
context: context, token: value.getString("token"), pay: true); context: context, token: value.getString("token"), pay: true);
queryBenefitList();
queryRuleDetails();
}); });
} }
///
queryBenefitList() async {
BaseData<List<VipBenefitList>> 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<VipRuleDetails> baseData =
await apiService.vipBenefit().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
vipRuleDetails = baseData.data;
});
}
EasyLoading.dismiss();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -48,137 +87,217 @@ class _RechargePage extends State<RechargePage> {
background: Color(0xFFFFFFFF), background: Color(0xFFFFFFFF),
leadingColor: Colors.black, leadingColor: Colors.black,
), ),
body: SingleChildScrollView( body:Stack(
physics: BouncingScrollPhysics(), children: [
child: Container( SingleChildScrollView(
child: Column( physics: BouncingScrollPhysics(),
children: [ child: Container(
ItemInputWidget( child: Column(
S.of(context).qingshuruchongzhijine, children: [
hintText: "", Container(
controller: controller, child: Column(children: [
padding: EdgeInsets.all(20), ItemInputWidget(
errorText: S.of(context).chongzhizuixiaojine(10), S.of(context).qingshuruchongzhijine,
titleColor: Color(0xFF727272), hintText: "",
errorTextColor: Color(0xFF32A060), controller: controller,
radius: 8, padding: EdgeInsets.all(20),
style: TextStyle( errorText: S.of(context).chongzhizuixiaojine(0.1),
fontWeight: FontWeight.bold, titleColor: Color(0xFF727272),
fontSize: 27.sp, errorTextColor: Color(0xFF32A060),
color: color, radius: 8,
), discount: discount/10,
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,
style: TextStyle( style: TextStyle(
fontSize: 16.sp,
color: Colors.black,
fontWeight: FontWeight.bold, 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(() {});
},
), ),
), Row(
GestureDetector(
onTap: () {
setState(() {
checkIndex = 1;
});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
Image.asset("assets/image/icon_we_chat.png"), if (vipRuleDetails?.recharge != null &&
Expanded( vipRuleDetails.recharge != "")
flex: 1, Expanded(child:Container(
child: Padding( color: Colors.white,
padding: EdgeInsets.only(left: 8.w), padding: EdgeInsets.only(left: 8),
child: Text( child: Html(
S.of(context).weixinzhifu, data: "注意:${vipRuleDetails?.recharge??""}",
style: TextStyle( customImageRenders: {
fontSize: 14.sp, networkSourceMatcher(): networkImageRender(
color: Color(0xff353535), 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<RechargePage> {
} }
int amount = int.tryParse(money); int amount = int.tryParse(money);
if (checkIndex == 1) { if (checkIndex == 1) {
if (amount < 10) { if (amount < 0.001) {
SmartDialog.showToast(S.of(context).chongzhizuixiaojine(10), SmartDialog.showToast(S.of(context).chongzhizuixiaojine(0.001),
alignment: Alignment.center); alignment: Alignment.center);
return; return;
} }
@ -220,10 +339,10 @@ class _RechargePage extends State<RechargePage> {
// await Min.initialize(); // await Min.initialize();
// } // }
BaseData<WxPay> baseData = BaseData<dynamic> baseData =
await apiService.recharge({"amount": amount, "rechargeType": 2}); await apiService.recharge({"amount": amount, "rechargeType": 2});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
WxPay wxPay = baseData.data; WxPay wxPay = WxPay.fromJson(baseData.data);
await registerWxApi( await registerWxApi(
appId: wxPay.appId, appId: wxPay.appId,
doOnAndroid: true, doOnAndroid: true,
@ -240,8 +359,19 @@ class _RechargePage extends State<RechargePage> {
); );
weChatResponseEventHandler.listen((event) async { weChatResponseEventHandler.listen((event) async {
print("payCallback: ${event.errCode}"); 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);
}
} }
} }
} }

20
lib/order/exchange_history_page.dart

@ -486,17 +486,15 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
GestureDetector( GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
// Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
// '/router/logistics_information_page', '/router/logistics_information_page',
// arguments: { arguments: {
// "logisticsNum": orderInfo.logisticsNum, "orderId": exchangeOrder.creditOrderDetailList[0].orderId,
// "logisticsName": orderInfo.logisticsName, "logisticsNum": "",
// "shipperCode": orderInfo.shipperCode, "logisticsName": "",
// "productNum": orderInfo.productList.length, "productNum": exchangeOrder.creditOrderDetailList[0].goodsNumber,
// "skuImg": orderInfo.productList.length > 0 "skuImg":exchangeOrder.creditOrderDetailList[0].goodsMainImg
// ? orderInfo.productList[0].skuImg });
// : ""
// });
}); });
}, },
child: buildBtnStatusTow(exchangeOrder.state), child: buildBtnStatusTow(exchangeOrder.state),

34
lib/order/exchange_order_page.dart

@ -993,19 +993,26 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
); );
weChatResponseEventHandler.listen((event) async { weChatResponseEventHandler.listen((event) async {
print("payCallback: ${event.errCode}"); print("payCallback: ${event.errCode}");
Navigator.of(context).popAndPushNamed( if(event.errCode == 0){
'/router/exchange_order_success_page', Navigator.of(context).popAndPushNamed(
arguments: { '/router/exchange_order_success_page',
"id": widget.arguments["goodsId"], arguments: {
"price": (widget.arguments["payType"] == 1 ? "id": widget.arguments["goodsId"],
(double.parse(widget.arguments["onePrice"])*buyNum).toString(): "price": (widget.arguments["payType"] == 1 ?
(widget.arguments["price"] == null || widget.arguments["price"] == "0" (double.parse(widget.arguments["onePrice"])*buyNum).toString():
? "0" (widget.arguments["price"] == null || widget.arguments["price"] == "0"
: (double.parse(widget.arguments["price"])*buyNum).toString())), ? "0"
"points": points, : (double.parse(widget.arguments["price"])*buyNum).toString())),
"payChannel":widget.arguments["payChannel"], "points": points,
}, "realPay":handleNeedPay(),
); "payChannel":widget.arguments["payChannel"],
},
);
}else {
SmartDialog.showToast("支付失败", alignment: Alignment.center);
return;
}
}); });
return; return;
} }
@ -1016,6 +1023,7 @@ class _ExchangeOrderPage extends State<ExchangeOrderPage> {
(widget.arguments["price"] == null || widget.arguments["price"] == "0" (widget.arguments["price"] == null || widget.arguments["price"] == "0"
? "0" ? "0"
: (double.parse(widget.arguments["price"])*buyNum).toString())), : (double.parse(widget.arguments["price"])*buyNum).toString())),
"realPay":handleNeedPay(),
"points": points, "points": points,
"payChannel":widget.arguments["payChannel"], "payChannel":widget.arguments["payChannel"],
"id": baseDate.data "id": baseDate.data

2
lib/order/exchange_order_success_page.dart

@ -87,7 +87,7 @@ class _ExchangeOrderSuccessPage extends State<ExchangeOrderSuccessPage> {
child: Column( child: Column(
children: [ children: [
Text( Text(
widget.arguments["price"], widget.arguments["realPay"],
style: TextStyle( style: TextStyle(
color: Colors.black, color: Colors.black,
fontSize: 21.sp, fontSize: 21.sp,

59
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/data/logistics.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.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:huixiang/view_widget/my_appbar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/no_data_view.dart'; import 'package:huixiang/view_widget/no_data_view.dart';
@ -35,8 +36,12 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
apiService = apiService =
ApiService(Dio(), context: context, token: value.getString("token")); 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"] ?? ""); widget.arguments["logisticsNum"] ?? "");
else
queryAppShippingTrace(widget.arguments["orderId"]);
}); });
} }
@ -63,6 +68,27 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
} }
} }
queryAppShippingTrace(orderId) async {
BaseData<Logistics> 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -115,12 +141,13 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
color: Color(0xff353535)), color: Color(0xff353535)),
), ),
), ),
SizedBox( Container(
height: 500.h,
child: (logistics != null && logistics.length > 0) child: (logistics != null && logistics.length > 0)
? ListView.builder( ? ListView.builder(
itemCount: itemCount:
logistics != null ? logistics.length : 0, logistics != null ? logistics.length : 0,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return orderTrackItem(logistics[position], return orderTrackItem(logistics[position],
position, logistics.length); position, logistics.length);
@ -166,20 +193,14 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
Stack( Stack(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
children: [ children: [
if (widget.arguments["skuImg"] != null) MImage(
Image.network( widget.arguments["skuImg"] != null ? widget.arguments["skuImg"] : "",
widget.arguments["skuImg"], width: 95,
width: 95.w, height: 95,
height: 95.h, fit: BoxFit.cover,
fit: BoxFit.cover, errorSrc: "assets/image/default_1.png",
) fadeSrc: "assets/image/default_1.png",
else ),
Image.asset(
"assets/image/default_1.png",
width: 95.w,
height: 95.h,
fit: BoxFit.cover,
),
Container( Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 32.w, right: 32.w, top: 5.h, bottom: 5.h), left: 32.w, right: 32.w, top: 5.h, bottom: 5.h),
@ -409,7 +430,7 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
String tripStatus = "assets/image/icon_sign.png"; String tripStatus = "assets/image/icon_sign.png";
if (type.contains("已签收")) { if (type.contains("已签收")) {
tripStatus = "assets/image/icon_sign.png"; tripStatus = "assets/image/icon_sign.png";
} else if (type.contains("派送中")) { } else if (type.contains("派送中") || type.contains("派件中")) {
tripStatus = "assets/image/icon_delivery.png"; tripStatus = "assets/image/icon_delivery.png";
} else if (type.contains("运输中") || type.contains("发往")) { } else if (type.contains("运输中") || type.contains("发往")) {
tripStatus = "assets/image/icon_transport.png"; tripStatus = "assets/image/icon_transport.png";
@ -425,7 +446,7 @@ class _LogisticsInformationPage extends State<LogisticsInformationPage> {
String logisticsTripStatus = ""; String logisticsTripStatus = "";
if (state.contains("已签收")) { if (state.contains("已签收")) {
logisticsTripStatus = "已签收"; logisticsTripStatus = "已签收";
} else if (state.contains("派送中")) { } else if (state.contains("派送中") || state.contains("派件中")) {
logisticsTripStatus = "派送中"; logisticsTripStatus = "派送中";
} else if (state.contains("运输中") || state.contains("发往")) { } else if (state.contains("运输中") || state.contains("发往")) {
logisticsTripStatus = "运输中"; logisticsTripStatus = "运输中";

6
lib/retrofit/data/goods.dart

@ -42,6 +42,7 @@ class Goods {
String money, String money,
String onePrice, String onePrice,
String oneMoney, String oneMoney,
String orderId,
int stock, int stock,
int sales, int sales,
bool isHot, bool isHot,
@ -68,6 +69,7 @@ class Goods {
_money = money; _money = money;
_onePrice = onePrice; _onePrice = onePrice;
_oneMoney = oneMoney; _oneMoney = oneMoney;
_orderId = orderId;
_stock = stock; _stock = stock;
_sales = sales; _sales = sales;
_isHot = isHot; _isHot = isHot;
@ -97,6 +99,7 @@ class Goods {
_money = json['money']; _money = json['money'];
_onePrice = json['onePrice']; _onePrice = json['onePrice'];
_oneMoney = json['oneMoney']; _oneMoney = json['oneMoney'];
_orderId = json['orderId'];
_stock = json['stock']; _stock = json['stock'];
_sales = json['sales']; _sales = json['sales'];
_isHot = json['isHot']; _isHot = json['isHot'];
@ -124,6 +127,7 @@ class Goods {
String _money; String _money;
String _onePrice; String _onePrice;
String _oneMoney; String _oneMoney;
String _orderId;
int _stock; int _stock;
int _sales; int _sales;
bool _isHot; bool _isHot;
@ -151,6 +155,7 @@ class Goods {
String get money => _money; String get money => _money;
String get onePrice => _onePrice; String get onePrice => _onePrice;
String get oneMoney => _oneMoney; String get oneMoney => _oneMoney;
String get orderId => _orderId;
int get stock => _stock; int get stock => _stock;
int get sales => _sales; int get sales => _sales;
bool get isHot => _isHot; bool get isHot => _isHot;
@ -180,6 +185,7 @@ class Goods {
map['money'] = _money; map['money'] = _money;
map['onePrice'] = _onePrice; map['onePrice'] = _onePrice;
map['oneMoney'] = _oneMoney; map['oneMoney'] = _oneMoney;
map['orderId'] = _orderId;
map['stock'] = _stock; map['stock'] = _stock;
map['sales'] = _sales; map['sales'] = _sales;
map['isHot'] = _isHot; map['isHot'] = _isHot;

10
lib/retrofit/data/rank.dart

@ -18,6 +18,7 @@ class Rank {
String _rankImg; String _rankImg;
String _rankName; String _rankName;
int _rankOrigin; int _rankOrigin;
int _level;
bool _status; bool _status;
String _updateTime; String _updateTime;
String _updateUser; String _updateUser;
@ -30,6 +31,7 @@ class Rank {
String get rankImg => _rankImg; String get rankImg => _rankImg;
String get rankName => _rankName; String get rankName => _rankName;
int get rankOrigin => _rankOrigin; int get rankOrigin => _rankOrigin;
int get level => _level;
bool get status => _status; bool get status => _status;
String get updateTime => _updateTime; String get updateTime => _updateTime;
String get updateUser => _updateUser; String get updateUser => _updateUser;
@ -41,8 +43,9 @@ class Rank {
String rankContent, String rankContent,
String rankImg, String rankImg,
String rankName, String rankName,
int rankOrigin, int rankOrigin,
bool status, int level,
bool status,
String updateTime, String updateTime,
String updateUser}){ String updateUser}){
_createTime = createTime; _createTime = createTime;
@ -53,6 +56,7 @@ class Rank {
_rankImg = rankImg; _rankImg = rankImg;
_rankName = rankName; _rankName = rankName;
_rankOrigin = rankOrigin; _rankOrigin = rankOrigin;
_level = level;
_status = status; _status = status;
_updateTime = updateTime; _updateTime = updateTime;
_updateUser = updateUser; _updateUser = updateUser;
@ -67,6 +71,7 @@ class Rank {
_rankImg = json["rankImg"]; _rankImg = json["rankImg"];
_rankName = json["rankName"]; _rankName = json["rankName"];
_rankOrigin = json["rankOrigin"]; _rankOrigin = json["rankOrigin"];
_level = json["level"];
_status = json["status"]; _status = json["status"];
_updateTime = json["updateTime"]; _updateTime = json["updateTime"];
_updateUser = json["updateUser"]; _updateUser = json["updateUser"];
@ -82,6 +87,7 @@ class Rank {
map["rankImg"] = _rankImg; map["rankImg"] = _rankImg;
map["rankName"] = _rankName; map["rankName"] = _rankName;
map["rankOrigin"] = _rankOrigin; map["rankOrigin"] = _rankOrigin;
map["level"] = _level;
map["status"] = _status; map["status"] = _status;
map["updateTime"] = _updateTime; map["updateTime"] = _updateTime;
map["updateUser"] = _updateUser; map["updateUser"] = _updateUser;

3
lib/retrofit/data/settleOrderInfo.dart

@ -8,6 +8,7 @@ class SettleOrderInfo {
dynamic memberVO; dynamic memberVO;
String postAge; String postAge;
String price; String price;
String benefitDiscountAmount;
String orderSum; String orderSum;
String discountAmount; String discountAmount;
List<PromotionInfoListBean> promotionInfoList; List<PromotionInfoListBean> promotionInfoList;
@ -25,6 +26,7 @@ class SettleOrderInfo {
settleOrderInfoBean.memberVO = map['memberVO']; settleOrderInfoBean.memberVO = map['memberVO'];
settleOrderInfoBean.postAge = map['postAge']; settleOrderInfoBean.postAge = map['postAge'];
settleOrderInfoBean.price = map['price']; settleOrderInfoBean.price = map['price'];
settleOrderInfoBean.benefitDiscountAmount = map['benefitDiscountAmount'];
settleOrderInfoBean.orderSum = map['orderSum']; settleOrderInfoBean.orderSum = map['orderSum'];
settleOrderInfoBean.discountAmount = map['discountAmount']; settleOrderInfoBean.discountAmount = map['discountAmount'];
settleOrderInfoBean.promotionInfoList = List()..addAll( settleOrderInfoBean.promotionInfoList = List()..addAll(
@ -48,6 +50,7 @@ class SettleOrderInfo {
"memberVO": memberVO, "memberVO": memberVO,
"postAge": postAge, "postAge": postAge,
"price": price, "price": price,
"benefitDiscountAmount": benefitDiscountAmount,
"orderSum": orderSum, "orderSum": orderSum,
"discountAmount": discountAmount, "discountAmount": discountAmount,
"promotionInfoList": promotionInfoList, "promotionInfoList": promotionInfoList,

12
lib/retrofit/data/social_info.dart

@ -4,20 +4,25 @@
class SocialInfo { class SocialInfo {
SocialInfo({ SocialInfo({
int fans, int fans,
int follow,}){ int follow,
int achievementNumber}){
_fans = fans; _fans = fans;
_follow = follow; _follow = follow;
_achievementNumber = achievementNumber;
} }
SocialInfo.fromJson(dynamic json) { SocialInfo.fromJson(dynamic json) {
_fans = json['fans']; _fans = json['fans'];
_follow = json['follow']; _follow = json['follow'];
_achievementNumber = json['achievementNumber'];
} }
int _fans; int _fans;
int _follow; int _follow;
int _achievementNumber;
int get fans => _fans; int get fans => _fans;
int get follow => _follow; int get follow => _follow;
int get achievementNumber => _achievementNumber;
set fans(int value) { set fans(int value) {
@ -28,10 +33,15 @@ class SocialInfo {
final map = <String, dynamic>{}; final map = <String, dynamic>{};
map['fans'] = _fans; map['fans'] = _fans;
map['follow'] = _follow; map['follow'] = _follow;
map['achievementNumber'] = _achievementNumber;
return map; return map;
} }
set follow(int value) { set follow(int value) {
_follow = value; _follow = value;
} }
set achievementNumber(int value) {
_achievementNumber = value;
}
} }

9
lib/retrofit/data/user_info.dart

@ -32,8 +32,11 @@ class UserInfo {
String birth; String birth;
dynamic balance; dynamic balance;
String money; String money;
String expendAmount;
String points; String points;
bool isBind; bool isBind;
String masterId;
String masterCardRankName;
MemberRank memberRankVo; MemberRank memberRankVo;
factory UserInfo.fromJson(Map<String, dynamic> json) => factory UserInfo.fromJson(Map<String, dynamic> json) =>
@ -51,8 +54,11 @@ class UserInfo {
..birth = json['birth'] as String ..birth = json['birth'] as String
..balance = json['balance'] ..balance = json['balance']
..money = json['money'] as String ..money = json['money'] as String
..expendAmount = json['expendAmount'] as String
..points = json['points'] as String ..points = json['points'] as String
..isBind = json['isBind'] as bool ..isBind = json['isBind'] as bool
..masterId = json['masterId'] as String
..masterCardRankName = json['masterCardRankName'] as String
..memberRankVo = json['memberRankVo'] == null ..memberRankVo = json['memberRankVo'] == null
? null ? null
: MemberRank.fromJson(json['memberRankVo'] as Map<String, dynamic>); : MemberRank.fromJson(json['memberRankVo'] as Map<String, dynamic>);
@ -71,8 +77,11 @@ class UserInfo {
'birth': this.birth, 'birth': this.birth,
'balance': this.balance, 'balance': this.balance,
'money': this.money, 'money': this.money,
'expendAmount': this.expendAmount,
'points': this.points, 'points': this.points,
'isBind': this.isBind, 'isBind': this.isBind,
'masterId': this.masterId,
'masterCardRankName': this.masterCardRankName,
'memberRankVo': this.memberRankVo == null ? "" : this.memberRankVo.toJson(), 'memberRankVo': this.memberRankVo == null ? "" : this.memberRankVo.toJson(),
}; };
} }

79
lib/retrofit/data/vip_benefit_list.dart

@ -1,18 +1,19 @@
/// id : "5" /// id : "5"
/// createTime : "2021-11-18 14:11:34" /// createTime : "2021-11-18 14:11:34"
/// createUser : "1" /// createUser : "1"
/// updateTime : "2021-11-18 17:10:24" /// updateTime : "2021-11-24 14:37:30"
/// updateUser : "1" /// updateUser : "1"
/// code : "DEPUTY" /// code : "DEPUTY"
/// name : "副卡" /// name : "副卡"
/// icon : "https://pos.upload.gznl.top/MDAwMA==/2021/11/fb1e46d2-6213-4164-abbc-9aa24da24faf.png" /// 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" /// iconGrey : "https://pos.upload.gznl.top/MDAwMA==/2021/11/f50d211a-3d52-4663-bf8a-c4dff4f79310.png"
/// introduce : "可绑定副卡" /// introduce : "<p>用户在成为金卡会员/共创会员之后, 即经行副卡绑定。点击添加新副卡,输入需要绑定的用户手机号,输入需要绑定用户的手机号,输入验证码,验证通过后,即可绑定成功。点击头像右下方的解除,出现提示弹窗,点击确认即可解除绑定。</p>"
/// describes : "可绑定副卡" /// describes : "<ul>\n<li>副卡用户必须为平台注册用户</li>\n<li>每位主卡用户只可绑定5位副卡用户,同时,只能解绑3次</li>\n<li>副卡享受主卡的部分权益,主卡会员失效之后,副卡也失效</li>\n<li>副卡成为金卡会员后,自动与主卡解绑</li>\n</ul>"
/// actived : true /// actived : false
/// sort : 4 /// sort : 4
/// isDelete : 0 /// isDelete : 0
/// have : false /// have : true
/// config : "5"
class VipBenefitList { class VipBenefitList {
VipBenefitList({ VipBenefitList({
@ -30,7 +31,8 @@ class VipBenefitList {
bool actived, bool actived,
int sort, int sort,
int isDelete, int isDelete,
bool have,}){ bool have,
String config,}){
_id = id; _id = id;
_createTime = createTime; _createTime = createTime;
_createUser = createUser; _createUser = createUser;
@ -46,6 +48,7 @@ class VipBenefitList {
_sort = sort; _sort = sort;
_isDelete = isDelete; _isDelete = isDelete;
_have = have; _have = have;
_config = config;
} }
VipBenefitList.fromJson(dynamic json) { VipBenefitList.fromJson(dynamic json) {
@ -64,6 +67,7 @@ class VipBenefitList {
_sort = json['sort']; _sort = json['sort'];
_isDelete = json['isDelete']; _isDelete = json['isDelete'];
_have = json['have']; _have = json['have'];
_config = json['config'];
} }
String _id; String _id;
String _createTime; String _createTime;
@ -80,6 +84,7 @@ class VipBenefitList {
int _sort; int _sort;
int _isDelete; int _isDelete;
bool _have; bool _have;
String _config;
String get id => _id; String get id => _id;
String get createTime => _createTime; String get createTime => _createTime;
@ -96,11 +101,7 @@ class VipBenefitList {
int get sort => _sort; int get sort => _sort;
int get isDelete => _isDelete; int get isDelete => _isDelete;
bool get have => _have; bool get have => _have;
String get config => _config;
set id(String value) {
_id = value;
}
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final map = <String, dynamic>{}; final map = <String, dynamic>{};
@ -119,62 +120,8 @@ class VipBenefitList {
map['sort'] = _sort; map['sort'] = _sort;
map['isDelete'] = _isDelete; map['isDelete'] = _isDelete;
map['have'] = _have; map['have'] = _have;
map['config'] = _config;
return map; 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;
}
} }

11
lib/retrofit/data/vip_rule_details.dart

@ -6,24 +6,29 @@ class VipRuleDetails {
VipRuleDetails({ VipRuleDetails({
String rule, String rule,
String contrast, String contrast,
String qa,}){ String qa,
String recharge,}){
_rule = rule; _rule = rule;
_contrast = contrast; _contrast = contrast;
_qa = qa; _qa = qa;
_recharge = recharge;
} }
VipRuleDetails.fromJson(dynamic json) { VipRuleDetails.fromJson(dynamic json) {
_rule = json['rule']; _rule = json['rule'];
_contrast = json['contrast']; _contrast = json['contrast'];
_qa = json['qa']; _qa = json['qa'];
_recharge = json['recharge'];
} }
String _rule; String _rule;
String _contrast; String _contrast;
String _qa; String _qa;
String _recharge;
String get rule => _rule; String get rule => _rule;
String get contrast => _contrast; String get contrast => _contrast;
String get qa => _qa; String get qa => _qa;
String get recharge => _recharge;
set rule(String value) { set rule(String value) {
@ -45,4 +50,8 @@ class VipRuleDetails {
set qa(String value) { set qa(String value) {
_qa = value; _qa = value;
} }
set recharge(String value) {
_recharge = value;
}
} }

26
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 base_url = "https://pos.platform.lotus-wallet.com/app/"; ///
// const baseUrl = "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 base_url = "http://192.168.10.236:8766/app/"; ///
// const baseUrl = "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 base_url = "http://192.168.10.37:8766/app/";
// const baseUrl = "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 base_url = "http://192.168.10.130:8766/app/";///
const baseUrl = "http://192.168.10.130:8766/app/";/// // const baseUrl = "http://192.168.10.130:8766/app/";///
@RestApi(baseUrl: baseUrl) @RestApi(baseUrl: baseUrl)
abstract class ApiService { abstract class ApiService {
@ -71,7 +71,7 @@ abstract class ApiService {
BuildContext context, BuildContext context,
String token, String token,
bool showLoading = true, bool showLoading = true,
bool pay = false, bool pay = true,
}) { }) {
Map<String, dynamic> headers = Map<String, dynamic> headers =
(token == null || token == "") ? {} : {'token': "Bearer $token"}; (token == null || token == "") ? {} : {'token': "Bearer $token"};
@ -204,9 +204,9 @@ abstract class ApiService {
@GET("/member/signIn") @GET("/member/signIn")
Future<BaseData> signIn(); Future<BaseData> signIn();
/// ///
@POST("/wallet/recharge") @POST("/wallet/recharge")
Future<BaseData<WxPay>> recharge(@Body() Map<String, dynamic> param); Future<BaseData<dynamic>> recharge(@Body() Map<String, dynamic> param);
/// ///
@GET("/coupon/receive?couponId={couponId}") @GET("/coupon/receive?couponId={couponId}")
@ -399,7 +399,7 @@ abstract class ApiService {
@DELETE("/information/trend/{id}") @DELETE("/information/trend/{id}")
Future<BaseData> deleteTrend(@Path("id") String id); Future<BaseData> deleteTrend(@Path("id") String id);
///(/) ///(//)
@GET("/member/socialInfo") @GET("/member/socialInfo")
Future<BaseData<SocialInfo>> socialInfo(); Future<BaseData<SocialInfo>> socialInfo();
@ -455,8 +455,16 @@ abstract class ApiService {
@GET("/member/bindSecondCard/{phone}") @GET("/member/bindSecondCard/{phone}")
Future<BaseData> bindSecondCard(@Path("phone") String phone); Future<BaseData> bindSecondCard(@Path("phone") String phone);
/// ///
@GET("/member/unbindSecondCard/{phone}") @GET("/member/unbindSecondCard/{phone}")
Future<BaseData> unbindSecondCard(@Path("phone") String phone); Future<BaseData> unbindSecondCard(@Path("phone") String phone);
///
@GET("/creditOrder/getAppShippingTrace?orderId={orderId}")
Future<BaseData<Logistics>> getAppShippingTrace(@Path("orderId") String orderId);
///
@POST("/member/rankBuy")
Future<BaseData<dynamic>> rankBuy(@Body() Map<String, dynamic> param);
} }

54
lib/retrofit/retrofit_api.g.dart

@ -9,7 +9,7 @@ part of 'retrofit_api.dart';
class _ApiService implements ApiService { class _ApiService implements ApiService {
_ApiService(this._dio, {this.baseUrl}) { _ApiService(this._dio, {this.baseUrl}) {
ArgumentError.checkNotNull(_dio, '_dio'); ArgumentError.checkNotNull(_dio, '_dio');
baseUrl ??= 'http://192.168.10.130:8766/app/'; baseUrl ??= 'http://192.168.10.236:8766/app/';
} }
final Dio _dio; final Dio _dio;
@ -271,7 +271,7 @@ class _ApiService implements ApiService {
} }
@override @override
Future<BaseData<WxPay>> recharge(param) async { Future<BaseData<dynamic>> recharge(param) async {
ArgumentError.checkNotNull(param, 'param'); ArgumentError.checkNotNull(param, 'param');
const _extra = <String, dynamic>{}; const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{}; final queryParameters = <String, dynamic>{};
@ -285,9 +285,9 @@ class _ApiService implements ApiService {
extra: _extra, extra: _extra,
baseUrl: baseUrl), baseUrl: baseUrl),
data: _data); data: _data);
final value = BaseData<WxPay>.fromJson( final value = BaseData<dynamic>.fromJson(
_result.data, _result.data,
(json) => WxPay.fromJson(json), (json) => json as dynamic,
); );
return value; return value;
} }
@ -1577,7 +1577,6 @@ class _ApiService implements ApiService {
return value; return value;
} }
@override @override
Future<BaseData<List<VipBenefitList>>> benefitList() async { Future<BaseData<List<VipBenefitList>>> benefitList() async {
const _extra = <String, dynamic>{}; const _extra = <String, dynamic>{};
@ -1621,7 +1620,6 @@ class _ApiService implements ApiService {
return value; return value;
} }
@override @override
Future<BaseData<List<SecondCardList>>> secondCardList() async { Future<BaseData<List<SecondCardList>>> secondCardList() async {
const _extra = <String, dynamic>{}; const _extra = <String, dynamic>{};
@ -1688,4 +1686,48 @@ class _ApiService implements ApiService {
return value; return value;
} }
@override
Future<BaseData<Logistics>> getAppShippingTrace(orderId) async {
ArgumentError.checkNotNull(orderId, 'orderId');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/creditOrder/getAppShippingTrace?orderId=$orderId',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<Logistics>.fromJson(
_result.data,
(json) => Logistics.fromJson(json),
);
return value;
}
@override
Future<BaseData<dynamic>> rankBuy(param) async {
ArgumentError.checkNotNull(param, 'param');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>('/member/rankBuy',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<dynamic>.fromJson(
_result.data,
(json) => json as dynamic,
);
return value;
}
} }

2
lib/settlement/settlement.dart

@ -397,7 +397,7 @@ class _Settlement extends State<Settlement> {
minOrderInfo, minOrderInfo,
), ),
//// /////
ActivityCouponRemarks( ActivityCouponRemarks(
couponCart, couponCart,
activityCart, activityCart,

156
lib/settlement/settlement_view/activity_coupon_remarks.dart

@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/settleOrderInfo.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:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -24,8 +25,8 @@ class ActivityCouponRemarks extends StatefulWidget {
this.promotions, this.promotions,
this.couponCount, this.couponCount,
this.placeOrder, this.placeOrder,
this.remark, this.remark,
this.editRemark, this.editRemark,
); );
@override @override
@ -35,7 +36,6 @@ class ActivityCouponRemarks extends StatefulWidget {
} }
class _ActivityCouponRemarks extends State<ActivityCouponRemarks> { class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
@ -51,7 +51,7 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
], ],
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
height: 122.h / (!widget.placeOrder ? 2 : 1), // height: 122.h / (!widget.placeOrder ? 2 : 1),
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: 16, left: 16,
right: 16, right: 16,
@ -67,19 +67,17 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
if (widget.placeOrder) if (widget.placeOrder && widget?.settleOrderInfo?.benefitDiscountAmount != null && widget?.settleOrderInfo?.benefitDiscountAmount != "0")
InkWell( Container(
onTap: () { margin:EdgeInsets.only(bottom: 13),
widget.activityCart(); child:Row(
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Expanded( Expanded(
flex: 1, flex: 1,
child: Text( child: Text(
S.of(context).huodong, "会员优惠金额",
style: TextStyle( style: TextStyle(
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
fontSize: 14.sp, fontSize: 14.sp,
@ -88,7 +86,7 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
), ),
), ),
Text( Text(
activityText(), widget.settleOrderInfo.benefitDiscountAmount,
textAlign: TextAlign.end, textAlign: TextAlign.end,
style: TextStyle( style: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
@ -96,57 +94,89 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
), ),
), ),
Icon(
Icons.keyboard_arrow_right,
size: 16,
),
], ],
), ),
), ),
if (widget.placeOrder) if (widget.placeOrder)
SizedBox( InkWell(
height: 13, 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) if (widget.placeOrder)
InkWell( SizedBox(
onTap: () { height: 13,
widget.couponCart(); ),
}, if (widget.placeOrder)
child: Row( InkWell(
mainAxisAlignment: MainAxisAlignment.center, onTap: () {
crossAxisAlignment: CrossAxisAlignment.center, widget.couponCart();
children: [ },
Expanded( child: Row(
flex: 1, mainAxisAlignment: MainAxisAlignment.center,
child: Text( crossAxisAlignment: CrossAxisAlignment.center,
S.of(context).youhuiquan, 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( style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 14.sp, fontSize: 14.sp,
color: Color(0xFF353535), color: Color(0xFF32A060),
fontWeight: MyFontWeight.semi_bold,
), ),
), ),
), Icon(
Text( Icons.keyboard_arrow_right,
couponText(), size: 16,
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) if (widget.placeOrder)
SizedBox( SizedBox(
height: 13, height: 13,
), ),
InkWell( InkWell(
onTap: () { onTap: () {
widget.editRemark(); widget.editRemark();
@ -166,15 +196,17 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
), ),
), ),
), ),
Expanded(child:Text( Expanded(
widget.remark, child: Text(
textAlign: TextAlign.end, widget.remark,
style: TextStyle( textAlign: TextAlign.end,
fontSize: 14.sp, style: TextStyle(
color: Color(0xFF353535), fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold, color: Color(0xFF353535),
fontWeight: MyFontWeight.semi_bold,
),
), ),
),), ),
Icon( Icon(
Icons.keyboard_arrow_right, Icons.keyboard_arrow_right,
size: 16, size: 16,
@ -191,7 +223,8 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
String promotion = ""; String promotion = "";
if (widget.promotions == null || widget.promotions == "") { if (widget.promotions == null || widget.promotions == "") {
promotion = "未选择任何活动"; promotion = "未选择任何活动";
if (widget.settleOrderInfo == null || widget.settleOrderInfo.promotionInfoList == null) { if (widget.settleOrderInfo == null ||
widget.settleOrderInfo.promotionInfoList == null) {
promotion = "暂无可选活动"; promotion = "暂无可选活动";
} else if (widget.coupons != null && widget.coupons != "") { } else if (widget.coupons != null && widget.coupons != "") {
promotion = "活动与优惠券不可同享"; promotion = "活动与优惠券不可同享";
@ -206,7 +239,8 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
String coupon = ""; String coupon = "";
if (widget.coupons == null || widget.coupons == "") { if (widget.coupons == null || widget.coupons == "") {
coupon = "未选择任何优惠券"; coupon = "未选择任何优惠券";
if (widget.settleOrderInfo == null || widget.settleOrderInfo.couponList == null) { if (widget.settleOrderInfo == null ||
widget.settleOrderInfo.couponList == null) {
coupon = "暂无可选优惠券"; coupon = "暂无可选优惠券";
} else if (widget.promotions != null && widget.promotions != "") { } else if (widget.promotions != null && widget.promotions != "") {
coupon = "优惠券与活动不可同享"; coupon = "优惠券与活动不可同享";

6
lib/utils/flutter_utils.dart

@ -29,6 +29,12 @@ class AppUtils {
return exp.hasMatch(mobile); 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) { static double textScale(context) {
double textScaleFactor = MediaQuery.of(context).textScaleFactor; double textScaleFactor = MediaQuery.of(context).textScaleFactor;
// print("textScaleFactor: $textScaleFactor"); // print("textScaleFactor: $textScaleFactor");

104
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<StatefulWidget> createState() {
return _BadgeAttainmentDialog();
}
}
class _BadgeAttainmentDialog extends State<BadgeAttainmentDialog> {
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),
),
),
],
),
),
],
),
),
);
}
}

4
lib/view_widget/cupertino_date_picker.dart

@ -65,7 +65,7 @@ class CupertinoDatePickerWidget extends StatelessWidget {
height: 2.h, height: 2.h,
color: Color(0xFFF4F4F4), color: Color(0xFFF4F4F4),
), ),
Container( Expanded(child:Container(
height: 200.h, height: 200.h,
child: CupertinoDatePicker( child: CupertinoDatePicker(
mode: CupertinoDatePickerMode.date, mode: CupertinoDatePickerMode.date,
@ -77,7 +77,7 @@ class CupertinoDatePickerWidget extends StatelessWidget {
dateTime = data; dateTime = data;
}, },
), ),
), ),),
], ],
), ),
); );

72
lib/view_widget/item_input_widget.dart

@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/retrofit/data/vip_benefit_list.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
class ItemInputWidget extends StatelessWidget { class ItemInputWidget extends StatelessWidget {
@ -15,7 +16,7 @@ class ItemInputWidget extends StatelessWidget {
final Function(String value) onChanged; final Function(String value) onChanged;
final Function() onTap; final Function() onTap;
final double discount;
final int inputLimit; final int inputLimit;
final bool isShowBtn; final bool isShowBtn;
@ -41,6 +42,7 @@ class ItemInputWidget extends StatelessWidget {
this.style = const TextStyle(), this.style = const TextStyle(),
this.radius = 4, this.radius = 4,
this.onTap, this.onTap,
this.discount,
this.textInputType, this.textInputType,
this.errorText = "", this.errorText = "",
this.errorTextColor = const Color(0xFFFF441A), this.errorTextColor = const Color(0xFFFF441A),
@ -68,30 +70,60 @@ class ItemInputWidget extends StatelessWidget {
); );
return Container( 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, padding: padding,
decoration: BoxDecoration( color: Colors.white,
boxShadow: [ // decoration: BoxDecoration(
BoxShadow( // boxShadow: [
color: Color(0x000000).withAlpha(25), // BoxShadow(
offset: Offset(0, 1), // color: Color(0x000000).withAlpha(25),
blurRadius: 12.0, // offset: Offset(0, 1),
), // blurRadius: 12.0,
], // ),
color: Colors.white, // ],
borderRadius: BorderRadius.circular(radius), // color: Colors.white,
), // borderRadius: BorderRadius.circular(radius),
// ),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Row(
title, mainAxisAlignment: MainAxisAlignment.start,
style: TextStyle( crossAxisAlignment: CrossAxisAlignment.center,
fontSize: 14.sp, children: [
fontWeight: FontWeight.bold, Text(
color: titleColor, 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( SizedBox(
height: 5.h, height: 5.h,

8
lib/view_widget/mine_vip_view.dart

@ -32,7 +32,7 @@ class MineVipView extends StatelessWidget {
}); });
String topLeft = ""; String topLeft = "";
String levelText = ""; String levelText = "普通用户";
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -58,7 +58,6 @@ class MineVipView extends StatelessWidget {
} else { } else {
topLeft = S.of(context).zanweikaitong; topLeft = S.of(context).zanweikaitong;
} }
switch (vipLevel) { switch (vipLevel) {
case 1: case 1:
{ {
@ -220,7 +219,7 @@ class MineVipView extends StatelessWidget {
// : "${S.of(context).jifen_(rankMax - rank)} ${S.of(context).daoxiayidengji}", // : "${S.of(context).jifen_(rankMax - rank)} ${S.of(context).daoxiayidengji}",
rank > rankMax rank > rankMax
? S.of(context).dangqiandengji ? S.of(context).dangqiandengji
: "消费¥20000 升级为金卡", : "消费¥${rankMax - rank}${S.of(context).daoxiayidengji}",
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
color: textColor, color: textColor,
@ -316,8 +315,9 @@ class MineVipView extends StatelessWidget {
Navigator.of(context) Navigator.of(context)
.pushNamed('/router/mine_vip_core', arguments: { .pushNamed('/router/mine_vip_core', arguments: {
"rankLevel": curLevel, "rankLevel": curLevel,
"userInfo":userInfo.masterCardRankName,
"createTime": (userInfo != null) ? "${userInfo.createTime}" : "", "createTime": (userInfo != null) ? "${userInfo.createTime}" : "",
"points": (userInfo != null) ? int.tryParse(userInfo.points) : 0, "expendAmount": (userInfo != null) ? int.tryParse(userInfo.expendAmount) : 0,
}); });
}); });
} }

283
lib/view_widget/vip_dialog.dart

@ -1,10 +1,55 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:huixiang/generated/l10n.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:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
class VipDialog extends StatelessWidget { import 'custom_image.dart';
int listCount = 9;
class VipDialog extends StatefulWidget {
final String vipName;
VipDialog(this.vipName);
@override
State<StatefulWidget> createState() {
return _VipDialog();
}
}
class _VipDialog extends State<VipDialog> {
ApiService apiService;
List<VipBenefitList> vipBenefitList = [];
@override
void initState() {
super.initState();
SharedPreferences.getInstance().then((value) {
apiService =
ApiService(Dio(), context: context, token: value.getString("token"));
queryBenefitList();
});
}
///
queryBenefitList() async {
BaseData<List<VipBenefitList>> 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -23,48 +68,82 @@ class VipDialog extends StatelessWidget {
margin: EdgeInsets.only(top: 40.h), margin: EdgeInsets.only(top: 40.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(8),), borderRadius: BorderRadius.circular(8),
child:Column( ),
children: [ child: Column(
Container( children: [
alignment: Alignment.center, Container(
width:double.infinity, alignment: Alignment.center,
height: 92, width: double.infinity,
padding: EdgeInsets.only(top: 50.h, bottom: 19.h), height: 92,
decoration: BoxDecoration( padding: EdgeInsets.only(top: 50.h, bottom: 19.h),
color: Colors.black, decoration: BoxDecoration(
borderRadius: BorderRadius.only( color: Colors.black,
topLeft: Radius.circular(8), borderRadius: BorderRadius.only(
topRight: Radius.circular(8), 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,
),
), ),
), ),
Padding( child: Text(
padding: EdgeInsets.only(top:16.h, bottom: 19.h), "${S.of(context).gongxinchengwei}${widget.vipName}",
child: Text( style: TextStyle(
S.of(context).huodequanyi, color: Colors.white,
style: TextStyle( fontSize: 18.sp,
color: Colors.black, fontWeight: FontWeight.bold,
fontSize: 14.sp, ),
fontWeight:MyFontWeight.medium, ),
), ),
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, Container(
height: (((listCount~/3+(listCount%3>0?1:0))*90.h) > width: MediaQuery.of(context).size.width,
MediaQuery.of(context).size.height/2 ? height: ((((vipBenefitList == null
MediaQuery.of(context).size.height/2 : ? 0
((listCount~/3+(listCount%3>0?1:0))*90.h)).toDouble(),child:vipUpgrade()), : vipBenefitList.length) ~/
Container( 3 +
margin: EdgeInsets.only(left: 32,right: 32,bottom: 20), ((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( decoration: BoxDecoration(
gradient: new LinearGradient( gradient: new LinearGradient(
begin: Alignment.centerLeft, begin: Alignment.centerLeft,
@ -87,8 +166,9 @@ class VipDialog extends StatelessWidget {
), ),
), ),
), ),
], ),
), ],
),
), ),
Image.asset( Image.asset(
"assets/image/vip_yk.png", "assets/image/vip_yk.png",
@ -105,30 +185,28 @@ class VipDialog extends StatelessWidget {
/// ///
Widget vipUpgrade() { Widget vipUpgrade() {
return GridView.builder( return GridView.builder(
itemCount:listCount, itemCount: vipBenefitList == null ? 0 : vipBenefitList.length,
shrinkWrap: true, shrinkWrap: true,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
//Widget数量 //Widget数量
crossAxisCount:3, crossAxisCount: 3,
//Widget之间间距 //Widget之间间距
crossAxisSpacing:0, crossAxisSpacing: 0,
//Widget之间间距 //Widget之间间距
mainAxisSpacing: 0, mainAxisSpacing: 0,
childAspectRatio: 1.5, childAspectRatio: 1.5,
), ),
itemBuilder: (context, index) { itemBuilder: (context, index) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {},
// Navigator.of(context).pushNamed('/router/legal_right_details', arguments: {}); child: vipUpgradeItem(vipBenefitList[index]),
},
child: vipUpgradeItem(),
); );
}, },
); );
} }
Widget vipUpgradeItem() { Widget vipUpgradeItem(VipBenefitList vipBenefitList) {
return Container( return Container(
alignment: Alignment.center, alignment: Alignment.center,
child: Column( child: Column(
@ -136,57 +214,77 @@ class VipDialog extends StatelessWidget {
Stack( Stack(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
children: [ children: [
Opacity( MImage(
opacity: 0.3, vipBenefitList?.icon ?? "",
// MImage( width: 36,
// "assets/image/badge_img.png", height: 36,
// width: 80, // fit: BoxFit.cover,
// height: 80, errorSrc: "assets/image/default_1.png",
// fit: BoxFit.cover, fadeSrc: "assets/image/default_1.png",
// 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,
),
), ),
Container( if (!vipBenefitList.actived)
decoration: new BoxDecoration( Container(
color: Color(0xFFA29E9E), decoration: new BoxDecoration(
borderRadius: BorderRadius.circular(7.0), 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, if (!vipBenefitList.actived && !vipBenefitList.have)
height: 15.h, Container(
child: Row( decoration: new BoxDecoration(
crossAxisAlignment: CrossAxisAlignment.center, color: Color(0xFFA29E9E),
mainAxisAlignment: MainAxisAlignment.center, borderRadius: BorderRadius.circular(7.0),
children: [ ),
Icon( width: 52.w,
Icons.lock, height: 15.h,
color: Color(0xFFFFDCA1), child: Row(
size: 10, crossAxisAlignment: CrossAxisAlignment.center,
), mainAxisAlignment: MainAxisAlignment.center,
Text( children: [
"暂未开放", Icon(
style: TextStyle( Icons.lock,
color: Color(0xFF181818), color: Color(0xFFFFDCA1),
fontWeight: MyFontWeight.regular, size: 10,
fontSize: 9.sp,
), ),
), Text(
], "暂未解锁",
style: TextStyle(
color: Color(0xFFFFDCA1),
fontWeight: MyFontWeight.regular,
fontSize: 9.sp,
),
),
],
),
), ),
)
], ],
), ),
SizedBox( SizedBox(
height: 5.h, height: 5.h,
), ),
Text( Text(
"储值优惠", vipBenefitList?.name ?? "",
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -200,5 +298,4 @@ class VipDialog extends StatelessWidget {
), ),
); );
} }
}
}

Loading…
Cancel
Save