yangan
2023-12-14 2deaf260457e02e2b80e0b9124b334a747a67868
pages/driver-page/driver-index/bill-of-lading-details/weighDetail/weighDetail.vue
@@ -46,7 +46,7 @@
                  class="count-input">
                  <u--input placeholder="请输入扣渣"
                     border="bottom"
                     type="number"
                     type="digit"
                     clearable
                     v-model="item.cinderWeight"
                     @input='v=>discountInputHandle(v,i,item.clean)'></u--input>
@@ -65,6 +65,23 @@
      </view>
         <!-- 判断是否检验质量 -->
         <view v-if="isShow(item) && isYanz()">
            <view class="level">
               <view style="width: 180rpx;">
               <u--text text="供应商"
                  size='32'></u--text>
            </view>
            <view style="font-size: 35rpx;">{{ coalDetailsData.customerName || '' }}</view>
            </view>
            <view class="level">
               <view style="width: 180rpx;">
               <u--text text="物料名称"
                  size='32'></u--text>
            </view>
            <view style="font-size: 35rpx;">{{ (coalDetailsData.coalName ? coalDetailsData.coalName: '') }}</view>
            </view>
            <view class="level">
            <view style="width: 180rpx;">
               <u--text text="物资明细"
@@ -280,7 +297,7 @@
               :height="0"
            >
               <u-cell
                  :title="(index + 1) +  '.' + '不合格规格'"
                  :title="(index + 1) +  '.' + '不合格品类'"
                  style="text-indent: 30RPX;"
                  @click="editItem(i,index)"
               >
@@ -316,12 +333,12 @@
                  readonly
                  @input='v=>unqualifiedWeightInputHandle(v,i,item.clean)'></u--input> -->
                  <view class="num-show"
>   {{el.unqualifiedWeight}}
>               {{el.unqualifiedWeight || ''}}
            </view>
            </view>
            <view class="num-show"
               v-else-if="flag">
               {{el.unqualifiedWeight}}
               {{el.unqualifiedWeight || ''}}
            </view>
         </view>
         </view>
@@ -329,7 +346,7 @@
      </u--list>
      <!-- 增加不合格规矩 -->
      <button  class="addBtn"  type="primary"   :plain="false"  @click="addUnqualified(i)">添加不合格规矩</button>
      <button  class="addBtn"  type="primary"   :plain="false"  @click="addUnqualified(i)">添加不合格品类</button>
         <!-- 物资明细 -->
         <u-action-sheet :actions="goodsList"
            :show="goodsShow"
@@ -630,8 +647,10 @@
               if(item){
               if(item.unqualifiedBreed){
                  arr = item.unqualifiedBreed.split(",");
                   temp = item.unqualifiedWeights.toString().split(',');
                  if(item.unqualifiedWeights){
                     temp = item.unqualifiedWeights.toString().split(',');
                  }
                   let result =  arr.length && arr.map((el,index)=>{
                  let obj = {unqualifiedBreed:el,unqualifiedWeight:temp[index]}
                  return obj
@@ -778,13 +797,18 @@
         // 点击确认
         confirmInput() {
            this.loading = true;
            let params = {};
            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].unqualifiedWeight){
               unqualifiedWeightAll = this.globalShowWeigh[i].unqualifiedWeight.split(",").reduce((p,n)=>{return (p - 0) + (n - 0)},0)  || ''
               }else{
                  unqualifiedWeightAll =''
               }
               return {
                  ...v,
@@ -794,7 +818,7 @@
                  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 :this.globalShowWeigh[i].unqualifiedWeight.split(",").reduce((p,n)=>{return (p - 0) + (n - 0)},0)
                  unqualifiedWeight :unqualifiedWeightAll
                  
               }
            })
@@ -871,12 +895,33 @@
         },
         // 折扣率输入
         discountInputHandle(value, index, clean) {
            let znums;
            if(this.globalShowWeigh[index].unqualifiedWeights){
               znums = this.globalShowWeigh[index].unqualifiedWeights.split(',')
            }else{
               znums = []
            }
            console.log('计算净重',value, index, clean)
            this.indexFlag  = index; // 记录标识位
            if (
               value &&
               value.indexOf(".") < 0 &&
               value != ""
         ) {
            value = parseFloat(value);
            value = value + ""; // 变回为字符串
         }else{
            value =  value.replace(/^(-)*(\d+)\.(\d\d).*$/,"$1$2.$3");
            this.$nextTick(()=>{
               this.showWeigh[index].cinderWeight  = value.replace(/[^\d.]/g, "");
            });
         } // 如果没有小数点,首位不能为类似于 01、02的值
            this.showWeigh[index].cinderWeight = (value - 0)
               let x = new BigNumber(clean - 0)
               let y = new BigNumber(value - 0)
               let z =  new BigNumber(this.globalShowWeigh[index].unqualifiedWeights.split(',').reduce((p,n)=>{
               let z =  new BigNumber(znums.reduce((p,n)=>{
                  return (p - 0) + (n - 0)
               },0))
               console.log(clean,value,'扣渣');