Răsfoiți Sursa

开票 结算开发

祁鹏飞 3 luni în urmă
părinte
comite
abd4e6ca19

+ 2 - 1
src/views/quoteConfig/project/modules/projectAdd.vue

@@ -780,6 +780,7 @@ const initEdit = async () => {
           item.drivingList = item.drivingIntentionList
           item.tableData = item.schemeInsuranceList.map(sub => {
             let obj = insuranceTypeList.value.find(a => a.id == sub.insuranceId)
+            console.log("🚀 ~ initEdit ~ obj:", obj)
             return {
               ...sub,
               optionId: res.data.schemeType===1?`${sub.optionId[0]}`:sub.optionId,
@@ -947,4 +948,4 @@ const save = async (ProjectAddRef: FormInstance | undefined) => {
     justify-content: center;
   }
 }
-</style>
+</style>

+ 0 - 1
src/views/receivable/handingFee/invoiceRecord.vue

@@ -56,7 +56,6 @@
               format="YYYY-MM-DD HH:mm:ss" />
           </el-form-item>
         </el-col>
-        <el-col :span="8"></el-col>
         <el-col :span="8" style="display: flex; align-items: start; justify-content: flex-end">
           <el-button type="primary" @click="search">查询</el-button>
           <el-button plain type="primary" @click="reset">重置</el-button>

+ 90 - 94
src/views/receivable/handingFee/ticket.vue

@@ -16,14 +16,16 @@
             <el-option value="orderType" label="订单类型"></el-option>
             <el-option value="signYear" label="签单年份"></el-option>
           </el-select>
-          <el-select v-model="item.type" v-if="item.name != 'signDate'" style="margin-right: 20px; width: 150px" @change="val=>signDateSelectChange(index, val)">
+          <el-select v-model="item.type" v-if="item.name != 'signDate'" style="margin-right: 20px; width: 150px"
+            @change="val => signDateSelectChange(index, val)">
             <el-option value="等于" label="等于"></el-option>
             <el-option value="不等于" label="不等于"></el-option>
             <el-option value="包含" label="包含"></el-option>
             <el-option value="不包含" label="不包含"></el-option>
             <el-option value="为空" label="为空"></el-option>
           </el-select>
-          <el-select v-model="item.type" v-else style="margin-right: 20px; width: 150px" @change="val=>signDateSelectChange(index, val)">
+          <el-select v-model="item.type" v-else style="margin-right: 20px; width: 150px"
+            @change="val => signDateSelectChange(index, val)">
             <el-option value="大于等于" label="大于等于"></el-option>
             <el-option value="小于等于" label="小于等于"></el-option>
             <el-option value="固定范围" label="固定范围"></el-option>
@@ -36,10 +38,11 @@
           </el-select>
           <el-date-picker style="width: 350px" v-model="datesearch" v-if="item.name == 'signDate'"
             :type="item.type == '大于等于' || item.type == '小于等于' ? 'date' : 'daterange'" placeholder="请选择"
-            :disabled="item.type == '为空'"  @change="handlePtlAgreementChange(index, $event)"   value-format="YYYY-MM-DD" />
-          <el-select style="width: 350px" v-model="multipleSearch" v-if="item.name == 'ptlAgreement'" multiple filterable
-            :disabled="item.type == '为空'" @change="handlePtlAgreementChange(index, $event)">
-            <el-option v-for="item in insurerContract" :key="item.id" :value="item.id" :label="item.agreementName" ></el-option>
+            :disabled="item.type == '为空'" @change="handlePtlAgreementChange(index, $event)" value-format="YYYY-MM-DD" />
+          <el-select style="width: 350px" v-model="multipleSearch" v-if="item.name == 'ptlAgreement'" multiple
+            filterable :disabled="item.type == '为空'" @change="handlePtlAgreementChange(index, $event)">
+            <el-option v-for="item in insurerContract" :key="item.id" :value="item.id"
+              :label="item.agreementName"></el-option>
           </el-select>
           <el-select style="width: 350px" v-model="orderTypesearch" v-if="item.name == 'orderType'" multiple
             :disabled="item.type == '为空'" @change="handlePtlAgreementChange(index, $event)">
@@ -47,9 +50,9 @@
             <el-option value="2" label="代客录单"></el-option>
             <el-option value="3" label="补录订单"></el-option>
           </el-select>
-          <el-date-picker v-if="item.name == 'signYear'" style="width: 350px" format="YYYY"
-          value-format="YYYY" v-model="yearrangesearch" type="yearrange"
-            range-separator="-" :disabled="item.type == '为空'" @change="handlePtlAgreementChange(index, $event)" />
+          <el-date-picker v-if="item.name == 'signYear'" style="width: 350px" format="YYYY" value-format="YYYY"
+            v-model="yearrangesearch" type="yearrange" range-separator="-" :disabled="item.type == '为空'"
+            @change="handlePtlAgreementChange(index, $event)" />
           <!-- <el-icon style="margin-left: 20px; cursor:pointer;"><CircleClose /></el-icon> -->
         </div>
         <el-button type="primary" @click="handleSearch">搜索</el-button>
@@ -87,8 +90,8 @@
     </el-table>
     <div class="footer">
       <el-button plain @click="handleBack">取消</el-button>
-      <el-button plain type="primary" @click="handleTicket">开票并结算</el-button>
-      <el-button type="primary" @click="handleInvoice">开票</el-button>
+      <el-button plain type="primary" @click="handleTicket(true)">开票并结算</el-button>
+      <el-button type="primary" @click="handleTicket(false)">开票</el-button>
     </div>
     <el-dialog v-model="addShow" width="800" title="添加应收">
       <div class="add-content">
@@ -147,13 +150,10 @@
         <el-button type="primary" @click="handleAddSubmit">确定</el-button>
       </template>
     </el-dialog>
-    <el-dialog v-model="countShow" width="600" title="开票并结算">
+    <el-dialog v-model="countShow" width="600" :title="isSettlement ? '开票并结算' : '开票'">
       <el-form ref="CountForm" :model="countForm" :rules="countRules" label-width="120">
-        <el-form-item prop="invoiceParty" label="开票方">
-          <el-input v-model="countForm.invoiceParty" placeholder="请输入"></el-input>
-        </el-form-item>
-        <el-form-item prop="receivableSupervisePremium" label="应收手续费">
-          <el-input v-model="countForm.receivableSupervisePremium" placeholder="请输入"></el-input>
+        <el-form-item prop="invoiceNo" label="开票号">
+          <el-input v-model="countForm.invoiceNo" placeholder="请输入"></el-input>
         </el-form-item>
         <el-form-item prop="overinflatedAmount" label="虚增金额">
           <el-input v-model="countForm.overinflatedAmount" placeholder="请输入"></el-input>
@@ -164,38 +164,35 @@
         <el-form-item prop="receivableSupervisePremium" label="应收金额">
           <el-input v-model="countForm.receivableSupervisePremium" placeholder="请输入"></el-input>
         </el-form-item>
-        <el-form-item prop="actualReceivedAmount" label="实收金额">
+        <el-form-item prop="invoiceTime" label="开票日期">
+          <el-date-picker v-model="countForm.invoiceTime" style="width: 100%;" type="date"
+            value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD" />
+        </el-form-item>
+        <el-form-item v-if="isSettlement" prop="actualReceivedAmount" label="实收金额">
           <el-input v-model="countForm.actualReceivedAmount" placeholder="请输入"></el-input>
         </el-form-item>
-        <el-form-item prop="receivePaymentDate" label="收款日期">
-          <el-date-picker v-model="countForm.receivePaymentDate" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
-            format="YYYY-MM-DD HH:mm:ss" />
+        <el-form-item v-if="isSettlement" prop="actualReceivedAmount" label="回款差额">
+          <el-input v-model="countForm.paymentDifference" placeholder="请输入"></el-input>
+        </el-form-item>
+        <el-form-item v-if="isSettlement" prop="actualReceivedAmount" label="差额原因">
+          <el-input v-model="countForm.paymentReason" placeholder="请输入"></el-input>
         </el-form-item>
-        <el-form-item prop="attachmentIds" label="收款凭证" class="upload-btn">
-          <el-upload style="margin: 0 10px 10px 0" :auto-upload="false" multiple v-if="!countForm.h"
-            :show-file-list="false" accept=".png, .jpg, .jpeg" @change="uploadImage" drag>
-            <el-button size="large" icon="Plus" />
+        <el-form-item v-if="isSettlement" prop="receivePaymentDate" label="收款日期">
+          <el-date-picker v-model="countForm.receivePaymentDate" style="width: 100%;" type="date"
+            value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD" />
+        </el-form-item>
+        <el-form-item v-if="isSettlement" prop="attachmentIds" label="收款凭证" class="upload-btn">
+          <el-upload action="https://tennat.baoxianzhanggui.com/api/file/upload"
+            v-model:file-list="countForm.attachmentIds" multiple list-type="picture-card">
+            <el-icon>
+              <Plus />
+            </el-icon>
           </el-upload>
-          <div class="imageDiv" v-for="(item, index) in imageUrl" :key="item">
-            <img :src="item" />
-            <div class="model">
-              <span class="icon-view" @click="handelViewImage(item, index)">
-                <el-icon>
-                  <View />
-                </el-icon>
-              </span>
-              <span class="icon-del" @click="handelDelImage(item, index)">
-                <el-icon>
-                  <Delete />
-                </el-icon>
-              </span>
-            </div>
-          </div>
         </el-form-item>
       </el-form>
       <template #footer>
-        <el-button class="border-[#0083FF] color-[#0083FF]" plain @click="handelCancel">取消</el-button>
-        <el-button type="primary" @click="handelComfirm(CountForm)">确定</el-button>
+        <el-button class="border-[#0083FF] color-[#0083FF]" plain @click="countShow = false">取消</el-button>
+        <el-button type="primary" @click="handelComfirm()">确定</el-button>
       </template>
     </el-dialog>
   </div>
@@ -217,7 +214,7 @@ const orderTypesearch = ref('')
 const yearrangesearch = ref('')
 const datesearch = ref('')
 const countShow = ref(false)
-const  countForm = ref({})
+const countForm = ref({})
 //获取保险公司协议
 const getByCompanyId = () => {
   api.dispatchApi.getByCompanyIdt(route.query.id).then((res: any) => {
@@ -307,21 +304,21 @@ const handlePtlAgreementChange = (index: any, e: any) => {
   console.log(e)
   if (Array.isArray(e)) {
     searchList.value[index].search = e.join(',') || ''
-  }else{
-    searchList.value[index].search = e|| ''
+  } else {
+    searchList.value[index].search = e || ''
   }
 }
 
 // 签单时间选择器改变时触发
-const signDateSelectChange = (index:any,e:any) => {
+const signDateSelectChange = (index: any, e: any) => {
   switch (e) {
     case '为空':
       searchList.value[index].search = ''
       break;
     case '大于等于':
     case '小于等于':
-    searchList.value[index].search = ''
-    datesearch.value =  ''
+      searchList.value[index].search = ''
+      datesearch.value = ''
       break;
   }
 }
@@ -374,63 +371,62 @@ const handleToAdd = (row) => {
 const handleBack = () => {
   router.back()
 }
-const handleTicket = () => {
 
-  api.financeApi.invoicingCheck({
+const countRules = {
+  receivableSupervisePremium: [
+    { required: true, message: '请输入应收金额', trigger: 'blur' }
+  ]
+}
+const isSettlement = ref(false)
+const handleTicket = (bool) => {
+  isSettlement.value = bool
+  const params = {
     incomeIds: selectedList.value.map(v => v.id),
     companyId: route.query.id,
     invoiceType: route.query.invoiceType
-  }).then((res: any) => {
+  }
+  api.financeApi.invoicingCheck(params).then((res: any) => {
     if (res.code == 200) {
-      countShow.value = true
-      api.financeApi.commissionInvoicing({
-        incomeIds: selectedList.value.map(v => v.id),
-        orderNos: selectedList.value.map(v => v.orderNo),
-        companyId: route.query.id,
-        invoiceType: route.query.invoiceType
-      }).then((sub: any) => {
-        if (sub.code == 200) {
-          ElMessage({
-            message: sub.msg,
-            type: 'success'
-          })
-          api.financeApi.settlement({
-            invoicingId: sub.data.invoiceId,
-            actualReceivedAmount: sub.data.sumPrice
-          }).then((msg: any) => {
-            if (msg.code == 200) {
-              ElMessage({
-                message: msg.msg,
-                type: 'success'
-              })
-            }
-          })
-        }
-      })
-    }else{
+      openCountForm()
+      calBeforeInvoice(params)
+    }
+  })
+}
 
+const calBeforeInvoice = (params: any) => {
+  api.financeApi.calBeforeInvoice(params).then((res: any) => {
+    if (sub.code == 200) {
+      countForm.value.invoiceTime = res.data.invoiceTime
+      countForm.value.receivableSupervisePremium = res.data.receivableSupervisePremium
     }
   })
 }
-const handleInvoice = () => {
-  api.financeApi.invoicingCheck({
+
+const openCountForm = () => {
+  countForm.value = {}
+  countShow.value = true
+}
+const handelComfirm = () => {
+  let apiFn = api.financeApi.commissionInvoicing
+  if (isSettlement.value) apiFn = api.financeApi.settlement
+  const attachmentIds = countForm.value.attachmentIds?.map(v => v.response.data.id)
+  const params = {
+    invoiceVO: {
+      ...countForm.value,
+      attachmentIds,
+    },
+    ...countForm.value,
     incomeIds: selectedList.value.map(v => v.id),
+    orderNos: selectedList.value.map(v => v.orderNo),
     companyId: route.query.id,
     invoiceType: route.query.invoiceType
-  }).then((res: any) => {
-    if (res.code == 200) {
-      api.financeApi.commissionInvoicing({
-        incomeIds: selectedList.value.map(v => v.id),
-        orderNos: selectedList.value.map(v => v.orderNo),
-        companyId: route.query.id,
-        invoiceType: route.query.invoiceType
-      }).then((sub: any) => {
-        if (sub.code == 200) {
-          ElMessage({
-            message: sub.msg,
-            type: 'success'
-          })
-        }
+  }
+  apiFn(params).then((sub: any) => {
+    if (sub.code == 200) {
+      countShow.value = false
+      ElMessage({
+        message: sub.msg,
+        type: 'success'
       })
     }
   })
@@ -438,7 +434,7 @@ const handleInvoice = () => {
 
 const initData = () => {
   // router
-    api.financeApi.getSelectedReceivableList({ orderNos: selectedList.value.map(v => v.orderNo),companyId: route.query.id}).then((res: any) => {
+  api.financeApi.getSelectedReceivableList({ orderNos: selectedList.value.map(v => v.orderNo), companyId: route.query.id }).then((res: any) => {
     if (res.code == 200) {
       tableData.value = res.data
     }