|
@@ -35,6 +35,7 @@ import {
|
|
|
import { renderAsync } from 'docx-preview'
|
|
import { renderAsync } from 'docx-preview'
|
|
|
import VuePdfEmbed from 'vue-pdf-embed'
|
|
import VuePdfEmbed from 'vue-pdf-embed'
|
|
|
import { clientGet, clientPost } from '@/utils/request.ts'
|
|
import { clientGet, clientPost } from '@/utils/request.ts'
|
|
|
|
|
+import { BaseResponse, PageType } from '@/utils/types.ts' // 新增:导入BaseResponse和PageType
|
|
|
|
|
|
|
|
// 接口定义
|
|
// 接口定义
|
|
|
export interface AContractInfo {
|
|
export interface AContractInfo {
|
|
@@ -144,7 +145,7 @@ const currentReceiptContractNumber = ref('')
|
|
|
// 收据表单数据
|
|
// 收据表单数据
|
|
|
const receiptForm = reactive<ReceiptDto>({
|
|
const receiptForm = reactive<ReceiptDto>({
|
|
|
paymentUnit: '',
|
|
paymentUnit: '',
|
|
|
- paymentMethod: '现金',
|
|
|
|
|
|
|
+ paymentMethod: '转账',
|
|
|
rmb: 0,
|
|
rmb: 0,
|
|
|
yj: 0,
|
|
yj: 0,
|
|
|
zj: 0,
|
|
zj: 0,
|
|
@@ -172,10 +173,8 @@ const returnReceiptForm = reactive<ReturnReceiptDto>({
|
|
|
|
|
|
|
|
// 付款方式选项
|
|
// 付款方式选项
|
|
|
const paymentMethods = [
|
|
const paymentMethods = [
|
|
|
- { label: '现金', value: '现金' },
|
|
|
|
|
- { label: '银行转账', value: '银行转账' },
|
|
|
|
|
- { label: '支付宝', value: '支付宝' },
|
|
|
|
|
- { label: '微信支付', value: '微信支付' },
|
|
|
|
|
|
|
+ { label: '转账', value: '转账' },
|
|
|
|
|
+ { label: '扫码', value: '扫码' },
|
|
|
{ label: '其他', value: '其他' },
|
|
{ label: '其他', value: '其他' },
|
|
|
]
|
|
]
|
|
|
|
|
|
|
@@ -583,7 +582,7 @@ const openReceiptDialog = async (contractId: string, contractNumber: string) =>
|
|
|
// 重置表单
|
|
// 重置表单
|
|
|
Object.assign(receiptForm, {
|
|
Object.assign(receiptForm, {
|
|
|
paymentUnit: '',
|
|
paymentUnit: '',
|
|
|
- paymentMethod: '现金',
|
|
|
|
|
|
|
+ paymentMethod: '转账',
|
|
|
rmb: 0,
|
|
rmb: 0,
|
|
|
yj: 0,
|
|
yj: 0,
|
|
|
zj: 0,
|
|
zj: 0,
|
|
@@ -647,10 +646,30 @@ const generateReceipt = async () => {
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
receiptGenerating.value = true
|
|
receiptGenerating.value = true
|
|
|
-
|
|
|
|
|
const response = await gainReceipt(currentReceiptContractId.value, receiptForm)
|
|
const response = await gainReceipt(currentReceiptContractId.value, receiptForm)
|
|
|
|
|
|
|
|
- if (response.code === 200 && response.data) {
|
|
|
|
|
|
|
+ if (response.code === 999) {
|
|
|
|
|
+ // 收据已存在,让用户选择是否预览
|
|
|
|
|
+ ElMessage.success('收据已存在!')
|
|
|
|
|
+ receiptVisible.value = false
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ await ElMessageBox.confirm(
|
|
|
|
|
+ `合同 ${currentReceiptContractNumber.value} 的收据已存在,是否要预览该收据?`,
|
|
|
|
|
+ '收据已存在',
|
|
|
|
|
+ {
|
|
|
|
|
+ confirmButtonText: '预览收据',
|
|
|
|
|
+ cancelButtonText: '不预览',
|
|
|
|
|
+ type: 'info',
|
|
|
|
|
+ },
|
|
|
|
|
+ )
|
|
|
|
|
+ // 用户选择预览
|
|
|
|
|
+ await previewDocument(response.data, `${currentReceiptContractNumber.value} - 收据`)
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ // 用户选择不预览,不做任何操作
|
|
|
|
|
+ console.log('用户选择不预览收据')
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (response.code === 200 && response.data) {
|
|
|
ElMessage.success('收据生成成功!')
|
|
ElMessage.success('收据生成成功!')
|
|
|
// 自动预览生成的收据
|
|
// 自动预览生成的收据
|
|
|
const receiptUrl = response.data
|
|
const receiptUrl = response.data
|
|
@@ -678,7 +697,7 @@ const closeReceiptDialog = () => {
|
|
|
// 重置表单
|
|
// 重置表单
|
|
|
Object.assign(receiptForm, {
|
|
Object.assign(receiptForm, {
|
|
|
paymentUnit: '',
|
|
paymentUnit: '',
|
|
|
- paymentMethod: '现金',
|
|
|
|
|
|
|
+ paymentMethod: '转账',
|
|
|
rmb: 0,
|
|
rmb: 0,
|
|
|
yj: 0,
|
|
yj: 0,
|
|
|
zj: 0,
|
|
zj: 0,
|
|
@@ -794,13 +813,33 @@ const generateReturnReceipt = async () => {
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
returnReceiptGenerating.value = true
|
|
returnReceiptGenerating.value = true
|
|
|
-
|
|
|
|
|
const response = await gainReturnReceipt(
|
|
const response = await gainReturnReceipt(
|
|
|
currentReturnReceiptContractId.value,
|
|
currentReturnReceiptContractId.value,
|
|
|
returnReceiptForm,
|
|
returnReceiptForm,
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- if (response.code === 200 && response.data) {
|
|
|
|
|
|
|
+ if (response.code === 999) {
|
|
|
|
|
+ // 退据已存在,让用户选择是否预览
|
|
|
|
|
+ ElMessage.success('退据已存在!')
|
|
|
|
|
+ returnReceiptVisible.value = false
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ await ElMessageBox.confirm(
|
|
|
|
|
+ `合同 ${currentReturnReceiptContractNumber.value} 的退据已存在,是否要预览该退据?`,
|
|
|
|
|
+ '退据已存在',
|
|
|
|
|
+ {
|
|
|
|
|
+ confirmButtonText: '预览退据',
|
|
|
|
|
+ cancelButtonText: '不预览',
|
|
|
|
|
+ type: 'info',
|
|
|
|
|
+ },
|
|
|
|
|
+ )
|
|
|
|
|
+ // 用户选择预览
|
|
|
|
|
+ await previewDocument(response.data, `${currentReturnReceiptContractNumber.value} - 退据`)
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ // 用户选择不预览,不做任何操作
|
|
|
|
|
+ console.log('用户选择不预览退据')
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (response.code === 200 && response.data) {
|
|
|
ElMessage.success('退据生成成功!')
|
|
ElMessage.success('退据生成成功!')
|
|
|
// 自动预览生成的退据
|
|
// 自动预览生成的退据
|
|
|
const returnReceiptUrl = response.data
|
|
const returnReceiptUrl = response.data
|
|
@@ -978,24 +1017,28 @@ onMounted(() => {
|
|
|
<ElTableColumn label="操作" width="160" fixed="right">
|
|
<ElTableColumn label="操作" width="160" fixed="right">
|
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
|
<div class="flex flex-col gap-1">
|
|
<div class="flex flex-col gap-1">
|
|
|
- <ElButton
|
|
|
|
|
- type="primary"
|
|
|
|
|
- size="small"
|
|
|
|
|
- text
|
|
|
|
|
- :icon="Receipt"
|
|
|
|
|
- @click="openReceiptDialog(row.id, row.contractNumber)"
|
|
|
|
|
- >
|
|
|
|
|
- 获取收据
|
|
|
|
|
- </ElButton>
|
|
|
|
|
- <ElButton
|
|
|
|
|
- type="warning"
|
|
|
|
|
- size="small"
|
|
|
|
|
- text
|
|
|
|
|
- :icon="RotateCcw"
|
|
|
|
|
- @click="openReturnReceiptDialog(row.id, row.contractNumber)"
|
|
|
|
|
- >
|
|
|
|
|
- 获取退据
|
|
|
|
|
- </ElButton>
|
|
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <ElButton
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ text
|
|
|
|
|
+ :icon="Receipt"
|
|
|
|
|
+ @click="openReceiptDialog(row.id, row.contractNumber)"
|
|
|
|
|
+ >
|
|
|
|
|
+ 获取收据
|
|
|
|
|
+ </ElButton>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <ElButton
|
|
|
|
|
+ type="warning"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ text
|
|
|
|
|
+ :icon="RotateCcw"
|
|
|
|
|
+ @click="openReturnReceiptDialog(row.id, row.contractNumber)"
|
|
|
|
|
+ >
|
|
|
|
|
+ 获取退据
|
|
|
|
|
+ </ElButton>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
</ElTableColumn>
|
|
</ElTableColumn>
|