Browse Source

需求池603 禁用的销售账号的数据可见

hbchen 1 year ago
parent
commit
e1f508e9ca
1 changed files with 30 additions and 31 deletions
  1. 30 31
      src/views/financialManagement/contractProgress-component/Compliance.vue

+ 30 - 31
src/views/financialManagement/contractProgress-component/Compliance.vue

@@ -147,6 +147,11 @@
   const sellerListType=ref(3)
   // 选中的销售数组
   const cascaderSelectSeller=ref([])
+  // 销售是否离职
+  const isSellerLeave={ficc:false,qy:false}
+  // 标识合规原本的销售是否已离职
+  let isLeave=false
+
   // 查看套餐报价单 图片
   const previewImage=ref('')
   // 查看套餐报价单 标题
@@ -255,12 +260,12 @@
     }
   }
 
-  // 标识合规原本的销售是否已离职
-  let isLeave=false
-
   // 销售修改
   const sellerChange=(value)=>{
     let ficcSeller,qySeller
+    // 一旦发生修改,离职的提示就消失
+    isSellerLeave.ficc=isSellerLeave.qy=false
+
     if(value?.length>0){
       for (let i = 0; i < value.length; i++) {
         const element = value[i];
@@ -390,20 +395,17 @@
   const complianceSubmit=()=>{
     contractInfoForm.value.validate(valid=>{
       if(valid){
+        // console.log(cascaderSelectSeller.value);
         if(isLeave){
           // 判断原本销售已离职
           if(sellerListType.value==3){
-            if(cascaderSelectSeller.value[0]){
-              if(props.sellerData.ficc_list.findIndex(item => item.seller_id == cascaderSelectSeller.value[0])==-1){
-                ElMessage.error('选择的FICC销售不存在或已离职')
-                return 
-              }
+            if(isSellerLeave.ficc){
+              ElMessage.error('选择的FICC销售不存在或已离职')
+              return
             }
-            if(cascaderSelectSeller.value[1]){
-              if(props.sellerData.rai_list.findIndex(item => item.seller_id == cascaderSelectSeller.value[1])==-1){
-                ElMessage.error('选择的权益销售不存在或已离职')
-                return
-              }
+            if(isSellerLeave.qy){
+              ElMessage.error('选择的权益销售不存在或已离职')
+              return
             }
           }else{
             if(!Number(compliance.form.seller_id)){
@@ -542,7 +544,6 @@
           compliance.form.has_payment=0
           compliance.form.actual_pay_companies=''
         }
-
         // 检验合同名称或者合同有效期是否重复
         if(compliance.form.contract_register_id){
           // 编辑
@@ -647,9 +648,9 @@
 
   // 对于销售的处理
   const sellerOperation=({seller_id,rai_seller_id,seller_ids,seller_name,rai_seller_name})=>{
-    if(seller_id && rai_seller_id){
+    if(sellerListType.value==3){
       cascaderSelectSeller.value = seller_ids.split(',').map(item => +item) 
-      if(props.sellerData.ficc_list.findIndex(item => item.seller_id == seller_id)==-1){
+      if(seller_id && props.sellerData.ficc_list.findIndex(item => item.seller_id == seller_id)==-1){
         props.sellerData.all_list.push({
           seller_id:seller_id,
           seller_name:seller_name+'-已离职',
@@ -657,8 +658,9 @@
           child:null
         })
         isLeave=true
+        isSellerLeave.ficc=true
       }
-      if(props.sellerData.rai_list.findIndex(item => item.seller_id == rai_seller_id)==-1){
+      if(rai_seller_id && props.sellerData.rai_list.findIndex(item => item.seller_id == rai_seller_id)==-1){
         props.sellerData.all_list.push({
           seller_id:rai_seller_id,
           seller_name:rai_seller_name+'-已离职',
@@ -666,20 +668,18 @@
           child:null
         })
         isLeave=true
-      }
-    }else if(!seller_id){
-      if(props.sellerData.rai_list.findIndex(item => item.seller_id == rai_seller_id)==-1){
-        // 为-1表示原本的销售已离职
-        compliance.form.seller_id = rai_seller_name
-        isLeave=true
+        isSellerLeave.qy=true
       }
     }else{
-      if(props.sellerData.ficc_list.findIndex(item => item.seller_id == seller_id)==-1){
-        // 为-1表示原本的销售已离职
-        compliance.form.seller_id = seller_name
+      if(rai_seller_id&&props.sellerData.rai_list.findIndex(item => item.seller_id == rai_seller_id)==-1){
+        compliance.form.seller_id = rai_seller_name+'-已离职'
+        isLeave=true
+      }else if(seller_id && props.sellerData.ficc_list.findIndex(item => item.seller_id == seller_id)==-1){
+        compliance.form.seller_id = seller_name+'-已离职'
         isLeave=true
       }
     }
+
   }
 
   // 选择品种 - ficc
@@ -779,13 +779,12 @@
       seller_name:props.detailInfo.seller_name,
       rai_seller_name:props.detailInfo.rai_seller_name
     }
-    // 拿到销售列表后才去做处理
-    intervalDataRequest(()=> props.sellerData.all_list>0 ,sellerOperation(para),1)
     // 销售显示
     sellerListType.value=props.detailInfo.sellerListType
-    if(sellerListType.value == 3){
-      cascaderSelectSeller.value = compliance.form.seller_ids.split(',').map(item => +item) 
-    }
+
+    // 拿到销售列表后才去做处理
+    intervalDataRequest(()=> props.sellerData.all_list>0 ,sellerOperation(para),1)
+
     // 套餐金额
     compliance.form.services_amount = props.detailInfo.service_amount_list.find(it => it.product_id==1)?
     props.detailInfo.service_amount_list.find(it => it.product_id==1).service_amount:0