qingyiay
2023-06-28 3de2db0492aa472cbb63c44c59b3ac13a47efe25
pages/driver-page/driver-index/bill-of-lading-details/weighDetail/weighDetail.vue
@@ -49,15 +49,9 @@
            <u-tag :text="item.level||'请选择'"
               plain
               @click="popoverShow(i)"></u-tag>
         </view>
         <view class="confirm-button"
            v-if='roleType===1'>
            <u-button type="primary"
               shape="circle"
               text="确认"
               @click="confirmInput(item)"
               :loading="loading"
               loading-text="确认"></u-button>
            <u-tag :text="item.productName||'请选择'"
               plain
               @click="productNamePopoverShow(i)"></u-tag>
         </view>
         <view v-if='roleType===1'>
            <u-picker :show="show"
@@ -65,6 +59,23 @@
               @cancel='cancel'
               @confirm='confirm'></u-picker>
         </view>
         <view class="">
            <u-action-sheet :actions="actionsList"
               :show="actionShow"
               cancelText='取消'
               :closeOnClickOverlay='true'
               @close='productNameClose'
               @select="selectClick"></u-action-sheet>
         </view>
      </view>
      <view class="confirm-button"
         v-if='roleType===1'>
         <u-button type="primary"
            shape="circle"
            text="确认"
            @click="confirmInput"
            :loading="loading"
            loading-text="确认"></u-button>
      </view>
   </view>
</template>
@@ -85,7 +96,11 @@
               ['轻质', '中质', '重质']
            ],
            level: '请选择',
            selectIndex: null
            selectIndex: null,
            // 产品列表
            actionsList: [],
            actionShow: false,
            actionIndex: null
         };
      },
      computed: {
@@ -99,6 +114,7 @@
      },
      onShow() {
         this.roleType === 1 ? this.GetOrderPlan() : this.getTakeCoal()
         this.getJcProductList()
      },
      methods: {
         getTakeCoal() {
@@ -124,12 +140,6 @@
                  this.coalDetailsData = res.data;
                  this.showWeigh = this.coalDetailsData[this.index].tmTaskCoalItems ? this.coalDetailsData[
                        this.index].tmTaskCoalItems : [],
                     // this.showWeigh = this.showWeigh.map(v => {
                     //    return {
                     //       ...v,
                     //       loading: false
                     //    }
                     // })
                     uni.hideLoading();
               } else {
                  this.$u.toast('加载失败')
@@ -137,11 +147,22 @@
               }
            });
         },
         getJcProductList() {
            this.$reqGet('getJcProductList').then(res => {
               if (res.code === 0) {
                  this.actionsList = res.data.map(v => {
                     return {
                        ...v,
                        name: v.productName
                     }
                  })
               }
            })
         },
         // 输入折扣率后点击确认
         confirmInput(item) {
         confirmInput() {
            this.loading = true
            console.log(this.coalDetailsData);
            this.$reqPost('updateTmTaskCoalItem', this.coalDetailsData[this.index].tmTaskCoalItems, 'json').then(
            this.$reqPost('updateTmTaskCoalItem', this.showWeigh, 'json').then(
               res => {
                  if (res.code == 0) {
                     this.loading = false
@@ -154,20 +175,36 @@
         },
         // 选择质量
         popoverShow(i) {
            this.show = true
            this.selectIndex = i
            if (this.roleType === 1) {
               this.show = true
               this.selectIndex = i
            }
         },
         // 选择产品
         productNamePopoverShow(i) {
            if (this.roleType === 1) {
               this.actionShow = true
               this.actionIndex = i
            }
         },
         confirm(e) {
            this.show = false
            this.coalDetailsData[this.index].tmTaskCoalItems[this.selectIndex].level = e.value[0]
            this.showWeigh[this.selectIndex].level = e.value[0]
         },
         cancel() {
            this.show = false
         },
         productNameClose() {
            this.actionShow = false
         },
         selectClick(val) {
            console.log(this.showWeigh);
            this.showWeigh[this.actionIndex].productName = val.productName
            this.showWeigh[this.actionIndex].productId = val.id
         },
         // 折扣率输入
         discountInputHandle(value, index, clean) {
            console.log(value, index);
            this.coalDetailsData[this.index].tmTaskCoalItems[index].discountWeight = (Number(value) * clean) / 100
            this.showWeigh[index].discountWeight = (Number(value) * clean) / 100
         }
      },
   }
@@ -250,7 +287,7 @@
               .count-input {
                  width: 70%;
                  // border-bottom: 1px solid rgb(218, 219, 222);
                  border-bottom: 1px solid rgb(218, 219, 222);
               }
            }
@@ -263,19 +300,25 @@
         }
         .level {
            width: 120rpx;
            width: 40%;
            margin-top: 30rpx;
            margin-left: 80rpx;
            display: flex;
            justify-content: space-between;
         }
         .confirm-button {
            position: absolute;
            bottom: 10rpx;
            right: 10rpx;
      }
            /deep/ .u-button {
               width: 180rpx !important;
            }
      .confirm-button {
         // position: relative;
         // bottom: 10rpx;
         // right: 10rpx;
         width: 100%;
         @include flex;
         justify-content: center;
         /deep/ .u-button {
            width: 180rpx !important;
         }
      }
   }