luobang před 2 roky
rodič
revize
dfe306dea3

+ 111 - 95
src/views/sale/components/transportFreight/saleTruckSettlement/bmsTruckDetailsOrderNew.vue

@@ -123,12 +123,20 @@
           </el-button>
         </el-form-item>
         <el-form-item v-show="activeName == 'first'">
-          <el-button type="primary" @click="openDetails"  v-if="!notRoutList.includes('uploadDetails')">
+          <el-button
+            type="primary"
+            @click="openDetails"
+            v-if="!notRoutList.includes('uploadDetails')"
+          >
             <i class="el-icon-circle-check"></i>直接修改单价
           </el-button>
         </el-form-item>
-         <el-form-item v-show="activeName == 'first'">
-          <el-button type="primary" @click="openDetailsAdd"  v-if="!notRoutList.includes('uploadDetails')">
+        <el-form-item v-show="activeName == 'first'">
+          <el-button
+            type="primary"
+            @click="openDetailsAdd"
+            v-if="!notRoutList.includes('uploadDetails')"
+          >
             <i class="el-icon-circle-check"></i>冲红
           </el-button>
         </el-form-item>
@@ -381,11 +389,14 @@
                 show-overflow-tooltip
               >
                 <template slot-scope="scope">
-                  <el-button @click="showPhoto(scope.row)" type="text" size="small">
-                    {{scope.row.detailsRemark}}
+                  <el-button
+                    @click="showPhoto(scope.row)"
+                    type="text"
+                    size="small"
+                  >
+                    {{ scope.row.detailsRemark }}
                   </el-button>
                 </template>
-
               </el-table-column>
             </el-table>
           </div>
@@ -613,18 +624,21 @@
                 show-overflow-tooltip
               >
               </el-table-column>
-               <el-table-column
+              <el-table-column
                 prop="detailsRemark"
                 label="直接修改备注"
                 width="120px"
                 show-overflow-tooltip
               >
                 <template slot-scope="scope">
-                  <el-button @click="showPhoto(scope.row)" type="text" size="small">
-                    {{scope.row.detailsRemark}}
+                  <el-button
+                    @click="showPhoto(scope.row)"
+                    type="text"
+                    size="small"
+                  >
+                    {{ scope.row.detailsRemark }}
                   </el-button>
                 </template>
-
               </el-table-column>
             </el-table>
           </div>
@@ -867,15 +881,12 @@
           ></el-input>
         </el-form-item>
         <el-form-item label="修改备注">
-          <el-input
-            v-model="detailRemark"
-            style="width:200px"
-          ></el-input>
+          <el-input v-model="detailRemark" style="width:200px"></el-input>
         </el-form-item>
         <el-form-item label="凭证图片" style="">
           <el-upload
             ref="detailsUpload"
-            action='noAction'
+            action="noAction"
             list-type="picture-card"
             :limit="10"
             :on-change="fileChange2"
@@ -896,10 +907,7 @@
         >确定</el-button
       >
     </el-dialog>
-    <el-dialog
-      title="冲红"
-      :visible.sync="showDetailsAdd"
-    >
+    <el-dialog title="冲红" :visible.sync="showDetailsAdd">
       <el-form style="margin-left:20%">
         <el-form-item label="冲红金额">
           <el-input
@@ -909,10 +917,7 @@
           ></el-input>
         </el-form-item>
         <el-form-item label="冲红备注">
-          <el-input
-            v-model="detailRemark"
-            style="width:200px"
-          ></el-input>
+          <el-input v-model="detailRemark" style="width:200px"></el-input>
         </el-form-item>
       </el-form>
       <el-button
@@ -929,9 +934,15 @@
     <el-dialog
       title="查看凭证"
       :visible.sync="showPhotoPreview"
-      :before-close=" ()=>showPhotoPreview=false "
+      :before-close="() => (showPhotoPreview = false)"
     >
-        <img width="100%"  v-for="(item,index) in previewList" :key="index" :src="item" alt="" />
+      <img
+        width="100%"
+        v-for="(item, index) in previewList"
+        :key="index"
+        :src="item"
+        alt=""
+      />
     </el-dialog>
   </div>
 </template>
@@ -1251,13 +1262,13 @@ export default {
       excludeTax: null,
       statementList: [],
       showStatementUpLoad: false,
-      detailAmount:null,
-      detailsList:[],
-      showDetailsUpLoad:false,
-      showDetailsAdd:false,
-      detailRemark:null,
-      showPhotoPreview:false,
-      previewList:[],
+      detailAmount: null,
+      detailsList: [],
+      showDetailsUpLoad: false,
+      showDetailsAdd: false,
+      detailRemark: null,
+      showPhotoPreview: false,
+      previewList: [],
       selecteddetailsOrderAmount: 0,
       scrollLeft: 0,
       scrollLeft1: 0,
@@ -1606,22 +1617,22 @@ export default {
       console.log('确认执行价的顺序')
       console.log(this.makeSurePriceOrderList)
       console.log(map)
-      let flag = 0
-      this.someOnePriceValueList.forEach(e => {
-        if (e.detailsAmount == null) {
-          console.log('进入了flag++')
-          flag++
-        }
-      })
-      if (flag != 0) {
-        this.$message({
-          type: 'error',
-          message: '没有最终运费',
-          duration: 2000,
-          offset: '250'
-        })
-        return
-      }
+      // let flag = 0
+      // this.someOnePriceValueList.forEach(e => {
+      //   if (e.detailsAmount == null) {
+      //     console.log('进入了flag++')
+      //     flag++
+      //   }
+      // })
+      // if (flag != 0) {
+      //   this.$message({
+      //     type: 'error',
+      //     message: '没有最终运费',
+      //     duration: 2000,
+      //     offset: '250'
+      //   })
+      //   return
+      // }
       console.log('确认执行价的顺序')
       console.log(this.makeSurePriceOrderList)
       console.log(map)
@@ -1672,13 +1683,15 @@ export default {
         if (this.setteldAllselectValue == 1) {
           data = this.tableData1
         } else {
-          let orderList= [];
-          this.$refs.tableRef1.selection.forEach((item)=>{
-            orderList.push(item.orderId);
-          });
-          console.log("orderList",orderList);
-          console.log("tableData1",this.tableData1);
-          data = this.tableData1.filter(item => orderList.indexOf(item.orderId)>=0);
+          let orderList = []
+          this.$refs.tableRef1.selection.forEach(item => {
+            orderList.push(item.orderId)
+          })
+          console.log('orderList', orderList)
+          console.log('tableData1', this.tableData1)
+          data = this.tableData1.filter(
+            item => orderList.indexOf(item.orderId) >= 0
+          )
         }
         console.log(data, 'data')
         this.selecteddetailsOrderAmount = data.reduce((prev, item) => {
@@ -1750,7 +1763,7 @@ export default {
         this.$refs.tableRef.selection.length != 1
       ) {
         this.$message.warning('请选择需要上传凭证的订单,一次只允许修改一个')
-        return;
+        return
       } else {
         this.detailAmount = null
         this.detailRemark = null
@@ -1761,17 +1774,17 @@ export default {
         } else {
           data = this.$refs.tableRef.selection
         }
-        for(let i=0;i<data.length;i++){
-          if(!data[i].orderId || !data[i].netWeight){
+        for (let i = 0; i < data.length; i++) {
+          if (!data[i].orderId || !data[i].netWeight) {
             this.$message.warning('没有派发运单,或没有净重,无法修改此项')
-            return;
+            return
           }
         }
         this.showDetailsUpLoad = true
       }
     },
-    updateTruckDetail(){
-        this.isLoading = true
+    updateTruckDetail() {
+      this.isLoading = true
       if (!this.detailAmount || !this.detailRemark) {
         this.$message.warning('请填写所有信息!')
         this.isLoading = false
@@ -1787,15 +1800,15 @@ export default {
         })
         console.log(orderList, 'orderList')
         let formData = new window.FormData()
-        if(this.detailsList){
-          this.detailsList.forEach((item,index)=>{
-            formData.append('file'+index, item.raw)
-          });
+        if (this.detailsList) {
+          this.detailsList.forEach((item, index) => {
+            formData.append('file' + index, item.raw)
+          })
         }
         formData.append('orderList', orderList)
         formData.append('userId', getCookie('userId'))
-        formData.append('detailAmount',this.detailAmount);
-        formData.append('detailRemark',this.detailRemark);
+        formData.append('detailAmount', this.detailAmount)
+        formData.append('detailRemark', this.detailRemark)
         let options = {
           url: '/api/v1/bms/updateTruckDetail',
           data: formData,
@@ -1809,7 +1822,7 @@ export default {
           if (res.data.status == 'succeed') {
             this.$message.success('修改成功!')
             this.setteldAllselectValue = 0
-            this.onclick();
+            this.onclick()
             this.closeUpload2()
           } else {
             this.$message.error(res.data.data)
@@ -1818,14 +1831,14 @@ export default {
         })
       }
     },
-    openDetailsAdd(){
-       console.log(this.$refs.tableRef.selection, 'selection')
+    openDetailsAdd() {
+      console.log(this.$refs.tableRef.selection, 'selection')
       if (
         !this.$refs.tableRef.selection ||
         this.$refs.tableRef.selection.length != 1
       ) {
         this.$message.warning('请选择需要冲红的订单,一次只允许修改一个')
-        return;
+        return
       } else {
         this.detailAmount = null
         this.detailRemark = null
@@ -1836,17 +1849,17 @@ export default {
         } else {
           data = this.$refs.tableRef.selection
         }
-        for(let i=0;i<data.length;i++){
-          if(!data[i].orderId){
+        for (let i = 0; i < data.length; i++) {
+          if (!data[i].orderId) {
             this.$message.warning('没有派发运单,无法修改此项')
-            return;
+            return
           }
         }
         this.showDetailsAdd = true
       }
     },
-    addTruckDetail(){
-        this.isLoading = true
+    addTruckDetail() {
+      this.isLoading = true
       if (!this.detailAmount || !this.detailRemark) {
         this.$message.warning('请填写所有信息!')
         this.isLoading = false
@@ -1862,16 +1875,16 @@ export default {
         })
         console.log(orderList, 'orderList')
         let map = {
-          orderList:orderList,
-          userId:getCookie('userId'),
-          detailAmount:this.detailAmount,
-          detailRemark:this.detailRemark
+          orderList: orderList,
+          userId: getCookie('userId'),
+          detailAmount: this.detailAmount,
+          detailRemark: this.detailRemark
         }
-        this.axios.post('/api/v1/bms/addTruckDetail',map).then(res => {
+        this.axios.post('/api/v1/bms/addTruckDetail', map).then(res => {
           if (res.data.status == 'succeed') {
             this.$message.success('修改成功!')
             this.setteldAllselectValue = 0
-            this.onclick();
+            this.onclick()
           } else {
             this.$message.error(res.data.data)
           }
@@ -2281,15 +2294,17 @@ export default {
     fileChange2(file, fileList) {
       this.detailsList = fileList
     },
-    showPhoto(row){
-      this.showPhotoPreview=true;
-      this.previewList=[];
-      this.axios.post('/api/v1/uc/getPicture',{
-        urls:row.photo
-      }).then((res)=>{
-        console.log(res);
-        this.previewList=res.data;
-      })
+    showPhoto(row) {
+      this.showPhotoPreview = true
+      this.previewList = []
+      this.axios
+        .post('/api/v1/uc/getPicture', {
+          urls: row.photo
+        })
+        .then(res => {
+          console.log(res)
+          this.previewList = res.data
+        })
     },
     exceed() {
       this.$message.warning('超出上传数量!')
@@ -2304,10 +2319,10 @@ export default {
       this.$refs.statementUpload.clearFiles()
       // this.$refs.receive.clearFiles()
     },
-    closeUpload2(){
-       this.showDetailsUpLoad = false
-       this.isLoading = false
-       this.$refs.detailsUpload.clearFiles()
+    closeUpload2() {
+      this.showDetailsUpLoad = false
+      this.isLoading = false
+      this.$refs.detailsUpload.clearFiles()
     },
     //防抖函数--防止用户重复点击
     debounce(func, delay) {
@@ -3342,6 +3357,7 @@ export default {
       map.isCloseEas = Number(1)
       map.isNewCar = Number(1)
       map.shipperAddressId = this.addressId
+      map.userName = getCookie('loginName')
       this.axios
         .post('/api/v1/ams/updateCarAddress', map)
         .then(res => {