|
|
@@ -32,19 +32,14 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
|
|
|
@override
|
|
|
void initState() {
|
|
|
super.initState();
|
|
|
- getKey('stationId').then((value) {
|
|
|
- setState(() {
|
|
|
- stationId = value;
|
|
|
- });
|
|
|
- getLine(value).then((childValue) {
|
|
|
- getOrderList(value, lineIdStr, page).then((resp) {
|
|
|
- if (isNotError(context, resp)) {
|
|
|
- setState(() {
|
|
|
- orderList = OrderListObj.fromJson(resp.data).data.items;
|
|
|
- hasNextPage = OrderListObj.fromJson(resp.data).data.hasNextPage;
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ getLine().then((childValue) {
|
|
|
+ getOrderList(lineIdStr, page).then((resp) {
|
|
|
+ if (isNotError(context, resp)) {
|
|
|
+ setState(() {
|
|
|
+ orderList = OrderListObj.fromJson(resp.data).data.items;
|
|
|
+ hasNextPage = OrderListObj.fromJson(resp.data).data.hasNextPage;
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
});
|
|
|
_scrollController.addListener(() {
|
|
|
@@ -58,15 +53,15 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
|
|
|
if (hasNextPage && loadMoreOrder) {
|
|
|
loadMoreOrder = false;
|
|
|
page = ++page;
|
|
|
- getOrderList(stationId, lineIdStr, page).then((resp) {
|
|
|
+ getOrderList(lineIdStr, page).then((resp) {
|
|
|
if (isNotError(context, resp)) {
|
|
|
- OrderListObj tempObj =OrderListObj.fromJson(resp.data);
|
|
|
+ OrderListObj tempObj = OrderListObj.fromJson(resp.data);
|
|
|
setState(() {
|
|
|
orderList.addAll(tempObj.data.items);
|
|
|
hasNextPage = tempObj.data.hasNextPage;
|
|
|
});
|
|
|
loadMoreOrder = true;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
loadMoreOrder = true;
|
|
|
}
|
|
|
});
|
|
|
@@ -76,21 +71,39 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
|
|
|
}
|
|
|
|
|
|
|
|
|
- Future getLine(String value) async {
|
|
|
- await getLineFromStation(value).then((resp) {
|
|
|
+ Future getLine() async {
|
|
|
+ await getAllLine().then((resp) {
|
|
|
if (isNotError(context, resp)) {
|
|
|
setState(() {
|
|
|
checkStatusList = [];
|
|
|
lineList = StationLine.fromJson(resp.data).data;
|
|
|
- for (int i = 0; i < lineList.length; i++) {
|
|
|
- checkStatusList.add(true);
|
|
|
- if (i < lineList.length - 1) {
|
|
|
- lineIdStr += lineList[i].id.toString() + ',';
|
|
|
+ getKey('lineIdStr').then((value) {
|
|
|
+ if (value != null) {
|
|
|
+ for (int i = 0; i < lineList.length; i++) {
|
|
|
+ if (value.indexOf(lineList[i].id.toString()) != -1) {
|
|
|
+ checkStatusList.add(true);
|
|
|
+ } else {
|
|
|
+ checkStatusList.add(false);
|
|
|
+ }
|
|
|
+ if (i < lineList.length - 1) {
|
|
|
+ lineIdStr += lineList[i].id.toString() + ',';
|
|
|
+ } else {
|
|
|
+ lineIdStr += lineList[i].id.toString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ print(checkStatusList);
|
|
|
} else {
|
|
|
- lineIdStr += lineList[i].id.toString();
|
|
|
+ for (int i = 0; i < lineList.length; i++) {
|
|
|
+ checkStatusList.add(true);
|
|
|
+ if (i < lineList.length - 1) {
|
|
|
+ lineIdStr += lineList[i].id.toString() + ',';
|
|
|
+ } else {
|
|
|
+ lineIdStr += lineList[i].id.toString();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- stationId = value;
|
|
|
+ });
|
|
|
+
|
|
|
});
|
|
|
return lineIdStr;
|
|
|
}
|
|
|
@@ -117,11 +130,7 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
|
|
|
showLineStatus = !showLineStatus;
|
|
|
});
|
|
|
if (!showLineStatus) {
|
|
|
- getKey('stationId').then((value) {
|
|
|
- if (stationId != value) {
|
|
|
- getLine(value);
|
|
|
- }
|
|
|
- });
|
|
|
+ getLine();
|
|
|
} else {
|
|
|
switchLine(context);
|
|
|
}
|
|
|
@@ -199,13 +208,13 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
|
|
|
child: Container(
|
|
|
height: ScreenUtil.getInstance().setHeight(80),
|
|
|
decoration: BoxDecoration(
|
|
|
- border: BorderDirectional(bottom: BorderSide(color: Colors.white,width: 0.5))
|
|
|
+ border: BorderDirectional(bottom: BorderSide(color: Colors.white, width: 0.5))
|
|
|
),
|
|
|
child: Row(
|
|
|
children: < Widget > [
|
|
|
Padding(
|
|
|
padding: EdgeInsets.only(right: 10),
|
|
|
- child: checked ? Icon(Icons.check, color: Colors.white, ) : Icon(Icons.check, color: Color.fromRGBO(0, 0, 0, 0.0)),
|
|
|
+ child: checked ? Icon(Icons.check, color: Colors.white, ) : Icon(Icons.check,color: Color.fromRGBO(0, 0, 0, 0.0,)),
|
|
|
),
|
|
|
Expanded(
|
|
|
flex: 1,
|
|
|
@@ -260,19 +269,18 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- Future _onRefresh() async{
|
|
|
- var stationId;
|
|
|
+ Future _onRefresh() async {
|
|
|
await getKey('stationId').then((value) {
|
|
|
stationId = value;
|
|
|
page = 1;
|
|
|
});
|
|
|
- await getOrderList(stationId, lineIdStr, page).then((resp) {
|
|
|
- if(isNotError(context, resp)){
|
|
|
- setState(() {
|
|
|
- orderList = OrderListObj.fromJson(resp.data).data.items;
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ await getOrderList(lineIdStr, page).then((resp) {
|
|
|
+ if (isNotError(context, resp)) {
|
|
|
+ setState(() {
|
|
|
+ orderList = OrderListObj.fromJson(resp.data).data.items;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
void deleteOrder(val) { //确认接单后的操作
|
|
|
@@ -283,7 +291,7 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
|
|
|
setState(() {
|
|
|
page = ++page;
|
|
|
});
|
|
|
- getOrderList(stationId, lineIdStr, page).then((resp) {
|
|
|
+ getOrderList(lineIdStr, page).then((resp) {
|
|
|
if (resp.success && resp.code == 1) {
|
|
|
setState(() {
|
|
|
orderList.addAll(resp.data.items);
|
|
|
@@ -303,20 +311,30 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
|
|
|
lineIdStr += lineList[i].id.toString() + ',';
|
|
|
}
|
|
|
}
|
|
|
+ if (lineIdStr == '') {
|
|
|
+ setState(() {
|
|
|
+ orderList = [];
|
|
|
+ hasNextPage = false;
|
|
|
+ });
|
|
|
+ setKey('lineIdStr', lineIdStr);
|
|
|
+ return;
|
|
|
+ }
|
|
|
lineIdStr = lineIdStr.substring(0, lineIdStr.length - 1);
|
|
|
- if(oldLineIdStr==lineIdStr) return;
|
|
|
+
|
|
|
+ if (oldLineIdStr == lineIdStr) return;
|
|
|
setState(() {
|
|
|
orderList = [];
|
|
|
- hasNextPage =true;
|
|
|
+ hasNextPage = true;
|
|
|
});
|
|
|
- getOrderList(stationId, lineIdStr, page).then((resp) {
|
|
|
- if(isNotError(context, resp)){
|
|
|
- OrderListObj tempObj =OrderListObj.fromJson(resp.data);
|
|
|
- setState(() {
|
|
|
- orderList = tempObj.data.items;
|
|
|
- hasNextPage = tempObj.data.hasNextPage;
|
|
|
- });
|
|
|
- oldLineIdStr =lineIdStr;
|
|
|
+ getOrderList(lineIdStr, page).then((resp) {
|
|
|
+ if (isNotError(context, resp)) {
|
|
|
+ OrderListObj tempObj = OrderListObj.fromJson(resp.data);
|
|
|
+ setState(() {
|
|
|
+ orderList = tempObj.data.items;
|
|
|
+ hasNextPage = tempObj.data.hasNextPage;
|
|
|
+ });
|
|
|
+ oldLineIdStr = lineIdStr;
|
|
|
+ setKey('lineIdStr', lineIdStr);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -379,7 +397,7 @@ class _OrderCardContainerState extends State < OrderCardContainer > with SingleT
|
|
|
orderItem('货物名称', widget.order.goods, 15),
|
|
|
orderItem('货物件数', '${widget.order.goodsQuantity}件', 30),
|
|
|
orderCutLine(),
|
|
|
- orderBtn(context, animationStatus, controller, str,widget.order.orderNo),
|
|
|
+ orderBtn(context, animationStatus, controller, str, widget.order.orderNo),
|
|
|
AnimatedOpen(animation: animation, openInfo: widget.order, )
|
|
|
],
|
|
|
),
|
|
|
@@ -392,7 +410,7 @@ class _OrderCardContainerState extends State < OrderCardContainer > with SingleT
|
|
|
super.dispose();
|
|
|
}
|
|
|
|
|
|
- Widget orderBtn(BuildContext context, bool animationStatus, AnimationController controller, String str,String orderNo) {
|
|
|
+ Widget orderBtn(BuildContext context, bool animationStatus, AnimationController controller, String str, String orderNo) {
|
|
|
return Container(
|
|
|
margin: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(20)),
|
|
|
child: Row(
|
|
|
@@ -437,8 +455,8 @@ class _OrderCardContainerState extends State < OrderCardContainer > with SingleT
|
|
|
return new LoadingDialog( //调用对话框
|
|
|
text: '是否确认接单', childCallback: (val) {
|
|
|
if (val) {
|
|
|
- orderReception(orderNo).then((resp){
|
|
|
- if(isNotError(context, resp)){
|
|
|
+ orderReception(orderNo).then((resp) {
|
|
|
+ if (isNotError(context, resp)) {
|
|
|
widget.callback(widget.index);
|
|
|
}
|
|
|
});
|