wzh преди 3 години
родител
ревизия
2f877da7f9

BIN
miniprogram/images/bottom-selece.png


+ 175 - 3
miniprogram/pages/voyageManage/myBills/examine/examine.js

@@ -9,7 +9,10 @@ Page({
   data: {
     voyageId: 0,
     currentBillItem: {},
-    tab: 0,
+    tab: 1,
+    currentDischargeIndex: 0,
+    dischargeTime: "",
+    ocrList: []
   },
 
   previewImage(e) {
@@ -22,13 +25,182 @@ Page({
     })
   },
   changeTab(e) {
-    this.setData({
-      tab: e.currentTarget.dataset.tab
+    let {
+      tab
+    } = e.currentTarget.dataset
+
+    if (tab == 1) {
+      wx.showModal({
+        title: "是否确认上传运单?",
+        success: async e => {
+          if (e.confirm) {
+            await this.distributeBills()
+          } else {
+            this.setData({
+              tab: -1
+            })
+          }
+        }
+      })
+    } else if (tab == 2) {
+      wx.showModal({
+        title: "是否确认上传磅单?",
+        success: async e => {
+          if (e.confirm) {
+            this.setData({
+              tab
+            })
+          } else {
+            this.setData({
+              tab: -1
+            })
+          }
+        }
+      })
+    } else if (tab == 4) {
+      wx.showModal({
+        title: "是否确认上传汽车磅单?",
+        success: async e => {
+          if (e.confirm) {
+            this.setData({
+              tab
+            })
+          } else {
+            this.setData({
+              tab: -1
+            })
+          }
+        }
+      })
+    } else if (tab == 5) {
+      wx.showModal({
+        title: "确认不通过?",
+        success: async e => {
+          if (e.confirm) {
+            this.setData({
+              tab
+            })
+            this.distributeBills()
+          } else {
+            this.setData({
+              tab: -1
+            })
+          }
+        }
+      })
+    }
+  },
+  async distributeBills() {
+    let arr = []
+    for (let i of this.data.currentBillItem.shipownerUploadFiles) {
+      if (i.checked) arr.push(i.id)
+    }
+    let type = this.data.tab
+
+    let postData = {
+      recordIds: arr.join(','),
+      voyageId: this.data.voyageId,
+      type,
+    }
+
+    if (type == 2) {
+      if (!this.check()) return
+      let {
+        dischargeTime,
+        dischargeTons,
+        dischargePieces,
+        currentBillItem,
+        currentDischargeIndex
+      } = this.data
+      postData.poundBillData = {
+        dischargeTime: dischargeTime.replaceAll("-", "/") + " 00:00:00",
+        dischargeTons,
+        dischargePieces,
+        portId: currentBillItem.discPorts[currentDischargeIndex].portId
+      }
+    }
+
+    if (type == 4) {
+      let {
+        ocrList,
+        currentDischargeIndex,
+        currentBillItem
+      } = this.data
+      for (let i of ocrList) {
+        i.portId = currentBillItem.discPorts[currentDischargeIndex].portId
+      }
+      postData.carLoadDatas = ocrList
+    }
+    let res = await postApi('/bill/distribute', postData)
+    wx.switchTab({
+      url: '/pages/voyageManage/voyageManage',
     })
+
   },
   reject() {
 
   },
+
+  check() {
+    if (!this.data.dischargeTime) {
+      wx.showToast({
+        title: '请选择卸货时间',
+        icon: "error"
+      })
+
+      return
+    }
+    if (!this.data.dischargeTons) {
+      wx.showToast({
+        title: '请选择卸货吨位',
+        icon: "error"
+      })
+
+      return
+    }
+    return true
+  },
+
+  async ocr() {
+    wx.showLoading({
+      title: "正在识别"
+    })
+    let arr = []
+    for (let i of this.data.currentBillItem.shipownerUploadFiles) {
+      if (i.checked) arr.push(i.id)
+    }
+    let res = await postApi("/bill/ocr", {
+      recordIds: arr.join(',')
+    })
+    wx.hideLoading({
+      success: (res) => {},
+    })
+    this.setData({
+      ocrList: res.data.result
+    })
+  },
+
+  ocrInputBlur(e) {
+    console.log(e)
+    let {
+      index,
+      param
+    } = e.currentTarget.dataset
+    let {
+      value
+    } = e.detail
+    let {
+      ocrList
+    } = this.data
+    ocrList[index][param] = value
+  },
+
+  bindDiscPortChange(e) {
+    console.log(e)
+    this.setData({
+      currentDischargeIndex: e.detail.value
+    })
+  },
   onLoad(options) {
     this.setData({
       voyageId: options.id,

+ 61 - 8
miniprogram/pages/voyageManage/myBills/examine/examine.wxml

@@ -35,17 +35,70 @@
 <view class="df aic jcsa">
   <view class="tabsview" bindtap="changeTab" data-tab="{{1}}" style="color:{{tab==1?'#fff':'#0094FE'}};background:{{tab==1?'#0094FE':''}};border:{{tab==1?'':'1px solid #0094FE'}};">运单</view>
   <view class="tabsview" bindtap="changeTab" data-tab="{{2}}" style="color:{{tab==2?'#fff':'#0094FE'}};background:{{tab==2?'#0094FE':''}};border:{{tab==2?'':'1px solid #0094FE'}};">磅单</view>
-  <view class="tabsview" bindtap="changeTab" data-tab="{{3}}" style="color:{{tab==3?'#fff':'#0094FE'}};background:{{tab==3?'#0094FE':''}};border:{{tab==3?'':'1px solid #0094FE'}};">汽车磅单</view>
-  <view class=" reject" bindtap="reject">不通过</view>
+  <view class="tabsview" bindtap="changeTab" data-tab="{{4}}" style="color:{{tab==4?'#fff':'#0094FE'}};background:{{tab==4?'#0094FE':''}};border:{{tab==4?'':'1px solid #0094FE'}};">汽车磅单</view>
+  <view class=" reject" bindtap="changeTab" data-tab="{{5}}">不通过</view>
 </view>
 <block wx:if="{{tab==1}}">
-  上传运单
+
+</block>
+<block wx:if="{{tab==2||tab==4}}">
+  <picker class="picker0" bindchange="bindDiscPortChange" value="{{currentDischargeIndex}}" range="{{currentBillItem.discPorts}}" range-key="portName">
+    <view class="picker">
+      {{currentBillItem.discPorts[currentDischargeIndex].portName||'请选择卸货港'}}
+      <image style="display: inline-block;width: 40rpx;height: 40rpx;" src="../../../../images/bottom-selece.png"></image>
+    </view>
+  </picker>
 </block>
 <block wx:if="{{tab==2}}">
-  上传磅单填写信息
+  <view class="p20 box2" wx:if="{{currentDischargeIndex!=-1}}">
+    <view class="df jcsb line2">
+      <view>卸货时间</view>
+      <view>
+        <picker class="picker2" mode="date" style="border-radius: 0;" model:value="{{dischargeTime}}">
+          <view>
+            {{dischargeTime||'选择开始时间'}}
+          </view>
+        </picker>
+      </view>
+    </view>
+    <view class="df jcsb line2">
+      <view>卸货吨位(吨)</view>
+      <view><input model:value="{{dischargeTons}}" type="digit" placeholder="必填" /></view>
+    </view>
+    <view class="df jcsb line2">
+      <view>卸货件数</view>
+      <view><input model:value="{{dischargePieces}}" type="number" /></view>
+    </view>
+    <view class="next" bindtap="distributeBills">确认</view>
+  </view>
+
 </block>
-<block wx:if="{{tab==3}}">
-  汽车磅单
-  识别
-  确认
+<block wx:if="{{tab==4}}">
+  <view class="primary" bindtap="ocr">开始识别</view>
+  <block wx:for="{{ocrList}}">
+    <view class="p20 box2" wx:if="{{currentDischargeIndex!=-1&&ocrList.length}}">
+      <view class="df jcsb line2">
+        <view>车牌</view>
+        <view><input bindblur="ocrInputBlur" data-index="{{index}}" data-param="carNum" value="{{item.carNum}}" type="text" placeholder="" /></view>
+      </view>
+      <view class="df jcsb line2">
+        <view>收货单位</view>
+        <view><input bindblur="ocrInputBlur" data-index="{{index}}" data-param="receivingUnit" value="{{item.receivingUnit}}" type="text" /></view>
+      </view>
+      <view class="df jcsb line2">
+        <view>毛重</view>
+        <view><input bindblur="ocrInputBlur" data-index="{{index}}" data-param="grossWeight" value="{{item.grossWeight}}" type="digit" /></view>
+      </view>
+      <view class="df jcsb line2">
+        <view>皮重</view>
+        <view><input bindblur="ocrInputBlur" data-index="{{index}}" data-param="tare" value="{{item.tare}}" type="digit" /></view>
+      </view>
+      <view class="df jcsb line2">
+        <view>净重</view>
+        <view><input bindblur="ocrInputBlur" data-index="{{index}}" data-param="netWeight" value="{{item.netWeight}}" type="digit" /></view>
+      </view>
+    </view>
+  </block>
+  <view wx:if="{{currentDischargeIndex!=-1&&ocrList.length}}" class="primary" bindtap="distributeBills">确认</view>
+  <view style="height: 30rpx;"></view>
 </block>

+ 49 - 0
miniprogram/pages/voyageManage/myBills/examine/examine.wxss

@@ -43,4 +43,53 @@ line-full-title,
   background: #d90024;
   border-radius: 10rpx;
   color: #fff;
+}
+
+.picker0 {
+  min-width: 260rpx;
+  max-width: 320rpx;
+  border: 1rpx solid grey;
+  padding: 10rpx 20rpx 10rpx 30rpx;
+  border-radius: 10rpx;
+  font-size: 26rpx;
+  margin: 20rpx auto;
+}
+
+.picker {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+}
+
+.box2 {
+  border: 1px solid grey;
+  margin: 30rpx auto;
+  border-radius: 20rpx;
+  width: 80vw;
+}
+
+.box2 input,
+.picker2 {
+  width: 320rpx !important;
+  border: 1px solid grey;
+  padding: 0 10rpx;
+}
+
+.line2 {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  font-size: 28rpx;
+  margin: 20rpx auto
+}
+
+.primary {
+  padding: 16rpx 30rpx;
+  color: #fff;
+  background: #0094FE;
+  font-size: 28rpx;
+  text-align: center;
+  border-radius: 10rpx;
+  margin: 0 auto;
+  width: 320rpx;
 }

+ 1 - 0
miniprogram/pages/voyageManage/myDaily/myDaily.js

@@ -31,6 +31,7 @@ Page({
       voyageId: options.id,
       trans: options.trans
     })
+    this.getMedias()
   },
   examineMedia() {
     if (this.data.currentIndex == -1) {

+ 4 - 3
miniprogram/pages/voyageManage/voyageManage.js

@@ -10,7 +10,7 @@ Page({
     defaultParams: {
       loginAccountId: wx.getStorageSync('loginAccountId')
     },
-    maintab: 3,
+    maintab: 1,
     status: 1,
     currentPage: 1,
     size: 20,
@@ -122,11 +122,12 @@ Page({
         let {
           index
         } = e.currentTarget.dataset
-        app.globalData.currentBillItem = this.data.list[index]
-
         if (this.data.list[index].shipownerUploadFiles.length == 1) {
+          this.data.list[index].shipownerUploadFiles[0].checked = true
+          app.globalData.currentBillItem = this.data.list[index]
           url = `/pages/voyageManage/myBills/examine/examine?id=${id}`
         } else {
+          app.globalData.currentBillItem = this.data.list[index]
           url = `/pages/voyageManage/myBills/myBills?id=${id}`
         }
         break