Эх сурвалжийг харах

合规登记,套餐信息不根据销售选择而定,页面默认展示套餐信息

hbchen 2 жил өмнө
parent
commit
6f5400dca6

+ 120 - 94
src/views/financialManagement/contractProgress.vue

@@ -137,8 +137,8 @@
     contractNoTotal:0,
     contractNoLoading:false,
     // --------------套餐信息
-    showServiceFicc:false,
-    showServiceQy:false,
+    // showServiceFicc:false,
+    // showServiceQy:false,
     // 选中的套餐 - ficc
     checkedService:[],
     // 选中的套餐 - 权益
@@ -195,7 +195,9 @@
     // 开票时 权益的销售列表
     sellerInvoiceListQ:[]
   })
-  // 销售列表类型1-单Ficc 2-单权益 3-ficc和权益
+  // 开票到款类型 1-单Ficc 2-单权益 3-ficc和权益
+  const InvoiceAndPaymentType=ref(3)
+  // 合规时销售类型 1-单Ficc 2-单权益 3-ficc和权益
   const sellerListType=ref(3)
   // ---------------开票信息
   const invoiceForm=reactive({
@@ -274,36 +276,36 @@
       console.log(contractInfo.form.seller_ids);
       cascaderSelectSeller.value=[ficcSeller,qySeller]
       contractInfo.form.seller_ids= cascaderSelectSeller.value.join(',')
-      // 根据销售选择是否显示套餐
-      if(ficcSeller && qySeller){
-        // 都有
-        contractInfo.showServiceFicc=true
-        contractInfo.showServiceQy=true
-        if(!contractInfo.form.contract_register_id){
-          // 新增的情况才置空
-          contractInfo.form.services_amount = contractInfo.form.services_Qy_amount = ''
-        }
-      }else if(!ficcSeller){
-        // 没有ficc销售
-        contractInfo.showServiceFicc=false
-        contractInfo.showServiceQy=true
-        contractInfo.form.services_Qy_amount = contractInfo.form.contract_amount
-        contractInfo.form.services_amount =''
-      }else{
-        // 没有权益销售
-        contractInfo.showServiceFicc=true
-        contractInfo.showServiceQy=false
-        contractInfo.form.services_amount = contractInfo.form.contract_amount
-        contractInfo.form.services_Qy_amount =''
-      }
+      // // 根据销售选择是否显示套餐
+      // if(ficcSeller && qySeller){
+      //   // 都有
+      //   contractInfo.showServiceFicc=true
+      //   contractInfo.showServiceQy=true
+      //   if(!contractInfo.form.contract_register_id){
+      //     // 新增的情况才置空
+      //     contractInfo.form.services_amount = contractInfo.form.services_Qy_amount = ''
+      //   }
+      // }else if(!ficcSeller){
+      //   // 没有ficc销售
+      //   contractInfo.showServiceFicc=false
+      //   contractInfo.showServiceQy=true
+      //   contractInfo.form.services_Qy_amount = contractInfo.form.contract_amount
+      //   contractInfo.form.services_amount =''
+      // }else{
+      //   // 没有权益销售
+      //   contractInfo.showServiceFicc=true
+      //   contractInfo.showServiceQy=false
+      //   contractInfo.form.services_amount = contractInfo.form.contract_amount
+      //   contractInfo.form.services_Qy_amount =''
+      // }
     }else{
       if(contractInfo.form.contract_register_id){
         ElMessage.warning('合规套餐类型已定,不允许修改销售数量')
         cascaderSelectSeller.value = contractInfo.form.seller_ids.split(',').map(item => +item)
         return 
       }
-      contractInfo.showServiceFicc = contractInfo.showServiceQy=true
-      contractInfo.form.services_amount = contractInfo.form.services_Qy_amount = ''
+      // contractInfo.showServiceFicc = contractInfo.showServiceQy=true
+      // contractInfo.form.services_amount = contractInfo.form.services_Qy_amount = ''
       cascaderSelectSeller.value=[]
     }
   }
@@ -393,16 +395,15 @@
     }
   })
 
-  watch(()=>contractInfo.form.contract_amount,(newVal)=>{
-    if(contractInfo.showServiceFicc && contractInfo.showServiceQy){
-      return 
-    }else if(!contractInfo.showServiceFicc){
-      contractInfo.form.services_Qy_amount = newVal
-    }else{
-      contractInfo.form.services_amount = newVal
-    }
-    
-  })
+  // watch(()=>contractInfo.form.contract_amount,(newVal)=>{
+  //   if(contractInfo.showServiceFicc && contractInfo.showServiceQy){
+  //     return 
+  //   }else if(!contractInfo.showServiceFicc){
+  //     contractInfo.form.services_Qy_amount = newVal
+  //   }else{
+  //     contractInfo.form.services_amount = newVal
+  //   }
+  // })
 
   // -----------------------method
   // 权限验证
@@ -510,7 +511,7 @@
     contractInfo.checkedPermissionQySmall=[]
     sellerArray.value=value==0?allSellerArray.all_list||[]:[]
 
-    sellerListType.value = value==0?3:''
+    InvoiceAndPaymentType.value = value==0?3:''
 
     // 1-大套餐  2-小套餐
     contractInfo.serviceType=0
@@ -622,7 +623,13 @@
     getServiceDetail({contract_id:selectItem.contract_id}).then(res=>{
       // console.log(res);
       let servivesTemp = res.data?res.data.Service||[]:[]
+
       if(selectItem.product_id==1){
+        // 清空权益套餐
+        contractInfo.serviceVarietyShowQy = false
+        contractInfo.serviceTypeQy = 0
+        contractInfo.checkedServiceQy=[]
+        contractInfo.form.services_Qy_amount = ''
         // FICC套餐
         // 小套餐
         let smallService = servivesTemp.find(item => item.ServiceTemplateId==2)
@@ -632,8 +639,12 @@
         contractInfo.serviceType = !!smallService?2:hasBigService?1:0
         contractInfo.checkedService=servivesTemp.map(item => item.ServiceTemplateId)
         contractInfo.checkedPermission=smallService?smallService.ChartPermissionIds||[]:[]
-        contractInfo.form.services_Qy_amount = ''
       }else{
+        // 清空FICC套餐
+        contractInfo.serviceVarietyShow = false
+        contractInfo.serviceType = 0
+        contractInfo.checkedService=[]
+        contractInfo.form.services_amount = ''
         //权益
         // 权益大套餐
         let bigServiceQY = servivesTemp.find(item => item.FMSServiceTemplateId==11 || item.FMSServiceTemplateId==12)
@@ -652,14 +663,14 @@
           contractInfo.checkedPermissionQyBig = []
           contractInfo.checkedPermissionQySmall = smallServiceQY.map(item => item.FMSServiceTemplateId)
         }
-        contractInfo.form.services_amount = ''
+        
       }
       contractInfo.varietyDiaType='edit'
 
     })
 
     contractInfo.form.product_ids = selectItem.product_id.toString()
-    sellerListType.value = selectItem.product_id
+    InvoiceAndPaymentType.value = selectItem.product_id
     sellerArray.value = selectItem.product_id==1?allSellerArray.ficc_list||[]:allSellerArray.rai_list || []
     // console.log(contractInfo.form);
     contractInfo.form.company_name=selectItem.company_name
@@ -683,8 +694,8 @@
       'start_date','contract_amount','relate_contract_code','actual_company_name'
     ])
   
-    contractInfo.showServiceFicc = selectItem.product_id == 1
-    contractInfo.showServiceQy = selectItem.product_id == 2
+    // contractInfo.showServiceFicc = selectItem.product_id == 1
+    // contractInfo.showServiceQy = selectItem.product_id == 2
 
   }
   // 销售选中
@@ -706,11 +717,11 @@
   const addTableRow=(type)=>{
     if(type=='invoice'){
       invoiceForm.invoiceData.push({
-        service_product_id:sellerListType.value == 3?'':sellerListType.value,origin_amount:'',amount:'',invoice_date:'',remark:'',
+        service_product_id:InvoiceAndPaymentType.value == 3?'':InvoiceAndPaymentType.value,origin_amount:'',amount:'',invoice_date:'',remark:'',
       seller_id:'',seller_name:'',amountDomType:'text',remarkDomType:'text'})
     }else{
       placementForm.placementData.push({
-        service_product_id:sellerListType.value == 3?'':sellerListType.value,origin_amount:'',
+        service_product_id:InvoiceAndPaymentType.value == 3?'':InvoiceAndPaymentType.value,origin_amount:'',
         amount:'',invoice_date:'',remark:'',amountDomType:'text',remarkDomType:'text'})
     }
   }
@@ -728,11 +739,11 @@
         return
       }
       invoiceForm.invoiceData.splice((index+1),0,
-      {service_product_id:sellerListType.value == 3?'':sellerListType.value,origin_amount:'',
+      {service_product_id:InvoiceAndPaymentType.value == 3?'':InvoiceAndPaymentType.value,origin_amount:'',
       amount:'',invoice_date:'',remark:'',seller_id:'',seller_name:'',amountDomType:'text',remarkDomType:'text'})
     }else{
       placementForm.placementData.splice((index+1),0,
-      {service_product_id:sellerListType.value == 3?'':sellerListType.value,origin_amount:'',
+      {service_product_id:InvoiceAndPaymentType.value == 3?'':InvoiceAndPaymentType.value,origin_amount:'',
       amount:'',invoice_date:'',remark:'',amountDomType:'text',remarkDomType:'text'})
     }
   }
@@ -790,7 +801,7 @@
       tempArr=placementForm.placementData
       word='到款'
     }
-    if(tempArr[index].origin_amount=='' && tempArr[index].amount=='' && (tempArr[index].service_product_id=='' || sellerListType.value != 3)
+    if(tempArr[index].origin_amount=='' && tempArr[index].amount=='' && (tempArr[index].service_product_id=='' || InvoiceAndPaymentType.value != 3)
     && tempArr[index].invoice_date=='' && !haveSalesman){
       // 没有内容 直接删除
       tempArr.splice(index,1)
@@ -900,12 +911,20 @@
       if(valid){
         contractInfo.form.services=[]
         contractInfo.form.service_amount=[]
+        
+        if(contractInfo.checkedServiceQy.length==0 && contractInfo.checkedService.length==0){
+          ElMessage.warning('请选择套餐')
+          return 
+        }
+        let hasFICCservice=false
+        let hasQYservice=false
         // FICC
-        if(contractInfo.showServiceFicc){
-          if(contractInfo.checkedService.length==0){
-            ElMessage.warning('请选择FICC套餐')
-            return 
-          }
+        if(contractInfo.checkedService.length>0){
+          // if(contractInfo.checkedService.length==0){
+          //   ElMessage.warning('请选择FICC套餐')
+          //   return 
+          // }
+          hasFICCservice=true
           if((!contractInfo.checkedPermission || contractInfo.checkedPermission.length==0) 
           && contractInfo.checkedService.some(serviceId =>serviceId==2)){
             ElMessage.warning('请保存FICC小套餐品种')
@@ -941,15 +960,17 @@
             return 
           }
           contractInfo.form.service_amount.push({product_id:1,service_amount:+contractInfo.form.services_amount})
+          contractInfo.form.services_amount = +parseFloat(contractInfo.form.services_amount).toFixed(2) || 0
         }
         
         // 权益
-        if(contractInfo.showServiceQy){
-          if(contractInfo.checkedServiceQy.length==0){
-            ElMessage.warning('请选择权益套餐')
-            return 
-          }
+        if(contractInfo.checkedServiceQy.length>0){
+          // if(contractInfo.checkedServiceQy.length==0){
+          //   ElMessage.warning('请选择权益套餐')
+          //   return 
+          // }
           // 权益大套餐
+          hasQYservice=true
           if((!contractInfo.checkedPermissionQyBig || contractInfo.checkedPermissionQyBig.length==0) 
           && contractInfo.checkedServiceQy.some(serviceId =>serviceId==10)){
             ElMessage.warning('请保存权益大套餐类型')
@@ -1005,13 +1026,21 @@
             return 
           }
           contractInfo.form.service_amount.push({product_id:2,service_amount:+contractInfo.form.services_Qy_amount})
+          contractInfo.form.services_Qy_amount = +parseFloat(contractInfo.form.services_Qy_amount).toFixed(2) || 0
         }
-        
+        let servicesAll=0
+        if(hasFICCservice&&hasQYservice){
+          servicesAll = Math.round((contractInfo.form.services_Qy_amount+contractInfo.form.services_amount)*100)/100
+        }else if(hasFICCservice){
+          servicesAll = contractInfo.form.services_amount
+          contractInfo.form.services_Qy_amount=''
+        }else{
+          servicesAll = contractInfo.form.services_Qy_amount
+          contractInfo.form.services_amount=''
+        }
+
         contractInfo.form.contract_amount = +parseFloat(contractInfo.form.contract_amount).toFixed(2)
-        contractInfo.form.services_amount = +parseFloat(contractInfo.form.services_amount).toFixed(2) || 0
-        contractInfo.form.services_Qy_amount = +parseFloat(contractInfo.form.services_Qy_amount).toFixed(2) || 0
-        console.log(contractInfo.form.services_amount,contractInfo.form.services_Qy_amount);
-        let servicesAll = Math.round((contractInfo.form.services_Qy_amount+contractInfo.form.services_amount)*100)/100
+        // console.log(contractInfo.form.services_amount,contractInfo.form.services_Qy_amount,servicesAll);
         if(servicesAll!=contractInfo.form.contract_amount){
           ElMessage.error('套餐总金额不等于合同金额')
           return 
@@ -1033,7 +1062,7 @@
         }else{
           // 新增
           contractRegisterCheck({company_name:contractInfo.form.company_name,
-            start_date:contractInfo.form.start_date,end_date:contractInfo.form.end_date}).then(res=>{
+            start_date:contractInfo.form.start_date,end_date:contractInfo.form.end_date,seller_ids:contractInfo.form.seller_ids}).then(res=>{
             if(res.data?.exist){
               // 存在给提示
               ElMessageBox.confirm('已登记过相同的合同,是否继续操作?',
@@ -1253,23 +1282,28 @@
         remark:res.data.remark,
         contract_source:res.data.contract_source,
       }
-      // 销售
+      // 开票到款时的展示方式
+      let hasFICC = res.data.service_amount_list.some(item => item.product_id==1)
+      let hasQY = res.data.service_amount_list.some(item => item.product_id==2)
+      if(hasFICC && hasQY){
+        InvoiceAndPaymentType.value = 3
+      }else if(!hasFICC){
+        InvoiceAndPaymentType.value = 2
+      }else{
+        InvoiceAndPaymentType.value = 1
+      }
+      // 合规时的销售
       if(res.data.seller_id && res.data.rai_seller_id){
-        contractInfo.showServiceFicc = contractInfo.showServiceQy=true
+        sellerListType.value=3
         sellerArray.value = allSellerArray.all_list
         cascaderSelectSeller.value = res.data.seller_ids.split(',').map(item => +item) 
       }else if(!res.data.seller_id){
+        sellerListType.value=2
         sellerArray.value=allSellerArray.rai_list
-        contractInfo.showServiceQy=true
       }else{
+        sellerListType.value=1
         sellerArray.value=allSellerArray.ficc_list
-        contractInfo.showServiceFicc=true
       }
-      // if(res.data.contract_source == 0){
-      //   sellerArray.value = allSellerArray.all_list
-      //   cascaderSelectSeller.value = res.data.seller_ids.split(',').map(item => +item) 
-      // }
-
       rmbRate.value=res.data.rmb_rate
       console.log(rmbRate.value,res.data.rmb_rate);
       if(haveGetCurrencyList.value){
@@ -1286,9 +1320,9 @@
       }
       // 套餐金额
       contractInfo.form.services_amount = res.data.service_amount_list.find(it => it.product_id==1)?
-      res.data.service_amount_list.find(it => it.product_id==1).service_amount:0
+      res.data.service_amount_list.find(it => it.product_id==1).service_amount:''
       contractInfo.form.services_Qy_amount = res.data.service_amount_list.find(it => it.product_id==2)?
-      res.data.service_amount_list.find(it => it.product_id==2).service_amount:0
+      res.data.service_amount_list.find(it => it.product_id==2).service_amount:''
       res.data.service_list.map(item =>{
         if(item.service_template_id==2){
           // ficc小套餐
@@ -1331,16 +1365,8 @@
       }).filter(Boolean)
       contractInfo.contractValidityDate=[res.data.start_date,res.data.end_date]
       
-      if(res.data.seller_id && res.data.rai_seller_id){
-        sellerListType.value = 3
-      }else if(!res.data.seller_id){
-        sellerListType.value = 2
-      }else{
-        sellerListType.value = 1
-      }
-      
       invoiceForm.invoiceData[0].service_product_id = 
-      placementForm.placementData[0].service_product_id=sellerListType.value == 3?'':sellerListType.value
+      placementForm.placementData[0].service_product_id=InvoiceAndPaymentType.value == 3?'':InvoiceAndPaymentType.value
 
       // 开票
       // console.log(res.data.service_amount_list.find(item => item.product_id==1),res.data.service_amount_list.find(item => item.product_id==2));
@@ -1377,7 +1403,7 @@
         // 添加一行空的
         if(contractInfo.operationtype=='invoice'){
           invoiceForm.invoiceData.push({
-            service_product_id:sellerListType.value == 3?'':sellerListType.value,              
+            service_product_id:InvoiceAndPaymentType.value == 3?'':InvoiceAndPaymentType.value,              
             origin_amount:'',
             amount:'',
             invoice_date:'',
@@ -1413,7 +1439,7 @@
         // 添加一行空的
         if(contractInfo.operationtype=='placement'){
           placementForm.placementData.push({
-            service_product_id:sellerListType.value == 3?'':sellerListType.value,
+            service_product_id:InvoiceAndPaymentType.value == 3?'':InvoiceAndPaymentType.value,
             origin_amount:'',
             amount:'',
             invoice_date:'',
@@ -1564,7 +1590,7 @@
                 </div>
                 <div class="info-row">
                   <div class="info-row-title" >套餐信息</div>
-                  <div class="info-row-services" v-if="contractInfo.showServiceFicc">
+                  <div class="info-row-services">
                     <div class="info-row-services-header" id="info-row-services-header">
                       <span>FICC套餐</span>
                       <el-input v-model="contractInfo.form.services_amount" :disabled="contractInfo.operationtype!='compliance'"
@@ -1601,7 +1627,7 @@
                       </el-checkbox>
                     </el-checkbox-group>
                   </div>
-                  <div class="info-row-services" v-if="contractInfo.showServiceQy">
+                  <div class="info-row-services">
                     <div class="info-row-services-header" id="info-row-services-header">
                       <span>权益套餐</span>
                       <el-input v-model="contractInfo.form.services_Qy_amount" :disabled="contractInfo.operationtype!='compliance'"
@@ -1663,7 +1689,7 @@
                   <div class="info-row-title">开票信息</div>
                   <div class="info-row-invoice-payment">
                     <div class="invoice-payment-title">
-                      <div v-if="contractInfo.showServiceFicc && contractInfo.showServiceQy" style="margin-right: 30px;margin-bottom: 20px;">
+                      <div v-if="InvoiceAndPaymentType==3" style="margin-right: 30px;margin-bottom: 20px;">
                         <div class="invoice-payment-money-multiple" :style="{height:isIandPExpand.haveInvoice?'135px':'59px'}">
                           <div class="invoice-payment-money-multiple-head" @click="isIandPExpand.haveInvoice=!isIandPExpand.haveInvoice">
                             <span style="margin-right: 20px;">已开票金额</span>
@@ -1692,7 +1718,7 @@
                         <span class="invoice-payment-money">{{moneyFormatter(contractInfo.moneyData?.haveInvoiceMoney)}}</span>
                         ({{ contractInfo.currencyUnit }})
                       </div>
-                      <div v-if="contractInfo.showServiceFicc && contractInfo.showServiceQy" style="margin-bottom: 20px;">
+                      <div v-if="InvoiceAndPaymentType==3" style="margin-bottom: 20px;">
                         <div class="invoice-payment-money-multiple" :style="{height:isIandPExpand.waitInvoice?'135px':'59px'}">
                           <div class="invoice-payment-money-multiple-head" @click="isIandPExpand.waitInvoice=!isIandPExpand.waitInvoice">
                             <span style="margin-right: 20px;">剩余开票金额</span>
@@ -1731,7 +1757,7 @@
                             {{$index+1}}
                           </template>
                         </el-table-column>
-                        <el-table-column label="套餐类型" width="160" align="center" prop="service_product_id" v-if="sellerListType==3">
+                        <el-table-column label="套餐类型" width="160" align="center" prop="service_product_id" v-if="InvoiceAndPaymentType==3">
                           <template #header>
                             <span style="color: var(--dangerColor);">*</span>套餐类型
                           </template>
@@ -1856,7 +1882,7 @@
                   <div class="info-row-title">到款信息</div>
                   <div class="info-row-invoice-payment">
                     <div class="invoice-payment-title">
-                      <div v-if="contractInfo.showServiceFicc && contractInfo.showServiceQy" style="margin-right: 30px;margin-bottom: 20px;">
+                      <div v-if="InvoiceAndPaymentType==3" style="margin-right: 30px;margin-bottom: 20px;">
                         <div class="invoice-payment-money-multiple" :style="{height:isIandPExpand.havePlacement?'135px':'59px'}">
                           <div class="invoice-payment-money-multiple-head" @click="isIandPExpand.havePlacement=!isIandPExpand.havePlacement">
                             <span style="margin-right: 20px;">已到款金额</span>
@@ -1886,7 +1912,7 @@
                         <span class="invoice-payment-money">{{moneyFormatter(contractInfo.moneyData.havePlacementMoney)}}</span>
                         ({{ contractInfo.currencyUnit }})
                       </div>
-                      <div v-if="contractInfo.showServiceFicc && contractInfo.showServiceQy" style="margin-bottom: 20px;">
+                      <div v-if="InvoiceAndPaymentType==3" style="margin-bottom: 20px;">
                         <div class="invoice-payment-money-multiple" :style="{height:isIandPExpand.waitPlacement?'135px':'59px'}">
                           <div class="invoice-payment-money-multiple-head" @click="isIandPExpand.waitPlacement=!isIandPExpand.waitPlacement">
                             <span style="margin-right: 20px;">剩余到款金额</span>
@@ -1925,7 +1951,7 @@
                             {{$index+1}}
                           </template>
                         </el-table-column>
-                        <el-table-column label="套餐类型" width="160" align="center" prop="service_product_id" v-if="sellerListType==3">
+                        <el-table-column label="套餐类型" width="160" align="center" prop="service_product_id" v-if="InvoiceAndPaymentType==3">
                           <template #header>
                             <span style="color: var(--dangerColor);">*</span>套餐类型
                           </template>