Browse Source

新增 上传提单

wzh 3 years ago
parent
commit
239d46e25f

+ 25 - 1
miniprogram/pages/voyageManage/myBills/myLab/myLab.js

@@ -1,6 +1,9 @@
 const {
   postApi
 } = require("../../../../apis/api")
+const {
+  uploadImage
+} = require('../../../../utils/uploadImage')
 
 // pages/voyageManage/myBills/myLab.js
 Page({
@@ -65,7 +68,6 @@ Page({
     })
 
     if (res.data.status == 0) {
-      console.log(res.data.result)
       for (let i of res.data.result) {
         i.billingDate = i.billingDate.substring(0, 10)
       }
@@ -91,6 +93,28 @@ Page({
       })
     }
   },
+  async uploadLab() {
+    let res = await uploadImage('voyage/uploadVoyageWayBill', {
+      voyageId: this.data.voyageId,
+      type: 5
+    })
+    if (res.status == 0) {
+      let {
+        viewUrl,
+        downloadUrl,
+        fileKey,
+        voyageId
+      } = res.result
+      let res1 = await postApi('/voyage/addLab', {
+        viewUrl,
+        downloadUrl,
+        fileKey,
+        voyageId,
+        portId: this.data.currentPortId
+      })
+      this.getLabList()
+    }
+  },
   onLoad(options) {
     let {
       id: voyageId

+ 1 - 1
miniprogram/pages/voyageManage/myBills/myLab/myLab.wxml

@@ -40,4 +40,4 @@
   </view>
   <view bindtap="scrollList" class="bottom-text">{{total==0?'暂无数据':(total>size*currentPage?'点击或滑动加载更多...':'已加载完毕')}}</view>
 </scroll-view>
-<view class="next" style="width: 50vw;">上传提单</view>
+<view bindtap="uploadLab" class="next" style="width: 50vw;">上传提单</view>

+ 3 - 3
miniprogram/utils/uploadImage.js

@@ -25,13 +25,13 @@ function uploadImage(path, params) {
       mediaType: ["image"],
       sourceType: ["camera", "album"],
       success: e => {
-        console.log("获取媒体成功!", e)
+        // console.log("获取媒体成功!", e)
         let src = e.tempFiles[0].tempFilePath
         wx.compressImage({
           src,
           quality: 80, // 压缩质量
           success: async e => {
-            console.log("图片压缩成功!", e)
+            // console.log("图片压缩成功!", e)
             wx.hideLoading({
               success: (res) => {},
             })
@@ -39,7 +39,7 @@ function uploadImage(path, params) {
               title: '正在上传...',
             })
             let res = await uploadFile(path, e.tempFilePath, params)
-            console.log("上传结束", res)
+            // console.log("上传结束", res)
             if (res.status == 0) {
               wx.showToast({
                 title: res.msg