通用开票/查询接口
This commit is contained in:
@@ -391,6 +391,7 @@ export interface PageResult<T> {
|
||||
/** 发票历史记录 */
|
||||
export interface InvoiceHistoryItem {
|
||||
id: string
|
||||
batchNo?: string
|
||||
/** 发票请求流水号 */
|
||||
invoiceReqSerialNo: string
|
||||
/** 销方税号 */
|
||||
@@ -558,11 +559,15 @@ export const invoiceStatusColorMap: Record<string, string> = {
|
||||
export function invoiceHistoryApi(
|
||||
page: number,
|
||||
pageSize: number,
|
||||
params?: { invoiceType?: string; isSuccess?: boolean }
|
||||
params?: { invoiceType?: string; isSuccess?: boolean; batchNo?: string }
|
||||
): Promise<PageResult<InvoiceHistoryItem>> {
|
||||
return http.get('/pt/invoiceBlueHistory', { params: { page, pageSize, ...params } })
|
||||
}
|
||||
|
||||
export function invoiceBatchNosApi(): Promise<string[]> {
|
||||
return http.get('/pt/invoiceBatchNos')
|
||||
}
|
||||
|
||||
// =============================================
|
||||
// 发票详情
|
||||
// =============================================
|
||||
|
||||
@@ -22,6 +22,14 @@
|
||||
</button>
|
||||
</div>
|
||||
<div class="surface-filters">
|
||||
<n-select
|
||||
v-model:value="selectedBatchNo"
|
||||
:options="batchNoOptions"
|
||||
clearable
|
||||
placeholder="批次号"
|
||||
style="width: 180px"
|
||||
@update:value="handleFilterChange"
|
||||
/>
|
||||
<n-select
|
||||
v-model:value="selectedStatus"
|
||||
:options="statusFilterOptions"
|
||||
@@ -481,6 +489,7 @@ import {
|
||||
RotateCcw
|
||||
} from 'lucide-vue-next'
|
||||
import {
|
||||
invoiceBatchNosApi,
|
||||
invoiceDownloadUrlApi,
|
||||
invoicePreviewBlobApi,
|
||||
invoiceDetailApi,
|
||||
@@ -566,6 +575,8 @@ function statusTagType(status: string): 'warning' | 'info' | 'success' | 'error'
|
||||
|
||||
const activeTab = ref('BLUE')
|
||||
const selectedStatus = ref<string | null>(null)
|
||||
const selectedBatchNo = ref<string | null>(null)
|
||||
const batchNoOptions = ref<Array<{ label: string; value: string }>>([])
|
||||
|
||||
const statusFilterOptions = [
|
||||
{ label: '全部', value: '' },
|
||||
@@ -579,12 +590,17 @@ const TAB_FILTERS: Record<string, { invoiceType: string }> = {
|
||||
}
|
||||
|
||||
function getFilterParams() {
|
||||
const params: { invoiceType: string; isSuccess?: boolean } = { ...TAB_FILTERS[activeTab.value] }
|
||||
const params: { invoiceType: string; isSuccess?: boolean; batchNo?: string } = {
|
||||
...TAB_FILTERS[activeTab.value]
|
||||
}
|
||||
if (selectedStatus.value === 'SUCCESS') {
|
||||
params.isSuccess = true
|
||||
} else if (selectedStatus.value === 'NOT_SUCCESS') {
|
||||
params.isSuccess = false
|
||||
}
|
||||
if (selectedBatchNo.value) {
|
||||
params.batchNo = selectedBatchNo.value
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
@@ -605,10 +621,20 @@ function handleFilterChange() {
|
||||
|
||||
function handleReset() {
|
||||
selectedStatus.value = null
|
||||
selectedBatchNo.value = null
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
}
|
||||
|
||||
async function fetchBatchNoOptions() {
|
||||
try {
|
||||
const res = await invoiceBatchNosApi()
|
||||
batchNoOptions.value = res.map((batchNo) => ({ label: batchNo, value: batchNo }))
|
||||
} catch {
|
||||
batchNoOptions.value = []
|
||||
}
|
||||
}
|
||||
|
||||
const message = useMessage()
|
||||
const loading = ref(false)
|
||||
const dataSource = ref<InvoiceHistoryItem[]>([])
|
||||
@@ -749,6 +775,16 @@ const columns = computed<DataTableColumns<InvoiceHistoryItem>>(() => {
|
||||
row.invoiceReqSerialNo
|
||||
)
|
||||
},
|
||||
{
|
||||
title: '批次',
|
||||
key: 'batchNo',
|
||||
width: 180,
|
||||
ellipsis: { tooltip: true },
|
||||
render: (row: InvoiceHistoryItem) =>
|
||||
row.batchNo
|
||||
? h(NTag, { size: 'small', round: true, type: 'info' }, () => row.batchNo)
|
||||
: h('span', { style: 'color:#9ca3af' }, '-')
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
key: 'status',
|
||||
@@ -1078,6 +1114,7 @@ const voucherColumns: DataTableColumns<InvoiceDetailVoucher> = [
|
||||
]
|
||||
|
||||
onMounted(() => {
|
||||
fetchBatchNoOptions()
|
||||
fetchData()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -76,6 +76,9 @@
|
||||
<n-form-item label="邮箱" path="email">
|
||||
<n-input v-model:value="editForm.email" />
|
||||
</n-form-item>
|
||||
<n-form-item v-if="editModal.mode === 'edit'" label="API Key">
|
||||
<n-input v-model:value="editForm.apiKey" readonly />
|
||||
</n-form-item>
|
||||
<n-form-item v-if="editModal.mode === 'create'" label="状态" path="status">
|
||||
<n-radio-group v-model:value="editForm.status">
|
||||
<n-radio-button value="ENABLED">启用</n-radio-button>
|
||||
@@ -237,6 +240,7 @@ const editForm = reactive({
|
||||
realName: '',
|
||||
phone: '',
|
||||
email: '',
|
||||
apiKey: '',
|
||||
status: 'ENABLED'
|
||||
})
|
||||
|
||||
@@ -357,6 +361,7 @@ function resetEditForm() {
|
||||
editForm.realName = ''
|
||||
editForm.phone = ''
|
||||
editForm.email = ''
|
||||
editForm.apiKey = ''
|
||||
editForm.status = 'ENABLED'
|
||||
}
|
||||
|
||||
@@ -379,6 +384,7 @@ async function openEdit(row: UserListItem) {
|
||||
editForm.realName = detail.realName ?? ''
|
||||
editForm.phone = detail.phone ?? ''
|
||||
editForm.email = detail.email ?? ''
|
||||
editForm.apiKey = detail.apiKey ?? ''
|
||||
editForm.status = detail.status
|
||||
editModal.visible = true
|
||||
}
|
||||
@@ -445,6 +451,13 @@ const columns = computed<DataTableColumns<UserListItem>>(() => [
|
||||
minWidth: 180,
|
||||
render: (row) => (row.roleCodes.length > 0 ? row.roleCodes.join(', ') : '-')
|
||||
},
|
||||
{
|
||||
title: 'API Key',
|
||||
key: 'apiKey',
|
||||
minWidth: 220,
|
||||
ellipsis: { tooltip: true },
|
||||
render: (row) => row.apiKey || '-'
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
key: 'status',
|
||||
|
||||
@@ -9,6 +9,7 @@ export interface UserListItem {
|
||||
status: string
|
||||
statusLabel?: string
|
||||
roleCodes: string[]
|
||||
apiKey?: string | null
|
||||
}
|
||||
|
||||
export interface UserDetail {
|
||||
@@ -23,6 +24,7 @@ export interface UserDetail {
|
||||
status: string
|
||||
statusLabel?: string
|
||||
roleIds: string[]
|
||||
apiKey?: string | null
|
||||
taxpayerNum?: string | null
|
||||
account?: string | null
|
||||
taxPassword?: string | null
|
||||
|
||||
Reference in New Issue
Block a user