From 61e7dca70b6c36025e009e8dcd42590171bd9f23 Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Tue, 31 Oct 2023 15:25:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=91=E6=8D=A2=E5=88=B8=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=9B=B4=E6=94=B9=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/home/welfare_page.dart | 2 +- lib/mine/coupon_page.dart | 2 +- lib/mine/coupons_page.dart | 2 +- lib/mine/roll_center_page.dart | 2 +- lib/order/write_off_page.dart | 25 ++++++++++++------------- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/lib/home/welfare_page.dart b/lib/home/welfare_page.dart index ed9e2525..895b8b2e 100644 --- a/lib/home/welfare_page.dart +++ b/lib/home/welfare_page.dart @@ -652,7 +652,7 @@ class _WelfarePage extends State { Navigator.of(context) .pushNamed('/router/write_off_page', arguments: { "couponId": cop.id, - "coupon": jsonEncode(cop.toJson()), + "coupon": cop, }); } else { showStoreSelector(cop.storeList); diff --git a/lib/mine/coupon_page.dart b/lib/mine/coupon_page.dart index eae30d08..7ea4efef 100644 --- a/lib/mine/coupon_page.dart +++ b/lib/mine/coupon_page.dart @@ -245,7 +245,7 @@ class _CouponPage extends State { '/router/write_off_page', arguments: { "couponId": coupons[position].id, - "coupon": jsonEncode(coupons[position]), + "coupon": coupons[position], }).then((value) { _onRefresh(); }); diff --git a/lib/mine/coupons_page.dart b/lib/mine/coupons_page.dart index a632b486..77b6c654 100644 --- a/lib/mine/coupons_page.dart +++ b/lib/mine/coupons_page.dart @@ -180,7 +180,7 @@ class _CouponsPage extends State { '/router/write_off_page', arguments: { "couponId": coupons[position].id, - "coupon": jsonEncode(coupons[position]), + "coupon": coupons[position], }).then((value) { _onRefresh(); }); diff --git a/lib/mine/roll_center_page.dart b/lib/mine/roll_center_page.dart index d3ca703a..8ae869f0 100644 --- a/lib/mine/roll_center_page.dart +++ b/lib/mine/roll_center_page.dart @@ -134,7 +134,7 @@ class _RollCenterPage extends State { '/router/write_off_page', arguments: { "couponId": coupons[position].id, - "coupon": coupons[position].toJson() + "coupon": coupons[position] }); } else { showStoreSelector(coupons[position].storeList); diff --git a/lib/order/write_off_page.dart b/lib/order/write_off_page.dart index e254c86c..4d49869d 100644 --- a/lib/order/write_off_page.dart +++ b/lib/order/write_off_page.dart @@ -33,7 +33,7 @@ class WriteOffPage extends StatefulWidget { } class _WriteOffPage extends State { - dynamic coupon; + Coupon coupon; ApiService apiService; CouponDetail queryCoupon; final RefreshController refreshController = RefreshController(); @@ -42,10 +42,10 @@ class _WriteOffPage extends State { void initState() { super.initState(); - coupon = jsonDecode(widget.arguments["coupon"]); + coupon = widget.arguments["coupon"]; if (mounted) setState(() {}); - queryCouponDetail(coupon["memberCouponId"]); + queryCouponDetail(coupon.memberCouponId); } ///查询核销券状态/查询优惠券详情 @@ -60,15 +60,14 @@ class _WriteOffPage extends State { } BaseData baseData = await apiService.couponDetail(memberCouponId); if (baseData != null && baseData.isSuccess) { - setState(() { queryCoupon = baseData.data; if(queryCoupon.status==2){ Navigator.of(context).pop(true); } - else Future.delayed(Duration(seconds: 1), () { - queryCouponDetail(coupon["memberCouponId"]); - }); - }); + // else Future.delayed(Duration(seconds: 15), () { + // queryCouponDetail(coupon.memberCouponId); + // }); + // setState(() {}); } else { SmartDialog.showToast(baseData.msg, alignment: Alignment.center); } @@ -127,7 +126,7 @@ class _WriteOffPage extends State { child: Column( children: [ Text( - coupon != null ? coupon["couponName"] : "", + coupon != null ? coupon.couponName : "", style: TextStyle( fontSize: 16.sp, fontWeight: FontWeight.bold, @@ -137,8 +136,8 @@ class _WriteOffPage extends State { height:11.h, ), Text( - (coupon["useStartTime"] == null || coupon["useEndTime"] == null) ? "" : S.of(context).youxiaoqi( - "${coupon["useStartTime"].replaceAll("-", ".").split(" ")[0]}-${coupon["useEndTime"].replaceAll("-", ".").split(" ")[0]}"), + (coupon.useStartTime == null || coupon.useEndTime == null) ? "" : S.of(context).youxiaoqi( + "${coupon.useStartTime.replaceAll("-", ".").split(" ")[0]}-${coupon.useEndTime.replaceAll("-", ".").split(" ")[0]}"), style: TextStyle( fontSize: 12.sp, color: Color(0xFF353535), @@ -203,7 +202,7 @@ class _WriteOffPage extends State { height: 16.h, ), Expanded(child: QrImage( - data: "{\"type\":\"wiped\",\"memberCouponId\":\"${coupon["memberCouponId"]}\"}", + data: "{\"type\":\"wiped\",\"memberCouponId\":\"${coupon.memberCouponId}\"}", version: QrVersions.auto, size: 250.w, gapless: true, @@ -560,7 +559,7 @@ class _WriteOffPage extends State { Container( child: Html( data: - coupon != null ? coupon["remark"] : "", + coupon != null ? coupon.remark : "", customImageRenders: { networkSourceMatcher(): networkImageRender( loadingWidget: () {