qingyiay
2023-07-07 837c21ced9ed0aafe17a7c0c16975a1b6731eb9d
pages/driver-page/driver-index/bill-of-lading-details/weighDetail/weighDetail.vue
@@ -42,42 +42,52 @@
                  <u--input placeholder="请输入扣渣"
                     border="bottom"
                     clearable
                     v-model="item.discount"
                     v-model="item.cinderWeight"
                     @input='v=>discountInputHandle(v,i,item.clean)'></u--input>
               </view>
               <view v-else-if='flag'
                  class="count">{{ item.discount }}%
                  class="count">{{ item.cinderWeight }}
               </view>
            </view>
            <view class="weigh">
               <view class="label-text">
                  扣渣后净重
               </view>
               <view class="count">{{ item.discountWeight }}</view>
               <view class="count">{{ item.weight }}</view>
            </view>
         </view>
         <view class="level">
            <view class=""
               style="width: 70rpx;">
               <u--text text="蓝本"
                  size='32'></u--text>
            </view>
            <u-tag :text="MaterialList[i].breed+MaterialList[i].spec||'暂无'"
               plain
               @click="productNamePopoverShow(i)"
               v-if='MaterialList[i].breed&&MaterialList[i].spec||roleType===4'></u-tag>
         </view>
         <view class="level"
            v-if='modifyMaterialList[i].modifyProductName'>
            <view style="width: 70rpx;">
               <u--text text="修正"
            v-if='!flag'>
            <view class=""
               style="width: 140rpx;">
               <u--text text="物资明细"
                  size='32'></u--text>
            </view>
            <view>
               <u-tag :text="modifyMaterialList[i].modifyProductName"
                  plain></u-tag>
            <u-tag :text="item.breed+item.spec||item.modifygoodsName||'暂无'"
               plain
               @click="goodsPopoverShow(i)"
               v-if='item.breed&&item.spec||roleType===4'></u-tag>
         </view>
         <view class="level"
            v-if='item.modifygoodsName||flag'>
            <view style="width: 140rpx;">
               <u--text text="产品名称"
                  size='32'></u--text>
            </view>
            <view v-if="showWeighCopy[i].modifyProductName||item.breed&&item.spec">
               <u-tag :text="!flag?showWeighCopy[i].modifyProductName:item.breed+item.spec"
                  plain
                  @click="productNamePopoverShow(i)"></u-tag>
            </view>
         </view>
         <!-- 物资明细 -->
         <u-action-sheet :actions="goodsList"
            :show="goodsShow"
            cancelText='取消'
            :closeOnClickOverlay='true'
            @close='goodsNameClose'
            @select="goodsselectClick"></u-action-sheet>
         <!-- 产品列表 -->
         <view class="">
            <u-action-sheet :actions="actionsList"
               :show="actionShow"
@@ -107,10 +117,15 @@
            orderPlanId: "",
            coalDetailsData: {},
            showWeigh: [],
            showWeighCopy: [],
            discountrate: "",
            loading: false,
            show: false,
            selectIndex: null,
            // 物资明细
            goodsList: [],
            goodsShow: false,
            goodsIndex: null,
            // 产品列表
            actionsList: [],
            actionShow: false,
@@ -119,11 +134,7 @@
            havedInput: false,
            flag: false,
            orderCode: null,
            // 物资明细list
            MaterialList: [],
            // 修改之后的物资明细list
            modifyMaterialList: [],
            // 修改之后的产品名称
            modifyProductName: null,
            // 是否修改
            isModify: false
@@ -156,6 +167,15 @@
                  this.orderCode = res.data.orderCode
                  this.showWeigh = this.coalDetailsData.tmTaskCoalItems ? this.coalDetailsData
                     .tmTaskCoalItems : [];
                  this.showWeigh = this.showWeigh.map(v => {
                     return {
                        ...v,
                        modifyProductName: '',
                        modifygoodsName: ''
                     }
                  })
                  this.showWeighCopy = JSON.parse(JSON.stringify(this.showWeigh))
                  uni.hideLoading()
               } else {
                  this.$u.toast('加载失败')
@@ -163,8 +183,12 @@
               }
            }).then(() => {
               this.$reqGet('getMaterialDetailByOrderCode', { orderCode: this.orderCode }).then(r => {
                  this.MaterialList = r.data
                  this.modifyMaterialList = JSON.parse(JSON.stringify(this.MaterialList))
                  this.goodsList = r.data.map(v => {
                     return {
                        ...v,
                        name: v.breed + v.spec
                     }
                  })
                  uni.hideLoading()
               })
            })
@@ -202,14 +226,8 @@
            this.showWeigh = this.showWeigh.map((v, i) => {
               return {
                  ...v,
                  itemId: this.MaterialList[i].itemId,
                  Num: this.MaterialList[i].Num,
                  NumUnit: this.MaterialList[i].NumUnit,
                  Remark: this.MaterialList[i].Remark,
                  spec: this.modifyMaterialList[i].modifyProductName ? this.actionsList[i].spec : this
                     .MaterialList[i].spec,
                  breed: this.modifyMaterialList[i].modifyProductName ? this.actionsList[i]
                     .secondCategoryName : this.MaterialList[i].breed
                  breed: this.showWeighCopy[i].modifyProductName ? this.showWeighCopy[i].breed : v.breed,
                  spec: this.showWeighCopy[i].modifyProductName ? this.showWeighCopy[i].spec : v.spec
               }
            })
            this.$reqPost('updateTmTaskCoalItem', this.showWeigh, 'json').then(
@@ -228,20 +246,42 @@
                  }
               })
         },
         // 物资明细
         goodsPopoverShow(index) {
            this.goodsShow = true
            this.goodsIndex = index
         },
         goodsNameClose() {
            this.goodsShow = false
         },
         goodsselectClick(val) {
            this.showWeigh[this.goodsIndex].modifygoodsName = val.name
            this.showWeigh[this.goodsIndex].itemId = val.itemId
            this.showWeigh[this.goodsIndex].num = val.num
            this.showWeigh[this.goodsIndex].numUnit = val.numUnit
            this.showWeigh[this.goodsIndex].remark = val.remark
            this.showWeigh[this.goodsIndex].breed = val.breed
            this.showWeigh[this.goodsIndex].spec = val.spec
         },
         // 产品列表
         productNamePopoverShow(index) {
            this.actionShow = true
            this.actionIndex = index
            if (this.roleType === 4 && !this.flag) {
               this.actionShow = true
               this.actionIndex = index
            }
         },
         productNameClose() {
            this.actionShow = false
         },
         selectClick(val) {
            this.modifyMaterialList[this.actionIndex].modifyProductName = val.name
            this.showWeighCopy[this.actionIndex].modifyProductName = val.name
            this.showWeighCopy[this.actionIndex].breed = val.secondCategoryName
            this.showWeighCopy[this.actionIndex].spec = val.spec
         },
         // 折扣率输入
         discountInputHandle(value, index, clean) {
            this.showWeigh[index].cinderWeight = Number(value)
            this.showWeigh[index].discountWeight = (clean - (Number(value)).toFixed(2));
            this.showWeigh[index].weight = (clean - (Number(value)).toFixed(2));
         }
      },
   }