发票调整

This commit is contained in:
weiwei committed 2025-06-26 17:33:40 +08:00
1 parent db86a920ca
commit 66a72d550f
2 files changed
+22 -24

No files matched your search

@@ -82,7 +82,7 @@
:loading="getReceiptDataLoading"
@click="previewInvoice(row)"
>
开发票
查看发票
</el-button>
<el-button icon="delete" text type="primary" v-auth="'wallet_walletRechargeInvoice_del'" @click="handleDelete([row.id])">
删除
@@ -62,7 +62,7 @@
<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" /> -->
<img
v-if="isShowStamp"
v-if="receiptData.picUrl"
class="w-[2.5cm] h-[2.5cm] absolute -top-2 left-[140px]"
:class="{ stamping: isStamping }"
draggable="false"
@@ -71,7 +71,7 @@
src="/@/assets/receiptStamp.png"
/>
</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">
<!-- <input type="text" v-model="receiptData.payeeUser" class="w-full h-full bg-transparent" /> -->
{{ receiptData.payeeUser }}
@@ -97,8 +97,8 @@
<div class="h-6">
<el-progress
:percentage="saveProgress"
v-if="saveProgress > 10"
:percentage="progressPercent"
v-if="progressPercent > 30"
:stroke-width="6"
status="success"
striped
@@ -110,7 +110,7 @@
<template #footer>
<el-button @click="handleClose" :disabled="loading">关闭</el-button>
<el-button v-auth="'wallet_walletRechargeApply_receiptStamp'" type="primary" @click="stampReceipt" :disabled="loading">
盖章保存
盖章
</el-button>
<el-button v-auth="'wallet_walletRechargeApply_receiptSave'" type="primary" @click="saveReceipt" :disabled="loading">保存</el-button>
<el-button v-if="receiptData.picUrl" type="primary" @click="handlePrint" :disabled="loading">打印</el-button>
@@ -148,9 +148,8 @@ const visible = ref(false)
const loading = ref(false)
const receiptRef = ref<HTMLElement | null>(null)
const deptOrUserInput = ref<HTMLInputElement | null>(null)
const timer = ref<any>(null)
const isStamping = ref(false)
const isShowStamp = ref(false)
let timer = null
const isStamping = ref(false) // 盖章动画开关
const receiptData = ref<ReceiptData>({
itemJson: "", // 款项json
code: "", // 发票代码(七位数)
@@ -159,12 +158,12 @@ const receiptData = ref<ReceiptData>({
totalPrice: "", // 合计人民币
totalPriceCnStr: "", // 合计人民币大写
payeeDept: "", // 收款单位
payeeUser: "", // 收款人
payeeUser: "", // 开票人
remark: "", // 备注
picUrl: "", // 发票图片地址
})
const applyId = ref<any>()
const saveProgress = ref(10)
const applyId = ref<string>()
const progressPercent = ref(30)
const receiptDataItems = computed(() => {
try {
const itemJson = JSON.parse(receiptData.value.itemJson)
@@ -178,22 +177,19 @@ const receiptDataItems = computed(() => {
})
const totalPrice = computed(() => displayPrice(receiptData.value.totalPrice))
const openDialog = (data: ReceiptData, id: any) => {
isShowStamp.value = false
if (data.picUrl) isShowStamp.value = true
const openDialog = (data: ReceiptData, id: string) => {
visible.value = true
receiptData.value = data
applyId.value = id
isStamping.value = false
setTimeout(() => {
timer = setTimeout(() => {
deptOrUserInput.value?.focus()
}, 50)
}
const handleClose = () => {
visible.value = false
timer.value = null
timer = null
}
// 生成图片并上传
@@ -219,17 +215,21 @@ const genImageUpload = async (): Promise<string | void> => {
data: formData,
onUploadProgress: (progressEvent: any) => {
if (progressEvent.lengthComputable) {
saveProgress.value = Math.round((progressEvent.loaded * 100) / progressEvent.total)
progressPercent.value = Math.round((progressEvent.loaded * 100) / progressEvent.total)
}
},
})
if (code == 0) return data.url
if (code == 0) {
useMessage().success("盖章成功")
return data.url
}
useMessage().error(data.msg || "上传失败")
} catch (error) {
useMessage().error(error as string)
} finally {
loading.value = false
saveProgress.value = 10
progressPercent.value = 30
isStamping.value = false
}
}
}
@@ -238,10 +238,9 @@ const genImageUpload = async (): Promise<string | void> => {
// 盖章并上传发票图片并保存
const stampReceipt = () => {
loading.value = true
isShowStamp.value = true
isStamping.value = true
setTimeout(async () => {
timer = setTimeout(async () => {
const url = await genImageUpload()
if (url) {
receiptData.value.picUrl = url
@@ -269,7 +268,6 @@ const saveReceipt = async () => {
useMessage().error(err as string)
} finally {
loading.value = false
isStamping.value = false
}
}