yangan
2024-06-13 25c5c75592946943b7c11fe0090d838c40c066b9
pages/public-page/forward/forward.vue
@@ -88,13 +88,21 @@
               :hairline="false"
               @click.stop="addForm"
               :disabled="whetherClick"></u-button></view>
         <!--分享日计划  -->
         <view
         class="AdddBtn"><u-button text="分享日计划"
               :hairline="false"
               open-type="share"
               :loading='loading'></u-button></view>
         <!-- 提交按钮 -->
         <view class="forwardBtn"><u-button text="提交"
         <view
         class="forwardBtn"><u-button text="提交"
               :hairline="false"
               type="warning"
               @click.stop="submitForm"
               :disabled="whetherClick1"
               :loading='loading'></u-button></view>
      </view>
      <!-- 增加按钮 -->
@@ -160,28 +168,41 @@
         this.carNumSurplusHuodai = this.forwardSurplus = Number(params.carNumSurplusHuodai || 0);
         this.orderPlanId = params.orderPlanId;
         // 判断是否转发完成 完成则不可再添加
         if (this.roleType === 1) {
         if (this.roleType === 1) {  //roleType 1客户
            this.whetherClick = this.carNumSurplus1 === 0
         } else if (this.roleType === 2) {
         } else if (this.roleType === 2) {  //roleType 2货代
            this.whetherClick = this.forwardSurplus === 0
         }
         this.getOrderPlan()
      },
      onShareAppMessage(res) {
        if (res.from === 'button') {// 来自页面内分享按钮
          console.log(res.target)
        }
        return {
          title: '分享日计划',
          path: 'pages/driver-page/delivery-my/delivery-my/delivery-my?'+ `id=${this.orderPlanId}`
        }
      },
      data() {
         return {
            forwardSurplus: 0,
            paramsName: {},
            huoDaiData: [],
            isClickFlag:true,// true 可以 or false for forward and back to the direction of the car direction (default
            fleetData: [],
            // 日计划id
            orderPlanId: '',
            jhOrderPlanForwardList: [{
               orderPlanId: '',
               name: '',
               carNum: null,
               xsUserId: 0,
               fleetId: 0,
               checkboxValue1: '',
            jhOrderPlanForwardList: [{  //转发对象
               orderPlanId: '',  //日计划Id
               name: '',  //车队或货代名称
               carNum: null,  //转发数量
               xsUserId: 0,  //货代Id
               fleetId: 0,  //车队Id
               checkboxValue1: '',  //全部转发
               isSelected: false
            }],
            // 索引,利用索引正确显示
@@ -190,15 +211,15 @@
            selectPopupShow: false,
            list1: [{ name: '车队' }, { name: '货代' }],
            tabHuoDai: false,
            carNumSurplus1: '',
            carNumSurplus1: '',  //剩余的提煤单数量(转发的数量 - 领取的数量)
            tempcarNumSurplus1: '',
            cars2: '',
            cars2: '',  //已经领取的车数
            carNum: '',
            carNumSurplusHuodai: '',
            formNum: 1,
            // 个人转发数据
            personalForward: {},
            whetherClick: false,
            whetherClick: false,  //添加按钮
            whetherClick1: false,
            // 滑动单元格配置
            options1: [{
@@ -209,10 +230,10 @@
            }],
            loading: false, //提交loading
            originForwardName: '', //原转发对象
            laterForwardName: '', //后转发对象
            laterForwardName: '', //后转发对象
            errorDataList: [], // 错误数据
            isDirectAdd: false, // 是否是在原来有对象的item修改 是的为true
            forwardId: '' //原来有对象 点击赋值
            forwardId: '' //原来有对象 点击赋值
         };
      },
      onShow() {
@@ -362,13 +383,18 @@
               this.fleetData = res.data;
            });
         },
         // 转发
         // 转发对象
         forwardObjectClick(index, name, id) {
            if(!id){
            this.selectPopupShow = true;
            this.index = index;
            this.originForwardName = name || ''
            this.isDirectAdd = this.originForwardName !== ''
            this.forwardId = id
            }else{
               return
            }
         },
         selectPopupClose() {
            this.selectPopupShow = false;
@@ -410,7 +436,7 @@
                  this.jhOrderPlanForwardList[this.index].xsUserId = item.userId;
                  this.jhOrderPlanForwardList[this.index].name = item.name;
                  this.jhOrderPlanForwardList[this.index].fleetId = 0;
                  this.jhOrderPlanForwardList[this.index].forWardType = 1;
                  this.jhOrderPlanForwardList[this.index].forWardType = 1;  //forWardType 转发类型 货代1 车队2
               }
               // }
            });
@@ -462,12 +488,13 @@
               return cur.carNum + prev;
            }, 0);
            console.log(total, '提煤单一共的数据');
        //roleType 1客户 2 货代 3司机 5装卸员
            if (this.roleType == 1) {
               if (Number(this.cars2) > total) {
                  this.carNumSurplus1 = Number(this.cars2) - total;
                  this.whetherClick = false;
                  this.whetherClick1 = false;
               } else if (Number(this.cars2) == total) {
               } else if (Number(this.cars2) == total) {  //剩余的提煤单为0(添加、提交按钮不能点击)
                  this.whetherClick = true;
                  this.whetherClick1 = false;
                  this.carNumSurplus1 = Number(this.cars2) - total;
@@ -499,6 +526,7 @@
            let time;
            let that = this;
            that.$set(that.jhOrderPlanForwardList[index], 'carNum', Number(value));
        //forWardType 转发类型 1货代 2车队
            that.$set(that.jhOrderPlanForwardList[index], 'forWardType', xsUserId ? 1 : 2);
            return (function() {
               if (!time) {
@@ -591,11 +619,12 @@
                  return isPass;
               }
            });
            console.log(this.jhOrderPlanForwardList,'jhOderPlan')
            if (isPass) {
               this.loading = true;
               this.$reqPost('forward', this.jhOrderPlanForwardList, 'json').then(res => {
                  console.log(res, 'zh');
                  // res.data.length == 0 提交成功 否则提交失败
                  // res.data.length == 0 提交成功 否则提交失败
                  if (res.data.length == 0) {
                     this.loading = false
                     this.$u.toast('提交成功');
@@ -618,7 +647,7 @@
            } else {
               this.tabHuoDai = false;
            }
         }
         },
      }
   };
</script>
@@ -782,11 +811,12 @@
      }
      .utils-buttonGroup {
         width: 610rpx;
         width: 700rpx;
         @include flex;
         justify-content: space-between;
         position: fixed;
         bottom: vww(30);
         left: vww(30);
         left: vww(18);
         z-index: 3;
         .AdddBtn,
@@ -832,4 +862,4 @@
         }
      }
   }
</style>
</style>