luobang 2 年之前
父节点
当前提交
b064780f9b

+ 1 - 1
build/utils.js

@@ -17,7 +17,7 @@ const devPathSrc = path.resolve(__dirname, '../../../src') // node_modules应用
 //  'statisticalReport','systemConfig','TMS','WMS','workFlow','ADMINISTRATORS']
 
 let devModules = ['all']
-// let devModules = ['index', 'WMS']
+// let devModules = ['index', 'appoint']
 // let devModules = ['all']
 
 // let devModules = ['index', 'ADMINISTRATORS']

+ 277 - 300
src/views/appoint/components/saleContract/addSaleOrderCoproductSend.vue

@@ -344,9 +344,9 @@
 </template>
 
 <script>
-import PageTitle from "@/components/Page/Title";
-import { getCookie } from "@/utils/util.js";
-import { sjTime, isNumber, isIntegerNumber } from "@/utils/sharedJsFile";
+import PageTitle from '@/components/Page/Title'
+import { getCookie } from '@/utils/util.js'
+import { sjTime, isNumber, isIntegerNumber } from '@/utils/sharedJsFile'
 export default {
   components: { PageTitle },
   data() {
@@ -383,17 +383,17 @@ export default {
       //线路表格单选缓存数据的
       cacheLine: {
         ROW_ID: 0,
-        lineDesk: "",
+        lineDesk: '',
         lineId: 0,
-        lineName: "",
-        lineNo: "",
-        lineType: "",
+        lineName: '',
+        lineNo: '',
+        lineType: '',
         spellNumber: 0
       },
       //收货客户
-      consigneeCompanyName: "",
+      consigneeCompanyName: '',
       //是否自提
-      saleOrderIsselfMention: "",
+      saleOrderIsselfMention: '',
       //单价已选数量
       choosePriceCount: 0,
       //已经选择车辆物资信息
@@ -401,9 +401,9 @@ export default {
       //销售订单物资信息
       option: {
         // 表格请求数据的地址
-        requestUrl: "",
+        requestUrl: '',
         // 控制显示当选列
-        selectionType: "radio",
+        selectionType: 'radio',
         isPagination: false
       },
       //当前选中的物资id
@@ -423,61 +423,61 @@ export default {
       //线路的表格
       line: {
         requestUrl:
-          "/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con=" + "销售",
-        selectionType: "radio"
+          '/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con=' + '销售',
+        selectionType: 'radio'
       },
       //车辆的表格
       truck: {
-        requestUrl: "",
-        selectionType: "select"
+        requestUrl: '',
+        selectionType: 'select'
       },
       //运输单价的表格
       Address: {
-        requestUrl: "/api/v1/ams/getAddressDeliveryAddress?apiId=255",
-        selectionType: "radio"
+        requestUrl: '/api/v1/ams/getAddressDeliveryAddress?apiId=255',
+        selectionType: 'radio'
       },
       addressText: null,
       //线路表格的框计算输入的值
       lineText: null,
       tableTop: [
         {
-          prop: "capacityNumber",
-          label: "车牌号",
-          width: "130",
+          prop: 'capacityNumber',
+          label: '车牌号',
+          width: '130',
           slot: true
         },
         {
-          prop: "carrierName",
-          label: "承运商",
-          width: "240",
+          prop: 'carrierName',
+          label: '承运商',
+          width: '240',
           slot: true
         },
         {
-          prop: "materialName",
-          label: "物资名称",
-          width: "140"
+          prop: 'materialName',
+          label: '物资名称',
+          width: '140'
         },
         {
-          prop: "lineName",
-          label: "运输线路",
-          width: "220"
+          prop: 'lineName',
+          label: '运输线路',
+          width: '220'
         },
         {
-          prop: "orderPlanWeight",
-          label: "重量",
-          width: "140",
+          prop: 'orderPlanWeight',
+          label: '重量',
+          width: '140',
           slot: true
         },
         {
-          prop: "saleDateOfReceipt",
-          label: "截止日期",
-          width: "230",
+          prop: 'saleDateOfReceipt',
+          label: '截止日期',
+          width: '230',
           slot: true
         },
         {
-          prop: "priceValue",
-          label: "运输单价",
-          width: "300",
+          prop: 'priceValue',
+          label: '运输单价',
+          width: '300',
           slot: true
         },
         // {
@@ -487,16 +487,16 @@ export default {
         //   slot: true,
         // },
         {
-          prop: "saleOrderConsignee",
-          label: "收货人",
-          width: "150",
+          prop: 'saleOrderConsignee',
+          label: '收货人',
+          width: '150',
           slot: true
         },
         {
-          prop: "saleOrderConsigneeTel",
-          label: "收货客户电话号码",
+          prop: 'saleOrderConsigneeTel',
+          label: '收货客户电话号码',
           slot: true,
-          width: "150"
+          width: '150'
         }
       ],
       truckText: null,
@@ -510,131 +510,131 @@ export default {
       addressIndex: null
       //缓存当前选中的运输单价
       // priceMap:{},
-    };
+    }
   },
   created() {
-    if (getCookie("orgCode") == "chengyunshang") {
+    if (getCookie('orgCode') == 'chengyunshang') {
       this.truck.requestUrl =
-        "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
-        getCookie("userId");
+        '/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=' +
+        getCookie('userId')
     } else {
       this.truck.requestUrl =
-        "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" + null;
+        '/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=' + null
     }
     this.option.requestUrl =
-      "/api/v1/ams/getSaleOrderAndMaterialById?apiId=410&saleOrderId=" +
-      this.$route.params.saleOrderId;
-    this.initializeLine();
+      '/api/v1/ams/getSaleOrderAndMaterialById?apiId=410&saleOrderId=' +
+      this.$route.params.saleOrderId
+    this.initializeLine()
   },
   methods: {
     onInput(val) {
       if (!isNumber(val)) {
-        this.$message.warning("重量/电话号码请输入数字");
+        this.$message.warning('重量/电话号码请输入数字')
       }
     },
     //初始化线路
     initializeLine() {
       this.axios
         .post(
-          "/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con=" +
-            "销售副产品单拼路线"
+          '/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con=' +
+            '销售副产品单拼路线'
         )
         .then(res => {
           this.lineName =
             res.data.data.list[0].lineName +
-            "  " +
-            res.data.data.list[0].lineDesk;
-          this.lineId = res.data.data.list[0].lineId;
-        });
+            '  ' +
+            res.data.data.list[0].lineDesk
+          this.lineId = res.data.data.list[0].lineId
+        })
     },
     //校验是否为车牌
     isVehicleNumber(vehicleNumber) {
-      var result = false;
+      var result = false
       if (vehicleNumber != null) {
         if (vehicleNumber.length == 7) {
-          var express = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/;
-          result = express.test(vehicleNumber);
+          var express = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/
+          result = express.test(vehicleNumber)
         }
       }
-      return result;
+      return result
     },
     //填充承运商下拉框
     fillCarrier(capacityId) {
       this.axios
-        .get("/api/v1/uc/getCarrierByCapacityId?capacityId=" + capacityId)
+        .get('/api/v1/uc/getCarrierByCapacityId?capacityId=' + capacityId)
         .then(res => {
-          var carrierNameList = [];
-          carrierNameList = res.data.data;
-          this.carrierNameOptions.push(carrierNameList);
-        });
+          var carrierNameList = []
+          carrierNameList = res.data.data
+          this.carrierNameOptions.push(carrierNameList)
+        })
     },
     //绑定车牌号和承运商的关系
     bindRelationship(mapValue) {
       let RmsCapacity = {
         capacityTypeId: 1,
         capacityNumber: mapValue.capacityNumber,
-        capacityCorlor: "黄",
-        capacityOwneris: "否",
-        capacityVip: "否",
-        capacityBlacklist: "否",
+        capacityCorlor: '黄',
+        capacityOwneris: '否',
+        capacityVip: '否',
+        capacityBlacklist: '否',
         remark: null,
         carrierId: mapValue.carrierId,
         state: mapValue.carrierName
-      };
+      }
       this.$confirm(
-        "车牌号(" +
+        '车牌号(' +
           mapValue.capacityNumber +
-          ")与承运商未有绑定关系, 是否立即绑定该车牌号和承运商?",
-        "提示",
+          ')与承运商未有绑定关系, 是否立即绑定该车牌号和承运商?',
+        '提示',
         {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
         }
       )
         .then(() => {
           this.axios
-            .post("/api/v1/rms/insertCapacity", RmsCapacity)
+            .post('/api/v1/rms/insertCapacity', RmsCapacity)
             .then(res => {
               if (res.data.data == 0) {
-                this.$message.success("该车牌号与承运商绑定关系成功!");
+                this.$message.success('该车牌号与承运商绑定关系成功!')
               }
-            });
+            })
         })
         .catch(() => {
-          this.$message({ type: "info", message: "已取消" });
-        });
+          this.$message({ type: 'info', message: '已取消' })
+        })
     },
     //失焦事件后确定车牌号与承运商是否有绑定关系
     checkRelationship(index) {
       if (this.selectionList[index].carrierId != null) {
         //暂存车牌号
-        var capacityNumber1;
+        var capacityNumber1
         if (this.isVehicleNumber(this.selectionList[index].capacityNumber)) {
           let mapValue = {
             capacityNumber: this.selectionList[index].capacityNumber,
             carrierId: this.selectionList[index].carrierId,
             carrierName: this.selectionList[index].carrierName
-          };
+          }
           this.axios
-            .post("/api/v1/uc/isInCapacityCarrier", mapValue)
+            .post('/api/v1/uc/isInCapacityCarrier', mapValue)
             .then(res => {
-              if (res.data.code == "201") {
-                capacityNumber1 = res.data.data;
+              if (res.data.code == '201') {
+                capacityNumber1 = res.data.data
                 if (capacityNumber1 == null) {
-                  this.selectionList[index].capacityNumber = null;
-                  this.$message.error("该车牌号未注册,请先前往注册!");
+                  this.selectionList[index].capacityNumber = null
+                  this.$message.error('该车牌号未注册,请先前往注册!')
                 } else {
-                  this.bindRelationship(mapValue);
+                  this.bindRelationship(mapValue)
                 }
               }
-            });
+            })
         }
       }
     },
     //收货地址弹出层
     handleSelect1(item) {
-      console.log("获取所有下拉值!");
+      console.log('获取所有下拉值!')
     },
     //车牌号弹出层
     handleSelect(item) {
@@ -643,54 +643,54 @@ export default {
           capacityNumber: item.capacityNumber,
           carrierId: this.receiveCarrierId,
           carrierName: this.receiveCarrierName
-        };
+        }
         this.axios
-          .post("/api/v1/uc/isInCapacityCarrier", mapValue)
+          .post('/api/v1/uc/isInCapacityCarrier', mapValue)
           .then(res => {
-            if (res.data.code == "201") {
-              this.bindRelationship(mapValue);
+            if (res.data.code == '201') {
+              this.bindRelationship(mapValue)
             } else {
-              this.fillCarrier(item.capacityId);
+              this.fillCarrier(item.capacityId)
             }
-          });
+          })
       } else {
-        this.fillCarrier(item.capacityId);
+        this.fillCarrier(item.capacityId)
       }
     },
     //查询全国省市县
     selectAddresClick() {
       if (this.addresText) {
         this.Address.requestUrl =
-          "/api/v1/ams/getAddressDeliveryAddress?apiId=255&con=" +
-          this.addresText;
+          '/api/v1/ams/getAddressDeliveryAddress?apiId=255&con=' +
+          this.addresText
       } else {
         this.Address.requestUrl =
-          "/api/v1/ams/getAddressDeliveryAddress?apiId=255&i=" + new Date();
+          '/api/v1/ams/getAddressDeliveryAddress?apiId=255&i=' + new Date()
       }
     },
 
     //以下是车牌号边输边查搜索
     querySearch(queryString, cb) {
       this.axios
-        .post("/api/v1/uc/getCapacityByLike?index=" + queryString)
+        .post('/api/v1/uc/getCapacityByLike?index=' + queryString)
         .then(res => {
-          if (res.data.code == "200") {
-            var restaurants = res.data.data;
+          if (res.data.code == '200') {
+            var restaurants = res.data.data
             var results = queryString
               ? restaurants.filter(this.createFilter(queryString))
-              : restaurants;
+              : restaurants
             // 调用 callback 返回建议列表的数据
-            cb(results);
+            cb(results)
           }
-        });
+        })
     },
     createFilter(queryString) {
       return restaurants => {
         return (
           restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
           -1
-        );
-      };
+        )
+      }
     },
     //以上是车牌号边输边查搜索
 
@@ -698,112 +698,114 @@ export default {
     querySearch1(queryString, cb) {
       this.axios
         .post(
-          "/api/v1/ams/getRealAddressByLike?addressId=" +
+          '/api/v1/ams/getRealAddressByLike?addressId=' +
             this.addressId +
-            "&index=" +
+            '&index=' +
             queryString
         )
         .then(res => {
-          if (res.data.code == "200") {
-            var restaurants = res.data.data;
+          if (res.data.code == '200') {
+            var restaurants = res.data.data
             var results = queryString
               ? restaurants.filter(this.createFilter1(queryString))
-              : restaurants;
+              : restaurants
             // 调用 callback 返回建议列表的数据
-            cb(results);
+            cb(results)
           }
-        });
+        })
     },
     createFilter1(queryString) {
       return restaurants => {
         return (
           restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
           -1
-        );
-      };
+        )
+      }
     },
     //以上是收货地址边输边查搜索
 
     //点击确定按钮的事件
     makeSure() {
       //获取当前派车的数量和预估吨位的总和
-      var sendCount = this.selectionList.length * this.uniteOrderPlanWeight;
+      var sendCount = this.selectionList.length * this.uniteOrderPlanWeight
       //判断是否达到总重量减80吨的重量
-      var canDo = this.number - 80 - (this.totalWeight + sendCount);
+      var canDo = this.number - 80 - (this.totalWeight + sendCount)
       //判断钒渣剩余数量
-      var fKNum = this.number - (this.totalWeight + sendCount);
-      if (this.materialName != "钒渣" && canDo < 0 && this.number >= 100) {
-        var canSend = Math.floor(
-          (this.number - 80 - this.totalWeight) / this.uniteOrderPlanWeight
-        );
-        if (canSend < 0) {
-          canSend = 0;
-        }
-        this.$message.error(
-          "当前已派发吨数接近订单总吨数,最多还可派 (" + canSend + ") 辆车!"
-        );
-        return;
-      } else if (
-        this.materialName != "钒渣" &&
-        this.number < 100 &&
-        this.totalWeight > 20
-      ) {
-        this.$message.error("当前可派发车数已用完!");
-        return;
-      } else if (this.materialName == "钒渣" && fKNum < 0) {
-        this.$message.error(
-          "所派车辆超出订单数量,请减少车辆数,或联系销售重新制单"
-        );
-        return;
-      } else {
-        let state = false;
-        var beReady = 0;
+      var fKNum = this.number - (this.totalWeight + sendCount)
+      // if (this.materialName != '钒渣' && canDo < 0 && this.number >= 100) {
+      //   var canSend = Math.floor(
+      //     (this.number - 80 - this.totalWeight) / this.uniteOrderPlanWeight
+      //   )
+      //   if (canSend < 0) {
+      //     canSend = 0
+      //   }
+      //   this.$message.error(
+      //     '当前已派发吨数接近订单总吨数,最多还可派 (' + canSend + ') 辆车!'
+      //   )
+      //   // return;
+      // } else
+      // if (
+      //   this.materialName != '钒渣' &&
+      //   this.number < 100 &&
+      //   this.totalWeight > 20
+      // ) {
+      //   this.$message.error('当前可派发车数已用完!')
+      //   return
+      // } else if (this.materialName == '钒渣' && fKNum < 0) {
+      //   this.$message.error(
+      //     '所派车辆超出订单数量,请减少车辆数,或联系销售重新制单'
+      //   )
+      //   return
+      // } else
+      if (true) {
+        let state = false
+        var beReady = 0
         this.selectionList.forEach(e => {
           if (!isNumber(e.orderPlanWeight)) {
             //判定重量合法
-            this.$message.error("重量请输入数字");
+            this.$message.error('重量请输入数字')
           } else if (e.saleOrderConsigneeTel) {
             //判断电话号码合法
             if (!isNumber(e.saleOrderConsigneeTel)) {
-              this.$message.error("电话号码请输入数字");
+              this.$message.error('电话号码请输入数字')
             } else {
-              (e.saleOrderConsigneeTel = e.saleOrderConsigneeTel + ""),
-                (state = true);
+              ;(e.saleOrderConsigneeTel = e.saleOrderConsigneeTel + ''),
+                (state = true)
             }
           } else {
-            (e.saleOrderConsigneeTel = null), (state = true);
+            ;(e.saleOrderConsigneeTel = null), (state = true)
           }
           //其他条件
           if (e.saleDateOfReceipt) {
             //转化截止日期格式
-            e.saleDateOfReceipt = sjTime(e.saleDateOfReceipt);
+            e.saleDateOfReceipt = sjTime(e.saleDateOfReceipt)
           }
           if (isIntegerNumber(e.carrierName)) {
-            e.carrierId = e.carrierName;
+            e.carrierId = e.carrierName
           }
           if (e.capacityNumber) {
-            beReady++;
+            beReady++
           }
-        });
+        })
         if (state) {
           //校验是否自提,是自提,则运输单价必选,非自提,运输单价为空
-          if (this.saleOrderIsselfMention == "是") {
+          if (this.saleOrderIsselfMention == '是') {
             this.selectionList.forEach(e => {
-              e.priceValue = null;
-              e.priceId = null;
-            });
+              e.priceValue = null
+              e.priceId = null
+            })
             //发送请求
-            this.sendRequest(beReady);
+            this.sendRequest(beReady)
           } else {
             //判断是否全部完成运输单价的选择
             if (this.choosePriceCount == this.selectionList.length) {
-              this.sendRequest(beReady);
+              this.sendRequest(beReady)
             } else {
-              this.$message.warning("还有运输单价未被选定!");
+              this.$message.warning('还有运输单价未被选定!')
             }
           }
         } else {
-          this.$message.warning("重量/电话号码请输入数字");
+          this.$message.warning('重量/电话号码请输入数字')
         }
       }
     },
@@ -811,68 +813,44 @@ export default {
     sendRequest(beReady) {
       if (beReady == this.selectionList.length) {
         this.axios
-          .post("/api/v1/ams/dispatchTruckOrderBySale", {
+          .post('/api/v1/ams/dispatchTruckOrderBySale', {
             saleOrderId: this.$route.params.saleOrderId,
             mapList: this.selectionList
           })
           .then(res => {
-            if (res.data.code == "200") {
-              this.$message.success("派车成功");
-              this.cancel();
+            if (res.data.code == '200') {
+              this.$message.success('派车成功')
+              this.cancel()
             } else {
-              //若该销售订单的净重已达到97%!
-              this.$confirm(
-                "当前已派发吨数接近订单总吨数! 是否仍然派车",
-                "提示",
-                {
-                  confirmButtonText: "确定",
-                  cancelButtonText: "取消",
-                  type: "warning",
-                  center: true
-                }
-              )
-                .then(() => {
-                  this.axios
-                    .post("/api/v1/ams/dispatchTruckOrderBySale", {
-                      saleOrderId: this.$route.params.saleOrderId,
-                      sendAgain: 1,
-                      mapList: this.selectionList
-                    })
-                    .then(res => {
-                      if (res.data.code == "200") {
-                        this.$message.success("派车成功");
-                        this.cancel();
-                      }
-                    });
-                })
-                .catch(() => {
-                  this.$message({
-                    type: "info",
-                    message: "取消派车!"
-                  });
-                });
+              this.$message({
+                message:
+                  '该销售订单下:已过磅、已派发未过磅、当前未派发的吨位总和已超过销售订单吨位,请联系销售重新制单;或调节当前未派发吨位。',
+                duration: 3000,
+                offset: '250',
+                center: true
+              })
             }
-          });
+          })
       } else {
-        this.$message.error("还有车牌号未填写!");
+        this.$message.error('还有车牌号未填写!')
       }
     },
     //点击取消按钮的事件
     cancel() {
-      this.$router.push("/saleOrderCoproduct");
+      this.$router.push('/saleOrderCoproduct')
     },
     //点击删除按钮删除当前点击的对象
     deleteRow(index) {
-      this.selectionList.splice(index, 1);
+      this.selectionList.splice(index, 1)
     },
     //复制的方法
     copyRow(index, row) {
-      let arr = [];
-      let crr = [];
+      let arr = []
+      let crr = []
       for (var i = 0; i < this.selectionList.length; i++) {
         if (i == index) {
           //表格数复制
-          arr.push(this.selectionList[i]);
+          arr.push(this.selectionList[i])
           arr.push({
             capacityId: row.capacityId,
             capacityNumber: row.capacityNumber,
@@ -891,25 +869,25 @@ export default {
             place: row.place,
             priceValue: row.priceValue,
             priceId: row.priceId
-          });
+          })
           //下拉框数据复制
-          crr.push(this.carrierNameOptions[i]);
-          crr.push(this.carrierNameOptions[i]);
+          crr.push(this.carrierNameOptions[i])
+          crr.push(this.carrierNameOptions[i])
         } else {
-          arr.push(this.selectionList[i]);
-          crr.push(this.carrierNameOptions[i]);
+          arr.push(this.selectionList[i])
+          crr.push(this.carrierNameOptions[i])
         }
       }
-      this.selectionList = [];
-      this.selectionList = arr;
-      this.carrierNameOptions = [];
-      this.carrierNameOptions = crr;
+      this.selectionList = []
+      this.selectionList = arr
+      this.carrierNameOptions = []
+      this.carrierNameOptions = crr
     },
     //收货地址模态窗口的框计算
     selectAddressClick() {
       this.Address.requestUrl =
-        "/api/v1/ams/getAddressDeliveryAddress?apiId=255&con=" +
-        this.addressText;
+        '/api/v1/ams/getAddressDeliveryAddress?apiId=255&con=' +
+        this.addressText
     },
 
     //运输单价模态窗口的点击确定事件--------------
@@ -918,40 +896,40 @@ export default {
       let map = {
         place: this.place,
         addressId: this.addressId
-      };
-      this.axios.post("/api/v1/ams/getPriceMap", map).then(res => {
+      }
+      this.axios.post('/api/v1/ams/getPriceMap', map).then(res => {
         if (res.data.data.priceId == -1) {
           this.selectionList[
             this.addressIndex
-          ].saleShipperAddressId = this.addressId;
-          this.selectionList[this.addressIndex].place = this.place;
+          ].saleShipperAddressId = this.addressId
+          this.selectionList[this.addressIndex].place = this.place
           this.selectionList[this.addressIndex].priceValue =
-            "该区域尚未录入任何单价!";
-          this.selectionList[this.addressIndex].priceId = 0;
-          this.addAddressClickNext();
+            '该区域尚未录入任何单价!'
+          this.selectionList[this.addressIndex].priceId = 0
+          this.addAddressClickNext()
         } else {
           //赋值运输单价和运输单价ID
           this.selectionList[
             this.addressIndex
-          ].saleShipperAddressId = this.addressId;
-          this.selectionList[this.addressIndex].place = this.place;
+          ].saleShipperAddressId = this.addressId
+          this.selectionList[this.addressIndex].place = this.place
           this.selectionList[this.addressIndex].priceValue =
-            res.data.data.priceValue; //this.priceMap.priceValue
-          this.selectionList[this.addressIndex].priceId = res.data.data.priceId; //this.priceMap.priceId
-          this.addAddressClickNext();
+            res.data.data.priceValue //this.priceMap.priceValue
+          this.selectionList[this.addressIndex].priceId = res.data.data.priceId //this.priceMap.priceId
+          this.addAddressClickNext()
         }
-      });
+      })
     },
     //运输单价模态窗口的点击确定事件接续执行方法
     addAddressClickNext() {
-      this.addressDrawer = false;
-      let arr = this.selectionList;
-      this.selectionList = [];
+      this.addressDrawer = false
+      let arr = this.selectionList
+      this.selectionList = []
       //统计被选中的运输单价数量
-      var count = 0;
+      var count = 0
       arr.forEach(e => {
         if (e.priceValue) {
-          count++;
+          count++
         }
         this.selectionList.push({
           //销售订单与物资表主键
@@ -972,61 +950,61 @@ export default {
           place: e.place,
           priceValue: e.priceValue,
           priceId: e.priceId
-        });
-      });
-      console.log("this.selectionList222", this.selectionList);
+        })
+      })
+      console.log('this.selectionList222', this.selectionList)
       //赋值单价已选数量
-      this.choosePriceCount = count;
+      this.choosePriceCount = count
     },
 
     //收货地址点击浏览的事件
     select(index) {
-      this.addressDrawer = true;
-      this.addressIndex = index;
+      this.addressDrawer = true
+      this.addressIndex = index
     },
     //收货地址模态框单选选中的事件
     currentRadioChange2(val) {
       //若具体地址有值,清空值
       if (this.place != null) {
-        this.place = null;
+        this.place = null
       }
-      (this.address = val.address), (this.addressId = val.addressId);
+      ;(this.address = val.address), (this.addressId = val.addressId)
       // this.priceMap = {};
       // this.priceMap = val;
     },
     //派车数确定事件
     AddTruckClick() {
       if (!this.materialId) {
-        this.$message.warning("请选择物资后,再点击!");
+        this.$message.warning('请选择物资后,再点击!')
       } else if (!this.lineId) {
-        this.$message.warning("请选择线路后,再点击!");
+        this.$message.warning('请选择线路后,再点击!')
       } else if (!this.carNumber) {
-        this.$message.warning("请先输入派车数!");
+        this.$message.warning('请先输入派车数!')
       } else if (!this.uniteOrderPlanWeight) {
-        this.$message.warning("请先输入每车数量!");
+        this.$message.warning('请先输入每车数量!')
       } else if (!this.uniteSaleDateOfReceipt) {
-        this.$message.warning("请先输入截止日期!");
+        this.$message.warning('请先输入截止日期!')
       } else {
-        var i = 0;
+        var i = 0
         //给自提客户,即(承运商)赋值
         let mapValue = {
           isSelfMention: this.saleOrderIsselfMention,
           consigneeName: this.consigneeCompanyName
-        };
+        }
         this.axios
-          .post("/api/v1/uc/getCarrierByConsignee", mapValue)
+          .post('/api/v1/uc/getCarrierByConsignee', mapValue)
           .then(res => {
             if (res.data.data == null) {
-              this.receiveCarrierId = null;
-              this.receiveCarrierName = null;
-              this.$message.warning("该收货单位尚未注册为承运商!");
+              this.receiveCarrierId = null
+              this.receiveCarrierName = null
+              this.$message.warning('该收货单位尚未注册为承运商!')
             } else {
-              this.receiveCarrierId = res.data.data.carrierId;
-              this.receiveCarrierName = res.data.data.carrierName;
+              this.receiveCarrierId = res.data.data.carrierId
+              this.receiveCarrierName = res.data.data.carrierName
             }
             //若自提客户为四川西南水泥有限公司
-            if (this.receiveCarrierName == "四川西南水泥有限公司") {
-              this.axios.get("/api/v1/uc/getXiNanCarrier").then(res => {
+            if (this.receiveCarrierName == '四川西南水泥有限公司') {
+              this.axios.get('/api/v1/uc/getXiNanCarrier').then(res => {
                 //生成下方表单单元格
                 for (i = 0; i < this.carNumber; i++) {
                   this.selectionList.push({
@@ -1045,11 +1023,11 @@ export default {
                     priceValue: null,
                     priceId: null,
                     saleOrderConsignee: null
-                  });
-                  this.carrierNameOptions.push(res.data.data);
+                  })
+                  this.carrierNameOptions.push(res.data.data)
                 }
-                console.log("res.data.data", res.data.data);
-              });
+                console.log('res.data.data', res.data.data)
+              })
             } else {
               //生成下方表单单元格
               for (i = 0; i < this.carNumber; i++) {
@@ -1069,83 +1047,82 @@ export default {
                   priceValue: null,
                   priceId: null,
                   saleOrderConsignee: null
-                });
+                })
               }
             }
-          });
+          })
       }
     },
     //车辆模态框框计算
     selectTruckClick() {
-      if (getCookie("orgCode") == "chengyunshang") {
+      if (getCookie('orgCode') == 'chengyunshang') {
         this.truck.requestUrl =
-          "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
-          getCookie("userId") +
-          "&index=" +
-          this.truckText;
+          '/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=' +
+          getCookie('userId') +
+          '&index=' +
+          this.truckText
       } else {
         this.truck.requestUrl =
-          "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
+          '/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=' +
           null +
-          "&index=" +
-          this.truckText;
+          '&index=' +
+          this.truckText
       }
     },
     //车辆表格
     currentRadioChange1(select) {
-      this.selectTruck = [];
-      this.selectTruck = select;
+      this.selectTruck = []
+      this.selectTruck = select
     },
     //主界面表格单选
     currentRadioChange(row) {
-      this.consigneeCompanyName = row.consigneeCompanyName;
-      this.saleOrderIsselfMention = row.saleOrderIsselfMention;
-      this.materialId = row.materialId;
-      this.materialName = row.materialName;
-      this.saleMaterialId = row.saleMaterialId;
-      this.saleOrderId = row.saleOrderId;
-      this.totalWeight = row.totalWeight;
-      this.number = row.number;
+      this.consigneeCompanyName = row.consigneeCompanyName
+      this.saleOrderIsselfMention = row.saleOrderIsselfMention
+      this.materialId = row.materialId
+      this.materialName = row.materialName
+      this.saleMaterialId = row.saleMaterialId
+      this.saleOrderId = row.saleOrderId
+      this.totalWeight = row.totalWeight
+      this.number = row.number
     },
     //线路表格的单选事件
     currentRadioChange5(row) {
       //存在lineName,赋值,否则初始化
       if (row.lineName) {
-        this.cacheLine = row;
+        this.cacheLine = row
       } else {
         this.cacheLine = {
           ROW_ID: 0,
-          lineDesk: "",
+          lineDesk: '',
           lineId: 0,
-          lineName: "",
-          lineNo: "",
-          lineType: "",
+          lineName: '',
+          lineNo: '',
+          lineType: '',
           spellNumber: 0
-        };
+        }
       }
     },
     onClick(num) {
       if (num == 1) {
-        this.drawer = true;
-        this.lineText = null;
+        this.drawer = true
+        this.lineText = null
       }
     },
     //线路表格的框计算
     selectClick() {
       this.line.requestUrl =
-        "/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con=" + this.lineText;
+        '/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con=' + this.lineText
     },
     //线路表格的确定事件
     AddClick() {
-      if (this.cacheLine.lineName != "") {
-        this.drawer = false;
-        this.lineName =
-          this.cacheLine.lineName + "  " + this.cacheLine.lineDesk;
-        this.lineId = this.cacheLine.lineId;
+      if (this.cacheLine.lineName != '') {
+        this.drawer = false
+        this.lineName = this.cacheLine.lineName + '  ' + this.cacheLine.lineDesk
+        this.lineId = this.cacheLine.lineId
       }
     }
   }
-};
+}
 </script>
 
 <style lang="scss">

+ 274 - 296
src/views/appoint/components/saleContract/addSaleOrderCoproductSendCarrier.vue

@@ -344,9 +344,9 @@
 </template>
 
 <script>
-import PageTitle from "@/components/Page/Title";
-import { getCookie } from "@/utils/util.js";
-import { sjTime, isNumber, isIntegerNumber } from "@/utils/sharedJsFile";
+import PageTitle from '@/components/Page/Title'
+import { getCookie } from '@/utils/util.js'
+import { sjTime, isNumber, isIntegerNumber } from '@/utils/sharedJsFile'
 export default {
   components: { PageTitle },
   data() {
@@ -383,17 +383,17 @@ export default {
       //线路表格单选缓存数据的
       cacheLine: {
         ROW_ID: 0,
-        lineDesk: "",
+        lineDesk: '',
         lineId: 0,
-        lineName: "",
-        lineNo: "",
-        lineType: "",
+        lineName: '',
+        lineNo: '',
+        lineType: '',
         spellNumber: 0
       },
       //收货客户
-      consigneeCompanyName: "",
+      consigneeCompanyName: '',
       //是否自提
-      saleOrderIsselfMention: "",
+      saleOrderIsselfMention: '',
       //单价已选数量
       choosePriceCount: 0,
       //已经选择车辆物资信息
@@ -401,9 +401,9 @@ export default {
       //销售订单物资信息
       option: {
         // 表格请求数据的地址
-        requestUrl: "",
+        requestUrl: '',
         // 控制显示当选列
-        selectionType: "radio",
+        selectionType: 'radio',
         isPagination: false
       },
       //当前选中的物资id
@@ -423,61 +423,61 @@ export default {
       //线路的表格
       line: {
         requestUrl:
-          "/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con=" + "销售",
-        selectionType: "radio"
+          '/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con=' + '销售',
+        selectionType: 'radio'
       },
       //车辆的表格
       truck: {
-        requestUrl: "",
-        selectionType: "select"
+        requestUrl: '',
+        selectionType: 'select'
       },
       //运输单价的表格
       Address: {
-        requestUrl: "/api/v1/ams/getAddressDeliveryAddress?apiId=255",
-        selectionType: "radio"
+        requestUrl: '/api/v1/ams/getAddressDeliveryAddress?apiId=255',
+        selectionType: 'radio'
       },
       addressText: null,
       //线路表格的框计算输入的值
       lineText: null,
       tableTop: [
         {
-          prop: "capacityNumber",
-          label: "车牌号",
-          width: "130",
+          prop: 'capacityNumber',
+          label: '车牌号',
+          width: '130',
           slot: true
         },
         {
-          prop: "carrierName",
-          label: "承运商",
-          width: "240",
+          prop: 'carrierName',
+          label: '承运商',
+          width: '240',
           slot: true
         },
         {
-          prop: "materialName",
-          label: "物资名称",
-          width: "140"
+          prop: 'materialName',
+          label: '物资名称',
+          width: '140'
         },
         {
-          prop: "lineName",
-          label: "运输线路",
-          width: "220"
+          prop: 'lineName',
+          label: '运输线路',
+          width: '220'
         },
         {
-          prop: "orderPlanWeight",
-          label: "重量",
-          width: "140",
+          prop: 'orderPlanWeight',
+          label: '重量',
+          width: '140',
           slot: true
         },
         {
-          prop: "saleDateOfReceipt",
-          label: "截止日期",
-          width: "230",
+          prop: 'saleDateOfReceipt',
+          label: '截止日期',
+          width: '230',
           slot: true
         },
         {
-          prop: "priceValue",
-          label: "运输单价",
-          width: "300",
+          prop: 'priceValue',
+          label: '运输单价',
+          width: '300',
           slot: true
         },
         // {
@@ -487,16 +487,16 @@ export default {
         //   slot: true,
         // },
         {
-          prop: "saleOrderConsignee",
-          label: "收货人",
-          width: "150",
+          prop: 'saleOrderConsignee',
+          label: '收货人',
+          width: '150',
           slot: true
         },
         {
-          prop: "saleOrderConsigneeTel",
-          label: "收货客户电话号码",
+          prop: 'saleOrderConsigneeTel',
+          label: '收货客户电话号码',
           slot: true,
-          width: "150"
+          width: '150'
         }
       ],
       truckText: null,
@@ -510,132 +510,132 @@ export default {
       addressIndex: null
       //缓存当前选中的运输单价
       // priceMap:{},
-    };
+    }
   },
   created() {
-    if (getCookie("orgCode") == "chengyunshang") {
+    if (getCookie('orgCode') == 'chengyunshang') {
       this.truck.requestUrl =
-        "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
-        getCookie("userId");
+        '/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=' +
+        getCookie('userId')
     } else {
       this.truck.requestUrl =
-        "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" + null;
+        '/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=' + null
     }
     this.option.requestUrl =
-      "/api/v1/ams/getSaleOrderAndMaterialById?apiId=410&saleOrderId=" +
-      this.$route.params.saleOrderId;
-    this.initializeLine();
+      '/api/v1/ams/getSaleOrderAndMaterialById?apiId=410&saleOrderId=' +
+      this.$route.params.saleOrderId
+    this.initializeLine()
   },
   methods: {
     onInput(val) {
       if (!isNumber(val)) {
-        this.$message.warning("重量/电话号码请输入数字");
+        this.$message.warning('重量/电话号码请输入数字')
       }
     },
     //初始化线路
     initializeLine() {
       this.axios
         .post(
-          "/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con=" +
-            "销售副产品单拼路线"
+          '/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con=' +
+            '销售副产品单拼路线'
         )
         .then(res => {
           this.lineName =
             res.data.data.list[0].lineName +
-            "  " +
-            res.data.data.list[0].lineDesk;
-          this.lineId = res.data.data.list[0].lineId;
-        });
+            '  ' +
+            res.data.data.list[0].lineDesk
+          this.lineId = res.data.data.list[0].lineId
+        })
     },
     //校验是否为车牌
     isVehicleNumber(vehicleNumber) {
-      var result = false;
+      var result = false
       if (vehicleNumber != null) {
         if (vehicleNumber.length == 7) {
-          var express = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/;
-          result = express.test(vehicleNumber);
+          var express = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/
+          result = express.test(vehicleNumber)
         }
       }
-      return result;
+      return result
     },
     //填充承运商下拉框
     fillCarrier(capacityId) {
       this.axios
-        .get("/api/v1/uc/getCarrierByCapacityId?capacityId=" + capacityId)
+        .get('/api/v1/uc/getCarrierByCapacityId?capacityId=' + capacityId)
         .then(res => {
-          var carrierNameList = [];
-          carrierNameList = res.data.data;
-          this.carrierNameOptions.push(carrierNameList);
-        });
+          var carrierNameList = []
+          carrierNameList = res.data.data
+          this.carrierNameOptions.push(carrierNameList)
+        })
     },
     //绑定车牌号和承运商的关系
     bindRelationship(mapValue) {
       let RmsCapacity = {
         capacityTypeId: 1,
         capacityNumber: mapValue.capacityNumber,
-        capacityCorlor: "黄",
-        capacityOwneris: "否",
-        capacityVip: "否",
-        capacityBlacklist: "否",
+        capacityCorlor: '黄',
+        capacityOwneris: '否',
+        capacityVip: '否',
+        capacityBlacklist: '否',
         remark: null,
         carrierId: mapValue.carrierId,
         state: mapValue.carrierName
-      };
+      }
       this.$confirm(
-        "车牌号(" +
+        '车牌号(' +
           mapValue.capacityNumber +
-          ")与承运商未有绑定关系, 是否立即绑定该车牌号和承运商?",
-        "提示",
+          ')与承运商未有绑定关系, 是否立即绑定该车牌号和承运商?',
+        '提示',
         {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
         }
       )
         .then(() => {
           this.axios
-            .post("/api/v1/rms/insertCapacity", RmsCapacity)
+            .post('/api/v1/rms/insertCapacity', RmsCapacity)
             .then(res => {
-              this.$message.success("该车牌号与承运商绑定关系成功!");
-            });
+              this.$message.success('该车牌号与承运商绑定关系成功!')
+            })
         })
         .catch(() => {
           this.$message({
-            type: "info",
-            message: "已取消该车牌号与承运商绑定关系"
-          });
-        });
+            type: 'info',
+            message: '已取消该车牌号与承运商绑定关系'
+          })
+        })
     },
     //失焦事件后确定车牌号与承运商是否有绑定关系
     checkRelationship(index) {
       if (this.selectionList[index].carrierId != null) {
         //暂存车牌号
-        var capacityNumber1;
+        var capacityNumber1
         if (this.isVehicleNumber(this.selectionList[index].capacityNumber)) {
           let mapValue = {
             capacityNumber: this.selectionList[index].capacityNumber,
             carrierId: this.selectionList[index].carrierId,
             carrierName: this.selectionList[index].carrierName
-          };
+          }
           this.axios
-            .post("/api/v1/uc/isInCapacityCarrier", mapValue)
+            .post('/api/v1/uc/isInCapacityCarrier', mapValue)
             .then(res => {
-              if (res.data.code == "201") {
-                capacityNumber1 = res.data.data;
+              if (res.data.code == '201') {
+                capacityNumber1 = res.data.data
                 if (capacityNumber1 == null) {
-                  this.selectionList[index].capacityNumber = null;
-                  this.$message.error("该车牌号未注册,请先前往注册!");
+                  this.selectionList[index].capacityNumber = null
+                  this.$message.error('该车牌号未注册,请先前往注册!')
                 } else {
-                  this.bindRelationship(mapValue);
+                  this.bindRelationship(mapValue)
                 }
               }
-            });
+            })
         }
       }
     },
     //收货地址弹出层
     handleSelect1(item) {
-      console.log("获取所有下拉值!");
+      console.log('获取所有下拉值!')
     },
     //车牌号弹出层
     handleSelect(item) {
@@ -644,54 +644,54 @@ export default {
           capacityNumber: item.capacityNumber,
           carrierId: this.receiveCarrierId,
           carrierName: this.receiveCarrierName
-        };
+        }
         this.axios
-          .post("/api/v1/uc/isInCapacityCarrier", mapValue)
+          .post('/api/v1/uc/isInCapacityCarrier', mapValue)
           .then(res => {
-            if (res.data.code == "201") {
-              this.bindRelationship(mapValue);
+            if (res.data.code == '201') {
+              this.bindRelationship(mapValue)
             } else {
-              this.fillCarrier(item.capacityId);
+              this.fillCarrier(item.capacityId)
             }
-          });
+          })
       } else {
-        this.fillCarrier(item.capacityId);
+        this.fillCarrier(item.capacityId)
       }
     },
     //查询全国省市县
     selectAddresClick() {
       if (this.addresText) {
         this.Address.requestUrl =
-          "/api/v1/ams/getAddressDeliveryAddress?apiId=255&con=" +
-          this.addresText;
+          '/api/v1/ams/getAddressDeliveryAddress?apiId=255&con=' +
+          this.addresText
       } else {
         this.Address.requestUrl =
-          "/api/v1/ams/getAddressDeliveryAddress?apiId=255&i=" + new Date();
+          '/api/v1/ams/getAddressDeliveryAddress?apiId=255&i=' + new Date()
       }
     },
 
     //以下是车牌号边输边查搜索
     querySearch(queryString, cb) {
       this.axios
-        .post("/api/v1/uc/getCapacityByLike?index=" + queryString)
+        .post('/api/v1/uc/getCapacityByLike?index=' + queryString)
         .then(res => {
-          if (res.data.code == "200") {
-            var restaurants = res.data.data;
+          if (res.data.code == '200') {
+            var restaurants = res.data.data
             var results = queryString
               ? restaurants.filter(this.createFilter(queryString))
-              : restaurants;
+              : restaurants
             // 调用 callback 返回建议列表的数据
-            cb(results);
+            cb(results)
           }
-        });
+        })
     },
     createFilter(queryString) {
       return restaurants => {
         return (
           restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
           -1
-        );
-      };
+        )
+      }
     },
     //以上是车牌号边输边查搜索
 
@@ -699,180 +699,159 @@ export default {
     querySearch1(queryString, cb) {
       this.axios
         .post(
-          "/api/v1/ams/getRealAddressByLike?addressId=" +
+          '/api/v1/ams/getRealAddressByLike?addressId=' +
             this.addressId +
-            "&index=" +
+            '&index=' +
             queryString
         )
         .then(res => {
-          if (res.data.code == "200") {
-            var restaurants = res.data.data;
+          if (res.data.code == '200') {
+            var restaurants = res.data.data
             var results = queryString
               ? restaurants.filter(this.createFilter1(queryString))
-              : restaurants;
+              : restaurants
             // 调用 callback 返回建议列表的数据
-            cb(results);
+            cb(results)
           }
-        });
+        })
     },
     createFilter1(queryString) {
       return restaurants => {
         return (
           restaurants.value.toLowerCase().indexOf(queryString.toLowerCase()) >
           -1
-        );
-      };
+        )
+      }
     },
     //以上是收货地址边输边查搜索
     //点击确定按钮的事件
     makeSure() {
       //获取当前派车的数量和预估吨位的总和
-      var sendCount = this.selectionList.length * this.uniteOrderPlanWeight;
+      var sendCount = this.selectionList.length * this.uniteOrderPlanWeight
       //判断是否达到总重量减80吨的重量
-      var canDo = this.number - 80 - (this.totalWeight + sendCount);
+      var canDo = this.number - 80 - (this.totalWeight + sendCount)
       //判断钒渣剩余数量
-      var fKNum = this.number - (this.totalWeight + sendCount);
-      if (this.materialName != "钒渣" && canDo < 0 && this.number >= 100) {
-        var canSend = Math.floor(
-          (this.number - 80 - this.totalWeight) / this.uniteOrderPlanWeight
-        );
-        if (canSend < 0) {
-          canSend = 0;
-        }
-        this.$message.error(
-          "当前已派发吨数接近订单总吨数,最多还可派 (" + canSend + ") 辆车!"
-        );
-        return;
-      } else if (
-        this.materialName != "钒渣" &&
-        this.number < 100 &&
-        this.totalWeight > 20
-      ) {
-        this.$message.error("当前可派发车数已用完!");
-        return;
-      } else if (this.materialName == "钒渣" && fKNum < 0) {
-        this.$message.error(
-          "所派车辆超出订单数量,请减少车辆数,或联系销售重新制单"
-        );
-        return;
-      } else {
-        let state = false;
-        var beReady = 0;
+      var fKNum = this.number - (this.totalWeight + sendCount)
+      // if (this.materialName != "钒渣" && canDo < 0 && this.number >= 100) {
+      //   var canSend = Math.floor(
+      //     (this.number - 80 - this.totalWeight) / this.uniteOrderPlanWeight
+      //   );
+      //   if (canSend < 0) {
+      //     canSend = 0;
+      //   }
+      //   this.$message.error(
+      //     "当前已派发吨数接近订单总吨数,最多还可派 (" + canSend + ") 辆车!"
+      //   );
+      //   return;
+      // } else if (
+      //   this.materialName != "钒渣" &&
+      //   this.number < 100 &&
+      //   this.totalWeight > 20
+      // ) {
+      //   this.$message.error("当前可派发车数已用完!");
+      //   return;
+      // } else if (this.materialName == "钒渣" && fKNum < 0) {
+      //   this.$message.error(
+      //     "所派车辆超出订单数量,请减少车辆数,或联系销售重新制单"
+      //   );
+      //   return;
+      // }
+      if (true) {
+        let state = false
+        var beReady = 0
         this.selectionList.forEach(e => {
           if (!isNumber(e.orderPlanWeight)) {
             //判定重量合法
-            this.$message.error("重量请输入数字");
+            this.$message.error('重量请输入数字')
           } else if (e.saleOrderConsigneeTel) {
             //判断电话号码合法
             if (!isNumber(e.saleOrderConsigneeTel)) {
-              this.$message.error("电话号码请输入数字");
+              this.$message.error('电话号码请输入数字')
             } else {
-              (e.saleOrderConsigneeTel = e.saleOrderConsigneeTel + ""),
-                (state = true);
+              e.saleOrderConsigneeTel = e.saleOrderConsigneeTel + ''
+              state = true
             }
           } else {
-            (e.saleOrderConsigneeTel = null), (state = true);
+            e.saleOrderConsigneeTel = null
+            state = true
           }
           //其他条件
           if (e.saleDateOfReceipt) {
             //转化截止日期格式
-            e.saleDateOfReceipt = sjTime(e.saleDateOfReceipt);
+            e.saleDateOfReceipt = sjTime(e.saleDateOfReceipt)
           }
           if (isIntegerNumber(e.carrierName)) {
-            e.carrierId = e.carrierName;
+            e.carrierId = e.carrierName
           }
           if (e.capacityNumber) {
-            beReady++;
+            beReady++
           }
-        });
+        })
         if (state) {
           //校验是否自提,是自提,则运输单价必选,非自提,运输单价为空
-          if (this.saleOrderIsselfMention == "是") {
+          if (this.saleOrderIsselfMention == '是') {
             this.selectionList.forEach(e => {
-              e.priceValue = null;
-              e.priceId = null;
-            });
-            this.sendRequest(beReady);
+              e.priceValue = null
+              e.priceId = null
+            })
+            this.sendRequest(beReady)
           } else {
             //判断是否全部完成运输单价的选择
             if (this.choosePriceCount == this.selectionList.length) {
-              this.sendRequest(beReady);
+              this.sendRequest(beReady)
             } else {
-              this.$message.warning("还有运输单价未被选定!");
+              this.$message.warning('还有运输单价未被选定!')
             }
           }
         } else {
-          this.$message.warning("重量/电话号码请输入数字");
+          this.$message.warning('重量/电话号码请输入数字')
         }
       }
     },
     //发送请求
     sendRequest(beReady) {
-      console.log("send");
+      console.log('send')
       if (beReady == this.selectionList.length) {
         this.axios
-          .post("/api/v1/ams/dispatchTruckOrderBySale", {
+          .post('/api/v1/ams/dispatchTruckOrderBySale', {
             saleOrderId: this.$route.params.saleOrderId,
             mapList: this.selectionList
           })
           .then(res => {
-            if (res.data.code == "200") {
-              this.$message.success("派车成功");
-              this.cancel();
+            if (res.data.code == '200') {
+              this.$message.success('派车成功')
+              this.cancel()
             } else {
               //若该销售订单的净重已达到97%!
-              this.$confirm(
-                "当前已派发吨数接近订单总吨数! 是否仍然派车",
-                "提示",
-                {
-                  confirmButtonText: "确定",
-                  cancelButtonText: "取消",
-                  type: "warning",
-                  center: true
-                }
-              )
-                .then(() => {
-                  this.axios
-                    .post("/api/v1/ams/dispatchTruckOrderBySale", {
-                      saleOrderId: this.$route.params.saleOrderId,
-                      sendAgain: 1,
-                      mapList: this.selectionList
-                    })
-                    .then(res => {
-                      if (res.data.code == "200") {
-                        this.$message.success("派车成功");
-                        this.cancel();
-                      }
-                    });
-                })
-                .catch(() => {
-                  this.$message({
-                    type: "info",
-                    message: "取消派车!"
-                  });
-                });
+              this.$message({
+                message:
+                  '该销售订单下:已过磅、已派发未过磅、当前未派发的吨位总和已超过销售订单吨位,请联系销售重新制单;或调节当前未派发吨位。',
+                duration: 3000,
+                offset: '250',
+                center: true
+              })
             }
-          });
+          })
       } else {
-        this.$message.error("还有车牌号未填写!");
+        this.$message.error('还有车牌号未填写!')
       }
     },
     //点击取消按钮的事件
     cancel() {
-      this.$router.push("/saleOrderCoproductCarrier");
+      this.$router.push('/saleOrderCoproductCarrier')
     },
     //点击删除按钮删除当前点击的对象
     deleteRow(index) {
-      this.selectionList.splice(index, 1);
+      this.selectionList.splice(index, 1)
     },
     //复制的方法
     copyRow(index, row) {
-      let arr = [];
-      let crr = [];
+      let arr = []
+      let crr = []
       for (var i = 0; i < this.selectionList.length; i++) {
         if (i == index) {
           //表格数复制
-          arr.push(this.selectionList[i]);
+          arr.push(this.selectionList[i])
           arr.push({
             capacityId: row.capacityId,
             capacityNumber: row.capacityNumber,
@@ -891,25 +870,25 @@ export default {
             place: row.place,
             priceValue: row.priceValue,
             priceId: row.priceId
-          });
+          })
           //下拉框数据复制
-          crr.push(this.carrierNameOptions[i]);
-          crr.push(this.carrierNameOptions[i]);
+          crr.push(this.carrierNameOptions[i])
+          crr.push(this.carrierNameOptions[i])
         } else {
-          arr.push(this.selectionList[i]);
-          crr.push(this.carrierNameOptions[i]);
+          arr.push(this.selectionList[i])
+          crr.push(this.carrierNameOptions[i])
         }
       }
-      this.selectionList = [];
-      this.selectionList = arr;
-      this.carrierNameOptions = [];
-      this.carrierNameOptions = crr;
+      this.selectionList = []
+      this.selectionList = arr
+      this.carrierNameOptions = []
+      this.carrierNameOptions = crr
     },
     //收货地址模态窗口的框计算
     selectAddressClick() {
       this.Address.requestUrl =
-        "/api/v1/ams/getAddressDeliveryAddress?apiId=255&con=" +
-        this.addressText;
+        '/api/v1/ams/getAddressDeliveryAddress?apiId=255&con=' +
+        this.addressText
     },
 
     //运输单价模态窗口的点击确定事件--------------
@@ -918,40 +897,40 @@ export default {
       let map = {
         place: this.place,
         addressId: this.addressId
-      };
-      this.axios.post("/api/v1/ams/getPriceMap", map).then(res => {
+      }
+      this.axios.post('/api/v1/ams/getPriceMap', map).then(res => {
         if (res.data.data.priceId == -1) {
           this.selectionList[
             this.addressIndex
-          ].saleShipperAddressId = this.addressId;
-          this.selectionList[this.addressIndex].place = this.place;
+          ].saleShipperAddressId = this.addressId
+          this.selectionList[this.addressIndex].place = this.place
           this.selectionList[this.addressIndex].priceValue =
-            "该区域尚未录入任何单价!";
-          this.selectionList[this.addressIndex].priceId = 0;
-          this.addAddressClickNext();
+            '该区域尚未录入任何单价!'
+          this.selectionList[this.addressIndex].priceId = 0
+          this.addAddressClickNext()
         } else {
           //赋值运输单价和运输单价ID
           this.selectionList[
             this.addressIndex
-          ].saleShipperAddressId = this.addressId;
-          this.selectionList[this.addressIndex].place = this.place;
+          ].saleShipperAddressId = this.addressId
+          this.selectionList[this.addressIndex].place = this.place
           this.selectionList[this.addressIndex].priceValue =
-            res.data.data.priceValue; //this.priceMap.priceValue
-          this.selectionList[this.addressIndex].priceId = res.data.data.priceId; //this.priceMap.priceId
-          this.addAddressClickNext();
+            res.data.data.priceValue //this.priceMap.priceValue
+          this.selectionList[this.addressIndex].priceId = res.data.data.priceId //this.priceMap.priceId
+          this.addAddressClickNext()
         }
-      });
+      })
     },
     //运输单价模态窗口的点击确定事件接续执行方法
     addAddressClickNext() {
-      this.addressDrawer = false;
-      let arr = this.selectionList;
-      this.selectionList = [];
+      this.addressDrawer = false
+      let arr = this.selectionList
+      this.selectionList = []
       //统计被选中的运输单价数量
-      var count = 0;
+      var count = 0
       arr.forEach(e => {
         if (e.priceValue) {
-          count++;
+          count++
         }
         this.selectionList.push({
           //销售订单与物资表主键
@@ -972,55 +951,55 @@ export default {
           place: e.place,
           priceValue: e.priceValue,
           priceId: e.priceId
-        });
-      });
-      console.log("this.selectionList222", this.selectionList);
+        })
+      })
+      console.log('this.selectionList222', this.selectionList)
       //赋值单价已选数量
-      this.choosePriceCount = count;
+      this.choosePriceCount = count
     },
 
     //收货地址点击浏览的事件
     select(index) {
-      this.addressDrawer = true;
-      this.addressIndex = index;
+      this.addressDrawer = true
+      this.addressIndex = index
     },
     //收货地址模态框单选选中的事件
     currentRadioChange2(val) {
       //若具体地址有值,清空值
       if (this.place != null) {
-        this.place = null;
+        this.place = null
       }
-      (this.address = val.address), (this.addressId = val.addressId);
+      ;(this.address = val.address), (this.addressId = val.addressId)
       // this.priceMap = {};
       // this.priceMap = val;
     },
     //派车数确定事件
     AddTruckClick() {
       if (!this.materialId) {
-        this.$message.warning("请选择物资后,再点击!");
+        this.$message.warning('请选择物资后,再点击!')
       } else if (!this.lineId) {
-        this.$message.warning("请选择线路后,再点击!");
+        this.$message.warning('请选择线路后,再点击!')
       } else if (!this.carNumber) {
-        this.$message.warning("请先输入派车数!");
+        this.$message.warning('请先输入派车数!')
       } else if (!this.uniteOrderPlanWeight) {
-        this.$message.warning("请先输入每车数量!");
+        this.$message.warning('请先输入每车数量!')
       } else if (!this.uniteSaleDateOfReceipt) {
-        this.$message.warning("请先输入截止日期!");
+        this.$message.warning('请先输入截止日期!')
       } else {
-        var i = 0;
+        var i = 0
         this.axios
           .get(
-            "/api/v1/uc/getRmsCarrierByCarrierSsoId?carrierSsoId=" +
-              getCookie("userId")
+            '/api/v1/uc/getRmsCarrierByCarrierSsoId?carrierSsoId=' +
+              getCookie('userId')
           )
           .then(res => {
             if (res.data.data == null) {
-              this.receiveCarrierId = null;
-              this.receiveCarrierName = null;
-              this.$message.warning("该账号未注册为承运商!");
+              this.receiveCarrierId = null
+              this.receiveCarrierName = null
+              this.$message.warning('该账号未注册为承运商!')
             } else {
-              this.receiveCarrierId = res.data.data.carrierId;
-              this.receiveCarrierName = res.data.data.carrierName;
+              this.receiveCarrierId = res.data.data.carrierId
+              this.receiveCarrierName = res.data.data.carrierName
             }
             //生成下方表单单元格
             for (i = 0; i < this.carNumber; i++) {
@@ -1040,82 +1019,81 @@ export default {
                 priceValue: null,
                 priceId: null,
                 saleOrderConsignee: null
-              });
+              })
             }
-          });
+          })
       }
     },
     //车辆模态框框计算
     selectTruckClick() {
-      if (getCookie("orgCode") == "chengyunshang") {
+      if (getCookie('orgCode') == 'chengyunshang') {
         this.truck.requestUrl =
-          "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
-          getCookie("userId") +
-          "&index=" +
-          this.truckText;
+          '/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=' +
+          getCookie('userId') +
+          '&index=' +
+          this.truckText
       } else {
         this.truck.requestUrl =
-          "/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=" +
+          '/api/v1/uc/getAllCapacityByCarrierLike?apiId=248&carrierSsoId=' +
           null +
-          "&index=" +
-          this.truckText;
+          '&index=' +
+          this.truckText
       }
     },
     //车辆表格
     currentRadioChange1(select) {
-      this.selectTruck = [];
-      this.selectTruck = select;
+      this.selectTruck = []
+      this.selectTruck = select
     },
     //主界面表格单选
     currentRadioChange(row) {
-      this.consigneeCompanyName = row.consigneeCompanyName;
-      this.saleOrderIsselfMention = row.saleOrderIsselfMention;
-      this.materialId = row.materialId;
-      this.materialName = row.materialName;
-      this.saleMaterialId = row.saleMaterialId;
-      this.saleOrderId = row.saleOrderId;
-      this.totalWeight = row.totalWeight;
-      this.number = row.number;
+      this.consigneeCompanyName = row.consigneeCompanyName
+      this.saleOrderIsselfMention = row.saleOrderIsselfMention
+      this.materialId = row.materialId
+      this.materialName = row.materialName
+      this.saleMaterialId = row.saleMaterialId
+      this.saleOrderId = row.saleOrderId
+      this.totalWeight = row.totalWeight
+      this.number = row.number
     },
     //线路表格的单选事件
     currentRadioChange5(row) {
       //存在lineName,赋值,否则初始化
       if (row.lineName) {
-        this.cacheLine = row;
+        this.cacheLine = row
       } else {
         this.cacheLine = {
           ROW_ID: 0,
-          lineDesk: "",
+          lineDesk: '',
           lineId: 0,
-          lineName: "",
-          lineNo: "",
-          lineType: "",
+          lineName: '',
+          lineNo: '',
+          lineType: '',
           spellNumber: 0
-        };
+        }
       }
     },
     onClick(num) {
       if (num == 1) {
-        this.drawer = true;
-        this.lineText = null;
+        this.drawer = true
+        this.lineText = null
       }
     },
     //线路表格的框计算
     selectClick() {
       this.line.requestUrl =
-        "/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con=" + this.lineText;
+        '/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con=' + this.lineText
     },
     //线路表格的确定事件
     AddClick() {
-      if (this.cacheLine.lineName != "") {
-        this.drawer = false;
-        this.lineName =
-          this.cacheLine.lineName + "  " + this.cacheLine.lineDesk;
-        this.lineId = this.cacheLine.lineId;
+      if (this.cacheLine.lineName != '') {
+        this.drawer = false
+        this.lineName = this.cacheLine.lineName + '  ' + this.cacheLine.lineDesk
+        this.lineId = this.cacheLine.lineId
       }
     }
   }
-};
+}
 </script>
 
 <style lang="scss">

+ 7 - 32
src/views/appoint/components/saleContract/addSaleOrderSend.vue

@@ -563,38 +563,13 @@ export default {
             this.$message.success('派车成功')
             this.cancel()
           } else {
-            //若该销售订单的净重已达到97%!
-            this.$confirm(
-              '该销售订单下已派重量与净重之和已超过97%! 是否仍然派车',
-              '提示',
-              {
-                confirmButtonText: '确定',
-                cancelButtonText: '取消',
-                type: 'warning',
-                center: true
-              }
-            )
-              .then(() => {
-                this.axios
-                  .post('/api/v1/ams/dispatchTruckOrderBySale', {
-                    saleOrderId: this.$route.params.saleOrderId,
-                    sendAgain: 1,
-                    mapList: this.selectionList,
-                    userName: getCookie('loginName')
-                  })
-                  .then(res => {
-                    if (res.data.code == '200') {
-                      this.$message.success('派车成功')
-                      this.cancel()
-                    }
-                  })
-              })
-              .catch(() => {
-                this.$message({
-                  type: 'info',
-                  message: '取消派车!'
-                })
-              })
+            this.$message({
+              message:
+                '该销售订单下:已过磅、已派发未过磅、当前未派发的吨位总和已超过销售订单吨位,请联系销售重新制单;或调节当前未派发吨位。',
+              duration: 3000,
+              offset: '250',
+              center: true
+            })
           }
         })
     },