qingyiay
2023-06-26 c502a1e37ea372b52140e8913f636c9d57b56e23
pages/public-page/forward/forward.vue
@@ -9,14 +9,17 @@
      </view>
      <view v-if="roleType == 1" class="notice-bar">
         <u-notice-bar :text="text" :fontSize="30"></u-notice-bar>
         <view class="notice-icon" style="background: url('../../../static/image/banner/notice.png') no-repeat;background-size: cover; width: 42rpx;height: 42rpx;"></view>
         <view
            class="notice-icon"
            style="background: url('https://mx.jzeg.cn:9095/appimg/image/banner/notice.png') no-repeat;background-size: cover; width: 42rpx;height: 42rpx;"
         ></view>
      </view>
      <view v-else-if="roleType == 2" class="notice-bar"><u-notice-bar :text="text1" :fontSize="30"></u-notice-bar></view>
      <view class="card-main">
         <view class="card-block">
            <view class="forward-card" v-for="(val, index) in jhOrderPlanForwardList" :key="index">
               <u-swipe-action>
                  <u-swipe-action-item :options="options1" @click="deleteGroup(index, val)">
            <u-swipe-action>
               <u-swipe-action-item :options="options1" v-for="(val, index) in jhOrderPlanForwardList" :key="val.vid" :name="val.vid" @click="deleteGroup(index, val)">
                  <view class="forward-card">
                     <view class="card-content">
                        <u--form labelPosition="left" :model="forwardForm" ref="form1">
                           <u-form-item label="转发对象" labelWidth="21%" ref="item1" @click="forwardObjectClick(index)">
@@ -34,16 +37,23 @@
                                    ></u--input>
                                 </view>
                                 <u-checkbox-group v-model="val.checkboxValue1" placement="column" @change="v => checkboxChange(v, index, val)">
                                    <u-checkbox size="30" shape="circle" labelSize="30" label="全部转发" name="全部转发" :disabled="val.ischecked"></u-checkbox>
                                    <u-checkbox
                                       size="30"
                                       shape="circle"
                                       labelSize="30"
                                       label="全部转发"
                                       name="全部转发"
                                       :disabled="val.ischecked"
                                       :checked="val.isSelected"
                                    ></u-checkbox>
                                 </u-checkbox-group>
                              </view>
                           </u-form-item>
                           <!-- <u-form-item><u-button text="删除本组" :hairline="false" type="error" @click="deleteGroup(index, val)"></u-button></u-form-item> -->
                        </u--form>
                     </view>
                  </u-swipe-action-item>
               </u-swipe-action>
            </view>
                  </view>
               </u-swipe-action-item>
            </u-swipe-action>
         </view>
      </view>
@@ -100,7 +110,7 @@
      this.orderPlanId = params.orderPlanId;
      this.$reqGet('forwardList', { OrderPlanId: params.orderPlanId }).then(res => {
         if (res.data.length !== 0 && this.roleType == 1) {
            this.jhOrderPlanForwardList = res.data.map(item => {
            this.jhOrderPlanForwardList = res.data.map((item, index) => {
               return {
                  id: item.id,
                  orderPlanId: item.orderPlanId,
@@ -108,11 +118,12 @@
                  carNum: item.carNum,
                  xsUserId: item.xsUserId === null ? 0 : item.xsUserId,
                  fleetId: item.fleetId === null ? 0 : item.fleetId,
                  checkboxValue1: ''
                  checkboxValue1: '',
                  vid: `${new Date().getTime()}${index}${item.id}`
               };
            });
         } else if (res.data.length !== 0 && this.roleType == 2) {
            this.jhOrderPlanForwardList = res.data.map(item => {
            this.jhOrderPlanForwardList = res.data.map((item, index) => {
               return {
                  id: item.id,
                  orderPlanId: item.orderPlanId,
@@ -120,15 +131,17 @@
                  carNum: item.carNum,
                  xsUserId: item.xsUserId === null ? 0 : item.xsUserId,
                  fleetId: item.fleetId === null ? 0 : item.fleetId,
                  checkboxValue1: ''
                  checkboxValue1: '',
                  vid: `${new Date().getTime()}${index}${item.id}`
               };
            });
         } else {
            this.jhOrderPlanForwardList = this.jhOrderPlanForwardList.map(v => {
               if (!v.orderPlanId) {
            this.jhOrderPlanForwardList = this.jhOrderPlanForwardList.map((item, index) => {
               if (!item.orderPlanId) {
                  return {
                     ...v,
                     orderPlanId: params.orderPlanId
                     ...item,
                     orderPlanId: params.orderPlanId,
                     vid: `${new Date().getTime()}${index}${item.id}`
                  };
               }
            });
@@ -150,7 +163,8 @@
               carNum: null,
               xsUserId: 0,
               fleetId: 0,
               checkboxValue1: ''
               checkboxValue1: '',
               isSelected: false
            }
         ],
         // 索引,利用索引正确显示
@@ -244,29 +258,6 @@
            };
         });
         if (value.length != 0) {
            let tempforwardSurplus = this.forwardSurplus;
            let tempcarNumSurplus1 = this.carNumSurplus1;
            // if (v.id) {
            //    this.$reqGet('jhorderplanforward', { forwardId: v.id }).then(res => {
            //       this.personalForward = res.data;
            //       // 计算全部转发数
            //       // 客户
            //       if (this.roleType == 1) {
            //          this.jhOrderPlanForwardList[index].carNum = this.allrelay(this.personalForward.carNum, tempcarNumSurplus1);
            //          this.calculate(this.jhOrderPlanForwardList);
            //          if (tempcarNumSurplus1 == 0) {
            //             this.jhOrderPlanForwardList[index].carNum = this.allrelay(0, this.carNumSurplus1);
            //          }
            //       }
            //       tempcarNumSurplus1 = 0;
            //       // 货代
            //       if (this.roleType == 2) {
            //          this.jhOrderPlanForwardList[index].carNum = this.allrelay(this.personalForward.carNum, tempforwardSurplus);
            //       }
            //       tempforwardSurplus = 0;
            //    });
            // } else { }
            if (this.roleType == 1) {
               this.jhOrderPlanForwardList[index].carNum = this.allrelay(this.carNumSurplus1, this.jhOrderPlanForwardList[index].carNum);
               this.calculate(this.jhOrderPlanForwardList);
@@ -283,7 +274,7 @@
            });
            this.whetherClick = true;
         } else {
            this.jhOrderPlanForwardList[index].carNum = 0;
            this.jhOrderPlanForwardList[index].carNum = null;
            this.calculate(this.jhOrderPlanForwardList);
         }
      },
@@ -345,8 +336,8 @@
         }, 0);
         console.log(total, '提煤单一共的数据');
         if (this.roleType == 1) {
            if (this.cars2 >= total) {
               this.carNumSurplus1 = this.cars2 - total;
            if (Number(this.cars2) >= total) {
               this.carNumSurplus1 = Number(this.cars2) - total;
               this.whetherClick = false;
               this.whetherClick1 = false;
            } else {
@@ -357,8 +348,8 @@
            }
         }
         if (this.roleType == 2) {
            if (this.carNum >= total) {
               this.carNumSurplusHuodai = this.carNum - total;
            if (Number(this.carNum) >= total) {
               this.carNumSurplusHuodai = Number(this.carNum) - total;
               this.whetherClick = false;
               this.whetherClick1 = false;
            } else {
@@ -377,6 +368,27 @@
            if (!time) {
               time = setTimeout(() => {
                  that.calculate(that.jhOrderPlanForwardList);
                  if (that.roleType == 1) {
                     if (that.jhOrderPlanForwardList[index].carNum < Number(that.carNumSurplus1)) {
                        that.$set(that.jhOrderPlanForwardList[index], 'checkboxValue1', '');
                        that.jhOrderPlanForwardList.forEach((v, i) => {
                           if (index != i) {
                              v.ischecked = false;
                           }
                        });
                     }
                  }
                  if (that.roleType == 2) {
                     if (that.jhOrderPlanForwardList[index].carNum < Number(that.carNumSurplusHuodai)) {
                        that.$set(that.jhOrderPlanForwardList[index], 'checkboxValue1', '');
                        that.jhOrderPlanForwardList.forEach((v, i) => {
                           if (index != i) {
                              v.ischecked = false;
                           }
                        });
                     }
                  }
                  time = null;
               }, 800);
            }
@@ -398,7 +410,9 @@
               xsUserId: 0,
               fleetId: 0,
               checkboxValue1: '',
               ischecked: false
               ischecked: false,
               vid: new Date().getTime(),
               isSelected: false
            });
         } else {
            this.jhOrderPlanForwardList.push({
@@ -408,7 +422,9 @@
               xsUserId: 0,
               fleetId: 0,
               checkboxValue1: '',
               ischecked: true
               ischecked: true,
               vid: new Date().getTime(),
               isSelected: false
            });
         }
         this.calculate(this.jhOrderPlanForwardList);
@@ -444,13 +460,7 @@
               this.$u.toast('请输入合法数字');
               isPass = false;
               return isPass;
            }
            // else if (Number(v.carNum) > Number(this.forwardSurplus)) {
            //    this.$u.toast('超过最大订单剩余量');
            //    isPass = false;
            //    return isPass;
            // }
            else {
            } else {
               isPass = true;
               return isPass;
            }