|
@@ -15,45 +15,10 @@
|
|
@edit="handleEdit"
|
|
@edit="handleEdit"
|
|
@del="handleDelete"
|
|
@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>
|
|
</CtTable>
|
|
</v-card>
|
|
</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>
|
|
<CtForm ref="CtFormRef" :items="formItems"></CtForm>
|
|
</CtDialog>
|
|
</CtDialog>
|
|
</template>
|
|
</template>
|
|
@@ -61,6 +26,7 @@
|
|
<script setup>
|
|
<script setup>
|
|
defineOptions({ name: 'invoiceHeader'})
|
|
defineOptions({ name: 'invoiceHeader'})
|
|
import { ref } from 'vue'
|
|
import { ref } from 'vue'
|
|
|
|
+import { getEnterpriseBusiness } from '@/api/enterprise'
|
|
import { getInvoiceTitlePage, createInvoiceTitle, updateInvoiceTitle, deleteInvoiceTitle } from '@/api/recruit/enterprise/member/invoice'
|
|
import { getInvoiceTitlePage, createInvoiceTitle, updateInvoiceTitle, deleteInvoiceTitle } from '@/api/recruit/enterprise/member/invoice'
|
|
import Snackbar from '@/plugins/snackbar'
|
|
import Snackbar from '@/plugins/snackbar'
|
|
import Confirm from '@/plugins/confirm'
|
|
import Confirm from '@/plugins/confirm'
|
|
@@ -72,12 +38,11 @@ const total = ref(0)
|
|
const items = ref([])
|
|
const items = ref([])
|
|
const headers = [
|
|
const headers = [
|
|
{ title: '抬头类型', key: 'category', sortable: false, value: item => item.category === 0 ? '个人' : '企业' },
|
|
{ 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: 'title', sortable: false },
|
|
{ title: '税号', key: 'code', sortable: false },
|
|
{ title: '税号', key: 'code', sortable: false },
|
|
{ title: '联系邮箱', key: 'email', sortable: false },
|
|
{ title: '联系邮箱', key: 'email', sortable: false },
|
|
{ title: '联系电话', key: 'phone', sortable: false },
|
|
{ title: '联系电话', key: 'phone', sortable: false },
|
|
- { title: '单位电话', key: 'enterprisePhone', sortable: false },
|
|
|
|
- { title: '单位地址', key: 'enterpriseAddress', sortable: false },
|
|
|
|
{ title: '开户银行', key: 'enterpriseBankTitle', sortable: false },
|
|
{ title: '开户银行', key: 'enterpriseBankTitle', sortable: false },
|
|
{ title: '银行账号', key: 'enterpriseBankNo', sortable: false },
|
|
{ title: '银行账号', key: 'enterpriseBankNo', sortable: false },
|
|
{ title: '操作', key: 'actions', sortable: false }
|
|
{ title: '操作', key: 'actions', sortable: false }
|
|
@@ -92,10 +57,26 @@ const show = ref(false)
|
|
const editId = ref(null)
|
|
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')
|
|
const code = formItems.value.options.find(item => item.key === 'code')
|
|
code.hide = e ? false : true
|
|
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({
|
|
const formItems = ref({
|
|
options: [
|
|
options: [
|
|
{
|
|
{
|
|
@@ -108,6 +89,18 @@ const formItems = ref({
|
|
{ label: '个人', value: 0 },
|
|
{ label: '个人', value: 0 },
|
|
{ label: '企业', value: 1 }
|
|
{ label: '企业', value: 1 }
|
|
],
|
|
],
|
|
|
|
+ change: handleChangeCategory
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ type: 'ifRadio',
|
|
|
|
+ key: 'type',
|
|
|
|
+ value: 0,
|
|
|
|
+ label: '发票类型 *',
|
|
|
|
+ width: 90,
|
|
|
|
+ items: [
|
|
|
|
+ { label: '增值税普通发票', value: 0 },
|
|
|
|
+ { label: '增值税专用发票', value: 1 }
|
|
|
|
+ ],
|
|
change: handleChangeType
|
|
change: handleChangeType
|
|
},
|
|
},
|
|
{
|
|
{
|
|
@@ -135,6 +128,13 @@ const formItems = ref({
|
|
}
|
|
}
|
|
]
|
|
]
|
|
},
|
|
},
|
|
|
|
+ {
|
|
|
|
+ type: 'phoneNumber',
|
|
|
|
+ key: 'phone',
|
|
|
|
+ value: null,
|
|
|
|
+ label: '联系电话',
|
|
|
|
+ outlined: true
|
|
|
|
+ },
|
|
{
|
|
{
|
|
type: 'text',
|
|
type: 'text',
|
|
key: 'email',
|
|
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',
|
|
type: 'text',
|
|
key: 'enterpriseBankTitle',
|
|
key: 'enterpriseBankTitle',
|
|
value: null,
|
|
value: null,
|
|
label: '开户银行',
|
|
label: '开户银行',
|
|
|
|
+ defaultLabel: '开户银行',
|
|
outlined: true
|
|
outlined: true
|
|
},
|
|
},
|
|
{
|
|
{
|
|
@@ -184,11 +164,21 @@ const formItems = ref({
|
|
key: 'enterpriseBankNo',
|
|
key: 'enterpriseBankNo',
|
|
value: null,
|
|
value: null,
|
|
label: '银行账号',
|
|
label: '银行账号',
|
|
|
|
+ defaultLabel: '银行账号',
|
|
outlined: true
|
|
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 getList =async () => {
|
|
const res = await getInvoiceTitlePage(query.value)
|
|
const res = await getInvoiceTitlePage(query.value)
|
|
@@ -205,10 +195,12 @@ const handleChangePage = (e) => {
|
|
// 新增
|
|
// 新增
|
|
const handleAdd = () => {
|
|
const handleAdd = () => {
|
|
formItems.value.options.forEach(e => {
|
|
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.value = 0
|
|
e.change(e.value)
|
|
e.change(e.value)
|
|
- } else e.value = null
|
|
|
|
|
|
+ }
|
|
})
|
|
})
|
|
show.value = true
|
|
show.value = true
|
|
editId.value = null
|
|
editId.value = null
|
|
@@ -219,7 +211,10 @@ const handleEdit = (item) => {
|
|
editId.value = item.id
|
|
editId.value = item.id
|
|
formItems.value.options.forEach(e => {
|
|
formItems.value.options.forEach(e => {
|
|
e.value = item[e.key]
|
|
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
|
|
show.value = true
|
|
}
|
|
}
|
|
@@ -249,6 +244,7 @@ const handleSubmit = async () => {
|
|
formItems.value.options.forEach(item => {
|
|
formItems.value.options.forEach(item => {
|
|
obj[item.key] = item.value
|
|
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 (obj.phone && !checkPhone(obj.phone)) return Snackbar.warning(t('login.correctPhoneNumber'))
|
|
if (editId.value) obj.id = editId.value
|
|
if (editId.value) obj.id = editId.value
|
|
const api = editId.value ? updateInvoiceTitle : createInvoiceTitle
|
|
const api = editId.value ? updateInvoiceTitle : createInvoiceTitle
|
|
@@ -260,7 +256,4 @@ const handleSubmit = async () => {
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
-.mw {
|
|
|
|
- max-width: 80px;
|
|
|
|
-}
|
|
|
|
</style>
|
|
</style>
|