Browse Source

增加转发页面;

更改订单详情
dart3_last
wurong 2 years ago
parent
commit
00af647dbb
  1. 3
      lib/main.dart
  2. 127
      lib/order/order_detail_page.dart

3
lib/main.dart

@ -90,6 +90,7 @@ import 'community/photo_view_gallery_screen.dart';
import 'community/report/report_notice.dart'; import 'community/report/report_notice.dart';
import 'community/report/report_page.dart'; import 'community/report/report_page.dart';
import 'community/report/report_success.dart'; import 'community/report/report_success.dart';
import 'community/share_trends.dart';
import 'home/guide_page.dart'; import 'home/guide_page.dart';
import 'home/help_farmers/help_farmers_page.dart'; import 'home/help_farmers/help_farmers_page.dart';
import 'home/home_view/activity_list.dart'; import 'home/home_view/activity_list.dart';
@ -438,4 +439,6 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
ChatSetting(), ChatSetting(),
'/router/notice_setting': (context, {arguments}) => '/router/notice_setting': (context, {arguments}) =>
NoticeSetting(), NoticeSetting(),
'/router/share_trends': (context, {arguments}) =>
ShareTrends(arguments:arguments),
}; };

127
lib/order/order_detail_page.dart

@ -94,21 +94,20 @@ class _OrderDetailPage extends State<OrderDetailPage> {
queryDetails() async { queryDetails() async {
if (apiService == null) { if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance(); SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService( apiService = ApiService(Dio(),
Dio(), context: context,
context: context, token: value.getString("token"),
token: value.getString("token"), showLoading: false);
showLoading: false }
);
}
BaseData<OrderInfo> baseData = await apiService BaseData<OrderInfo> baseData = await apiService
.orderDetail(widget.arguments["id"]) .orderDetail(widget.arguments["id"])
.catchError((error) { .catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center); alignment: Alignment.center);
refreshController.refreshFailed(); refreshController.refreshFailed();
refreshController.loadFailed();}); refreshController.loadFailed();
});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
orderInfo = baseData.data; orderInfo = baseData.data;
payStatus = orderInfo.payStatus; payStatus = orderInfo.payStatus;
@ -130,8 +129,8 @@ class _OrderDetailPage extends State<OrderDetailPage> {
}); });
refreshController.refreshCompleted(); refreshController.refreshCompleted();
refreshController.loadComplete(); refreshController.loadComplete();
}else{ } else {
SmartDialog.showToast(baseData.msg,alignment: Alignment.center); SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
refreshController.refreshFailed(); refreshController.refreshFailed();
refreshController.loadFailed(); refreshController.loadFailed();
} }
@ -172,68 +171,59 @@ class _OrderDetailPage extends State<OrderDetailPage> {
controller: refreshController, controller: refreshController,
enablePullDown: true, enablePullDown: true,
enablePullUp: false, enablePullUp: false,
header: MyHeader(), header: MyHeader(color: Colors.white,),
footer: CustomFooter( footer: CustomFooter(
builder: (context, mode) { builder: (context, mode) {
return MyFooter(mode); return MyFooter(mode);
}, },
), ),
onRefresh:(){ onRefresh:(){
setState(() { queryDetails();
queryDetails();
});
}, },
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
scrollController: ScrollController(), scrollController: ScrollController(),
child: Container( child: Column(
child: SingleChildScrollView( children: [
physics: BouncingScrollPhysics(), ///
child: Container( OrderStatus(
child: Column( orderStatus,
children: [ isTakeOut,
/// sendStatus,
OrderStatus( payStatus,
orderStatus, refundStatus,
isTakeOut, title,
sendStatus, center,
payStatus, orderInfo,
refundStatus, ),
title,
center,
orderInfo,
),
/// ///
if(orderInfo != null && orderInfo.addressExt != null) if(orderInfo != null && orderInfo.addressExt != null)
OrderAddress( OrderAddress(
orderStatus, orderStatus,
isTakeOut, isTakeOut,
sendStatus, sendStatus,
payStatus, payStatus,
refundStatus, refundStatus,
title, title,
center, center,
paySelected, paySelected,
_orderCancel, _orderCancel,
orderInfo, orderInfo,
jumpState jumpState
), ),
/// ///
if(orderInfo != null) if(orderInfo != null)
OrderCommodity(orderInfo), OrderCommodity(orderInfo),
/// ///
if(orderInfo != null) if(orderInfo != null)
OrderInfoView(orderInfo, isTakeOut), OrderInfoView(orderInfo, isTakeOut),
Container( Container(
height: 42.h, height: 42.h,
),
],
),
), ),
), ],
), ),
), ),
) )
@ -258,21 +248,26 @@ class _OrderDetailPage extends State<OrderDetailPage> {
} }
} }
payResult(BaseData baseData) async{ payResult(BaseData baseData) async {
await queryDetails(); await queryDetails();
Future.delayed(Duration(milliseconds: 800), () { Future.delayed(Duration(milliseconds: 800), () {
EasyLoading.dismiss(); EasyLoading.dismiss();
SmartDialog.showToast(baseData?.msg == "ok" ?"订单支付成功" :baseData?.msg,alignment: Alignment.center); SmartDialog.showToast(baseData?.msg == "ok" ? "订单支付成功" : baseData?.msg,
alignment: Alignment.center);
}); });
} }
statusTitle() { statusTitle() {
if (isTakeOut == 0) { if (isTakeOut == 0) {
if (payStatus == 0) { if (payStatus == 0 && orderStatus != -1) {
title = S.of(context).dingdandaizhifu; title = S.of(context).dingdandaizhifu;
} else { } else {
title = S.of(context).dingdanyizhifu; title = S.of(context).dingdanyizhifu;
switch (orderStatus) { switch (orderStatus) {
case -1:
title = S.of(context).yiquxiao;
center = S.of(context).yiquxiao;
break;
case 2: case 2:
title = S.of(context).shangjiazhengzaipeican; title = S.of(context).shangjiazhengzaipeican;
break; break;
@ -343,7 +338,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
} }
} }
} }
if (orderStatus == 5) { if (orderStatus == 5 || orderStatus == -1) {
title = S.of(context).yiquxiao; title = S.of(context).yiquxiao;
center = S.of(context).yiquxiao; center = S.of(context).yiquxiao;
} }
@ -552,10 +547,10 @@ class _OrderDetailPage extends State<OrderDetailPage> {
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
SmartDialog.showToast("订单取消成功"); SmartDialog.showToast("订单取消成功");
// Future.delayed(Duration(milliseconds:450), () { // Future.delayed(Duration(milliseconds:450), () {
queryDetails(); queryDetails();
// }); // });
}else{ } else {
SmartDialog.showToast(baseData.msg,alignment: Alignment.center); SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
} }
} }

Loading…
Cancel
Save