819527061@qq.com
2024-07-05 c3db9f5a903f7213f14d9eaafc804ecdb3bdf2a0
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,20 +102,19 @@
    </view>
    <!--  称重历史-->
    <weigh-item :list="weighHistory" class="weighingDecive-item"></weigh-item>
    <view class="chengzhong-btn">
    <view class="chengzhong-btn" v-if="applyHouseId && noCarNo == 1 && status == 15 && roleType == 4">
    <!--   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>
    </view>
    <view class="chengzhong-btn marginTop">
    <!--  iszj,是否已质检字段  质检员身份+有tmId+质检之前  -->
    <view class="chengzhong-btn marginTop" v-if="weighData.tmId && roleType == 4">
      <!--   收发单信息时   -->
      <u-button type="primary"
                text="复磅"
                :disabled="weighData.tmId && roledType == 4"
                :loading="repeatWeighLoading"
                loadingText="确认"
                @click="confirmRepeatWeigh"></u-button>
@@ -112,8 +130,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: {
@@ -192,6 +211,7 @@
    // 监听重量变化
    globalweigh: {
      handler: function(newV) {
        console.log(newV,'newV===')
        if(newV) {
          this.weighData.weigh = this.realTimeWeigh = newV;
          if  ((this.weighList.orderType == '外销')) {
@@ -266,14 +286,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.正常;
@@ -366,9 +389,41 @@
      uni.showLoading({
        title: '加载中'
      })
      console.log(this.weighData.sceneId,'磅房----')
      // 获取称重信息
      this.$reqGet('weighList', { id: this.tmId }).then(res => {
        console.log(res, '获取称重信息');
      // 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,'参数===')
      this.$reqGet('getTmTaskCoalNoCar', params).then(res => {
        console.log(res, '提煤单信息');
        uni.hideLoading()
        if (res.code == 0) {
          this.weighList = res.data;
@@ -383,15 +438,37 @@
          this.outBuy = (this.weighList.orderType.indexOf('销') !== -1) && this.showWeigh.skin > 0;
          // 继续卸货只有外购类型第二次会有
          this.canUnload = this.weighList.orderType === '外购' && this.showWeigh.hair > 0;
        }else {
          this.weighList = {}
          this.$u.toast(res.msg ? res.msg : '占无磅单信息');
        }
      });
    },
    // confirmWeigh() {  //点击确认称重按钮
    //
    // },
    // 确认称重接口
    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')
          .then(res => {
@@ -412,10 +489,32 @@
            this.isConfirmWeighLoading = false;
            console.log(err);
            this.$u.toast(err.msg ? err.msg : '称重失败');
          });
          }).finally(() => {
        this.isConfirmWeighLoading = false;
      });
    },
    confirmRepeatWeigh() {  //复磅
      this.repeatWeighLoading = true
      if(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);
          }else {
            this.$u.toast('复磅失败,请稍后重试' + (res.msg ? res.msg : ''));
          }
        }).finally(() => {
          this.repeatWeighLoading = false;
        })
      }else {
        this.$u.toast('未能获取地磅重量');
        this.repeatWeighLoading = false;
      }
    }
  }
};
@@ -518,7 +617,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 +769,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;
@@ -752,4 +852,19 @@
.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>