|
|
|
@ -0,0 +1,401 @@
|
|
|
|
|
<template>
|
|
|
|
|
<ContentWrap>
|
|
|
|
|
<!-- 搜索工作栏 -->
|
|
|
|
|
<el-form
|
|
|
|
|
class="-mb-15px"
|
|
|
|
|
:model="queryParams"
|
|
|
|
|
ref="queryFormRef"
|
|
|
|
|
:inline="true"
|
|
|
|
|
label-width="120px"
|
|
|
|
|
>
|
|
|
|
|
<el-form-item label="开票状态" prop="invoiceStatus">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="queryParams.invoiceStatus"
|
|
|
|
|
placeholder="请选择状态"
|
|
|
|
|
clearable
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
>
|
|
|
|
|
<el-option label="未开票" :value="0" />
|
|
|
|
|
<el-option label="开票中" :value="1" />
|
|
|
|
|
<el-option label="开票完成" :value="2" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="发票类型" prop="type">
|
|
|
|
|
<el-select v-model="queryParams.type" placeholder="" clearable class="!w-240px">
|
|
|
|
|
<el-option label="企业" :value="1" />
|
|
|
|
|
<el-option label="个人" :value="2" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="订单类型" prop="orderType">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="queryParams.orderType"
|
|
|
|
|
placeholder="请选择订单类型"
|
|
|
|
|
clearable
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
>
|
|
|
|
|
<el-option label="换电订单" :value="1" />
|
|
|
|
|
<el-option label="站外充电订单" :value="2" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="发票抬头" prop="invoiceTitle">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.invoiceTitle"
|
|
|
|
|
placeholder="请输入"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="税号" prop="dutyNumber">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.dutyNumber"
|
|
|
|
|
placeholder="请输入"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="注册地址" prop="registeredAddress">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.registeredAddress"
|
|
|
|
|
placeholder="请输入"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="开户行" prop="bankOfDeposit">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.bankOfDeposit"
|
|
|
|
|
placeholder="请输入"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="开票联系人姓名" prop="contactPerson">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.contactPerson"
|
|
|
|
|
placeholder="请输入"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="开票联系人电话" prop="contactNumber">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.contactNumber"
|
|
|
|
|
placeholder="请输入"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
|
type="number"
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="创建时间" prop="createTime">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="queryParams.createTime"
|
|
|
|
|
value-format="YYYY-MM-DD HH:mm:ss"
|
|
|
|
|
type="daterange"
|
|
|
|
|
start-placeholder="开始日期"
|
|
|
|
|
end-placeholder="结束日期"
|
|
|
|
|
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="开户行账户" prop="openBankAccount">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.openBankAccount"
|
|
|
|
|
placeholder="请输入开户行账户"
|
|
|
|
|
clearable
|
|
|
|
|
@keyup.enter="handleQuery"
|
|
|
|
|
class="!w-240px"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
|
|
|
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
|
|
|
|
<!-- <el-button
|
|
|
|
|
type="primary"
|
|
|
|
|
plain
|
|
|
|
|
@click="openForm('create')"
|
|
|
|
|
v-hasPermi="['cloud:invoice:create']"
|
|
|
|
|
>
|
|
|
|
|
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
|
|
|
|
</el-button> -->
|
|
|
|
|
<el-button
|
|
|
|
|
type="success"
|
|
|
|
|
plain
|
|
|
|
|
@click="handleExport"
|
|
|
|
|
:loading="exportLoading"
|
|
|
|
|
v-hasPermi="['cloud:invoice:export']"
|
|
|
|
|
>
|
|
|
|
|
<Icon icon="ep:download" class="mr-5px" /> 导出
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</ContentWrap>
|
|
|
|
|
|
|
|
|
|
<!-- 列表 -->
|
|
|
|
|
<ContentWrap>
|
|
|
|
|
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
|
|
|
|
<!-- <el-table-column label="id" align="center" prop="id" /> -->
|
|
|
|
|
<el-table-column label="序号" type="index" align="center" width="100" />
|
|
|
|
|
<el-table-column label="开票订单号" align="center" prop="orderNo" />
|
|
|
|
|
<!-- <el-table-column label="用户编号" align="center" prop="userId" /> -->
|
|
|
|
|
<el-table-column label="开票金额(元)" align="center" prop="actualPay">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
{{ scope.row.actualPay / 100 }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="状态" align="center" prop="invoiceStatus">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<!-- {{ ['未开票','开票中','开票完成'][scope.row.invoiceStatus] }} -->
|
|
|
|
|
<el-tag type="info" v-if="scope.row.invoiceStatus == 0">未开票</el-tag>
|
|
|
|
|
<el-tag type="danger" v-if="scope.row.invoiceStatus == 1">开票中</el-tag>
|
|
|
|
|
<el-tag type="success" v-if="scope.row.invoiceStatus == 2">开票完成</el-tag>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="发票类型" align="center" prop="type">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-tag type="info" v-if="scope.row.type == 1">企业</el-tag>
|
|
|
|
|
<el-tag type="warning" v-if="scope.row.type == 2">个人</el-tag>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="订单类型" align="center" prop="orderType">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-tag type="info" v-if="scope.row.orderType == 1">换电订单</el-tag>
|
|
|
|
|
<el-tag type="warning" v-if="scope.row.orderType == 2">站外充电订单</el-tag>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<!-- <el-table-column label="文件表id" align="center" prop="infraFileId" /> -->
|
|
|
|
|
<el-table-column label="发票抬头" align="center" prop="invoiceTitle" />
|
|
|
|
|
<el-table-column label="税号" align="center" prop="dutyNumber" />
|
|
|
|
|
<el-table-column label="注册地址" align="center" prop="registeredAddress" />
|
|
|
|
|
<el-table-column label="开户行" align="center" prop="bankOfDeposit" />
|
|
|
|
|
<el-table-column label="开票联系人姓名" align="center" prop="contactPerson" />
|
|
|
|
|
<el-table-column label="开票联系人电话" align="center" prop="contactNumber" />
|
|
|
|
|
<!-- <el-table-column label="电子邮箱" align="center" prop="emailAddress" /> -->
|
|
|
|
|
<!-- <el-table-column
|
|
|
|
|
label="创建时间"
|
|
|
|
|
align="center"
|
|
|
|
|
prop="createTime"
|
|
|
|
|
:formatter="dateFormatter"
|
|
|
|
|
width="180px"
|
|
|
|
|
/> -->
|
|
|
|
|
<el-table-column label="开户行账户" align="center" prop="openBankAccount" />
|
|
|
|
|
<el-table-column label="文件地址" align="center" prop="fileUrl" />
|
|
|
|
|
<el-table-column label="操作" align="center">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<!-- <el-button link type="primary" @click="openForm('update', scope.row.id)">
|
|
|
|
|
编辑
|
|
|
|
|
</el-button> -->
|
|
|
|
|
<!-- <el-button link type="danger" @click="handleDelete(scope.row.id)"> 删除 </el-button> -->
|
|
|
|
|
<el-button
|
|
|
|
|
link
|
|
|
|
|
type="primary"
|
|
|
|
|
@click="upload_pdf(scope.row)"
|
|
|
|
|
v-if="scope.row.invoiceStatus != 2"
|
|
|
|
|
>
|
|
|
|
|
上传发票
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
<!-- 分页 -->
|
|
|
|
|
<Pagination
|
|
|
|
|
:total="total"
|
|
|
|
|
v-model:page="queryParams.pageNo"
|
|
|
|
|
v-model:limit="queryParams.pageSize"
|
|
|
|
|
@pagination="getList"
|
|
|
|
|
/>
|
|
|
|
|
</ContentWrap>
|
|
|
|
|
<!-- -->
|
|
|
|
|
<el-dialog v-model="upload_dialogVisible" title="上传发票" width="500" center>
|
|
|
|
|
<div style="display: flex; justify-content: space-evenly">
|
|
|
|
|
<!-- <UploadImgs v-model:modelValue="upload_formData.avatar" /> -->
|
|
|
|
|
<el-upload
|
|
|
|
|
class="upload-demo"
|
|
|
|
|
ref="upload_pdf_file"
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
:headers="uploadHeaders"
|
|
|
|
|
drag
|
|
|
|
|
action="https://www.zzpower.net/admin-api/infra/file/uploadFile"
|
|
|
|
|
multiple
|
|
|
|
|
:on-success="upload_success"
|
|
|
|
|
:on-progress="upload_progress"
|
|
|
|
|
>
|
|
|
|
|
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
|
|
|
|
<div class="el-upload__text"> 拖动文件 or <em>点击上传</em> </div>
|
|
|
|
|
<!-- <template #tip>
|
|
|
|
|
<div class="el-upload__tip"> </div>
|
|
|
|
|
</template> -->
|
|
|
|
|
</el-upload>
|
|
|
|
|
</div>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<div class="dialog-footer">
|
|
|
|
|
<el-button @click="upload_dialogVisible = false">取消</el-button>
|
|
|
|
|
<el-button type="primary" @click="upload_submit"> 确认 </el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
<!-- 表单弹窗:添加/修改 -->
|
|
|
|
|
<InvoiceForm ref="formRef" @success="getList" />
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { dateFormatter } from '@/utils/formatTime'
|
|
|
|
|
import download from '@/utils/download'
|
|
|
|
|
import { InvoiceApi, InvoiceVO } from '@/api/system/orderManagement/invoice'
|
|
|
|
|
import InvoiceForm from './InvoiceForm.vue'
|
|
|
|
|
import { UploadFilled } from '@element-plus/icons-vue'
|
|
|
|
|
import { getAccessToken, getTenantId } from '@/utils/auth'
|
|
|
|
|
|
|
|
|
|
/** 开票 列表 */
|
|
|
|
|
defineOptions({ name: 'Invoice' })
|
|
|
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗
|
|
|
|
|
const { t } = useI18n() // 国际化
|
|
|
|
|
|
|
|
|
|
const loading = ref(true) // 列表的加载中
|
|
|
|
|
const list = ref<InvoiceVO[]>([]) // 列表的数据
|
|
|
|
|
const upload_pdf_file = ref(null)
|
|
|
|
|
// 列表的总页数
|
|
|
|
|
const total = ref(0)
|
|
|
|
|
const queryParams = reactive({
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
userId: undefined,
|
|
|
|
|
actualPay: undefined,
|
|
|
|
|
invoiceStatus: undefined,
|
|
|
|
|
orderNo: undefined,
|
|
|
|
|
type: undefined,
|
|
|
|
|
orderType: undefined,
|
|
|
|
|
infraFileId: undefined,
|
|
|
|
|
invoiceTitle: undefined,
|
|
|
|
|
dutyNumber: undefined,
|
|
|
|
|
registeredAddress: undefined,
|
|
|
|
|
bankOfDeposit: undefined,
|
|
|
|
|
contactPerson: undefined,
|
|
|
|
|
contactNumber: undefined,
|
|
|
|
|
emailAddress: undefined,
|
|
|
|
|
createTime: [],
|
|
|
|
|
openBankAccount: undefined
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const upload_dialogVisible = ref(false) // 上传发票的弹窗
|
|
|
|
|
const upload_formData = ref({})
|
|
|
|
|
const queryFormRef = ref() // 搜索的表单
|
|
|
|
|
const exportLoading = ref(false) // 导出的加载中
|
|
|
|
|
const uploadHeaders = ref({
|
|
|
|
|
Authorization: 'Bearer ' + getAccessToken(),
|
|
|
|
|
'tenant-id': getTenantId()
|
|
|
|
|
})
|
|
|
|
|
/** 查询列表 */
|
|
|
|
|
const getList = async () => {
|
|
|
|
|
loading.value = true
|
|
|
|
|
console.log(queryParams, 'queryParams')
|
|
|
|
|
try {
|
|
|
|
|
const data = await InvoiceApi.getInvoicePage(queryParams)
|
|
|
|
|
list.value = data.list
|
|
|
|
|
total.value = data.total
|
|
|
|
|
} finally {
|
|
|
|
|
loading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
|
const handleQuery = () => {
|
|
|
|
|
queryParams.pageNo = 1
|
|
|
|
|
getList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
|
const resetQuery = () => {
|
|
|
|
|
queryFormRef.value.resetFields()
|
|
|
|
|
handleQuery()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 添加/修改操作 */
|
|
|
|
|
const formRef = ref()
|
|
|
|
|
const openForm = (type: string, id?: number) => {
|
|
|
|
|
formRef.value.open(type, id)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
|
const handleDelete = async (id: number) => {
|
|
|
|
|
try {
|
|
|
|
|
// 删除的二次确认
|
|
|
|
|
await message.delConfirm()
|
|
|
|
|
// 发起删除
|
|
|
|
|
await InvoiceApi.deleteInvoice(id)
|
|
|
|
|
message.success(t('common.delSuccess'))
|
|
|
|
|
// 刷新列表
|
|
|
|
|
await getList()
|
|
|
|
|
} catch {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 导出按钮操作 */
|
|
|
|
|
const handleExport = async () => {
|
|
|
|
|
try {
|
|
|
|
|
// 导出的二次确认
|
|
|
|
|
await message.exportConfirm()
|
|
|
|
|
// 发起导出
|
|
|
|
|
exportLoading.value = true
|
|
|
|
|
const data = await InvoiceApi.exportInvoice(queryParams)
|
|
|
|
|
download.excel(data, '开票.xls')
|
|
|
|
|
} catch {
|
|
|
|
|
} finally {
|
|
|
|
|
exportLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const upload_pdf = (row: any) => {
|
|
|
|
|
console.log(row)
|
|
|
|
|
|
|
|
|
|
// console.log(id)
|
|
|
|
|
upload_formData.value = row
|
|
|
|
|
upload_dialogVisible.value = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const upload_submit = async () => {
|
|
|
|
|
// let queryParams = { ...upload_formData }
|
|
|
|
|
loading.value = true
|
|
|
|
|
try {
|
|
|
|
|
upload_formData.value.invoiceStatus = 2
|
|
|
|
|
await InvoiceApi.updateInvoice(upload_formData.value)
|
|
|
|
|
message.success('上传成功')
|
|
|
|
|
} finally {
|
|
|
|
|
loading.value = false
|
|
|
|
|
}
|
|
|
|
|
upload_dialogVisible.value = false
|
|
|
|
|
upload_pdf_file.value.clearFiles()
|
|
|
|
|
getList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const upload_success = (res: any, file: any) => {
|
|
|
|
|
// console.log(res, file)
|
|
|
|
|
upload_formData.value.infraFileId = res.data.id
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const upload_progress = (ev: any, file: any) => {
|
|
|
|
|
// console.log(ev, file)
|
|
|
|
|
// console.log(file.raw.type, 'leixing ')
|
|
|
|
|
if (file.raw.type != 'application/pdf') {
|
|
|
|
|
message.error('请上传pdf格式文件')
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
upload_pdf_file.value.clearFiles()
|
|
|
|
|
upload_dialogVisible.value = false
|
|
|
|
|
}, 2000)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 初始化 **/
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
getList()
|
|
|
|
|
})
|
|
|
|
|
</script>
|