yangan
2024-08-05 1a92541e81f43ea9b544919400b0835bb2b7ee2b
pages/loadUnload-page/selectTarget/selectTarget.vue
@@ -2,7 +2,7 @@
   <view class="main">
      <!-- 当前选择仓库 -->
      <view class="top-tag">
         <text>点击切换/选择仓库</text>
         <text style="margin-right:20rpx">点击切换/选择仓库</text>
         <u-tag 
         size='large'
         icon='map'
@@ -11,6 +11,7 @@
         ></u-tag>
      </view>
      <!-- 点击查看原盐钙镁 -->
         <view class="self-deliver">
               <view class="self-deliver_text">
                  查看原盐钙镁结果
@@ -22,6 +23,11 @@
                     @click="todoDetail"></u-button>
               </view>
            </view>
            <view
            v-if="messageObj.carNo"
         class="notice-bar"><u-notice-bar :text="messageText"
          :fontSize="30" :showIcon = 'true'
          ></u-notice-bar></view>
      <!-- <u--form labelPosition="top"
         labelWidth="20%"
         :borderBottom="false"
@@ -48,7 +54,7 @@
            text="查看该仓库收发单"
            @click.stop="formHandle"></u-button>
      </view> -->
      <!-- 煤场 -->
      <!-- 场地 -->
      <view class='div-box'>
            <u-empty mode="data"
                     icon="http://cdn.uviewui.com/uview/empty/data.png"
@@ -65,7 +71,7 @@
                        <view class=""></view>
                     </view>
                     <view class="second">
                        <view class="coal-name">{{ item.productName || '' }}</view>
                        <view class="coal-name">{{ item.productNames || item.productName }}</view>
                        <view class="order-type">{{ item.orderType || '' }}</view>
                     </view>
                     <view class="third">
@@ -73,11 +79,7 @@
                           <view class="third-line_text">客户名称:</view>
                           <view>{{ item.customerName }}</view>
                        </view>
                        <view class="third-line">
                           <view class="third-line_text">仓库:</view>
                           <view >{{ item.bunkerName }}</view>
                        </view>
                        <view class="third-line">
                        <view class="third-line"  v-if="item.productName === 'EDC'">
                           <view class="third-line_text">质检状态:</view>
                           <view> <u-tag :text="checkStatusList[item.checkStatus]" plain > </u-tag></view>
                        </view>
@@ -102,15 +104,14 @@
         <uni-table border stripe 
         emptyText="暂无更多数据">
               <uni-tr>
                  <uni-th width='140'
                  <uni-th width='120'
                  align="center">操作</uni-th>
                   <uni-th align="center" width='120'>产品</uni-th>
                  <uni-th align="center">车牌号</uni-th>
                  <uni-th align="center">类型</uni-th>
                  <uni-th align="center">皮重</uni-th>
                  <uni-th align="center">毛重</uni-th>
                  <uni-th align="center">净重</uni-th>
                  <uni-th align="center">数量</uni-th>
                  <uni-th align="center" width='200'>仓库</uni-th>
                  <uni-th align="center" width='100'>皮重</uni-th>
                  <uni-th align="center" width='100'>毛重</uni-th>
                  <uni-th align="center" width='100'>净重</uni-th>
                  <uni-th align="center" width='100'>数量</uni-th>
                   <!-- <uni-th align="center">仓库</uni-th> -->
                  <!-- <uni-th align="center">状态</uni-th> -->
                  
@@ -120,23 +121,21 @@
               <view class="btnBox"> 
                  <!--   -->
                  <u-button   text='查看'  @click="viewDetail(subItem)"></u-button>
                  <u-button type='primary' text='确认装卸'  v-if="subItem.flag" @click="enterOk(subItem)"></u-button>
                  <u-button type='primary' text='确认装卸'  v-if="subItem.flag && isBtnShow(item)" @click="enterOk(item,subItem)"></u-button>
                  </view></uni-td>
                  <uni-td align="center">
                     <view>{{ subItem.productName }}</view></uni-td>
                     <uni-td align="center">
                     <view style="width:150rpx">{{ subItem.carNo }}</view></uni-td>
               <uni-td>
                  <view class="name">{{ subItem.orderType }}</view>
                  <view>{{ subItem.bunkerName }}</view>
               </uni-td>
               <uni-td>
                  <view class="name">{{ subItem.skin }}</view>
                  <view class="name" v-if="subItem.skin">{{ Number(subItem.skin).toFixed(2) || ''  }}</view>
               </uni-td>
               <uni-td>
                  <view class="name">{{ subItem.hair }}</view>
                  <view class="name" v-if="subItem.hair"> {{  Number(subItem.hair).toFixed(2) || ''  }}</view>
               </uni-td>
                  <uni-td>
                  <view class="name">{{ subItem.clean }}</view>
                  <view class="name" v-if="(subItem.clean || (subItem.clean && subItem.clean === 0))">{{ Number(subItem.clean).toFixed(2) || ''}}</view>
               </uni-td>
               <uni-td>
                  <view class="name">{{ subItem.productQuantity }}</view>
@@ -171,29 +170,55 @@
               是否确认装卸?
               <view v-if="isNumOk || isClean">
                  <text>产品名称:{{activeObj.productName}}</text>
                  <view class="queren">
                     <text>请输入</text>:
                       <u--input
                          type='digit'
                          border="bottom"
                         :disabled="activeObj.productName === 'PVC' && activeObj.packingType === 5"
                        :placeholder="isNumOk ?  '数量' :'折吨'"
                        v-model="checkNum"
                     >
                     </u--input>
                     <text> {{isNumOk ? '件' : '吨' }}</text>
                     </view>
                     <!-- pvc 并且是大包 -->
                     <view class="pvcBig" v-if="activeObj.productName === 'PVC' && activeObj.packingType === 5">
                     <!-- 聚氯乙烯树脂 并且是大包 -->
                     <view class="pvcBig" v-if="activeObj.productName === '聚氯乙烯树脂' && activeObj.packingType === 5">
                        
                     </view>
                     <view v-if="isNumOk && activeObj.productQuantity">当前数量:{{activeObj.productQuantity}}件</view>
                     <view v-if="activeObj.containerNumber"><span>集装箱号:</span>{{activeObj.containerNumber}}</view>
               </view>
                     <view>是否空车出厂: <u-radio-group
                        v-model="isEmptyCar"
                         placement="row"
                         iconPlacement="right"
                         style="justify-content: space-evenly"
                     >
                        <u-radio
                        :key="1"
                        :label="'是'"
                        :name="'1'"
                        shape="circle"
                        iconSize="32"
                        label-size="32"
                        size="40"
                        >
                        </u-radio>
                        <u-radio
                        :key="0"
                        :label="'否'"
                        :name="'0'"
                        shape="circle"
                        iconSize="32"
                        label-size="32"
                        size="40"
                        >
                        </u-radio>
                     </u-radio-group></view>
            </view>
         </u-modal>
      <!-- 煤仓 -->
      <!-- 仓库 -->
      <!-- <u-action-sheet :actions="secondClassActionsList"
         :show="secondClassShow"
         cancelText='取消'
@@ -211,12 +236,41 @@
</template>
<script>
   import { mapState, mapMutations, mapGetters } from 'vuex';
   export default {
      props: {
         loadUnloadData: {
            type: Object,
            default: {}
         }
      },
      computed:{
         isBtnShow(){
            return function(item){
               console.log(item,'itemssss')
               if(!item){
                  return false
               }else{
                  if(this.errorStatusList.includes(item.status)){
                     return false
                  }else{
                     return true;
                  }
               }
            }
         },
         messageText(){
            if(this.messageObj.carNo){
               return `时间:${this.messageObj.now},${this.messageObj.carNo},产品${this.messageObj.productNames}在${this.messageObj.bunkerName}入场了,请及时检查!`
            }else{
               return '暂无消息'
            }
         },
           ...mapGetters(['websocketData'])
      },
      watch: {
         loadUnloadData: {
@@ -226,6 +280,29 @@
            },
            deep: true,
            immediate: true
         },
         //监听消息
         'websocketData': {
        handler(v) {
          console.log(v, '接受的ws数据');
          if(v) {
            if (v.startsWith('kgTipHead')) {
            console.log('vvvvv',v.slice(11))
               let nowWeighObj = JSON.parse(v.slice(11));
            console.log(nowWeighObj,'nowWeight');
            this.messageObj = nowWeighObj;
            //   this.messageList = JSON.parse(v.slice(5));
            //   this.messageList = {
            //     ...this.messageList,
            //     title: this.messageList.title.slice(0, 8) + '...',
            //     content: removeTags(this.messageList.content).trim().slice(0, 8) + '...'
            //   }
            //   this.messagePushShow = true;
            }
          }
        },
        deep: true,
        immediate: true
         }
      },
      data() {
@@ -234,20 +311,24 @@
               firstClass: "",
               secondClass: "",
               orderType: '',
               bunkerId:""
               bunkerIds:""
            },
            messageObj:{
               carNo:'',
            },
            isEmptyCar:null, //是否空车出厂
            checkStatusList:[
               '待取样','已取样','合格','不合格'
               '待取样','已取样','质检中','待复核','复核中','待审定','审定中','已完成'
            ],
            index: '',
            enterZx:false,
            typeText:'', // 确认装卸三种类型
            isNumOk:false, //计件
            isClean:false, // 折吨
            // 煤场操作菜单
            // 场地操作菜单
            firstClassActionsList: [],
            firstClassShow: false,
            // 煤仓操作菜单
            // 仓库操作菜单
            secondClassActionsList: [],
            secondClassShow: false,
            coalList: [],
@@ -259,6 +340,7 @@
            filedId: "",
            selectedCoal: [],
            orderTypeShow: false,
            pvcWeight:'',
            orderTypeList: [{
                  name: '外销',
                  id: Math.floor(Math.random() * 100) + 1,
@@ -270,14 +352,18 @@
            ],
            isOrderType: '请选择', //磅房类型是否选择了 选择了清空
            cleanIconClick: true, //修改点击清空磅房选择会出现
            errorStatusList:[0,1,6,24,27,26] // 不能点击确认装卸的状态
         };
      },
      methods: {
            getPVCWeight(){
         },
         viewDetail(item){
            //查看收发单详情
            uni.navigateTo({
               url: `/pages/loadUnload-page/loadUnlaodPageDetail/detail?id=${item.id}&checkId=${item.checkId}`
               url: `/subPages/loadUnlaodPageDetail/detail?id=${item.id}&checkId=${item.checkId}`
            });
         
         },
@@ -287,7 +373,8 @@
               this.userInfo.password = null
            })
         },
         // 获取煤场
         // 获取场地
         getDeptIdFiled() {
            uni.showLoading({
               title: "加载中"
@@ -296,10 +383,18 @@
               uni.hideLoading()
               if (res.code === 0) {
                  this.firstClassActionsList = res.data;
                  this.firstClassActionsList.unshift({name:'全部',id:res.data.map(item=>item.id).join(',')})
                  if(res.data.length){
                     this.dataForm.bunkerId = res.data[0].id;
                        uni.setStorageSync('bunkerId',res.data[0].id)
                     this.dataForm.firstClass = res.data[0].name;
                     if(!uni.getStorageSync('bunkerIds')){
                        this.dataForm.firstClass = '全部'
                        this.dataForm.bunkerIds = res.data.map(item=>item.id).join(',')
                         uni.setStorageSync('bunkerIds',res.data.map(item=>item.id).join(','))
                     }else{
                        this.dataForm.bunkerIds = uni.getStorageSync('bunkerIds');
                        uni.setStorageSync('bunkerIds',this.dataForm.bunkerIds)
                     }
                     this.getDetailData();
               
                  }
@@ -307,7 +402,7 @@
                  this.$u.toast('加载失败')
               }
            }).then(() => {
               this.getUserInfo()
            })
         },
         firstClassSelect() {
@@ -320,7 +415,8 @@
                 uni.showLoading({
                    title:'加载中'
                })
               this.$reqGet('getTaskCoalListByBunkerId', { bunkerId:this.dataForm.bunkerId }).then(res => {
               this.$reqGet('getTaskCoalListByBunkerId', { bunkerIds:this.dataForm.bunkerIds }).then(res => {
               uni.hideLoading();
               if (res.code === 0) {
                  this.detailData = res.data.map(item=>{
                     item.tmTaskCoalList.map(el=>{
@@ -330,27 +426,33 @@
                   return item;
                  });
                  console.log(this.detailData,'detailData')
               uni.hideLoading();
               }else if(res.code === 1){
                  this.detailData = [];
                  this.$u.toast(res.msg ? res.msg : '操作失败!!')
               }
            }).catch(err=>{
               this.detailData = [];
               this.$u.toast(res.msg ? res.msg : '操作失败!!')
            })
         },
         firstClassSelectClick(val) {
            this.dataForm.firstClass = val.name;
            this.dataForm.bunkerId= val.id;
            uni.setStorageSync('bunkerId', val.id);
            this.dataForm.bunkerIds= val.id;
            uni.removeStorageSync('bunkerIds')
            uni.setStorageSync('bunkerIds', val.id);
            this.getDetailData();
            this.filedId = val.id
         },
         formHandle() {
            if (!this.dataForm.firstClass) return this.$u.toast('请选择煤场或者煤仓');
            this.$nextTick(()=>{
                uni.navigateTo({
                  url: `/pages/loadUnload-page/loadUnload-detail/loadUnload-detail?bunkerId=${this.dataForm.bunkerId}`
               })
            })
         // formHandle() {
         //    if (!this.dataForm.firstClass) return this.$u.toast('请选择场地或者仓库');
         //    this.$nextTick(()=>{
          //       uni.navigateTo({
         //          url: `/pages/loadUnload-page/loadUnload-detail/loadUnload-detail?bunkerId=${this.dataForm.bunkerId}`
         //       })
         //    })
            
         },
         // },
         change(){
         },
@@ -358,23 +460,57 @@
         },
         open(){},
         enterOk(item){
            console.log('123',item)
         enterOk(parintItem,item){
            console.log(parintItem,'priintItem')
            // uni.request({
            //    url: `${BaseUrl}/admin/dict/type/tray_weight`,
            //    method: 'GET',
            //    header: {
            //    Authorization: 'Bearer' + ' ' + uni.getStorageSync('token'),
            //    clientToc: 'Y',
            //    'CLIENT_TOC': 'Y',
            // },
            //    success: (res) => {
            //       this.pvcWeight = res.data.data.find(item=>item.label === '5') ? Number(res.data.data.find(item=>item.label == '5').value) : '';
            //    }
            // })
         //  计件:   0 聚氯乙烯树脂 type
         //  折吨:
            this.activeObj = item;
            if(item.productQuantity){
            if( (parintItem.orderType === '外购' ||parintItem.orderType === '外购退' ) && item.isWeight === 0){
               this.isNumOk = true;
               this.isClean = false;
            }else if(item.isWeight === 1){
               //回显计数量
                this.checkNum  = item.productQuantity ? item.productQuantity : '';
            }else if( parintItem.orderType ==='外购' &&  item.isWeight === 1){
               this.isClean = true;
               this.isNumOk = false;
            }else{
               this.isNumOk = false;
               this.isClean = false;
            }
            //聚氯乙烯树脂
             if(parintItem.orderType ==='外销' && (/聚氯乙烯树脂/.test(item.productName) || item.productName === 'PVC')  && (item.packingType === 3 || item.packingType === 4)){
               this.isNumOk = true;
               this.isClean  = false;
            }
            //瓶装液氯条件
            //EDC 质检完成方可确认
            if(item.packingType === 1){
               this.isNumOk = true;
               this.isClean = false;
            }
            //
            //pvc大包自动计算折吨
            if(item.productName === 'PVC' && item.packingType === 5){
               this.checkNum =  (Number(item.productQuantity) * 60)
            if((/聚氯乙烯树脂/.test(item.productName) || item.productName === 'PVC')  && item.packingType === 5){
               this.isNumOk = true;
               this.isClean = false;
            }
            if(parintItem.orderType === '外购'){
               this.isEmptyCar = '1';
            }else if(parintItem.orderType === '外销' || parintItem.orderType === '外购退'){
               this.isEmptyCar = '0';
            }
         this.enterZx = true;
            
@@ -382,22 +518,35 @@
         closeModal(){
            this.enterZx = false;
            this.checkNum = '';
            this.isEmptyCar = null;
         },
         cancelModal(){
            this.enterZx = false;
            this.checkNum = '';
            this.isEmptyCar = null;
         },
         confirmModal(){
            this.enterZx = false;
                uni.showLoading({
                    title:'加载中'
                })
            this.$reqPost('confirmLoadAndUnload',{
                });
            console.log(this.activeObj,this.activeObj.productName ==='EDC' && this.activeObj.checkStatus !== 7,'12313')
            if(this.activeObj.productName ==='EDC' && this.activeObj.checkStatus !== 7){
               console.log('触发,’13131')
               this.enterZx = false;
               this.$u.toast(`请检查当前EDC订单质检状态后在确认装卸!`);
            }else if( this.isEmptyCar === null){
               this.$u.toast(`请检查${this.isNumOk ? '计件数量' :'折吨'},以及是否空车出厂项!`);
            }else{
               this.enterZx = false;
               this.$reqPost('confirmLoadAndUnload',{
               id: this.activeObj.id,
               productQuantity:this.isNumOk ? this.checkNum :this.activeObj.skin,
               productQuantity:this.isNumOk ? this.checkNum : '',
               discount:this.isClean ? this.checkNum : null,
               isEmptyCar:this.isEmptyCar,
               isPretendDischar:this.activeObj.isPretendDischar
             },'json').then(res=>{
               uni.hideLoading();
               console.log(res,'rez')
               this.checkNum = '';
               if(res.code === 1){
@@ -414,9 +563,12 @@
            }).catch((err) => {
                this.$u.toast(err.msg || '失败');
            }).finally(() => {
            uni.hideLoading();
                   
            })
            }
         },
         //判断是否是 三种特殊类型对应弹窗
         judgeTypeFun(name){
@@ -427,12 +579,10 @@
         todoDetail(){
            console.log()
            uni.navigateTo({
                  url: `/pages/loadUnload-page/checkTestDetails/index`
                  url: `/subPages/checkTestDetails/index`
               })
         }
      },
      onShow(){
@@ -443,39 +593,54 @@
               uni.hideLoading()
               if (res.code === 0) {
                  this.firstClassActionsList = res.data;
                  if(res.data.length === 1){
                     this.dataForm.bunkerId = res.data[0].id;
                     uni.setStorageSync('bunkerId', res.data[0].id)
                     this.dataForm.firstClass = res.data[0].name;
               
                  }
               } else {
                  this.$u.toast('加载失败')
               }
            }).then(() => {
               this.getUserInfo()
            })
      }
            });
      },
   }
</script>
<style lang="scss"
   scoped>
::-webkit-scrollbar{
        display: none;
   }
   .table{
   width: 100%;
  /deep/ .uni-table{
   min-width: 0!important;
   margin-left: 20rpx;
   width: auto;
  }
   
}
.notice-bar{
      margin-left: vww(10);
      margin-bottom: 20rpx;
      margin-top: 20rpx;
         width: 98%;
         .u-notice-bar{
            border-radius: 20rpx;
               margin-top: 20rpx;
               height: 40rpx;
         }
}
      // 自主配送
         .self-deliver {
         position: relative;
            position: relative;
            text-indent: 20rpx;
            top: vww(10);
            width: 95%;
            height: vww(40);
            margin: vww(8) 10rpx;
            margin: vww(13) 10rpx;
            margin-left: 20rpx;
            padding: 0 vww(8);
            background: #ffffff;
            box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(73, 120, 240, 0.14), 0rpx 7rpx 45rpx 0rpx rgba(73, 120, 240, 0.12);
@@ -488,6 +653,7 @@
               height: 28px !important;
               line-height: 40px;
               padding: 0 12px;
               text-indent: 0!important;
               font-size: 28rpx;
               font-weight: 300;
               color: #ffffff;
@@ -551,14 +717,15 @@
      position: relative;
      top: vww(-160);
      .top-tag{
             width: 33%;
             width: 60%;
            margin-left: 55%;
            height: 100rpx;
            margin-left: 65%;
            margin-left: 50%;
            display: flex;
            /* margin-top: 40rpx; */
            color: #fff;
            align-items: center;
            justify-content: space-between;
               }
               .div-box{
@@ -606,7 +773,7 @@
               }
            }
            .history-information {
         margin-bottom:50rpx;
         margin-bottom:30rpx;
         margin-top: 10rpx;
         background: #ffffff;
         border-radius: 20rpx;
@@ -655,7 +822,7 @@
         .third {
            width: 96%;
            height:  120rpx;
            height:  auto;
            font-size: 30rpx;
            font-weight: 300;
            color: #515151;