延迟发票上传
This commit is contained in:
1 parent
71cd34589f
commit
ea0b3e60db
1 file changed
+67
-29
@@ -1,14 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-model="visible" title="预览" width="800px" :close-on-click-modal="false" draggable destroy-on-close>
|
<el-dialog v-model="visible" title="预览" width="800px" :close-on-click-modal="false" draggable destroy-on-close>
|
||||||
<div v-loading="loading" id="receiptRef" ref="receiptRef"
|
<div v-loading="loading" id="receiptRef" ref="receiptRef" class="w-[17.5cm] h-[9.5cm] border border-gray-400 p-6 bg-[#EBE1C622]">
|
||||||
class="w-[17.5cm] h-[9.5cm] border border-gray-400 p-6 bg-[#EBE1C622]">
|
|
||||||
<div class="text-center mx-auto w-[10cm] text-3xl font-bold">浦江县行政事业单位食堂统一收款收据</div>
|
<div class="text-center mx-auto w-[10cm] text-3xl font-bold">浦江县行政事业单位食堂统一收款收据</div>
|
||||||
|
|
||||||
<div class="flex justify-between items-end mb-1">
|
<div class="flex justify-between items-end mb-1">
|
||||||
<div></div>
|
<div></div>
|
||||||
<div>
|
<div>
|
||||||
{{ formatDate(new Date(receiptData.time), "YYYY年 mm月 dd日") || " 年 月 日".replace(/ /g, " ")
|
{{ formatDate(new Date(receiptData.time), "YYYY年 mm月 dd日") || " 年 月 日".replace(/ /g, " ") }}
|
||||||
}}
|
|
||||||
</div>
|
</div>
|
||||||
<span>
|
<span>
|
||||||
<span>No. </span>
|
<span>No. </span>
|
||||||
@@ -21,9 +19,13 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="border border-gray-600 px-2 w-3/12 h-[0.75cm]">交款单位(或个人)</td>
|
<td class="border border-gray-600 px-2 w-3/12 h-[0.75cm]">交款单位(或个人)</td>
|
||||||
<td class="border border-gray-600 px-2 w-9/12 h-[0.75cm] text-sm text-blue-800" colspan="4">
|
<td class="border border-gray-600 px-2 w-9/12 h-[0.75cm] text-sm text-blue-800" colspan="4">
|
||||||
<input type="text" v-model="receiptData.deptOrUser"
|
<input
|
||||||
class="caret-red-600 w-full h-full bg-transparent text-center" ref="deptOrUserInput"
|
type="text"
|
||||||
maxlength="30" />
|
v-model="receiptData.deptOrUser"
|
||||||
|
class="caret-red-600 w-full h-full bg-transparent text-center"
|
||||||
|
ref="deptOrUserInput"
|
||||||
|
maxlength="30"
|
||||||
|
/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -60,10 +62,14 @@
|
|||||||
<td class="border border-gray-600 px-2 w-1/6 h-[0.75cm]">收款单位<br />(盖章)</td>
|
<td class="border border-gray-600 px-2 w-1/6 h-[0.75cm]">收款单位<br />(盖章)</td>
|
||||||
<td class="border border-gray-600 px-2 text-left w-1/6 h-[0.75cm] text-sm text-blue-800">
|
<td class="border border-gray-600 px-2 text-left w-1/6 h-[0.75cm] text-sm text-blue-800">
|
||||||
<!-- <input type="text" v-model="receiptData.payeeDept" class="w-full h-full bg-transparent" /> -->
|
<!-- <input type="text" v-model="receiptData.payeeDept" class="w-full h-full bg-transparent" /> -->
|
||||||
<img v-if="receiptData.stampPicUrl && visibleStampPic"
|
<img
|
||||||
class="w-[2.5cm] h-[2.5cm] absolute -top-2 left-[140px]" draggable="false"
|
v-if="receiptData.stampPicUrl && visibleStampPic"
|
||||||
|
class="w-[2.5cm] h-[2.5cm] absolute -top-2 left-[140px]"
|
||||||
|
draggable="false"
|
||||||
style="-webkit-user-drag: none; user-select: none; pointer-events: none"
|
style="-webkit-user-drag: none; user-select: none; pointer-events: none"
|
||||||
oncontextmenu="return false" src="/@/assets/receiptStamp.png" />
|
oncontextmenu="return false"
|
||||||
|
src="/@/assets/receiptStamp.png"
|
||||||
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td class="border border-gray-600 px-2 w-1/6 h-[0.75cm]">开票人<br />(签名)</td>
|
<td class="border border-gray-600 px-2 w-1/6 h-[0.75cm]">开票人<br />(签名)</td>
|
||||||
<td class="border border-gray-600 px-2 text-left w-1/6 h-[0.75cm] text-sm text-blue-800">
|
<td class="border border-gray-600 px-2 text-left w-1/6 h-[0.75cm] text-sm text-blue-800">
|
||||||
@@ -73,8 +79,11 @@
|
|||||||
<td class="border border-gray-600 px-2 text-left align-text-top w-1/3 h-[0.75cm]">
|
<td class="border border-gray-600 px-2 text-left align-text-top w-1/3 h-[0.75cm]">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<span class="whitespace-nowrap">备注:</span>
|
<span class="whitespace-nowrap">备注:</span>
|
||||||
<textarea v-model="receiptData.remark" maxlength="12"
|
<textarea
|
||||||
class="flex-1 text-sm text-blue-800 w-full h-full bg-transparent resize-none overflow-y-hidden" />
|
v-model="receiptData.remark"
|
||||||
|
maxlength="12"
|
||||||
|
class="flex-1 text-sm text-blue-800 w-full h-full bg-transparent resize-none overflow-y-hidden"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -90,20 +99,48 @@
|
|||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button @click="handleClose" :disabled="loading">关闭</el-button>
|
<el-button @click="handleClose" :disabled="loading">关闭</el-button>
|
||||||
<!-- ['2', '3'].includes(receiptData.processStatus!) && !['6'].includes(receiptData.status!) -->
|
<!-- ['2', '3'].includes(receiptData.processStatus!) && !['6'].includes(receiptData.status!) -->
|
||||||
<el-button v-if="['2', '3'].includes(receiptData.processStatus!)" v-auth="'wallet_walletRechargeApply_back'"
|
<el-button
|
||||||
type="primary" plain @click="backInvoice" :disabled="loading">
|
v-if="['2', '3'].includes(receiptData.processStatus!)"
|
||||||
|
v-auth="'wallet_walletRechargeApply_back'"
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
@click="backInvoice"
|
||||||
|
:disabled="loading"
|
||||||
|
>
|
||||||
作废
|
作废
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button v-if="!receiptData.processStatus && !['6'].includes(receiptData.status!)" type="primary"
|
<el-button
|
||||||
:disabled="loading" @click="applyStamp">申请审批</el-button>
|
v-if="!receiptData.processStatus && !['6'].includes(receiptData.status!)"
|
||||||
<el-button v-if="receiptData.processStatus == undefined && !['6'].includes(receiptData.status!)"
|
type="primary"
|
||||||
v-auth="'wallet_walletRechargeApply_receiptSave'" type="primary" @click="saveReceipt"
|
:disabled="loading"
|
||||||
:disabled="loading">保存</el-button>
|
@click="applyStamp"
|
||||||
<el-button v-if="receiptData.stampPicUrl && !['6'].includes(receiptData.status!)" type="warning"
|
>申请审批</el-button
|
||||||
@click="handlePrint" :disabled="loading">打印</el-button>
|
>
|
||||||
<el-button v-auth="'wallet_invoice_refresh'"
|
<el-button
|
||||||
v-if="receiptData.stampPicUrl && !['6'].includes(receiptData.status!)" type="primary" plain
|
v-if="receiptData.processStatus == undefined && !['6'].includes(receiptData.status!)"
|
||||||
icon="RefreshRight" @click="refreshInvoice" :disabled="refreshLoading">重新生成发票</el-button>
|
v-auth="'wallet_walletRechargeApply_receiptSave'"
|
||||||
|
type="primary"
|
||||||
|
@click="saveReceipt"
|
||||||
|
:disabled="loading"
|
||||||
|
>保存</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
v-if="receiptData.stampPicUrl && !['6'].includes(receiptData.status!)"
|
||||||
|
type="warning"
|
||||||
|
@click="handlePrint"
|
||||||
|
:disabled="loading"
|
||||||
|
>打印</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
v-auth="'wallet_invoice_refresh'"
|
||||||
|
v-if="receiptData.stampPicUrl && !['6'].includes(receiptData.status!)"
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="RefreshRight"
|
||||||
|
@click="refreshInvoice"
|
||||||
|
:disabled="refreshLoading"
|
||||||
|
>重新生成发票</el-button
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
@@ -116,10 +153,9 @@ import request from "/@/utils/request"
|
|||||||
import { formatDate } from "/@/utils/formatTime"
|
import { formatDate } from "/@/utils/formatTime"
|
||||||
import { displayPrice } from "/@/utils/formatMoney"
|
import { displayPrice } from "/@/utils/formatMoney"
|
||||||
import printJS from "print-js"
|
import printJS from "print-js"
|
||||||
import * as WalletRechargeInvoiceApi from "/@/api/wallet/wallet-recharge-invoice"
|
import * as WalletRechargeInvoiceApi from "/@/api/wallet/wallet-recharge-invoice"
|
||||||
import { useDict } from "/@/hooks/dict"
|
import { useDict } from "/@/hooks/dict"
|
||||||
|
|
||||||
|
|
||||||
interface ReceiptData {
|
interface ReceiptData {
|
||||||
id: string
|
id: string
|
||||||
itemJson: string
|
itemJson: string
|
||||||
@@ -202,20 +238,21 @@ const refreshInvoice = async () => {
|
|||||||
visibleStampPic.value = false
|
visibleStampPic.value = false
|
||||||
// 申请审批
|
// 申请审批
|
||||||
const blob = await genImage()
|
const blob = await genImage()
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1000))
|
||||||
if (!blob) return useMessage().error("图片生成失败")
|
if (!blob) return useMessage().error("图片生成失败")
|
||||||
const picUrl = await uploadImage(blob)
|
const picUrl = await uploadImage(blob)
|
||||||
if (!picUrl) return useMessage().error("图片上传失败")
|
if (!picUrl) return useMessage().error("图片上传失败")
|
||||||
|
|
||||||
const _data = {
|
const _data = {
|
||||||
id: receiptData.value.id,
|
id: receiptData.value.id,
|
||||||
picUrl: picUrl
|
picUrl: picUrl,
|
||||||
}
|
}
|
||||||
await WalletRechargeInvoiceApi.refreshInvoice(_data)
|
await WalletRechargeInvoiceApi.refreshInvoice(_data)
|
||||||
useMessage().success("重新生成发票成功")
|
useMessage().success("重新生成发票成功")
|
||||||
emit("refresh")
|
emit("refresh")
|
||||||
visible.value = false
|
visible.value = false
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
console.error(err);
|
console.error(err)
|
||||||
useMessage().error(err.msg)
|
useMessage().error(err.msg)
|
||||||
} finally {
|
} finally {
|
||||||
refreshLoading.value = false
|
refreshLoading.value = false
|
||||||
@@ -251,7 +288,7 @@ const genImage = async (): Promise<Blob | void | null> => {
|
|||||||
pixelRatio: 6,
|
pixelRatio: 6,
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(error);
|
console.error(error)
|
||||||
return useMessage().error("图片生成错误")
|
return useMessage().error("图片生成错误")
|
||||||
})
|
})
|
||||||
return blob
|
return blob
|
||||||
@@ -315,6 +352,7 @@ const applyStamp = async () => {
|
|||||||
// 申请审批
|
// 申请审批
|
||||||
const blob = await genImage()
|
const blob = await genImage()
|
||||||
if (!blob) return useMessage().error("图片生成失败")
|
if (!blob) return useMessage().error("图片生成失败")
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 1000))
|
||||||
const picUrl = await uploadImage(blob)
|
const picUrl = await uploadImage(blob)
|
||||||
if (!picUrl) return useMessage().error("图片上传失败")
|
if (!picUrl) return useMessage().error("图片上传失败")
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user