| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825 |
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'dart:async';
- import 'order_management_page/order_detail_page.dart';
- import 'order_detail/order_detail.dart';
- import '../showDialog.dart';
- import '../util/models.dart';
- import '../util/api.dart';
- import '../util/util.dart';
- class OrderManagementPage extends StatefulWidget {
- final Widget child;
- OrderManagementPage({
- Key key,
- this.child
- }): super(key: key);
- _OrderManagementPageState createState() => _OrderManagementPageState();
- }
- class _OrderManagementPageState extends State < OrderManagementPage > with AutomaticKeepAliveClientMixin {
- @override
- Widget build(BuildContext context) {
- return Container(
- child: Scaffold(
- appBar: AppBar(
- title: Text('订单管理', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(36)), ),
- centerTitle: true,
- backgroundColor: Color.fromRGBO(64, 98, 254, 1),
- ),
- body: Container(
- decoration: BoxDecoration(
- color: Color.fromRGBO(246, 246, 254, 1)
- ),
- child: QueryWidget()
- ),
- resizeToAvoidBottomPadding: false //键盘弹出,页面不跟随向上滑动,防止出现溢出错误
- )
- );
- }
- @override
- bool get wantKeepAlive => true;
- }
- class QueryWidget extends StatefulWidget { //搜索栏
- final Widget child;
- QueryWidget({
- Key key,
- this.child
- }): super(key: key);
- _QueryWidgetState createState() => _QueryWidgetState();
- }
- class _QueryWidgetState extends State < QueryWidget > {
- //单号的输入框控制器
- TextEditingController _orderController = TextEditingController();
- ScrollController _scrollController = ScrollController();
- GlobalKey _globalKey = GlobalKey(); //搜索栏key
- List < bool > statusList = [true, false, false];
- double inputPostX = 0;
- double inputPostY = 0;
- double inputWidth = 0;
- double inputHeight = 0;
- bool showStatus = true; //提示层显示状态
- String _orderNo = "";
- int orderStatus = 1; //0:代收单,1:待取件,2:运途中:已完成
- int page = 1;
- bool hasNextPage = true;
- List < FromStatusGetOrderList > orderList = [];
- List likeOrderNoList = [];
- var timer;
- bool loadMoreStatus = true;
- @override
- void initState() {
- super.initState();
- switchOrderFromStatus(orderStatus, page);
- _scrollController.addListener(() {
- if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) {
- if (loadMoreStatus) {
- page = ++page;
- getMoreOrder(orderStatus, page);
- }
- }
- });
- }
- @override
- Widget build(BuildContext context) {
- return Stack(
- children: < Widget > [
- Container(
- child: Column(
- children: < Widget > [
- Container(
- color: Colors.white,
- height: ScreenUtil.getInstance().setHeight(222),
- padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), 0),
- child: Column(
- children: < Widget > [
- Container(
- key: _globalKey,
- height: ScreenUtil.getInstance().setHeight(100),
- decoration: BoxDecoration(
- border: Border.all(color: Color.fromRGBO(204, 204, 204, 1), width: 1),
- borderRadius: BorderRadius.all(Radius.circular(5))
- ),
- child: Row(
- children: < Widget > [
- Expanded(
- child: TextField(
- controller: _orderController,
- keyboardType: TextInputType.number,
- autocorrect: true,
- decoration: InputDecoration(
- border: InputBorder.none,
- hintText: "输入运单号后6位查询物流",
- hintStyle: TextStyle(fontSize: ScreenUtil.getInstance().setSp(26), color: Color.fromRGBO(155, 155, 155, 1)),
- contentPadding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(30), 0, ScreenUtil.getInstance().setWidth(30), 0)
- ),
- onTap: () {
- RenderObject inputObj = _globalKey.currentContext.findRenderObject();
- setState(() {
- inputWidth = inputObj.paintBounds.size.width;
- inputHeight = inputObj.paintBounds.size.height;
- inputPostX = inputObj.getTransformTo(null).getTranslation().x;
- inputPostY = ScreenUtil.getInstance().setWidth(20) + inputHeight;
- });
- },
- onChanged: ((value) {
- setState(() {
- _orderNo = value;
- });
- if (timer != null) {
- timer.cancel();
- }
- timer = Timer(Duration(milliseconds: 500), () {
- if (_orderNo.length >= 6) {
- orderNoLike(_orderNo, orderStatus).then((resp) {
- if (isNotError(context, resp)) {
- LikeOrderNo tempObj = LikeOrderNo.fromJson(resp.data);
- if (tempObj.data.length > 0) {
- setState(() {
- likeOrderNoList = tempObj.data;
- showStatus = false;
- });
- }
- }
- });
- } else {
- setState(() {
- showStatus = true;
- });
- }
- });
- }),
- onEditingComplete: () {
- FocusScope.of(context).requestFocus(FocusNode());
- setState(() {
- showStatus = true;
- });
- },
- ),
- ),
- IconButton(
- icon: Image.asset('lib/images/icon_saoyisao.png',
- width: ScreenUtil.getInstance().setWidth(38),
- height: ScreenUtil.getInstance().setHeight(36),
- ),
- onPressed: () {},
- ),
- GestureDetector(
- child: Container(
- width: ScreenUtil.getInstance().setWidth(120),
- decoration: BoxDecoration(
- border: Border(left: BorderSide.merge(BorderSide(color: Color.fromRGBO(204, 204, 204, 1), width: 1), BorderSide(color: Color.fromRGBO(204, 204, 204, 1), width: 0)), )
- ),
- child: Center(
- child: Text("查询", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(26), color: Color.fromRGBO(64, 98, 254, 1)), ),
- ),
- ),
- onTap: () {
- print("查询");
- }
- ),
- ],
- ),
- ),
- Container(
- height: ScreenUtil.getInstance().setHeight(100),
- child: Container(
- padding: EdgeInsets.only(top: ScreenUtil.getInstance().setHeight(25)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: < Widget > [
- GestureDetector(
- child: Container(
- height: ScreenUtil.getInstance().setHeight(80),
- decoration: BoxDecoration(
- border: statusList[0] ? Border(bottom: BorderSide.merge(BorderSide(color: Colors.black, width: 1), BorderSide(color: Colors.black, width: 0)), ) : Border()
- ),
- child: Center(
- child: Text("待取件", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: statusList[0] ? Colors.black : Color.fromRGBO(155, 155, 155, 1)), ),
- )
- ),
- onTap: () {
- if (statusList[0]) {
- return;
- } else {
- setState(() {
- statusList = [true, false, false];
- orderStatus = 1;
- });
- switchOrderFromStatus(orderStatus, page);
- }
- },
- ),
- GestureDetector(
- child: Container(
- height: ScreenUtil.getInstance().setHeight(80),
- decoration: BoxDecoration(
- border: statusList[1] ? Border(bottom: BorderSide.merge(BorderSide(color: Colors.black, width: 1), BorderSide(color: Colors.black, width: 0)), ) : Border()
- ),
- child: Center(
- child: Text("运途中", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: statusList[1] ? Colors.black : Color.fromRGBO(155, 155, 155, 1)), ),
- )
- ),
- onTap: () {
- if (statusList[1]) {
- return;
- } else {
- setState(() {
- statusList = [false, true, false];
- orderStatus = 2;
- });
- switchOrderFromStatus(orderStatus, page);
- }
- },
- ),
- GestureDetector(
- child: Container(
- height: ScreenUtil.getInstance().setHeight(80),
- decoration: BoxDecoration(
- border: statusList[2] ? Border(bottom: BorderSide.merge(BorderSide(color: Colors.black, width: 1), BorderSide(color: Colors.black, width: 0)), ) : Border()
- ),
- child: Center(
- child: Text("已完成", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: statusList[2] ? Colors.black : Color.fromRGBO(155, 155, 155, 1)), ),
- )
- ),
- onTap: () {
- if (statusList[2]) {
- return;
- } else {
- setState(() {
- statusList = [false, false, true];
- orderStatus = 3;
- });
- switchOrderFromStatus(orderStatus, page);
- }
- },
- ),
- ],
- )
- )
- ),
- ],
- )
- ),
- Expanded(
- child: Container(
- padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), 0),
- child: orderList == null ? Center(
- child: _getMoreWidget()
- ) : orderList.length == 0 ?
- Center(
- child: Text('暂无订单'),
- ) :
- RefreshIndicator(
- onRefresh: refreshOrder,
- child: ListView.builder(
- physics: AlwaysScrollableScrollPhysics(),
- controller: _scrollController,
- itemCount: orderList.length + 1,
- itemBuilder: (BuildContext context, int index) {
- if (index < orderList.length) {
- return _cardWiget(orderList[index], index);
- }
- if (hasNextPage) {
- return _getMoreWidget();
- } else {
- return _noMoreWidegt();
- }
- },
- )
- )
- ),
- )
- ],
- )
- ),
- Positioned(
- left: inputPostX,
- top: inputPostY,
- child: Offstage(
- offstage: showStatus,
- child:
- Container(
- width: inputWidth,
- height: ScreenUtil.getInstance().setHeight(320),
- margin: EdgeInsets.only(top: ScreenUtil.getInstance().setHeight(1)),
- decoration: BoxDecoration(
- color: Color.fromRGBO(244, 248, 251, 1),
- border: Border.all(color: Color.fromRGBO(204, 204, 204, 1), width: 1),
- borderRadius: BorderRadius.all(Radius.circular(5))
- ),
- child: ListView.builder(
- itemCount: likeOrderNoList.length,
- itemBuilder: (BuildContext context, int index) {
- return InkWell(
- child: Padding(
- padding: EdgeInsets.all(10),
- child: Text(likeOrderNoList[index]),
- ),
- onTap: () {
- setState(() {
- page = 1;
- _orderNo = likeOrderNoList[index];
- });
- fromStatusGetOrderList(orderStatus, page, likeOrderNoList[index]).then((resp) {
- if (isNotError(context, resp)) {
- FromStatusGetOrderObj tempObj = FromStatusGetOrderObj.fromJson(resp.data);
- setState(() {
- orderList = tempObj.data.items;
- hasNextPage = tempObj.data.hasNextPage;
- });
- }
- });
- setState(() {
- _orderController.text = likeOrderNoList[index];
- showStatus = true;
- FocusScope.of(context).requestFocus(FocusNode());
- });
- },
- );
- },
- ),
- ),
- )
- )
- ],
- );
- }
- Widget _cardWiget(FromStatusGetOrderList obj, int index) {
- Map < int, String > statusMap = {
- 1: '待取货',
- 2: '运途中',
- 3: '已签收',
- 4: '已拒收',
- 5: '已作废'
- };
- return InkWell(
- child: Card(
- color: Colors.white,
- child: Container(
- padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(20)),
- child: Column(
- children: < Widget > [
- Padding(
- padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(30)),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: < Widget > [
- 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)), ),
- ],
- )
- ),
- Padding(
- padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(20)),
- child: Row(
- children: < Widget > [
- Text('${obj.sendCompanyName} --> ${obj.receiptCompanyName}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30)), ),
- ],
- )
- ),
- Padding(
- padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(15)),
- child: Row(
- children: < Widget > [
- SizedBox(
- width: ScreenUtil.getInstance().setWidth(355),
- child: Text('货物名称:${obj.goods}', 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)), ),
- ],
- ),
- ),
- Padding(
- padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(30)),
- child: Row(
- children: < Widget > [
- SizedBox(
- width: ScreenUtil.getInstance().setWidth(355),
- child: Text('货物件数:${obj.goodsQuantity}件', 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)), ),
- ],
- ),
- ),
- Padding(
- padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(20)),
- child: Container(
- height: ScreenUtil.getInstance().setHeight(1),
- color: Color.fromRGBO(223, 223, 223, 1),
- ),
- ),
- orderStatus == 1 ? _status1Fun(obj, index) : orderStatus == 2 ? _status2Fun(obj, index) : _status3Fun(obj, index)
- ],
- ),
- )
- ),
- onTap: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (BuildContext context) {
- return OrderDetailsPage(orderNo: obj.orderNo);
- })
- );
- },
- );
- }
- Widget _status1Fun(FromStatusGetOrderList obj, int index) {
- return Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: < Widget > [
- InkWell(
- child: Container(
- width: ScreenUtil.getInstance().setWidth(94),
- height: ScreenUtil.getInstance().setHeight(48),
- decoration: BoxDecoration(
- color: Color.fromRGBO(239, 243, 249, 1),
- borderRadius: BorderRadius.all(Radius.circular(4.0))
- ),
- child: Center(
- child: Text('作废', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
- ),
- ),
- onTap: () {
- showDialog < Null > (
- context: context, //BuildContext对象
- barrierDismissible: false,
- builder: (BuildContext context) {
- return new LoadingDialog( //调用对话框
- text: '是否确认作废', childCallback: (val) {
- if (val) {
- myUpdataOrder(obj.orderNo, 5, index);
- } else {
- return;
- }
- },
- );
- });
- print("作废");
- },
- ),
- InkWell(
- child: Container(
- width: ScreenUtil.getInstance().setWidth(94),
- height: ScreenUtil.getInstance().setHeight(48),
- decoration: BoxDecoration(
- color: Color.fromRGBO(239, 243, 249, 1),
- borderRadius: BorderRadius.all(Radius.circular(4.0))
- ),
- child: Center(
- child: Text('寄件', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
- ),
- ),
- onTap: () {
- showDialog < Null > (
- context: context, //BuildContext对象
- barrierDismissible: false,
- builder: (BuildContext context) {
- return new LoadingDialog( //调用对话框
- text: '是否确认寄件', childCallback: (val) {
- if (val) {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (BuildContext context) {
- return OrderDetailPage(orderNo: obj.orderNo);
- })
- ).then((resp) {
- if (resp == true) {
- deleteOrder(index);
- }
- });
- } else {
- return;
- }
- },
- );
- });
- print("寄件");
- },
- ),
- ],
- );
- }
- Widget _status2Fun(FromStatusGetOrderList obj, int index) {
- return Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: < Widget > [
- InkWell(
- child: Container(
- width: ScreenUtil.getInstance().setWidth(94),
- height: ScreenUtil.getInstance().setHeight(48),
- decoration: BoxDecoration(
- color: Color.fromRGBO(239, 243, 249, 1),
- borderRadius: BorderRadius.all(Radius.circular(4.0))
- ),
- child: Center(
- child: Text('作废', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
- ),
- ),
- onTap: () {
- showDialog < Null > (
- context: context, //BuildContext对象
- barrierDismissible: false,
- builder: (BuildContext context) {
- return new LoadingDialog( //调用对话框
- text: '是否确认作废', childCallback: (val) {
- if (val) {
- myUpdataOrder(obj.orderNo, 5, index);
- } else {
- return;
- }
- },
- );
- });
- print("作废");
- },
- ),
- InkWell(
- child: Container(
- width: ScreenUtil.getInstance().setWidth(94),
- height: ScreenUtil.getInstance().setHeight(48),
- decoration: BoxDecoration(
- color: Color.fromRGBO(239, 243, 249, 1),
- borderRadius: BorderRadius.all(Radius.circular(4.0))
- ),
- child: Center(
- child: Text('拒收', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
- ),
- ),
- onTap: () {
- showDialog < Null > (
- context: context, //BuildContext对象
- barrierDismissible: false,
- builder: (BuildContext context) {
- return new LoadingDialog( //调用对话框
- text: '是否确认拒收', childCallback: (val) {
- if (val) {
- myUpdataOrder(obj.orderNo, 4, index);
- } else {
- return;
- }
- },
- );
- });
- print("拒收");
- },
- ),
- InkWell(
- child: Container(
- width: ScreenUtil.getInstance().setWidth(94),
- height: ScreenUtil.getInstance().setHeight(48),
- decoration: BoxDecoration(
- color: Color.fromRGBO(239, 243, 249, 1),
- borderRadius: BorderRadius.all(Radius.circular(4.0))
- ),
- child: Center(
- child: Text('签收', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
- ),
- ),
- onTap: () {
- showDialog < Null > (
- context: context, //BuildContext对象
- barrierDismissible: false,
- builder: (BuildContext context) {
- return new LoadingDialog( //调用对话框
- text: '是否确认签收', childCallback: (val) {
- if (val) {
- myUpdataOrder(obj.orderNo, 3, index);
- } else {
- return;
- }
- },
- );
- });
- print("签收");
- },
- ),
- InkWell(
- child: Container(
- width: ScreenUtil.getInstance().setWidth(94),
- height: ScreenUtil.getInstance().setHeight(48),
- decoration: BoxDecoration(
- color: Color.fromRGBO(239, 243, 249, 1),
- borderRadius: BorderRadius.all(Radius.circular(4.0))
- ),
- child: Center(
- child: Text('改单', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
- ),
- ),
- onTap: () {
- showDialog < Null > (
- context: context, //BuildContext对象
- barrierDismissible: false,
- builder: (BuildContext context) {
- return new LoadingDialog( //调用对话框
- text: '是否确认改单', childCallback: (val) {
- if (val) {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (BuildContext context) {
- return OrderDetailPage(orderNo: obj.orderNo);
- })
- ).then((resp) {
- if (resp == true) {
- switchOrderFromStatus(orderStatus, page);
- }
- });
- } else {
- return;
- }
- },
- );
- });
- print("改单");
- },
- ),
- InkWell(
- child: Container(
- width: ScreenUtil.getInstance().setWidth(94),
- height: ScreenUtil.getInstance().setHeight(48),
- decoration: BoxDecoration(
- color: Color.fromRGBO(239, 243, 249, 1),
- borderRadius: BorderRadius.all(Radius.circular(4.0))
- ),
- child: Center(
- child: Text('打印', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
- ),
- ),
- onTap: () {
- showDialog < Null > (
- context: context, //BuildContext对象
- barrierDismissible: false,
- builder: (BuildContext context) {
- return new LoadingDialog( //调用对话框
- text: '是否确认打印', childCallback: (val) {
- if (val) {
- //widget.callback(widget.index);
- } else {
- return;
- }
- },
- );
- });
- print("打印");
- },
- ),
- ],
- );
- }
- Widget _status3Fun(FromStatusGetOrderList obj, int index) {
- return Row(
- mainAxisAlignment: MainAxisAlignment.end,
- children: < Widget > [
- InkWell(
- child: Container(
- width: ScreenUtil.getInstance().setWidth(94),
- height: ScreenUtil.getInstance().setHeight(48),
- decoration: BoxDecoration(
- color: Color.fromRGBO(239, 243, 249, 1),
- borderRadius: BorderRadius.all(Radius.circular(4.0))
- ),
- child: Center(
- child: Text('打印', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
- ),
- ),
- onTap: () {
- showDialog < Null > (
- context: context, //BuildContext对象
- barrierDismissible: false,
- builder: (BuildContext context) {
- return new LoadingDialog( //调用对话框
- text: '是否确认打印', childCallback: (val) {
- if (val) {
- //widget.callback(widget.index);
- } else {
- return;
- }
- },
- );
- });
- print("打印");
- },
- ),
- ],
- );
- }
- 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),
- ),
- ),
- );
- }
- switchOrderFromStatus(int orderStatus, int page) {
- setState(() {
- orderList = null;
- });
- page = 1;
- fromStatusGetOrderList(orderStatus, page, _orderNo).then((resp) {
- if (isNotError(context, resp)) {
- FromStatusGetOrderObj tempObj = FromStatusGetOrderObj.fromJson(resp.data);
- setState(() {
- orderList = tempObj.data.items;
- hasNextPage = tempObj.data.hasNextPage;
- });
- }
- });
- }
- getMoreOrder(int orderStatus, int page) {
- if (!hasNextPage) {
- return;
- }
- loadMoreStatus = false;
- fromStatusGetOrderList(orderStatus, page, _orderNo).then((resp) {
- if (isNotError(context, resp)) {
- FromStatusGetOrderObj tempObj = FromStatusGetOrderObj.fromJson(resp.data);
- setState(() {
- orderList.addAll(tempObj.data.items);
- hasNextPage = tempObj.data.hasNextPage;
- });
- loadMoreStatus = true;
- } else {
- loadMoreStatus = true;
- }
- });
- }
- deleteOrder(int index) {
- setState(() {
- orderList.removeAt(index);
- });
- if (orderList.length < 4) {
- if (hasNextPage) {
- setState(() {
- page = ++page;
- });
- getMoreOrder(orderStatus, page);
- }
- }
- }
- myUpdataOrder(String myOrderNo, int myOrderStatus, int index) {
- updataOrderStatus(myOrderNo, myOrderStatus).then((resp) {
- if (isNotError(context, resp)) {
- deleteOrder(index);
- }
- });
- }
- Future refreshOrder() async {
- page = 1;
- await fromStatusGetOrderList(orderStatus, page, _orderNo).then((resp) {
- if (isNotError(context, resp)) {
- FromStatusGetOrderObj tempObj = FromStatusGetOrderObj.fromJson(resp.data);
- setState(() {
- orderList = tempObj.data.items;
- hasNextPage = tempObj.data.hasNextPage;
- });
- }
- });
- }
- }
|