|
|
|
@ -39,17 +39,14 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
ApiService apiService; |
|
|
|
|
MinApiService minService; |
|
|
|
|
int jumpState; |
|
|
|
|
final RefreshController refreshController = RefreshController(); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
void initState() { |
|
|
|
|
super.initState(); |
|
|
|
|
SharedPreferences.getInstance().then((value) { |
|
|
|
|
apiService = ApiService( |
|
|
|
|
Dio(), |
|
|
|
|
context: context, |
|
|
|
|
token: value.getString("token"), |
|
|
|
|
showLoading: true |
|
|
|
|
); |
|
|
|
|
apiService = ApiService(Dio(), |
|
|
|
|
context: context, token: value.getString("token"), showLoading: true); |
|
|
|
|
queryDetails(); |
|
|
|
|
}); |
|
|
|
|
jumpState = widget.arguments["jumpState"]; |
|
|
|
@ -66,7 +63,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
String tenant = orderInfo.tenantCode; |
|
|
|
|
String storeId = orderInfo.storeId; |
|
|
|
|
SharedPreferences.getInstance().then( |
|
|
|
|
(value) => { |
|
|
|
|
(value) => { |
|
|
|
|
value.setString('minToken', minToken), |
|
|
|
|
value.setString('tenant', tenant), |
|
|
|
|
value.setString('storeId', storeId), |
|
|
|
@ -94,16 +91,19 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
queryDetails() async { |
|
|
|
|
if (apiService == null) { |
|
|
|
|
SharedPreferences value = await SharedPreferences.getInstance(); |
|
|
|
|
apiService = ApiService( |
|
|
|
|
Dio(), |
|
|
|
|
apiService = ApiService(Dio(), |
|
|
|
|
context: context, |
|
|
|
|
token: value.getString("token"), |
|
|
|
|
showLoading: false |
|
|
|
|
); |
|
|
|
|
showLoading: false); |
|
|
|
|
} |
|
|
|
|
BaseData<OrderInfo> baseData = await apiService |
|
|
|
|
.orderDetail(widget.arguments["id"]) |
|
|
|
|
.catchError((error) {}); |
|
|
|
|
.catchError((error) { |
|
|
|
|
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), |
|
|
|
|
alignment: Alignment.center); |
|
|
|
|
refreshController.refreshFailed(); |
|
|
|
|
refreshController.loadFailed(); |
|
|
|
|
}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
orderInfo = baseData.data; |
|
|
|
|
payStatus = orderInfo.payStatus; |
|
|
|
@ -123,8 +123,12 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
setState(() { |
|
|
|
|
statusTitle(); |
|
|
|
|
}); |
|
|
|
|
}else{ |
|
|
|
|
SmartDialog.showToast(baseData.msg,alignment: Alignment.center); |
|
|
|
|
refreshController.refreshCompleted(); |
|
|
|
|
refreshController.loadComplete(); |
|
|
|
|
} else { |
|
|
|
|
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); |
|
|
|
|
refreshController.refreshFailed(); |
|
|
|
|
refreshController.loadFailed(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -159,52 +163,70 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
leadingColor: Colors.white, |
|
|
|
|
brightness: Brightness.dark, |
|
|
|
|
), |
|
|
|
|
body: Container( |
|
|
|
|
child: SingleChildScrollView( |
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
child: Container( |
|
|
|
|
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 |
|
|
|
|
body: SmartRefresher( |
|
|
|
|
controller: refreshController, |
|
|
|
|
enablePullDown: true, |
|
|
|
|
enablePullUp: false, |
|
|
|
|
header: MyHeader(), |
|
|
|
|
footer: CustomFooter( |
|
|
|
|
builder: (context, mode) { |
|
|
|
|
return MyFooter(mode); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
onRefresh:(){ |
|
|
|
|
setState(() { |
|
|
|
|
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, |
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
///订单商品 |
|
|
|
|
if(orderInfo != null) |
|
|
|
|
OrderCommodity(orderInfo), |
|
|
|
|
///订单取货地址,或, 收货地址 |
|
|
|
|
if(orderInfo != null && orderInfo.addressExt != null) |
|
|
|
|
OrderAddress( |
|
|
|
|
orderStatus, |
|
|
|
|
isTakeOut, |
|
|
|
|
sendStatus, |
|
|
|
|
payStatus, |
|
|
|
|
refundStatus, |
|
|
|
|
title, |
|
|
|
|
center, |
|
|
|
|
paySelected, |
|
|
|
|
_orderCancel, |
|
|
|
|
orderInfo, |
|
|
|
|
jumpState |
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
///显示订单信息 |
|
|
|
|
if(orderInfo != null) |
|
|
|
|
OrderInfoView(orderInfo, isTakeOut), |
|
|
|
|
///订单商品 |
|
|
|
|
if(orderInfo != null) |
|
|
|
|
OrderCommodity(orderInfo), |
|
|
|
|
|
|
|
|
|
Container( |
|
|
|
|
height: 42.h, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
///显示订单信息 |
|
|
|
|
if(orderInfo != null) |
|
|
|
|
OrderInfoView(orderInfo, isTakeOut), |
|
|
|
|
|
|
|
|
|
Container( |
|
|
|
|
height: 42.h, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|