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: () {