liyg vor 2 Jahren
Ursprung
Commit
32b81ca64e

+ 34 - 39
src/views/sale/components/transportFreight/saleTruckSettlement/bmsTruckDetailsOrderNew.vue

@@ -2220,48 +2220,43 @@ export default {
           detailAmount: this.detailAmount,
           detailRemark: this.detailRemark
         }
-        if (this.detailsList.length >= 0) {
-            //上传备注图片
-            let formData = new window.FormData()
-            this.detailsList.forEach((item, index) => {
-              formData.append('file' + index, item.raw)
-            })
-            let options = {
-              url: '/api/v1/uc/uploadPic',
-              data: formData,
-              method: 'post',
-              headers: {
-                'Content-Type': 'multipart/form-data'
-              }
-            }
-            this.axios(options).then(res => {
-               map.urls= res.data
-               this.axios.post('/api/v1/bms/addTruckDetail', map).then(res => {
-                if (res.data.status == 'succeed') {
-                  this.$message.success('修改成功!')
-                  this.setteldAllselectValue = 0
-                  this.onclick()
-                } else {
-                  this.$message.error(res.data.data)
+        let _this=this;
+       new Promise((resolve, reject) => {
+          if (_this.detailsList.length >= 0) {
+              //先上传备注图片
+              let formData = new window.FormData()
+              _this.detailsList.forEach((item, index) => {
+                formData.append('file' + index, item.raw)
+              })
+              let options = {
+                url: '/api/v1/uc/uploadPic',
+                data: formData,
+                method: 'post',
+                headers: {
+                  'Content-Type': 'multipart/form-data'
                 }
-                this.showDetailsAdd = false
-                this.isLoading = false
+              }
+              _this.axios(options).then(res => {
+                map.urls= res.data
+                _this.closeUpload2();
+                resolve('OK');
               })
-              this.closeUpload2();
-            })
-        }else{
+          }else{
+            resolve('NoPIC');
+          }
+        }).then((result)=>{
             this.axios.post('/api/v1/bms/addTruckDetail', map).then(res => {
-            if (res.data.status == 'succeed') {
-              this.$message.success('修改成功!')
-              this.setteldAllselectValue = 0
-              this.onclick()
-            } else {
-              this.$message.error(res.data.data)
-            }
-            this.showDetailsAdd = false
-            this.isLoading = false
-          })
-        }
+              if (res.data.status == 'succeed') {
+                this.$message.success('修改成功!')
+                this.setteldAllselectValue = 0
+                this.onclick()
+              } else {
+                this.$message.error(res.data.data)
+              }
+              this.showDetailsAdd = false
+              this.isLoading = false
+            })
+        });
       }
     },
     openConsigneeUpd() {