819527061@qq.com
2024-08-27 10207852795508714a0f84bd7934cbbf6a80f572
pages/driver-page/driver-index/bill-of-lading-details/nocarNoWeighingDevice/nocarNoWeighingDevice.vue
@@ -102,22 +102,80 @@
    </view>
    <!--  称重历史-->
    <weigh-item :list="weighHistory" class="weighingDecive-item"></weigh-item>
    <view class="chengzhong-btn" v-if="applyHouseId && noCarNo == 1 && status == 15 && roleType == 4">
    <!--   applyHouseId有磅房号,noCarNo=1(无车牌号),status=15,质检员 把符合上面条件的加上称重按钮   -->
      <u-button type="primary"
                text="确定称重"
                :loading="isConfirmWeighLoading"
                loadingText="确认"
                @click="confirmWeigh"></u-button>
    </view>
    <!--  iszj,是否已质检字段  质检员身份+有tmId+质检之前  -->
    <view class="chengzhong-btn marginTop" v-if="weighData.tmId && roleType == 4">
      <!--   收发单信息时   -->
      <u-button type="primary"
                text="复磅"
                :loading="repeatWeighLoading"
                loadingText="确认"
                @click="confirmRepeatWeigh"></u-button>
    <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="evacuationModal">
      <u-modal :show="evacuationModalShow"
               :title="evacuationTitle"
               :content="evacuationContent"
               :showCancelButton="true"
               @confirm="evacuationConfirm"
               @cancel="evacuationCancel"></u-modal>
    </view>
  </view>
</template>
@@ -141,6 +199,7 @@
  },
  data() {
    return {
      statusWeigh: '',  //状态
      isWeighing:'',
      timer:null,
      weighData: {
@@ -202,6 +261,9 @@
      applyHouseId:'',  //磅房号
      noCarNo:0,  //是否有车牌号(有车牌0,无车牌1)
      status:null,  //状态
      orderCode:'',
      showModal: false,
      modalContent: '确认要复磅吗?'
    };
  },
  watch: {
@@ -212,8 +274,9 @@
    globalweigh: {
      handler: function(newV) {
        console.log(newV,'newV===')
        if(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;
@@ -333,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;
      }
    },
@@ -381,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: {
@@ -391,34 +501,6 @@
      })
      console.log(this.weighData.sceneId,'磅房----')
      // 获取称重信息
      // 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,'参数===')
@@ -435,14 +517,39 @@
          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 {
          this.weighList = {}
          Object.keys(this.weighList).forEach(key => {
            this.weighList[key] = '';
          });
          this.$u.toast(res.msg ? res.msg : '占无磅单信息');
        }
      });
    },
    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()
@@ -470,7 +577,8 @@
    // 确认称重接口
    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) {
@@ -493,18 +601,31 @@
        this.isConfirmWeighLoading = false;
      });
    },
    confirmRepeatWeigh() {  //复磅
    confirmAction() {  //复磅
      this.showModal = true
    },
    confirmRepeatWeigh() {  //复磅二次确认
      this.repeatWeighLoading = true
      if(this.weighData.weigh != 0) {
      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;
            this.$u.toast('复磅成功');
            setTimeout(() => {
              uni.navigateBack({
                delta: 1
              });
            }, 1000);
              this.$u.toast('复磅成功');
            },1000)
            // setTimeout(() => {
            //   uni.navigateBack({
            //     delta: 1
            //   });
            // }, 1000);
          }else {
            this.$u.toast('复磅失败,请稍后重试' + (res.msg ? res.msg : ''));
          }
@@ -515,7 +636,84 @@
        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>
@@ -815,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;
    }
  }
@@ -845,10 +1043,7 @@
    justify-content: space-between;
  }
}
.chengzhong-btn{
  width: 80%;
  margin: 0 auto;
}
.marginTop{
  margin-top: 20rpx;
}