Ver Fonte

代码优化、新增内容

hbchen há 2 anos atrás
pai
commit
11eabad3a0

+ 1 - 0
README.md

@@ -62,6 +62,7 @@
       + 使用css修改颜色:需要将需要修改颜色的标签的fill属性的值设为'currentColor' ,方可通过css修改颜色。
       + 两种方式可以混用。
     3. **import ids from 'virtual:svg-icons-names'** 可以获取所有图标的symbolId,即为svgIcon的name属性,返回值为一个数组。
+### 提示:开发之前可以瞅一眼 组件封装和工具函数的文件夹 看是否有你需要的东西,能省点事就省点事嘛.
 
 
 

+ 1 - 0
src/components/SvgIcon/index.vue

@@ -1,3 +1,4 @@
+<!-- svg图标组件 -->
 <script setup>
 import { computed } from 'vue'
 const props = defineProps({

+ 1 - 0
src/components/mPage.vue

@@ -1,3 +1,4 @@
+<!-- 分液器 -->
 <script setup>
   const props=defineProps({
     page_no:{

+ 1 - 0
src/directives/modules/buttonPermisson.js

@@ -1,3 +1,4 @@
+// 权限指令
 import store from "@/store"
 
 export const permission={

+ 1 - 0
src/directives/modules/select-scroll.js

@@ -1,3 +1,4 @@
+// el-select标签 滚动指令
 import {debounce} from 'lodash/function'
 
 export const optionsLoadMore={

+ 0 - 1
src/utils/common-methods.js

@@ -4,7 +4,6 @@
  * @param {Blob} data 流数据
  * @param {String} type 下载的文件类型
  * @param {String} fileName 下载的文件名
- * @return null
  */
 export function downloadByFlow(data,type,fileName) {
   let fileTypeMime ='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'

+ 77 - 97
src/views/financialManagement/contractProgress.vue

@@ -16,6 +16,13 @@
   const invoiceFormRef=ref(null)
   // 到款记录表单
   const placementFormRef=ref(null)
+
+  const contractSourceArray=['非CRM合同导入','CRM合同导入']
+  const contractStatusArray=[{id:1,label:"已审批"},{id:2,label:"单章寄回"},{id:3,label:"已签回"}]
+  const contractTypeArray=[{id:1,label:"新签"},{id:2,label:"续约"}]
+  const operationType=[{op_type:1,label:"合规登记"},{op_type:2,label:"开票登记"},{op_type:3,label:"到款登记"},
+  {op_type:4,label:"修改合同状态"},{op_type:5,label:"删除合同登记"}]
+
   // 合同信息
   const contractInfo=reactive({
     /*
@@ -134,22 +141,21 @@
     ],
     rowErrorShow:''
   })
-
+  // 查看套餐报价单 图片
   const previewImage=ref('')
+  // 查看套餐报价单 标题
   const previewImageTitle=ref('')
+// -----------------------------监听
+  // 已开票金额
   watch(()=> contractInfo.moneyData.haveInvoiceMoney ,(newValue)=>{
     contractInfo.moneyData.waitInvoiceMoney = contractInfo.moneyData.allInvoiceMoney-newValue
     contractInfo.moneyData.waitInvoiceMoney=Math.round(contractInfo.moneyData.waitInvoiceMoney*100)/100
   })
+  // 已到款金额
   watch(()=> contractInfo.moneyData.havePlacementMoney ,(newValue)=>{
     contractInfo.moneyData.waitPlacementMoney = contractInfo.moneyData.allPlacementMoney-newValue
     contractInfo.moneyData.waitPlacementMoney=Math.round(contractInfo.moneyData.waitPlacementMoney*100)/100
   })
-  const contractSourceArray=['非CRM合同导入','CRM合同导入']
-  const contractStatusArray=[{id:1,label:"已审批"},{id:2,label:"单章寄回"},{id:3,label:"已签回"}]
-  const contractTypeArray=[{id:1,label:"新签"},{id:2,label:"续约"}]
-  const operationType=[{op_type:1,label:"合规登记"},{op_type:2,label:"开票登记"},{op_type:3,label:"到款登记"},
-  {op_type:4,label:"修改合同状态"},{op_type:5,label:"删除合同登记"}]
   // -----------------------method
   // 权限验证
   const permissionValidation=()=>{
@@ -180,14 +186,15 @@
           messageHint.close()
           router.back()
         },1000)
+        return false
       }
     }
+    return true
   }
   //获取销售列表
   const getSellerListFun=()=>{
     getSellerList().then(res=>{
       contractInfo.sellerList=res.data || []
-      // console.log(contractInfo.sellerList);
     })
   }
   // 获取服务列表
@@ -227,6 +234,7 @@
     }
     contractInfo.contractValidityDate=[]
     setTimeout(()=>{
+      // 去除错误信息
       contractInfoForm.value && contractInfoForm.value.clearValidate()
     },0)
   }
@@ -312,108 +320,78 @@
   }
   // 表格删除行
   const deleteRow=(type,index)=>{
+    let tempArr=[]
     if(type=='invoice'){
-      if(invoiceForm.invoiceData[index].amount=='' && invoiceForm.invoiceData[index].invoice_date==''){
-        // 没有内容 直接删除
-        invoiceForm.invoiceData.splice(index,1)
-      }else{
-        ElMessageBox.confirm('删除后不可恢复,是否删除该条开票记录?',
-        '提示',    
-        {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning',
-        }).then(res=>{
-          // 有金额才进行删除后的运算
-          if(invoiceForm.invoiceData[index].amount!=''){
-            invoiceForm.invoiceData.splice(index,1)
-            let money=0
-            invoiceForm.invoiceData.map(item =>{
-              money+=parseFloat(item.amount) || 0
-              // console.log(money);
-            })
-            // 保留两位小数、防止计算时精度丢失
-            money=Math.round(money*100)/100
+      tempArr=invoiceForm.invoiceData
+    }else{
+      tempArr=placementForm.placementData
+    }
+    if(tempArr[index].amount=='' && tempArr[index].invoice_date==''){
+      // 没有内容 直接删除
+      tempArr.splice(index,1)
+    }else{
+      ElMessageBox.confirm('删除后不可恢复,是否删除该条开票记录?',
+      '提示',    
+      {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      }).then(res=>{
+        // 有金额才进行删除后的运算
+        if(tempArr[index].amount!=''){
+          tempArr.splice(index,1)
+          tempArr.map(item =>{
+            money+=parseFloat(item.amount) || 0
+            // console.log(money);
+          })
+          let money=0
+          // 保留两位小数、防止计算时精度丢失
+          money=Math.round(money*100)/100
+          if(type=='invoice'){
             contractInfo.moneyData.haveInvoiceMoney=money
           }else{
-            invoiceForm.invoiceData.splice(index,1)
-          }
-        }).catch(()=>{})
-      }
-    }else{
-      if(placementForm.placementData[index].amount=='' && placementForm.placementData[index].invoice_date==''){
-        // 没有内容 直接删除
-        placementForm.placementData.splice(index,1)
-      }else{
-        ElMessageBox.confirm('删除后不可恢复,是否删除该条到款记录?',
-        '提示',    
-        {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning',
-        }).then(res=>{
-          // 有金额才进行删除后的运算
-          if(placementForm.placementData[index].amount!=''){
-            placementForm.placementData.splice(index,1)
-            let money=0
-            placementForm.placementData.map(item =>{
-              money+=parseFloat(item.amount) || 0
-              // console.log(money);
-            })
-            // 保留两位小数、防止计算时精度丢失
-            money=Math.round(money*100)/100
             contractInfo.moneyData.havePlacementMoney=money
-          }else{
-            placementForm.placementData.splice(index,1)
           }
-        }).catch(()=>{})
-      }
+        }else{
+          tempArr.splice(index,1)
+        }
+      }).catch(()=>{})
     }
   }
   // 金额改变
   const moneyChange=(type,value,index)=>{ 
     // console.log(value);
     let numerValue=parseFloat(value)
+    let tempArr=[]
     if(type=='invoice'){
-      if(!numerValue&&numerValue!=0&&value){
-        invoiceForm.invoiceData[index].amount=''
-        ElMessage.error('请输入数字')
-        return
-      }
-      // 如果输入不是 以.结尾&&只有一个.的话,就赋值为转为成数字后的值
-      if(!(value.endsWith('.') && value.indexOf('.')==(value.length-1))&&numerValue){
-        invoiceForm.invoiceData[index].amount=numerValue
-      }
-      // console.log(numerValue);
+      tempArr=invoiceForm.invoiceData
+    }else{
+      tempArr=placementForm.placementData
+    }
 
-      let money=0
-      invoiceForm.invoiceData.map(item =>{
-        money+=parseFloat(item.amount) || 0
-      })
-      // 保留两位小数、防止计算时精度丢失
-      money=Math.round(money*100)/100
+    if(!numerValue&&numerValue!=0&&value){
+      tempArr[index].amount=''
+      ElMessage.error('请输入数字')
+      return
+    }
+    // 如果输入不是 以.结尾&&只有一个. 或者 不是零结尾的话,就赋值为转为成数字后的值
+    // 考虑到类似12.02的情况
+    if(!((value.endsWith('.') && value.indexOf('.')==(value.length-1)) || 
+    (value.endsWith('0') && value.indexOf('.')==(value.length-2)))&&numerValue){
+      tempArr[index].amount=numerValue
+    }
+    let money=0
+    tempArr.map(item =>{
+      money+=Math.round(item.amount*100)/100 || 0
+    })
+    // 保留两位小数、防止计算时精度丢失
+    money=Math.round(money*100)/100
+    
+    if(type=='invoice'){
       contractInfo.moneyData.haveInvoiceMoney=money
-
     }else{
-      if(!numerValue&&numerValue!=0&&value){
-        placementForm.placementData[index].amount=''
-        ElMessage.error('请输入数字')
-        return
-      }
-      // 如果输入不是 以.结尾&&只有一个.的话,就赋值为转为成数字后的值
-      if(!(value.endsWith('.') && value.indexOf('.')==(value.length-1))&&numerValue){
-        placementForm.placementData[index].amount=numerValue
-      }
-
-      let money=0
-      placementForm.placementData.map(item =>{
-        money+=parseFloat(item.amount) || 0
-      })
-      // 保留两位小数、防止计算时精度丢失
-      money=Math.round(money*100)/100
       contractInfo.moneyData.havePlacementMoney=money
     }
-    
   }
   // 金额格式化,保留两位小数
   const moneyFormatter=(money)=>{
@@ -561,10 +539,11 @@
   contractInfo.form.contract_register_id = parseInt(route.query.complianceId) || ''
   // complianceId没有,认为是合规登记
   contractInfo.operationtype=contractInfo.form.contract_register_id?(route.query.type || 'compliance'):'compliance'
-  permissionValidation()
-
-  getSellerListFun()
-  getServiceListFun()
+  if(permissionValidation()){
+    // 权限通过
+    getSellerListFun()
+    getServiceListFun()
+  }
 
   if(contractInfo.form.contract_register_id){
     //请求详情接口
@@ -608,6 +587,7 @@
           })
         })
       }
+      // 到款
       if(res.data.payment_list.length>0){
         placementForm.placementData=[]
         res.data.payment_list.map(item=>{
@@ -706,7 +686,7 @@
                   prop="start_date">
                     <el-date-picker type="daterange" 
                     v-model="contractInfo.contractValidityDate" @change="contractValidityDateChane"
-                    start-placeholder="合同有效期-开始" range-separator="至" end-placeholder="合同有效期-结束" value-format="YYYY-MM-DD"
+                    start-placeholder="开始日期" end-placeholder="结束日期" value-format="YYYY-MM-DD"
                     :clearable="false">
                     </el-date-picker>
                   </el-form-item>

+ 5 - 2
src/views/financialManagement/financialList.vue

@@ -176,8 +176,8 @@ const statusArray=[{id:1,label:"进行中"},{id:2,label:"已完成"}]
           <div class="financial-search-zone">
             <el-input v-model="financial.searchParams.keyword" placeholder="合同编号/客户姓名/销售" :prefix-icon="Search"
             style="width: 286px;margin-bottom: 8px;" @input="searchFinancial" clearable />
-            <el-date-picker v-model="financial.createtime" start-placeholder="合同创建日期"
-            end-placeholder="合同创建日期" style="margin-right: 30px;max-width: 286px;margin-bottom: 8px;"
+            <el-date-picker v-model="financial.createtime" start-placeholder="登记日期-开始"
+            end-placeholder="登记日期-结束" style="margin-right: 30px;max-width: 286px;margin-bottom: 8px;"
             value-format="YYYY-MM-DD" type="daterange"></el-date-picker>
             <el-select v-model="financial.searchParams.service_type" placeholder="请选择套餐类型" clearable
             @change="searchFinancial" style="width: 286px;margin-bottom: 8px;">
@@ -247,6 +247,8 @@ const statusArray=[{id:1,label:"进行中"},{id:2,label:"已完成"}]
                   {{statusArray[row.register_status-1].label}}
                 </template>
               </el-table-column>
+              <el-table-column label="登记时间" v-if="financial.tabelColumnShowArr.includes('create_time')"
+               align="center" prop="create_time" width="165"></el-table-column>
               <el-table-column label="操作"  fixed="right" width="120">
                 <template #header>
                   <div class="table-column-select">
@@ -262,6 +264,7 @@ const statusArray=[{id:1,label:"进行中"},{id:2,label:"已完成"}]
                         <el-checkbox label="contractDate">合同有效期</el-checkbox>
                         <el-checkbox label="agreed_pay_time">约定付款时间</el-checkbox>
                         <el-checkbox label="sign_date">签订日</el-checkbox>
+                        <el-checkbox label="create_time">登记时间</el-checkbox>
                         <el-checkbox label="remark">备注</el-checkbox>
                       </el-checkbox-group>
                       <el-button style="float: right;" @click="checkedConfirm">确认</el-button>