<script lang="ts" setup>
|
import type { ErpPurchaseInvoiceApi } from '#/api/erp/purchase/invoice';
|
import type { DescriptionItemSchema } from '#/components/description';
|
|
import { onMounted, ref } from 'vue';
|
|
import { ContentWrap } from '@vben/common-ui';
|
import { erpPriceInputFormatter, formatDateTime } from '@vben/utils';
|
|
import { Spin } from 'ant-design-vue';
|
|
import { getPurchaseInvoice } from '#/api/erp/purchase/invoice';
|
import { useDescription } from '#/components/description';
|
|
defineOptions({ name: 'ErpPurchaseInvoiceApproveDetail' });
|
|
const props = defineProps<{ id: string }>();
|
|
const loading = ref(false);
|
const formData = ref<ErpPurchaseInvoiceApi.PurchaseInvoice>();
|
|
/** 文本字段空值占位 */
|
function textRender(val: unknown) {
|
return val === 0 || val ? String(val) : '-';
|
}
|
|
const [Descriptions] = useDescription({
|
bordered: true,
|
column: 2,
|
schema: [
|
{ label: '来票编号', field: 'no', render: textRender },
|
{ label: '供应商名称', field: 'supplierName', render: textRender },
|
{
|
label: '采购订单号',
|
field: 'order',
|
render: (_val, data) => (data?.order?.no ? data.order.no : '-'),
|
},
|
{ label: '发票号码', field: 'invoiceNo', render: textRender },
|
{ label: '发票抬头', field: 'invoiceTitle', render: textRender },
|
{
|
label: '来票金额(元)',
|
field: 'price',
|
render: (val) => erpPriceInputFormatter(val) || '-',
|
},
|
{
|
label: '剩余可付金额(元)',
|
field: 'remainingInvoicePrice',
|
render: (val) => erpPriceInputFormatter(val ?? 0) || '-',
|
},
|
{
|
label: '开票日期',
|
field: 'invoiceTime',
|
render: (val) => formatDateTime(val) as string,
|
},
|
{ label: '创建人', field: 'creatorName', render: textRender },
|
{
|
label: '创建时间',
|
field: 'createTime',
|
render: (val) => formatDateTime(val) as string,
|
},
|
{ label: '备注', field: 'remark', render: textRender },
|
] as DescriptionItemSchema[],
|
});
|
|
onMounted(async () => {
|
try {
|
loading.value = true;
|
formData.value = await getPurchaseInvoice(Number(props.id));
|
} finally {
|
loading.value = false;
|
}
|
});
|
</script>
|
|
<template>
|
<ContentWrap class="m-2">
|
<Spin :spinning="loading" tip="加载中...">
|
<div class="space-y-4">
|
<!-- 来票基本信息 -->
|
<div class="rounded-lg border border-border bg-background p-4">
|
<div class="mb-4 flex items-center gap-2">
|
<span class="inline-block h-4 w-1 rounded bg-primary" />
|
<span class="text-base font-semibold">来票基本信息</span>
|
</div>
|
<Descriptions :data="formData" />
|
</div>
|
</div>
|
</Spin>
|
</ContentWrap>
|
</template>
|