|
|
@@ -2,6 +2,9 @@ import 'package:flutter/material.dart';
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
import 'order_management_page/order_detail_page.dart';
|
|
|
import '../showDialog.dart';
|
|
|
+import '../util/models.dart';
|
|
|
+import '../util/api.dart';
|
|
|
+import '../util/util.dart';
|
|
|
class OrderManagementPage extends StatefulWidget {
|
|
|
final Widget child;
|
|
|
|
|
|
@@ -14,6 +17,7 @@ class OrderManagementPage extends StatefulWidget {
|
|
|
}
|
|
|
|
|
|
class _OrderManagementPageState extends State < OrderManagementPage > with AutomaticKeepAliveClientMixin {
|
|
|
+
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
return Container(
|
|
|
@@ -22,12 +26,6 @@ class _OrderManagementPageState extends State < OrderManagementPage > with Autom
|
|
|
title: Text('订单管理', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(36)), ),
|
|
|
centerTitle: true,
|
|
|
backgroundColor: Color.fromRGBO(64, 98, 254, 1),
|
|
|
- // actions: < Widget > [
|
|
|
- // IconButton(
|
|
|
- // icon: Icon(Icons.add_circle_outline),
|
|
|
- // onPressed: () {},
|
|
|
- // )
|
|
|
- // ],
|
|
|
),
|
|
|
body: Container(
|
|
|
decoration: BoxDecoration(
|
|
|
@@ -68,10 +66,16 @@ class _QueryWidgetState extends State < QueryWidget > {
|
|
|
double inputHeight = 0;
|
|
|
bool showStatus = true; //提示层显示状态
|
|
|
String _orderNo = "";
|
|
|
+ int orderStatus = 1; //0:代收单,1:待取件,2:运途中:已完成
|
|
|
+ int page = 1;
|
|
|
+ bool hasNextPage = true;
|
|
|
+ List<FromStatusGetOrderList> orderList=[];
|
|
|
+
|
|
|
|
|
|
@override
|
|
|
void initState() {
|
|
|
super.initState();
|
|
|
+ switchOrderFromStatus(orderStatus, page);
|
|
|
_scrollController.addListener((){
|
|
|
if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) {
|
|
|
print("滑到底部了");
|
|
|
@@ -245,14 +249,30 @@ class _QueryWidgetState extends State < QueryWidget > {
|
|
|
Expanded(
|
|
|
child: Container(
|
|
|
padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), 0),
|
|
|
- child: ListView(
|
|
|
- controller: _scrollController,
|
|
|
- children: < Widget > [
|
|
|
- _cardWiget(),
|
|
|
- _cardWiget(),
|
|
|
- _cardWiget(),
|
|
|
- ],
|
|
|
- ),
|
|
|
+ child:
|
|
|
+ // ListView(
|
|
|
+ // controller: _scrollController,
|
|
|
+ // children: < Widget > [
|
|
|
+ // _cardWiget(),
|
|
|
+ // _cardWiget(),
|
|
|
+ // _cardWiget(),
|
|
|
+ // ],
|
|
|
+ // ),
|
|
|
+ ListView.builder(
|
|
|
+ controller:_scrollController,
|
|
|
+ itemCount: orderList.length,
|
|
|
+ itemBuilder: (BuildContext context,int index){
|
|
|
+ if(index<orderList.length){
|
|
|
+ return _cardWiget(orderList[index]);
|
|
|
+ }
|
|
|
+ if (hasNextPage) {
|
|
|
+ return _getMoreWidget();
|
|
|
+ } else {
|
|
|
+ return _noMoreWidegt();
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ )
|
|
|
),
|
|
|
)
|
|
|
],
|
|
|
@@ -297,7 +317,13 @@ class _QueryWidgetState extends State < QueryWidget > {
|
|
|
],
|
|
|
);
|
|
|
}
|
|
|
- Widget _cardWiget() {
|
|
|
+ Widget _cardWiget(FromStatusGetOrderList obj) {
|
|
|
+ Map<int,String> statusMap={
|
|
|
+ 1:'待取货',
|
|
|
+ 2:'运途中',
|
|
|
+ 3:'已签收',
|
|
|
+ 4:'拒收'
|
|
|
+ };
|
|
|
return GestureDetector(
|
|
|
child: Card(
|
|
|
color: Colors.white,
|
|
|
@@ -310,8 +336,8 @@ class _QueryWidgetState extends State < QueryWidget > {
|
|
|
child: Row(
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
children: < Widget > [
|
|
|
- Text('订单号:10893477897899', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(102, 102, 102, 1)), ),
|
|
|
- Text("待取货", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(126, 211, 33, 1)), ),
|
|
|
+ Text('订单号:${obj.orderNo}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(102, 102, 102, 1)), ),
|
|
|
+ Text('${statusMap[obj.orderStatus]}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(126, 211, 33, 1)), ),
|
|
|
],
|
|
|
)
|
|
|
),
|
|
|
@@ -319,7 +345,7 @@ class _QueryWidgetState extends State < QueryWidget > {
|
|
|
padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(20)),
|
|
|
child: Row(
|
|
|
children: < Widget > [
|
|
|
- Text('朝阳门大阳汽贸 --> 香河汽修厂', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30)), ),
|
|
|
+ Text('${obj.sendCompanyName} --> ${obj.receiptCompanyName}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30)), ),
|
|
|
],
|
|
|
)
|
|
|
),
|
|
|
@@ -329,9 +355,9 @@ class _QueryWidgetState extends State < QueryWidget > {
|
|
|
children: < Widget > [
|
|
|
SizedBox(
|
|
|
width: ScreenUtil.getInstance().setWidth(355),
|
|
|
- child: Text('货物名称:汽车轮胎', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
|
|
|
+ child: Text('货物名称:${obj.goods}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
|
|
|
),
|
|
|
- Text('代收款:2800元', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
|
|
|
+ Text('代收款:${obj.goodsAgencyFund/100}元', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
@@ -341,9 +367,9 @@ class _QueryWidgetState extends State < QueryWidget > {
|
|
|
children: < Widget > [
|
|
|
SizedBox(
|
|
|
width: ScreenUtil.getInstance().setWidth(355),
|
|
|
- child: Text('货物件数:4件', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
|
|
|
+ child: Text('货物件数:${obj.goodsQuantity}件', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
|
|
|
),
|
|
|
- Text('运费:280元', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
|
|
|
+ Text('运费:${obj.goodsFreight/100}元', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
@@ -569,4 +595,52 @@ class _QueryWidgetState extends State < QueryWidget > {
|
|
|
},
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
+ switchOrderFromStatus(int orderStatus,int page){
|
|
|
+ fromStatusGetOrderList(orderStatus,page).then((resp){
|
|
|
+ print(resp);
|
|
|
+ if(isNotError(context, resp)){
|
|
|
+ FromStatusGetOrderObj tempObj = FromStatusGetOrderObj.fromJson(resp.data);
|
|
|
+ setState(() {
|
|
|
+ orderList =tempObj.data.items;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget _getMoreWidget() {
|
|
|
+ return Center(
|
|
|
+ child: Padding(
|
|
|
+ padding: EdgeInsets.all(10.0),
|
|
|
+ child: Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: < Widget > [
|
|
|
+ Text(
|
|
|
+ '加载中...',
|
|
|
+ style: TextStyle(fontSize: 16.0),
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ width: ScreenUtil.getInstance().setWidth(50),
|
|
|
+ height: ScreenUtil.getInstance().setHeight(50),
|
|
|
+ child: CircularProgressIndicator()
|
|
|
+ )
|
|
|
+
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ Widget _noMoreWidegt() {
|
|
|
+ return Center(
|
|
|
+ child: Padding(
|
|
|
+ padding: EdgeInsets.all(10.0),
|
|
|
+ child: Text(
|
|
|
+ '没有更多数据了...',
|
|
|
+ style: TextStyle(fontSize: 16.0),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|