qingyiay
2023-10-08 cbfc1953c7e7333dbcb1e43fff15433ed24fc543
pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue
@@ -204,16 +204,20 @@
            :disabled="addAndSubtractCoalDisabled"
            @click="addAndSubtractCoal"
            class="jiajian"
            v-if="outBuy"></u-button>
            v-if="outBuy||!isSkinWeigh"></u-button>
      </view>
      <view class="four">
      <view v-show="isConfirmWeighLoading"
         style="color: #ff6363;width: auto;margin: 0 auto;">
         超出毛重,磅房人员确认中,请勿离开此页面
      </view>
      <!-- <view class="four">
         <u-button type="primary"
            text="刷新"
            @click.stop="RefreshHandle"
            icon="reload"
            throttle-time="800"
            :loading="refreshLoading"></u-button>
      </view>
      </view> -->
      <!-- 放空弹窗 -->
      <view class="evacuationModal">
         <u-modal :show="evacuationModalShow"
@@ -229,7 +233,6 @@
            title="异常原因"
            :showCancelButton="true"
            @confirm="abnormalConfirm"
            @cancel="abnormalCancel"
            confirmText="提交">
            <view class="slot-content">
               <u--form labelPosition="top"
@@ -249,11 +252,17 @@
            </view>
         </u-modal>
      </view>
      <!-- 确认后称重提示弹窗 -->
      <view class="">
         <u-modal :show="confirmWeighVisiable"
            title="提示"
            :content="confirmWeighContent"
            @confirm="confirmWeighConfirm"></u-modal>
      </view>
   </view>
</template>
<script>
   let socket = null;
   import { webSocketUrl } from '@/api/request.js';
   import { mapState, mapMutations } from 'vuex';
   import combinedTitle from '@/components/combined-title/combined-title.vue';
@@ -277,6 +286,23 @@
         this.changeWeigh('')
         this.realTimeWeigh = 0
      },
      onShow() {
         this.timer = setTimeout(() => {
            if (!this.globalweigh) {
               console.log('称重时自动重连');
               this.socketTask.close();
               this.changesocketTask(null);
               this.changereconnectNum({ connectNum: 1, isWeigh: true })
               this.$store.dispatch('websocketInit');
            }
         }, 3000)
      },
      onHide() {
         clearTimeout(this.timer)
      },
      onUnload() {
         clearTimeout(this.timer)
      },
      components: {
         combinedTitle
      },
@@ -296,7 +322,8 @@
               coalContactClean: 0,
               coalContactHair: 0,
               coalContactSkin: 0,
               isMerge: 0 //1是 0不是  默认0  是否合卡
               isMerge: '0', //1是 0不是  默认0  是否合卡
               isBackground: '0'
            },
            takeCoalId: null,
            weighHouseCode: '',
@@ -360,7 +387,8 @@
            mergeStateShow: false, //合卡弹窗
            checkboxValue1: [],
            isExceedOrigin: false, //是否超出原发毛重
            refreshLoading: false
            refreshLoading: false,
            timer: null
         };
      },
      watch: {
@@ -373,7 +401,8 @@
                  .orderType ==
                  '转出') {
                  if (this.weighList.skin == 0) {
                     this.isSkinWeigh = true
                     this.isSkinWeigh = true //称皮没有返回装卸
                     this.outBuy = false //称皮没有返回装卸
                     this.temporaryWeighObj.skin = newV;
                     let xx = new BigNumber(this.avgSkin)
                     let yy = new BigNumber(newV)
@@ -381,6 +410,7 @@
                        this.avgSkin !== 0
                  } else {
                     this.isSkinWeigh = false;
                     this.outBuy = true;
                     this.temporaryWeighObj.hair = newV;
                     this.temporaryWeighObj.clean = (this.temporaryWeighObj.hair - this.weighList.skin).toFixed(
                        2);
@@ -394,17 +424,20 @@
                  .orderType == '转入') {
                  if (this.weighList.hair == 0) {
                     this.isSkinWeigh = false;
                     this.outBuy = true;
                     this.temporaryWeighObj.hair = newV;
                     if (this.weighList.orderType == '外购') {
                        let xx = new BigNumber(newV)
                        let yy = new BigNumber(this.weighList.hairTwo)
                        if (xx.minus(yy) > 0.3) {
                           this.$u.toast('超出原发信息毛重,请等待管理人员处理')
                           this.isExceedOrigin = true
                        }
                     }
                     // if (this.weighList.orderType == '外购') {
                     //    let xx = new BigNumber(newV)
                     //    let yy = new BigNumber(this.weighList.hairTwo)
                     //    if (xx.minus(yy) > 0.3) {
                     //       this.$u.toast('超出原发信息毛重,请等待管理人员处理')
                     //       this.isExceedOrigin = true
                     //       this.saveWeigh()
                     //    }
                     // }
                  } else {
                     this.isSkinWeigh = true;
                     this.isSkinWeigh = true; //称皮没有返回装卸
                     this.outBuy = false //称皮没有返回装卸
                     this.temporaryWeighObj.skin = newV;
                     let xx = new BigNumber(this.avgSkin)
                     let yy = new BigNumber(newV)
@@ -420,11 +453,16 @@
                  }
               }
            }
         },
         confirmWeighVisiable(v) {
            if (v) {
               uni.hideLoading()
            }
         }
      },
      computed: {
         ...mapState(['globalweigh', 'globalinfraredStatus', 'globalisconnect', 'globalisUploadimg', 'globalisLogin',
            'is_open_socket'
            'is_open_socket', 'socketTask', 'confirmWeighVisiable', 'confirmWeighContent'
         ]),
         coalContactClean() {
            let xx = BigNumber(this.weighData.coalContactHair)
@@ -455,7 +493,9 @@
      },
      methods: {
         ...mapMutations(['changeweighHouseCode', 'changeisLogin', 'changeWeigh']),
         ...mapMutations(['changeweighHouseCode', 'changeisLogin', 'changeWeigh', 'changeconfirmWeighVisiable',
            'changesocketTask', 'changereconnectNum'
         ]),
         RefreshHandle() {
            if (this.globalisconnect) return this.$u.toast('已连接,无需刷新')
            this.refreshLoading = true
@@ -542,7 +582,6 @@
         // 确认称重接口
         saveWeigh() {
            this.weighData.coalContactClean = this.coalContactClean;
            console.log(this.weighData);
            this.$reqPost('saveWeigh', this.weighData, 'json')
               .then(res => {
                  console.log(res, '称重接口');
@@ -554,6 +593,10 @@
                        });
                        this.isConfirmWeighLoading = false;
                     }, 1000);
                  } else if (res.code === 3) {
                     uni.showLoading({
                        title: '磅房人员确认中',
                     })
                  } else {
                     this.$u.toast(res.msg ? res.msg : '称重失败,请稍后重试');
                     this.isConfirmWeighLoading = false
@@ -678,6 +721,16 @@
               this.orderSurplusLess = true
            }
         },
         confirmWeighConfirm() {
            this.changeconfirmWeighVisiable(false)
            this.isConfirmWeighLoading = false
            setTimeout(() => {
               this.$u.toast('即将返回上一页'),
                  uni.navigateBack({
                     delta: 1
                  })
            }, 800)
         }
      }
   };
</script>