Kaynağa Gözat

寄件时如订单已取消,增加判断并调回订单管理页

daxu0403 7 yıl önce
ebeveyn
işleme
aadab2ec3f

+ 5 - 5
.flutter-plugins

@@ -1,5 +1,5 @@
-barcode_scan=/Users/xiaoguang/flutter/.pub-cache/hosted/pub.flutter-io.cn/barcode_scan-0.0.8/
-city_pickers=/Users/xiaoguang/flutter/.pub-cache/hosted/pub.flutter-io.cn/city_pickers-0.0.4/
-flutter_picker=/Users/xiaoguang/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_picker-1.0.10/
-shared_preferences=/Users/xiaoguang/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences-0.5.2/
-url_launcher=/Users/xiaoguang/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher-5.0.2/
+barcode_scan=/Users/daxu/app/flutter/.pub-cache/hosted/pub.dartlang.org/barcode_scan-0.0.8/
+city_pickers=/Users/daxu/app/flutter/.pub-cache/hosted/pub.dartlang.org/city_pickers-0.0.4/
+flutter_picker=/Users/daxu/app/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_picker-1.0.8/
+shared_preferences=/Users/daxu/app/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.1+1/
+url_launcher=/Users/daxu/app/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.0.1/

+ 2 - 2
android/local.properties

@@ -1,5 +1,5 @@
-sdk.dir=/Users/xiaoguang/Library/Android/sdk
-flutter.sdk=/Users/xiaoguang/flutter
+sdk.dir=/Users/daxu/Library/Android/sdk
+flutter.sdk=/Users/daxu/app/flutter
 flutter.versionName=1.0.0
 flutter.versionCode=1
 flutter.buildMode=debug

+ 355 - 260
lib/pages/order_management_page/order_detail_page.dart

@@ -8,6 +8,7 @@ import '../../showAlert.dart';
 import '../../showLineModal.dart';
 import '../../util/session.dart';
 import '../../util/bluetooth_utils.dart';
+
 class OrderDetailPage extends StatefulWidget {
   final String orderNo;
   final String status;
@@ -22,43 +23,51 @@ class OrderDetailPage extends StatefulWidget {
 }
 
 class _OrderDetailPageState extends State < OrderDetailPage > {
-
   OrderDetailData orderDetailObj;
 
   @override
   void initState() {
     super.initState();
-    getOrderDetail(widget.orderNo).then((resp){
-      if(isNotError(context, resp) && this.mounted){
-       OrderDetailObj tempObj = OrderDetailObj.fromJson(resp.data);
-       setState(() {
-         orderDetailObj =tempObj.data;
-       });
+    getOrderDetail(widget.orderNo).then((resp) {
+      if (isNotError(context, resp) && this.mounted) {
+        OrderDetailObj tempObj = OrderDetailObj.fromJson(resp.data);
+        setState(() {
+          orderDetailObj = tempObj.data;
+        });
       }
     });
   }
+
   @override
   Widget build(BuildContext context) {
     return Scaffold(
       appBar: AppBar(
-        title: Text("订单详情", style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(36)), ),
+        title: Text(
+          "订单详情",
+          style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(36)),
+        ),
         centerTitle: true,
         backgroundColor: Color.fromRGBO(64, 98, 254, 1),
       ),
       body: Container(
-        padding: EdgeInsets.fromLTRB(0, ScreenUtil.getInstance().setHeight(20), 0, ScreenUtil.getInstance().setHeight(20)),
+        padding: EdgeInsets.fromLTRB(
+          0,
+          ScreenUtil.getInstance().setHeight(20),
+          0,
+          ScreenUtil.getInstance().setHeight(20)),
         color: Color.fromRGBO(246, 246, 254, 1),
-        child:orderDetailObj==null?Center(
-          child:_getMoreWidget(),
-        ): ListView(
+        child: orderDetailObj == null ?
+        Center(
+          child: _getMoreWidget(),
+        ) :
+        ListView(
           children: < Widget > [
             _sendInfo(),
             _getInfo(),
-            ItemInfoWidget(obj:orderDetailObj,status:widget.status),
+            ItemInfoWidget(obj: orderDetailObj, status: widget.status),
           ],
-        )
-      ),
-        
+        )),
+
       //resizeToAvoidBottomPadding: false //键盘弹出,页面不跟随向上滑动,防止出现溢出错误
     );
   }
@@ -71,14 +80,23 @@ class _OrderDetailPageState extends State < OrderDetailPage > {
         children: < Widget > [
           titleWidget('lib/images/icon_send.png', '发件信息'),
           underLine(),
-          contentWiget('电话', orderDetailObj.senderPhone!=null?orderDetailObj.senderPhone:orderDetailObj.sendCompanyPhone),
+          contentWiget(
+            '电话',
+            orderDetailObj.senderPhone != null ?
+            orderDetailObj.senderPhone :
+            orderDetailObj.sendCompanyPhone),
           contentWiget('企业编码', orderDetailObj.sendCompanyCode),
           contentWiget('企业名称', orderDetailObj.sendCompanyName),
-          contentWiget('城市/区域', '${orderDetailObj.sendCompanyProvinceName}'+' '+'${orderDetailObj.sendCompanyCityName}'+' '+ '${orderDetailObj.sendCompanyAreaName}'),
+          contentWiget(
+            '城市/区域',
+            '${orderDetailObj.sendCompanyProvinceName}' +
+            ' ' +
+            '${orderDetailObj.sendCompanyCityName}' +
+            ' ' +
+            '${orderDetailObj.sendCompanyAreaName}'),
           lastContentWiget('详细地址', orderDetailObj.sendCompanyAddress)
         ],
-      )
-    );
+      ));
   }
 
   Widget _getInfo() {
@@ -91,15 +109,19 @@ class _OrderDetailPageState extends State < OrderDetailPage > {
           underLine(),
           contentWiget('企业名称', orderDetailObj.receiptCompanyName),
           contentWiget('电话', orderDetailObj.receiptCompanyPhone),
-          contentWiget('城市/区域', '${orderDetailObj.receiptCompanyProvinceName}'+' '+ '${orderDetailObj.receiptCompanyCityName}'+' '+ '${orderDetailObj.receiptCompanyAreaName}'),
+          contentWiget(
+            '城市/区域',
+            '${orderDetailObj.receiptCompanyProvinceName}' +
+            ' ' +
+            '${orderDetailObj.receiptCompanyCityName}' +
+            ' ' +
+            '${orderDetailObj.receiptCompanyAreaName}'),
           lastContentWiget('详细地址', orderDetailObj.sendCompanyAddress)
         ],
-      )
-    );
+      ));
   }
 }
 
-
 class ItemInfoWidget extends StatefulWidget {
   final OrderDetailData obj;
   final String status;
@@ -113,13 +135,12 @@ class ItemInfoWidget extends StatefulWidget {
 }
 
 class _ItemInfoWidgetState extends State < ItemInfoWidget > {
-
-  double afterTransportFee=0.0;//运费
-  int afterGoodsNumber=0;//数量
-  double afterCollectingFee=0.0;//代收
+  double afterTransportFee = 0.0; //运费
+  int afterGoodsNumber = 0; //数量
+  double afterCollectingFee = 0.0; //代收
   bool submitStatus = true;
   String lineId = '-1';
-  List<CompanyOfLineList>  lineList = [];
+  List < CompanyOfLineList > lineList = [];
   String showTextPaymentMehod = '现付';
   int goodsPaymentMethod = 1;
   BluetoothUtils bluetooth = BluetoothUtils();
@@ -127,22 +148,22 @@ class _ItemInfoWidgetState extends State < ItemInfoWidget > {
   void initState() {
     super.initState();
     setState(() {
-       afterTransportFee = widget.obj.goodsFreight/100;
-       afterGoodsNumber =widget.obj.goodsQuantity;
-       afterCollectingFee =widget.obj.goodsAgencyFund/100;
-       lineId = widget.obj.lineId.toString();
+      afterTransportFee = widget.obj.goodsFreight / 100;
+      afterGoodsNumber = widget.obj.goodsQuantity;
+      afterCollectingFee = widget.obj.goodsAgencyFund / 100;
+      lineId = widget.obj.lineId.toString();
     });
-    if(widget.obj.receiptCompanyId!=null){
-       getLineOfCompanyId(widget.obj.receiptCompanyId.toString()).then((resp){
-        if(isNotError(context, resp) && this.mounted){
-            CompanyOfLine obj = CompanyOfLine.fromJson(resp.data);
-            setState(() {
-                lineList = obj.data;
-            });
-          }
+    if (widget.obj.receiptCompanyId != null) {
+      getLineOfCompanyId(widget.obj.receiptCompanyId.toString()).then((resp) {
+        if (isNotError(context, resp) && this.mounted) {
+          CompanyOfLine obj = CompanyOfLine.fromJson(resp.data);
+          setState(() {
+            lineList = obj.data;
+          });
+        }
       });
     }
-    showTextPaymentMehod = widget.obj.goodsPaymentMethod==1?'现付':'到付';
+    showTextPaymentMehod = widget.obj.goodsPaymentMethod == 1 ? '现付' : '到付';
     goodsPaymentMethod = widget.obj.goodsPaymentMethod;
   }
 
@@ -156,12 +177,13 @@ class _ItemInfoWidgetState extends State < ItemInfoWidget > {
           children: < Widget > [
             titleWidget('lib/images/icon_huowu.png', "货物信息"),
             underLine(),
-            contentWiget("货物名称",widget.obj.goods),
+            contentWiget("货物名称", widget.obj.goods),
             _inputWidget("数量", widget.obj.goodsQuantity),
-            _inputWidget("运费", widget.obj.goodsFreight/100),
-            _inputWidget("代收", widget.obj.goodsAgencyFund/100),
-             _packageType('付款方式'),
-            contentWiget("保价", (widget.obj.goodsPriceProtection/100).toString()),
+            _inputWidget("运费", widget.obj.goodsFreight / 100),
+            _inputWidget("代收", widget.obj.goodsAgencyFund / 100),
+            _packageType('付款方式'),
+            contentWiget(
+              "保价", (widget.obj.goodsPriceProtection / 100).toString()),
             contentWiget("重量", widget.obj.goodsWeight.toStringAsFixed(1)),
             contentWiget("包装类型", (widget.obj.goodsPackingName)),
             contentWiget("货物类型", (widget.obj.goodsCategoryName)),
@@ -169,8 +191,7 @@ class _ItemInfoWidgetState extends State < ItemInfoWidget > {
             submitBtn(widget.obj.orderNo)
           ],
         ),
-      )
-    );
+      ));
   }
 
   Widget _inputWidget(String key, num value) {
@@ -178,125 +199,146 @@ class _ItemInfoWidgetState extends State < ItemInfoWidget > {
       padding: EdgeInsets.only(left: ScreenUtil.getInstance().setWidth(30)),
       child: Column(
         children: < Widget > [
-           SizedBox(
-              height: ScreenUtil.getInstance().setHeight(89),
-              child: Center(
-                child: Row(
-                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
-                  children: < Widget > [
-                    Text(key, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
-                    Container(
-                      width: ScreenUtil.getInstance().setWidth(300),
-                      child: Row(
-                        mainAxisAlignment: MainAxisAlignment.end,
-                        children: < Widget > [
-                          Expanded(
-                            //padding: EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(20)),
-                            //child: Text(value,style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(136, 136, 136, 1)), ),
-                            child: Center(
-                              child: TextField(
-                                keyboardType: TextInputType.number,
-                                textAlign: TextAlign.end,
-                                style: TextStyle(
-                                  fontSize: ScreenUtil.getInstance().setSp(30),
-                                  color: Colors.black
-                                ),
-                                decoration: InputDecoration(
-                                  border: InputBorder.none,
-                                  hintText: value.toString(),
-                                  hintStyle: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Colors.black),
-                                  contentPadding: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(20), 0, 0, 0),
-                                ),
-                                onChanged: (value){
-                                  if(key=='数量'){
-                                    afterGoodsNumber =int.parse(value);
-                                  }else if(key=='运费'){
-                                    afterTransportFee =double.parse(value);
-                                    String temp = afterTransportFee.toStringAsFixed(1);
-                                    afterTransportFee = double.parse(temp);
-                                  }else if(key=='代收'){
-                                    afterCollectingFee =double.parse(value);
-                                     String temp = afterCollectingFee.toStringAsFixed(1);
-                                     afterCollectingFee = double.parse(temp);
-                                  }
-                                },
+          SizedBox(
+            height: ScreenUtil.getInstance().setHeight(89),
+            child: Center(
+              child: Row(
+                mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                children: < Widget > [
+                  Text(
+                    key,
+                    style: TextStyle(
+                      fontSize: ScreenUtil.getInstance().setSp(30),
+                      color: Color.fromRGBO(74, 74, 74, 1)),
+                  ),
+                  Container(
+                    width: ScreenUtil.getInstance().setWidth(300),
+                    child: Row(
+                      mainAxisAlignment: MainAxisAlignment.end,
+                      children: < Widget > [
+                        Expanded(
+                          //padding: EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(20)),
+                          //child: Text(value,style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(136, 136, 136, 1)), ),
+                          child: Center(
+                            child: TextField(
+                              keyboardType: TextInputType.number,
+                              textAlign: TextAlign.end,
+                              style: TextStyle(
+                                fontSize:
+                                ScreenUtil.getInstance().setSp(30),
+                                color: Colors.black),
+                              decoration: InputDecoration(
+                                border: InputBorder.none,
+                                hintText: value.toString(),
+                                hintStyle: TextStyle(
+                                  fontSize:
+                                  ScreenUtil.getInstance().setSp(30),
+                                  color: Colors.black),
+                                contentPadding: EdgeInsets.fromLTRB(
+                                  ScreenUtil.getInstance().setWidth(20),
+                                  0,
+                                  0,
+                                  0),
                               ),
-                            )
-                          ),
-                          Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1), )
-                        ],
-                      )
-                    )
-                  ],
-                ),
-              )
-          ),
-          Expanded(
-            flex: 0,
-            child: underLine()
-          )
+                              onChanged: (value) {
+                                if (key == '数量') {
+                                  afterGoodsNumber = int.parse(value);
+                                } else if (key == '运费') {
+                                  afterTransportFee = double.parse(value);
+                                  String temp =
+                                    afterTransportFee.toStringAsFixed(1);
+                                  afterTransportFee = double.parse(temp);
+                                } else if (key == '代收') {
+                                  afterCollectingFee = double.parse(value);
+                                  String temp =
+                                    afterCollectingFee.toStringAsFixed(1);
+                                  afterCollectingFee = double.parse(temp);
+                                }
+                              },
+                            ),
+                          )),
+                        Icon(
+                          Icons.keyboard_arrow_right,
+                          color: Color.fromRGBO(199, 199, 204, 1),
+                        )
+                      ],
+                    ))
+                ],
+              ),
+            )),
+          Expanded(flex: 0, child: underLine())
         ],
-      )
-    );
+      ));
   }
 
   Widget _descWidget(String str) {
-    return
-    Container(
+    return Container(
       padding: EdgeInsets.all(ScreenUtil.getInstance().setWidth(30)),
-      child: Text(str, maxLines: 100, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
+      child: Text(
+        str,
+        maxLines: 100,
+        style: TextStyle(
+          fontSize: ScreenUtil.getInstance().setSp(30),
+          color: Color.fromRGBO(74, 74, 74, 1)),
+      ),
     );
   }
 
   Widget submitBtn(String orderNo) {
     return GestureDetector(
       child: Container(
-        margin: EdgeInsets.fromLTRB(ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(50), ScreenUtil.getInstance().setWidth(30), ScreenUtil.getInstance().setWidth(40)),
+        margin: EdgeInsets.fromLTRB(
+          ScreenUtil.getInstance().setWidth(30),
+          ScreenUtil.getInstance().setWidth(50),
+          ScreenUtil.getInstance().setWidth(30),
+          ScreenUtil.getInstance().setWidth(40)),
         height: ScreenUtil.getInstance().setHeight(88),
         decoration: BoxDecoration(
           borderRadius: BorderRadius.all(Radius.circular(4)),
           color: Color.fromRGBO(37, 102, 242, 1),
         ),
         child: Center(
-        child:Row(
+          child: Row(
             mainAxisAlignment: MainAxisAlignment.center,
-            children: <Widget>[
-                Offstage(
-                  offstage: submitStatus,
-                  child: SizedBox(
-                    width: ScreenUtil.getInstance().setWidth(45),
-                    height: ScreenUtil.getInstance().setHeight(45),
-                    child: Image.asset('lib/images/loading.gif'),
-                  ),
+            children: < Widget > [
+              Offstage(
+                offstage: submitStatus,
+                child: SizedBox(
+                  width: ScreenUtil.getInstance().setWidth(45),
+                  height: ScreenUtil.getInstance().setHeight(45),
+                  child: Image.asset('lib/images/loading.gif'),
                 ),
-                Text('提交', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(36), color: Colors.white)),
+              ),
+              Text('提交',
+                style: TextStyle(
+                  fontSize: ScreenUtil.getInstance().setSp(36),
+                  color: Colors.white)),
             ],
-          )
-        ),
+          )),
       ),
       onTap: () {
-        if(!submitStatus) return;
-        if(afterCollectingFee>0){
-          if(widget.obj.sendCompanyBankCard==null || widget.obj.sendCompanyBankCard==''){
-             showDialog <Null> (
-                context: context,
-                barrierDismissible: false,
-                builder: (BuildContext context) {
-                  return MyAlertDialog(text: '银行信息不全',childCallback:(val){});
-                }
-              );
+        if (!submitStatus) return;
+        if (afterCollectingFee > 0) {
+          if (widget.obj.sendCompanyBankCard == null ||
+            widget.obj.sendCompanyBankCard == '') {
+            showDialog < Null > (
+              context: context,
+              barrierDismissible: false,
+              builder: (BuildContext context) {
+                return MyAlertDialog(text: '银行信息不全', childCallback: (val) {});
+              });
             return;
           }
         }
-        if(lineList.length>1 && widget.status=='寄件'){
-            showLineModal(lineList,orderNo);
-            return;
+        if (lineList.length > 1 && widget.status == '寄件') {
+          showLineModal(lineList, orderNo);
+          return;
         }
-          submitOrder(orderNo);
+        submitOrder(orderNo);
       },
     );
   }
-  
+
   Widget _packageType(String key) {
     return Padding(
       padding: EdgeInsets.only(left: ScreenUtil.getInstance().setWidth(30)),
@@ -311,7 +353,12 @@ class _ItemInfoWidgetState extends State < ItemInfoWidget > {
                   children: < Widget > [
                     Expanded(
                       flex: 0,
-                      child: Text(key, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
+                      child: Text(
+                        key,
+                        style: TextStyle(
+                          fontSize: ScreenUtil.getInstance().setSp(30),
+                          color: Color.fromRGBO(74, 74, 74, 1)),
+                      ),
                     ),
                     Expanded(
                       child: Row(
@@ -320,96 +367,117 @@ class _ItemInfoWidgetState extends State < ItemInfoWidget > {
                           //Text('${value}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(136, 136, 136, 1)), ),
                           SizedBox(
                             width: ScreenUtil.getInstance().setWidth(500),
-                            child: Text(showTextPaymentMehod, textAlign: TextAlign.end, )
-                          ),
-                          Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1), )
+                            child: Text(
+                              showTextPaymentMehod,
+                              textAlign: TextAlign.end,
+                            )),
+                          Icon(
+                            Icons.keyboard_arrow_right,
+                            color: Color.fromRGBO(199, 199, 204, 1),
+                          )
                         ],
-                      )
-                    )
+                      ))
                   ],
                 ),
-              )
-            ),
+              )),
             onTap: () {
               showPickerModal(context);
             },
           ),
-          Expanded(
-            flex: 0,
-            child: underLine()
-          )
+          Expanded(flex: 0, child: underLine())
         ],
-      )
-    );
-
+      ));
   }
 
   showPickerModal(BuildContext context) {
-    List < dynamic > data =  ['现付', '到付'];
+    List < dynamic > data = ['现付', '到付'];
     new Picker(
       adapter: PickerDataAdapter < String > (pickerdata: data),
       height: ScreenUtil.getInstance().setHeight(450),
       confirmText: '确定',
-      confirmTextStyle: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(64, 98, 254, 1)),
+      confirmTextStyle: TextStyle(
+        fontSize: ScreenUtil.getInstance().setSp(30),
+        color: Color.fromRGBO(64, 98, 254, 1)),
       cancelText: '取消',
-      cancelTextStyle: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(153, 153, 153, 1)),
+      cancelTextStyle: TextStyle(
+        fontSize: ScreenUtil.getInstance().setSp(30),
+        color: Color.fromRGBO(153, 153, 153, 1)),
       headercolor: Color.fromRGBO(245, 245, 245, 1),
       itemExtent: ScreenUtil.getInstance().setHeight(80),
-      textStyle: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(42, 42, 42, 1)),
+      textStyle: TextStyle(
+        fontSize: ScreenUtil.getInstance().setSp(30),
+        color: Color.fromRGBO(42, 42, 42, 1)),
       changeToFirst: true,
       hideHeader: false,
       onConfirm: (Picker picker, List value) {
         setState(() {
-           showTextPaymentMehod = data[value[0]];
+          showTextPaymentMehod = data[value[0]];
         });
         if (showTextPaymentMehod == '现付') {
           goodsPaymentMethod = 1;
         } else {
           goodsPaymentMethod = 2;
         }
-      }
-    ).showModal(this.context); 
+      }).showModal(this.context);
   }
 
-  showLineModal(List<CompanyOfLineList> list,String orderNo){
+  showLineModal(List < CompanyOfLineList > list, String orderNo) {
     showDialog < Null > (
       context: context, //BuildContext对象
       barrierDismissible: false,
       builder: (BuildContext context) {
-        return ShowLineModal( 
-          lineList: list, childCallback: (val) {
-              lineId = val;
-             submitOrder(orderNo);
+        return ShowLineModal(
+          lineList: list,
+          childCallback: (val) {
+            lineId = val;
+            submitOrder(orderNo);
           },
         );
       });
   }
-  submitOrder(String orderNo){
-     setState(() {
-        submitStatus = false;
-      });
-      updataOrder(lineId,orderNo,afterTransportFee,afterCollectingFee,afterGoodsNumber,goodsPaymentMethod).then((resp){
-        if(isNotError(context, resp) && this.mounted){
+
+  submitOrder(String orderNo) {
+    setState(() {
+      submitStatus = false;
+    });
+    updataOrder(lineId, orderNo, afterTransportFee, afterCollectingFee,
+        afterGoodsNumber, goodsPaymentMethod)
+      .then((resp) {
+        if (isNotError(context, resp) && this.mounted) {
           showDialog < Null > (
-          context: context, //BuildContext对象
-          barrierDismissible: false,
-          builder: (BuildContext context) {
-            //打印
-            OrderDetailData data = OrderDetailObj.fromJson(resp.data).data;
-            getKey('printType').then((printType){
-                getKey('stationName').then((stationName){
-                  getKey('nickName').then((nickName){
-                    getKey('companyName').then((companyName){
-                          getKey('companyCustomerPhone').then((companyCustomerPhone){
-                            double goodsYs = data.goodsPaymentMethod==2?(data.goodsFreight/100)+(data.goodsAgencyFund/100):data.goodsAgencyFund/100;
-                            String nowDate = fromatDate( DateTime.now().millisecondsSinceEpoch);//打印时间
-                            String createTime =  fromatDate(data.createTime);
-                            double goodsAgencyFunds = data.goodsAgencyFund/100;
-                            double goodsDFreight = data.goodsPaymentMethod==2?data.goodsFreight/100:0;
-                            double goodsXFreight = data.goodsPaymentMethod==1?data.goodsFreight/100:0;
-                            String receiptAddress = data.receiptCompanyAddress.length>10?data.receiptCompanyAddress.substring(0,10):data.receiptCompanyAddress;
+            context: context, //BuildContext对象
+            barrierDismissible: false,
+            builder: (BuildContext context) {
+              //打印
+              OrderDetailObj parentObj = OrderDetailObj.fromJson(resp.data);
+              if (parentObj.success) {
+                OrderDetailData data = parentObj.data;
+                getKey('printType').then((printType) {
+                  getKey('stationName').then((stationName) {
+                    getKey('nickName').then((nickName) {
+                      getKey('companyName').then((companyName) {
+                        getKey('companyCustomerPhone')
+                          .then((companyCustomerPhone) {
+                            double goodsYs = data.goodsPaymentMethod == 2 ?
+                              (data.goodsFreight / 100) +
+                              (data.goodsAgencyFund / 100) :
+                              data.goodsAgencyFund / 100;
+                            String nowDate = fromatDate(
+                              DateTime.now().millisecondsSinceEpoch); //打印时间
+                            String createTime = fromatDate(data.createTime);
+                            double goodsAgencyFunds = data.goodsAgencyFund / 100;
+                            double goodsDFreight = data.goodsPaymentMethod == 2 ?
+                              data.goodsFreight / 100 :
+                              0;
+                            double goodsXFreight = data.goodsPaymentMethod == 1 ?
+                              data.goodsFreight / 100 :
+                              0;
+                            String receiptAddress =
+                              data.receiptCompanyAddress.length > 10 ?
+                              data.receiptCompanyAddress.substring(0, 10) :
+                              data.receiptCompanyAddress;
 
-                            Map<String, String> pum = {
+                            Map < String, String > pum = {
                               "[logisticsNo]": "${data.orderNo ?? ''}",
                               "[createTime]": "$createTime",
                               "[sendStationName]": "$stationName",
@@ -421,7 +489,7 @@ class _ItemInfoWidgetState extends State < ItemInfoWidget > {
                               "[endStationName]": "${data.receiptStationName}",
                               "[goodsLineCode]": "${data.lineCode ?? ''}",
                               "[goodsLine]": "${data.lineName ?? ''}",
-                              "[repairAddress]": "${receiptAddress?? ''}",
+                              "[repairAddress]": "${receiptAddress ?? ''}",
                               "[goodsQuantity]": "${data.goodsQuantity ?? ''}",
                               "[goodsInsurance]": "${data.goodsInsurance ?? ''}",
                               "[goodsFlatCost]": "${data.goodsFlatCost ?? ''}",
@@ -432,45 +500,59 @@ class _ItemInfoWidgetState extends State < ItemInfoWidget > {
                               "[goodsYs]": "$goodsYs",
                               "[dealerBankAccount]": "${data.sendCompanyBankCard ?? ''}",
                               "[goodsRemark]": "${data.memo ?? ''}",
-                              "[realName]": "${nickName?? ''}",
+                              "[realName]": "${nickName ?? ''}",
                               "[currentTime]": "$nowDate",
                               "[currentGoodNumber]": "1/1",
-                              "[companyCustomerPhone]":"$companyCustomerPhone",
-                              "[companyName]":"$companyName"
+                              "[companyCustomerPhone]": "$companyCustomerPhone",
+                              "[companyName]": "$companyName"
                             };
-                            bluetooth.printOrder(pum, int.parse(printType)).then((value){
-                              if(value==null){
-                                showDialog <Null> (
-                                  context: context,
-                                  barrierDismissible: false,
-                                  builder: (BuildContext context) {
-                                    return MyAlertDialog(text: '未连接打印机',childCallback:(val){});
-                                  }
-                                );
-                              }
-                            });
+                            bluetooth
+                              .printOrder(pum, int.parse(printType))
+                              .then((value) {
+                                if (value == null) {
+                                  showDialog < Null > (
+                                    context: context,
+                                    barrierDismissible: false,
+                                    builder: (BuildContext context) {
+                                      return MyAlertDialog(
+                                        text: '未连接打印机',
+                                        childCallback: (val) {});
+                                    });
+                                }
+                              });
                           });
+                      });
                     });
                   });
                 });
-              });
-            return MyAlertDialog( //调用对话框
-              text: '订单修改成功!', childCallback: (val) {
-                if(val){
-                  Navigator.pop(context,true);
-                }
-              },
-            );
-          });
-        }else{
+                return MyAlertDialog(
+                  //调用对话框
+                  text: '订单修改成功!',
+                  childCallback: (val) {
+                    if (val) {
+                      Navigator.pop(context, true);
+                    }
+                  },
+                );
+              } else {
+                showDialog < Null > (
+                  context: context,
+                  barrierDismissible: false,
+                  builder: (BuildContext context) {
+                    return MyAlertDialog(
+                      text: parentObj.msg, childCallback: (val) {
+                          Navigator.pop(context, true);
+                      });
+                  });
+              }
+            });
+        } else {
           setState(() {
             submitStatus = true;
           });
         }
       });
   }
- 
-  
 }
 
 Widget titleWidget(String iconUrl, String str) {
@@ -482,14 +564,17 @@ Widget titleWidget(String iconUrl, String str) {
         mainAxisAlignment: MainAxisAlignment.start,
         children: < Widget > [
           Padding(
-            padding: EdgeInsets.only(right: ScreenUtil.getInstance().setHeight(20)),
+            padding: EdgeInsets.only(
+              right: ScreenUtil.getInstance().setHeight(20)),
             child: Image.asset(
               iconUrl,
               width: ScreenUtil.getInstance().setWidth(40),
               height: ScreenUtil.getInstance().setHeight(40),
-            )
-          ),
-          Text(str, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(32)), )
+            )),
+          Text(
+            str,
+            style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(32)),
+          )
         ],
       ),
     ),
@@ -509,34 +594,38 @@ Widget contentWiget(String key, String value) {
     child: Column(
       children: < Widget > [
         Padding(
-          padding: EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(30)),
+          padding:
+          EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(30)),
           child: SizedBox(
             height: ScreenUtil.getInstance().setHeight(89),
             child: Center(
               child: Row(
                 mainAxisAlignment: MainAxisAlignment.spaceBetween,
                 children: < Widget > [
-                  Text(key, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
-                  Text(value, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(136, 136, 136, 1)), ),
+                  Text(
+                    key,
+                    style: TextStyle(
+                      fontSize: ScreenUtil.getInstance().setSp(30),
+                      color: Color.fromRGBO(74, 74, 74, 1)),
+                  ),
+                  Text(
+                    value,
+                    style: TextStyle(
+                      fontSize: ScreenUtil.getInstance().setSp(30),
+                      color: Color.fromRGBO(136, 136, 136, 1)),
+                  ),
                 ],
               ),
-            )
-          )
-        ),
-        Expanded(
-          flex: 0,
-          child: underLine()
-        )
+            ))),
+        Expanded(flex: 0, child: underLine())
       ],
-    )
-  );
+    ));
 }
 
 Widget lastContentWiget(String key, String value) {
   return Padding(
     padding: EdgeInsets.only(left: ScreenUtil.getInstance().setWidth(30)),
-    child:
-    Padding(
+    child: Padding(
       padding: EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(30)),
       child: SizedBox(
         height: ScreenUtil.getInstance().setHeight(89),
@@ -544,36 +633,42 @@ Widget lastContentWiget(String key, String value) {
           child: Row(
             mainAxisAlignment: MainAxisAlignment.spaceBetween,
             children: < Widget > [
-              Text(key, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(74, 74, 74, 1)), ),
-              Text(value, style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(136, 136, 136, 1)), ),
+              Text(
+                key,
+                style: TextStyle(
+                  fontSize: ScreenUtil.getInstance().setSp(30),
+                  color: Color.fromRGBO(74, 74, 74, 1)),
+              ),
+              Text(
+                value,
+                style: TextStyle(
+                  fontSize: ScreenUtil.getInstance().setSp(30),
+                  color: Color.fromRGBO(136, 136, 136, 1)),
+              ),
             ],
           ),
-        )
-      )
-    ),
+        ))),
   );
 }
 
 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()
-            )
-
-          ],
-        ),
+  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())
+        ],
       ),
-    );
-  }
+    ),
+  );
+}