Browse Source

Merge branch 'dev' of http://39.101.143.165:8090/dong_k/tenant-Platform into dev

祁鹏飞 2 months ago
parent
commit
306025a815

+ 2 - 0
src/api/modules/finance.ts

@@ -24,6 +24,8 @@ const financeApi = (axiosInstance: ApiInstance) => ({
     commissionInvoicing: (data: any) => axiosInstance.post('/receivable/commissionInvoicing', data), // 开票
     // 删除开票记录
     deleteInvoiceById: (data: any) => axiosInstance.delete(`/receivable/deleteInvoiceById/${data}`),
+    // 跟单开票记录删除
+    deleteFollowInvoiceById: (data: any) => axiosInstance.delete(`/receivable/deleteFollowInvoiceById/${data}`),
     //金额总计
     queryTotalWithdrawalAmount: (data: any) => axiosInstance.post('/amountAuditing/queryTotalWithdrawalAmount', data),
     // 结算

+ 2 - 0
src/api/modules/settlement.ts

@@ -2,6 +2,8 @@ import { ApiInstance } from '../type'
 
 const settlementApi = (axiosInstance: ApiInstance) => ({
   companySuperviseSettlementReport: (data: any) => axiosInstance.post('/receivable/companySuperviseSettlementReport', data), // 保险公司报表
+  followCompanySuperviseSettlementReport: (data: any) => axiosInstance.post('/receivable/followCompanySuperviseSettlementReport', data), // 保险公司报表
+
   followSettlementExcel: (data: any) => axiosInstance.post('/receivable/followSettlementExcel',data), // 跟单记录
   platformSettlementExcel: (data: any) => axiosInstance.post('/receivable/platformSettlementExcel',data), // 平台结算记录
   superviseSettlementExcel: (data: any) => axiosInstance.post('/receivable/superviseSettlementExcel', data), // 手续费车险结算记录

+ 1 - 1
src/views/receivable/documentary/documentaryRecord.vue

@@ -305,7 +305,7 @@ const handleDelete = (row) => {
     }
   )
     .then(() => {
-      api.financeApi.deleteInvoiceById(row.id).then((res: any) => {
+      api.financeApi.deleteFollowInvoiceById(row.id).then((res: any) => {
         if (res.code == 200) {
           reset()
           ElMessage({

+ 7 - 7
src/views/receivable/documentary/documentaryReport.vue

@@ -51,12 +51,12 @@
                                                 展开
                                             </template>
 </el-table-column>-->
-          <el-table-column prop="totalFollowFee" label="累计应收"></el-table-column>
+          <el-table-column prop="totalReceivable" label="累计应收"></el-table-column>
           <el-table-column prop="followFee" label="应收跟单费"></el-table-column>
-          <el-table-column prop="gdfInvoicedAmount" label="已开票"></el-table-column>
-          <el-table-column prop="gdfSettledAmount" label="已结算"></el-table-column>
-          <el-table-column prop="gdfUnInvoicedAmount" label="未开票"></el-table-column>
-          <el-table-column prop="gdfUnSettledAmount" label="未结算"></el-table-column>
+          <el-table-column prop="totalInvoiced" label="已开票"></el-table-column>
+          <el-table-column prop="totalSettlementAmount" label="已结算"></el-table-column>
+          <el-table-column prop="totalUnInvoiced" label="未开票"></el-table-column>
+          <el-table-column prop="totalUnSettlementAmount" label="未结算"></el-table-column>
           <el-table-column label="操作" fixed="right" width="120">
             <template #default="scope">
               <el-button link type="primary">查看明细</el-button>
@@ -435,7 +435,7 @@ const view = (scope) => {
 
 
 const initData1 = () => {
-  api.settlementApi.companySuperviseSettlementReport({
+  api.settlementApi.followCompanySuperviseSettlementReport({
     companyId: recordForm.value.companyId,
     startTime: recordForm.value.time?.[0],
     endTime: recordForm.value.time?.[1],
@@ -703,7 +703,7 @@ onMounted(() => {
     initData2();
   } else if (route.query.activeName == "3") {
     recordForm2.value.invoiceId = route.query.id
-    initData3(['1']);
+    initData3(['2']);
   }
   initData1();
   initCompany();

+ 0 - 1
src/views/receivable/documentary/index.vue

@@ -160,7 +160,6 @@
           <el-table-column prop="companyName" label="保险公司" width="120"></el-table-column>
           <el-table-column prop="deptName" label="出单机构" width="120"></el-table-column>
           <el-table-column prop="agreementName" label="出单协议" width="150"></el-table-column>
-          <el-table-column prop="invoiceStatusName" label="开票状态" width="100"></el-table-column>
           <el-table-column prop="orderType" label="订单类型" width="100"></el-table-column>
           <el-table-column prop="licenseNo" label="车牌号" width="100"></el-table-column>
           <el-table-column prop="otherCostsPremiums" label="应收跟单费" width="100"></el-table-column>

+ 34 - 18
src/views/receivable/documentary/ticket.vue

@@ -42,7 +42,7 @@
       <el-table-column prop="receivablePremium" label="应收总额"></el-table-column>
       <el-table-column prop="reconciliationAmount" label="对账金额">
         <template #default="scope">
-          <div class="flex items-center cursor-pointer" @click="handleEdit(scope.row,scope.$index)"
+          <div class="flex items-center cursor-pointer" @click="handleEdit(scope.row, scope.$index)"
             @mouseenter="scope.row.showEdit = true" @mouseleave="scope.row.showEdit = false">
             ¥{{ scope.row.reconciliationAmount || 0 }}
             <el-icon class="m-l-4px " v-if="scope.row.showEdit">
@@ -58,8 +58,8 @@
     </el-table>
     <div class="footer">
       <el-button plain @click="router.back()">取消</el-button>
-      <el-button plain type="primary" @click="handleTicket(true)">开票并结算</el-button>
-      <el-button type="primary" @click="handleTicket(false)">开票</el-button>
+      <el-button plain type="primary" :disabled="selectedList.some(item => item.receivablePremium <= 0)" @click="handleTicket(true)">开票并结算</el-button>
+      <el-button type="primary" :disabled="selectedList.some(item => item.receivablePremium <= 0)" @click="handleTicket(false)">开票</el-button>
     </div>
     <el-dialog :close-on-click-modal="false" v-model="countShow" width="600" :title="isSettlement ? '开票并结算' : '开票'">
       <el-form ref="CountForm" :model="countForm" :rules="countRules" label-width="120">
@@ -80,8 +80,7 @@
         </el-form-item>
         <el-form-item prop="receivableSupervisePremium" label="开票金额">
           <el-input-number :disabled="selectedList.length > 1" v-model="countForm.receivableSupervisePremium"
-            style="width: 100%;" :min="0" :precision="2" controls-position="right"
-            @change="handleChange()" />
+            style="width: 100%;" :min="0" :precision="2" controls-position="right" @change="handleChange()" />
         </el-form-item>
         <!-- <el-form-item prop="overinflatedAmount" label="虚增金额">
           <el-input v-model="countForm.overinflatedAmount" disabled></el-input>
@@ -135,7 +134,8 @@
         <el-button type="primary" @click="handelComfirm()">确定</el-button>
       </template>
     </el-dialog>
-    <el-dialog :close-on-click-modal="false" v-model="editShow" width="600" :title="isSettlement ? '开票并结算' : '开票'" draggable>
+    <el-dialog :close-on-click-modal="false" v-model="editShow" width="600" :title="isSettlement ? '开票并结算' : '开票'"
+      draggable>
       <el-form ref="CountForm" :model="editForm" :rules="countRules" label-width="120">
         <el-form-item prop="receivableSupervisePremium" label="应收金额">
           <el-input v-model="editForm.receivablePremium" placeholder="请输入" disabled></el-input>
@@ -153,10 +153,10 @@
       </el-form>
       <template #footer>
         <el-button class="border-[#0083FF] color-[#0083FF]" plain @click="editShow = false">取消</el-button>
-        <el-button type="primary" @click="handelComfirmEdit" >确定</el-button>
+        <el-button type="primary" @click="handelComfirmEdit">确定</el-button>
       </template>
     </el-dialog>
-  <el-image-viewer v-if="imageShow" :url-list="[bigImageUrl]" @close="imageShow = false" />
+    <el-image-viewer v-if="imageShow" :url-list="[bigImageUrl]" @close="imageShow = false" />
 
   </div>
 </template>
@@ -182,8 +182,9 @@ const editForm = ref({})
 const rowIndex = ref(0)
 const handleEdit = (row: any, index: number) => {
   editShow.value = true
-  editForm.value = {...row}
+  editForm.value = { ...row }
   rowIndex.value = index
+  console.log(editForm.value)
 }
 const companyIdprops = {
   expandTrigger: 'hover' as const,
@@ -196,8 +197,11 @@ const tableRef = ref('')
 const selCompanyId = ref('')
 /** 处理选择变更,更新选中的公司ID和选中列表 */
 const handleSelection = (val: any) => {
+  console.log(val)
   if (val.length) selCompanyId.value = val[0].partnerCompanyId
-  if (!val.length) selCompanyId.value = ''
+  if (!val.length){
+
+  } selCompanyId.value = ''
   selectedList.value = val
 }
 /** 处理全选/多选操作,确保所选行仅限于同一合作公司:选取首项的公司ID作为当前选中公司,过滤掉不同公司的选项并取消其选中状态 */
@@ -299,15 +303,21 @@ const handleTicket = async (bool: boolean) => {
     ElMessage.error('请选择应收单据')
     return
   }
-  if (selectedList.value.find(v => v.reconciliationAmount === undefined)) {
+  if (selectedList.value.some(v => v.reconciliationAmount === undefined || v.reconciliationAmount === null || v.reconciliationAmount === '')) {
     ElMessage.error('请先确认对账金额')
     return
   }
   isSettlement.value = bool
-  const arr = selectedList.value.map(v => v.uninvoiced)
+  console.log(selectedList.value)
+  // 使用接口计算每项的差值(对账金额 - 已开票金额)
+  const arr = await Promise.all(selectedList.value.map(async v => {
+    const diff = await calSub(v.reconciliationAmount, v.invoiced)
+    return diff
+  }))
+  console.log(arr)
   const res = await api.financeApi.calculateTotalSum(arr.join())
   if (res.code == 200) {
-    countForm.value.selectFlag=1;
+    countForm.value.selectFlag = 1;
     openCountForm()
     countForm.value.companyId = selectedList.value[0].companyId
     countForm.value.reconciliationAmount = selectedList.value.reduce((total, current) => total + current.reconciliationAmount, 0);
@@ -351,16 +361,20 @@ const openCountForm = () => {
 
   countShow.value = true
 }
-const handelComfirm = () => {
-  if (countForm.value.reconciliationAmount < countForm.value.receivableSupervisePremium) {
-    ElMessage.error('开票金额不可大于对账金额')
+const handelComfirm = async () => {
+  const arr = await Promise.all(selectedList.value.map(async v => {
+    const diff = await calSub(v.reconciliationAmount, v.invoiced)
+    return diff
+  }))
+  const res = await api.financeApi.calculateTotalSum(arr.join())
+  if (countForm.value.receivableSupervisePremium > res.data) {
+    ElMessage.error('开票金额不可大于未开票金额')
     return
   }
   if (countForm.value.receivableSupervisePremium === 0) {
     ElMessage.error('开票金额不能为0')
     return
   }
-  console.log()
   const attachmentIds = countForm.value.attachmentIds
   let params: any = {
     details: selectedList.value,
@@ -486,6 +500,7 @@ onMounted(() => {
   align-items: center;
   justify-content: center;
 }
+
 .imageDiv {
   position: relative;
   width: 80px;
@@ -525,6 +540,7 @@ onMounted(() => {
     }
   }
 }
+
 .upload-btn {
   :deep(.el-button) {
     width: 80px;
@@ -533,4 +549,4 @@ onMounted(() => {
     color: #ccc;
   }
 }
-</style>
+</style>