|
|
|
@ -23,9 +23,12 @@ import 'package:huixiang/view_widget/mine_vip_view.dart';
|
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/my_appbar.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/vip_dialog.dart'; |
|
|
|
|
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
|
|
|
|
|
|
import '../../retrofit/data/user_info.dart'; |
|
|
|
|
import '../../view_widget/classic_header.dart'; |
|
|
|
|
import '../../view_widget/my_footer.dart'; |
|
|
|
|
|
|
|
|
|
class MineVipCore extends StatefulWidget { |
|
|
|
|
final Map<String, dynamic> arguments; |
|
|
|
@ -46,6 +49,7 @@ class _MineVipCore extends State<MineVipCore> {
|
|
|
|
|
int checkIndex = 0; |
|
|
|
|
UserInfo userInfo; |
|
|
|
|
int rankNameIndex; |
|
|
|
|
final RefreshController refreshController = RefreshController(); |
|
|
|
|
|
|
|
|
|
final SwiperController controller = SwiperController(); |
|
|
|
|
|
|
|
|
@ -104,7 +108,9 @@ class _MineVipCore extends State<MineVipCore> {
|
|
|
|
|
|
|
|
|
|
///会员等级列表 |
|
|
|
|
queryVipLevel() async { |
|
|
|
|
BaseData<List<Rank>> rankData = await apiService.rankList().catchError((onError) {}); |
|
|
|
|
BaseData<List<Rank>> rankData = await apiService.rankList().catchError((onError) { |
|
|
|
|
refreshController.refreshFailed(); |
|
|
|
|
refreshController.loadFailed();}); |
|
|
|
|
if (rankData != null && rankData.isSuccess) { |
|
|
|
|
ranks.clear(); |
|
|
|
|
ranks.addAll(rankData.data); |
|
|
|
@ -114,21 +120,29 @@ class _MineVipCore extends State<MineVipCore> {
|
|
|
|
|
setState(() { |
|
|
|
|
controller.move((widget.arguments["rankLevel"] - 1), animation: false); |
|
|
|
|
}); |
|
|
|
|
refreshController.refreshCompleted(); |
|
|
|
|
refreshController.loadComplete(); |
|
|
|
|
} else { |
|
|
|
|
SmartDialog.showToast(rankData?.msg??"", alignment: Alignment.center); |
|
|
|
|
refreshController.refreshFailed(); |
|
|
|
|
refreshController.loadFailed(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
///会员权益列表 |
|
|
|
|
queryBenefitList() async { |
|
|
|
|
BaseData<List<VipBenefitList>> baseData = |
|
|
|
|
await apiService.benefitList().catchError((onError) {}); |
|
|
|
|
await apiService.benefitList().catchError((onError) { |
|
|
|
|
refreshController.refreshFailed(); |
|
|
|
|
refreshController.loadFailed();}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
setState(() { |
|
|
|
|
vipBenefitList.clear(); |
|
|
|
|
vipBenefitList.addAll(baseData.data); |
|
|
|
|
vipBenefitList.sort((a, b) => (a.sort).compareTo(b.sort)); |
|
|
|
|
}); |
|
|
|
|
refreshController.refreshCompleted(); |
|
|
|
|
refreshController.loadComplete(); |
|
|
|
|
} |
|
|
|
|
EasyLoading.dismiss(); |
|
|
|
|
} |
|
|
|
@ -136,11 +150,15 @@ class _MineVipCore extends State<MineVipCore> {
|
|
|
|
|
///会员权益介绍/规则/说明/储值说明 |
|
|
|
|
queryRuleDetails() async { |
|
|
|
|
BaseData<VipRuleDetails> baseData = |
|
|
|
|
await apiService.vipBenefit().catchError((onError) {}); |
|
|
|
|
await apiService.vipBenefit().catchError((onError) { |
|
|
|
|
refreshController.refreshFailed(); |
|
|
|
|
refreshController.loadFailed();}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
setState(() { |
|
|
|
|
vipRuleDetails = baseData.data; |
|
|
|
|
}); |
|
|
|
|
refreshController.refreshCompleted(); |
|
|
|
|
refreshController.loadComplete(); |
|
|
|
|
} |
|
|
|
|
EasyLoading.dismiss(); |
|
|
|
|
} |
|
|
|
@ -180,6 +198,13 @@ class _MineVipCore extends State<MineVipCore> {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_onRefresh() async { |
|
|
|
|
await queryVipLevel(); |
|
|
|
|
await queryBenefitList(); |
|
|
|
|
await queryRuleDetails(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
|
return Container( |
|
|
|
@ -259,7 +284,24 @@ class _MineVipCore extends State<MineVipCore> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Expanded(child: |
|
|
|
|
SingleChildScrollView( |
|
|
|
|
SmartRefresher( |
|
|
|
|
controller: refreshController, |
|
|
|
|
enablePullDown: true, |
|
|
|
|
enablePullUp: false, |
|
|
|
|
header: MyHeader( |
|
|
|
|
color: Colors.white, |
|
|
|
|
), |
|
|
|
|
footer: CustomFooter( |
|
|
|
|
builder: (context, mode) { |
|
|
|
|
return MyFooter(mode); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
onRefresh: () { |
|
|
|
|
_onRefresh(); |
|
|
|
|
}, |
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
scrollController: ScrollController(), |
|
|
|
|
child: SingleChildScrollView( |
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
@ -564,6 +606,7 @@ class _MineVipCore extends State<MineVipCore> {
|
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
)), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
@ -618,8 +661,8 @@ class _MineVipCore extends State<MineVipCore> {
|
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
gradient: LinearGradient( |
|
|
|
|
colors: [ |
|
|
|
|
AppUtils.getLighterColor(ranks[position]?.color ?? ""), |
|
|
|
|
Color(int.parse((ranks[position]?.color ?? "").replaceAll("#", "FF"), radix: 16)), |
|
|
|
|
AppUtils.getLighterColor(ranks[position]?.color ?? "#85C9DD"), |
|
|
|
|
Color(int.parse((ranks[position]?.color ?? "#85C9DD").replaceAll("#", "FF"), radix: 16)), |
|
|
|
|
], |
|
|
|
|
begin: Alignment.topLeft, |
|
|
|
|
end: Alignment.bottomRight, |
|
|
|
@ -698,14 +741,12 @@ class _MineVipCore extends State<MineVipCore> {
|
|
|
|
|
), |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisAlignment: |
|
|
|
|
(userInfo?.memberRankVo?.rankName != ranks[position].rankName || (userInfo?.memberRankVo?.rankName == "共创会员" && ranks[position].rankName == "共创会员"))? |
|
|
|
|
MainAxisAlignment.spaceAround: |
|
|
|
|
MainAxisAlignment.end, |
|
|
|
|
MainAxisAlignment.spaceAround, |
|
|
|
|
children: [ |
|
|
|
|
if(userInfo?.memberRankVo?.rankName != ranks[position].rankName || (userInfo?.memberRankVo?.rankName == "共创会员" && ranks[position].rankName == "共创会员")) |
|
|
|
|
Align(alignment: Alignment.centerRight, |
|
|
|
|
child: Text( |
|
|
|
|
(ranks[position].rankName == "共创会员") ? "¥${AppUtils.calculateDouble(double.tryParse(ranks[position].price??""))}/永久" : (ranks[position]?.originScore ?? 0).toString(), |
|
|
|
|
(ranks[position].rankName == "共创会员") ? "永久VIP" : (ranks[position]?.originScore ?? 0).toString(), |
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color:Color(int.parse((ranks[position]?.textColor ?? "").replaceAll("#", "FF"), radix: 16)), |
|
|
|
@ -734,7 +775,7 @@ class _MineVipCore extends State<MineVipCore> {
|
|
|
|
|
TextSpan( |
|
|
|
|
text:"${AppUtils.calculateDouble(double.tryParse(userInfo.expendAmount??"0"))}", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 26.sp, |
|
|
|
|
fontSize: 24.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
color: Color(int.parse((ranks[position]?.textColor ?? "").replaceAll("#", "FF"), radix: 16)), |
|
|
|
|
), |
|
|
|
@ -752,19 +793,19 @@ class _MineVipCore extends State<MineVipCore> {
|
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
),), |
|
|
|
|
// if(userInfo?.memberRankVo?.rankName == ranks[position].rankName && (userInfo?.memberRankVo?.rankName != "共创会员" && ranks[position].rankName != "共创会员")) |
|
|
|
|
// Container( |
|
|
|
|
// height: 8.h, |
|
|
|
|
// child: ClipRRect( |
|
|
|
|
// borderRadius: BorderRadius.circular(6.5), |
|
|
|
|
// child: LinearProgressIndicator( |
|
|
|
|
// value: (userInfo?.memberRankVo?.nextOrigin ?? 0) > (double.tryParse(userInfo?.expendAmount ?? "0").toInt())? ((checkIndex < rankNameIndex) ? |
|
|
|
|
// (userInfo?.memberRankVo?.nextOrigin ?? 0)/(userInfo?.memberRankVo?.nextOrigin ?? 0): (double.tryParse(userInfo?.expendAmount ?? "0").toInt()) / (userInfo?.memberRankVo?.nextOrigin ?? 0)) : 0, |
|
|
|
|
// backgroundColor: Colors.white, |
|
|
|
|
// color: AppUtils.getLighterColor(ranks[position]?.color ?? ""), |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
if(userInfo?.memberRankVo?.rankName == ranks[position].rankName && (userInfo?.memberRankVo?.rankName != "共创会员" && ranks[position].rankName != "共创会员")) |
|
|
|
|
Container( |
|
|
|
|
height: 8.h, |
|
|
|
|
child: ClipRRect( |
|
|
|
|
borderRadius: BorderRadius.circular(6.5), |
|
|
|
|
child: LinearProgressIndicator( |
|
|
|
|
value: (userInfo?.memberRankVo?.nextOrigin ?? 0) > (double.tryParse(userInfo?.expendAmount ?? "0").toInt())? ((checkIndex < rankNameIndex) ? |
|
|
|
|
(userInfo?.memberRankVo?.nextOrigin ?? 0)/(userInfo?.memberRankVo?.nextOrigin ?? 0): (double.tryParse(userInfo?.expendAmount ?? "0").toInt()) / (userInfo?.memberRankVo?.nextOrigin ?? 0)) : 0, |
|
|
|
|
backgroundColor: Colors.white, |
|
|
|
|
color: AppUtils.getLighterColor(ranks[position]?.color ?? ""), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|