From 825abb00f52fe7d68b3479f328928bf74a47171e Mon Sep 17 00:00:00 2001
From: 819527061@qq.com <123456>
Date: 星期四, 18 七月 2024 10:56:11 +0800
Subject: [PATCH] 细节问题

---
 pages/driver-page/driver-index/bill-of-lading-details/nocarNoWeighingDevice/nocarNoWeighingDevice.vue |  323 +++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 259 insertions(+), 64 deletions(-)

diff --git a/pages/driver-page/driver-index/bill-of-lading-details/nocarNoWeighingDevice/nocarNoWeighingDevice.vue b/pages/driver-page/driver-index/bill-of-lading-details/nocarNoWeighingDevice/nocarNoWeighingDevice.vue
index 518498a..f0eb7ea 100644
--- a/pages/driver-page/driver-index/bill-of-lading-details/nocarNoWeighingDevice/nocarNoWeighingDevice.vue
+++ b/pages/driver-page/driver-index/bill-of-lading-details/nocarNoWeighingDevice/nocarNoWeighingDevice.vue
@@ -102,22 +102,80 @@
     </view>
     <!--  绉伴噸鍘嗗彶-->
     <weigh-item :list="weighHistory" class="weighingDecive-item"></weigh-item>
-    <view class="chengzhong-btn" v-if="applyHouseId && noCarNo == 1 && status == 15 && roleType == 4">
-    <!--   applyHouseId鏈夌鎴垮彿锛宯oCarNo=1(鏃犺溅鐗屽彿)锛宻tatus=15,璐ㄦ鍛� 鎶婄鍚堜笂闈㈡潯浠剁殑鍔犱笂绉伴噸鎸夐挳   -->
-      <u-button type="primary"
-                text="纭畾绉伴噸"
-                :loading="isConfirmWeighLoading"
-                loadingText="纭"
-                @click="confirmWeigh"></u-button>
-    </view>
+
     <!--  iszj锛屾槸鍚﹀凡璐ㄦ瀛楁  璐ㄦ鍛樿韩浠�+鏈塼mId+璐ㄦ涔嬪墠  -->
-    <view class="chengzhong-btn marginTop" v-if="weighData.tmId && roleType == 4">
-      <!--   鏀跺彂鍗曚俊鎭椂   -->
-      <u-button type="primary"
-                text="澶嶇"
-                :loading="repeatWeighLoading"
-                loadingText="纭"
-                @click="confirmRepeatWeigh"></u-button>
+
+
+
+
+
+    <view class="three">
+      <!-- .澶栬喘璁㈠崟锛屼笉鍑虹幇杩斿洖鍔犲噺鍚ㄧ殑鎸夐挳 -->
+      <view class="chengzhong-btn" v-if="applyHouseId && noCarNo == 1 && status == 15 && roleType == 4">
+        <!--   applyHouseId鏈夌鎴垮彿锛宯oCarNo=1(鏃犺溅鐗屽彿)锛宻tatus=15,璐ㄦ鍛� 鎶婄鍚堜笂闈㈡潯浠剁殑鍔犱笂绉伴噸鎸夐挳   -->
+        <u-button type="primary"
+                  :disabled="realTimeWeigh == 0 || globalinfraredStatus || isweigh ||globalWarning"
+                  text="纭畾绉伴噸"
+                  :loading="isConfirmWeighLoading"
+                  loadingText="纭"
+                  @click="confirmWeigh">
+        </u-button>
+      </view>
+      <view class="chengzhong-btn" v-if="weighData.tmId && roleType == 4">
+        <!--   鏀跺彂鍗曚俊鎭椂 status: 棰嗗彇(0),棰勭害(1),绛惧埌(2),鍏ュ満(3),绉扮毊(4),绉版瘺(5),绂诲満(6), 鍏ョ鎴�(7),鍑虹鎴�(8),鍏ョ叅浠�(9),鍑虹叅浠�(10)
+        ,鏀剧┖(11),浣滃簾(12),鍏ュ満鐢宠(13),杩涘叆鍦洪櫌(14),鐢宠璁¢噺(15);  -->
+        <u-button type="primary"
+                  text="澶嶇"
+                  :loading="repeatWeighLoading"
+                  loadingText="纭"
+                  :disabled="isFuBangSHow"
+                  @click="showModal = true"></u-button>
+      </view>
+      <view class="chengzhong-btn" v-if="weighData.tmId && outBuy && roleType == 4">
+        <u-button type="primary"
+                  text="杩斿洖鍔犲噺鍚�"
+                  :disabled="addAndSubtractCoalDisabled"
+                  @click="addAndSubtractCoal"
+                  class="jiajian"
+        ></u-button>
+      </view>
+      <view class="chengzhong-btn" v-if='weighData.tmId && canUnload && isJixuxiehuo && roleType == 4'>
+        <u-button type="primary"
+                  text="缁х画鍗歌揣"
+                  @click="UnloadingAgainHandle"
+
+                  loadingText="纭"
+                  :disabled="isweigh||realTimeWeigh == 0 || statusWeigh == 3"
+        ></u-button>
+      </view>
+      <!-- 鏀剧┖ -->
+      <view class="chengzhong-btn" v-if="weighData.tmId && roleType == 4">
+        <u-button type="primary"
+                  text="鏀剧┖"
+                  plain
+                  @click="evacuation"
+                  throttleTime="500"
+                  :disabled="!isEvacuation"></u-button>
+      </view>
+      <!--浜屾纭-->
+      <u-modal :show="showModal"
+               :asyncClose="true"
+               @cancel="showModal = false"
+               :content="modalContent"
+               :showCancelButton="true"
+               :cancelButtonText="'鍙栨秷'"
+               :showConfirmButton="true"
+               :confirmButtonText="'纭'"
+               @confirm="confirmRepeatWeigh" />
+    </view>
+    <!-- 鏀剧┖寮圭獥 -->
+    <view class="evacuationModal">
+      <u-modal :show="evacuationModalShow"
+               :title="evacuationTitle"
+               :content="evacuationContent"
+               :showCancelButton="true"
+               @confirm="evacuationConfirm"
+               @cancel="evacuationCancel"></u-modal>
     </view>
   </view>
 </template>
@@ -141,6 +199,7 @@
   },
   data() {
     return {
+      statusWeigh: '',  //鐘舵��
       isWeighing:'',
       timer:null,
       weighData: {
@@ -202,6 +261,9 @@
       applyHouseId:'',  //纾呮埧鍙�
       noCarNo:0,  //鏄惁鏈夎溅鐗屽彿(鏈夎溅鐗�0锛屾棤杞︾墝1)
       status:null,  //鐘舵��
+      orderCode:'',
+      showModal: false,
+      modalContent: '纭瑕佸纾呭悧锛�'
     };
   },
   watch: {
@@ -212,8 +274,9 @@
     globalweigh: {
       handler: function(newV) {
         console.log(newV,'newV===')
-        if(newV) {
+        if(newV || newV == 0) {
           this.weighData.weigh = this.realTimeWeigh = newV;
+          console.log(this.showWeigh.skin,'this.showWeigh------')
           if  ((this.weighList.orderType == '澶栭攢')) {
             if (!this.showWeigh.skin) {
               this.temporaryWeighObj.skin = newV;
@@ -333,6 +396,9 @@
         return (this.weighList.skin === 0 ? this.temporaryWeighObj.skin : this.weighList.skin) == this.temporaryWeighObj.hair;
       }
       if (this.weighList.orderType == '澶栬喘') {
+        console.log(this.weighList.hair,'this.weighList.hair=====')
+        console.log(this.temporaryWeighObj.skin,'this.temporaryWeighObj.skin')
+        console.log((this.weighList.hair === 0 ? this.temporaryWeighObj.skin : this.weighList.hair) == this.temporaryWeighObj.hair,'hhhhhhhhhhhh')
         return (this.weighList.hair === 0 ? this.temporaryWeighObj.skin : this.weighList.hair) == this.temporaryWeighObj.hair;
       }
     },
@@ -381,6 +447,50 @@
         return true
       }
     },
+    isJixuxiehuo() {   //鏄惁鏄剧ず缁х画鍗歌揣鎸夐挳
+      if(this.weighList?.tmTaskCoalItems && this.weighList?.tmTaskCoalItems.length > 0) {
+        return this.weighList?.tmTaskCoalItems.length > 0
+      }else {
+        return false
+      }
+    },
+    isFuBangSHow() {  //澶嶇鏄惁鍙互鐐瑰嚮
+      console.log(this.globalweigh,'this.globalweigh====')
+      if(this.noCarNo == 1) {  //鏃犺溅鐗岀殑鏃跺�欏纾呴兘鑳界偣鍑�
+        //鏉′欢锛� 涓嶆槸绉伴噸瀹屾垚+涓嶆槸鏈О閲�+鏈夎溅鐗�+鍙告満  銆愭湭绉伴噸0锛岀О閲嶄腑1锛岄獙璐ㄤ腑2锛岀О閲嶅畬鎴�3,楠岃川瀹屾垚4銆�  noCarNo 鏄惁鏈夎溅鐗屽彿(鏈夎溅鐗�0锛屾棤杞︾墝1)
+        if(this.statusWeigh == 0 || this.statusWeigh == 3 || this.globalweigh == 0) {
+        // if( this.statusWeigh == 3 || this.globalweigh == 0) {
+          return true
+        }else {
+          return false
+        }
+      }else {   //鏈夎溅鐗岀殑璇�
+        console.log(this.isJixuxiehuo,'this.isJixuxiehuo------')
+        if(this.weighHistory && this.weighHistory.length > 0) {
+          if(!this.isJixuxiehuo) {  //鍙湁涓�鏉� tmTaskCoalItems
+            let data = this.weighHistory[0]
+            if(!data.hair && !data.skin) {  //鐨噸鍜屾瘺閲嶉兘娌℃湁鐨勮瘽 澶嶇 涓嶈兘鐐瑰嚮
+              return true
+            }else if(data.hair && data.skin) {  //鐨噸鍜屾瘺閲嶉兘鏈夌殑璇� 澶嶇 涔熶笉鑳界偣鍑� 锛堢О閲嶇粨鏉燂級
+              return true
+            }else {
+              return false
+            }
+
+          }else {
+            let hairAndSkin = this.weighHistory.every(item => item.hair && item.skin)   //鐨噸姣涢噸閮芥湁
+            if(hairAndSkin) {
+              return true
+            }else {
+              return false
+            }
+          }
+        }else {
+          return true
+        }
+      }
+    }
+
 
   },
   methods: {
@@ -391,34 +501,6 @@
       })
       console.log(this.weighData.sceneId,'纾呮埧----')
       // 鑾峰彇绉伴噸淇℃伅
-      // uni.request({   //鏍规嵁纾呮埧鏌ヨ鎻愮叅鍗曚俊鎭�
-      //   url: `${BaseUrl}/wrzs/jccoalweighhouse/getTmTaskCoalNoCar/${this.weighData.sceneId}`,
-      //   method: 'GET',
-      //   header: {
-      //     Authorization: 'Bearer' + ' ' + uni.getStorageSync('token'),
-      //     clientToc: 'Y',
-      //     'CLIENT_TOC': 'Y',
-      //   },
-      //   success: (res) => {
-      //     console.log(res,'res.datra----------')
-      //     if(res.data.code == 0) {
-      //       this.weighList = res.data;
-      //       this.weighData.deptId = res.data.deptId;
-      //       this.weighData.tmId = res.data.id;
-      //       this.weighData.carNo = res.data.carNo;
-      //       this.weighData.tmCode = res.data.code;
-      //       this.weighData.filedId = res.data.filedId;
-      //       this.noCarNo = res.data.noCarNo
-      //       this.applyHouseId = res.data.applyHouseId
-      //       this.status = res.data.status
-      //       this.outBuy = (this.weighList.orderType.indexOf('閿�') !== -1) && this.showWeigh.skin > 0;
-      //       // 缁х画鍗歌揣鍙湁澶栬喘绫诲瀷绗簩娆′細鏈�
-      //       this.canUnload = this.weighList.orderType === '澶栬喘' && this.showWeigh.hair > 0;
-      //     }else {
-      //       this.$u.toast(res.data.msg);
-      //     }
-      //   }
-      // })
       let params = {}
       this.tmId ? params = { tmId: this.tmId, houseId: this.weighData.sceneId } : params = { houseId: this.weighData.sceneId }
       console.log(params,'鍙傛暟===')
@@ -435,14 +517,39 @@
           this.noCarNo = res.data.noCarNo
           this.applyHouseId = res.data.applyHouseId
           this.status = res.data.status
+          this.statusWeigh = res.data.statusWeigh
+          this.orderCode = res.data.orderCode
           this.outBuy = (this.weighList.orderType.indexOf('閿�') !== -1) && this.showWeigh.skin > 0;
           // 缁х画鍗歌揣鍙湁澶栬喘绫诲瀷绗簩娆′細鏈�
           this.canUnload = this.weighList.orderType === '澶栬喘' && this.showWeigh.hair > 0;
+          this.getShebeiData()  //鑾峰彇璁惧淇℃伅
         }else {
-          this.weighList = {}
+          Object.keys(this.weighList).forEach(key => {
+            this.weighList[key] = '';
+          });
           this.$u.toast(res.msg ? res.msg : '鍗犳棤纾呭崟淇℃伅');
         }
       });
+    },
+    getShebeiData() {  //鑾峰彇璁惧淇℃伅
+      let params = {
+        deptId: this.weighData.deptId,
+        filedId: this.weighData.filedId,
+        tmId: this.weighData.tmId,
+        tmCode: this.weighData.tmCode,
+        carNo: this.weighData.carNo
+      }
+      console.log(params,'params=====')
+      this.$reqGet('getWeighHouse',params).then(res => {
+        console.log(res, '鑾峰彇璁惧淇℃伅res');
+        if(res.code == 0) {
+          this.weighData.gateCameraId = res.data.lastEquipmentId;
+          this.weighData.equipmentCode = res.data.lastEquipmentCode;
+          this.weighData.sceneInOut = res.data.sceneInOut;
+        }else {
+          this.$u.toast(res.msg);
+        }
+      })
     },
     refreshClick() {
       this.init()
@@ -470,7 +577,8 @@
     // 纭绉伴噸鎺ュ彛
     saveWeigh() {  //鐐瑰嚮纭绉伴噸鎸夐挳
       // this.weighData.coalContactClean = this.coalContactClean;
-      this.$reqPost('saveWeighYZY', this.weighData, 'json')
+      console.log(this.weighData,'澶嶇鍙傛暟----')
+      this.$reqPost('saveWeigh', this.weighData, 'json')
           .then(res => {
             console.log(res, '绉伴噸鎺ュ彛');
             if (res.code == 0) {
@@ -493,18 +601,31 @@
         this.isConfirmWeighLoading = false;
       });
     },
-    confirmRepeatWeigh() {  //澶嶇
+    confirmAction() {  //澶嶇
+      this.showModal = true
+    },
+    confirmRepeatWeigh() {  //澶嶇浜屾纭
       this.repeatWeighLoading = true
-      if(this.weighData.weigh != 0) {
+      setTimeout(() => {
+        // 3绉掑悗鑷姩鍏抽棴
+        this.showModal = false;
+      }, 2000)
+      console.log(this.weighData.weigh,'this.weighData.weigh======')
+      if(this.weighData.weigh && this.weighData.weigh != 0) {
         this.$reqPost('reWeighYZY', this.weighData, 'json').then(res => {
           if (res.code == 0) {
             this.repeatWeighLoading = false;
-            this.$u.toast('澶嶇鎴愬姛');
             setTimeout(() => {
               uni.navigateBack({
                 delta: 1
               });
-            }, 1000);
+              this.$u.toast('澶嶇鎴愬姛');
+            },1000)
+            // setTimeout(() => {
+            //   uni.navigateBack({
+            //     delta: 1
+            //   });
+            // }, 1000);
           }else {
             this.$u.toast('澶嶇澶辫触锛岃绋嶅悗閲嶈瘯' + (res.msg ? res.msg : ''));
           }
@@ -515,7 +636,84 @@
         this.$u.toast('鏈兘鑾峰彇鍦扮閲嶉噺');
         this.repeatWeighLoading = false;
       }
-    }
+    },
+    // 鍔犲噺鐓�
+    addAndSubtractCoal() {
+      this.$reqPost('addAndSubtractCoal', {
+        deptId: this.weighData.deptId,
+        sceneId: this.weighData.sceneId,
+        carNo: this.weighData.carNo,
+        filedId: this.weighData.filedId,
+        tmId: this.weighData.tmId,
+        gateCameraId: this.weighData.gateCameraId,
+        equipmentCode: this.weighData.equipmentCode,
+        tmCode: this.weighData.tmCode,
+        sceneInOut: this.weighData.sceneInOut,
+        weigh: this.realTimeWeigh
+      }, 'json').then(res => {
+        if (res.code == 0) {
+          this.$u.toast('鎿嶄綔鎴愬姛锛屽嵆灏嗚繑鍥炰笂涓�椤�');
+          setTimeout(() => {
+            uni.navigateBack({
+              delta: 1
+            });
+            this.isConfirmWeighLoading = false;
+          }, 1000);
+          console.log(res, '鍔犲噺鐓�');
+        } else {
+          this.$u.toast('鎿嶄綔澶辫触锛岃绋嶅�欓噸璇�');
+        }
+      });
+    },
+    // 缁х画鍗歌揣
+    UnloadingAgainHandle() {
+      this.UnloadingAgainLoading = true
+      this.$reqPost('continueWeigh', {
+        deptId: this.weighData.deptId,
+        sceneId: this.weighData.sceneId,
+        carNo: this.weighData.carNo,
+        tmId: this.weighData.tmId,
+        filedId: this.weighData.filedId,
+        gateCameraId: this.weighData.gateCameraId,
+        equipmentCode: this.weighData.equipmentCode,
+        tmCode: this.weighData.tmCode,
+        sceneInOut: this.weighData.sceneInOut,
+        weigh: this.realTimeWeigh
+      }, 'json').then(res => {
+        this.UnloadingAgainLoading = false
+        if (res.code == 0) {
+          this.$u.toast('鎿嶄綔鎴愬姛锛屽嵆灏嗚繑鍥炰笂涓�椤�');
+          setTimeout(() => {
+            uni.navigateBack({
+              delta: 1
+            });
+          }, 1000);
+        } else {
+          this.$u.toast('鎿嶄綔澶辫触锛岃绋嶅�欓噸璇�');
+        }
+      })
+    },
+    // 鏀剧┖
+    evacuation() {
+      this.evacuationModalShow = true;
+    },
+    // 鏀剧┖寮圭獥纭
+    evacuationConfirm() {
+      this.$reqPost('getTwoEvacuation', this.weighData, 'json').then(res => {
+        console.log(res, '绗簩娆℃斁绌�');
+        if (res.code == 0) {
+          this.$u.toast('鎿嶄綔鎴愬姛');
+          this.evacuationModalShow = false;
+        } else {
+          this.$u.toast(res.msg ? res.msg : '鎿嶄綔澶辫触');
+          this.evacuationModalShow = true;
+        }
+      });
+    },
+    // 鏀剧┖寮圭獥鍙栨秷
+    evacuationCancel() {
+      this.evacuationModalShow = false;
+    },
   }
 };
 </script>
@@ -815,15 +1013,15 @@
   .three {
     margin: 0 auto vww(5);
     margin-bottom: vww(60);
-    width: 96%;
-    display: grid;
-    grid-template-columns: repeat(auto-fit, minmax(140rpx, 1fr));
-    justify-content: center;
-    gap: vww(10);
-    color: #939393;
-
-    .u-button {
-      width: vww(70);
+    width: 100%;
+    display: flex;
+    flex-wrap: wrap;
+    padding: 0 40rpx;
+    box-sizing: border-box;
+    justify-content: start;
+    .u-button{
+      width: 200rpx;
+      margin: 10rpx 10rpx;
     }
   }
 
@@ -845,10 +1043,7 @@
     justify-content: space-between;
   }
 }
-.chengzhong-btn{
-  width: 80%;
-  margin: 0 auto;
-}
+
 .marginTop{
   margin-top: 20rpx;
 }

--
Gitblit v1.9.1