|
@@ -2,39 +2,30 @@
|
|
|
<div class="page-container">
|
|
<div class="page-container">
|
|
|
<PageTitle title="开票管理" />
|
|
<PageTitle title="开票管理" />
|
|
|
|
|
|
|
|
- <SearchBar :form="searchForm" :filters="filters" placeholder="对账编号" />
|
|
|
|
|
|
|
+ <SearchBar :form="searchForm" :filters="filters" placeholder="开票编号" />
|
|
|
|
|
|
|
|
- <el-table v-loading="loading" :data="tableData" border style="width: 100%" @selection-change="handleSelectionChange">
|
|
|
|
|
- <el-table-column type="selection" width="55" align="center" />
|
|
|
|
|
- <el-table-column prop="billNo" label="对账编号" min-width="130" align="center" />
|
|
|
|
|
- <el-table-column prop="billDate" label="对账日期" min-width="110" align="center" />
|
|
|
|
|
- <el-table-column prop="amount" label="对账单金额" min-width="110" align="center">
|
|
|
|
|
|
|
+ <el-table v-loading="loading" :data="tableData" border style="width: 100%">
|
|
|
|
|
+ <el-table-column prop="statementInvoiceNo" label="开票编号" min-width="130" align="center" />
|
|
|
|
|
+ <el-table-column prop="invoiceTime" label="开票时间" min-width="110" align="center">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <span>{{ parseTime(scope.row.invoiceTime, '{y}-{m}-{d}') }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column prop="customerName" label="客户名称" min-width="110" align="center" />
|
|
|
|
|
+ <el-table-column prop="amount" label="开票金额" min-width="110" align="center">
|
|
|
<template #default="{ row }">¥{{ row.amount.toFixed(2) }}</template>
|
|
<template #default="{ row }">¥{{ row.amount.toFixed(2) }}</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column prop="billStatus" label="对账状态" min-width="90" align="center">
|
|
|
|
|
|
|
+ <el-table-column prop="invoiceStatus" label="开票状态" min-width="90" align="center">
|
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
|
- {{ getDictLabel(statement_status, row.billStatus) }}
|
|
|
|
|
|
|
+ {{ getDictLabel(invoice_status, row.invoiceStatus) }}
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" width="100" align="center">
|
|
<el-table-column label="操作" width="100" align="center">
|
|
|
- <!-- <template #default="{ row }">
|
|
|
|
|
|
|
+ <template #default="{ row }">
|
|
|
<el-button type="primary" link size="small" @click="handleView(row)">查看</el-button>
|
|
<el-button type="primary" link size="small" @click="handleView(row)">查看</el-button>
|
|
|
- </template> -->
|
|
|
|
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
|
-
|
|
|
|
|
- <div class="bottom-bar">
|
|
|
|
|
- <div class="summary">
|
|
|
|
|
- <span
|
|
|
|
|
- >已选择 <em>{{ selectedCount }}</em> 个对账单</span
|
|
|
|
|
- >
|
|
|
|
|
- <span class="total"
|
|
|
|
|
- >合计金额 <em>¥{{ totalAmount.toFixed(2) }}</em></span
|
|
|
|
|
- >
|
|
|
|
|
- <el-button type="primary" :disabled="selectedCount === 0" @click="handleApplyInvoice">申请开票</el-button>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
-
|
|
|
|
|
<div class="pagination-wrapper">
|
|
<div class="pagination-wrapper">
|
|
|
<TablePagination v-model:page="pagination.page" v-model:pageSize="pagination.pageSize" :total="pagination.total" />
|
|
<TablePagination v-model:page="pagination.page" v-model:pageSize="pagination.pageSize" :total="pagination.total" />
|
|
|
</div>
|
|
</div>
|
|
@@ -44,14 +35,11 @@
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import { reactive, ref, computed, onMounted, watch } from 'vue';
|
|
import { reactive, ref, computed, onMounted, watch } from 'vue';
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
|
|
|
|
+import { useRouter } from 'vue-router';
|
|
|
import { PageTitle, SearchBar, TablePagination } from '@/components';
|
|
import { PageTitle, SearchBar, TablePagination } from '@/components';
|
|
|
-import { getStatementList, applyForInvoice } from '@/api/pc/enterprise/statement';
|
|
|
|
|
-import type { StatementOrder } from '@/api/pc/enterprise/statementTypes';
|
|
|
|
|
-import { get } from 'http';
|
|
|
|
|
|
|
+import { getStatementInvoiceList } from '@/api/pc/enterprise/statement';
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
-const { invoice_issuance_status, statement_status, payment_status } = toRefs<any>(
|
|
|
|
|
- proxy?.useDict('invoice_issuance_status', 'statement_status', 'payment_status')
|
|
|
|
|
-);
|
|
|
|
|
|
|
+const { invoice_status } = toRefs<any>(proxy?.useDict('invoice_issuance_status', 'statement_status', 'invoice_status'));
|
|
|
const searchForm = reactive({
|
|
const searchForm = reactive({
|
|
|
keyword: '',
|
|
keyword: '',
|
|
|
dateRange: [],
|
|
dateRange: [],
|
|
@@ -68,28 +56,26 @@ const filters = ref([{ field: 'invoiceStatus', label: '开票状态', options: i
|
|
|
const pagination = reactive({ page: 1, pageSize: 5, total: 0 });
|
|
const pagination = reactive({ page: 1, pageSize: 5, total: 0 });
|
|
|
const tableData = ref<any[]>([]);
|
|
const tableData = ref<any[]>([]);
|
|
|
const loading = ref(false);
|
|
const loading = ref(false);
|
|
|
-const selectedRows = ref<any[]>([]);
|
|
|
|
|
-
|
|
|
|
|
|
|
+const router = useRouter();
|
|
|
// 加载对账单列表
|
|
// 加载对账单列表
|
|
|
-const loadStatementList = async () => {
|
|
|
|
|
|
|
+const loadStatementInvoice = async () => {
|
|
|
try {
|
|
try {
|
|
|
loading.value = true;
|
|
loading.value = true;
|
|
|
- const res = await getStatementList({
|
|
|
|
|
|
|
+ const res = await getStatementInvoiceList({
|
|
|
pageNum: pagination.page,
|
|
pageNum: pagination.page,
|
|
|
pageSize: pagination.pageSize,
|
|
pageSize: pagination.pageSize,
|
|
|
- statementOrderNo: searchForm.keyword,
|
|
|
|
|
- isInvoiceStatus: searchForm.invoiceStatus,
|
|
|
|
|
- statementStatus: '2'
|
|
|
|
|
|
|
+ statementInvoiceNo: searchForm.keyword,
|
|
|
|
|
+ isInvoiceStatus: searchForm.invoiceStatus
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
if (res.code === 200 && res.rows) {
|
|
if (res.code === 200 && res.rows) {
|
|
|
- tableData.value = res.rows.map((item: StatementOrder) => ({
|
|
|
|
|
|
|
+ tableData.value = res.rows.map((item: any) => ({
|
|
|
id: item.id,
|
|
id: item.id,
|
|
|
- billNo: item.statementOrderNo,
|
|
|
|
|
- billDate: item.statementDate,
|
|
|
|
|
- amount: parseFloat(item.amount as any) || 0,
|
|
|
|
|
- billStatus: item.statementStatus,
|
|
|
|
|
- invoiceStatus: item.isInvoiceStatus,
|
|
|
|
|
|
|
+ statementInvoiceNo: item.statementInvoiceNo,
|
|
|
|
|
+ invoiceTime: item.invoiceTime,
|
|
|
|
|
+ customerName: item.customerName,
|
|
|
|
|
+ amount: parseFloat(item.invoiceAmount as any) || 0,
|
|
|
|
|
+ invoiceStatus: item.invoiceStatus,
|
|
|
payStatus: item.isPaymentStatus
|
|
payStatus: item.isPaymentStatus
|
|
|
}));
|
|
}));
|
|
|
pagination.total = res.total || 0;
|
|
pagination.total = res.total || 0;
|
|
@@ -112,7 +98,7 @@ const getDictLabel = (dictOptions: any[], value: string) => {
|
|
|
watch(
|
|
watch(
|
|
|
() => [pagination.page, pagination.pageSize],
|
|
() => [pagination.page, pagination.pageSize],
|
|
|
() => {
|
|
() => {
|
|
|
- loadStatementList();
|
|
|
|
|
|
|
+ loadStatementInvoice();
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
|
|
|
|
@@ -121,76 +107,18 @@ watch(
|
|
|
() => [searchForm.keyword, searchForm.invoiceStatus],
|
|
() => [searchForm.keyword, searchForm.invoiceStatus],
|
|
|
() => {
|
|
() => {
|
|
|
pagination.page = 1;
|
|
pagination.page = 1;
|
|
|
- loadStatementList();
|
|
|
|
|
|
|
+ loadStatementInvoice();
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
-// // 加载字典数据
|
|
|
|
|
-// const loadDictData = async () => {
|
|
|
|
|
-// try {
|
|
|
|
|
-// const res = await getDictByType('invoice_issuance_status');
|
|
|
|
|
-// if (res.data) {
|
|
|
|
|
-// invoiceStatusOptions.value = [
|
|
|
|
|
-// { label: '全部', value: '' },
|
|
|
|
|
-// ...res.data.map((item) => ({
|
|
|
|
|
-// label: item.dictLabel,
|
|
|
|
|
-// value: item.dictValue
|
|
|
|
|
-// }))
|
|
|
|
|
-// ];
|
|
|
|
|
-// filters.value[0].options = invoiceStatusOptions.value;
|
|
|
|
|
-// }
|
|
|
|
|
-// } catch (error) {
|
|
|
|
|
-// console.error('加载字典数据失败:', error);
|
|
|
|
|
-// }
|
|
|
|
|
-// };
|
|
|
|
|
-
|
|
|
|
|
// 页面加载时获取数据
|
|
// 页面加载时获取数据
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
// loadDictData();
|
|
// loadDictData();
|
|
|
- loadStatementList();
|
|
|
|
|
-});
|
|
|
|
|
-
|
|
|
|
|
-// 处理选择变化
|
|
|
|
|
-const handleSelectionChange = (selection: any[]) => {
|
|
|
|
|
- selectedRows.value = selection;
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
-// 计算选中数量
|
|
|
|
|
-const selectedCount = computed(() => selectedRows.value.length);
|
|
|
|
|
-
|
|
|
|
|
-// 计算总金额
|
|
|
|
|
-const totalAmount = computed(() => {
|
|
|
|
|
- return selectedRows.value.reduce((sum, item) => sum + item.amount, 0);
|
|
|
|
|
|
|
+ loadStatementInvoice();
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const handleView = (row: any) => {
|
|
const handleView = (row: any) => {
|
|
|
- ElMessage.info(`查看对账单:${row.billNo}`);
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
-const handleApplyInvoice = async () => {
|
|
|
|
|
- try {
|
|
|
|
|
- form.statementOrderIds = selectedRows.value.map((row) => row.id);
|
|
|
|
|
- if (!form.statementOrderIds) {
|
|
|
|
|
- ElMessage.warning('请选择要申请的对账单');
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- const billNos = selectedRows.value.map((row) => row.billNo).join('、');
|
|
|
|
|
- await ElMessageBox.confirm(`确定要为以下对账单申请开票吗?\n${billNos}`, '提示', {
|
|
|
|
|
- confirmButtonText: '确定',
|
|
|
|
|
- cancelButtonText: '取消',
|
|
|
|
|
- type: 'warning'
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- // TODO: 调用申请开票接口
|
|
|
|
|
- await applyForInvoice(form);
|
|
|
|
|
- ElMessage.success('申请开票成功');
|
|
|
|
|
- loadStatementList();
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- if (error !== 'cancel') {
|
|
|
|
|
- console.error('申请开票失败:', error);
|
|
|
|
|
- ElMessage.error('申请开票失败');
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ router.push(`/reconciliation/invoiceManage/detail?id=${row.id}`);
|
|
|
};
|
|
};
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|