|
|
|
@ -95,12 +95,10 @@ 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"]) |
|
|
|
@ -108,7 +106,8 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
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<OrderDetailPage> {
|
|
|
|
|
}); |
|
|
|
|
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,23 +171,17 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
controller: refreshController, |
|
|
|
|
enablePullDown: true, |
|
|
|
|
enablePullUp: false, |
|
|
|
|
header: MyHeader(), |
|
|
|
|
header: MyHeader(color: Colors.white,), |
|
|
|
|
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: [ |
|
|
|
|
///订单状态显示 |
|
|
|
@ -233,9 +226,6 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
@ -258,21 +248,26 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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<OrderDetailPage> {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (orderStatus == 5) { |
|
|
|
|
if (orderStatus == 5 || orderStatus == -1) { |
|
|
|
|
title = S.of(context).yiquxiao; |
|
|
|
|
center = S.of(context).yiquxiao; |
|
|
|
|
} |
|
|
|
@ -554,8 +549,8 @@ class _OrderDetailPage extends State<OrderDetailPage> {
|
|
|
|
|
// Future.delayed(Duration(milliseconds:450), () { |
|
|
|
|
queryDetails(); |
|
|
|
|
// }); |
|
|
|
|
}else{ |
|
|
|
|
SmartDialog.showToast(baseData.msg,alignment: Alignment.center); |
|
|
|
|
} else { |
|
|
|
|
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|