qingyiay
2023-03-31 04f3f15c930c2b02187d0ce11d68978b65361d54
pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue
@@ -20,7 +20,7 @@
               </view> -->
            </view>
         </view>
         <view class="bottom"><text>TIP:当前状态正常可以称重</text></view>
         <view class="bottom"><text>TIP:当前状态为正常时可以称重</text></view>
      </view>
      <view class="two">
         <p>订单编号:{{ weighList.code || '' }}</p>
@@ -34,7 +34,8 @@
         <p>矿场名称:{{ weighList.filedName || '' }}</p>
      </view>
      <view class="three">
         <!-- 外销订单成皮时,返回加减吨按钮置灰。称毛时可用.外购订单,不出现返回加减吨的按钮 -->
         <u-button type="primary" text="放空" plain @click="evacuation" throttleTime="500"></u-button>
         <!-- 外销订单称皮时,返回加减吨按钮置灰。称毛时可用.外购订单,不出现返回加减吨的按钮 -->
         <u-button
            type="primary"
            text="确定称重"
@@ -45,7 +46,17 @@
         ></u-button>
         <u-button type="primary" text="返回加减吨" :disabled="addAndSubtractCoalDisabled" v-if="weighList.orderTye == '外销'" @click="addAndSubtractCoal"></u-button>
      </view>
      <view class="four">如您需要调整装载货品吨数,请点击返回加减吨</view>
      <view class="four" v-if="weighList.orderTye == '外销'">如您需要调整装载货品吨数,请点击返回加减吨</view>
      <view class="evacuationModal">
         <u-modal
            :show="evacuationModalShow"
            :title="evacuationTitle"
            :content="evacuationContent"
            :showCancelButton="true"
            @confirm="evacuationConfirm"
            @cancel="evacuationCancel"
         ></u-modal>
      </view>
   </view>
</template>
@@ -90,29 +101,33 @@
         //    pingMessage: JSON.stringify({ type: 'ping' }) // 心跳请求信息
         // }
         // 临时称重对象
         temporaryWeighObj:{
            skin:0,
            hair:0,
            clean:0
         temporaryWeighObj: {
            skin: 0,
            hair: 0,
            clean: 0
         },
         infraredStatus:false// 红外状态
         infraredStatus: false, // 红外状态,
         // 放空控制
         evacuationModalShow: false,
         evacuationTitle: '第二次放空确认',
         evacuationContent: '是否确认放空'
      };
   },
   watch:{
      realTimeWeigh(newV,oldV){
         if(this.weighList.orderTye == '外销'){
            if(this.weighList.skin == 0){
               this.temporaryWeighObj.skin = this.realTimeWeigh
   watch: {
      realTimeWeigh(newV, oldV) {
         if (this.weighList.orderTye == '外销') {
            if (this.weighList.skin == 0) {
               this.temporaryWeighObj.skin = this.realTimeWeigh;
            } else {
               this.temporaryWeighObj.hair = this.realTimeWeigh
               this.temporaryWeighObj.clean = this.temporaryWeighObj.hair - this.weighList.skin
               this.temporaryWeighObj.hair = this.realTimeWeigh;
               this.temporaryWeighObj.clean = (this.temporaryWeighObj.hair - this.weighList.skin).toFixed(2);
            }
         } else if(this.weighList.orderTye == '外购'){
            if(this.weighList.hair == 0){
               this.temporaryWeighObj.hair = this.realTimeWeigh
         } else if (this.weighList.orderTye == '外购') {
            if (this.weighList.hair == 0) {
               this.temporaryWeighObj.hair = this.realTimeWeigh;
            } else {
               this.temporaryWeighObj.skin = this.realTimeWeigh
               this.temporaryWeighObj = this.weighList.hair - this.temporaryWeighObj.skin
               this.temporaryWeighObj.skin = this.realTimeWeigh;
               this.temporaryWeighObj = this.weighList.hair - this.temporaryWeighObj.skin;
            }
         }
      }
@@ -134,9 +149,21 @@
               return false;
            }
         }
      },
      }
   },
   methods: {
      // 放空
      evacuation() {
         this.evacuationModalShow = true;
      },
      // 放空弹窗确认
      evacuationConfirm() {
         this.evacuationModalShow = false;
      },
      // 放空弹窗取消
      evacuationCancel() {
         this.evacuationModalShow = false;
      },
      init() {
         // 获取称重信息
         this.$reqGet('weighList', { id: this.takeCoalId }).then(res => {
@@ -161,7 +188,7 @@
                  if (this.weighList.skin ? (this.weighList.skin < this.realTimeWeigh ? true : false) : true) {
                     this.saveWeigh();
                  } else {
                     this.$u.toast('毛重不能小于皮重');
                     this.$u.toast('毛重不q能小于皮重');
                     this.isConfirmWeighLoading = false;
                  }
               } else {
@@ -227,12 +254,13 @@
         // 获取服务器传来的数据,做相应处理
         socket.onMessage(res => {
            console.log('socketWeigh', res);
            let nowWeighObj = JSON.parse(res.data.slice(7))
            let nowWeighObj = JSON.parse(res.data.slice(7));
            if (nowWeighObj.eqCode == this.weighHouseCode) {
               if(nowWeighObj.'暂定'){
                  this.infraredStatus = true
               }else{
                  this.infraredStatus = false
               if (nowWeighObj.eqInfraredStatus) {
                  this.infraredStatus = true;
                  this.weighData.weigh = this.realTimeWeigh = nowWeighObj.weigh;
               } else {
                  this.infraredStatus = false;
                  this.weighData.weigh = this.realTimeWeigh = nowWeighObj.weigh;
               }
            }
@@ -258,7 +286,7 @@
   flex-direction: column;
   .one {
      flex: 2;
      border: vww(1) solid #dddddd;
      border: vww(2) solid #dddddd;
      margin: vww(20) vww(20) 0 vww(20);
      border-radius: vww(15);
      .top {
@@ -287,7 +315,7 @@
   }
   .two {
      flex: 4;
      border: vww(1) solid #dddddd;
      border: vww(2) solid #dddddd;
      margin: vww(20);
      border-radius: vww(10);
      padding: vww(20);