order_management_page.dart 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. import 'dart:async';
  4. import 'order_management_page/order_detail_page.dart';
  5. import '../showDialog.dart';
  6. import '../util/models.dart';
  7. import '../util/api.dart';
  8. import '../util/util.dart';
  9. class OrderManagementPage extends StatefulWidget {
  10. final Widget child;
  11. OrderManagementPage({
  12. Key key,
  13. this.child
  14. }): super(key: key);
  15. _OrderManagementPageState createState() => _OrderManagementPageState();
  16. }
  17. class _OrderManagementPageState extends State < OrderManagementPage > with AutomaticKeepAliveClientMixin {
  18. @override
  19. Widget build(BuildContext context) {
  20. return Container(
  21. child: Scaffold(
  22. appBar: AppBar(
  23. title: Text('订单管理', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(36)), ),
  24. centerTitle: true,
  25. backgroundColor: Color.fromRGBO(64, 98, 254, 1),
  26. ),
  27. body: Container(
  28. decoration: BoxDecoration(
  29. color: Color.fromRGBO(246, 246, 254, 1)
  30. ),
  31. child: QueryWidget()
  32. ),
  33. resizeToAvoidBottomPadding: false //键盘弹出,页面不跟随向上滑动,防止出现溢出错误
  34. )
  35. );
  36. }
  37. @override
  38. bool get wantKeepAlive => true;
  39. }
  40. class QueryWidget extends StatefulWidget { //搜索栏
  41. final Widget child;
  42. QueryWidget({
  43. Key key,
  44. this.child
  45. }): super(key: key);
  46. _QueryWidgetState createState() => _QueryWidgetState();
  47. }
  48. class _QueryWidgetState extends State < QueryWidget > {
  49. //单号的输入框控制器
  50. TextEditingController _orderController = TextEditingController();
  51. ScrollController _scrollController = ScrollController();
  52. GlobalKey _globalKey = GlobalKey(); //搜索栏key
  53. List < bool > statusList = [true, false, false];
  54. double inputPostX = 0;
  55. double inputPostY = 0;
  56. double inputWidth = 0;
  57. double inputHeight = 0;
  58. bool showStatus = true; //提示层显示状态
  59. String _orderNo = "";
  60. int orderStatus = 1; //0:代收单,1:待取件,2:运途中:已完成
  61. int page = 1;
  62. bool hasNextPage = true;
  63. List < FromStatusGetOrderList > orderList = [];
  64. List likeOrderNoList = [];
  65. var timer;
  66. @override
  67. void initState() {
  68. super.initState();
  69. switchOrderFromStatus(orderStatus, page);
  70. _scrollController.addListener(() {
  71. if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) {
  72. print("滑到底部了");
  73. }
  74. });
  75. }
  76. @override
  77. Widget build(BuildContext context) {
  78. return Stack(
  79. children: < Widget > [
  80. Container(
  81. child: Column(
  82. children: < Widget > [
  83. Container(
  84. color: Colors.white,
  85. height: ScreenUtil.getInstance().setHeight(222),
  86. padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), 0),
  87. child: Column(
  88. children: < Widget > [
  89. Container(
  90. key: _globalKey,
  91. height: ScreenUtil.getInstance().setHeight(100),
  92. decoration: BoxDecoration(
  93. border: Border.all(color: Color.fromRGBO(204, 204, 204, 1), width: 1),
  94. borderRadius: BorderRadius.all(Radius.circular(5))
  95. ),
  96. child: Row(
  97. children: < Widget > [
  98. Expanded(
  99. child: TextField(
  100. controller: _orderController,
  101. keyboardType: TextInputType.number,
  102. autocorrect: true,
  103. decoration: InputDecoration(
  104. border: InputBorder.none,
  105. hintText: "输入运单号后6位查询物流",
  106. hintStyle: TextStyle(fontSize: ScreenUtil.getInstance().setSp(26), color: Color.fromRGBO(155, 155, 155, 1)),
  107. contentPadding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(30), 0, ScreenUtil.getInstance().setWidth(30), 0)
  108. ),
  109. onTap: () {
  110. RenderObject inputObj = _globalKey.currentContext.findRenderObject();
  111. setState(() {
  112. inputWidth = inputObj.paintBounds.size.width;
  113. inputHeight = inputObj.paintBounds.size.height;
  114. inputPostX = inputObj.getTransformTo(null).getTranslation().x;
  115. inputPostY = ScreenUtil.getInstance().setWidth(20) + inputHeight;
  116. });
  117. },
  118. onChanged: ((value) {
  119. setState(() {
  120. _orderNo = value;
  121. });
  122. if (_orderNo.length >= 6) {
  123. if(timer!=null){
  124. timer.cancel();
  125. }
  126. timer = Timer(Duration(milliseconds: 500),(){
  127. orderNoLike(_orderNo).then((resp){
  128. if(isNotError(context, resp)){
  129. LikeOrderNo tempObj = LikeOrderNo.fromJson(resp.data);
  130. if(tempObj.data.length>0){
  131. setState(() {
  132. likeOrderNoList =tempObj.data;
  133. showStatus = false;
  134. });
  135. }
  136. }
  137. });
  138. });
  139. } else {
  140. setState(() {
  141. showStatus = true;
  142. });
  143. }
  144. }),
  145. onEditingComplete: () {
  146. FocusScope.of(context).requestFocus(FocusNode());
  147. setState(() {
  148. showStatus = true;
  149. });
  150. },
  151. ),
  152. ),
  153. IconButton(
  154. icon: Image.asset('lib/images/icon_saoyisao.png',
  155. width: ScreenUtil.getInstance().setWidth(38),
  156. height: ScreenUtil.getInstance().setHeight(36),
  157. ),
  158. onPressed: () {},
  159. ),
  160. GestureDetector(
  161. child: Container(
  162. width: ScreenUtil.getInstance().setWidth(120),
  163. decoration: BoxDecoration(
  164. 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)), )
  165. ),
  166. child: Center(
  167. child: Text("查询", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(26), color: Color.fromRGBO(64, 98, 254, 1)), ),
  168. ),
  169. ),
  170. onTap: () {
  171. print("查询");
  172. }
  173. ),
  174. ],
  175. ),
  176. ),
  177. Container(
  178. height: ScreenUtil.getInstance().setHeight(100),
  179. child: Container(
  180. padding: EdgeInsets.only(top: ScreenUtil.getInstance().setHeight(25)),
  181. child: Row(
  182. mainAxisAlignment: MainAxisAlignment.spaceAround,
  183. children: < Widget > [
  184. GestureDetector(
  185. child: Container(
  186. height: ScreenUtil.getInstance().setHeight(80),
  187. decoration: BoxDecoration(
  188. border: statusList[0] ? Border(bottom: BorderSide.merge(BorderSide(color: Colors.black, width: 1), BorderSide(color: Colors.black, width: 0)), ) : Border()
  189. ),
  190. child: Center(
  191. child: Text("待取件", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: statusList[0] ? Colors.black : Color.fromRGBO(155, 155, 155, 1)), ),
  192. )
  193. ),
  194. onTap: () {
  195. if (statusList[0]) {
  196. return;
  197. } else {
  198. setState(() {
  199. statusList = [true, false, false];
  200. orderStatus = 1;
  201. });
  202. switchOrderFromStatus(orderStatus, page);
  203. }
  204. },
  205. ),
  206. GestureDetector(
  207. child: Container(
  208. height: ScreenUtil.getInstance().setHeight(80),
  209. decoration: BoxDecoration(
  210. border: statusList[1] ? Border(bottom: BorderSide.merge(BorderSide(color: Colors.black, width: 1), BorderSide(color: Colors.black, width: 0)), ) : Border()
  211. ),
  212. child: Center(
  213. child: Text("运途中", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: statusList[1] ? Colors.black : Color.fromRGBO(155, 155, 155, 1)), ),
  214. )
  215. ),
  216. onTap: () {
  217. if (statusList[1]) {
  218. return;
  219. } else {
  220. setState(() {
  221. statusList = [false, true, false];
  222. orderStatus = 2;
  223. });
  224. switchOrderFromStatus(orderStatus, page);
  225. }
  226. },
  227. ),
  228. GestureDetector(
  229. child: Container(
  230. height: ScreenUtil.getInstance().setHeight(80),
  231. decoration: BoxDecoration(
  232. border: statusList[2] ? Border(bottom: BorderSide.merge(BorderSide(color: Colors.black, width: 1), BorderSide(color: Colors.black, width: 0)), ) : Border()
  233. ),
  234. child: Center(
  235. child: Text("已完成", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: statusList[2] ? Colors.black : Color.fromRGBO(155, 155, 155, 1)), ),
  236. )
  237. ),
  238. onTap: () {
  239. if (statusList[2]) {
  240. return;
  241. } else {
  242. setState(() {
  243. statusList = [false, false, true];
  244. orderStatus = 3;
  245. });
  246. switchOrderFromStatus(orderStatus, page);
  247. }
  248. },
  249. ),
  250. ],
  251. )
  252. )
  253. ),
  254. ],
  255. )
  256. ),
  257. Expanded(
  258. child: Container(
  259. padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), ScreenUtil.getInstance().setWidth(20), 0),
  260. child: orderList == null ? Center(
  261. child: _getMoreWidget()
  262. ) : orderList.length == 0 ? Center(
  263. child: Text('暂无订单'),
  264. ) :
  265. ListView.builder(
  266. controller: _scrollController,
  267. itemCount: orderList.length + 1,
  268. itemBuilder: (BuildContext context, int index) {
  269. if (index < orderList.length) {
  270. return _cardWiget(orderList[index], index);
  271. }
  272. if (hasNextPage) {
  273. return _getMoreWidget();
  274. } else {
  275. return _noMoreWidegt();
  276. }
  277. },
  278. )
  279. ),
  280. )
  281. ],
  282. )
  283. ),
  284. Positioned(
  285. left: inputPostX,
  286. top: inputPostY,
  287. child: Offstage(
  288. offstage: showStatus,
  289. child:
  290. Container(
  291. width: inputWidth,
  292. height: ScreenUtil.getInstance().setHeight(320),
  293. margin: EdgeInsets.only(top: ScreenUtil.getInstance().setHeight(1)),
  294. decoration: BoxDecoration(
  295. color: Color.fromRGBO(244, 248, 251, 1),
  296. border: Border.all(color: Color.fromRGBO(204, 204, 204, 1), width: 1),
  297. borderRadius: BorderRadius.all(Radius.circular(5))
  298. ),
  299. child: ListView.builder(
  300. itemCount: likeOrderNoList.length,
  301. itemBuilder: (BuildContext context, int index) {
  302. return InkWell(
  303. child: Padding(
  304. padding: EdgeInsets.all(10),
  305. child: Text(likeOrderNoList[index]),
  306. ),
  307. onTap: () {
  308. setState(() {
  309. page=1;
  310. });
  311. fromStatusGetOrderList(orderStatus, page,_orderNo).then((resp) {
  312. if (isNotError(context, resp)) {
  313. FromStatusGetOrderObj tempObj = FromStatusGetOrderObj.fromJson(resp.data);
  314. setState(() {
  315. orderList = tempObj.data.items;
  316. hasNextPage = tempObj.data.hasNextPage;
  317. });
  318. }
  319. });
  320. setState(() {
  321. _orderController.text = likeOrderNoList[index];
  322. showStatus = true;
  323. FocusScope.of(context).requestFocus(FocusNode());
  324. });
  325. },
  326. );
  327. },
  328. ),
  329. ),
  330. )
  331. )
  332. ],
  333. );
  334. }
  335. Widget _cardWiget(FromStatusGetOrderList obj, int index) {
  336. Map < int, String > statusMap = {
  337. 1: '待取货',
  338. 2: '运途中',
  339. 3: '已签收',
  340. 4: '已拒收',
  341. 5: '已作废'
  342. };
  343. return Card(
  344. color: Colors.white,
  345. child: Container(
  346. padding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(20)),
  347. child: Column(
  348. children: < Widget > [
  349. Padding(
  350. padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(30)),
  351. child: Row(
  352. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  353. children: < Widget > [
  354. Text('订单号:${obj.orderNo}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(102, 102, 102, 1)), ),
  355. Text('${statusMap[obj.orderStatus]}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(126, 211, 33, 1)), ),
  356. ],
  357. )
  358. ),
  359. Padding(
  360. padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(20)),
  361. child: Row(
  362. children: < Widget > [
  363. Text('${obj.sendCompanyName} --> ${obj.receiptCompanyName}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30)), ),
  364. ],
  365. )
  366. ),
  367. Padding(
  368. padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(15)),
  369. child: Row(
  370. children: < Widget > [
  371. SizedBox(
  372. width: ScreenUtil.getInstance().setWidth(355),
  373. child: Text('货物名称:${obj.goods}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
  374. ),
  375. Text('代收款:${obj.goodsAgencyFund/100}元', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
  376. ],
  377. ),
  378. ),
  379. Padding(
  380. padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(30)),
  381. child: Row(
  382. children: < Widget > [
  383. SizedBox(
  384. width: ScreenUtil.getInstance().setWidth(355),
  385. child: Text('货物件数:${obj.goodsQuantity}件', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
  386. ),
  387. Text('运费:${obj.goodsFreight/100}元', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(155, 155, 155, 1)), ),
  388. ],
  389. ),
  390. ),
  391. Padding(
  392. padding: EdgeInsets.only(bottom: ScreenUtil.getInstance().setHeight(20)),
  393. child: Container(
  394. height: ScreenUtil.getInstance().setHeight(1),
  395. color: Color.fromRGBO(223, 223, 223, 1),
  396. ),
  397. ),
  398. orderStatus == 1 ? _status1Fun(obj, index) : orderStatus == 2 ? _status2Fun(obj, index) : _status3Fun(obj, index)
  399. ],
  400. ),
  401. )
  402. );
  403. }
  404. Widget _status1Fun(FromStatusGetOrderList obj, int index) {
  405. return Row(
  406. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  407. children: < Widget > [
  408. InkWell(
  409. child: Container(
  410. width: ScreenUtil.getInstance().setWidth(94),
  411. height: ScreenUtil.getInstance().setHeight(48),
  412. decoration: BoxDecoration(
  413. color: Color.fromRGBO(239, 243, 249, 1),
  414. borderRadius: BorderRadius.all(Radius.circular(4.0))
  415. ),
  416. child: Center(
  417. child: Text('作废', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
  418. ),
  419. ),
  420. onTap: () {
  421. showDialog < Null > (
  422. context: context, //BuildContext对象
  423. barrierDismissible: false,
  424. builder: (BuildContext context) {
  425. return new LoadingDialog( //调用对话框
  426. text: '是否确认作废', childCallback: (val) {
  427. if (val) {
  428. myUpdataOrder(obj.orderNo,5,index);
  429. } else {
  430. return;
  431. }
  432. },
  433. );
  434. });
  435. print("作废");
  436. },
  437. ),
  438. InkWell(
  439. child: Container(
  440. width: ScreenUtil.getInstance().setWidth(94),
  441. height: ScreenUtil.getInstance().setHeight(48),
  442. decoration: BoxDecoration(
  443. color: Color.fromRGBO(239, 243, 249, 1),
  444. borderRadius: BorderRadius.all(Radius.circular(4.0))
  445. ),
  446. child: Center(
  447. child: Text('寄件', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
  448. ),
  449. ),
  450. onTap: () {
  451. showDialog < Null > (
  452. context: context, //BuildContext对象
  453. barrierDismissible: false,
  454. builder: (BuildContext context) {
  455. return new LoadingDialog( //调用对话框
  456. text: '是否确认寄件', childCallback: (val) {
  457. if (val) {
  458. Navigator.push(
  459. context,
  460. MaterialPageRoute(
  461. builder: (BuildContext context) {
  462. return OrderDetailPage(orderNo: obj.orderNo);
  463. })
  464. ).then((resp) {
  465. if (resp == true) {
  466. deleteOrder(index);
  467. }
  468. });
  469. } else {
  470. return;
  471. }
  472. },
  473. );
  474. });
  475. print("寄件");
  476. },
  477. ),
  478. ],
  479. );
  480. }
  481. Widget _status2Fun(FromStatusGetOrderList obj, int index) {
  482. return Row(
  483. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  484. children: < Widget > [
  485. InkWell(
  486. child: Container(
  487. width: ScreenUtil.getInstance().setWidth(94),
  488. height: ScreenUtil.getInstance().setHeight(48),
  489. decoration: BoxDecoration(
  490. color: Color.fromRGBO(239, 243, 249, 1),
  491. borderRadius: BorderRadius.all(Radius.circular(4.0))
  492. ),
  493. child: Center(
  494. child: Text('作废', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
  495. ),
  496. ),
  497. onTap: () {
  498. showDialog < Null > (
  499. context: context, //BuildContext对象
  500. barrierDismissible: false,
  501. builder: (BuildContext context) {
  502. return new LoadingDialog( //调用对话框
  503. text: '是否确认作废', childCallback: (val) {
  504. if (val) {
  505. myUpdataOrder(obj.orderNo,5,index);
  506. } else {
  507. return;
  508. }
  509. },
  510. );
  511. });
  512. print("作废");
  513. },
  514. ),
  515. InkWell(
  516. child: Container(
  517. width: ScreenUtil.getInstance().setWidth(94),
  518. height: ScreenUtil.getInstance().setHeight(48),
  519. decoration: BoxDecoration(
  520. color: Color.fromRGBO(239, 243, 249, 1),
  521. borderRadius: BorderRadius.all(Radius.circular(4.0))
  522. ),
  523. child: Center(
  524. child: Text('拒收', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
  525. ),
  526. ),
  527. onTap: () {
  528. showDialog < Null > (
  529. context: context, //BuildContext对象
  530. barrierDismissible: false,
  531. builder: (BuildContext context) {
  532. return new LoadingDialog( //调用对话框
  533. text: '是否确认拒收', childCallback: (val) {
  534. if (val) {
  535. myUpdataOrder(obj.orderNo,4,index);
  536. } else {
  537. return;
  538. }
  539. },
  540. );
  541. });
  542. print("拒收");
  543. },
  544. ),
  545. InkWell(
  546. child: Container(
  547. width: ScreenUtil.getInstance().setWidth(94),
  548. height: ScreenUtil.getInstance().setHeight(48),
  549. decoration: BoxDecoration(
  550. color: Color.fromRGBO(239, 243, 249, 1),
  551. borderRadius: BorderRadius.all(Radius.circular(4.0))
  552. ),
  553. child: Center(
  554. child: Text('签收', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
  555. ),
  556. ),
  557. onTap: () {
  558. showDialog < Null > (
  559. context: context, //BuildContext对象
  560. barrierDismissible: false,
  561. builder: (BuildContext context) {
  562. return new LoadingDialog( //调用对话框
  563. text: '是否确认签收', childCallback: (val) {
  564. if (val) {
  565. myUpdataOrder(obj.orderNo,3,index);
  566. } else {
  567. return;
  568. }
  569. },
  570. );
  571. });
  572. print("签收");
  573. },
  574. ),
  575. InkWell(
  576. child: Container(
  577. width: ScreenUtil.getInstance().setWidth(94),
  578. height: ScreenUtil.getInstance().setHeight(48),
  579. decoration: BoxDecoration(
  580. color: Color.fromRGBO(239, 243, 249, 1),
  581. borderRadius: BorderRadius.all(Radius.circular(4.0))
  582. ),
  583. child: Center(
  584. child: Text('改单', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
  585. ),
  586. ),
  587. onTap: () {
  588. showDialog < Null > (
  589. context: context, //BuildContext对象
  590. barrierDismissible: false,
  591. builder: (BuildContext context) {
  592. return new LoadingDialog( //调用对话框
  593. text: '是否确认改单', childCallback: (val) {
  594. if (val) {
  595. Navigator.push(
  596. context,
  597. MaterialPageRoute(
  598. builder: (BuildContext context) {
  599. return OrderDetailPage(orderNo: obj.orderNo);
  600. })
  601. );
  602. } else {
  603. return;
  604. }
  605. },
  606. );
  607. });
  608. print("改单");
  609. },
  610. ),
  611. InkWell(
  612. child: Container(
  613. width: ScreenUtil.getInstance().setWidth(94),
  614. height: ScreenUtil.getInstance().setHeight(48),
  615. decoration: BoxDecoration(
  616. color: Color.fromRGBO(239, 243, 249, 1),
  617. borderRadius: BorderRadius.all(Radius.circular(4.0))
  618. ),
  619. child: Center(
  620. child: Text('打印', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
  621. ),
  622. ),
  623. onTap: () {
  624. showDialog < Null > (
  625. context: context, //BuildContext对象
  626. barrierDismissible: false,
  627. builder: (BuildContext context) {
  628. return new LoadingDialog( //调用对话框
  629. text: '是否确认打印', childCallback: (val) {
  630. if (val) {
  631. //widget.callback(widget.index);
  632. } else {
  633. return;
  634. }
  635. },
  636. );
  637. });
  638. print("打印");
  639. },
  640. ),
  641. ],
  642. );
  643. }
  644. Widget _status3Fun(FromStatusGetOrderList obj, int index) {
  645. return Row(
  646. mainAxisAlignment: MainAxisAlignment.end,
  647. children: < Widget > [
  648. InkWell(
  649. child: Container(
  650. width: ScreenUtil.getInstance().setWidth(94),
  651. height: ScreenUtil.getInstance().setHeight(48),
  652. decoration: BoxDecoration(
  653. color: Color.fromRGBO(239, 243, 249, 1),
  654. borderRadius: BorderRadius.all(Radius.circular(4.0))
  655. ),
  656. child: Center(
  657. child: Text('打印', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(24), color: Color.fromRGBO(64, 98, 254, 1))),
  658. ),
  659. ),
  660. onTap: () {
  661. showDialog < Null > (
  662. context: context, //BuildContext对象
  663. barrierDismissible: false,
  664. builder: (BuildContext context) {
  665. return new LoadingDialog( //调用对话框
  666. text: '是否确认打印', childCallback: (val) {
  667. if (val) {
  668. //widget.callback(widget.index);
  669. } else {
  670. return;
  671. }
  672. },
  673. );
  674. });
  675. print("打印");
  676. },
  677. ),
  678. ],
  679. );
  680. }
  681. Widget _getMoreWidget() {
  682. return Center(
  683. child: Padding(
  684. padding: EdgeInsets.all(10.0),
  685. child: Row(
  686. mainAxisAlignment: MainAxisAlignment.center,
  687. crossAxisAlignment: CrossAxisAlignment.center,
  688. children: < Widget > [
  689. Text(
  690. '加载中...',
  691. style: TextStyle(fontSize: 16.0),
  692. ),
  693. Container(
  694. width: ScreenUtil.getInstance().setWidth(50),
  695. height: ScreenUtil.getInstance().setHeight(50),
  696. child: CircularProgressIndicator()
  697. )
  698. ],
  699. ),
  700. ),
  701. );
  702. }
  703. Widget _noMoreWidegt() {
  704. return Center(
  705. child: Padding(
  706. padding: EdgeInsets.all(10.0),
  707. child: Text(
  708. '没有更多数据了...',
  709. style: TextStyle(fontSize: 16.0),
  710. ),
  711. ),
  712. );
  713. }
  714. switchOrderFromStatus(int orderStatus, int page) {
  715. setState(() {
  716. orderList = null;
  717. });
  718. fromStatusGetOrderList(orderStatus, page).then((resp) {
  719. if (isNotError(context, resp)) {
  720. FromStatusGetOrderObj tempObj = FromStatusGetOrderObj.fromJson(resp.data);
  721. setState(() {
  722. orderList = tempObj.data.items;
  723. hasNextPage = tempObj.data.hasNextPage;
  724. });
  725. }
  726. });
  727. }
  728. getMoreOrder(int orderStatus, int page) {
  729. if (!hasNextPage) {
  730. return;
  731. }
  732. fromStatusGetOrderList(orderStatus, page).then((resp) {
  733. if (isNotError(context, resp)) {
  734. FromStatusGetOrderObj tempObj = FromStatusGetOrderObj.fromJson(resp.data);
  735. setState(() {
  736. orderList.addAll(tempObj.data.items);
  737. hasNextPage = tempObj.data.hasNextPage;
  738. });
  739. }
  740. });
  741. }
  742. deleteOrder(int index){
  743. setState(() {
  744. orderList.removeAt(index);
  745. });
  746. if (orderList.length < 4) {
  747. if (hasNextPage) {
  748. setState(() {
  749. page = ++page;
  750. });
  751. getMoreOrder(orderStatus, page);
  752. }
  753. }
  754. }
  755. myUpdataOrder(String myOrderNo,int myOrderStatus,int index){
  756. updataOrderStatus(myOrderNo, myOrderStatus).then((resp){
  757. if(isNotError(context, resp)){
  758. deleteOrder(index);
  759. }
  760. });
  761. }
  762. }