yangan
2024-01-18 2e60df573ae7648e5df412b50a924cb52820b135
pages/driver-page/driver-index/bill-of-lading-details/weighDetail/weighDetail.vue
@@ -55,12 +55,22 @@
                  class="count">{{ item.cinderWeight }}
               </view>
            </view>
            <view class="weigh">
               <view class="label-text">
                  扣渣后净重
            <!-- 净重div -->
            <view class="weight-box">
               <view class="weigh-qualified">
               <view>
                  合格净重:
               </view>
               <view class="count">{{ item.weight }}</view>
               <view class="count">  {{  cleanWeight(item) }}</view>
            </view>
            <view class="weigh-qualified" v-for="el,index in unqualifiedArr(i)">
               <view>
                  不合格净重:
               </view>
               <view class="count">    {{el.unqualifiedWeight || ''}}</view>
            </view>
            </view>
         </view>
      </view>
         <!-- 判断是否检验质量 -->
@@ -97,7 +107,7 @@
            </view>
         </view>
         <view class="level"
            v-if='item.modifygoodsName||globalShowWeigh[i].modifyProductName'>
            v-if='item.modifygoodsName ||globalShowWeigh[i].modifyProductName'>
            <view style="width: 180rpx;">
               <u--text text="品名与规格"
                  size='32'></u--text>
@@ -108,6 +118,7 @@
                  {{!flag?(globalShowWeigh[i].modifyProductName?globalShowWeigh[i].modifyProductName:item.modifygoodsName):(item.breed+'/'+item.spec)}}
               </text>
            </view>
         </view>
         <!-- <view class="unqualifiedBreed">
            <view style="width: 180rpx;">
@@ -227,8 +238,28 @@
               {{item.penaltyAmount}}
            </view>
         </view>
         <!-- 单价 -->
         <view class="notice-num">
               <view class="num-text"
               style="margin-left: 10rpx;">
               <u--text text="单价"
                  size='32'></u--text>
            </view>
            <view class="num-input"
            v-if='roleType===4&&!flag'
            >
            <u--input placeholder="请输入单价"
                  border="bottom"
                  clearable
                  v-model="item.unitPrice"></u--input>
            </view>
            <view class="num-show"
               v-else-if="flag">
               {{item.unitPrice}}
            </view>
         </view>
         <!--不合格判定种类  -->
         <!-- <view class="notice-num" v-if="item.penaltyType == '其他扣罚'" >
         <view class="notice-num">
               <view class="num-text"
               style="margin-left: 10rpx;">
               <u--text text="不合格判定"
@@ -239,17 +270,17 @@
            @click.stop="onFoucus"
            style="height: 50rpx;"
            >
            <u-radio-group  size='32' v-model="item.unqualifiedType">
            <u-radio  :label-size="25" :name="1"  :label="'长度扣罚'" :disabled="disabled">长度扣罚</u-radio>
            <u-radio-group  size='32' v-model="item.penaltyType">
            <u-radio  :label-size="25" :name="'1'"  :label="'超尺扣罚'" :disabled="disabled">超尺扣罚</u-radio>
            <u-radio  :label-size="25" :name="'2'" :label="'厚度扣罚'" :disabled="disabled">厚度扣罚</u-radio>
            <u-radio  :label-size="25" :name="'3'" :label="'密闭器'" :disabled="disabled">密闭器</u-radio>
            </u-radio-group>
            </view>
            <view class="num-show"
               v-else-if="flag">
               <text> {{item.unqualifiedType == 1 ? '长度扣罚' : item.unqualifiedType == 2 ? '厚度扣罚' :item.unqualifiedType == 3 ? '密闭器' : null }} </text>
               <text> {{item.penaltyType == 1 ? '超尺扣罚' : item.penaltyType == 2 ? '厚度扣罚' :item.penaltyType == 3 ? '密闭器' : null }} </text>
            </view>
         </view> -->
         </view>
         </view>
         <u-empty v-if=" isYanz() && !isShow(item) " icon-size="200"  text="''" >
            <text>暂未验质</text>
@@ -342,9 +373,26 @@
            </view>
            
         </view>
         <view class="notice-num">
         <!-- <view class="notice-num">
            <view class="num-text">
               <u--text text="不合格品判定"
                  size='32'></u--text>
            </view>
            <view class="num-input"
               v-if='roleType===4&&!flag'>
                  <view class="num-show">
                     {{selectlist.find(item=>item.value ==el.unqualifiedType ) ? selectlist.find(item=>item.value ==el.unqualifiedType ).name : ''  }}
            </view>
            </view>
            <view class="num-show"
               v-else-if="flag">
               {{selectlist.find(item=>item.value ==el.unqualifiedType ) ? selectlist.find(item=>item.value ==el.unqualifiedType ).name : ''  }}
            </view>
         </view> -->
         <view class="notice-num">
            <view class="num-text">
               <u--text text="单价"
                  size='32'></u--text>
            </view>
            <view class="num-input"
@@ -355,13 +403,13 @@
                  v-model="el.unqualifiedWeight"
                  readonly
                  @input='v=>unqualifiedWeightInputHandle(v,i,item.clean)'></u--input> -->
                  <view class="num-show">
                     {{selectlist.find(item=>item.value ==el.unqualifiedType ) ? selectlist.find(item=>item.value ==el.unqualifiedType ).name : ''  }}
                  <view class="num-show"
>               {{el.penaltyUnitPrice || ''}}
            </view>
            </view>
            <view class="num-show"
               v-else-if="flag">
               {{selectlist.find(item=>item.value ==el.unqualifiedType ) ? selectlist.find(item=>item.value ==el.unqualifiedType ).name : ''  }}
               {{el.penaltyUnitPrice || ''}}
            </view>
            
         </view>
@@ -371,7 +419,7 @@
      </u--list>
      <!-- 增加不合格规矩 -->
      <button  class="addBtn"  type="primary"   :plain="false"  @click="addUnqualified(i)">添加不合格品类</button>
      <button  class="addBtn" v-if="isShow(item) && isYanz()" type="primary"   :plain="false"  @click="addUnqualified(i)">添加不合格品类</button>
         <!-- 物资明细 -->
         <u-action-sheet :actions="goodsList"
            :show="goodsShow"
@@ -559,7 +607,7 @@
            selectlist:[
               {
                  value: '1',
                  name:'长度扣罚',
                  name:'超尺扣罚',
                  fontSize:'40'
               },
               {
@@ -669,6 +717,7 @@
               let arr = [];
               let temp = [];
               let noPin = [];
               let noPrice = [];
               const item = this.globalShowWeigh[index];
               console.log(this.globalShowWeigh[index],'index')
               if(item){
@@ -681,12 +730,15 @@
                     noPin = item.unqualifiedType.toString().split(',');
                  }
                  if(item.penaltyUnitPrice){
                     noPrice = item.penaltyUnitPrice.toString().split(',')
                  }
                  //  if(item.penaltyType){
                  //    noPin = item.penaltyType.toString().split(',');
                  // }
                 
                   let result =  arr.length && arr.map((el,index)=>{
                  let obj = {unqualifiedBreed:el,unqualifiedWeight:temp[index],unqualifiedType:noPin[index]}
                  let obj = {unqualifiedBreed:el,unqualifiedWeight:temp[index],unqualifiedType:noPin[index],penaltyUnitPrice:noPrice[index]}
                  return obj
                  })
                  console.log(result,temp,'arr')
@@ -699,7 +751,22 @@
               
            }
         },
         cleanWeight(){
            return function(item){
               console.log(item,'itemsssss')
               if(!item.weight){
                  return ''
               }else if(item.weight && !item.unqualifiedWeight){
                  return item.weight
               }else if(item.weight && item.unqualifiedWeight){
                  return (item.weight - (item.unqualifiedWeight - 0)).toFixed(2)
               }else{
                  return ''
               }
            }
         }
      },
      onShow(params){
@@ -851,18 +918,22 @@
         },
         // 点击确认
         confirmInput() {
            let flag = true;
            let params = {},unqualifiedWeightAll;
            params.qualityInstructions = this.qualityInstructions;
            params.remarks = this.remarks;
            this.showWeigh = this.showWeigh.map((v, i) => {
               if(!v.penaltyType) {
                  v.penaltyAmount = '';
                  v.unqualifiedType = '';
             v.unqualifiedType = '';
               if(!v.unitPrice){
                   flag = false;
               }
               if(this.globalShowWeigh[i].unqualifiedWeights){
               unqualifiedWeightAll = this.globalShowWeigh[i].unqualifiedWeights.split(",").reduce((p,n)=>{return (p - 0) + (n - 0)},0).toFixed(2)  || ''
               }else{
                  unqualifiedWeightAll =''
                  unqualifiedWeightAll = 0;
               }
               return {
                  ...v,
@@ -870,14 +941,15 @@
                  breed: this.globalShowWeigh[i].modifyProductName ? this.globalShowWeigh[i].breed : v.breed,
                  spec: this.globalShowWeigh[i].modifyProductName ? this.globalShowWeigh[i].spec : v.spec,
                  inspectionJpg: v.fileList.map(v => v.url.replace(BaseUrl, '')).join(','),
                  unqualifiedWeights :this.globalShowWeigh[i].unqualifiedWeights,
                  unqualifiedWeight :unqualifiedWeightAll,
                  penaltyType:this.globalShowWeigh[i].unqualifiedType,
                  tempArr:this.globalShowWeigh[i].tempArr ? JSON.stringify(this.globalShowWeigh[i].tempArr) : ''
                  unqualifiedWeights :this.globalShowWeigh[i].unqualifiedWeights ? this.globalShowWeigh[i].unqualifiedWeights : 0,
                  unqualifiedWeight :unqualifiedWeightAll ,
                  // penaltyType:this.globalShowWeigh[i].unqualifiedType,
                  tempArr:this.globalShowWeigh[i].tempArr ? JSON.stringify(this.globalShowWeigh[i].tempArr) : '',
                  penaltyUnitPrice:this.globalShowWeigh[i].penaltyUnitPrice,
                  
               }
            });
            console.log(this.globalShowWeigh,this.showWeigh,'this.gloa')
            if(flag){
            this.loading = true;
            params.tmTaskCoalItems = this.showWeigh;
            this.$reqPost('updateTmTaskCoalItem', params, 'json').then(
@@ -895,6 +967,11 @@
                     this.$u.toast(res.msg ? res.msg : '操作失败')
                  }
               })
            }else{
               this.$u.toast('请输入单价')
               return
            }
         },
         // 校验数据是否合格 
         checkValue(data,target){
@@ -938,7 +1015,7 @@
               // this.actionShow = true
               // this.actionIndex = index
               uni.navigateTo({
                  url: `/pages/public-page/selectSpecifications/selectSpecifications?index=${index}&takeCoalId=${this.orderPlanId}&productName=${this.willProductName}`
                  url: `/pages/public-page/selectSpecifications/selectSpecifications?index=${index}&takeCoalId=${this.orderPlanId}&productName=${this.willProductName}&pageFlag=${false}`
               })
            }
         },
@@ -983,11 +1060,11 @@
                  return (p - 0) + (n - 0)
               },0))
               console.log(clean,value,'扣渣');
               if(x.minus(y).minus(z).toFixed(2) <= 0){
               if(x.minus(y).toFixed(2) <= 0){
                  this.showWeigh[index].weight = '0';
                  this.$u.toast('当前净重不合格,请检查皮重,毛重是否准确')
               }else{
                  this.showWeigh[index].weight = x.minus(y).minus(z).toFixed(2)
                  this.showWeigh[index].weight = x.minus(y).minus(z);
               }
            }else{
               this.$u.toast('当前无净重')
@@ -1094,11 +1171,11 @@
                  url: `/pages/public-page/selectSpecifications/selectSpecifications?index=${i}&takeCoalId=${this.orderPlanId}&unqualified=${this.willUnqualified}&type=add`
               })
               console.log(this.globalShowWeigh[i],'2222')
               this.numAll(this.globalShowWeigh[i].unqualifiedWeights.split(","),i,this.showWeigh[i].clean)
               // this.numAll(this.globalShowWeigh[i].unqualifiedWeights.split(","),i,this.showWeigh[i].clean)
            }
         },
         deleteItem(i,index){
           let {unqualifiedBreed,unqualifiedWeights,unqualifiedType} =  this.globalShowWeigh[i];
           let {unqualifiedBreed,unqualifiedWeights,unqualifiedType,penaltyUnitPrice} =  this.globalShowWeigh[i];
           this.indexFlag  = i; // 记录标识位
           console.log(this.globalShowWeigh[i],'index')
           if (this.roleType === 4 && !this.flag) {
@@ -1121,16 +1198,24 @@
               unqualifiedWeights = '';
            }
            if(unqualifiedType.split(",").length > 1){
               let strArr = unqualifiedType.split(',');
            // if(unqualifiedType.split(",").length > 1){
            //    let strArr = unqualifiedType.split(',');
            //     strArr.splice(index ,1)
            //     unqualifiedType = strArr.join(",")
            // }else{
            //    unqualifiedType = '';
            // }
            if(penaltyUnitPrice.split(",").length > 1){
               let strArr = penaltyUnitPrice.split(',');
                strArr.splice(index ,1)
                unqualifiedType = strArr.join(",")
                penaltyUnitPrice = strArr.join(",")
            }else{
               unqualifiedType = '';
               penaltyUnitPrice = '';
            }
             this.globalShowWeigh[i].unqualifiedBreed = unqualifiedBreed;
             this.globalShowWeigh[i].unqualifiedWeights = unqualifiedWeights;
             this.globalShowWeigh[i].unqualifiedType = unqualifiedType;
            //  this.globalShowWeigh[i].unqualifiedType = unqualifiedType;
             this.globalShowWeigh[i].penaltyUnitPrice = penaltyUnitPrice;
             this.globalShowWeigh[i].tempArr.splice(index,1)
             console.log(this.globalShowWeigh[i].unqualifiedBreed,'unqualifiedBreed')
             this.changeglobalShowWeigh(this.globalShowWeigh)
@@ -1162,6 +1247,20 @@
      justify-content: space-between;
      align-items: center;
   }
   .weigh-qualified{
      display: flex;
      flex-direction: row;
      justify-content: space-around;
      height: 160rpx;
   }
   .weight-box{
      display: flex;
      height: 160rpx;
      margin-bottom: 20rpx;
      flex-direction: column;
      overflow-y: scroll;
   }
   /deep/ .u-picker {
      height: 600rpx;