|
|
|
@ -162,51 +162,42 @@ class _OrderHistoryList extends State<OrderHistoryList>
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
queryOrder({bool isLoading = true}) async { |
|
|
|
|
try { |
|
|
|
|
if (isLoading) |
|
|
|
|
SmartDialog.showLoading( |
|
|
|
|
msg: S.current.zhengzaijiazai, |
|
|
|
|
); |
|
|
|
|
BaseData<PageInfo<OrderInfo>>? baseData = await apiService?.orderList({ |
|
|
|
|
"current": current, |
|
|
|
|
"model": {"status": widget.orderStatus}, |
|
|
|
|
"order": "descending", |
|
|
|
|
"size": 10, |
|
|
|
|
"sort": "id" |
|
|
|
|
}).catchError((onError) { |
|
|
|
|
networkStatus = -1; |
|
|
|
|
refreshController.refreshFailed(); |
|
|
|
|
refreshController.loadFailed(); |
|
|
|
|
return BaseData<PageInfo<OrderInfo>>()..isSuccess = false; |
|
|
|
|
}); |
|
|
|
|
if (baseData?.isSuccess ?? false) { |
|
|
|
|
if (baseData!.data != null && |
|
|
|
|
(baseData.data!.records?.isNotEmpty ?? false)) { |
|
|
|
|
if (current == 1) { |
|
|
|
|
orderInfos.clear(); |
|
|
|
|
} |
|
|
|
|
orderInfos.addAll(baseData.data!.records!); |
|
|
|
|
if (isLoading) |
|
|
|
|
SmartDialog.showLoading( |
|
|
|
|
msg: S.current.zhengzaijiazai, |
|
|
|
|
); |
|
|
|
|
BaseData<PageInfo<OrderInfo>>? baseData = await apiService?.orderList({ |
|
|
|
|
"current": current, |
|
|
|
|
"model": {"status": widget.orderStatus}, |
|
|
|
|
"order": "descending", |
|
|
|
|
"size": 10, |
|
|
|
|
"sort": "id" |
|
|
|
|
}).catchError((onError) { |
|
|
|
|
networkStatus = -1; |
|
|
|
|
refreshController.refreshFailed(); |
|
|
|
|
refreshController.loadFailed(); |
|
|
|
|
return BaseData<PageInfo<OrderInfo>>()..isSuccess = false; |
|
|
|
|
}); |
|
|
|
|
if (baseData?.isSuccess ?? false) { |
|
|
|
|
if ((baseData?.data?.records?.isNotEmpty ?? false)) { |
|
|
|
|
if (current == 1) { |
|
|
|
|
orderInfos.clear(); |
|
|
|
|
} |
|
|
|
|
orderInfos.addAll(baseData!.data!.records!); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
refreshController.refreshCompleted(); |
|
|
|
|
refreshController.loadComplete(); |
|
|
|
|
if (current * 10 > (int.tryParse("${baseData.data?.total}") ?? 0)) { |
|
|
|
|
refreshController.loadNoData(); |
|
|
|
|
} else { |
|
|
|
|
current += 1; |
|
|
|
|
} |
|
|
|
|
setState(() {}); |
|
|
|
|
networkStatus = 1; |
|
|
|
|
refreshController.refreshCompleted(); |
|
|
|
|
refreshController.loadComplete(); |
|
|
|
|
if (current * 10 > (int.tryParse("${baseData?.data?.total}") ?? 0)) { |
|
|
|
|
refreshController.loadNoData(); |
|
|
|
|
} else { |
|
|
|
|
if (baseData?.msg?.isNotEmpty ?? false) |
|
|
|
|
SmartDialog.showToast( |
|
|
|
|
"${baseData!.msg}", |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
); |
|
|
|
|
refreshController.refreshFailed(); |
|
|
|
|
refreshController.loadFailed(); |
|
|
|
|
current += 1; |
|
|
|
|
} |
|
|
|
|
} finally { |
|
|
|
|
setState(() {}); |
|
|
|
|
networkStatus = 1; |
|
|
|
|
} else { |
|
|
|
|
refreshController.refreshFailed(); |
|
|
|
|
refreshController.loadFailed(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|