From 862019e882ed7287acc50a7330e665f2d0d0af15 Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Fri, 21 Oct 2022 15:59:41 +0800 Subject: [PATCH 1/3] =?UTF-8?q?vip=E9=A1=B5=E9=9D=A2=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=8C=20=E4=BC=98=E6=83=A0=E5=88=B8=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E6=98=AF0=E5=B0=B1=E4=B8=8D=E6=98=BE=E7=A4=BA;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/home/welfare_page.dart | 14 ++-- lib/retrofit/retrofit_api.dart | 2 +- lib/view_widget/new_coupon_widget.dart | 8 +- lib/vip/vip_page.dart | 100 ++++++++++++------------- 4 files changed, 59 insertions(+), 65 deletions(-) diff --git a/lib/home/welfare_page.dart b/lib/home/welfare_page.dart index df772876..38c345ca 100644 --- a/lib/home/welfare_page.dart +++ b/lib/home/welfare_page.dart @@ -157,7 +157,7 @@ class _WelfarePage extends State { appBar: MyAppBar( background: Colors.transparent, leadingColor: Colors.white, - title: "福利中心", + title: S.of(context).fulizhongxin, titleColor: Colors.white, titleSize: 18.sp, brightness: Brightness.dark, @@ -520,7 +520,7 @@ class _WelfarePage extends State { textBaseline: TextBaseline.alphabetic, children: [ Text( - "¥", + cop.limitAmount != "0.00"?"¥":"", style: TextStyle( fontSize: 16.sp, fontWeight: MyFontWeight.medium, @@ -531,9 +531,9 @@ class _WelfarePage extends State { height: 4.h, ), Text( - coupon != null + cop.limitAmount != "0.00"?(coupon != null ? "${AppUtils.calculateDouble(double.tryParse(cop.limitAmount) ?? 0)}" - : "", + : "") :"", style: TextStyle( fontSize: 24.sp, fontWeight: FontWeight.bold, @@ -555,10 +555,10 @@ class _WelfarePage extends State { textBaseline: TextBaseline.alphabetic, children: [ Text( - coupon != null + cop.discountPercent != 0 ? (coupon != null ? "${(cop.discountPercent / 10.0 >= 10) ? 10 : cop.discountPercent / 10.0}" ?? "0" - : "", + : ""):"", style: TextStyle( fontSize: 30.sp, fontWeight: MyFontWeight.semi_bold, @@ -569,7 +569,7 @@ class _WelfarePage extends State { height: 4.h, ), Text( - "折", + cop.discountPercent != 0 ? "折" :"", style: TextStyle( fontSize: 16.sp, fontWeight: MyFontWeight.semi_bold, diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 69d486bf..728654be 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -537,7 +537,7 @@ abstract class ApiService { Future> vipCardIndex(); ///VIP订阅/购买 - @POST("/vipCard/orderVip/{id}") + @POST("/vipCard/orderVip") Future> orderVip(@Body() Map param); diff --git a/lib/view_widget/new_coupon_widget.dart b/lib/view_widget/new_coupon_widget.dart index 050786fd..83ba1521 100644 --- a/lib/view_widget/new_coupon_widget.dart +++ b/lib/view_widget/new_coupon_widget.dart @@ -497,6 +497,7 @@ class NewCouponWidget extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ + if(coupon?.limitAmount != "0.00") Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.baseline, @@ -532,16 +533,17 @@ class NewCouponWidget extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ + // if(coupon.discountPercent != 0) Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.baseline, textBaseline: TextBaseline.alphabetic, children: [ Text( - coupon != null + coupon.discountPercent != 0?( coupon != null ? "${(coupon.discountPercent / 10.0 >= 10) ? 10 : coupon.discountPercent / 10.0}" ?? "0" - : "", + : ""):"", style: TextStyle( fontSize: 37.sp, fontWeight: MyFontWeight.semi_bold, @@ -552,7 +554,7 @@ class NewCouponWidget extends StatelessWidget { height: 4.h, ), Text( - "折", + "${coupon.discountPercent != 0 ? "折":""}", style: TextStyle( fontSize: 20.sp, fontWeight: MyFontWeight.semi_bold, diff --git a/lib/vip/vip_page.dart b/lib/vip/vip_page.dart index c247ebc9..40fb1cef 100644 --- a/lib/vip/vip_page.dart +++ b/lib/vip/vip_page.dart @@ -44,32 +44,31 @@ class _VipPageState extends State with AutomaticKeepAliveClientMixin { } queryVipHome() async { - if (apiService == null) { - SharedPreferences value = await SharedPreferences.getInstance(); - apiService = ApiService( - Dio(), - context: context, - token: value.getString("token"), - showLoading: true - ); - } - BaseData baseData = - await apiService.vipCardIndex().catchError((onError) { - _refreshController.refreshFailed();}); - if (baseData != null && baseData.isSuccess) { - vipHome = baseData.data; - _refreshController.refreshCompleted(); - }else{ - _refreshController.refreshFailed(); - SmartDialog.showToast(baseData.msg ?? "", alignment: Alignment.center); + try{ + if (apiService == null) { + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + showLoading: true + ); + } + BaseData baseData = + await apiService.vipCardIndex().catchError((onError) { + _refreshController.refreshFailed();}); + if (baseData != null && baseData.isSuccess) { + vipHome = baseData.data; + _refreshController.refreshCompleted(); + }else{ + _refreshController.refreshFailed(); + SmartDialog.showToast(baseData.msg ?? "", alignment: Alignment.center); + } + }finally{ + setState((){}); } } - - _onRefresh() { - queryVipHome(); - } - @override Widget build(BuildContext context) { super.build(context); @@ -77,39 +76,32 @@ class _VipPageState extends State with AutomaticKeepAliveClientMixin { backgroundColor: Color(0xFFF9FAF7), body: Container( padding: EdgeInsets.only(bottom: 76.h), - child: Container( - child: FutureBuilder( - future:queryVipHome(), - builder: (context, snapshot) { - return SmartRefresher( - controller: _refreshController, - enablePullDown: true, - enablePullUp: false, - header: MyHeader(), - physics: BouncingScrollPhysics(), - onRefresh: () { - setState(() { - _onRefresh(); - }); - }, - child: SingleChildScrollView( - child: Container( - child:Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - VipTop(vipHome,_onRefresh()), + child: SmartRefresher( + controller: _refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + physics: BouncingScrollPhysics(), + onRefresh: () { + queryVipHome(); + }, + child: SingleChildScrollView( + child: Container( + child:Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + VipTop(vipHome,(){ + queryVipHome(); + }), - if(vipHome !=null) - VipGoodsDiscount(vipHome), + if(vipHome !=null) + VipGoodsDiscount(vipHome), - ExclusiveCoupon(), - ], - ), - ), - ), - ); - }, + ExclusiveCoupon(), + ], + ), + ), ), ), ), From 8eb3784de30ad5660efb3940569d88639f101d7d Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Fri, 21 Oct 2022 15:59:50 +0800 Subject: [PATCH 2/3] =?UTF-8?q?vip=E9=A1=B5=E9=9D=A2=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=8C=20=E4=BC=98=E6=83=A0=E5=88=B8=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E6=98=AF0=E5=B0=B1=E4=B8=8D=E6=98=BE=E7=A4=BA;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/vip/vip_view/vip_top.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/vip/vip_view/vip_top.dart b/lib/vip/vip_view/vip_top.dart index 0aa0fc90..4c8f0f8a 100644 --- a/lib/vip/vip_view/vip_top.dart +++ b/lib/vip/vip_view/vip_top.dart @@ -20,9 +20,9 @@ import 'package:tobias/tobias.dart' as tobias; class VipTop extends StatefulWidget { final VipCardHome vipCardHome; - final Function onRefresh; + final Function queryVipHome; - VipTop(this.vipCardHome, this.onRefresh); + VipTop(this.vipCardHome, this.queryVipHome); @override State createState() { @@ -42,7 +42,7 @@ class _VipTop extends State { payListen = weChatResponseEventHandler.listen((event) async { print("payCallback: ${event.errCode}"); if (event.errCode == 0) { - widget.onRefresh(); + widget.queryVipHome(); SmartDialog.showToast("支付成功", alignment: Alignment.center); } else { SmartDialog.showToast("支付失败", alignment: Alignment.center); @@ -96,7 +96,7 @@ class _VipTop extends State { tobias.aliPay(baseData.data["body"]).then((payRes) { if (payRes['resultStatus'] == 9000 || payRes['resultStatus'] == '9000') { - widget.onRefresh(); + widget.queryVipHome(); SmartDialog.showToast("支付成功", alignment: Alignment.center); } else { From ad8db00642d622f9ccf05cdd492dfcdef6d01653 Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Fri, 21 Oct 2022 16:11:59 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E9=80=89=E6=8B=A9vip=E4=BB=B7=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/settlement/settlement.dart | 2 +- lib/settlement/settlement_view/activity_coupon_remarks.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index 68b40587..5a9648a5 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -80,7 +80,7 @@ class _Settlement extends State { int count1 = 0; String productId; bool orderButton = false; - bool useVipPriceSelect = false; + bool useVipPriceSelect = true; @override void initState() { diff --git a/lib/settlement/settlement_view/activity_coupon_remarks.dart b/lib/settlement/settlement_view/activity_coupon_remarks.dart index 4b80a8a5..3e302526 100644 --- a/lib/settlement/settlement_view/activity_coupon_remarks.dart +++ b/lib/settlement/settlement_view/activity_coupon_remarks.dart @@ -43,7 +43,7 @@ class ActivityCouponRemarks extends StatefulWidget { } class _ActivityCouponRemarks extends State { - bool vipSelect = false; + bool vipSelect = true; @override Widget build(BuildContext context) {