-
zhangwei
2025-11-11 ec90cbd7680a6f927cb1cea43f33ab7df6d0864c
src/pages/delivergoods/arrange.vue
@@ -25,10 +25,15 @@
                     <view class="chuany-width15">
                        {{$util.formatDate(item.deliverTime,'riqi')}}
                     </view>
                     <view class="chuany-width15">
                        <u-text size='14' :text="carNumber(item.car&&item.car.carNumber)" lines="1">
                           <!-- <u-text size='14' :text="item.remark||item.companyName" lines="1"> -->
                        </u-text>
                     </view>
                     <view :class="item.deliveredstatus !== 'Delivered'?'chuany-width67':'chuany-width79'"
                        @click='goDetail(item)'>
                        <u-text size='14' :text="item.companyName" lines="1">
                        <!-- <u-text size='14' :text="item.remark||item.companyName" lines="1"> -->
                           <!-- <u-text size='14' :text="item.remark||item.companyName" lines="1"> -->
                        </u-text>
                     </view>
                     <template v-if="item.deliveredstatus !== 'Delivered'">
@@ -53,7 +58,7 @@
         <up-empty text='暂无' icon="/static/order.png">
         </up-empty>
      </view>
      <up-modal title="送货安排" :show="show7" showCancelButton @confirm="confirmSave" @cancel='cancelModal'
      <up-modal title="送货安排" :show="show7" showCancelButton @confirm="confirmSave" @cancel='cancelModal'
         ref='modalArrange' :asyncClose="true">
         <up-form labelPosition="left" :model="arrangeInfo" ref="formRef" labelWidth='140rpx'>
            <up-form-item label="送货日期" prop="deliverTime" required :borderBottom='false' ref="item1"
@@ -81,8 +86,9 @@
               <!-- <form-select class="form_select" ref="formSelect1" :search="true" :icon="true"
                  :placeholder="optionPlaceholder" :selectedId="optionId" :localdata="optionModel"
                  @change="changeOption" @clear="clearOption"></form-select> -->
               <tem-select ref="formSelect" placeholder="请选择收货单位" :selectedId="arrangeInfo.buyerId" :value='arrangeInfo.companyName' :search='true'
                  :localdata="customerList" @change="selectChange"></tem-select>
               <tem-select ref="formSelect" placeholder="请选择收货单位" :selectedId="arrangeInfo.buyerId"
                  :value='arrangeInfo.companyName' :search='true' :localdata="customerList"
                  @change="selectChange"></tem-select>
               <!-- <up-input v-model="arrangeInfo.companyName" placeholder="请选择收货单位" border="none">
                  <template #suffix>
                     <up-button @tap="clickAction" text="点击选择" type="primary" size="mini"></up-button>
@@ -145,7 +151,7 @@
            deliverTime: Number(new Date(this.$util.formatDate(new Date(), null, 1))),
            arrangeInfo: {
               deliverTime: this.$util.formatDate(new Date(), null, 1),
               driverId: '',
               // driverId: '',
               buyerId: null,
               dianhua: '',
               remark: '',
@@ -210,6 +216,9 @@
            deliverKeyName: ''
         }
      },
      computed: {
      },
      onShow() {
         this.init()
      },
@@ -217,7 +226,7 @@
         this.$refs.formRef.setRules(this.rules);
      },
      onLoad() {
         this.Getdrivers()
         this.GetCarList()
         this.getCustomer()
         this.GetDriversOfWithin7days()
      },
@@ -238,6 +247,22 @@
         uni.stopPullDownRefresh();
      },
      methods: {
         carNumber(str) {
            if (!str) {
               return ''
            }
            // 检查字符串是否包含括号
            const leftBracket = str.indexOf('(');
            const rightBracket = str.lastIndexOf(')');
            // 如果存在左右括号且位置正确,则返回括号内的内容
            if (leftBracket !== -1 && rightBracket !== -1 && leftBracket < rightBracket) {
               return str.substring(leftBracket + 1, rightBracket);
            }
            // 否则返回原字符串
            return str;
         },
         goDetail(item) {
            uni.navigateTo({
               url: `/pages/delivergoods/arrangedetail?KeyId=${item.keyid}`
@@ -277,8 +302,10 @@
         },
         selectItem(item) {
            if (this.selectAc == 'driver') {
               this.arrangeInfo.driverName = item.name
               this.arrangeInfo.driverId = item.keyid
               // this.arrangeInfo.driverName = item.driverName
               this.arrangeInfo.driverName = item.carNumber
               // this.arrangeInfo.driverId = item.keyid
               this.arrangeInfo.carId = item.keyid
            } else if (this.selectAc == 'driver7') {
               this.deliverKeyID = item.keyid
               this.deliverKeyName = item.name
@@ -294,7 +321,7 @@
            this.selectAc = ''
         },
         selectChange(item) {
            console.log(item,'hhhhh');
            console.log(item, 'hhhhh');
            if (typeof item == 'object') {
               this.buyerName = item.name
               this.arrangeInfo.buyerId = item.keyid
@@ -337,7 +364,8 @@
            this.isEdit = true
            this.arrangeInfo = {
               deliverTime: this.$util.formatDate(item.deliverTime),
               driverId: item.driverId,
               // driverId: item.driverId,
               carId: item.car.keyid || "",
               buyerId: item.buyerId,
               dianhua: item.dianhua,
               remark: item.remark,
@@ -346,10 +374,11 @@
               keyid: item.keyid,
               companyName: item.companyName,
               sort: item.sort,
               driverName: item.driver.name || ''
               driverName: item.car.carNumber || ''
            }
            this.show7 = true
            this.driverName = item.driver && item.driver.name
            this.driverName = item.car && item.car.carNumber
            this.deliverTime = Number(new Date(this.$util.formatDate(item.deliverTime)))
            // let obj = this.customerList.find(ite => {
            //    return ite.keyid == item.buyerId
            // })
@@ -433,7 +462,7 @@
                        this.isEdit = false
                        this.arrangeInfo = {
                           deliverTime: this.$util.formatDate(new Date(), null, 1),
                           driverId: '',
                           // driverId: '',
                           buyerId: null,
                           dianhua: '',
                           remark: '',
@@ -452,6 +481,7 @@
                           title: res.error
                        })
                     }
                     this.deliverTime = Number(new Date(this.$util.formatDate(new Date(), null, 1)))
                     this.isLoading = false
                  })
                  return
@@ -460,7 +490,7 @@
                  if (res.code == 1) {
                     this.arrangeInfo = {
                        deliverTime: this.$util.formatDate(new Date(), null, 1),
                        driverId: '',
                        // driverId: '',
                        buyerId: null,
                        dianhua: '',
                        remark: '',
@@ -479,6 +509,7 @@
                        title: res.error
                     })
                  }
                  this.deliverTime = Number(new Date(this.$util.formatDate(new Date(), null, 1)))
                  this.isLoading = false
               })
            }).catch(errors => {
@@ -489,7 +520,7 @@
         cancelModal() {
            this.arrangeInfo = {
               deliverTime: this.$util.formatDate(new Date(), null, 1),
               driverId: '',
               // driverId: '',
               buyerId: null,
               dianhua: '',
               remark: '',
@@ -499,14 +530,19 @@
               driverName: '',
               sort: '1'
            }
            this.deliverTime = Number(new Date(this.$util.formatDate(new Date(), null, 1)))
            this.show7 = false
            this.driverName = ''
            this.buyerName = ''
         },
         Getdrivers() {
            this.$api.Getdrivers().then(res => {
         GetCarList() {
            this.$api.GetCarList().then(res => {
               if (res.code == 1) {
                  this.driverList = res.data
                  this.driverList.forEach(item => {
                     item.driverName = item.name
                     item.name = item.carNumber
                  })
               }
            })
         },