فهرست منبع

企业-发票抬头管理

Xiao_123 7 ماه پیش
والد
کامیت
7bfc6dab46

+ 59 - 66
src/views/recruit/enterprise/invoiceManagement/index.vue

@@ -15,45 +15,10 @@
       @edit="handleEdit"
       @del="handleDelete"
     >
-      <template #code="{ item }">
-        <v-tooltip :text="item.code" location="top">
-          <template v-slot:activator="{ props }">
-            <div v-bind="props" class="mw ellipsis">{{ item.code }}</div>
-          </template>
-        </v-tooltip>
-      </template>
-      <template #email="{ item }">
-        <v-tooltip :text="item.email" location="top">
-          <template v-slot:activator="{ props }">
-            <div v-bind="props" class="mw ellipsis">{{ item.email }}</div>
-          </template>
-        </v-tooltip>
-      </template>
-      <template #enterpriseAddress="{ item }">
-        <v-tooltip :text="item.enterpriseAddress" location="top">
-          <template v-slot:activator="{ props }">
-            <div v-bind="props" class="mw ellipsis">{{ item.enterpriseAddress }}</div>
-          </template>
-        </v-tooltip>
-      </template>
-      <template #enterpriseBankTitle="{ item }">
-        <v-tooltip :text="item.enterpriseBankTitle" location="top">
-          <template v-slot:activator="{ props }">
-            <div v-bind="props" class="mw ellipsis">{{ item.enterpriseBankTitle }}</div>
-          </template>
-        </v-tooltip>
-      </template>
-      <template #enterpriseBankNo="{ item }">
-        <v-tooltip :text="item.enterpriseBankNo" location="top">
-          <template v-slot:activator="{ props }">
-            <div v-bind="props" class="mw ellipsis">{{ item.enterpriseBankNo }}</div>
-          </template>
-        </v-tooltip>
-      </template>
     </CtTable>
   </v-card>
 
-  <CtDialog :visible="show" :widthType="2" titleClass="text-h6" :title="editId ? '编辑发票抬头' : '新增发票抬头'" @close="handleClose" @submit="handleSubmit">
+  <CtDialog :visible="show" :widthType="3" titleClass="text-h6" :title="editId ? '编辑发票抬头' : '新增发票抬头'" @close="handleClose" @submit="handleSubmit">
     <CtForm ref="CtFormRef" :items="formItems"></CtForm>
   </CtDialog>
 </template>
@@ -61,6 +26,7 @@
 <script setup>
 defineOptions({ name: 'invoiceHeader'})
 import { ref } from 'vue'
+import { getEnterpriseBusiness } from '@/api/enterprise'
 import { getInvoiceTitlePage, createInvoiceTitle, updateInvoiceTitle, deleteInvoiceTitle } from '@/api/recruit/enterprise/member/invoice'
 import Snackbar from '@/plugins/snackbar'
 import Confirm from '@/plugins/confirm'
@@ -72,12 +38,11 @@ const total = ref(0)
 const items = ref([])
 const headers = [
   { title: '抬头类型', key: 'category', sortable: false, value: item => item.category === 0 ? '个人' : '企业' },
+  { title: '发票类型', key: 'type', sortable: false, value: item => item.type === 0 ? '增值税普通发票' : '增值税专用发票' },
   { title: '发票抬头', key: 'title', sortable: false },
   { title: '税号', key: 'code', sortable: false },
   { title: '联系邮箱', key: 'email', sortable: false },
   { title: '联系电话', key: 'phone', sortable: false },
-  { title: '单位电话', key: 'enterprisePhone', sortable: false },
-  { title: '单位地址', key: 'enterpriseAddress', sortable: false },
   { title: '开户银行', key: 'enterpriseBankTitle', sortable: false },
   { title: '银行账号', key: 'enterpriseBankNo', sortable: false },
   { title: '操作', key: 'actions', sortable: false }
@@ -92,10 +57,26 @@ const show = ref(false)
 const editId = ref(null)
 
 // 抬头类型
-const handleChangeType = (e) => {
+const keys = ['enterpriseBankTitle', 'enterpriseBankNo']
+const handleChangeCategory = (e) => {
+  const type = formItems.value.options.find(item => item.key === 'type').value
   const code = formItems.value.options.find(item => item.key === 'code')
   code.hide = e ? false : true
+  keys.forEach(k => {
+    const result = formItems.value.options.find(item => item.key === k)
+    result.label = (e && type) || (!e && type) ? `${result.defaultLabel} *` : result.defaultLabel
+    result.rules = (e && type) || (!e && type) ? [v => !!v || `请输入${result.defaultLabel}`] : []
+  })
+}
+
+const handleChangeType = (e) => {
+  keys.forEach(k => {
+    const result = formItems.value.options.find(item => item.key === k)
+    result.label = e ? `${result.defaultLabel} *` : result.defaultLabel
+    result.rules = e ? [v => !!v || `请输入${result.defaultLabel}`] : []
+  })
 }
+
 const formItems = ref({
   options: [
     {
@@ -108,6 +89,18 @@ const formItems = ref({
         { label: '个人', value: 0 },
         { label: '企业', value: 1 }
       ],
+      change: handleChangeCategory
+    },
+    {
+      type: 'ifRadio',
+      key: 'type',
+      value: 0,
+      label: '发票类型 *',
+      width: 90,
+      items: [
+        { label: '增值税普通发票', value: 0 },
+        { label: '增值税专用发票', value: 1 }
+      ],
       change: handleChangeType
     },
     {
@@ -135,6 +128,13 @@ const formItems = ref({
         }
       ]
     },
+    {
+      type: 'phoneNumber',
+      key: 'phone',
+      value: null,
+      label: '联系电话',
+      outlined: true
+    },
     {
       type: 'text',
       key: 'email',
@@ -151,32 +151,12 @@ const formItems = ref({
         }
       ]
     },
-    {
-      type: 'phoneNumber',
-      key: 'phone',
-      value: null,
-      label: '联系电话',
-      outlined: true
-    },
-    {
-      type: 'text',
-      key: 'enterpriseAddress',
-      value: null,
-      label: '单位地址',
-      outlined: true
-    },
-    {
-      type: 'phoneNumber',
-      key: 'enterprisePhone',
-      value: null,
-      label: '单位电话',
-      outlined: true
-    },
     {
       type: 'text',
       key: 'enterpriseBankTitle',
       value: null,
       label: '开户银行',
+      defaultLabel: '开户银行',
       outlined: true
     },
     {
@@ -184,11 +164,21 @@ const formItems = ref({
       key: 'enterpriseBankNo',
       value: null,
       label: '银行账号',
+      defaultLabel: '银行账号',
       outlined: true
     }
   ]
 })
 
+// 获取企业工商信息
+const business = ref({})
+const getEnterpriseBusinessInfo = async () => {
+  const data = await getEnterpriseBusiness()
+  if (!data || !Object.keys(data).length) return
+  business.value = data
+}
+getEnterpriseBusinessInfo()
+
 // 获取列表
 const getList =async () => {
   const res = await getInvoiceTitlePage(query.value)
@@ -205,10 +195,12 @@ const handleChangePage = (e) => {
 // 新增
 const handleAdd = () => {
   formItems.value.options.forEach(e => {
-    if (e.key === 'category') {
+    e.value = business.value[e.key] || null
+    if (e.key === 'title') e.value = business.value.name
+    if (e.key === 'category' || e.key === 'type') {
       e.value = 0
       e.change(e.value)
-    } else e.value = null
+    }
   })
   show.value = true
   editId.value = null
@@ -219,7 +211,10 @@ const handleEdit = (item) => {
   editId.value = item.id
   formItems.value.options.forEach(e => {
     e.value = item[e.key]
-    if (e?.change) e.change(item[e.key])
+    if (e.key === 'category' || e.key === 'type') {
+      e.value = item[e.key] || 0
+      e.change(e.value)
+    }
   })
   show.value = true
 }
@@ -249,6 +244,7 @@ const handleSubmit = async () => {
   formItems.value.options.forEach(item => {
     obj[item.key] = item.value
   })
+  if (obj.type === undefined || obj.type === null || obj.type === '') return Snackbar.warning('请选择发票类型')
   if (obj.phone && !checkPhone(obj.phone)) return Snackbar.warning(t('login.correctPhoneNumber'))
   if (editId.value) obj.id = editId.value
   const api = editId.value ? updateInvoiceTitle : createInvoiceTitle
@@ -260,7 +256,4 @@ const handleSubmit = async () => {
 </script>
 
 <style scoped lang="scss">
-.mw {
-  max-width: 80px;
-}
 </style>

+ 5 - 1
src/views/recruit/enterprise/tradingOrder/components/trading/transaction.vue

@@ -75,6 +75,7 @@ const invoiceList = ref([])
 // 查询可开票订单
 const checkStatus = async () => {
   const payOrderIds = dataList.value.map(e => e.payOrderId)
+  // 已开票payOrderId
   const { list }  = await getInvoiceListPage({ payOrderIds })
   invoiceList.value = list
 }
@@ -114,7 +115,9 @@ const invoiceHeaders = [
   { title: '发票抬头', key: 'title', sortable: false },
   { title: '税号', key: 'code', sortable: false },
   { title: '联系邮箱', key: 'email', sortable: false },
-  { title: '联系电话', key: 'phone', sortable: false }
+  { title: '联系电话', key: 'phone', sortable: false },
+  { title: '开户银行', key: 'enterpriseBankTitle', sortable: false },
+  { title: '开户账号', key: 'enterpriseBankNo', sortable: false }
 ]
 const getInvoiceTitleList = async () => {
   const { list, total } = await getInvoiceTitlePage(invoiceQuery.value)
@@ -154,6 +157,7 @@ const handleSubmit = async () => {
   delete obj.id
   await createInvoice({ ...obj, payOrderId: order.value.payOrderId })
   Snackbar.success('申请成功,开票中...')
+  radio.value = null
   handleClose()
   getData()
 }

+ 2 - 2
src/views/recruit/personal/company/index.vue

@@ -63,10 +63,10 @@ const dealRouteQuery = (data) => {
 
 // 搜索
 const handleSearch = async (val, key) => {
-  if (!val) return
+  if (!val && key !== 'name') return
   query.value.pageNo = 1
   // val为-1时选择的是不限或者全国, 此时选中的字段不传
-  if (val === -1 || val[0] === -1) delete query.value[key]
+  if (!val || val === -1 || val[0] === -1) delete query.value[key]
   else query.value[key] = val
   dealRouteQuery(query.value)
   await getCompanyData()