yangan
2025-02-10 6ebd978221c7bf469f5e1d821b4345101357ca4c
pages/driver-page/driver-index/SelfDelivery/SelfDelivery.vue
@@ -1,27 +1,6 @@
<!-- 自主配送 -->
<template>
   <view class="main">
      <u-modal :show="selfDeliverShow"
         title="选择产品"
         showCancelButton
         @confirm="selfDeliverConfirm"
         @cancel="selfDeliverCancel">
         <view class="slot-content">
            <niceui-data-select-input v-model="deptId"
               :localdata="deptList"
               placeholder="请选择单位"
               @change="deptChange"></niceui-data-select-input>
            <niceui-data-select-input v-model="productName"
               :localdata="productNameList"
               label="产品选择"
               placeholder="请选择产品"></niceui-data-select-input>
            <niceui-data-select-input v-model="filedId"
               :localdata="filedNameList"
               label="煤场选择"
               placeholder="请选择煤场"
               @change="filedChange"></niceui-data-select-input>
         </view>
      </u-modal>
      <!-- 司机选择的产品信息 -->
      <view class="product-info">
         <view class="product-info_block">
@@ -30,7 +9,10 @@
                  当前选择单位
               </view>
               <view class="selected-info_text">
                  {{deptName}}
                  <niceui-data-select-input v-model="deptId"
                     :localdata="deptList"
                     placeholder="请选择单位"
                     @change="deptChange"></niceui-data-select-input>
               </view>
            </view>
            <view class="selected-info">
@@ -38,7 +20,11 @@
                  当前选择产品
               </view>
               <view class="selected-info_text">
                  {{productName}}
                  <niceui-data-select-input v-model="productName"
                     :localdata="productNameList"
                     label="产品选择"
                     placeholder="请选择产品"
                     @change="productNameChange"></niceui-data-select-input>
               </view>
            </view>
@@ -47,44 +33,85 @@
                  当前选择煤场
               </view>
               <view class="selected-info_text">
                  {{filedName}}
                  <niceui-data-select-input v-model="filedId"
                     :localdata="filedNameList"
                     label="煤场选择"
                     placeholder="请选择煤场"
                     @change="filedChange"></niceui-data-select-input>
               </view>
            </view>
            <view class="re-select">
               <u-button text="重新选择"
                  @click="reSelect"></u-button>
         </view>
      </view>
      <view class="bottom-block">
         <!-- 选择发运时间 -->
         <view class="send-date">
            <view class="send-date_label">
               发运时间
            </view>
            <uni-datetime-picker type="date"
               :clear-icon="false"
               v-model="sendDate"
               :start="sendDateStart"
               :end="sendDateEnd" />
         </view>
         <!-- 客户名称 -->
         <view class="customer-name">
            <view class="customer-name_label">
               选择客户
            </view>
            <view class="customer-name_block"
               @click="selfDeliver">
               <input class="customer-name_block-input"
                  type="text"
                  placeholder="请选择客户"
                  v-model="customerName"
                  @focus="selfDeliver"
                  ref="selectCustomer" />
            </view>
         </view>
      </view>
      <!-- 选择发运时间 -->
      <view class="send-date">
         <view class="send-date_label">
            发运时间
         </view>
         <uni-datetime-picker type="date"
            :clear-icon="false"
            v-model="sendDate"
            :start="sendDateStart"
            :end="sendDateEnd" />
      </view>
      <!-- 客户名称 -->
      <view class="customer-name">
         <view class="customer-name_label">
            选择客户
         </view>
         <niceui-data-select-input v-model="customerId"
            :localdata="customerNameList"
            placeholder="请选择客户"
            @change="customerNameChange"></niceui-data-select-input>
      </view>
      <!-- 提交 -->
      <view class="re-select">
         <view class="re-select_block">
      <view class="confirm-build">
         <view class="confirm-build_block">
            <u-button text="确认创建"
               @click="confirmBuild"
               :loading="buildLoading"
               :disabled="abledBuild"></u-button>
         </view>
      </view>
      <view class="">
         <u-popup :closeable='true'
            :round="30"
            mode='bottom'
            :show="selfDeliverShow"
            @close="selfDeliverClose"
            @open="selfDeliverOpen">
            <view class="name-list-section">
               <view class="name-list_title">
                  选择客户
               </view>
               <view class="name-list_container">
                  <u-empty mode="data"
                     icon="http://cdn.uviewui.com/uview/empty/data.png"
                     text="暂无数据"
                     textSize="30"
                     iconSize="1000"
                     v-if="customerNameList.length===0"></u-empty>
                  <view class="name-list_container_item"
                     v-for="item in customerNameList"
                     @click="selectCustomer(item)">
                     <view class="item-image">
                        <image src="https://mr1.res.jzeg.cn:9096/appimg/image/banner/address.png"
                           mode="widthFix"
                           style="width: 18px;"></image>
                     </view>
                     <view class="item-customerName">
                        {{item.customerName}}
                     </view>
                  </view>
               </view>
            </view>
         </u-popup>
      </view>
   </view>
</template>
@@ -98,7 +125,9 @@
      },
      onLoad() {
         this.getCarNoByVarieties()
         this.getShipToList()
         if (this.deptId && this.productName) {
            this.getShipToList()
         }
         this.sendDate = this.sendDateStart = dayjs().format('YYYY-MM-DD')
         this.sendDateEnd = dayjs().add(7, 'day').format('YYYY-MM-DD')
      },
@@ -118,7 +147,7 @@
            sendDateEnd: '',
            customerId: '',
            customerName: '',
            customerNameList: '',
            customerNameList: [],
            buildLoading: false
         }
      },
@@ -133,20 +162,13 @@
            uni.showLoading({
               title: "加载中"
            })
            this.$reqGet('getShipToList').then(res => {
               uni.hideLoading()
               if (res.code == 0) {
                  this.customerNameList = res.data
                  if (this.customerNameList.length !== 0) {
                     this.customerNameList = this.customerNameList.map(v => {
                        return {
                           value: v.customerId,
                           text: v.customerName
                        }
                     })
            this.$reqGet('getDeptAndProductNameByCustomer', { deptId: this.deptId, productName: this.productName })
               .then(res => {
                  uni.hideLoading()
                  if (res.code == 0) {
                     this.customerNameList = res.data
                  }
               }
            })
               })
         },
         //查询相关单位
         getCarNoByVarieties() {
@@ -162,17 +184,23 @@
                        text: v.deptName
                     }
                  })
                  this.selfDeliverShow = true
                  this.deptId = Array.isArray(this.deptList) && this.deptList.length !== 0 ? this.deptList[0]
                     .value : ''
               } else {
                  this.$u.toast('加载失败')
               }
            }).then(() => {
               this.getDeptByProductName()
               this.getDeptIdByFiledList()
            })
         },
         deptChange(e) {
            this.deptName = this.deptList.find(v => v.value === e).text
            this.getDeptByProductName()
            this.getDeptIdByFiledList()
            if (this.deptId && this.productName) {
               this.getShipToList()
            }
         },
         // 根据部门获取产品名称
         getDeptByProductName() {
@@ -183,7 +211,10 @@
                     text: v.productName
                  }
               })
               this.productName = this.productNameList[0].value
               this.productName = Array.isArray(this.productNameList) && this.productNameList.lenght !== 0 ?
                  this.productNameList[0].value : ''
            }).then(() => {
               this.getShipToList()
            })
         },
         // 根据部门获取煤场名称
@@ -195,41 +226,50 @@
                     text: v.name
                  }
               })
               this.filedId = this.filedNameList.length !== 0 ? this.filedNameList[0].value : ''
               this.filedName = this.filedNameList.length !== 0 ? this.filedNameList[0].text : ''
               if (Array.isArray(this.filedNameList) && this.filedNameList.length === 1) {
                  this.filedId = this.filedNameList[0].value
                  this.filedName = this.filedNameList[0].text
               } else if (Array.isArray(this.filedNameList) && this.filedNameList.length > 1) {
                  this.filedId = ''
                  this.filedName = ''
               }
            })
         },
         filedChange(e) {
            this.filedName = this.filedNameList.find(v => v.value === e).text
         },
         customerNameChange(e) {
            this.customerName = this.customerNameList.find(v => v.value === e).text
         productNameChange(e) {
            if (this.deptId && this.productName) {
               this.getShipToList()
            }
         },
         reSelect() {
         selfDeliver() {
            this.selfDeliverShow = true
         },
         selfDeliverConfirm() {
         selfDeliverClose() {
            this.selfDeliverShow = false
         },
         selfDeliverCancel() {
         selfDeliverOpen() {
            this.selfDeliverShow = true
         },
         selectCustomer(value) {
            this.customerId = value.customerId
            this.customerName = value.customerName
            this.selfDeliverShow = false
            uni.navigateBack({
               delta: 1
            })
         },
         confirmBuild() {
            let form = {
               carNo: uni.getStorageSync('carNo'),
               coalName: this.productName,
               deptId: this.deptId,
               deptName: this.deptName,
               filedId: this.filedId,
               filedName: this.filedName,
               deptId: this.deptId,  //部门Id
               deptName: this.deptName,  //部门名称
               filedId: this.filedId,  //煤场Id
               filedName: this.filedName,  //煤场名称
               orderType: "外购",
               sendDate: this.sendDate,
               xsUserId1: uni.getStorageSync('userId'),
               isPretendDischar: 1,
               isSpecial: 1,
               sendDate: this.sendDate,  //发运时间
               xsUserId1: uni.getStorageSync('userId'),  //用户id
               isPretendDischar: 1,  //是否能装卸 1已经确认装卸 0不需要装卸
               isSpecial: 1,  //是否是特产品 1特殊产品 0不是特使产品
               customerId: this.customerId,
               customerName: this.customerName
            }
@@ -276,30 +316,25 @@
      align-items: center;
   }
   .slot-content {
      width: 100%;
      height: vww(150);
      @include flex;
      flex-direction: column;
   }
   .main {
      width: 100%;
      color: #232323;
      .product-info {
         width: 96%;
         height: vww(200);
         height: vww(250);
         margin: vww(8);
         margin-top: vww(20);
         background: #ffffff;
         box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(73, 120, 240, 0.14), 0rpx 7rpx 45rpx 0rpx rgba(73, 120, 240, 0.12);
         border-radius: 20rpx;
         position: relative;
         @include flex;
         justify-content: center;
         &_block {
            width: 88%;
            height: vww(150);
            height: vww(200);
            margin-left: vww(10);
            @include flex;
            flex-direction: column;
@@ -308,6 +343,7 @@
            .selected-info {
               width: 100%;
               display: flex;
               align-items: center;
               &_label {
                  margin-right: vww(8);
@@ -319,24 +355,55 @@
            }
            .re-select {
               position: absolute;
               width: vww(100);
               margin: 0 auto;
               bottom: vww(10);
            }
         }
      }
      .bottom-block {
         height: vww(200);
      }
      .send-date,
      .customer-name {
         height: vww(40);
         margin: vww(40) vww(20);
         position: relative;
         &_label {
            margin: vww(8);
         }
         &_block {
            width: 100%;
            flex: 1;
            height: vww(35);
            border: 1px solid #e5e5e5;
            box-sizing: border-box;
            border-radius: 4px;
            padding: 0 5px;
            padding-left: 10px;
            position: relative;
            user-select: none;
            @include flex;
            &-input {
               width: 96%;
               height: 96%;
               color: #333;
               position: absolute;
               left: vww(10);
               z-index: -1;
               white-space: nowrap;
               text-overflow: ellipsis;
               -o-text-overflow: ellipsis;
               overflow: hidden;
            }
         }
      }
      .re-select {
      .confirm-build {
         width: 100%;
         height: vww(80);
         background-color: #ffffff;
@@ -352,5 +419,52 @@
            width: 94%;
         }
      }
      .name-list-section {
         width: 100%;
         height: vww(600);
         position: relative;
         @include flex;
         justify-content: center;
         align-items: flex-start;
         .name-list_title {
            position: absolute;
            top: vww(10);
            font-size: vww(20);
         }
         .name-list_container {
            width: 94%;
            padding-top: vww(10);
            overflow: scroll;
            @include flex;
            justify-content: flex-start;
            flex-direction: column;
            margin-top: vww(40);
            &_item {
               width: 100%;
               height: vww(50);
               @include flex;
               justify-content: flex-start;
               font-size: vww(18);
               .item-image {
                  height: 100%;
                  display: flex;
                  align-items: center;
               }
               .item-customerName {
                  color: #252525;
                  margin-left: vww(8);
                  white-space: nowrap;
                  text-overflow: ellipsis;
                  overflow: hidden;
               }
            }
         }
      }
   }
</style>
</style>