diff --git a/lib/main.dart b/lib/main.dart index dd21aa1d..b1899985 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -90,6 +90,7 @@ import 'community/photo_view_gallery_screen.dart'; import 'community/report/report_notice.dart'; import 'community/report/report_page.dart'; import 'community/report/report_success.dart'; +import 'community/share_trends.dart'; import 'home/guide_page.dart'; import 'home/help_farmers/help_farmers_page.dart'; import 'home/home_view/activity_list.dart'; @@ -438,4 +439,6 @@ Map routers = { ChatSetting(), '/router/notice_setting': (context, {arguments}) => NoticeSetting(), + '/router/share_trends': (context, {arguments}) => + ShareTrends(arguments:arguments), }; diff --git a/lib/order/order_detail_page.dart b/lib/order/order_detail_page.dart index c53ef472..78366ca6 100644 --- a/lib/order/order_detail_page.dart +++ b/lib/order/order_detail_page.dart @@ -94,21 +94,20 @@ class _OrderDetailPage extends State { queryDetails() async { if (apiService == null) { - SharedPreferences value = await SharedPreferences.getInstance(); - apiService = ApiService( - Dio(), - context: context, - token: value.getString("token"), - showLoading: false - ); - } + SharedPreferences value = await SharedPreferences.getInstance(); + apiService = ApiService(Dio(), + context: context, + token: value.getString("token"), + showLoading: false); + } BaseData baseData = await apiService .orderDetail(widget.arguments["id"]) .catchError((error) { SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), alignment: Alignment.center); refreshController.refreshFailed(); - refreshController.loadFailed();}); + refreshController.loadFailed(); + }); if (baseData != null && baseData.isSuccess) { orderInfo = baseData.data; payStatus = orderInfo.payStatus; @@ -130,8 +129,8 @@ class _OrderDetailPage extends State { }); refreshController.refreshCompleted(); refreshController.loadComplete(); - }else{ - SmartDialog.showToast(baseData.msg,alignment: Alignment.center); + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); refreshController.refreshFailed(); refreshController.loadFailed(); } @@ -172,68 +171,59 @@ class _OrderDetailPage extends State { controller: refreshController, enablePullDown: true, enablePullUp: false, - header: MyHeader(), + header: MyHeader(color: Colors.white,), footer: CustomFooter( builder: (context, mode) { return MyFooter(mode); }, ), onRefresh:(){ - setState(() { - queryDetails(); - }); + queryDetails(); }, physics: BouncingScrollPhysics(), scrollController: ScrollController(), - child: Container( - child: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Container( - child: Column( - children: [ - ///订单状态显示 - OrderStatus( - orderStatus, - isTakeOut, - sendStatus, - payStatus, - refundStatus, - title, - center, - orderInfo, - ), + child: Column( + children: [ + ///订单状态显示 + OrderStatus( + orderStatus, + isTakeOut, + sendStatus, + payStatus, + refundStatus, + title, + center, + orderInfo, + ), - ///订单取货地址,或, 收货地址 - if(orderInfo != null && orderInfo.addressExt != null) - OrderAddress( - orderStatus, - isTakeOut, - sendStatus, - payStatus, - refundStatus, - title, - center, - paySelected, - _orderCancel, - orderInfo, - jumpState - ), + ///订单取货地址,或, 收货地址 + if(orderInfo != null && orderInfo.addressExt != null) + OrderAddress( + orderStatus, + isTakeOut, + sendStatus, + payStatus, + refundStatus, + title, + center, + paySelected, + _orderCancel, + orderInfo, + jumpState + ), - ///订单商品 - if(orderInfo != null) - OrderCommodity(orderInfo), + ///订单商品 + if(orderInfo != null) + OrderCommodity(orderInfo), - ///显示订单信息 - if(orderInfo != null) - OrderInfoView(orderInfo, isTakeOut), + ///显示订单信息 + if(orderInfo != null) + OrderInfoView(orderInfo, isTakeOut), - Container( - height: 42.h, - ), - ], - ), + Container( + height: 42.h, ), - ), + ], ), ), ) @@ -258,21 +248,26 @@ class _OrderDetailPage extends State { } } - payResult(BaseData baseData) async{ + payResult(BaseData baseData) async { await queryDetails(); Future.delayed(Duration(milliseconds: 800), () { EasyLoading.dismiss(); - SmartDialog.showToast(baseData?.msg == "ok" ?"订单支付成功" :baseData?.msg,alignment: Alignment.center); + SmartDialog.showToast(baseData?.msg == "ok" ? "订单支付成功" : baseData?.msg, + alignment: Alignment.center); }); } statusTitle() { if (isTakeOut == 0) { - if (payStatus == 0) { + if (payStatus == 0 && orderStatus != -1) { title = S.of(context).dingdandaizhifu; } else { title = S.of(context).dingdanyizhifu; switch (orderStatus) { + case -1: + title = S.of(context).yiquxiao; + center = S.of(context).yiquxiao; + break; case 2: title = S.of(context).shangjiazhengzaipeican; break; @@ -343,7 +338,7 @@ class _OrderDetailPage extends State { } } } - if (orderStatus == 5) { + if (orderStatus == 5 || orderStatus == -1) { title = S.of(context).yiquxiao; center = S.of(context).yiquxiao; } @@ -552,10 +547,10 @@ class _OrderDetailPage extends State { if (baseData != null && baseData.isSuccess) { SmartDialog.showToast("订单取消成功"); // Future.delayed(Duration(milliseconds:450), () { - queryDetails(); + queryDetails(); // }); - }else{ - SmartDialog.showToast(baseData.msg,alignment: Alignment.center); + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); } }