qingyiay
2023-10-08 cbfc1953c7e7333dbcb1e43fff15433ed24fc543
pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue
@@ -2,6 +2,9 @@
   <view class="bill-of-lading-details">
      <view class="top-banner"
         style="background: url('https://mx.jzeg.cn:9095/appimg/image/banner/loadingbanner.png') no-repeat;background-size: cover;">
         <u-notice-bar :text="originInfoNotice"
            v-if="originInfoVisible"
            fontSize='36'></u-notice-bar>
         <view class="top-information">
            <view class="cutomer-name"
               v-if="orderType == '转入' || orderType == '转出'">煤场:{{ coalDetailsData.toFiledName || '' }}</view>
@@ -22,7 +25,7 @@
                  <view class="status-button"
                     style="background: url('https://mx.jzeg.cn:9095/appimg/image/banner/statusbutton.png') no-repeat;
                              background-size: cover;">
                     {{ coalStatus[coalDetailsData.status] || '' }}
                     {{coalStatus[correctStatus]||''}}
                  </view>
               </view>
               <view class="time">
@@ -63,6 +66,7 @@
            <view class="origin-info_content">
               <view class="first-line"><combined-title title="原发信息"></combined-title></view>
               <u-form :model="originInfoForm"
                  :rules="rules"
                  label-position="top"
                  label-width="160"
                  :label-style="{'marginLeft':'9px'}"
@@ -130,7 +134,7 @@
                        height="150"
                        :previewFullImage="true"
                        :disabled="isModifyoriginInfo"
                        :deletable='!deletable'></u-upload>
                        :deletable="!deletable"></u-upload>
                  </u-form-item>
               </u-form>
               <view class="submit-button">
@@ -168,7 +172,7 @@
                  plain
                  @click="rcsqClick"
                  shape="circle"
                  :disabled="coalDetailsData.status === 3"></u-button>
                  :disabled="correctStatus>= 3"></u-button>
            </view>
            <view class="bottom-button">
               <u-button text="放空"
@@ -241,7 +245,7 @@
      </view>
      <!-- 磅房忙碌提示弹窗 -->
      <view class="">
         <u-modal :show="wsgVisiable"
         <u-modal :show="wsgShow"
            title="提示"
            :content="wsgContent"
            @confirm="wsgContentConfirm"></u-modal>
@@ -256,10 +260,13 @@
   import combinedTitle from '@/components/combined-title/combined-title.vue';
   import BigNumber from "bignumber.js"
   const dayjs = require('dayjs')
   import isBetween from 'dayjs/plugin/isBetween'
   export default {
      components: {
         combinedTitle
      },
      onPullDownRefresh() {
         this.getTakeCoal(); //获取提煤单详情
         uni.stopPullDownRefresh();
      },
      onLoad(value) {
         this.orderPlanId = value.orderPlanId;
@@ -270,15 +277,18 @@
            this.getWeightHouseObj.overTmWaixiao = value.overTmWaixiao
         }
         this.fileList1 = []
         dayjs.extend(isBetween)
         this.changeglobalIsFirstWeighing(1)
         if (this.globalIsFirstWeighing === 1) {
            console.log('获取详情 onload');
            this.getTakeCoal(); //获取提煤单详情
         }
         this.init(); //获取日志
         this.getgetService(); //获取客服
      },
      onShow() {
         this.coalDayPage(); //获取日志 定时任务
         if (this.globalIsFirstWeighing === 2) {
            console.log('获取详情 onShow');
            this.getTakeCoal(); //获取提煤单详情
         }
      },
@@ -326,7 +336,7 @@
               serviecePhone: ''
            },
            coalStatus: ['领取', '预约', '签到', '入场', '称皮', '称毛', '离场', '入磅房', '出磅房', '入煤仓', '出煤仓', '放空', '作废', '入场申请',
               '进入场院', '异常审核中'
               '进入场院', '异常审核中', '返回加减吨', '超时', '打印中', '打印中'
            ], // 状态
            weighHouseCode: '',
            // 放空弹窗控制变量
@@ -381,29 +391,20 @@
            originInfoVisible: false,
            fileList1: [], //图片列表
            deletable: true,
            rules: {
               contactPicture: {
                  type: 'string',
                  required: true,
                  message: '请上传原发磅单图片',
                  trigger: ['blur', 'change']
               },
               coalContactHair: {
                  type: 'string',
                  required: true,
                  message: '请输入毛重',
                  trigger: ['blur', 'change']
               },
               coalContactSkin: {
                  type: 'string',
                  required: true,
                  message: '请输入皮重',
                  trigger: ['blur', 'change']
               }
            },
            rules: {},
            timeout: '0',
            wsgShow: false,
            timeLineStatus: null,
            originInfoNotice: '填写原发信息后可上磅计量'
         };
      },
      watch: {
         '$store.state.wsgVisiable': {
            deep: true,
            handler: function(val) {
               this.wsgShow = val
            }
         }
      },
      computed: {
         ...mapState(['globalweigh', 'globalinfraredStatus', 'wsgVisiable', 'wsgContent', 'globalIsFirstWeighing']),
@@ -428,7 +429,7 @@
            return this.coalDetailsData.hair !== 0 || this.coalDetailsData.skin !== 0;
         },
         isapproach() {
            return this.currentPageCoalStatus !== 3;
            return this.correctStatus !== 3
         },
         coalContactClean() {
            let xx = BigNumber(this.originInfoForm.coalContactHair ? this.originInfoForm.coalContactHair : 0)
@@ -444,6 +445,10 @@
            let minutes = ("0" + currentDate.getMinutes()).slice(-2);
            let formattedDate = year + "-" + month + "-" + date + " " + hours + ":" + minutes;
            return formattedDate
         },
         correctStatus() {
            return this.currentPageCoalStatus === this.timeLineStatus ? this.currentPageCoalStatus : this
               .timeLineStatus
         }
      },
      methods: {
@@ -451,7 +456,7 @@
         init() {
            this.$reqGet('coalDayPage', { id: this.orderPlanId, timeout: this.timeout }).then(res => {
               if (res.code == 0) {
                  // this.dayRZ = res.data;
                  this.timeLineStatus = res.data[0].taskStatus
                  this.dayRZ = res.data.map(v => {
                     let slicedate = v.taskStatusDes.slice(0, 10);
                     if (slicedate == this.currentDate) {
@@ -480,7 +485,7 @@
                  uni.setStorageSync('customeropenId', this.serviceInfoObj.openId);
                  uni.setStorageSync('customerName', this.serviceInfoObj.openName);
               }
            });
            })
         },
         // 获取提煤单详情
         getTakeCoal() {
@@ -517,24 +522,17 @@
                  this.primarySkin = this.coalDetailsData.skinTwo;
                  this.primaryHair = this.coalDetailsData.hairTwo;
                  this.primaryClean = this.coalDetailsData.cleanTwo;
                  // 判断当前时间是否超出预约时间
                  let endTime = this.coalDetailsData.yuYueSection.slice(0, 10) + ' ' + this.coalDetailsData
                     .yuYueSection.slice(-5);
                  if (dayjs(this.currentTime).isAfter(endTime) && this.coalDetailsData.status <= 1) {
                     this.$u.toast('已超出预约时间,可点击入场申请重新入场')
                     this.timeout = '1'
                  }
                  // 入门证 和 出门证 是否显示
                  this.ablePrintInduction = this.coalDetailsData.hair || this.coalDetailsData.skin
                  this.ablePrintOut = this.coalDetailsData.hair && this.coalDetailsData.skin || this
                     .coalDetailsData.status === 6
                  // 原发信息回显以及控制是否可修改
                  this.haveInputOrigin = !this.coalDetailsData.skinTwo && this.coalDetailsData.orderType ===
                     '外购'
                  this.deletable = this.isModifyoriginInfo = this.coalDetailsData.status > 3
                  this.deletable = this.coalDetailsData.status > 3
                  this.originInfoForm.coalContactSkin = this.coalDetailsData.skinTwo;
                  this.originInfoForm.coalContactHair = this.coalDetailsData.hairTwo;
                  this.originInfoForm.contactPicture = this.coalDetailsData.contactPicture
                  if (this.coalDetailsData.contactPicture) {
                     this.fileList1 = this.coalDetailsData.contactPicture.split(',').map(v => {
                        return {
@@ -565,7 +563,16 @@
                  }
               }
            }).then(() => {
               this.getgetService(); //获取客服
               // 判断当前时间是否超出预约时间
               setTimeout(() => {
                  let endTime = this.coalDetailsData.yuYueSection.slice(0, 10) + ' ' + this
                     .coalDetailsData
                     .yuYueSection.slice(-5);
                  if (dayjs(this.currentTime).isAfter(endTime) && this.coalDetailsData.status <= 1) {
                     this.$u.toast('已超出预约时间,可点击入场申请重新入场')
                     this.timeout = '1'
                  }
               }, 1000)
            })
         },
         // 日志查询
@@ -573,6 +580,7 @@
            this.interval = setInterval(() => {
               this.$reqGet('coalDayPage', { id: this.orderPlanId, timeout: this.timeout }).then(res => {
                  if (res.code == 0) {
                     this.timeLineStatus = res.data[0].taskStatus
                     this.dayRZ = res.data.map(v => {
                        let slicedate = v.taskStatusDes.slice(0, 10);
                        if (slicedate == this.currentDate) {
@@ -681,6 +689,13 @@
                  this.weighData.gateCameraId = res.data.lastEquipmentId;
                  this.weighData.equipmentCode = res.data.lastEquipmentCode;
                  this.weighData.sceneInOut = res.data.sceneInOut;
                  let form = {
                     sceneId: this.weighData.sceneId,
                     gateCameraId: this.weighData.gateCameraId,
                     equipmentCode: this.weighData.equipmentCode,
                     sceneInOut: this.weighData.sceneInOut,
                  }
                  uni.setStorageSync('WeighHouseForm', JSON.stringify(form))
                  this.weighHouseCode = res.data.code;
                  uni.navigateTo({
                     url: `/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice?takeCoalId=${this.orderPlanId}&sceneId=${
@@ -737,24 +752,41 @@
               title: '正在打印中,请稍后'
            })
            this.enterLoading = true
            this.$reqGet('printer', { type: 2, tmId: this.coalDetailsData.id }).then(res => {
               uni.hideLoading()
               this.enterLoading = false
               console.log(res);
               if (res.code === 0) {
                  this.$u.toast('打印成功')
               } else {
                  this.$u.toast(res.msg ? res.msg : '打印失败')
               }
            })
            let form = {
               deptId: this.getWeightHouseObj.deptId,
               tmId: this.getWeightHouseObj.tmId,
               carNo: uni.getStorageSync('carNo'),
               type: 2,
               weighingNumber: 1
            }
            this.$reqPost('printer', Object.assign(form, JSON.parse(uni.getStorageSync('WeighHouseForm'))),
               'json').then(
               res => {
                  uni.hideLoading()
                  this.enterLoading = false
                  console.log(res);
                  if (res.code === 0) {
                     this.$u.toast('打印成功')
                  } else {
                     this.$u.toast(res.msg ? res.msg : '打印失败')
                  }
               })
         },
         // 打印出门证
         printExitPermit() {
            uni.showLoading({
               title: '正在打印中,请稍后'
            })
            let form = {
               deptId: this.getWeightHouseObj.deptId,
               tmId: this.getWeightHouseObj.tmId,
               carNo: uni.getStorageSync('carNo'),
               type: 3,
               weighingNumber: 2
            }
            this.outLoading = true
            this.$reqGet('printer', { type: 3, tmId: this.coalDetailsData.id }).then(res => {
            this.$reqPost('printer', Object.assign(form, JSON.parse(uni.getStorageSync('WeighHouseForm'))),
               'json').then(res => {
               uni.hideLoading()
               this.outLoading = false
               if (res.code === 0) {
@@ -781,7 +813,8 @@
            this.isfocus2 = false;
         },
         inputChange() {
            if (Number(this.originInfoForm.coalContactHair) > 0 && Number(this.originInfoForm.coalContactSkin > 0)) {
            if (Number(this.originInfoForm.coalContactHair) > 0 && Number(this.originInfoForm.coalContactSkin >
                  0)) {
               this.isInputOrigin = true;
            }
         },
@@ -823,7 +856,8 @@
                  name: 'file',
                  success: res => {
                     if (num == 1) {
                        this.originInfoForm.contactPicture = JSON.parse(res.data).data.url;
                        this.originInfoForm.contactPicture = JSON.parse(res.data)
                           .data.url;
                        resolve(`${BaseUrl}${JSON.parse(res.data).data.url}`);
                     }
                  }
@@ -843,18 +877,25 @@
               taskCoalCode: this.coalDetailsData.code,
               carNo: this.coalDetailsData.carNo,
            }
            this.$refs.originInfoRef.validate().then(res => {
            if (this.originInfoForm.coalContactSkin && this.originInfoForm.coalContactHair && this
               .originInfoForm
               .contactPicture) {
               this.$reqPost('appSaveContact', form, 'json').then(res => {
                  if (res.code === 0) {
                     this.$u.toast('提交成功')
                     this.getTakeCoal()
                  } else {
                     this.isModifyoriginInfo = true
                     this.$u.toast(res.msg ? res.msg : '提交失败')
                  }
               }).then(() => {
                  setTimeout(() => {
                     this.getTakeCoal()
                  }, 1000)
               })
            }).catch(errors => {
            } else {
               uni.$u.toast('请填写完整原发信息')
            })
            }
         }
      }
   };