Browse Source

小冲突

hbchen 1 year ago
parent
commit
1958303c22

+ 2 - 2
.env.development

@@ -1,5 +1,5 @@
 # 接口地址
-# VITE_APP_API_URL="http://192.168.77.4:8619/api"
-VITE_APP_API_URL="http://8.136.199.33:8619/api"
+VITE_APP_API_URL="http://192.168.77.4:8619/api"
+# VITE_APP_API_URL="http://8.136.199.33:8619/api"
 # crm系统地址
 VITE_CRM_SYSTEM_URL="https://rddptest.hzinsights.com/login"

+ 1 - 0
package.json

@@ -14,6 +14,7 @@
     "axios": "^0.26.0",
     "echarts": "^5.4.0",
     "element-plus": "^2.2.14",
+    "element-resize-detector": "^1.2.4",
     "html2canvas": "1.4.0",
     "js-base64": "^3.7.2",
     "js-md5": "^0.7.3",

+ 1 - 1
src/api/crm.js

@@ -16,7 +16,7 @@ export function getPermissionList(data) {
       params:data
   })
 }
-// 获取销售列表
+// 获取销售列表(包括禁用的销售)
  /**
   * @param {
   * } data 

+ 20 - 1
src/api/financialMana.js

@@ -325,6 +325,23 @@ export function getPreRegistrationList(data) {
       method:'get',
       params:data
   })
+}
+ /**
+  * 新增预登记时 判断合规信息是否存在
+  * @param {
+ * company_name - 客户名称
+ * start_date - 约定开始日期
+ * end_date - 约定结束日期
+ * services - 套餐列表
+ * } data 
+ * @returns 
+ */
+export function preRegistrationCheck(data) {
+ return request({
+     url:'/contract/register/check_contract_duplicate',
+     method:'post',
+     data
+ })
 }
  // 新增预登记
  /**
@@ -351,7 +368,9 @@ export function preRegistrationAdd(data) {
  /**
   * 
   * @param {
- * invoice_id contract_register_id
+ * invoice_id
+ * contract_register_id 
+ * detail_type(1编辑 2预开票/到款)
  * } data 
  * @returns 
  */

+ 19 - 3
src/utils/request.js

@@ -8,10 +8,21 @@ const request = axios.create({
 
 })
 
+let requestList=new Set()
+
 request.interceptors.request.use(
   config=>{
     // console.log(config);
     config.headers['Authorization'] = localStorage.getItem('fsms_token') || ''
+       // 不处理get请求
+    if (config.method !== 'get') {
+      // 利用axios cancelToken 先取消请求
+      config.cancelToken = new axios.CancelToken(e => {
+        // console.log(e, config, 'CancelToken')
+        // 在这里取消重复请求,上个请求未完成时,相同的请求不会再次执行
+        requestList.has(`${config.url}`) ? e(`${config.url}---重复请求被中断`) : requestList.add(`${config.url}`)
+      })
+    }
     return config
   },
   err=>{
@@ -22,6 +33,7 @@ request.interceptors.request.use(
 
 request.interceptors.response.use(
   res=>{
+    requestList.delete(`${res.config.url}`)
     if(res.request.responseType==='blob' || res.request.responseType==='Blob'){
        // 字节流
        if(res.status === 200){
@@ -52,14 +64,18 @@ request.interceptors.response.use(
     }
   },
   err=>{
-      const {message} = err
-      console.log(message);
+    requestList.clear()
+    const {message} = err
+    console.log(message,'--错误信息');
+    if(!err.__CANCEL__){
+      // 多次点击由CancelToken取消的请求不给错误提示
       ElMessage({
         message: message || '网络异常',
         type: 'error',
         duration: 3 * 1000
       })
-      return Promise.reject(err)
+    }
+    return Promise.reject(err)
   }
 )
 

+ 8 - 1
src/views/financialManagement/composition/IandPList.js

@@ -59,6 +59,12 @@ export default function getIandPListCom(type) {
     placement.searchParams.current = 1
     placementList()
   }
+
+  const sellerChange=(value)=>{
+    placement.searchParams.seller_ids = value.join(',')
+    searchPlacement()
+  }
+
   // 搜索项-开始金额和结束金额改变
   const moneyChange=(value,prop)=>{
     let trimValue = value.trim()
@@ -139,11 +145,12 @@ export default function getIandPListCom(type) {
       downloadByFlow(res,'xlxs',fileName)
     })
   }
-
+  
   return {
     data:placement,
     dateButtonData,
     placementList,
+    sellerChange,
     searchPlacement,
     moneyChange,
     placementExport,

+ 16 - 5
src/views/financialManagement/contractProgress-component/Compliance.vue

@@ -110,7 +110,8 @@
     // 有效期
     contractValidityDate:[],
     // 合同类型选中
-    contractTypeCheck:[]
+    contractTypeCheck:[],
+    hasQYSeller:''
   })
 
   // --------------套餐信息
@@ -198,7 +199,9 @@
     compliance.form.services_Qy_amount='',
     compliance.form.service_remark='',
     compliance.form.remark=""
-    
+
+    compliance.hasQYSeller=''
+
     serviceData.checkedService=[]
     serviceData.checkedServiceQy=[]
     serviceData.checkedPermission=[]
@@ -278,10 +281,12 @@
         }
       }
       cascaderSelectSeller.value=[ficcSeller,qySeller]
+      compliance.hasQYSeller=qySeller?true:false
       compliance.form.seller_ids= cascaderSelectSeller.value.join(',')
     }else{
       cascaderSelectSeller.value=[]
       compliance.form.seller_ids=''
+      compliance.hasQYSeller=''
     }
   }
   // 合同编号选中
@@ -336,7 +341,7 @@
         serviceData.serviceType = !!smallService?2:hasBigService?1:0
         serviceData.checkedService=servivesTemp.map(item => item.ServiceTemplateId)
         serviceData.checkedPermission=smallService?smallService.ChartPermissionIds||[]:[]
-        compliance.form.services_Qy_amount = ''
+        compliance.form.services_amount = res.data.Price
       }else{
         // 清空FICC套餐
         serviceData.serviceVarietyShow = false
@@ -352,6 +357,8 @@
         serviceData.serviceVarietyShowQy = (!!bigServiceQY) || (!!smallServiceQY)
         serviceData.serviceTypeQy = serviceData.qYDiaType =  !!bigServiceQY?1:!!smallServiceQY?2:0
         serviceData.checkedServiceQy=[!!bigServiceQY?10:13]
+
+        compliance.form.services_Qy_amount = res.data.Price
         if(!!bigServiceQY){
           //权益大套餐
           serviceData.checkedPermissionQyBig = [bigServiceQY.FMSServiceTemplateId]
@@ -361,12 +368,14 @@
           serviceData.checkedPermissionQyBig = []
           serviceData.checkedPermissionQySmall = smallServiceQY.map(item => item.FMSServiceTemplateId)
         }
-        compliance.form.services_amount = ''
       }
       serviceData.varietyDiaType='edit'
     })
     compliance.form.product_ids = selectItem.product_id.toString()
     sellerListType.value = selectItem.product_id
+
+    compliance.hasQYSeller=selectItem.product_id==2
+
     compliance.form.crm_contract_id=selectItem.contract_id
     compliance.form.start_date=selectItem.start_date
     compliance.form.end_date=selectItem.end_date
@@ -785,6 +794,8 @@
     // 拿到销售列表后才去做处理
     intervalDataRequest(()=> props.sellerData.all_list>0 ,sellerOperation(para),1)
 
+    compliance.hasQYSeller = props.detailInfo.rai_seller_id?true:false
+    
     // 套餐金额
     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
@@ -1002,7 +1013,7 @@
             </el-checkbox>
           </el-checkbox-group>
         </div>
-        <div class="info-row-services">
+        <div class="info-row-services" v-show="compliance.hasQYSeller!==false">
           <div class="info-row-services-header" id="info-row-services-header">
             <span>权益套餐</span>
             <el-input v-model="compliance.form.services_Qy_amount" :disabled="operationtype!='compliance'"

+ 176 - 82
src/views/financialManagement/contractProgress-component/InvoiceAndPayment.vue

@@ -56,25 +56,42 @@
   // ---------------开票/到款金额信息
   const amountForm=reactive({
     amountData:[
-      {
-        service_product_id:'',
-        origin_amount:'',
-        amount:'',
-        invoice_date:'',
-        remark:'',
-        // dom的类型
-        amountDomType:'text',
-        remarkDomType:'text',
-        seller_id:'',
-        seller_name:''
-      }
-    ]
+      // {
+      //   service_product_id:'',
+      //   origin_amount:'',
+      //   amount:'',
+      //   invoice_date:'',
+      //   remark:'',
+      //   // dom的类型
+      //   amountDomType:'text',
+      //   remarkDomType:'text',
+      //   seller_id:'',
+      //   seller_name:'',
+        // hasRelativeSeller // 是否有对应 开票/到款 的记录销售
+      // }
+    ],
+    // 已经登记的开票/到款 开票登记的时候是到款,到款登记的时候是开票
+    submittedAmountData:[]
   })
+  // 销售离职验证
+  const sellerValidator=(row,callback)=>{
+    // console.log(row);
+    console.log(row);
+    if(row.seller_name.indexOf('已离职')!=-1){
+      ElMessage.error(row.seller_name)
+      return 
+    }else{
+      callback()
+    }
+  }
+
   //开票-到款展开和收起
   const isIandPExpand=reactive({
     haveInvoice:false,
     waitInvoice:false
   })
+  
+
   // 货币汇率
   const rmbRate=ref(1)
 
@@ -123,21 +140,16 @@
     IandP.moneyData.haveMoneyFICC = Math.round(IandP.moneyData.haveMoneyFICC*100)/100
     IandP.moneyData.haveMoneyQY = Math.round(IandP.moneyData.haveMoneyQY*100)/100
   }
-  // 添加行
-  const addTableRow=()=>{
-    amountForm.amountData.push({
-      service_product_id:sellerListType.value == 3?'':sellerListType.value,origin_amount:'',amount:'',invoice_date:'',remark:'',
-    seller_id:'',seller_name:'',amountDomType:'text',remarkDomType:'text'})
-  }
 
-  // 开票销售更改
-  const invoiceSellerChange=(row,value)=>{
+  // 销售更改
+  const sellerChange=(row,value)=>{
     if(row.service_product_id==1){
-      row.seller_name = props.sellerData.ficc_list.find(seller => seller.seller_id==value)?.seller_name
+      row.seller_name = [...props.sellerData.ficc_list,...props.sellerData.rai_list].find(seller => seller.seller_id==value)?.seller_name
     }else{
       row.seller_name = props.sellerData.rai_list.find(seller => seller.seller_id==value)?.seller_name
     }
   }
+
   // 判断表格当前行的信息是否填写完整
   const canAddorEdit=(type,row)=>{
     if(!(row.amount && row.invoice_date && row.service_product_id)){
@@ -149,13 +161,82 @@
     return 1
   }
 
+  const setRowData=()=>{
+    /**
+     * 添加数据 根据 开票/到款记录的套餐类型和序号对应
+     * 对应的上,套餐类型和销售 跟对应的开票/到款记录一样,没有为空
+     * 主要是 需要添加的数据 是对应的哪一条记录
+     */
+    let serviceProductId=sellerListType.value == 3?'':sellerListType.value
+    let sellerId,sellerName='';
+    // 已经找到对应记录的 次数 FICC,权益
+    let hasFindCount=[0,0]
+    // 存在的记录条数 FICC,权益
+    let allCount=[amountForm.amountData.filter(item => item.service_product_id==1).length,
+    amountForm.amountData.filter(item => item.service_product_id==2).length]
+    // 可编辑情况下
+    if(props.operationtype=='invoice'&&props.type=='开票' || props.operationtype=='placement'&&props.type=='到款'){
+      for (let i = 0; i < amountForm.submittedAmountData.length; i++) {
+        const element = amountForm.submittedAmountData[i];
+        // 符合条件,继续找
+        if(amountForm.amountData.some(it => it.service_product_id == element.service_product_id) &&
+         hasFindCount[element.service_product_id-1]<allCount[element.service_product_id-1]){
+          hasFindCount[element.service_product_id-1]++
+          continue
+        } 
+        // 不符合条件,那需要添加的数据就 对应这一条
+        serviceProductId=element.service_product_id
+        sellerId=element.seller_id || ''
+        sellerName=element.seller_name || ''
+        // 找到第一条就break掉
+        break
+      }
+    }
+    // 判断销售是否离职
+    if(sellerId){
+      if(serviceProductId==1){
+        // FICC销售和权益销售都要判断,并且页面呈现为级联选择器
+        if([...props.sellerData.ficc_list,...props.sellerData.rai_list]
+        .findIndex(seller => seller.seller_id==sellerId)==-1){
+          props.sellerData.all_list.push({
+            seller_id:sellerId,
+            seller_name:sellerName+'-已离职',
+            disabled:true,
+            child:null
+          })
+          sellerName=sellerName+'-已离职'
+        }
+        // console.log(sellerId);
+      }else{
+        if(props.sellerData.rai_list.findIndex(seller => seller.seller_id==sellerId)==-1){
+          sellerId = sellerName+'-已离职'
+          sellerName=sellerName+'-已离职'
+        }
+      }
+    }
+    amountForm.amountData.push({
+      service_product_id:serviceProductId,              
+      origin_amount:'',
+      amount:'',
+      is_pre_pay:0,
+      invoice_date:'',
+      remark:'',
+      seller_id:sellerId,
+      seller_name:sellerName,
+      // 到款有对应的销售需要禁用
+      hasRelativeSeller:!!sellerId,
+      amountDomType:'text',
+      remarkDomType:'text'
+    })
+  }
+
   // 表格添加行
   const addRow=(row,index)=>{
     const flag = canAddorEdit(props.type,row)
     if(flag==1){
-      amountForm.amountData.splice((index+1),0,
-      {service_product_id:sellerListType.value == 3?'':sellerListType.value,origin_amount:'',
-      amount:'',invoice_date:'',remark:'',seller_id:'',seller_name:'',amountDomType:'text',remarkDomType:'text'})
+      setRowData()
+      // amountForm.amountData.push({service_product_id:sellerListType.value == 3?'':sellerListType.value,origin_amount:'',
+      // amount:'',invoice_date:'',remark:'',seller_id:'',seller_name:'',amountDomType:'text',remarkDomType:'text'})
     }else{
       ElMessage.error(flag)
     }
@@ -317,7 +398,7 @@
   const setIandPDetail=()=>{
     sellerListType.value = props.IPDetailInfo.sellerListType
     rmbRate.value=props.IPDetailInfo.rmb_rate
-    amountForm.amountData[0].service_product_id = sellerListType.value == 3?'':sellerListType.value
+    // amountForm.amountData[0].service_product_id = sellerListType.value == 3?'':sellerListType.value
 
     // FICC套餐总金额 = FICC套餐剩余开篇金额
     IandP.moneyData.waitMoneyFICC= IandP.moneyData.allMoneyFICC =
@@ -325,46 +406,44 @@
     // 权益套餐总金额 = 权益套餐剩余开篇金额
     IandP.moneyData.waitMoneyQY= IandP.moneyData.allMoneyQY =
     props.IPDetailInfo.service_amount_list.find(item => item.product_id==2)?props.IPDetailInfo.service_amount_list.find(item => item.product_id==2).service_amount:0
-    let amoutList = props.type=='开票'?props.IPDetailInfo.invoice_list:props.IPDetailInfo.payment_list
-    if(amoutList.length>0){
-      amountForm.amountData=[]
-      amoutList.map(item=>{
-        if(item.service_product_id==1){
-          // FICC
-          IandP.moneyData.haveMoneyFICC+=item.origin_amount
-        }else{
-          // 权益
-          IandP.moneyData.haveMoneyQY+=item.origin_amount
-        }
-        amountForm.amountData.push({
-          invoice_id:item.contract_invoice_id,
-          service_product_id:item.service_product_id,
-          origin_amount:item.origin_amount,
-          amount:item.amount,
-          is_pre_pay:item.is_pre_pay,
-          invoice_date:item.invoice_time,
-          remark:item.remark,
-          seller_id:item.seller_id,
-          seller_name:item.seller_name,
-          amountDomType:'text',
-          remarkDomType:'text',
-          isEdit:false
-        })
-      })
-      // 添加一行空的
+    let amoutList = []
+
+    // 分理处已登记的开票/到款
+    if(props.type=='开票'){
+      amoutList=props.IPDetailInfo.invoice_list
+      amountForm.submittedAmountData = props.IPDetailInfo.payment_list
+    }else{
+      amountForm.submittedAmountData =  props.IPDetailInfo.invoice_list
+      amoutList= props.IPDetailInfo.payment_list
+    }
+
+    // if(amoutList.length>0){
+    amountForm.amountData=[]
+    amoutList.map(item=>{
+      if(item.service_product_id==1){
+        // FICC
+        IandP.moneyData.haveMoneyFICC+=item.origin_amount
+      }else{
+        // 权益
+        IandP.moneyData.haveMoneyQY+=item.origin_amount
+      }
       amountForm.amountData.push({
-        service_product_id:sellerListType.value == 3?'':sellerListType.value,              
-        origin_amount:'',
-        amount:'',
-        is_pre_pay:0,
-        invoice_date:'',
-        remark:'',
-        seller_id:'',
-        seller_name:'',
+        invoice_id:item.contract_invoice_id,
+        service_product_id:item.service_product_id,
+        origin_amount:item.origin_amount,
+        amount:item.amount,
+        is_pre_pay:item.is_pre_pay,
+        invoice_date:item.invoice_time,
+        remark:item.remark,
+        seller_id:item.seller_id,
+        seller_name:item.seller_name,
         amountDomType:'text',
-        remarkDomType:'text'
+        remarkDomType:'text',
+        isEdit:false
       })
-    }
+    })
+    setRowData()
+    // }
     IandP.moneyData.haveMoney=
     IandP.moneyData.haveMoneyFICC+IandP.moneyData.haveMoneyQY
 
@@ -419,7 +498,7 @@
                 </div>
               </div>
             </div>
-            <div style="margin-right: 30px;" v-else>已{{ type }}金额:
+            <div style="margin-right: 30px;display: flex;align-items: center;" v-else>已{{ type }}金额:
               <span class="invoice-payment-money">{{moneyFormatter(IandP.moneyData?.haveMoney)}}</span>
               ({{ IandP.currencyUnit }})
             </div>
@@ -448,11 +527,11 @@
                 </div>
               </div>
             </div>
-            <div v-else>剩余{{ type }}金额:
+            <div v-else style="display: flex;align-items: center;">剩余{{ type }}金额:
               <span class="invoice-payment-money">{{moneyFormatter(IandP.moneyData?.waitMoney)}}</span>
               ({{ IandP.currencyUnit }})
             </div>
-            <el-button type="primary" style="margin: 0 0 0 20px;" @click="addTableRow" 
+            <el-button type="primary" style="margin: 0 0 0 20px;" @click="setRowData" 
             v-if="amountForm.amountData.length==0">添加{{ type }}信息</el-button>
           </div>
           <el-form ref="iandPFormRef" :model="amountForm" 
@@ -486,12 +565,12 @@
                 <template #default="{row,$index}">
                   <el-form-item :prop="`amountData.${$index}.origin_amount`" :show-message="false" v-show="!row.invoice_id || row.isEdit"
                   :rules="{required:true,message:()=>{ ElMessage.error(type+'金额不能为空')},trigger:'blur'}">
-                    <label :for="type=='开票'?'invoice':'payment'+$index+'origin_amount'" style="cursor: pointer;" 
+                    <label :for="(type=='开票'?'invoice':'payment')+$index+'origin_amount'" style="cursor: pointer;" 
                     :style="{color:row.origin_amount?'var(--secondaryTextColor)':'var(--hitTextColorOne)'}"
                     v-show="row.amountDomType=='text'" @click="iandPInput(row,'amountDomType')">
                       {{ row.origin_amount ? parseFloat(row.origin_amount).toFixed(2): '单击此处输入金额'}}
                     </label>
-                    <el-input v-model.trim="row.origin_amount" :id="type=='开票'?'invoice':'payment'+$index+'origin_amount'" style="width: 124px;" 
+                    <el-input v-model.trim="row.origin_amount" :id="(type=='开票'?'invoice':'payment')+$index+'origin_amount'" style="width: 124px;" 
                     v-show="row.amountDomType=='input'" @blur="iandPAmountBlur(row)"
                       placeholder="请输入金额" @input="(e)=>moneyChange(e,$index,row)"></el-input>
                   </el-form-item>
@@ -506,39 +585,49 @@
                   <span v-else style="color: var(--hitTextColorOne);">{{type}}金额为空</span>
                 </template>
               </el-table-column>
-              <el-table-column :label="type+'日'" width="120" align="center" prop="invoice_date">
+              <el-table-column :label="type+'日'" width="140" align="center" prop="invoice_date">
                 <template #header>
                   <span style="color: var(--dangerColor);">*</span>{{type}}日
                 </template>
                 <template #default="{row,$index}" >
                   <el-form-item :prop="`amountData.${$index}.invoice_date`" :show-message="false" v-show="!row.invoice_id || row.isEdit"
                   :rules="{required:true,message:()=>{ ElMessage.error(`请选择${type}日`)},trigger:'change'}">       
-                    <el-date-picker v-model="row.invoice_date" style="width: 124px;"
+                    <el-date-picker v-model="row.invoice_date" style="width: 120px;"
                     placeholder="请选择日期" value-format="YYYY-MM-DD" :clearable="false" ></el-date-picker>
                   </el-form-item>
                   <span v-show="row.invoice_id && !row.isEdit">{{ row.invoice_date || '--' }}</span>
                 </template>
               </el-table-column >
-              <el-table-column label="销售" width="120" align="center" prop="seller_id" v-if="type=='开票'">
+              <el-table-column label="销售" width="160" align="center" prop="seller_id">
                 <template #header>
                   <span style="color: var(--dangerColor);">*</span>销售
                 </template>
                 <template #default="{row,$index}">
-                  <el-form-item :prop="`amountData.${$index}.seller_id`" :show-message="false" v-show="!row.invoice_id || row.isEdit"
-                  :rules="{required:true,message:()=>{ ElMessage.error('销售不能为空')},trigger:'change'}">
-                    <el-select v-model="row.seller_id" style="width: 124px;" :ref='`amountData-service_product_id${$index}`'
-                    placeholder="请选择销售" filterable v-if="row.service_product_id==1" @change="(value)=> invoiceSellerChange(row,value)">
+                  <el-form-item :prop="`amountData.${$index}.seller_id`" 
+                  :show-message="false" v-show="!row.invoice_id || row.isEdit"
+                  :rules="[{required:true,message:()=>{ ElMessage.error('销售不能为空')},trigger:'change'},
+                  {validator:(rule,value,callback)=>{
+                    sellerValidator(row,callback)
+                  },trigger:'change'}]">
+                    <!-- <el-select v-model="row.seller_id" :disabled="type=='到款'&& row.hasRelativeSeller" 
+                    style="width: 143px;" 
+                     filterable  >
                       <el-option :label="item.seller_name" :value="item.seller_id" 
                       v-for="item in sellerData.ficc_list" :key="item.seller_id">
                       </el-option>
-                    </el-select>
-                    <el-select v-model="row.seller_id" style="width: 124px;" :ref='`amountData-service_product_id${$index}`'
-                    placeholder="请选择销售" filterable v-else-if="row.service_product_id==2" @change="(value)=> invoiceSellerChange(row,value)">
+                    </el-select> -->
+                    <el-cascader :options="sellerData.all_list" v-model="row.seller_id" v-if="row.service_product_id==1"
+                    :ref='`amountData-service_product_id${$index}`' placeholder="请选择销售" @change="(value)=> sellerChange(row,value)"
+                    :props="{label:'seller_name',value:'seller_id',children:'child',emitPath:false}" 
+                    :show-all-levels="false" filterable class="seller-cascader" :disabled="type=='到款'&& row.hasRelativeSeller"></el-cascader>
+                    <el-select v-model="row.seller_id" style="width: 143px;"
+                    :ref='`amountData-service_product_id${$index}`' :disabled="type=='到款'&& row.hasRelativeSeller"
+                    placeholder="请选择权益销售" filterable  v-else-if="row.service_product_id==2" @change="(value)=> sellerChange(row,value)">
                       <el-option :label="item.seller_name" :value="item.seller_id" 
                       v-for="item in sellerData.rai_list" :key="item.seller_id">
                       </el-option>
                     </el-select>
-                    <el-select v-model="row.seller_id" style="width: 124px;" :ref='`amountData-service_product_id${$index}`'
+                    <el-select v-model="row.seller_id" style="width: 143px;" :ref='`amountData-service_product_id${$index}`'
                     placeholder="请选择销售" v-else
                       @visible-change="selectVisible">
                     </el-select>
@@ -549,10 +638,10 @@
               <el-table-column label="备注" width="160" align="center" prop="remark" show-overflow-tooltip >
                 <template #default="{row,$index}">
                   <el-form-item  v-show="!row.invoice_id || row.isEdit">             
-                    <label :for="'invoice'+$index+'remark'" style="cursor: pointer;" v-show="row.remarkDomType=='text'" 
+                    <label :for="(type=='开票'?'invoice':'payment')+$index+'remark'" style="cursor: pointer;" v-show="row.remarkDomType=='text'" 
                     :style="{color:row.remark?'var(--secondaryTextColor)':'var(--hitTextColorOne)'}"
                     @click="iandPInput(row,'remarkDomType')">{{ row.remark || '单击此处输入备注'}}</label>
-                    <el-input v-model="row.remark" :id="'invoice'+$index+'remark'" style="width: 124px;" placeholder="请输入备注" 
+                    <el-input v-model="row.remark" :id="(type=='开票'?'invoice':'payment')+$index+'remark'" style="width: 124px;" placeholder="请输入备注" 
                     v-show="row.remarkDomType=='input'" @blur="row.remarkDomType='text'"/>
                   </el-form-item>
                   <span v-show="row.invoice_id && !row.isEdit">{{row.remark || '--'}}</span>
@@ -587,7 +676,12 @@
     }
   }
   .el-input__wrapper{
-    width: 100px;
+    width: 120px;
+  }
+  .seller-cascader{
+    .el-input__wrapper{
+      width: 140px;
+    }
   }
   .el-form-item{
     margin-bottom: 0;

+ 2 - 2
src/views/financialManagement/contractProgress.vue

@@ -15,7 +15,7 @@
   const store=useStore()
 
   const operationType=[{op_type:1,label:"合规登记"},{op_type:2,label:"开票登记"},{op_type:3,label:"到款登记"},
-  {op_type:4,label:"修改合同状态"},{op_type:5,label:"删除合同登记"},{op_type:6,label:"合规编辑"},{op_type:7,label:"预到款登记"}]
+  {op_type:4,label:"修改合同状态"},{op_type:5,label:"删除合同登记"},{op_type:6,label:"合规编辑"},{op_type:7,label:"预到款登记"},{op_type:8,label:"预开票登记"}]
 
   // 权限对象,判断是否有 合规登记、开票登记、到款登记权限
   const permissionItem={
@@ -210,7 +210,7 @@
   // complianceId没有,认为是合规登记
   operationtype=contractRegisterId?(route.query.type || 'view'):'compliance'
 
-  // 是否是开票登记或者款登记
+  // 是否是开票登记或者款登记
   const isIOrP = operationtype=='invoice' || operationtype=='placement'
 
   // 处理各个登记模块展开和收起的默认状态 

+ 1 - 8
src/views/financialManagement/invoice/invoiceList.vue

@@ -8,11 +8,6 @@ const data = invoice.data
 
 const sellerArray=ref([])
 
-const sellerChange=(value)=>{
-  data.searchParams.seller_ids = value.join(',')
-  invoice.searchPlacement()
-}
-
 const getSellerListFun=()=>{
   getSellerList().then(res=>{
     sellerArray.value = res.data?.all_list || []
@@ -23,8 +18,6 @@ const getSellerListFun=()=>{
 getSellerListFun()
 invoice.placementList()
 
-
-
 </script>
 
 <template>
@@ -34,7 +27,7 @@ invoice.placementList()
           <el-input v-model="data.searchParams.keyword" placeholder="请输入合同编号/客户名称"
           class="iandP-search-item" clearable @input="invoice.searchPlacement" ></el-input>
           <el-cascader :options="sellerArray" class="iandP-search-item" filterable 
-             @change="sellerChange" placeholder="请选择销售" clearable collapse-tags :show-all-levels="false"
+             @change="invoice.sellerChange" placeholder="请选择销售" clearable collapse-tags :show-all-levels="false"
             :props="{multiple:true,label:'seller_name',value:'seller_id',children:'child',emitPath:false}">
           </el-cascader>
           <el-select v-model="data.searchParams.service_product_id" placeholder="请选择套餐类型" clearable

+ 15 - 1
src/views/financialManagement/placement/placementList.vue

@@ -1,14 +1,23 @@
 <script setup>
-
+import {getSellerList} from '@/api/crm'
 import getCom from '../composition/IandPList'
 import '../style/iandPList.scss'
 
 const placement=getCom(2)
 const data = placement.data
+const sellerArray=ref([])
+
 
 // ---------------method
 
+const getSellerListFun=()=>{
+  getSellerList().then(res=>{
+    sellerArray.value = res.data?.all_list || []
+    // console.log(res);
+  })
+}
 // --------created
+getSellerListFun()
 placement.placementList()
 
 </script>
@@ -19,6 +28,10 @@ placement.placementList()
         <div class="iandP-search-box">
           <el-input v-model="data.searchParams.keyword" placeholder="请输入合同编号/客户名称" class="iandP-search-item"
           clearable @input="placement.searchPlacement" ></el-input>
+          <el-cascader :options="sellerArray" class="iandP-search-item" filterable 
+             @change="placement.sellerChange" placeholder="请选择销售" clearable collapse-tags :show-all-levels="false"
+            :props="{multiple:true,label:'seller_name',value:'seller_id',children:'child',emitPath:false}">
+          </el-cascader>
           <el-select v-model="data.searchParams.service_product_id" placeholder="请选择套餐类型" clearable
           @change="placement.searchPlacement" class="iandP-search-item">
             <el-option v-for="item in placement.serviceTypeArray" :key="item.value"
@@ -76,6 +89,7 @@ placement.placementList()
           <el-table-column label="金额单位" align="center" prop="unit_name"></el-table-column>
           <el-table-column label="换算金额(元)" align="center" prop="amount" show-overflow-tooltip></el-table-column>
           <el-table-column label="到款日" align="center" prop="invoice_time" show-overflow-tooltip></el-table-column>
+          <el-table-column label="销售" align="center" prop="seller_name" ></el-table-column>
           <el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip></el-table-column>
           <!-- <el-table-column label="操作" width="120" align="center">
             <template #default="{row}">

+ 139 - 89
src/views/financialManagement/registrationPre.vue

@@ -2,9 +2,9 @@
 import { Search } from '@element-plus/icons-vue'
 import {useRouter} from 'vue-router'
 import {useStore} from 'vuex'
-import {getSellerList} from '@/api/crm'
+import {getSellerList,getSellerListNoG} from '@/api/crm'
 import {getCurrencyList} from '@/api/common'
-import {getServiceList,getPreRegistrationList,preRegistrationAdd,
+import {getServiceList,getPreRegistrationList,preRegistrationAdd,preRegistrationCheck,
   preRegistrationDetail,preRegistrationEdit,preRegistrationDelete,preRegistrationSave} from '@/api/financialMana'
 import serviceCascader from './composition/serivceCascader.js'
 // 套餐的composition
@@ -24,7 +24,7 @@ const store = useStore()
     total:0,
   })
   // -----------------弹窗
-  const registrationPreForm=ref(null)
+  const registrationPreFormRef=ref(null)
 
   // 新增/编辑 开票/到款 预登记弹窗
   const dialog=reactive({
@@ -48,6 +48,11 @@ const store = useStore()
         }
       ],
     },
+    // 当前编辑的项
+    currentEditPreId:0,
+    // 套餐是否改变
+    hasServiceChange:false,
+
     //选中的套餐ID - 级联选择器绑定值
     selectServices:[],
     validityDate:[]
@@ -143,6 +148,7 @@ const productIdChange=(item)=>{
 }
 // 级联选择器套餐改变
 const servicesChange=(value,type)=>{
+  dialog.hasServiceChange=true
   let cascaderRef = type==1?selectServicesRef.value:selectServicesPreRef.value
   let returnItem=serviceComposition.servicesChange(servicesList.value,value,cascaderRef)
   if(type == 1){
@@ -152,7 +158,7 @@ const servicesChange=(value,type)=>{
     serviceTypePre.value = returnItem.typeValue
     preDialog.preForm.services=preDialog.selectServices=returnItem.backValue
   }
-  console.log(value,returnItem.backValue);
+  // console.log(value,returnItem.backValue);
 }
 
 watch(serviceType,(newVal)=>{
@@ -184,17 +190,25 @@ watch(serviceTypePre,(newVal)=>{
 })
 // -----------------------------------------套餐部分 - 结束
 // -----------------------------------------销售部分 - 开始
-//FICC销售列表
-let sellerInvoiceListF=[]
+//FICC&权益销售列表
+let sellerInvoiceListFandQ=[]
 //权益的销售列表
 let sellerInvoiceListQ=[]
 
 //获取销售列表
 const getSellerListFun=()=>{
-  getSellerList().then(res=>{
-    sellerInvoiceListF = res.data.ficc_list || []
-    sellerInvoiceListQ = res.data.rai_list || []
+  getSellerListNoG().then(res=>{
+    if(!res.data) return 
+    sellerInvoiceListQ = res.data.RaiSeller
+    sellerInvoiceListFandQ=[
+      {seller_id: 2,seller_name: "FICC销售",child:res.data.FiccSeller},
+      {seller_id: 5,seller_name: "权益销售",child:res.data.RaiSeller}
+    ]
   })
+  // getSellerList().then(res=>{
+  //   sellerInvoiceListF = res.data.ficc_list || []
+  //   sellerInvoiceListQ = res.data.rai_list || []
+  // })
 }
 
 let elMessageDom=null
@@ -261,19 +275,24 @@ const deleteRegistrationPreRow=(index,row)=>{
 }
 //编辑预登记
 const editRegistrationPre=(row)=>{
+  dialog.hasServiceChange=false
   preRegistrationDetail({contract_register_id:row.contract_register_id,
-  invoice_type:row.invoice_type}).then(res=>{
+  invoice_type:row.invoice_type,detail_type:1}).then(res=>{
     if(!res.data) return
     dialog.registrationPreForm.contract_register_id = res.data.contract_register_id
     dialog.registrationPreForm.company_name = res.data.company_name
     dialog.registrationPreForm.invoice_type = row.invoice_type
-    dialog.registrationPreForm.IorPInfo=res.data.list
+    // 排序 将编辑入口对应的记录提到第一位
+    dialog.registrationPreForm.IorPInfo=res.data.list.sort((a,b)=>a.pre_register_id == row.pre_register_id?-1:1)
+    dialog.currentEditPreId = row.pre_register_id
+
     dialog.registrationPreForm.services=res.data.services || []
     dialog.validityDate=[res.data.start_date,res.data.end_date]
     dialog.selectServices = [...res.data.services.map(item => item.service_template_id),...res.data.serviceTemplateIds]
     dialog.registrationPreForm.IorPInfo.forEach(item =>{
       // 不能为零,为零会回显
       item.service_product_id=item.service_product_id==0?'':item.service_product_id
+      item.seller_id=item.seller_id==0?'':item.seller_id
     })
     dialog.registrationType=row.invoice_type==3?'开票':'到款'
     dialog.title=`编辑${dialog.registrationType}预登记`
@@ -306,15 +325,19 @@ const dialogClosed=()=>{
   serviceType.value=0
   serviceComposition.resetDisable(servicesList.value)
   setTimeout(()=>{
-    registrationPreForm.value.clearValidate()
+    registrationPreFormRef.value.clearValidate()
   },0)
 }
 
 // 提交
 const submitForm=()=>{
-  registrationPreForm.value.validate((valid)=>{
+  registrationPreFormRef.value.validate(async (valid)=>{
     if(valid){
-      const serviceData=serivcesDataHandler(selectServicesRef.value)
+      let serviceData=[]
+      if(dialog.hasServiceChange){
+        // 套餐改变了,重组数据格式
+        serviceData=serivcesDataHandler(selectServicesRef.value)
+      }
       let params={
         contract_register_id:dialog.registrationPreForm.contract_register_id||0,
         company_name:dialog.registrationPreForm.company_name,
@@ -322,7 +345,7 @@ const submitForm=()=>{
         start_date:dialog.registrationPreForm.start_date,
         end_date:dialog.registrationPreForm.end_date,
         list:dialog.registrationPreForm.IorPInfo,
-        services:serviceData,
+        services:dialog.hasServiceChange?serviceData:dialog.registrationPreForm.services,
         del_invoice_ids:hasDeleteContractInvoiceIds,
         del_pre_register_ids:hasDeletePreRegisterIds
       }
@@ -332,17 +355,50 @@ const submitForm=()=>{
         item.seller_id=item.seller_id||0
         item.service_product_id=item.service_product_id||0
       })
-      console.log(params);
-      let prePlacementProp=preRegistrationAdd
+
+      // console.log(params);
       if(params.contract_register_id){
         // 编辑
-        prePlacementProp=preRegistrationEdit
+        preRegistrationEdit(params).then(res=>{
+          dialog.registrationPreShow=false
+          ElMessage.success(`${dialog.title}成功`)
+          placementPreList()
+        })
+      }else{
+        // 新增
+        // 校验合同信息是否存在
+        let checkRes = await preRegistrationCheck(
+          {company_name:params.company_name,
+            start_date:params.start_date,
+            end_date:params.end_date,
+            services:params.services})
+        if(!checkRes.data) return
+        if(checkRes.data.exist!==0){
+          ElMessageBox.confirm(`合规信息已存在,是否继续${dialog.registrationType}登记?`,
+          '操作提示',
+          {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning',
+          }).then(resp=>{
+            preRegistrationAdd(params).then(res=>{
+              dialog.registrationPreShow=false
+              ElMessage.success(`${dialog.title}成功`)
+              placementPreList()
+            })
+          }).catch((err)=>{
+            if(err=='cancel'){
+              dialog.registrationPreShow=false
+            }
+          })
+        }else{
+          preRegistrationAdd(params).then(res=>{
+            dialog.registrationPreShow=false
+            ElMessage.success(`${dialog.title}成功`)
+            placementPreList()
+          })
+        }
       }
-      prePlacementProp(params).then(res=>{
-        dialog.registrationPreShow=false
-        ElMessage.success(`${dialog.title}成功`)
-        placementPreList()
-      })
     }
   })
 }
@@ -398,7 +454,7 @@ watch(()=>preDialog.validityDate,(newVal)=>{
 const preIorP=(row)=>{
   preRegistrationDetail({contract_register_id:row.contract_register_id,
   invoice_type:row.invoice_type==3?4:3,pre_register_id:row.pre_register_id,arrive_id:row.arrive_id,
-  invoice_id:row.invoice_id}).then(res=>{
+  invoice_id:row.invoice_id,detail_type:2}).then(res=>{
     if(!res.data) return
     preDialog.preForm.contract_register_id = res.data.contract_register_id
     preDialog.preForm.company_name = res.data.company_name
@@ -406,10 +462,15 @@ const preIorP=(row)=>{
     preDialog.preForm.service_product_id=row.service_product_id==0?'':row.service_product_id
     preDialog.preForm.pre_register_id = row.pre_register_id || 0
     preDialog.preForm.currency_unit=row.currency_unit
+    // 从列表取销售
+    preDialog.preForm.seller_id=preDialog.preForm.invoice_type==3?row.payment_seller_id || '' : row.seller_id || ''
+
     if(res.data.list.length>0){
       preDialog.preForm.contract_invoice_id = res.data.list[0].contract_invoice_id || 0
       preDialog.preForm.amount=res.data.list[0].amount
-      preDialog.preForm.seller_id=res.data.list[0].seller_id
+      if(res.data.list[0].seller_id!=0){
+        preDialog.preForm.seller_id=res.data.list[0].seller_id
+      }
       preDialog.preForm.invoice_type=res.data.list[0].invoice_type
       preDialog.preForm.register_date=res.data.list[0].register_date
       preDialog.preForm.remark=res.data.list[0].remark
@@ -421,24 +482,8 @@ const preIorP=(row)=>{
     preDialog.show=true
     
     nextTick(()=>{
-      if(preDialog.title=='预开票'){
-        // 预开票需要回显套餐信息
-        serviceTypePre.value=serviceComposition.servicesChange(servicesList.value,preDialog.selectServices,selectServicesPreRef.value).typeValue
-      }else{
-        // 预到款不用回显套餐信息
-        let checkedNodes=selectServicesPreRef.value.getCheckedNodes()
-
-        // 套餐类型
-        let hasFICCService = checkedNodes.some(Node => Node.data.product_id == 1)
-        let hasQYService = checkedNodes.some(Node => Node.data.product_id == 2)
-        if(hasFICCService&&hasQYService){
-          serviceTypePre.value=3
-        }else if(hasFICCService){
-          serviceTypePre.value=1
-        }else{
-          serviceTypePre.value=2
-        }
-      }
+      // 回显套餐信息
+      serviceTypePre.value=serviceComposition.servicesChange(servicesList.value,preDialog.selectServices,selectServicesPreRef.value).typeValue
     })
   })
 }
@@ -446,19 +491,11 @@ const preIorP=(row)=>{
 const submitPreForm=()=>{
     preFormRef.value.validate((valid)=>{
     if(valid){
-      let serviceData;
-      if(preDialog.title=='预开票'){
-        // 预开票可能会修改套餐,需要重组套餐数据
-        serviceData=serivcesDataHandler(selectServicesPreRef.value)
-      }else{
-        // 预到款不需要重组套餐数据
-        serviceData=preDialog.preForm.services
-      }
       preDialog.preForm.amount = parseFloat(preDialog.preForm.amount)
       let params={
         contract_register_id:preDialog.preForm.contract_register_id,
         company_name:preDialog.preForm.company_name,
-        register_type:preDialog.preForm.invoice_type,
+        register_type:preDialog.title=='预到款'?4:3,
         start_date:preDialog.preForm.start_date,
         end_date:preDialog.preForm.end_date,
         list:[{
@@ -471,9 +508,9 @@ const submitPreForm=()=>{
           seller_id:preDialog.preForm.seller_id||0,
           service_product_id:preDialog.preForm.service_product_id,
         }],
-        services:serviceData
+        services:preDialog.preForm.services
       }
-      console.log(params);
+      // console.log(params);
       preRegistrationSave(params).then(res=>{
         preDialog.show=false
         ElMessage.success(`${preDialog.title}成功`)
@@ -619,15 +656,12 @@ placementPreList()
           </template>
         </el-table-column>
         <el-table-column label="套餐" prop="services" show-overflow-tooltip></el-table-column>
-        <el-table-column label="开票日" prop="invoice_time" width="110">
-        </el-table-column>
-        <el-table-column label="开票金额" prop="origin_amount" width="120">
-        </el-table-column>
+        <el-table-column label="开票日" prop="invoice_time" width="110"></el-table-column>
+        <el-table-column label="开票金额" prop="origin_amount" width="120"></el-table-column>
         <el-table-column label="开票销售" width="100" prop="seller_name"></el-table-column>
-        <el-table-column label="到款日" prop="arrive_time" width="110">
-        </el-table-column>
-        <el-table-column label="到款金额" prop="arrive_origin_amount" width="120">
-        </el-table-column>
+        <el-table-column label="到款日" prop="arrive_time" width="110"></el-table-column>
+        <el-table-column label="到款金额" prop="arrive_origin_amount" width="120"></el-table-column>
+        <el-table-column label="到款销售" width="100" prop="payment_seller_name"></el-table-column>
         <el-table-column label="操作" fixed="right" min-width="100">
           <template #default="{row}">
             <div class="table-options" style="padding-right: 20px;">
@@ -699,14 +733,14 @@ placementPreList()
     <el-dialog v-model="dialog.registrationPreShow" :title="dialog.title" top="5vh"
      width="942px" @closed="dialogClosed"
      :close-on-click-modal="false">
-      <el-form :model="dialog.registrationPreForm" inline ref="registrationPreForm" style="margin:0 10px;"> 
+      <el-form :model="dialog.registrationPreForm" inline ref="registrationPreFormRef" style="margin:0 10px;"> 
         <el-form-item label="客户名称" prop="company_name" label-width="90" style="margin-right: 30px;"
         :rules="{required:true,message:'客户名称不能为空',trigger:'blur'}"> 
           <el-input v-model="dialog.registrationPreForm.company_name"
           placeholder="请输入客户名称" style="width:320px" />
         </el-form-item>
         <el-form-item label="约定有效期" prop="end_date" label-width="102" style="margin-right: 20px;"
-        :rules="dialog.registrationType=='开票'?{required:true,message:'约定有效期不能为空',trigger:'change'}:{required:false}">
+        :rules="{required:true,message:'约定有效期不能为空',trigger:'change'}">
           <el-date-picker type="daterange" 
             v-model="dialog.validityDate" style="max-width: 320px;"
             start-placeholder="开始日期" end-placeholder="结束日期" value-format="YYYY-MM-DD"
@@ -714,7 +748,7 @@ placementPreList()
             </el-date-picker>
         </el-form-item>
         <el-form-item label="套餐" prop="services" label-width="90" style="margin-right: 20px;"
-        :rules="dialog.registrationType=='开票'?{required:true,message:'套餐不能为空',trigger:'change'}:{required:false}">
+        :rules="{required:true,message:'套餐不能为空',trigger:'change'}">
           <el-cascader filterable :options="servicesList" placeholder="请选择套餐" @change="(value)=>servicesChange(value,1)"
             :show-all-levels="true" v-model="dialog.selectServices" :clearable="false" ref="selectServicesRef"
             :props="{multiple:true,label:'title',value:'service_template_id',emitPath:false}" collapse-tags collapse-tags-tooltip
@@ -722,10 +756,13 @@ placementPreList()
           </el-cascader>
         </el-form-item>
         <el-scrollbar max-height="470px" noresize style="margin: 0 -10px;padding: 0 10px;" >
-          <div class="invoice-payment-row" v-for="(item,index) in dialog.registrationPreForm.IorPInfo" :key="index">
+          <div class="invoice-payment-row" 
+          :style="{backgroundColor:dialog.currentEditPreId==item.pre_register_id?'#FBF9F4':'#F5F7FA',
+                  border:dialog.currentEditPreId==item.pre_register_id?'1px solid #E9DDA2':'none'}"
+          v-for="(item,index) in dialog.registrationPreForm.IorPInfo" :key="index">
             <el-form-item label="套餐类型" :prop="`IorPInfo.${index}.service_product_id`" v-if="serviceType==3"
             label-width="90" style="margin-right: 20px;"
-            :rules="dialog.registrationType=='开票'?{required:true,message:'套餐类型不能为空',trigger:'change'}:{required:false}">
+            :rules="{required:true,message:'套餐类型不能为空',trigger:'change'}">
               <el-select v-model="item.service_product_id" style="width: 176px;" @change="productIdChange(item)"
               placeholder="请选择套餐">
                 <el-option label="FICC套餐" :value="1"></el-option>
@@ -749,28 +786,33 @@ placementPreList()
                 :placeholder="`请选择${dialog.registrationType}日`" value-format="YYYY-MM-DD" :clearable="false">
               </el-date-picker>
             </el-form-item>
-            <el-form-item label="开票销售" :prop="`IorPInfo.${index}.seller_id`" label-width="90" style="margin-right: 0;"
-            :rules="{required:true,message:'销售不能为空',trigger:'change'}" v-if="dialog.registrationType=='开票'">
-              <el-select v-model="item.seller_id" style="width: 176px;"
+            <el-form-item :label="dialog.registrationType+'销售'" :prop="`IorPInfo.${index}.seller_id`" label-width="90" style="margin-right: 0;"
+            :rules="{required:true,message:'销售不能为空',trigger:'change'}">
+              <!-- <el-select v-model="item.seller_id" style="width: 176px;"
               placeholder="请选择销售" filterable v-if="item.service_product_id==1">
                 <el-option :label="seller.seller_name" :value="seller.seller_id" 
                 v-for="seller in sellerInvoiceListF" :key="seller.seller_id">
                 </el-option>
-              </el-select>
-              <el-select v-model="item.seller_id" style="width: 176px;"
-              placeholder="请选择销售" filterable v-else-if="item.service_product_id==2">
+              </el-select> -->
+              <el-cascader :options="sellerInvoiceListFandQ" :disabled="dialog.registrationType=='到款' && item.contract_invoice_id" 
+              v-model="item.seller_id" v-if="item.service_product_id==1"
+               placeholder="请选择销售" :props="{label:'seller_name',value:'seller_id',children:'child',emitPath:false}" 
+              :show-all-levels="false" filterable style="max-width: 176px;"></el-cascader>
+              <el-select v-model="item.seller_id" style="width: 176px;" 
+              :disabled="dialog.registrationType=='到款' && item.contract_invoice_id"
+              placeholder="请选择权益销售" filterable v-else-if="item.service_product_id==2">
                 <el-option :label="seller.seller_name" :value="seller.seller_id" 
                 v-for="seller in sellerInvoiceListQ" :key="seller.seller_id">
                 </el-option>
               </el-select>
               <el-select v-model="item.seller_id" style="width: 176px;" 
-              placeholder="请选择销售" v-else
+              placeholder="请选择销售" :disabled="dialog.registrationType=='到款' && item.contract_invoice_id" v-else
                 @visible-change="selectVisible">
               </el-select>
             </el-form-item>
             <el-form-item label="备注" :prop="`IorPInfo.${index}.remark`" label-width="90" 
-            style="margin-right: 0;" :style="{marginLeft:serviceType==3 && dialog.registrationType=='开票'?'20px':'0'}"> 
-              <el-input v-model="item.remark" placeholder="请输入备注" :style="{width:serviceType==3&&dialog.registrationType=='开票'?'486px':'772px'}" />
+            style="margin-right: 0;" :style="{marginLeft:serviceType==3 ?'20px':'0'}"> 
+              <el-input v-model="item.remark" placeholder="请输入备注" :style="{width:serviceType==3?'486px':'772px'}" />
             </el-form-item>
             <el-icon color="#D0D2D5" class="deleteIcon" size="16px" @click="deleteRegistrationPreRow(index,item)"
             v-show="dialog.registrationPreForm.IorPInfo.length>1"><CircleCloseFilled /></el-icon>
@@ -792,27 +834,31 @@ placementPreList()
     </el-dialog>
     <!--预开票/到款 弹窗 -->
     <el-dialog v-model="preDialog.show" :title="preDialog.title"
-     width="450px" @closed="preDialogClosed"
+     width="500px" @closed="preDialogClosed"
      :close-on-click-modal="false">
       <el-form :model="preDialog.preForm" :rules="preDialog.rules" id="preFormRef"
-      ref="preFormRef" style="margin-left:10px;" label-width="101px"> 
-        <el-form-item label="约定有效期" prop="end_date" v-if="preDialog.title=='预开票'">
-          <el-date-picker type="daterange" key="pre"
+      ref="preFormRef" style="margin-left:37px;" label-width="101px"> 
+        <el-form-item label="客户名称" prop="company_name"> 
+          <el-input v-model="preDialog.preForm.company_name"
+          placeholder="请输入客户名称" style="width:286px" disabled/>
+        </el-form-item>
+        <el-form-item label="约定有效期" prop="end_date">
+          <el-date-picker type="daterange" key="pre" disabled
             v-model="preDialog.validityDate" style="max-width: 286px;"
             start-placeholder="开始日期" end-placeholder="结束日期" value-format="YYYY-MM-DD"
             :clearable="false">
             </el-date-picker>
         </el-form-item>
-        <el-form-item label="套餐" prop="services" v-show="preDialog.title=='预开票'">
+        <el-form-item label="套餐" prop="services">
           <el-cascader filterable :options="servicesList" placeholder="请选择套餐" 
-          @change="(value)=>servicesChange(value,2)"
+          @change="(value)=>servicesChange(value,2)" disabled
             :show-all-levels="true" v-model="preDialog.selectServices" :clearable="false" ref="selectServicesPreRef"
             :props="{multiple:true,label:'title',value:'service_template_id',emitPath:false}" collapse-tags collapse-tags-tooltip
             key="preSeriveces" style="min-width: 286px;z-index: 100;">
           </el-cascader>
         </el-form-item>
         <el-form-item label="套餐类型" prop="service_product_id" v-if="serviceTypePre==3" 
-        :rules="preDialog.title=='预开票'?{required:true,message:'套餐类型不能为空',trigger:'change'}:{required:false}">
+        :rules="{required:true,message:'套餐类型不能为空',trigger:'change'}">
           <el-select v-model="preDialog.preForm.service_product_id"
           style="width: 286px;" @change="productIdChange(preDialog.preForm)"
           placeholder="请选择套餐">
@@ -828,14 +874,18 @@ placementPreList()
             </el-option>
           </el-select>
         </el-form-item>
-        <el-form-item label="开票销售" prop="seller_id" v-if="preDialog.title=='预开票'">
-          <el-select v-model="preDialog.preForm.seller_id" style="width: 286px;"
+        <el-form-item :label="preDialog.title=='预开票'?'开票销售':'到款销售'" prop="seller_id">
+          <!-- <el-select v-model="preDialog.preForm.seller_id" style="width: 286px;"
           placeholder="请选择销售" filterable v-if="preDialog.preForm.service_product_id==1">
             <el-option :label="seller.seller_name" :value="seller.seller_id" 
             v-for="seller in sellerInvoiceListF" :key="seller.seller_id">
             </el-option>
-          </el-select>
-          <el-select v-model="preDialog.preForm.seller_id" style="width: 286px;"
+          </el-select> -->
+          <el-cascader :options="sellerInvoiceListFandQ" v-model="preDialog.preForm.seller_id" 
+          v-if="preDialog.preForm.service_product_id==1" placeholder="请选择销售" 
+          :props="{label:'seller_name',value:'seller_id',children:'child',emitPath:false}" 
+          :show-all-levels="false" filterable style="min-width: 286px;" :disabled="preDialog.title=='预到款'"></el-cascader>
+          <el-select v-model="preDialog.preForm.seller_id" style="width: 286px;" :disabled="preDialog.title=='预到款'"
           placeholder="请选择销售" filterable v-else-if="preDialog.preForm.service_product_id==2">
             <el-option :label="seller.seller_name" :value="seller.seller_id" 
             v-for="seller in sellerInvoiceListQ" :key="seller.seller_id">
@@ -886,8 +936,8 @@ placementPreList()
       margin-top: 20px;
     }
     .invoice-payment-row{
-      padding: 20px 10px 0;
-      background-color: #FBF9F4;
+      padding: 20px 8px 0;
+      // background-color: #F5F7FA;
       margin-bottom: 20px;
       position: relative;
       &:last-child{

+ 1 - 1
src/views/financialManagement/style/contractRegistration.scss

@@ -82,7 +82,7 @@
   }
   // 开票信息
   .info-row-invoice-payment{
-    padding-left: 80px;
+    padding-left: 50px;
     display: flex;
     flex-direction: column;
     align-items: flex-start;

+ 148 - 81
src/views/financialStatistics/commodityPayment.vue

@@ -5,6 +5,9 @@ import {getInvoicePaymentList,updatePayType,setServiceAmount} from '@/api/financ
 import {getSellerGroupList,getSellerList} from '@/api/crm'
 import {getSimpleServiceList} from '@/api/financialMana'
 import {downloadByFlow} from '@/utils/common-methods'
+import elementResizeDetectorMaker from 'element-resize-detector';
+// 监听dom
+const erd = elementResizeDetectorMaker(); 
 
 const moment = inject('$moment')
   const timeTypeData=[{label:'开票日期',value:1},{label:'到款日期',value:2},{label:'开票日期&到款日期',value:3}]
@@ -50,6 +53,7 @@ const moment = inject('$moment')
   const commodityPData=reactive({
     tableData:[],
     total:25,
+    amountTotal:0,
     invoiceAmountTotal:0,
     invoiceAmountList:[],
     placementAmountTotal:0,
@@ -60,6 +64,8 @@ const moment = inject('$moment')
 
   // 到款金额是否收起
   let placementIsFold=ref(true)
+  // 业务收入金额是否收起
+  let isIncomeFold=ref(true)
 
   // method
 
@@ -76,6 +82,7 @@ const moment = inject('$moment')
       commodityPData.tableData=[]
       let tempData = res.data.list.data_list || []
       commodityPData.total = res.data.page.total
+      commodityPData.amountTotal=res.data.list.amount_total
       commodityPData.invoiceAmountTotal=res.data.list.invoice_total
       commodityPData.invoiceAmountList = res.data.list.invoice_currency_total || []
       commodityPData.placementAmountTotal=res.data.list.payment_total
@@ -89,6 +96,9 @@ const moment = inject('$moment')
           })
         })
       })
+      // if(!(res.data.list.invoice_currency_total||res.data.list.payment_currency_total)){
+        foldOrUnfold(true)
+      // }
       // console.log(commodityPData.tableData);
     })
   }
@@ -127,9 +137,9 @@ const moment = inject('$moment')
     commodityPList()
   }
 
-  const dataExport=({value,text})=>{
+  const dataExport=(value)=>{
     getInvoicePaymentList({...searchParams,is_export:1,list_param:value}).then(res=>{
-      downloadByFlow(res,'xlsx',`商品到款统计列表-`+text)
+      downloadByFlow(res,'xlsx','商品到款统计表')
     })
   }
 
@@ -142,16 +152,17 @@ const moment = inject('$moment')
     return ''
   }
   // 开票到款金额展开收起
-  const foldOrUnfold=(type)=>{
-    if(!(commodityPData.tableData?.length>0)){
+  const foldOrUnfold=(flag)=>{
+    if(commodityPData.tableData?.length==0 && !flag){
       return 
     }
+    isIncomeFold.value = flag||flag+''=="false"?flag:!isIncomeFold.value
     // type: 0-开票  1-到款
-    if(type){
-      placementIsFold.value = !placementIsFold.value
-    }else{
-      invoiceIsFold.value = !invoiceIsFold.value
-    }
+    // if(type){
+    //   placementIsFold.value = !placementIsFold.value
+    // }else{
+    //   invoiceIsFold.value = !invoiceIsFold.value
+    // }
     // console.log(type,invoiceIsFold.value);
   }
   // --------------------------销售选择
@@ -257,7 +268,7 @@ const moment = inject('$moment')
   }
 
   const setServiceInfoSubmit=()=>{
-    console.log(setServiceInfoDia.dataForm);
+    // console.log(setServiceInfoDia.dataForm);
     let totalAmout=0
     setServiceInfoDia.dataForm.list.map(item =>{
       totalAmout= Math.round(item.amount*100 + totalAmout*100)/100
@@ -276,39 +287,59 @@ const moment = inject('$moment')
   // --------------------------------设置套餐信息
   //  -----------------------------------------------------弹窗
 
-  
+  const operationZone=ref(null)
+  const isShowItemWarp=ref(false)
+
+  const amountItemBody=ref(null)
+  const amountItemBodyHeight=ref(0)
+  // 监听
+  onMounted(()=>{
+    erd.listenTo(operationZone.value,(element)=>{
+      isShowItemWarp.value=element.clientWidth>1606?false:true
+    });
+
+    erd.listenTo(amountItemBody.value,(element)=>{
+      amountItemBodyHeight.value = element.clientHeight
+    });
+  })
+
+  onBeforeUnmount(()=>{
+    erd.uninstall(operationZone.value)
+    erd.uninstall(amountItemBody.value)
+  })
   // created
   // getSellerGroupListFun()
   getServiceListFun()
   commodityPList()
   getSellerListFun()
 
+
 </script>
 
 <template>
     <div id="commodity-payment-container" class="commodity-payment-container">
       <div class="search-zone">
         <el-input v-model="searchParams.keyword" placeholder="请输入客户名称" clearable class="search-item"
-        @input="searchCommodityP" :prefix-icon="Search" style="width: 240px;" ></el-input>
+        @input="searchCommodityP" :prefix-icon="Search" style="width: 232px;" ></el-input>
         <!-- <el-select v-model="searchParams.sell_group_id" placeholder="请选择销售组别" clearable style="width: 240px;margin: 0 30px 10px 0;"
         @change="searchCommodityP">
           <el-option :label="item.group_name" :value="item.group_id" v-for="item in groupList"></el-option>
         </el-select> -->
-        <el-cascader :options="sellerArray"  filterable style="width: 200px;margin: 0 0 8px 30px;"
+        <el-cascader :options="sellerArray"  filterable style="width: 232px;margin: 0 0 8px 30px;"
           @change="sellerChange" placeholder="请选择销售" clearable collapse-tags :show-all-levels="false"
           :props="{multiple:true,label:'seller_name',value:'seller_id',children:'child',emitPath:false}" key="seller" >
         </el-cascader>
-        <el-cascader :options="serviceList" style="width: 200px;margin: 0 0 8px 30px;" filterable 
+        <el-cascader :options="serviceList" style="width: 232px;margin: 0 0 8px 30px;" filterable 
           @change="serviceChange" placeholder="请选择套餐信息" clearable collapse-tags :show-all-levels="false"
           :props="{multiple:true,label:'title',value:'service_template_id',children:'children',emitPath:false}"
           collapse-tags-tooltip key="serivce" >
         </el-cascader>
-        <!-- <el-select v-model="searchParams.service_type" placeholder="请选择套餐信息" clearable style="width: 240px;margin: 0 30px 10px 0;"
+        <!-- <el-select v-model="searchParams.service_type" placeholder="请选择套餐信息" clearable style="width: 232px;margin: 0 30px 10px 0;"
         @change="searchCommodityP">
           <el-option :label="item.title" :value="item.service_template_id" v-for="item in serviceList"></el-option>
         </el-select> -->
         <div class="date-box">
-          <el-date-picker v-model="searchDate" type="daterange" @change="currentDateTab=0" style="max-width: 240px;margin-right: 20px;"
+          <el-date-picker v-model="searchDate" type="daterange" @change="currentDateTab=0" style="max-width: 232px;margin-right: 30px;"
             value-format="YYYY-MM-DD" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
           <div class="composition-button-tabs">
             <el-button size="large" v-for="(item,index) in dateButtonData" :key="item.tabId"
@@ -317,7 +348,7 @@ const moment = inject('$moment')
             @click="changeDateType(item)">{{ item.text }}</el-button>
           </div>
           <el-select v-model="searchParams.time_type" placeholder="请选择日期类型" @change="searchCommodityP"
-          style="width: 200px;" clearable>
+          style="width: 232px;" clearable>
             <el-option :label="item.label" :value="item.value" v-for="item in timeTypeData" :key="item.value"></el-option>
           </el-select>
         </div>
@@ -332,57 +363,65 @@ const moment = inject('$moment')
           <el-option label="已到款" :value="1"></el-option>
         </el-select>
       </div>
-      <div class="operation-zone">
+      <div class="operation-zone" ref="operationZone">
         <div class="amount-show-zone">
           <div class="amount-show-item">
-            <div class="amount-item-head" @click="foldOrUnfold(0)" 
-            :style="{cursor:commodityPData.tableData?.length>0?'pointer':'',padding:invoiceIsFold?'8px 20px 8px 20px':'20px'}">
+            <div class="amount-item-head" @click="foldOrUnfold()" 
+            :style="{cursor:commodityPData.tableData?.length>0?'pointer':''}">
               <div class="amount-item-head-title" >
-                已开票合计金额(换算后):{{ commodityPData.invoiceAmountTotal }}(CNY)
+                <el-tooltip placement="top">
+                  <div class="amount-item-title-icon">
+                    业务收入金额<el-icon color="white" size="16" style="margin: 0 4px;"><svg-Icon name="svgIcon-financial-info"></svg-Icon></el-icon> :
+                  </div>
+                  <template #content>
+                    <div style="text-align: center;">
+                      当前销售和日期筛选条件下所有已开票金额(包括已开票已到款
+                      <br />
+                      和已开票未到款)和已到款金额(未开票已到款)的总和
+                    </div>
+                  </template>
+                </el-tooltip>
+                {{ commodityPData.amountTotal }}(元)
               </div>
               <div class="fold-expand-row" v-show="commodityPData.tableData?.length>0">
                 <span class="amount-item-head-icon">
-                {{ invoiceIsFold?'展开':'收起' }}
+                {{ isIncomeFold?'展开':'收起' }}
                 </span>
-                <el-icon color="var(--themeColor)" :style="!invoiceIsFold && 'transform: rotate(180deg)'">
+                <el-icon color="var(--themeColor)" :style="!isIncomeFold && 'transform: rotate(180deg)'">
                   <svg-Icon name="svgIcon-common-arrow_down"></svg-Icon>
                 </el-icon>
               </div>
             </div>
-            <div class="amount-item-body-package" :style="{height:invoiceIsFold?'0':'66px'}">
-              <div class="amount-item-body">
-                <div class="amount-item-body-box" v-for="item in commodityPData.invoiceAmountList" :key="item.code">
-                  <img :src="item.flag_img" style="height: 40px;width: 40px;margin-right: 20px;" />
-                  <div class="amount-item-body-info">
-                    <span>{{ item.name }}({{ item.code }})</span>
-                    <span>{{ item.amount }}</span>
+            <div class="amount-item-body-package" 
+            :style="{width:isShowItemWarp?'715px':'1445px',height:isIncomeFold?'0':amountItemBodyHeight+'px'}">
+              <div class="amount-item-body"  ref="amountItemBody">
+                <div class="amount-body-box">
+                  <div class="amount-body-box-title">
+                    已开票合计金额(换算后):{{ commodityPData.invoiceAmountTotal }}(CNY)
+                  </div>
+                  <div class="amount-body-box-content">
+                    <div class="amount-item-body-box" v-for="item in commodityPData.invoiceAmountList" :key="item.code">
+                      <img :src="item.flag_img" style="height: 40px;width: 40px;margin-right: 20px;" />
+                      <div class="amount-item-body-info">
+                        <span>{{ item.name }}({{ item.code }})</span>
+                        <span>{{ item.amount }}</span>
+                      </div>
+                    </div>
                   </div>
                 </div>
-              </div>
-            </div>
-          </div>
-          <div class="amount-show-item">
-            <div class="amount-item-head" @click="foldOrUnfold(1)" 
-            :style="{cursor:commodityPData.tableData?.length>0?'pointer':'',padding:placementIsFold?'8px 20px 8px 20px':'20px'}">
-              <div class="amount-item-head-title" >
-                已到款合计金额(换算后):{{ commodityPData.placementAmountTotal }}(CNY)
-              </div>
-              <div class="fold-expand-row" v-show="commodityPData.tableData?.length>0">
-                <span class="amount-item-head-icon">
-                {{ placementIsFold?'展开':'收起' }}
-                </span>
-                <el-icon color="var(--themeColor)" :style="!placementIsFold && 'transform: rotate(180deg)'">
-                  <svg-Icon name="svgIcon-common-arrow_down"></svg-Icon>
-                </el-icon>
-              </div>
-            </div>
-            <div class="amount-item-body-package" :style="{height:placementIsFold?'0':'66px'}"> 
-              <div class="amount-item-body">
-                <div class="amount-item-body-box" v-for="item in commodityPData.placementAmountList" :key="item.code">
-                  <img :src="item.flag_img" style="height: 40px;width: 40px;margin-right: 20px;" />
-                  <div class="amount-item-body-info">
-                    <span>{{ item.name }}({{ item.code }})</span>
-                    <span>{{ item.amount }}</span>
+                <div class="amount-body-box-split" v-show="!isShowItemWarp"></div>
+                <div class="amount-body-box">
+                  <div class="amount-body-box-title">
+                    已到款合计金额(换算后):{{ commodityPData.placementAmountTotal }}(CNY)
+                  </div>
+                  <div class="amount-body-box-content">
+                    <div class="amount-item-body-box" v-for="item in commodityPData.placementAmountList" :key="item.code">
+                      <img :src="item.flag_img" style="height: 40px;width: 40px;margin-right: 20px;" />
+                      <div class="amount-item-body-info">
+                        <span>{{ item.name }}({{ item.code }})</span>
+                        <span>{{ item.amount }}</span>
+                      </div>
+                    </div>
                   </div>
                 </div>
               </div>
@@ -393,9 +432,9 @@ const moment = inject('$moment')
           <el-button style="margin-bottom: 10px;" size="large" class="element-common-button">导出</el-button>
           <template #dropdown>
             <el-dropdown-menu>
-              <el-dropdown-item :command="{value:0,text:'FICC&权益'}">FICC&权益</el-dropdown-item>
-              <el-dropdown-item :command="{value:1,text:'FICC'}">FICC</el-dropdown-item>
-              <el-dropdown-item :command="{value:2,text:'权益'}">权益</el-dropdown-item>
+              <el-dropdown-item :command="0">FICC&权益</el-dropdown-item>
+              <el-dropdown-item :command="1">FICC</el-dropdown-item>
+              <el-dropdown-item :command="2">权益</el-dropdown-item>
             </el-dropdown-menu>
           </template>
         </el-dropdown>
@@ -515,7 +554,7 @@ const moment = inject('$moment')
       align-items: center;
       flex-wrap: wrap;
       .search-item{
-        width: 200px;
+        width: 232px;
         margin: 0 0 8px 30px;
       }
       .date-box{
@@ -523,8 +562,8 @@ const moment = inject('$moment')
         align-items: center;
         margin: 0 0 8px 30px;
         .composition-button-tabs{
-          margin-right: 20px;
-
+          margin-right: 30px;
+          white-space: nowrap;
           .date-button{
             height: 40px;
             color: $hitTextColorTwo;
@@ -573,21 +612,27 @@ const moment = inject('$moment')
           box-shadow: 0px 4px 12px rgba(153, 153, 153, 0.08);
           border-radius: 8px;
           // height: 132px;
-          width: 725px;
+          // width: 725px;
           margin-right: 30px;
           box-sizing: border-box;
           // padding-bottom: 16px;
           .amount-item-head{
-            // padding: 20px 20px 20px 20px;
+            padding: 20px 0;
+            margin: 0 20px;
             transition: all 0.1s ease;
             display: flex;
             align-items: center;
             justify-content: space-between;
-            // cursor: pointer;
             .amount-item-head-title{
               font-weight: 600;
               font-size: 18px;
               color: #000000;
+              display: flex;
+              align-items: center;
+              .amount-item-title-icon{
+                display: flex;
+                align-items: center;
+              }
             }
             .fold-expand-row{
               display: flex;
@@ -605,32 +650,54 @@ const moment = inject('$moment')
             overflow: hidden;
             transition: height 0.1s ease;
             .amount-item-body{
-              padding: 6px 20px 16px;
+              box-sizing: border-box;
+              border-top: solid 1px #DCDFE6;
+              margin: 0 20px;
               box-sizing: border-box;
               display: flex;
               align-items: center;
-              justify-content: space-between;
-              .amount-item-body-box{
-                display: flex;
-                align-items: center;
-                width: 220px;
-                .amount-item-body-info{
+              flex-wrap: wrap;
+              .amount-body-box{
+                margin: 20px 0;
+                .amount-body-box-title{
+                  font-weight: 600;
+                  font-size: 16px;
+                  color: #000000;
+                }
+                .amount-body-box-content{
                   display: flex;
-                  flex-direction: column;
+                  align-items: center;
                   justify-content: space-between;
-                  span{
-                    font-weight: 400;
-                    font-size: 14px;
-                    color: $secondaryTextColor;
-                    margin-bottom: 2px;
-                    &:last-child{
-                      font-weight: 700;
-                      font-size: 16px;
-                      color: $mainTextColor;
+                  margin-top: 28px;
+                  .amount-item-body-box{
+                    display: flex;
+                    align-items: center;
+                    width: 225px;
+                    .amount-item-body-info{
+                      display: flex;
+                      flex-direction: column;
+                      justify-content: space-between;
+                      span{
+                        font-weight: 400;
+                        font-size: 14px;
+                        color: $secondaryTextColor;
+                        margin-bottom: 2px;
+                        &:last-child{
+                          font-weight: 700;
+                          font-size: 16px;
+                          color: $mainTextColor;
+                        }
+                      }
                     }
                   }
                 }
               }
+              .amount-body-box-split{
+                width: 1px;
+                height: 92px;
+                background-color: #DCDFE6;
+                margin-right: 52px;
+              }
             }
           }
         }