wk
2024-08-13 b73d5b4f9d70e997690121a04a8e93e40327d10a
pages/public-page/forward/forward.vue
@@ -15,7 +15,7 @@
         <u-notice-bar :text="text"
            :fontSize="30"></u-notice-bar>
         <view class="notice-icon"
            style="background: url('https://mx.jzeg.cn:9096/appimg/image/banner/notice.png') no-repeat;background-size: cover; width: 42rpx;height: 42rpx;">
            style="background: url('https://wrzs.czjlchem.com:9090/appimg/image/banner/notice.png') no-repeat;background-size: cover; width: 42rpx;height: 42rpx;">
         </view>
      </view>
      <view v-else-if="roleType == 2"
@@ -90,7 +90,7 @@
               :disabled="whetherClick"></u-button></view>
         <!--分享日计划  -->
         <view 
         class="AdddBtn"><u-button text="分享日计划"
         class="AdddBtn" v-if="isshow"><u-button text="分享日计划"
               :hairline="false"
               open-type="share"
               :loading='loading'></u-button></view>
@@ -106,7 +106,7 @@
      </view>
      <!-- 增加按钮 -->
      <!-- 选择货代或车队弹出框 -->
      <!-- 选择承运商或车队弹出框 -->
      <view class="selectHuoDaiOrFleet-container">
         <u-popup :show="selectPopupShow"
            mode="bottom"
@@ -160,17 +160,19 @@
   export default {
      onLoad(params) {
         console.log(params, '转发页面的参数');
         let reg=RegExp(/销/)
         this.isshow=!reg.test(params.orderType)
         // 客户
         this.cars2 = Number(params.cars2);
         this.tempcarNumSurplus1 = this.carNumSurplus1 = Number(params.carNumSurplus1 || 0);
         // 货代
         // 承运商
         this.carNum = Number(params.carNum);
         this.carNumSurplusHuodai = this.forwardSurplus = Number(params.carNumSurplusHuodai || 0);
         this.orderPlanId = params.orderPlanId;
         // 判断是否转发完成 完成则不可再添加
         if (this.roleType === 1) {  //roleType 1客户
            this.whetherClick = this.carNumSurplus1 === 0
         } else if (this.roleType === 2) {  //roleType 2货代
         } else if (this.roleType === 2) {  //roleType 2承运商
            this.whetherClick = this.forwardSurplus === 0
         }
         this.getOrderPlan()
@@ -189,6 +191,7 @@
      data() {
         return {
            isshow:false,
            forwardSurplus: 0,
            paramsName: {},
            huoDaiData: [],
@@ -198,9 +201,9 @@
            orderPlanId: '',
            jhOrderPlanForwardList: [{  //转发对象
               orderPlanId: '',  //日计划Id
               name: '',  //车队或货代名称
               name: '',  //车队或承运商名称
               carNum: null,  //转发数量
               xsUserId: 0,  //货代Id
               xsUserId: 0,  //承运商Id
               fleetId: 0,  //车队Id
               checkboxValue1: '',  //全部转发
               isSelected: false
@@ -209,9 +212,9 @@
            index: '',
            checkboxValue1: '',
            selectPopupShow: false,
            list1: [{ name: '车队' }, { name: '货代' }],
            list1: [{ name: '车队' }, { name: '承运商' }],
            tabHuoDai: false,
            carNumSurplus1: '',  //剩余的提煤单数量(转发的数量 - 领取的数量)
            carNumSurplus1: '',  //剩余的收发单数量(转发的数量 - 领取的数量)
            tempcarNumSurplus1: '',
            cars2: '',  //已经领取的车数
            carNum: '',
@@ -248,10 +251,10 @@
            return uni.getStorageSync('roleType');
         },
         text() {
            return `已领取${this.cars2}张提煤单,剩余${this.carNumSurplus1}张提煤单`;
            return `已领取${this.cars2}张收发单,剩余${this.carNumSurplus1}张收发单`;
         },
         text1() {
            return `已拥有${this.carNum}张提煤单,剩余${this.carNumSurplusHuodai}张提煤单`;
            return `已拥有${this.carNum}张收发单,剩余${this.carNumSurplusHuodai}张收发单`;
         }
      },
      methods: {
@@ -371,7 +374,7 @@
               this.calculate(this.jhOrderPlanForwardList);
            }
         },
         // 获取货代列表
         // 获取承运商列表
         getAllHuoDaiByCustomerId() {
            this.$reqGet('getAllHuoDaiByCustomerId').then(res => {
               this.huoDaiData = res.data;
@@ -400,7 +403,7 @@
            this.selectPopupShow = false;
         },
         selectPopupOpen() {},
         // 转发选择货代
         // 转发选择承运商
         forwardHuoDaiObjectSelect(item, index) {
            this.$nextTick(() => {
               // let isableAdd = this.jhOrderPlanForwardList.filter(v => item.name === v.name);
@@ -423,7 +426,7 @@
               // })
               //    this.selectPopupShow = false;
               // } else {
               //    this.$u.toast('提煤单剩余数为0或已添加');
               //    this.$u.toast('收发单剩余数为0或已添加');
               //    this.selectPopupShow = true;
               // }
               // } else {
@@ -436,7 +439,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;  //forWardType 转发类型 货代1 车队2
                  this.jhOrderPlanForwardList[this.index].forWardType = 1;  //forWardType 转发类型 承运商1 车队2
               }
               // }
            });
@@ -464,7 +467,7 @@
               // })
               //    this.selectPopupShow = false;
               // } else {
               //    this.$u.toast('提煤单剩余数为0或已添加');
               //    this.$u.toast('收发单剩余数为0或已添加');
               //    this.selectPopupShow = true;
               // }
               // } else {
@@ -482,25 +485,25 @@
               // }
            });
         },
         // 计算提煤单数量,添加或删除时调用
         // 计算收发单数量,添加或删除时调用
         calculate(arr) {
            let total = arr.reduce((prev, cur) => {
               return cur.carNum + prev;
            }, 0);
            console.log(total, '提煤单一共的数据');
        //roleType 1客户 2 货代 3司机 5装卸员
            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) {  //剩余的提煤单为0(添加、提交按钮不能点击)
               } else if (Number(this.cars2) == total) {  //剩余的收发单为0(添加、提交按钮不能点击)
                  this.whetherClick = true;
                  this.whetherClick1 = false;
                  this.carNumSurplus1 = Number(this.cars2) - total;
               } else {
                  this.carNumSurplus1 = 0;
                  this.$u.toast('剩余提煤单数量不足');
                  this.$u.toast('剩余收发单数量不足');
                  this.whetherClick = true;
                  this.whetherClick1 = true;
               }
@@ -516,7 +519,7 @@
                  this.carNumSurplusHuodai = Number(this.carNum) - total;
               } else {
                  this.carNumSurplusHuodai = 0;
                  this.$u.toast('剩余提煤单数量不足');
                  this.$u.toast('剩余收发单数量不足');
                  this.whetherClick = true;
                  this.whetherClick1 = true;
               }
@@ -526,7 +529,7 @@
            let time;
            let that = this;
            that.$set(that.jhOrderPlanForwardList[index], 'carNum', Number(value));
        //forWardType 转发类型 1货代 2车队
        //forWardType 转发类型 1承运商 2车队
            that.$set(that.jhOrderPlanForwardList[index], 'forWardType', xsUserId ? 1 : 2);
            return (function() {
               if (!time) {
@@ -642,7 +645,7 @@
            }
         },
         tabClick(item) {
            if (item.name == '货代') {
            if (item.name == '承运商') {
               this.tabHuoDai = true;
            } else {
               this.tabHuoDai = false;