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

1
lib/generated/intl/messages_en.dart

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

1
lib/generated/intl/messages_zh_CN.dart

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

1
lib/generated/intl/messages_zh_Hans_CN.dart

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

1
lib/generated/intl/messages_zh_Hant_CN.dart

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

1
lib/generated/intl/messages_zh_TW.dart

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

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 {
return Intl.message(

2
lib/integral/intergra_view/integral_vip.dart

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

1
lib/l10n/intl_en.arb

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

1
lib/l10n/intl_zh_CN.arb

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

1
lib/l10n/intl_zh_Hans_CN.arb

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

1
lib/l10n/intl_zh_Hant_CN.arb

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

1
lib/l10n/intl_zh_TW.arb

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

17
lib/mine/mine_page.dart

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

2
lib/mine/mine_view/community_follow.dart

@ -31,7 +31,7 @@ class _CommunityFollow extends State<CommunityFollow>
querySocialInfo();
}
///(/)
///(//)
querySocialInfo() async {
SharedPreferences value = await SharedPreferences.getInstance();
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/vip_benefit_list.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/border_text.dart';
import 'package:huixiang/view_widget/custom_image.dart';
@ -311,7 +312,7 @@ class _LegalRightDetails extends State<LegalRightDetails> {
SizedBox(
height: 20,
),
if(vipBenefitList[checkIndex].name == "副卡")
if(vipBenefitList[checkIndex].name == "副卡" && vipBenefitList[checkIndex].actived && vipBenefitList[checkIndex].have)
Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -438,14 +439,76 @@ class _LegalRightDetails extends State<LegalRightDetails> {
alignment: Alignment.center,
child: Column(
children: [
MImage(
vipBenefitList.icon,
width: 50,
height: 50,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
Stack(
alignment: Alignment.bottomCenter,
children: [
MImage(
vipBenefitList?.icon ?? "",
width: 50,
height: 50,
// fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
),
if(!vipBenefitList.actived)
Container(
decoration: new BoxDecoration(
color: Color(0xFFA29E9E),
borderRadius: BorderRadius.circular(7.0),
),
width: 52.w,
height: 15.h,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.lock,
color: Color(0xFFFFDCA1),
size: 10,
),
Text(
"暂未开放",
style: TextStyle(
color: Color(0xFFFFDCA1),
fontWeight: MyFontWeight.regular,
fontSize: 9.sp,
),
),
],
),
),
if(!vipBenefitList.actived && !vipBenefitList.have)
Container(
decoration: new BoxDecoration(
color: Color(0xFFA29E9E),
borderRadius: BorderRadius.circular(7.0),
),
width: 52.w,
height: 15.h,
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.lock,
color: Color(0xFFFFDCA1),
size: 10,
),
Text(
"暂未解锁",
style: TextStyle(
color: Color(0xFFFFDCA1),
fontWeight: MyFontWeight.regular,
fontSize: 9.sp,
),
),
],
),
),
],
),
SizedBox(
height: 8.h,
),
@ -507,6 +570,7 @@ class _LegalRightDetails extends State<LegalRightDetails> {
secondCardList?.headimg ?? "",
width: 50,
height: 50,
isCircle: true,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
@ -530,7 +594,7 @@ class _LegalRightDetails extends State<LegalRightDetails> {
height: 5.h,
),
Text(
secondCardList?.phone ?? "",
AppUtils.phoneEncode(secondCardList?.phone ?? ""),
style: TextStyle(
color: Color(0xFF79572D),
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/retrofit/data/achievement_detail_list.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/social_info.dart';
import 'package:huixiang/retrofit/data/user_info.dart';
import 'package:huixiang/retrofit/data/vip_badges_list.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/badge_attainment_dialog.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
@ -34,7 +36,7 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
List<VipBadgesList> vipBadgesList = [];
List<AchievementDetailList> achievementDetail = [];
int checkPosition = 0;
int attainmentPoint = 0;
SocialInfo infoNumber;
@override
void dispose() {
@ -47,7 +49,7 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
super.initState();
userInfo = widget.arguments["userInfo"];
queryAttainmentBadges();
queryAchievementDetail("1460164746211753984");
querySocialInfo();
}
///
@ -76,7 +78,7 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
}
///
queryAchievementDetail(achievementCategoryId) async {
queryAchievementDetail(index) async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
@ -86,17 +88,33 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
);
}
BaseData<List<AchievementDetailList>> baseData = await apiService
.getAchievementDetail(achievementCategoryId)
.getAchievementDetail(vipBadgesList[index].id)
.catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
achievementDetail.clear();
attainmentPoint = 0;
achievementDetail.addAll(baseData.data);
achievementDetail.forEach((element) {
if(element.actived)
attainmentPoint += 1;
});
showDeleteDialog(index);
});
}
EasyLoading.dismiss();
}
///(//)
querySocialInfo() async {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
showLoading: false,
);
BaseData<SocialInfo> baseData =
await apiService.socialInfo().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
infoNumber = baseData.data;
});
}
EasyLoading.dismiss();
@ -182,7 +200,7 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
color: Color(0xFF353535)),
),
Text(
attainmentPoint.toString(),
infoNumber != null ? infoNumber.achievementNumber.toString() :"0",
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 14,
@ -230,7 +248,7 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
return GestureDetector(
onTap: () {
setState(() {
showDeleteDialog(index);
queryAchievementDetail(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_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:fluwx/fluwx.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/rank.dart';
import 'package:huixiang/retrofit/data/vip_benefit_list.dart';
import 'package:huixiang/retrofit/data/vip_rule_details.dart';
import 'package:huixiang/retrofit/data/wx_pay.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart';
@ -36,6 +38,7 @@ class _MineVipCore extends State<MineVipCore> {
List<Rank> ranks = [];
List<VipBenefitList> vipBenefitList = [];
VipRuleDetails vipRuleDetails;
int checkIndex = 0;
final SwiperController controller = SwiperController();
@ -44,6 +47,16 @@ class _MineVipCore extends State<MineVipCore> {
super.initState();
SharedPreferences.getInstance().then((value) {
if(widget.arguments["rankLevel"] == 1 && !(value.getBool("FirstYinKa")??false)){
showAlertDialog("银卡会员");
value.setBool("FirstYinKa", true);
}else if(widget.arguments["rankLevel"] == 2 && !(value.getBool("FirstJinKa")??false)){
showAlertDialog("金卡会员");
value.setBool("FirstJinKa", true);
}else if(widget.arguments["rankLevel"] == 3 && !(value.getBool("FirstGongC")??false)){
showAlertDialog("共创会员");
value.setBool("FirstGongC", true);
}
apiService =
ApiService(Dio(), context: context, token: value.getString("token"));
queryVipLevel();
@ -78,7 +91,7 @@ class _MineVipCore extends State<MineVipCore> {
EasyLoading.dismiss();
}
/////
//////
queryRuleDetails() async {
BaseData<VipRuleDetails> baseData =
await apiService.vipBenefit().catchError((onError) {});
@ -90,6 +103,52 @@ class _MineVipCore extends State<MineVipCore> {
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
Widget build(BuildContext context) {
return Scaffold(
@ -99,6 +158,23 @@ class _MineVipCore extends State<MineVipCore> {
titleSize: 18.sp,
background: Colors.transparent,
leadingColor: Colors.black,
action:widget?.arguments["userInfo"] != null ? Container(
alignment: Alignment.center,
margin: EdgeInsets.only(right: 16.w),
child: GestureDetector(
onTap: () {
Navigator.of(context).pushNamed('/router/integral_detailed_page');
},
child: Text(
"${S.of(context).dangqianzhukadengji} : ${widget?.arguments["userInfo"]??""}",
style: TextStyle(
color: Colors.black,
fontSize: 16.sp,
fontWeight: MyFontWeight.bold,
),
),
),
) : SizedBox(),
),
body: SingleChildScrollView(
physics: BouncingScrollPhysics(),
@ -114,6 +190,11 @@ class _MineVipCore extends State<MineVipCore> {
loop: false,
physics: BouncingScrollPhysics(),
controller: controller,
onIndexChanged: (index){
setState(() {
checkIndex = index;
});
},
itemBuilder: (context, position) {
return MineVipView(
vipLevel: !(ranks != null && ranks.isNotEmpty)
@ -127,7 +208,7 @@ class _MineVipCore extends State<MineVipCore> {
padding: 6.w,
rank: !(ranks != null && ranks.isNotEmpty)
? 0
: widget.arguments["points"],
: widget.arguments["expendAmount"],
rankMax: !(ranks != null && ranks.isNotEmpty)
? 0
: (position < (ranks.length - 1))
@ -387,10 +468,12 @@ class _MineVipCore extends State<MineVipCore> {
],
),
),
InkWell(
if(
ranks.length > checkIndex && widget.arguments["rankLevel"] < ranks[checkIndex].level && ranks[checkIndex].price != "0.00")
InkWell(
onTap: () {
setState(() {
showAlertDialog();
buyRank();
});
},
child: Container(
@ -408,7 +491,7 @@ class _MineVipCore extends State<MineVipCore> {
height: 54,
alignment: Alignment.center,
child: Text(
"${S.of(context).lijikaitong}20000/永久",
"${S.of(context).lijikaitong}${ranks.length>checkIndex?ranks[checkIndex].price:""}/永久",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16.sp,
@ -416,7 +499,7 @@ class _MineVipCore extends State<MineVipCore> {
),
),
),
)
),
],
),
),
@ -570,7 +653,7 @@ class _MineVipCore extends State<MineVipCore> {
SizedBox(
height: 5.h,
),
Text(
Expanded(child: Text(
vipBenefitList?.name ?? "",
maxLines: 2,
overflow: TextOverflow.ellipsis,
@ -580,19 +663,20 @@ class _MineVipCore extends State<MineVipCore> {
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
),
),
))
,
],
),
);
}
///
showAlertDialog() {
showAlertDialog(vipName) {
//
showDialog(
context: 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:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:fluwx/fluwx.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/vip_benefit_list.dart';
import 'package:huixiang/retrofit/data/vip_rule_details.dart';
import 'package:huixiang/retrofit/data/wx_pay.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/utils/min.dart';
import 'package:huixiang/view_widget/item_input_widget.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -23,10 +28,11 @@ class RechargePage extends StatefulWidget {
class _RechargePage extends State<RechargePage> {
ApiService apiService;
TextEditingController controller = TextEditingController();
VipRuleDetails vipRuleDetails;
List<VipBenefitList> vipBenefitList = [];
Color color = Colors.black;
double discount = 100;
@override
void initState() {
@ -35,9 +41,42 @@ class _RechargePage extends State<RechargePage> {
SharedPreferences.getInstance().then((value) {
apiService = ApiService(Dio(),
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
Widget build(BuildContext context) {
return Scaffold(
@ -48,137 +87,217 @@ class _RechargePage extends State<RechargePage> {
background: Color(0xFFFFFFFF),
leadingColor: Colors.black,
),
body: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Container(
child: Column(
children: [
ItemInputWidget(
S.of(context).qingshuruchongzhijine,
hintText: "",
controller: controller,
padding: EdgeInsets.all(20),
errorText: S.of(context).chongzhizuixiaojine(10),
titleColor: Color(0xFF727272),
errorTextColor: Color(0xFF32A060),
radius: 8,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 27.sp,
color: color,
),
inputLimit: 6,
textInputType: TextInputType.number,
textInputFormatter: FilteringTextInputFormatter.digitsOnly,
onChanged: (value) {
if (value != null &&
value != "" &&
double.tryParse(value) < 10) {
color = Colors.red;
} else {
color = Colors.black;
}
setState(() {});
},
),
Container(
width: double.infinity,
margin: EdgeInsets.only(
left: 20.w,
right: 20.w,
top: 12.h,
bottom: 4.h,
),
padding: EdgeInsets.only(
left: 20.w,
right: 16.w,
top: 20.h,
bottom: 20.h,
),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Color(0x000000).withAlpha(25),
offset: Offset(0, 1),
blurRadius: 12.0,
),
],
color: Colors.white,
borderRadius: BorderRadius.circular(4),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(bottom: 16.h),
child: Text(
S.of(context).zhifufangshi,
body:Stack(
children: [
SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Container(
child: Column(
children: [
Container(
child: Column(children: [
ItemInputWidget(
S.of(context).qingshuruchongzhijine,
hintText: "",
controller: controller,
padding: EdgeInsets.all(20),
errorText: S.of(context).chongzhizuixiaojine(0.1),
titleColor: Color(0xFF727272),
errorTextColor: Color(0xFF32A060),
radius: 8,
discount: discount/10,
style: TextStyle(
fontSize: 16.sp,
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 27.sp,
color: color,
),
inputLimit: 6,
textInputType: TextInputType.number,
textInputFormatter: FilteringTextInputFormatter.digitsOnly,
onChanged: (value) {
if (value != null &&
value != "" &&
double.tryParse(value) < 10) {
color = Colors.red;
} else {
color = Colors.black;
}
setState(() {});
},
),
),
GestureDetector(
onTap: () {
setState(() {
checkIndex = 1;
});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Image.asset("assets/image/icon_we_chat.png"),
Expanded(
flex: 1,
child: Padding(
padding: EdgeInsets.only(left: 8.w),
child: Text(
S.of(context).weixinzhifu,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xff353535),
),
if (vipRuleDetails?.recharge != null &&
vipRuleDetails.recharge != "")
Expanded(child:Container(
color: Colors.white,
padding: EdgeInsets.only(left: 8),
child: Html(
data: "注意:${vipRuleDetails?.recharge??""}",
customImageRenders: {
networkSourceMatcher(): networkImageRender(
loadingWidget: () {
return Container();
},
),
},
),
),
),
checkView(1),
),)
],
),
],),
),
Container(
width: double.infinity,
margin: EdgeInsets.only(
left: 0.w,
right: 0.w,
top: 16.h,
bottom: 4.h,
),
padding: EdgeInsets.only(
left: 20.w,
right: 16.w,
top: 20.h,
bottom: 20.h,
),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Color(0x000000).withAlpha(25),
offset: Offset(0, 1),
blurRadius: 12.0,
),
],
color: Colors.white,
// borderRadius: BorderRadius.circular(4),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(bottom: 16.h),
child: Text(
S.of(context).zhifufangshi,
style: TextStyle(
fontSize: 16.sp,
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
),
GestureDetector(
onTap: () {
setState(() {
checkIndex = 1;
});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset("assets/image/icon_we_chat.png"),
Expanded(
flex: 1,
child: Padding(
padding: EdgeInsets.only(left: 8.w),
child: Text(
S.of(context).weixinzhifu,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xff353535),
),
),
),
),
checkView(1),
],
),
),
],
),
],
),
),
InkWell(
onTap: () {
recharge();
},
child: Container(
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 26.h),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
RoundButton(
width: double.infinity,
height: 46.h,
text: S.of(context).querenchongzhi,
textColor: Colors.white,
fontSize: 14.sp,
backgroup: Color(0xff32A060),
fontWeight: FontWeight.bold,
),
],
),
),
// InkWell(
// onTap: () {
// recharge();
// },
// child: Container(
// // margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 26.h),
// child: Column(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// RoundButton(
// width: double.infinity,
// height: 46.h,
// text: S.of(context).querenchongzhi,
// textColor: Colors.white,
// fontSize: 14.sp,
// backgroup: Color(0xff32A060),
// fontWeight: FontWeight.bold,
// ),
// ],
// ),
// ),
// ),
],
),
],
),
),
),
Align(alignment: Alignment.bottomCenter,child:
Container(
height: 54.h,
color: Colors.white,
child: Row(
children: [
Spacer(),
Padding(padding: EdgeInsets.only(top: 7,right: 16),
child:Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
S.of(context).heji,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.black,
),
),
Text(
controller.text == "" ? "" :(double.parse(controller.text) * (discount/100)).toString(),
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF32A060),
),
),
],
)),
GestureDetector(
onTap: () {
recharge();
},
child: RoundButton(
width: 103.w,
height: 54.h,
text: S.of(context).chongzhi,
textColor: Colors.white,
fontWeight: MyFontWeight.regular,
backgroup: Color(0xFF32A060),
radius: 0,
fontSize: 16.sp,
padding: EdgeInsets.symmetric(vertical: 5.h),
),
),
],
),
))
],
),
);
}
@ -207,8 +326,8 @@ class _RechargePage extends State<RechargePage> {
}
int amount = int.tryParse(money);
if (checkIndex == 1) {
if (amount < 10) {
SmartDialog.showToast(S.of(context).chongzhizuixiaojine(10),
if (amount < 0.001) {
SmartDialog.showToast(S.of(context).chongzhizuixiaojine(0.001),
alignment: Alignment.center);
return;
}
@ -220,10 +339,10 @@ class _RechargePage extends State<RechargePage> {
// await Min.initialize();
// }
BaseData<WxPay> baseData =
BaseData<dynamic> baseData =
await apiService.recharge({"amount": amount, "rechargeType": 2});
if (baseData != null && baseData.isSuccess) {
WxPay wxPay = baseData.data;
WxPay wxPay = WxPay.fromJson(baseData.data);
await registerWxApi(
appId: wxPay.appId,
doOnAndroid: true,
@ -240,8 +359,19 @@ class _RechargePage extends State<RechargePage> {
);
weChatResponseEventHandler.listen((event) async {
print("payCallback: ${event.errCode}");
if(event.errCode == 0){
Navigator.of(context).pop();
SmartDialog.showToast("充值成功", alignment: Alignment.center);
}
else{
SmartDialog.showToast("充值失败", alignment: Alignment.center);
return;
}
});
}
else{
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
}
}

20
lib/order/exchange_history_page.dart

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

34
lib/order/exchange_order_page.dart

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

2
lib/order/exchange_order_success_page.dart

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

6
lib/retrofit/data/goods.dart

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

8
lib/retrofit/data/rank.dart

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

3
lib/retrofit/data/settleOrderInfo.dart

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

12
lib/retrofit/data/social_info.dart

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

9
lib/retrofit/data/user_info.dart

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

79
lib/retrofit/data/vip_benefit_list.dart

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

11
lib/retrofit/data/vip_rule_details.dart

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

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 baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///
// const base_url = "http://192.168.10.236:8766/app/"; ///
// const baseUrl = "http://192.168.10.236:8766/app/"; ///
const base_url = "http://192.168.10.236:8766/app/"; ///
const baseUrl = "http://192.168.10.236:8766/app/"; ///
// const base_url = "http://192.168.10.37:8766/app/";
// const baseUrl = "http://192.168.10.37:8766/app/";
const base_url = "http://192.168.10.130:8766/app/";///
const baseUrl = "http://192.168.10.130:8766/app/";///
// const base_url = "http://192.168.10.130:8766/app/";///
// const baseUrl = "http://192.168.10.130:8766/app/";///
@RestApi(baseUrl: baseUrl)
abstract class ApiService {
@ -71,7 +71,7 @@ abstract class ApiService {
BuildContext context,
String token,
bool showLoading = true,
bool pay = false,
bool pay = true,
}) {
Map<String, dynamic> headers =
(token == null || token == "") ? {} : {'token': "Bearer $token"};
@ -204,9 +204,9 @@ abstract class ApiService {
@GET("/member/signIn")
Future<BaseData> signIn();
///
///
@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}")
@ -399,7 +399,7 @@ abstract class ApiService {
@DELETE("/information/trend/{id}")
Future<BaseData> deleteTrend(@Path("id") String id);
///(/)
///(//)
@GET("/member/socialInfo")
Future<BaseData<SocialInfo>> socialInfo();
@ -455,8 +455,16 @@ abstract class ApiService {
@GET("/member/bindSecondCard/{phone}")
Future<BaseData> bindSecondCard(@Path("phone") String phone);
///
///
@GET("/member/unbindSecondCard/{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 {
_ApiService(this._dio, {this.baseUrl}) {
ArgumentError.checkNotNull(_dio, '_dio');
baseUrl ??= 'http://192.168.10.130:8766/app/';
baseUrl ??= 'http://192.168.10.236:8766/app/';
}
final Dio _dio;
@ -271,7 +271,7 @@ class _ApiService implements ApiService {
}
@override
Future<BaseData<WxPay>> recharge(param) async {
Future<BaseData<dynamic>> recharge(param) async {
ArgumentError.checkNotNull(param, 'param');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
@ -285,9 +285,9 @@ class _ApiService implements ApiService {
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<WxPay>.fromJson(
final value = BaseData<dynamic>.fromJson(
_result.data,
(json) => WxPay.fromJson(json),
(json) => json as dynamic,
);
return value;
}
@ -1577,7 +1577,6 @@ class _ApiService implements ApiService {
return value;
}
@override
Future<BaseData<List<VipBenefitList>>> benefitList() async {
const _extra = <String, dynamic>{};
@ -1621,7 +1620,6 @@ class _ApiService implements ApiService {
return value;
}
@override
Future<BaseData<List<SecondCardList>>> secondCardList() async {
const _extra = <String, dynamic>{};
@ -1688,4 +1686,48 @@ class _ApiService implements ApiService {
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,
),
////
/////
ActivityCouponRemarks(
couponCart,
activityCart,

156
lib/settlement/settlement_view/activity_coupon_remarks.dart

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

6
lib/utils/flutter_utils.dart

@ -29,6 +29,12 @@ class AppUtils {
return exp.hasMatch(mobile);
}
static String phoneEncode(String phone){
if(phone == null || phone.length != 11)
return phone;
return phone.substring(0,3) + "****" + phone.substring(phone.length-4);
}
static double textScale(context) {
double textScaleFactor = MediaQuery.of(context).textScaleFactor;
// print("textScaleFactor: $textScaleFactor");

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

72
lib/view_widget/item_input_widget.dart

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/retrofit/data/vip_benefit_list.dart';
import 'package:huixiang/utils/font_weight.dart';
class ItemInputWidget extends StatelessWidget {
@ -15,7 +16,7 @@ class ItemInputWidget extends StatelessWidget {
final Function(String value) onChanged;
final Function() onTap;
final double discount;
final int inputLimit;
final bool isShowBtn;
@ -41,6 +42,7 @@ class ItemInputWidget extends StatelessWidget {
this.style = const TextStyle(),
this.radius = 4,
this.onTap,
this.discount,
this.textInputType,
this.errorText = "",
this.errorTextColor = const Color(0xFFFF441A),
@ -68,30 +70,60 @@ class ItemInputWidget extends StatelessWidget {
);
return Container(
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 12.h, bottom: 4.h),
// margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 12.h, bottom: 4.h),
padding: padding,
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Color(0x000000).withAlpha(25),
offset: Offset(0, 1),
blurRadius: 12.0,
),
],
color: Colors.white,
borderRadius: BorderRadius.circular(radius),
),
color: Colors.white,
// decoration: BoxDecoration(
// boxShadow: [
// BoxShadow(
// color: Color(0x000000).withAlpha(25),
// offset: Offset(0, 1),
// blurRadius: 12.0,
// ),
// ],
// color: Colors.white,
// borderRadius: BorderRadius.circular(radius),
// ),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.bold,
color: titleColor,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
title,
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.bold,
color: titleColor,
),
),
Container(
margin: EdgeInsets.only(left: 5),
width: 85,
height: 20.h,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(9),
topRight: Radius.circular(9),
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(9),
),
color: Color(0xFF32A060),
),
child: Text(
"当前折扣:${discount.toString()}",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
),
],
),
SizedBox(
height: 5.h,

8
lib/view_widget/mine_vip_view.dart

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

281
lib/view_widget/vip_dialog.dart

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