qingyiay
2023-04-17 169e9b4d59bdd763bb5bd1b5a9b092a1200e327b
pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue
@@ -3,7 +3,7 @@
      <view class="bangDanMessage">
         <view class="">
            <text>客户:{{ coalDetailsData.customerName || '' }}</text>
            <text>矿厂:{{ coalDetailsData.deptName || '' }}</text>
            <text>矿场:{{ coalDetailsData.deptName || '' }}</text>
         </view>
         <view class="">
            <text>皮重:{{ coalDetailsData.skin || '' }}</text>
@@ -11,7 +11,7 @@
            <text>净重:{{ coalDetailsData.clean || '' }}</text>
         </view>
         <view class="">
            <text>磅单类型:{{ coalDetailsData.orderTye || '' }}</text>
            <text>磅单类型:{{ coalDetailsData.orderType || '' }}</text>
            <text>状态:{{ coalStatus[coalDetailsData.status] }}</text>
         </view>
         <view class="">
@@ -48,8 +48,8 @@
</template>
<script>
let socket = null;
import { webSocketUrl } from '@/api/request.js';
import { mapState, mapMutations } from 'vuex';
export default {
   onLoad(value) {
      if (value.orderPlanId && value.yyId) {
@@ -100,14 +100,19 @@
            sceneId: '',
            gateCameraId: '',
            equipmentCode: '',
            weigh: 30
         }
            weigh: 0
         },
         // 原发信息
         primarySkin: null,
         primaryHair: null,
         primaryClean: null
      };
   },
   onShow() {
      this.init();
   },
   computed: {
      ...mapState(['globalweigh', 'globalinfraredStatus']),
      name() {
         return uni.getStorageSync('name');
      },
@@ -141,7 +146,8 @@
      getTakeCoal() {
         this.$reqGet('getTakeCoal', { takeCoalId: this.orderPlanId }).then(res => {
            if (res.code == 0) {
               this.coalDetailsData = res.data[0];
               console.log(res, '提煤单详情');
               this.coalDetailsData = res.data;
               // 获取所在磅房参数赋值
               this.getWeightHouseObj.deptId = this.coalDetailsData.deptId;
               this.getWeightHouseObj.filedId = this.coalDetailsData.filedId;
@@ -157,6 +163,10 @@
               this.getServiceOpenid.filedId = this.coalDetailsData.filedId;
               // 获取提煤单状态
               this.currentPageCoalStatus = this.coalDetailsData.status;
               // 获取原发信息
               this.primarySkin = this.coalDetailsData.skinTwo;
               this.primaryHair = this.coalDetailsData.hairTwo;
               this.primaryClean = this.coalDetailsData.cleanTwo;
            }
         });
      },
@@ -248,49 +258,13 @@
               uni.navigateTo({
                  url: `/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice?takeCoalId=${this.orderPlanId}&sceneId=${
                     res.data.id
                  }&gateCameraId=${res.data.lastEquipmentId}&gateCameraCode=${res.data.lastEquipmentCode}&weighHouseCode=${res.data.code}`
                  }&gateCameraId=${res.data.lastEquipmentId}&gateCameraCode=${res.data.lastEquipmentCode}&weighHouseCode=${res.data.code}&primarySkin=${
                     this.primarySkin
                  }&primaryHair=${this.primaryHair}&primaryClean=${this.primaryClean}`
               });
            } else {
               this.$u.toast('未在磅房,请前往磅房后再试!!');
            }
         });
      },
      /**
       * 初始化 weoSocket
       */
      initWebSocket() {
         let wsUrl = `${webSocketUrl}?access_token=${uni.getStorageSync('token')}`;
         socket = uni.connectSocket({
            url: wsUrl,
            header: {
               CLIENT_TOC: 'Y'
            },
            complete: res => {
               console.log(res, 'socket结果');
            }
         });
         socket.onOpen(() => {
            console.log('onOpen');
         });
         // 获取服务器传来的数据,做相应处理
         socket.onMessage(res => {
            console.log('socketWeigh', res);
            let nowWeighObj = JSON.parse(res.data.slice(7));
            if (nowWeighObj.eqCode == this.weighHouseCode) {
               if (nowWeighObj.eqInfraredStatus) {
                  this.weighData.weigh = nowWeighObj.weigh;
               } else {
                  this.weighData.weigh = nowWeighObj.weigh;
               }
            }
         });
         socket.onClose(() => {
            console.log('webSocketClose');
            this.$u.toast('磅房中断');
         });
         socket.onError(err => {
            console.log('socket报错', err);
            this.$u.toast('出现错误,请重新进入该页面,重试!!');
         });
      },
      // 放空
@@ -299,6 +273,10 @@
      },
      // 放空弹窗确认
      evacuationConfirm() {
         this.weighData = {
            ...this.weighData,
            weigh: this.globalweigh
         };
         let mix = Object.assign(this.weighData, this.getWeightHouseObj);
         this.$reqPost('getOneEvacuation', mix, 'json').then(res => {
            console.log(res, '第一次放空');