ソースを参照

发件接口添加statioId

daxu0403 7 年 前
コミット
5e974f8506
2 ファイル変更86 行追加80 行削除
  1. 84 80
      lib/pages/send_express_page.dart
  2. 2 0
      lib/util/api.dart

+ 84 - 80
lib/pages/send_express_page.dart

@@ -10,6 +10,7 @@ import '../util/api.dart';
 import '../util/models.dart';
 import '../showAlert.dart';
 import '../send_Dialog.dart';
+import '../util/session.dart';
 class SendExpressPage extends StatefulWidget {
   final Widget child;
 
@@ -51,8 +52,8 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
   TextEditingController sendCompanyAddressController = TextEditingController();
   TextEditingController receiptCompanyAddressController = TextEditingController();
 
- 
-  
+
+
 
   List < dynamic > goodsCateGoryList = [];
   List < dynamic > goodsPackageList = [];
@@ -132,11 +133,11 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
       //if (_scrollController.position.pixels == _scrollController.position.maxScrollExtent) {}
     });
     sendCompanyPhoneController.addListener(() {
-     
-        setState(() {
-          sendCompanyPhone = sendCompanyPhoneController.text;
-        });
-      
+
+      setState(() {
+        sendCompanyPhone = sendCompanyPhoneController.text;
+      });
+
       if (timer != null) {
         timer.cancel();
       }
@@ -173,11 +174,11 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
     });
 
     receiptCompanyPhoneController.addListener(() {
-      
-        setState(() {
-          receiptCompanyPhone = receiptCompanyPhoneController.text;
-        });
-      
+
+      setState(() {
+        receiptCompanyPhone = receiptCompanyPhoneController.text;
+      });
+
 
       if (timer != null) {
         timer.cancel();
@@ -429,7 +430,7 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
       )
     );
   }
-  
+
   Widget _contentWiget(String key, String type, [bool keyboardType = false]) { //false是数字键盘
     return Padding(
       padding: EdgeInsets.only(left: ScreenUtil.getInstance().setWidth(30)),
@@ -486,19 +487,19 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
                                   goodsQuantity = int.parse(value);
                                 } else if (key == '运费') {
                                   goodsFreight = double.parse(value);
-                                  String temp =goodsFreight.toStringAsFixed(1);
+                                  String temp = goodsFreight.toStringAsFixed(1);
                                   goodsFreight = double.parse(temp);
                                 } else if (key == '代收') {
                                   goodsAgencyFund = double.parse(value);
-                                  String temp =goodsAgencyFund.toStringAsFixed(1);
+                                  String temp = goodsAgencyFund.toStringAsFixed(1);
                                   goodsAgencyFund = double.parse(temp);
                                 } else if (key == '保价') {
                                   goodsPriceProtection = double.parse(value);
-                                  String temp =goodsPriceProtection.toStringAsFixed(1);
+                                  String temp = goodsPriceProtection.toStringAsFixed(1);
                                   goodsPriceProtection = double.parse(temp);
                                 } else if (key == '重量') {
                                   goodsWeight = double.parse(value);
-                                  String temp =goodsWeight.toStringAsFixed(1);
+                                  String temp = goodsWeight.toStringAsFixed(1);
                                   goodsWeight = double.parse(temp);
                                 }
                               }
@@ -750,15 +751,15 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
         }
         if (goodsQuantity == 0) {
           errStr = '请填写货物数量';
-        } 
-        if(int.tryParse(goodsQuantity.toString())==null){
-          errStr='货物数量格式错误';
+        }
+        if (int.tryParse(goodsQuantity.toString()) == null) {
+          errStr = '货物数量格式错误';
         }
         if (goodsFreight == 0.0) {
           errStr = '请填写运费';
         }
-        if(int.tryParse(sendCompanyPhone)==null || int.tryParse(receiptCompanyPhone)==null || sendCompanyPhone.length!=11 ||  receiptCompanyPhone.length!=11){
-          errStr='请输入正确的电话';
+        if (int.tryParse(sendCompanyPhone) == null || int.tryParse(receiptCompanyPhone) == null || sendCompanyPhone.length != 11 || receiptCompanyPhone.length != 11) {
+          errStr = '请输入正确的电话';
         }
         if (errStr != '') {
           showError(errStr);
@@ -767,65 +768,68 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
         setState(() {
           submitStatus = false;
         });
-        createOrder(
-          sendCompanyId, //寄件公司Id
-          sendCompanyName, //寄件公司名称 不能为空
-          sendCompanyPhone, //寄件公司电话 不能为空
-          sendCompanyCode ?? '', //寄件公司编码 
-          sendCompanyProvinceName, //寄件公司省名称 不能为空
-          sendCompanyProvinceCode, //寄件公司省编码 不能为空
-          sendCompanyCityName, //寄件公司市名称 不能为空
-          sendCompanyCityCode, //寄件公司市编码 不能为空
-          sendCompanyAreaName, //寄件公司区名称 不能为空
-          sendCompanyAreaCode, //寄件公司区编码 不能为空
-          sendCompanyAddress, //寄件公司详细地址,不能为空
-          receiptCompanyId, //收件公司id
-          receiptCompanyPhone, //收件公司电话 不能为空
-          receiptCompanyName, //收件公司名称 不能为空
-          receiptCompanyProvinceName, //收件公司省名称 不能为空
-          receiptCompanyProvinceCode, //收件公司省编码 不能为空
-          receiptCompanyCityName, //收件公司市名称 不能为空
-          receiptCompanyCityCode, //收件公市编码 不能为空
-          receiptCompanyAreaName, //收件公区名称 不能为空
-          receiptCompanyAreaCode, //收件公司区编码 不能为空
-          receiptCompanyAddress, //收件公司地址详情 不能为空
-          goods, //商品名称 不能为空
-          goodsQuantity, //商品数量 不能为空
-          goodsPackingId, //商品包装ID 
-          goodsCategoryId, //商品类别ID 
-          goodsPaymentMethod, //付款方式 1,现付  2 到付
-          goodsWeight, //商品重量 
-          goodsPriceProtection * 100, //商品保价,已分为单位
-          goodsAgencyFund * 100, //商品代收款,已分为单位
-          goodsFreight * 100, //商品运费 不能为空 ,已分为单位
-          memo, //备注
-        ).then((resp) {
-          if (isNotError(context, resp)) {
-            setState(() {
-              submitStatus = true;
-            });
-            CreateOrder orderObj = CreateOrder.fromJson(resp.data);
-            showDialog < Null > (
-              context: context, //BuildContext对象
-              barrierDismissible: false,
-              builder: (BuildContext context) {
-                return SendDialog( //调用对话框
-                  orderNo: orderObj.orderNo,
-                  childCallback: (val) {
-                    if (!val) {
-                      //跳转
-                      Navigator.push(context, MaterialPageRoute(builder: (context) {
-                        return OrderDetail(orderId: orderObj.orderNo, );
-                      }));
-                    }
-                  },
-                );
+        getKey('stationId').then((value) {
+          createOrder(
+            value,
+            sendCompanyId, //寄件公司Id
+            sendCompanyName, //寄件公司名称 不能为空
+            sendCompanyPhone, //寄件公司电话 不能为空
+            sendCompanyCode ?? '', //寄件公司编码 
+            sendCompanyProvinceName, //寄件公司省名称 不能为空
+            sendCompanyProvinceCode, //寄件公司省编码 不能为空
+            sendCompanyCityName, //寄件公司市名称 不能为空
+            sendCompanyCityCode, //寄件公司市编码 不能为空
+            sendCompanyAreaName, //寄件公司区名称 不能为空
+            sendCompanyAreaCode, //寄件公司区编码 不能为空
+            sendCompanyAddress, //寄件公司详细地址,不能为空
+            receiptCompanyId, //收件公司id
+            receiptCompanyPhone, //收件公司电话 不能为空
+            receiptCompanyName, //收件公司名称 不能为空
+            receiptCompanyProvinceName, //收件公司省名称 不能为空
+            receiptCompanyProvinceCode, //收件公司省编码 不能为空
+            receiptCompanyCityName, //收件公司市名称 不能为空
+            receiptCompanyCityCode, //收件公市编码 不能为空
+            receiptCompanyAreaName, //收件公区名称 不能为空
+            receiptCompanyAreaCode, //收件公司区编码 不能为空
+            receiptCompanyAddress, //收件公司地址详情 不能为空
+            goods, //商品名称 不能为空
+            goodsQuantity, //商品数量 不能为空
+            goodsPackingId, //商品包装ID 
+            goodsCategoryId, //商品类别ID 
+            goodsPaymentMethod, //付款方式 1,现付  2 到付
+            goodsWeight, //商品重量 
+            goodsPriceProtection * 100, //商品保价,已分为单位
+            goodsAgencyFund * 100, //商品代收款,已分为单位
+            goodsFreight * 100, //商品运费 不能为空 ,已分为单位
+            memo, //备注
+          ).then((resp) {
+            if (isNotError(context, resp)) {
+              setState(() {
+                submitStatus = true;
               });
-          } else {
-            setState(() {
-              submitStatus = true;
-            });
-          }
+              CreateOrder orderObj = CreateOrder.fromJson(resp.data);
+              showDialog < Null > (
+                context: context, //BuildContext对象
+                barrierDismissible: false,
+                builder: (BuildContext context) {
+                  return SendDialog( //调用对话框
+                    orderNo: orderObj.orderNo,
+                    childCallback: (val) {
+                      if (!val) {
+                        //跳转
+                        Navigator.push(context, MaterialPageRoute(builder: (context) {
+                          return OrderDetail(orderId: orderObj.orderNo, );
+                        }));
+                      }
+                    },
+                  );
+                });
+            } else {
+              setState(() {
+                submitStatus = true;
+              });
+            }
+          });
         });
       },
     );

+ 2 - 0
lib/util/api.dart

@@ -50,6 +50,7 @@ Future updataPasswrod(oldPassword, newPassword) async {
 
 //发件(创建订单)
 Future createOrder(
+  String statiodId,//司机站点id
   String sendCompanyId, //寄件公司Id
   String sendCompanyName, //寄件公司名称 不能为空
   String sendCompanyPhone, //寄件公司电话 不能为空
@@ -83,6 +84,7 @@ Future createOrder(
   String memo //备注
 ) async {
   var response = await Http().post('app/order/logistics_order_create', data: {
+    'stationId':statiodId,
     'sendCompanyId': sendCompanyId,
     'sendCompanyName': sendCompanyName,
     'sendCompanyPhone': sendCompanyPhone,