|
|
@ -1,6 +1,7 @@ |
|
|
|
import 'package:dio/dio.dart'; |
|
|
|
import 'package:dio/dio.dart'; |
|
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
|
|
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart'; |
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/base_data.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/exchange_order.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/exchange_order.dart'; |
|
|
@ -125,25 +126,25 @@ class ExchangeHistoryList extends StatefulWidget { |
|
|
|
class _ExchangeHistoryList extends State<ExchangeHistoryList> |
|
|
|
class _ExchangeHistoryList extends State<ExchangeHistoryList> |
|
|
|
with AutomaticKeepAliveClientMixin{ |
|
|
|
with AutomaticKeepAliveClientMixin{ |
|
|
|
ApiService apiService; |
|
|
|
ApiService apiService; |
|
|
|
|
|
|
|
RefreshController _refreshController = RefreshController(initialRefresh: false); |
|
|
|
RefreshController _refreshController = |
|
|
|
int pageNum = 1; |
|
|
|
RefreshController(initialRefresh: false); |
|
|
|
List<ExchangeOrder> orders = []; |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
void initState() { |
|
|
|
void initState() { |
|
|
|
super.initState(); |
|
|
|
super.initState(); |
|
|
|
SharedPreferences.getInstance().then((value) => { |
|
|
|
SharedPreferences.getInstance().then((value) => { |
|
|
|
apiService = ApiService(Dio(), |
|
|
|
apiService = ApiService(Dio(), |
|
|
|
showLoading: true, |
|
|
|
showLoading: false, |
|
|
|
context: context, token: value.getString('token')), |
|
|
|
context: context, token: value.getString('token')), |
|
|
|
queryHistory(), |
|
|
|
queryHistory(), |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int pageNum = 1; |
|
|
|
queryHistory({isLoading = true}) async { |
|
|
|
List<ExchangeOrder> orders = []; |
|
|
|
try{ |
|
|
|
|
|
|
|
if(isLoading) |
|
|
|
queryHistory() async { |
|
|
|
EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black); |
|
|
|
var map = { |
|
|
|
var map = { |
|
|
|
"pageNum": pageNum, |
|
|
|
"pageNum": pageNum, |
|
|
|
"pageSize": 10, |
|
|
|
"pageSize": 10, |
|
|
@ -162,7 +163,6 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> |
|
|
|
orders.clear(); |
|
|
|
orders.clear(); |
|
|
|
} |
|
|
|
} |
|
|
|
orders.addAll(baseData.data.list); |
|
|
|
orders.addAll(baseData.data.list); |
|
|
|
setState(() { |
|
|
|
|
|
|
|
_refreshController.loadComplete(); |
|
|
|
_refreshController.loadComplete(); |
|
|
|
_refreshController.refreshCompleted(); |
|
|
|
_refreshController.refreshCompleted(); |
|
|
|
if (baseData.data.pages == baseData.data.pageNum) { |
|
|
|
if (baseData.data.pages == baseData.data.pageNum) { |
|
|
@ -170,16 +170,18 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
pageNum += 1; |
|
|
|
pageNum += 1; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
_refreshController.refreshFailed(); |
|
|
|
_refreshController.refreshFailed(); |
|
|
|
_refreshController.loadFailed(); |
|
|
|
_refreshController.loadFailed(); |
|
|
|
|
|
|
|
}}finally{ |
|
|
|
|
|
|
|
EasyLoading.dismiss(); |
|
|
|
|
|
|
|
setState(() {}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_refresh() { |
|
|
|
_refresh() { |
|
|
|
pageNum = 1; |
|
|
|
pageNum = 1; |
|
|
|
queryHistory(); |
|
|
|
queryHistory(isLoading: false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
@ -531,7 +533,6 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> |
|
|
|
GestureDetector( |
|
|
|
GestureDetector( |
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
onTap: () { |
|
|
|
onTap: () { |
|
|
|
setState(() { |
|
|
|
|
|
|
|
Navigator.of(context).pushNamed( |
|
|
|
Navigator.of(context).pushNamed( |
|
|
|
'/router/logistics_information_page', |
|
|
|
'/router/logistics_information_page', |
|
|
|
arguments: { |
|
|
|
arguments: { |
|
|
@ -541,7 +542,6 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> |
|
|
|
"productNum": exchangeOrder.creditOrderDetailList[0].goodsNumber, |
|
|
|
"productNum": exchangeOrder.creditOrderDetailList[0].goodsNumber, |
|
|
|
"skuImg":exchangeOrder.creditOrderDetailList[0].goodsMainImg |
|
|
|
"skuImg":exchangeOrder.creditOrderDetailList[0].goodsMainImg |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
child: buildBtnStatusTow(exchangeOrder.sendStatus), |
|
|
|
child: buildBtnStatusTow(exchangeOrder.sendStatus), |
|
|
|
)) |
|
|
|
)) |
|
|
|