浏览代码

发件如果匹配到物品不弹选择线路框(当收件方是多线路情况下)

daxu0403 7 年之前
父节点
当前提交
3bef75e089
共有 1 个文件被更改,包括 21 次插入17 次删除
  1. 21 17
      lib/pages/send_express_page.dart

+ 21 - 17
lib/pages/send_express_page.dart

@@ -46,6 +46,7 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
   bool lineModalStatus = false;
   bool submitStatus = true;
   bool checkedLine = false;//当收件方有多条线路时,此状态表示是否已经选择过线路了
+  bool checkedGoodsName1 = false;//有没有选择货物
 
   String stationId;//司机端站点id
 
@@ -1236,8 +1237,8 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
         if (int.tryParse(goodsQuantity.toString()) == null) {
           errStr = '货物数量格式错误';
         }
-        if (goodsFreight == 0.0) {
-          errStr = '请填写运费';
+        if (goodsFreight < 0.0) {
+          errStr = '运费输入错误';
         }
         if (sendCompanyPhone == '' || receiptCompanyPhone == '' ) {
           errStr = '请输入正确的电话';
@@ -1252,7 +1253,7 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
           return;
         }
         
-        if(lineList.length>1 && !checkedLine){
+        if(lineList.length>1 && !checkedLine &&!checkedGoodsName1){
           showLineModal(lineList);
           return;
        }
@@ -1473,20 +1474,21 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
         return ShowLineModal( 
           lineList: list, childCallback: (val) {
               lineId = val;
-              goodsNameAccurate(stationId,goodsController.text,lineId).then((resp){
-                if(isNotError(context, resp) && this.mounted){
-                  if(resp.data['data']['goods']!=null){
-                    GoodsPriceList tempObj = GoodsPriceObjAccurate.fromJson(resp.data).data;
-                      setState(() {
-                        goods=tempObj.goods;
-                        goodsController.text = tempObj.goods;
-                        goodsFreight = tempObj.price/100;
-                        goodsFreightController.text = (tempObj.price/100).toString();
-                      });
-                  }
-                  checkedLine = true;
-                }
-              });
+               checkedLine = true;
+              // goodsNameAccurate(stationId,goodsController.text,lineId).then((resp){
+              //   if(isNotError(context, resp) && this.mounted){
+              //     if(resp.data['data']['goods']!=null){
+              //       GoodsPriceList tempObj = GoodsPriceObjAccurate.fromJson(resp.data).data;
+              //         setState(() {
+              //           goods=tempObj.goods;
+              //           goodsController.text = tempObj.goods;
+              //           goodsFreight = tempObj.price/100;
+              //           goodsFreightController.text = (tempObj.price/100).toString();
+              //         });
+              //     }
+                 
+              //   }
+              // });
           },
         );
       });
@@ -1651,6 +1653,8 @@ class _SendExpressPageState extends State < SendExpressPage > with AutomaticKeep
                 goodsController.text = obj.goods;
                 goodsFreight = (obj.price/100);
                 goodsFreightController.text = (obj.price/100).toString();
+                checkedGoodsName1 = true;
+                lineId = obj.lineId.toString();
               });
             },
           ),