瀏覽代碼

添加扫描功能,修改发件,改单页面样式

daxu0403 7 年之前
父節點
當前提交
838bd037bb

+ 21 - 49
lib/pages/order_management_page.dart

@@ -508,31 +508,17 @@ class _QueryWidgetState extends State < QueryWidget > {
             ),
           ),
           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,status: '寄件',);
-                          })
-                      ).then((resp) {
-                        if (resp == true) {
-                          deleteOrder(index);
-                        }
-                      });
-                    } else {
-                      return;
-                    }
-                  },
-                );
-              });
-            print("寄件");
+            Navigator.push(
+              context,
+              MaterialPageRoute(
+                builder: (BuildContext context) {
+                  return OrderDetailPage(orderNo: obj.orderNo,status: '寄件',);
+                })
+            ).then((resp) {
+              if (resp == true) {
+                deleteOrder(index);
+              }
+            });
           },
         ),
       ],
@@ -646,31 +632,17 @@ class _QueryWidgetState extends State < QueryWidget > {
             ),
           ),
           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,status: '改单',);
-                          })
-                      ).then((resp) {
-                        if (resp == true) {
-                          switchOrderFromStatus(orderStatus, page);
-                        }
-                      });
-                    } else {
-                      return;
-                    }
-                  },
-                );
+             Navigator.push(
+                context,
+                MaterialPageRoute(
+                  builder: (BuildContext context) {
+                    return OrderDetailPage(orderNo: obj.orderNo,status: '改单',);
+                  })
+              ).then((resp) {
+                if (resp == true) {
+                  switchOrderFromStatus(orderStatus, page);
+                }
               });
-            print("改单");
           },
         ),
         InkWell(

+ 39 - 36
lib/pages/order_management_page/order_detail_page.dart

@@ -220,47 +220,50 @@ class _ItemInfoWidgetState extends State < ItemInfoWidget > {
                           //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(
+                            child:Padding(
+                              padding: EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(30)),
+                              child: TextField(
+                                keyboardType: TextInputType.number,
+                                textAlign: TextAlign.end,
+                                style: TextStyle(
                                   fontSize:
                                   ScreenUtil.getInstance().setSp(30),
                                   color: Colors.black),
-                                contentPadding: EdgeInsets.fromLTRB(
-                                  ScreenUtil.getInstance().setWidth(20),
-                                  0,
-                                  0,
-                                  0),
+                                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);
+                                  }
+                                },
                               ),
-                              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),
-                        )
+                        // Icon(
+                        //   Icons.keyboard_arrow_right,
+                        //   color: Color.fromRGBO(199, 199, 204, 1),
+                        // )
                       ],
                     ))
                 ],

+ 65 - 0
lib/pages/order_taking_page.dart

@@ -7,6 +7,9 @@ import '../showDialog.dart';
 import '../util/session.dart';
 import '../util/util.dart';
 import '../showAlert.dart';
+import 'package:barcode_scan/barcode_scan.dart';
+import 'package:flutter/services.dart';
+import 'order_management_page/order_detail_page.dart';
 
 class OrderTakingPage extends StatefulWidget {
 
@@ -30,6 +33,7 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
   String oldLineIdStr = '';
   int page = 1;
   bool loadMoreOrder = true;
+   String barcode = "";//扫描的订单号
   @override
   void initState() {
     super.initState();
@@ -235,6 +239,35 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
                   ),
                 ),
               )
+            ),
+             Positioned(
+              right: 20,
+              bottom: 20,
+              child:Container(
+                  width: ScreenUtil.getInstance().setWidth(80),
+                  height: ScreenUtil.getInstance().setHeight(80),
+                  decoration: BoxDecoration(
+                    color: Colors.white,
+                    borderRadius: BorderRadius.all(Radius.circular(50)),
+                     boxShadow: [ //阴影
+                        BoxShadow(
+                            color: Colors.black54,
+                            offset: Offset(2.0, 2.0),
+                            blurRadius: 4.0
+                        )
+                      ]
+                  ),
+                  child:IconButton(
+                        icon: Image.asset('lib/images/icon_saoyisao.png',
+                          width: ScreenUtil.getInstance().setWidth(50),
+                          height: ScreenUtil.getInstance().setHeight(48),
+                        ),
+                        onPressed: () {
+                          scan();
+                        },
+                  )
+                ),
+              
             )
           ],
         )
@@ -242,6 +275,8 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
     );
   }
 
+  
+
   Widget _lineWidget(LineObj lineObj, int index, bool checked) {
     return InkWell(
       child: Container(
@@ -330,6 +365,36 @@ class _OrderTakingPageState extends State < OrderTakingPage > with AutomaticKeep
     });
   }
 
+   Future scan() async {
+    try {
+      String barcode = await BarcodeScanner.scan();
+      int index = barcode.indexOf('&');
+      if(index!=-1){
+        barcode = barcode.substring(index+1);
+      }
+      Navigator.push(
+        context,
+        MaterialPageRoute(
+          builder: (BuildContext context) {
+            return OrderDetailPage(orderNo: barcode,status: '寄件',);
+          })
+      );
+    } on PlatformException catch (e) {
+      if (e.code == BarcodeScanner.CameraAccessDenied) {
+        setState(() {
+          return this.barcode = 'The user did not grant the camera permission!';
+        });
+      } else {
+        setState(() {
+          return this.barcode = 'Unknown error: $e';
+        });
+      }
+    } on FormatException{
+      setState(() => this.barcode = 'null (User returned using the "back"-button before scanning anything. Result)');
+    } catch (e) {
+      setState(() => this.barcode = 'Unknown error: $e');
+    }
+  }
 
 
   void deleteOrder(val) { //确认接单后的操作

+ 56 - 31
lib/pages/send_express_page.dart

@@ -461,7 +461,9 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
                       children: < Widget > [
                         SizedBox(
                           width: ScreenUtil.getInstance().setWidth(500),
-                          child: TextField(
+                          child: Padding(
+                            padding: EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(30)),
+                            child:  TextField(
                             controller: tab == 'sendPhone' ? sendCompanyPhoneController : receiptCompanyPhoneController,
                             keyboardType: TextInputType.number,
                             textAlign: TextAlign.end,
@@ -515,8 +517,10 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
                              
                             },
                           ),
+                          )
+                         
                         ),
-                        Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1), )
+                        // Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1), )
                       ],
                     )
                   )
@@ -554,7 +558,9 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
                       children: < Widget > [
                         SizedBox(
                           width: ScreenUtil.getInstance().setWidth(500),
-                          child: TextField(
+                          child:Padding(
+                            padding: EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(30)),
+                            child:TextField(
                             controller: (key == '企业名称') ? (type == 'send' ? sendCompanyNameController : receiptCompanyNameController) : (key == '企业编码' ? sendCompanyCodeController : null),
                             keyboardType: keyboardType ? TextInputType.text : TextInputType.number,
                             textAlign: TextAlign.end,
@@ -607,9 +613,11 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
                               }
                             },
                           ),
+                          )
+                           
                         ),
 
-                        Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1), )
+                        // Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1), )
                       ],
                     )
                   )
@@ -647,7 +655,9 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
                       children: < Widget > [
                         SizedBox(
                           width: ScreenUtil.getInstance().setWidth(500),
-                          child: TextField(
+                          child: Padding(
+                            padding: EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(30)),
+                            child:TextField(
                             controller: controller,
                             keyboardType: keyboardType ? TextInputType.text : TextInputType.number,
                             textAlign: TextAlign.end,
@@ -678,9 +688,11 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
                               }
                             },
                           ),
+                          )
+                          
                         ),
 
-                        Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1), )
+                        // Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1), )
                       ],
                     )
                   )
@@ -719,17 +731,22 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
                       children: < Widget > [
                         SizedBox(
                           width: ScreenUtil.getInstance().setWidth(500),
-                          child: TextField(
-                            focusNode: key == '银行卡号'?bankCardFocusNode:null,
-                            controller: key == '银行卡号'?bankCardController:key=='银行名称'?bankNameController:openBankNameController,
-                            keyboardType: keyboardType ? TextInputType.text : TextInputType.number,
-                            textAlign: TextAlign.end,
-                            decoration: InputDecoration(
-                              border: InputBorder.none
-                            ),
-                          ),
+                          child: 
+                          Padding(
+                             padding: EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(30)),
+                             child:TextField(
+                                focusNode: key == '银行卡号'?bankCardFocusNode:null,
+                                controller: key == '银行卡号'?bankCardController:key=='银行名称'?bankNameController:openBankNameController,
+                                keyboardType: keyboardType ? TextInputType.text : TextInputType.number,
+                                textAlign: TextAlign.end,
+                                decoration: InputDecoration(
+                                  border: InputBorder.none
+                                ),
+                              ),
+                          )
+                          
                         ),
-                        Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1), )
+                        // Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1), )
                       ],
                     )
                   )
@@ -840,15 +857,19 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
                     //Text('${value}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(136, 136, 136, 1)), ),
                     SizedBox(
                       width: ScreenUtil.getInstance().setWidth(500),
-                      child: TextField(
-                        controller: type == 'send' ? sendCompanyAddressController : receiptCompanyAddressController,
-                        textAlign: TextAlign.end,
-                        decoration: InputDecoration(
-                          border: InputBorder.none
+                      child: Padding(
+                        padding: EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(30)),
+                        child:  TextField(
+                          controller: type == 'send' ? sendCompanyAddressController : receiptCompanyAddressController,
+                          textAlign: TextAlign.end,
+                          decoration: InputDecoration(
+                            border: InputBorder.none
+                          ),
                         ),
-                      ),
+                      )
+                     
                     ),
-                    Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1), )
+                    // Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1), )
                   ],
                 )
               )
@@ -879,16 +900,20 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
                     //Text('${value}', style: TextStyle(fontSize: ScreenUtil.getInstance().setSp(30), color: Color.fromRGBO(136, 136, 136, 1)), ),
                     SizedBox(
                       width: ScreenUtil.getInstance().setWidth(500),
-                      child: TextField(
-                        controller: openBankPhoneController,
-                        textAlign: TextAlign.end,
-                        keyboardType: TextInputType.number,
-                        decoration: InputDecoration(
-                          border: InputBorder.none
+                      child: Padding(
+                        padding: EdgeInsets.only(right: ScreenUtil.getInstance().setWidth(30)),
+                        child: TextField(
+                          controller: openBankPhoneController,
+                          textAlign: TextAlign.end,
+                          keyboardType: TextInputType.number,
+                          decoration: InputDecoration(
+                            border: InputBorder.none
+                          ),
                         ),
-                      ),
+                      )
+                     
                     ),
-                    Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1), )
+                    // Icon(Icons.keyboard_arrow_right, color: Color.fromRGBO(199, 199, 204, 1), )
                   ],
                 )
               )