|
@@ -20,7 +20,7 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
|
|
|
ScrollController _scrollController = ScrollController(); //初始化滚动轴监控对象
|
|
ScrollController _scrollController = ScrollController(); //初始化滚动轴监控对象
|
|
|
List < OrderList > orderList = []; //订单列表
|
|
List < OrderList > orderList = []; //订单列表
|
|
|
bool hasNextPage = true;
|
|
bool hasNextPage = true;
|
|
|
- List lineList = [];
|
|
|
|
|
|
|
+ List lineList = []; //线路列表
|
|
|
String stationId;
|
|
String stationId;
|
|
|
List < bool > checkStatusList = [];
|
|
List < bool > checkStatusList = [];
|
|
|
bool showLineStatus = true;
|
|
bool showLineStatus = true;
|
|
@@ -37,7 +37,7 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
|
|
|
getOrderList(value, lineIdStr, page).then((resp) {
|
|
getOrderList(value, lineIdStr, page).then((resp) {
|
|
|
if (resp.success && resp.code == 1) {
|
|
if (resp.success && resp.code == 1) {
|
|
|
setState(() {
|
|
setState(() {
|
|
|
- orderList = resp.data.items;
|
|
|
|
|
|
|
+ orderList = resp.data.items;
|
|
|
hasNextPage = resp.data.hasNextPage;
|
|
hasNextPage = resp.data.hasNextPage;
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
@@ -49,15 +49,16 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
|
|
|
setState(() {
|
|
setState(() {
|
|
|
showLineStatus = true;
|
|
showLineStatus = true;
|
|
|
});
|
|
});
|
|
|
|
|
+ switchLine();
|
|
|
}
|
|
}
|
|
|
if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) {
|
|
if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) {
|
|
|
print('滑动到底部了');
|
|
print('滑动到底部了');
|
|
|
- if(hasNextPage){
|
|
|
|
|
|
|
+ if (hasNextPage) {
|
|
|
setState(() {
|
|
setState(() {
|
|
|
- page=++page;
|
|
|
|
|
|
|
+ page = ++page;
|
|
|
});
|
|
});
|
|
|
getOrderList(stationId, lineIdStr, page).then((resp) {
|
|
getOrderList(stationId, lineIdStr, page).then((resp) {
|
|
|
- if (resp.success && resp.code == 1) {
|
|
|
|
|
|
|
+ if (resp.success && resp.code == 1) {
|
|
|
setState(() {
|
|
setState(() {
|
|
|
orderList.addAll(resp.data.items);
|
|
orderList.addAll(resp.data.items);
|
|
|
hasNextPage = resp.data.hasNextPage;
|
|
hasNextPage = resp.data.hasNextPage;
|
|
@@ -117,6 +118,8 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
|
|
|
getLine(value);
|
|
getLine(value);
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
+ } else {
|
|
|
|
|
+ switchLine();
|
|
|
}
|
|
}
|
|
|
}, )
|
|
}, )
|
|
|
]
|
|
]
|
|
@@ -141,7 +144,7 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
|
|
|
}
|
|
}
|
|
|
if (hasNextPage) {
|
|
if (hasNextPage) {
|
|
|
return _getMoreWidget();
|
|
return _getMoreWidget();
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
return _noMoreWidegt();
|
|
return _noMoreWidegt();
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -151,6 +154,7 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
|
|
|
setState(() {
|
|
setState(() {
|
|
|
showLineStatus = true;
|
|
showLineStatus = true;
|
|
|
});
|
|
});
|
|
|
|
|
+ switchLine();
|
|
|
},
|
|
},
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
@@ -212,7 +216,6 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
|
|
|
setState(() {
|
|
setState(() {
|
|
|
checkStatusList[index] = !checked;
|
|
checkStatusList[index] = !checked;
|
|
|
});
|
|
});
|
|
|
-
|
|
|
|
|
},
|
|
},
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
@@ -241,20 +244,20 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Widget _noMoreWidegt(){
|
|
|
|
|
|
|
+ Widget _noMoreWidegt() {
|
|
|
return Center(
|
|
return Center(
|
|
|
child: Padding(
|
|
child: Padding(
|
|
|
padding: EdgeInsets.all(10.0),
|
|
padding: EdgeInsets.all(10.0),
|
|
|
- child: Text(
|
|
|
|
|
- '没有更多数据了...',
|
|
|
|
|
- style: TextStyle(fontSize: 16.0),
|
|
|
|
|
- ),
|
|
|
|
|
|
|
+ child: Text(
|
|
|
|
|
+ '没有更多数据了...',
|
|
|
|
|
+ style: TextStyle(fontSize: 16.0),
|
|
|
|
|
+ ),
|
|
|
),
|
|
),
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Future < Null > _onRefresh() async {
|
|
Future < Null > _onRefresh() async {
|
|
|
- await getKey('stationId').then((value) {
|
|
|
|
|
|
|
+ await getKey('stationId').then((value) {
|
|
|
getOrderList(value, lineIdStr, 1).then((resp) {
|
|
getOrderList(value, lineIdStr, 1).then((resp) {
|
|
|
setState(() {
|
|
setState(() {
|
|
|
orderList = resp.data.items;
|
|
orderList = resp.data.items;
|
|
@@ -263,15 +266,48 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void deleteOrder(val) {
|
|
|
|
|
|
|
+ void deleteOrder(val) { //确认接单后的操作
|
|
|
setState(() {
|
|
setState(() {
|
|
|
orderList.removeAt(val);
|
|
orderList.removeAt(val);
|
|
|
if (orderList.length < 4) {
|
|
if (orderList.length < 4) {
|
|
|
-
|
|
|
|
|
|
|
+ if (hasNextPage) {
|
|
|
|
|
+ setState(() {
|
|
|
|
|
+ page = ++page;
|
|
|
|
|
+ });
|
|
|
|
|
+ getOrderList(stationId, lineIdStr, page).then((resp) {
|
|
|
|
|
+ if (resp.success && resp.code == 1) {
|
|
|
|
|
+ setState(() {
|
|
|
|
|
+ orderList.addAll(resp.data.items);
|
|
|
|
|
+ hasNextPage = resp.data.hasNextPage;
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ void switchLine() { //切换线路
|
|
|
|
|
+ setState(() {
|
|
|
|
|
+ orderList = [];
|
|
|
|
|
+ hasNextPage =true;
|
|
|
|
|
+ });
|
|
|
|
|
+ lineIdStr = '';
|
|
|
|
|
+ for (int i = 0; i < checkStatusList.length; i++) {
|
|
|
|
|
+ if (checkStatusList[i]) {
|
|
|
|
|
+ lineIdStr += lineList[i].id.toString() + ',';
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ lineIdStr = lineIdStr.substring(0, lineIdStr.length - 1);
|
|
|
|
|
+ getOrderList(stationId, lineIdStr, page).then((resp) {
|
|
|
|
|
+ if (resp.success && resp.code == 1) {
|
|
|
|
|
+ setState(() {
|
|
|
|
|
+ orderList = resp.data.items;
|
|
|
|
|
+ hasNextPage = resp.data.hasNextPage;
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|