yangan
2023-12-20 6cb6a76d779335f8bc9f1e2a3431b2903558a075
pages/driver-page/driver-index/bill-of-lading-details/weighDetail/weighDetail.vue
@@ -59,7 +59,7 @@
               <view class="label-text">
                  扣渣后净重
               </view>
               <view class="count">{{ item.weight  || item.clean}}</view>
               <view class="count">{{ item.weight }}</view>
            </view>
         </view>
      </view>
@@ -188,7 +188,7 @@
            </view>
         </view>
         <!-- 新增扣罚种类、 扣罚金额,不合格判定种类-->
         <view class="notice-num">
         <!-- <view class="notice-num">
               <view class="num-text"
               style="margin-left: 10rpx;">
               <u--text text="扣罚种类"
@@ -204,11 +204,11 @@
            </view>
            <view class="num-show"
               v-else-if="flag">
               {{item.penaltyType}}
               {{item.penaltyType == '0' ? '无扣罚' : '其他扣罚'}}
            </view>
         </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="扣罚金额"
@@ -228,7 +228,7 @@
            </view>
         </view>
         <!--不合格判定种类  -->
         <view class="notice-num" v-if="item.penaltyType == '其他扣罚'" >
         <!-- <view class="notice-num" v-if="item.penaltyType == '其他扣罚'" >
               <view class="num-text"
               style="margin-left: 10rpx;">
               <u--text text="不合格判定"
@@ -249,7 +249,7 @@
               v-else-if="flag">
               <text> {{item.unqualifiedType == 1 ? '长度扣罚' : item.unqualifiedType == 2 ? '厚度扣罚' :item.unqualifiedType == 3 ? '密闭器' : null }} </text>
            </view>
         </view>
         </view> -->
         </view>
         <u-empty v-if=" isYanz() && !isShow(item) " icon-size="200"  text="''" >
            <text>暂未验质</text>
@@ -340,13 +340,38 @@
               v-else-if="flag">
               {{el.unqualifiedWeight || ''}}
            </view>
         </view>
         <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'>
               <!-- <u--input placeholder="请输入不合格重量"
                  border="bottom"
                  clearable
                  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>
            </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>
         </u--list-item>
      </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"
@@ -643,16 +668,25 @@
            return function(index){
               let arr = [];
               let temp = [];
               let noPin = [];
               const item = this.globalShowWeigh[index];
               console.log(this.globalShowWeigh[index],'index')
               if(item){
               if(item.unqualifiedBreed){
                  arr = item.unqualifiedBreed.split(",");
                  if(item.unqualifiedWeights){
                     temp = item.unqualifiedWeights.toString().split(',');
                  }
                  if(item.unqualifiedType){
                     noPin = item.unqualifiedType.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]}
                  let obj = {unqualifiedBreed:el,unqualifiedWeight:temp[index],unqualifiedType:noPin[index]}
                  return obj
                  })
                  console.log(result,temp,'arr')
@@ -668,7 +702,8 @@
         }
      },
      onShow(){
      onShow(params){
         console.log(params,'paramss')
         this.numAll(this.globalShowWeigh[this.indexFlag].unqualifiedWeights.split(","),this.indexFlag,this.showWeigh[this.indexFlag].clean)
      },
      mounted() {
@@ -684,6 +719,12 @@
         this.alterUnqualified = params.unqualified === "true" || false
         this.havedSubmit = params.havedSubmit === "true" || false;
         console.log(this.havedSubmit,'this.havedSubmit')
         uni.$on("handClick", res => {
            console.log(res.tempArr);
            this.showWeigh[res.index].tempArr = res.tempArr;
            // 清除监听
         })
      },
      methods: {
         ...mapMutations(['changeglobalShowWeigh']),
@@ -703,13 +744,15 @@
            }else{
                y = 0;
            }
            console.log(value,y,'yyyyyyyyy')
            if(x.minus(y).minus(z).toFixed(2)  <= 0){
            if(clean){
               if(x.minus(y).minus(z).toFixed(2)  <= 0){
                  this.showWeigh[index].weight = '0';
                  this.$u.toast('当前净重不合格,请检查皮重,毛重是否准确')
               }else{
                  this.showWeigh[index].weight = x.minus(y).minus(z).toFixed(2) ;
               }
            }
            
@@ -728,24 +771,36 @@
                  this.orderCode = res.data.orderCode
                  this.showWeigh = this.coalDetailsData.tmTaskCoalItems ? this.coalDetailsData
                     .tmTaskCoalItems : [];
                  this.showWeigh = this.showWeigh.map(v => {
                     if(!v.penaltyType) v.penaltyType = '0'
                  this.showWeigh = this.showWeigh.map((v,i) => {
                     if(!v.tempArr){
                        v.tempArr = ''
                     }else{
                        v.tempArr = JSON.parse(v.tempArr)
                     }
                     return {
                        ...v,
                        modifyProductName: '',
                        modifygoodsName: '',
                        fileList: [],
                        inspectionJpg: v.inspectionJpg.split(','),
                        isImage: v.inspectionJpg
                        isImage: v.inspectionJpg,
                        unqualifiedType:v.penaltyType,
                        tempArr:v.tempArr
                     }
                  })
                  this.showWeighCopy = JSON.parse(JSON.stringify(this.showWeigh))
                  uni.setStorageSync("showWeighCopyStorge", this.showWeighCopy)
                  if (this.havedSubmit) {
                     this.changeglobalShowWeigh(uni.getStorageSync('showWeighCopyStorgeOther'))
                  } else {
                     this.changeglobalShowWeigh(uni.getStorageSync('showWeighCopyStorge'))
                  }
                  uni.setStorageSync('showWeighCopyStorgeOther',this.showWeighCopy)
                  // if (this.havedSubmit) {
                  //    this.changeglobalShowWeigh(uni.getStorageSync('showWeighCopyStorge'))
                  //    this.changeglobalShowWeigh(uni.getStorageSync('showWeighCopyStorgeOther'))
                  // } else {
                  //    this.changeglobalShowWeigh(uni.getStorageSync('showWeighCopyStorgeOther'))
                  //    this.changeglobalShowWeigh(uni.getStorageSync('showWeighCopyStorge'))
                  // }
                  this.changeglobalShowWeigh(uni.getStorageSync('showWeighCopyStorge'))
                      this.changeglobalShowWeigh(uni.getStorageSync('showWeighCopyStorgeOther'))
                  //称重明细无数据时显示物资明细
                  if(!this.coalDetailsData.tmTaskCoalItems.length){
                     this.current = 0; 
@@ -796,32 +851,33 @@
         },
         // 点击确认
         confirmInput() {
            this.loading = 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 = '';
               }
               if(this.globalShowWeigh[i].unqualifiedWeights){
               unqualifiedWeightAll = this.globalShowWeigh[i].unqualifiedWeights.split(",").reduce((p,n)=>{return (p - 0) + (n - 0)},0)  || ''
               unqualifiedWeightAll = this.globalShowWeigh[i].unqualifiedWeights.split(",").reduce((p,n)=>{return (p - 0) + (n - 0)},0).toFixed(2)  || ''
               }else{
                  unqualifiedWeightAll =''
               }
               return {
                  ...v,
                  unqualifiedBreed: this.globalShowWeigh[i].unqualifiedBreed ? this.globalShowWeigh[i]
                     .unqualifiedBreed : v.unqualifiedBreed,
                  unqualifiedBreed: this.globalShowWeigh[i].unqualifiedBreed ,
                  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
                  unqualifiedWeight :unqualifiedWeightAll,
                  penaltyType:this.globalShowWeigh[i].unqualifiedType,
                  tempArr:this.globalShowWeigh[i].tempArr ? JSON.stringify(this.globalShowWeigh[i].tempArr) : ''
                  
               }
            })
            });
            console.log(this.globalShowWeigh,this.showWeigh,'this.gloa')
            this.loading = true;
            params.tmTaskCoalItems = this.showWeigh;
            this.$reqPost('updateTmTaskCoalItem', params, 'json').then(
               res => {
@@ -917,8 +973,9 @@
            });
         } // 如果没有小数点,首位不能为类似于 01、02的值
         
            this.showWeigh[index].cinderWeight = (value - 0)
            // 如果没有净重 ,则不进行计算
            if(clean){
               this.showWeigh[index].cinderWeight = (value - 0)
               let x = new BigNumber(clean - 0)
               let y = new BigNumber(value - 0)
               let z =  new BigNumber(znums.reduce((p,n)=>{
@@ -931,6 +988,10 @@
               }else{
                  this.showWeigh[index].weight = x.minus(y).minus(z).toFixed(2)
               }
            }else{
               this.$u.toast('当前无净重')
            }
            
            
         },
@@ -1036,7 +1097,7 @@
            }
         },
         deleteItem(i,index){
           let {unqualifiedBreed,unqualifiedWeights} =  this.globalShowWeigh[i];
           let {unqualifiedBreed,unqualifiedWeights,unqualifiedType} =  this.globalShowWeigh[i];
           this.indexFlag  = i; // 记录标识位
           console.log(this.globalShowWeigh[i],'index')
           if (this.roleType === 4 && !this.flag) {
@@ -1058,9 +1119,20 @@
            }else{
               unqualifiedWeights = '';
            }
            if(unqualifiedType.split(",").length > 1){
               let strArr = unqualifiedType.split(',');
                strArr.splice(index ,1)
                unqualifiedType = strArr.join(",")
            }else{
               unqualifiedType = '';
            }
             this.globalShowWeigh[i].unqualifiedBreed = unqualifiedBreed;
             this.globalShowWeigh[i].unqualifiedWeights = unqualifiedWeights;
             this.globalShowWeigh[i].unqualifiedType = unqualifiedType;
             this.globalShowWeigh[i].tempArr.splice(index,1)
             console.log(this.globalShowWeigh[i].unqualifiedBreed,'unqualifiedBreed')
             this.changeglobalShowWeigh(this.globalShowWeigh)
             }
             this.numAll(this.globalShowWeigh[this.indexFlag].unqualifiedWeights.split(","),this.indexFlag,this.showWeigh[this.indexFlag].clean)