819527061@qq.com
2024-08-27 10207852795508714a0f84bd7934cbbf6a80f572
pages/driver-page/driver-index/bill-of-lading-details/nocarNoWeighingDevice/nocarNoWeighingDevice.vue
@@ -1,5 +1,11 @@
<template>
  <view class="weighingDevice">
    <div class="shuaxinBtn">
      <u-button
          @click="refreshClick"
          type="primary"
          :plain="true">点击刷新</u-button>
    </div>
    <view class="one"
          :style="{ backgroundImage: `url(${onlineurl}/appimg/image/banner/weighbanner.png)`, backgroundSize: 'cover', backgroundRepeat: 'no-repeat' }">
      <view class="top">
@@ -51,6 +57,19 @@
          <view class="prefix">订单类型:</view>
          <view class="suffix">{{ weighList.orderType || '' }}</view>
        </view>
        <view class="main-information">
          <view class="prefix">产品:</view>
          <view class="suffix">{{ weighList.coalName || '' }}</view>
        </view>
        <view class="main-information">
          <view class="prefix">车牌号:</view>
          <view class="suffix">{{ weighList.noCarNo == 1 ? '无车牌' : weighList.carNo }}</view>
        </view>
<!--        xsUser1Name-->
        <view class="main-information">
          <view class="prefix">司机姓名:</view>
          <view class="suffix">{{ weighList.xsUser1Name || '' }}</view>
        </view>
        <!-- <view class="main-information"  v-if="isweight">
          <view class="prefix">皮重:</view>
          <view class="suffix">
@@ -83,23 +102,80 @@
    </view>
    <!--  称重历史-->
    <weigh-item :list="weighHistory" class="weighingDecive-item"></weigh-item>
    <view class="chengzhong-btn">
    <!--   applyHouseId有磅房号,noCarNo=1(无车牌号),status=15,质检员 把符合上面条件的加上称重按钮   -->
      <u-button type="primary"
                text="确定称重"
                :disabled="applyHouseId && noCarNo == 1 && status == 15 && roledType == 4"
                :loading="isConfirmWeighLoading"
                loadingText="确认"
                @click="confirmWeigh"></u-button>
    <!--  iszj,是否已质检字段  质检员身份+有tmId+质检之前  -->
    <view class="three">
      <!-- .外购订单,不出现返回加减吨的按钮 -->
      <view class="chengzhong-btn" v-if="applyHouseId && noCarNo == 1 && status == 15 && roleType == 4">
        <!--   applyHouseId有磅房号,noCarNo=1(无车牌号),status=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">
        &lt;!&ndash;   收发单信息时 status: 领取(0),预约(1),签到(2),入场(3),称皮(4),称毛(5),离场(6), 入磅房(7),出磅房(8),入煤仓(9),出煤仓(10)
        ,放空(11),作废(12),入场申请(13),进入场院(14),申请计量(15);  &ndash;&gt;
        <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="chengzhong-btn marginTop">
      <!--   收发单信息时   -->
      <u-button type="primary"
                text="复磅"
                :disabled="weighData.tmId && roledType == 4"
                :loading="repeatWeighLoading"
                loadingText="确认"
                @click="confirmRepeatWeigh"></u-button>
    <!-- 放空弹窗 -->
    <view class="evacuationModal">
      <u-modal :show="evacuationModalShow"
               :title="evacuationTitle"
               :content="evacuationContent"
               :showCancelButton="true"
               @confirm="evacuationConfirm"
               @cancel="evacuationCancel"></u-modal>
    </view>
  </view>
</template>
@@ -112,8 +188,9 @@
export default {
  onLoad(params) {
    console.log(params,'params===')
    this.tmId = params.tmId;
    this.weighData.sceneId = params.houseId;
    this.tmId = params?.tmId || '';  //提煤单id
    this.weighData.sceneId = params?.houseId; //磅房id
    this.changeweighHouseCode(params?.weighHouseCode);
    this.changeWeigh('')
  },
  components: {
@@ -122,6 +199,7 @@
  },
  data() {
    return {
      statusWeigh: '',  //状态
      isWeighing:'',
      timer:null,
      weighData: {
@@ -183,6 +261,9 @@
      applyHouseId:'',  //磅房号
      noCarNo:0,  //是否有车牌号(有车牌0,无车牌1)
      status:null,  //状态
      orderCode:'',
      showModal: false,
      modalContent: '确认要复磅吗?'
    };
  },
  watch: {
@@ -192,8 +273,10 @@
    // 监听重量变化
    globalweigh: {
      handler: function(newV) {
        if(newV) {
        console.log(newV,'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;
@@ -266,14 +349,17 @@
  },
  computed: {
    ...mapState(['globalweigh', 'globalinfraredStatus', 'globalWarning', 'globalisconnect', 'globalisUploadimg',
      'globalisLogin', 'socketTask','is_open_socket'
    ...mapState(['globalinfraredStatus', 'globalWarning', 'globalisconnect', 'globalisUploadimg',
      'globalisLogin', 'socketTask','is_open_socket',
    ]),
    ...mapGetters(['globalweigh']),
    token() {
      return uni.getStorageSync('token');
    },
    roleType() {
      return uni.getStorageSync('roleType');
      console.log(uni.getStorageSync('userInfo'),'roleType----称重页面')
      console.log(uni.getStorageSync('userInfo').type,'type----type')
      return uni.getStorageSync('userInfo').type;
    },
    weightStatus(){
      //称重是否异常   1.无车 2.连接中 3.正常;
@@ -310,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;
      }
    },
@@ -358,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: {
@@ -366,9 +499,13 @@
      uni.showLoading({
        title: '加载中'
      })
      console.log(this.weighData.sceneId,'磅房----')
      // 获取称重信息
      this.$reqGet('weighList', { id: this.tmId }).then(res => {
        console.log(res, '获取称重信息');
      let params = {}
      this.tmId ? params = { tmId: this.tmId, houseId: this.weighData.sceneId } : params = { houseId: this.weighData.sceneId }
      console.log(params,'参数===')
      this.$reqGet('getTmTaskCoalNoCar', params).then(res => {
        console.log(res, '提煤单信息');
        uni.hideLoading()
        if (res.code == 0) {
          this.weighList = res.data;
@@ -380,20 +517,68 @@
          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 {
          Object.keys(this.weighList).forEach(key => {
            this.weighList[key] = '';
          });
          this.$u.toast(res.msg ? res.msg : '占无磅单信息');
        }
      });
    },
    // confirmWeigh() {  //点击确认称重按钮
    //
    // },
    // 确认称重接口
    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()
    },
    confirmWeigh() {  //点击确认称重按钮
      this.isConfirmWeighLoading = true
      if (this.isConfirmWeighLoading == false) {
        this.isConfirmWeighLoading = true
        if(this.weighData.weigh != 0) {
          if (this.weighList.orderType == '外销') {
            if (this.weighList.skin ? (this.weighList.skin < this.realTimeWeigh ? true : false) : true) {
              this.saveWeigh();
            } else {
              this.$u.toast('毛重不能小于皮重');
              this.isConfirmWeighLoading = false;
            }
          } else {
            this.saveWeigh();
          }
        }else {
          this.$u.toast('未能获取地磅重量');
          this.isConfirmWeighLoading = false;
        }
      }
    },
    // 确认称重接口
    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) {
@@ -412,11 +597,123 @@
            this.isConfirmWeighLoading = false;
            console.log(err);
            this.$u.toast(err.msg ? err.msg : '称重失败');
          });
          }).finally(() => {
        this.isConfirmWeighLoading = false;
      });
    },
    confirmRepeatWeigh() {  //复磅
    }
    confirmAction() {  //复磅
      this.showModal = true
    },
    confirmRepeatWeigh() {  //复磅二次确认
      this.repeatWeighLoading = true
      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;
            setTimeout(() => {
              uni.navigateBack({
                delta: 1
              });
              this.$u.toast('复磅成功');
            },1000)
            // setTimeout(() => {
            //   uni.navigateBack({
            //     delta: 1
            //   });
            // }, 1000);
          }else {
            this.$u.toast('复磅失败,请稍后重试' + (res.msg ? res.msg : ''));
          }
        }).finally(() => {
          this.repeatWeighLoading = false;
        })
      }else {
        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>
@@ -518,7 +815,7 @@
  .one {
    // flex: 3;
    height: 290rpx;
    margin: vww(20);
    margin: vww(10) vww(20) vww(20) vww(20);
    border-radius: vww(15);
    .top {
@@ -670,11 +967,12 @@
  .bottom-block {
    width: calc(100% - 60rpx);
    box-sizing: border-box;
    height: 420rpx;
    margin: 0 vww(15) vww(15) vww(15);
    background: #ffffff;
    box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(73, 120, 240, 0.14), 0rpx 7rpx 45rpx 0rpx rgba(73, 120, 240, 0.12);
    border-radius: 20rpx;
    padding: 20rpx 0;
    box-sizing: border-box;
    @include flex;
    justify-content: center;
    overflow: hidden;
@@ -715,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;
    }
  }
@@ -745,11 +1043,23 @@
    justify-content: space-between;
  }
}
.chengzhong-btn{
  width: 80%;
  margin: 0 auto;
}
.marginTop{
  margin-top: 20rpx;
}
.weighingDevice{
  .shuaxinBtn{
    width: calc(100% - 80rpx);
    margin: 20rpx auto 0;
    ::v-deep{
      .u-button--plain.u-button--primary{
        border-radius: 60rpx;
      }
      .u-button--normal{
        padding: 0 25rpx;
        font-size: 28rpx;
      }
    }
  }
}
</style>