yangan
2023-11-21 0937a09b807ae3d615e2e13d7b254a952b9f99ce
pages/driver-page/driver-index/bill-of-lading-details/weighDetail/weighDetail.vue
@@ -36,6 +36,7 @@
               <view class="num">{{ item.clean }}</view>
            </view>
         </view>
            <view v-if="isShow(item) && isYanz()">
         <view class="discount">
            <view class="rate">
               <view class="label-text">
@@ -58,13 +59,14 @@
               <view class="label-text">
                  扣渣后净重
               </view>
               <view class="count">{{ item.weight }}</view>
               <view class="count">{{ item.weight  || item.clean}}</view>
            </view>
         </view>
      </view>
         <!-- 判断是否检验质量 -->
         <view v-if="isShow(item)">
         <view v-if="isShow(item) && isYanz()">
            <view class="level">
            <view style="width: 140rpx;">
            <view style="width: 180rpx;">
               <u--text text="物资明细"
                  size='32'></u--text>
            </view>
@@ -126,16 +128,21 @@
               <u--text text="通知数量"
                  size='32'></u--text>
            </view>
            <view class="num-input"
            <view class="num-input "
               v-if='roleType===4&&!flag'>
               <u--input placeholder="请输入通知数量"
               <u-input placeholder="请输入通知数量"
                  border="bottom"
                  clearable
                  v-model="item.num"></u--input>
                  style="width: 70%;"
                  v-model="item.num">
               <template slot="suffix">
                  <text class="inp-unit">{{   item.numUnit}}</text>
               </template>
               </u-input>
            </view>
            <view class="num-show"
               v-else-if="flag">
               {{item.num}}
               {{item.num + item.numUnit}}
            </view>
         </view>
         <view class="notice-num">   
@@ -147,19 +154,90 @@
            <view class="num-input"
            v-if='roleType===4&&!flag'
            >
            <u--input placeholder="请输入通知重量"
            <u-input placeholder="请输入通知重量"
                  border="bottom"
                  clearable
                  v-model="item.weight1"></u--input>
                  style="width: 70%;"
                  v-model="item.weight1">
                  <template slot="suffix">
                  <text class="inp-unit">{{   item.weightUnit  }}</text>
               </template>
               </u-input>
            </view>
            <view class="num-show"
               v-else-if="flag">
               {{item.weight1}}
               {{item.weight1 + item.weightUnit }}
            </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-radio"
            v-if='roleType===4&&!flag'
            >
            <u-radio-group  size='34' v-model="item.penaltyType">
            <u-radio  :label-size="32" :name="'0'"  :label="'无扣罚'" :disabled="disabled">无扣罚</u-radio>
            <u-radio  :label-size="32"  :name="'其他扣罚'"  :label="'其他扣罚'" :disabled="disabled">其他扣罚</u-radio>
            </u-radio-group>
            </view>
            <view class="num-show"
               v-else-if="flag">
               {{item.penaltyType}}
            </view>
         </view>
         <!-- 扣罚金额 -->
         <view class="notice-num" v-if="item.penaltyType == '其他扣罚'">
               <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.penaltyAmount"></u--input>
            </view>
            <view class="num-show"
               v-else-if="flag">
               {{item.penaltyAmount}}
            </view>
         </view>
         <!--不合格判定种类  -->
         <view class="notice-num" v-if="item.penaltyType == '其他扣罚'" >
               <view class="num-text"
               style="margin-left: 10rpx;">
               <u--text text="不合格判定"
                  size='32'></u--text>
            </view>
            <view class="num-radio"
            v-if='roleType===4&&!flag'
            @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  :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>
            </view>
         </view>
         </view>
         <u-empty v-else icon-size="200"  text="''" >
         <u-empty v-if=" isYanz() && !isShow(item) " icon-size="200"  text="''" >
            <text>暂未验质</text>
         </u-empty>
         <u-empty v-if="!isYanz()" icon-size="200"  text="''" >
            <text>暂无数据</text>
         </u-empty>
         <view style="display: flex;margin-top: 20rpx;margin-left: 20rpx;"
            v-if="item.isImage">
@@ -215,6 +293,49 @@
               @select="selectUnqualifiedClick"></u-action-sheet>
         </view>
      </view>
      <!-- 新增 验质备注。验质说明 -->
      <view v-if=" isYanz()">
         <view v-if="coalDetailsData.orderType == '外购'">
      <view style="padding: 10rpx;">
      <u-row  >
                    <u-col span="24" >
                        <view class="demo-layout bg-purple-light" style="display: flex;">
                     <text style="font-size: 32rpx;">验质说明:</text>
                     <view style="display: inline-block;"
                     v-if='roleType===4&&!flag'
                     >
                     <u--input placeholder="请输入验质说明"
                           border="bottom"
                           clearable
                           v-model="qualityInstructions"></u--input>
                     </view>
                     <view class="num-show"
                        v-else-if="flag">
                        {{ qualityInstructions }}
                     </view>
                  </view>
                    </u-col>
                </u-row>
         </view>
         <view style="padding: 10rpx;">
            <u-row >
                    <u-col span="24">
                        <view class="demo-layout bg-purple-light" >
                     <text style="font-size: 32rpx;">验质备注:</text>
                     <view style="width: 50%;"
                     v-if='roleType===4&&!flag'
                     >
                     <u-textarea border="surround" v-model="remarks" ref="textarea" placeholder="请输入验质备注"></u-textarea>
                     </view>
                     <view class="num-show"
                        v-else-if="flag">
                      {{ remarks }}
                     </view>
                  </view>
                    </u-col>
                </u-row>
            </view>
         </view>
      <view class="confirm-button"
         v-if='roleType===4&&!flag'>
         <u-button type="primary"
@@ -224,13 +345,15 @@
            :loading="loading"
            loading-text="确认"></u-button>
      </view></view>
      </view>
      <!-- 物料明细 -->
      <view v-if="!current">
         <view class="main-block"
         v-for="(item,i) in goodsList"
         :key="item.id">
         <view class="level">
            <view style="width: 140rpx;">
            <view style="width: 180rpx;">
               <u--text text="物资名称"
                  size='32'></u--text>
            </view>
@@ -325,8 +448,29 @@
   export default {
      data() {
         return {
            qualityInstructions:"",
            remarks:'',
            selectlist:[
               {
                  value: '1',
                  name:'长度扣罚',
                  fontSize:'40'
               },
               {
                  value: '2',
                  name:'厚度扣罚',
                  fontSize:'40'
               },
               {
                  value: '3',
                  name:'密闭器',
                  fontSize:'40'
               }
            ],
            orderPlanId: "",
            title: '素胚勾勒出青花,笔锋浓转淡',
            isWeighingType:'',
         subTitle: '2020-05-15',
         thumb: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg',
            coalDetailsData: {},
@@ -395,6 +539,23 @@
            return    uni.getStorageSync('roleType')!== 4 && item.iszj == 1 ? true :  uni.getStorageSync('roleType')== 4 ? true : false;
                // 已经验质
            }
         },
         //判断需不需要验质
         isYanz(){
            return function(item){
            // return     ( this.coalDetailsData.orderType !=='外购' ||   this.coalDetailsData.weighingType !=='回磅') ? false : true;
            if(this.coalDetailsData.orderType =='外购'){
               if(this.coalDetailsData.weighingType == '回磅'){
                  return true
               }else{
                  return false
               }
            }else if(this.coalDetailsData.orderType =='外销'){
               return false;
            }
                // 已经验质
            }
         }
      },
      mounted() {
@@ -420,10 +581,13 @@
               if (res.code == 0) {
                  uni.hideLoading()
                  this.coalDetailsData = res.data;
                  this.remarks  = res.data.remarks;
                  this.qualityInstructions = res.data.qualityInstructions
                  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'
                     return {
                        ...v,
                        modifyProductName: '',
@@ -440,6 +604,11 @@
                  } else {
                     this.changeglobalShowWeigh(uni.getStorageSync('showWeighCopyStorge'))
                  }
                  //称重明细无数据时显示物资明细
                  if(!this.coalDetailsData.tmTaskCoalItems.length){
                     this.current = 0;
                  }
                  this.isWeighingType = res.data.weighingType //当前磅单是否回磅
               } else {
                  this.$u.toast('加载失败')
                  uni.hideLoading()
@@ -485,8 +654,15 @@
         },
         // 点击确认
         confirmInput() {
            this.loading = true
            this.loading = true;
            let params = {};
            params.qualityInstructions = this.qualityInstructions;
            params.remarks = this.remarks;
            this.showWeigh = this.showWeigh.map((v, i) => {
               if(!v.penaltyType) {
                  v.penaltyAmount = '';
                  v.unqualifiedType = '';
               }
               return {
                  ...v,
                  unqualifiedBreed: this.globalShowWeigh[i].unqualifiedBreed ? this.globalShowWeigh[i]
@@ -497,7 +673,8 @@
               }
            })
            this.$reqPost('updateTmTaskCoalItem', this.showWeigh, 'json').then(
            params.tmTaskCoalItems = this.showWeigh;
            this.$reqPost('updateTmTaskCoalItem', params, 'json').then(
               res => {
                  if (res.code == 0) {
                     this.loading = false
@@ -512,6 +689,20 @@
                     this.$u.toast(res.msg ? res.msg : '操作失败')
                  }
               })
         },
         // 校验数据是否合格
         checkValue(data,target){
            if(!data.length){
               return
            }
            let flag = data.find(item=>item[target] <=0);
            console.log(flag,'flag');
             if(flag){
               return false
            }else{
               return true;
            }
         },
         // 物资明细
         goodsPopoverShow(index) {
@@ -533,6 +724,7 @@
            this.showWeigh[this.goodsIndex].breed = val.breed
            this.showWeigh[this.goodsIndex].spec = val.spec
            this.showWeigh[this.goodsIndex].weightUnit = val.weightUnit
            this.showWeigh[this.goodsIndex].weight1 = val.weight;
         },
         // 品名与规格
         productNamePopoverShow(index) {
@@ -555,13 +747,18 @@
         // 折扣率输入
         discountInputHandle(value, index, clean) {
            console.log('计算净重',value, index, clean)
            value = Number(value)
            this.showWeigh[index].cinderWeight = Number(value)
            if (clean) {
               let x = new BigNumber(clean)
               let y = new BigNumber(value)
               this.showWeigh[index].weight = x.minus(y).toFixed(2)
            }
            this.showWeigh[index].cinderWeight = (value - 0)
               let x = new BigNumber(clean - 0)
               let y = new BigNumber(value - 0)
               let z =  new BigNumber(this.showWeigh[index].unqualifiedWeight - 0)
               console.log(clean,value,this.showWeigh[index].unqualifiedWeight - 0,'扣渣');
               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)
               }
            
         },
         // 选择不合格品名
@@ -582,17 +779,18 @@
         },
         // 不合格重量输入
         unqualifiedWeightInputHandle(value, index, clean) {
            value = value + 0;
            let x = new BigNumber(clean)
            let y = new BigNumber(value)
            let z;
            if(!this.showWeigh[index].cinderWeight){
             z = 0;
            }else{
             z = new BigNumber(this.showWeigh[index].cinderWeight);
            }
            console.log(value, index, clean,'不合格重量输入')
            this.showWeigh[index].weight = x.minus(y).minus(z).toFixed(2) || ''
            // 判断是不是有净重才进行计算
            let x = new BigNumber(clean - 0)
            let y = new BigNumber(value - 0)
            let z = new BigNumber(this.showWeigh[index].cinderWeight -  0);
            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) ;
               }
         },
         // 删除图片
         deletePic(event) {
@@ -641,6 +839,14 @@
         //点击tab 切换展示明细
         tabChange(val){
            this.current = val;
         },
         //下拉框聚焦时间
         onFoucus(val){
            this.focusSelect = true;
         },
         closeEvent(){
            this.focusSelect = false;
         }
      },
   }
@@ -754,6 +960,11 @@
            .num-input {
               width: 60%;
               border-bottom: 1px solid rgb(218, 219, 222);
               position: relative;
            }
            .num-radio{
               width: 60%;
               font-size: 100rpx;
            }
            .num-show {