|
|
@@ -1,18 +1,28 @@
|
|
|
<script lang="ts" setup>
|
|
|
-import { h, ref } from 'vue';
|
|
|
+import { ref } from 'vue';
|
|
|
|
|
|
import { useVbenModal } from '@vben/common-ui';
|
|
|
+import { X } from '@vben/icons';
|
|
|
|
|
|
import {
|
|
|
+ ElButton,
|
|
|
ElCard,
|
|
|
ElDescriptions,
|
|
|
ElDescriptionsItem,
|
|
|
+ ElDialog,
|
|
|
ElImage,
|
|
|
+ ElMessage,
|
|
|
+ ElMessageBox,
|
|
|
ElTag,
|
|
|
+ ElUpload,
|
|
|
} from 'element-plus';
|
|
|
|
|
|
import { getDictListApi } from '#/api/dict';
|
|
|
-import { getAttachmentListApi } from '#/api/file';
|
|
|
+import {
|
|
|
+ addAttachmentApi,
|
|
|
+ deleteAttachmentApi,
|
|
|
+ getAttachmentListApi,
|
|
|
+} from '#/api/file';
|
|
|
import { getOrdersDetailApi } from '#/api/orders';
|
|
|
|
|
|
const data = ref();
|
|
|
@@ -23,6 +33,11 @@ const certificateDataList = ref<any[]>([]);
|
|
|
const buyerPhotoDataList = ref<any[]>([]);
|
|
|
const coupon2sid = ref(''); // 优惠券id
|
|
|
|
|
|
+// 上传对话框相关状态
|
|
|
+const uploadDialogVisible = ref(false);
|
|
|
+const currentUploadType = ref('');
|
|
|
+const uploadLoading = ref(false);
|
|
|
+
|
|
|
const [Modal, modalApi] = useVbenModal({
|
|
|
class: 'w-2/3',
|
|
|
onCancel() {
|
|
|
@@ -143,6 +158,210 @@ const getFilePrefix = async () => {
|
|
|
return '';
|
|
|
};
|
|
|
|
|
|
+// 处理删除附件
|
|
|
+const handleDeleteAttachment = async (attid: string, type: string) => {
|
|
|
+ try {
|
|
|
+ // 显示确认对话框
|
|
|
+ await ElMessageBox.confirm(
|
|
|
+ '确定要删除这个附件吗?删除后无法恢复。',
|
|
|
+ '删除确认',
|
|
|
+ {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
+ // 用户确认后执行删除
|
|
|
+ await deleteAttachmentApi({ attid });
|
|
|
+ ElMessage.success('删除成功');
|
|
|
+
|
|
|
+ // 根据类型刷新对应的附件列表
|
|
|
+ const filePrefix = await getFilePrefix();
|
|
|
+
|
|
|
+ switch (type) {
|
|
|
+ case 'buyer': {
|
|
|
+ await getOrderBuyerPhoto(coupon2sid.value, filePrefix);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'certificate': {
|
|
|
+ await getOrderCertificate(coupon2sid.value, filePrefix);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'invoice': {
|
|
|
+ await getOrderInvoice(data.value.row.ordersid, filePrefix);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ // 如果用户取消操作,error会包含'cancel'字符串,我们不显示错误消息
|
|
|
+ if (error !== 'cancel') {
|
|
|
+ console.error('删除附件失败:', error);
|
|
|
+ ElMessage.error('删除失败,请重试');
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// 处理上传附件点击
|
|
|
+const handleUploadClick = (type: string) => {
|
|
|
+ currentUploadType.value = type;
|
|
|
+ uploadDialogVisible.value = true;
|
|
|
+};
|
|
|
+
|
|
|
+// 处理文件上传前的钩子
|
|
|
+const beforeUpload = (file: File) => {
|
|
|
+ // 根据上传类型设置不同的文件类型验证
|
|
|
+ let isValidType = false;
|
|
|
+ const isLt10M = file.size / 1024 / 1024 < 10;
|
|
|
+
|
|
|
+ switch (currentUploadType.value) {
|
|
|
+ case 'buyer':
|
|
|
+ case 'certificate': {
|
|
|
+ // 购机者照片和证件照片只能上传图片
|
|
|
+ isValidType = [
|
|
|
+ 'image/bmp',
|
|
|
+ 'image/gif',
|
|
|
+ 'image/jpeg',
|
|
|
+ 'image/png',
|
|
|
+ ].includes(file.type);
|
|
|
+ if (!isValidType) {
|
|
|
+ ElMessage.error('只能上传JPG/PNG/GIF/BMP格式的图片文件!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'invoice': {
|
|
|
+ // 发票附件可以上传图片或PDF
|
|
|
+ isValidType = [
|
|
|
+ 'application/pdf',
|
|
|
+ 'image/bmp',
|
|
|
+ 'image/gif',
|
|
|
+ 'image/jpeg',
|
|
|
+ 'image/png',
|
|
|
+ ].includes(file.type);
|
|
|
+ if (!isValidType) {
|
|
|
+ ElMessage.error('只能上传JPG/PNG/GIF/BMP/PDF格式的文件!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!isLt10M) {
|
|
|
+ ElMessage.error('上传文件大小不能超过10MB!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+};
|
|
|
+
|
|
|
+// 处理文件上传
|
|
|
+const handleFileUpload = async (options: any) => {
|
|
|
+ const { file } = options;
|
|
|
+ uploadLoading.value = true;
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 检查是否已有文件,每种类型只能上传一个文件
|
|
|
+ let hasExistingFile = false;
|
|
|
+ let existingFileName = '';
|
|
|
+
|
|
|
+ switch (currentUploadType.value) {
|
|
|
+ case 'buyer': {
|
|
|
+ if (buyerPhotoDataList.value.length > 0) {
|
|
|
+ hasExistingFile = true;
|
|
|
+ existingFileName =
|
|
|
+ buyerPhotoDataList.value[0].attorginname ||
|
|
|
+ `${buyerPhotoDataList.value[0].attname}.${buyerPhotoDataList.value[0].atttype}`;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'certificate': {
|
|
|
+ if (certificateDataList.value.length > 0) {
|
|
|
+ hasExistingFile = true;
|
|
|
+ existingFileName =
|
|
|
+ certificateDataList.value[0].attorginname ||
|
|
|
+ `${certificateDataList.value[0].attname}.${certificateDataList.value[0].atttype}`;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'invoice': {
|
|
|
+ if (invoiceDataList.value.length > 0) {
|
|
|
+ hasExistingFile = true;
|
|
|
+ existingFileName =
|
|
|
+ invoiceDataList.value[0].attorginname ||
|
|
|
+ `${invoiceDataList.value[0].attname}.${invoiceDataList.value[0].atttype}`;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (hasExistingFile) {
|
|
|
+ ElMessage.warning(
|
|
|
+ `已存在文件"${existingFileName}",请先删除现有文件再上传新文件`,
|
|
|
+ );
|
|
|
+ uploadDialogVisible.value = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const formData = new FormData();
|
|
|
+ formData.append('file', file);
|
|
|
+
|
|
|
+ // 根据上传类型设置不同的参数
|
|
|
+ let attlsh = '';
|
|
|
+ let attmodel = '';
|
|
|
+
|
|
|
+ switch (currentUploadType.value) {
|
|
|
+ case 'buyer': {
|
|
|
+ attlsh = coupon2sid.value;
|
|
|
+ attmodel = 'coupon_buyer';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'certificate': {
|
|
|
+ attlsh = coupon2sid.value;
|
|
|
+ attmodel = 'coupon_identity';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'invoice': {
|
|
|
+ attlsh = data.value.row.ordersid;
|
|
|
+ attmodel = 'coupon_invoice';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ formData.append('attlsh', attlsh);
|
|
|
+ formData.append('attmodel', attmodel);
|
|
|
+
|
|
|
+ // 调用上传API
|
|
|
+ await addAttachmentApi(formData);
|
|
|
+
|
|
|
+ ElMessage.success('上传成功!');
|
|
|
+ uploadDialogVisible.value = false;
|
|
|
+
|
|
|
+ // 刷新对应的附件列表
|
|
|
+ const filePrefix = await getFilePrefix();
|
|
|
+
|
|
|
+ switch (currentUploadType.value) {
|
|
|
+ case 'buyer': {
|
|
|
+ await getOrderBuyerPhoto(coupon2sid.value, filePrefix);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'certificate': {
|
|
|
+ await getOrderCertificate(coupon2sid.value, filePrefix);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 'invoice': {
|
|
|
+ await getOrderInvoice(data.value.row.ordersid, filePrefix);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error('上传失败:', error);
|
|
|
+ ElMessage.error('上传失败,请重试!');
|
|
|
+ } finally {
|
|
|
+ uploadLoading.value = false;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
// 订单状态映射
|
|
|
const getOrderStatusTag = (status: number) => {
|
|
|
const statusMap = {
|
|
|
@@ -159,72 +378,10 @@ const getOrderStatusTag = (status: number) => {
|
|
|
);
|
|
|
};
|
|
|
|
|
|
-// 渲染附件
|
|
|
-const renderAttachments = (attachments: any[], emptyText: string) => {
|
|
|
- if (attachments.length === 0) {
|
|
|
- return h('div', { class: 'text-gray-500 text-sm' }, emptyText);
|
|
|
- }
|
|
|
-
|
|
|
- return h(
|
|
|
- 'div',
|
|
|
- { class: 'flex flex-wrap gap-3' },
|
|
|
- attachments.map((item) => {
|
|
|
- // 判断文件类型,根据atttype进行不同展示
|
|
|
- if (item.atttype === 'pdf') {
|
|
|
- // PDF文件显示为链接
|
|
|
- return h(
|
|
|
- 'a',
|
|
|
- {
|
|
|
- href: item.url,
|
|
|
- target: '_blank',
|
|
|
- class:
|
|
|
- 'inline-flex items-center px-3 py-2 text-sm font-medium text-blue-600 bg-blue-50 border border-blue-200 rounded-lg hover:bg-blue-100 hover:text-blue-700 transition-colors',
|
|
|
- title: item.attorginname || item.attname,
|
|
|
- },
|
|
|
- [
|
|
|
- h('i', { class: 'fas fa-file-pdf mr-2 text-red-500' }),
|
|
|
- item.attorginname || `${item.attname}.${item.atttype}`,
|
|
|
- ],
|
|
|
- );
|
|
|
- } else {
|
|
|
- // 图片文件使用ElImage展示
|
|
|
- const imageExtensions = new Set([
|
|
|
- 'bmp',
|
|
|
- 'gif',
|
|
|
- 'jpeg',
|
|
|
- 'jpg',
|
|
|
- 'png',
|
|
|
- 'webp',
|
|
|
- ]);
|
|
|
- return imageExtensions.has(item.atttype.toLowerCase())
|
|
|
- ? h(ElImage, {
|
|
|
- src: item.url,
|
|
|
- previewSrcList: attachments
|
|
|
- .filter((i) => imageExtensions.has(i.atttype.toLowerCase()))
|
|
|
- .map((i) => i.url),
|
|
|
- fit: 'cover',
|
|
|
- style: 'width: 100px; height: 100px;',
|
|
|
- class: 'border rounded',
|
|
|
- previewTeleported: true,
|
|
|
- })
|
|
|
- : // 其他文件类型显示为普通链接
|
|
|
- h(
|
|
|
- 'a',
|
|
|
- {
|
|
|
- href: item.url,
|
|
|
- target: '_blank',
|
|
|
- class:
|
|
|
- 'inline-flex items-center px-3 py-2 text-sm font-medium text-gray-600 bg-gray-50 border border-gray-200 rounded-lg hover:bg-gray-100 hover:text-gray-700 transition-colors',
|
|
|
- title: item.attorginname || item.attname,
|
|
|
- },
|
|
|
- [
|
|
|
- h('i', { class: 'fas fa-file mr-2 text-gray-500' }),
|
|
|
- item.attorginname || `${item.attname}.${item.atttype}`,
|
|
|
- ],
|
|
|
- );
|
|
|
- }
|
|
|
- }),
|
|
|
- );
|
|
|
+// 判断是否为图片文件
|
|
|
+const isImageFile = (atttype: string) => {
|
|
|
+ const imageExtensions = new Set(['bmp', 'gif', 'jpeg', 'jpg', 'png', 'webp']);
|
|
|
+ return imageExtensions.has(atttype.toLowerCase());
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
@@ -325,9 +482,56 @@ const renderAttachments = (attachments: any[], emptyText: string) => {
|
|
|
<div>
|
|
|
<h4 class="mb-2 text-sm font-medium text-gray-700">购机者照片</h4>
|
|
|
<div class="min-h-[60px] rounded-lg bg-gray-50 p-3">
|
|
|
- <component
|
|
|
- :is="renderAttachments(buyerPhotoDataList, '暂无购机者照片')"
|
|
|
- />
|
|
|
+ <div
|
|
|
+ v-if="buyerPhotoDataList.length === 0"
|
|
|
+ class="flex h-20 flex-col items-center justify-center space-y-2"
|
|
|
+ >
|
|
|
+ <span class="text-sm text-gray-500">暂无购机者照片</span>
|
|
|
+ <ElButton
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ @click="handleUploadClick('buyer')"
|
|
|
+ >
|
|
|
+ 上传附件
|
|
|
+ </ElButton>
|
|
|
+ </div>
|
|
|
+ <div v-else class="flex flex-wrap gap-3">
|
|
|
+ <div
|
|
|
+ v-for="item in buyerPhotoDataList"
|
|
|
+ :key="item.attid"
|
|
|
+ class="group relative"
|
|
|
+ >
|
|
|
+ <ElImage
|
|
|
+ v-if="isImageFile(item.atttype)"
|
|
|
+ :src="item.url"
|
|
|
+ :preview-src-list="
|
|
|
+ buyerPhotoDataList
|
|
|
+ .filter((i) => isImageFile(i.atttype))
|
|
|
+ .map((i) => i.url)
|
|
|
+ "
|
|
|
+ fit="cover"
|
|
|
+ style="width: 100px; height: 100px"
|
|
|
+ class="rounded border"
|
|
|
+ preview-teleported
|
|
|
+ />
|
|
|
+ <a
|
|
|
+ v-else
|
|
|
+ :href="item.url"
|
|
|
+ target="_blank"
|
|
|
+ class="inline-flex items-center rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-sm font-medium text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-700"
|
|
|
+ :title="item.attorginname || item.attname"
|
|
|
+ >
|
|
|
+ <i class="fas fa-file mr-2 text-gray-500"></i>
|
|
|
+ {{ item.attorginname || `${item.attname}.${item.atttype}` }}
|
|
|
+ </a>
|
|
|
+ <button
|
|
|
+ class="absolute right-1 top-1 flex h-6 w-6 items-center justify-center rounded-full bg-red-500 text-white opacity-0 transition-opacity duration-200 group-hover:opacity-100"
|
|
|
+ @click.stop="handleDeleteAttachment(item.attid, 'buyer')"
|
|
|
+ >
|
|
|
+ <X class="w-3 h-3" />
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
@@ -335,9 +539,58 @@ const renderAttachments = (attachments: any[], emptyText: string) => {
|
|
|
<div>
|
|
|
<h4 class="mb-2 text-sm font-medium text-gray-700">证件附件</h4>
|
|
|
<div class="min-h-[60px] rounded-lg bg-gray-50 p-3">
|
|
|
- <component
|
|
|
- :is="renderAttachments(certificateDataList, '暂无证件附件')"
|
|
|
- />
|
|
|
+ <div
|
|
|
+ v-if="certificateDataList.length === 0"
|
|
|
+ class="flex h-20 flex-col items-center justify-center space-y-2"
|
|
|
+ >
|
|
|
+ <span class="text-sm text-gray-500">暂无证件附件</span>
|
|
|
+ <ElButton
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ @click="handleUploadClick('certificate')"
|
|
|
+ >
|
|
|
+ 上传附件
|
|
|
+ </ElButton>
|
|
|
+ </div>
|
|
|
+ <div v-else class="flex flex-wrap gap-3">
|
|
|
+ <div
|
|
|
+ v-for="item in certificateDataList"
|
|
|
+ :key="item.attid"
|
|
|
+ class="group relative"
|
|
|
+ >
|
|
|
+ <ElImage
|
|
|
+ v-if="isImageFile(item.atttype)"
|
|
|
+ :src="item.url"
|
|
|
+ :preview-src-list="
|
|
|
+ certificateDataList
|
|
|
+ .filter((i) => isImageFile(i.atttype))
|
|
|
+ .map((i) => i.url)
|
|
|
+ "
|
|
|
+ fit="cover"
|
|
|
+ style="width: 100px; height: 100px"
|
|
|
+ class="rounded border"
|
|
|
+ preview-teleported
|
|
|
+ />
|
|
|
+ <a
|
|
|
+ v-else
|
|
|
+ :href="item.url"
|
|
|
+ target="_blank"
|
|
|
+ class="inline-flex items-center rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-sm font-medium text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-700"
|
|
|
+ :title="item.attorginname || item.attname"
|
|
|
+ >
|
|
|
+ <i class="fas fa-file mr-2 text-gray-500"></i>
|
|
|
+ {{ item.attorginname || `${item.attname}.${item.atttype}` }}
|
|
|
+ </a>
|
|
|
+ <button
|
|
|
+ class="absolute right-1 top-1 flex h-6 w-6 items-center justify-center rounded-full bg-red-500 text-white opacity-0 transition-opacity duration-200 group-hover:opacity-100"
|
|
|
+ @click.stop="
|
|
|
+ handleDeleteAttachment(item.attid, 'certificate')
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <X class="w-3 h-3" />
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
@@ -345,15 +598,116 @@ const renderAttachments = (attachments: any[], emptyText: string) => {
|
|
|
<div>
|
|
|
<h4 class="mb-2 text-sm font-medium text-gray-700">发票附件</h4>
|
|
|
<div class="min-h-[60px] rounded-lg bg-gray-50 p-3">
|
|
|
- <component
|
|
|
- :is="renderAttachments(invoiceDataList, '暂无发票附件')"
|
|
|
- />
|
|
|
+ <div
|
|
|
+ v-if="invoiceDataList.length === 0"
|
|
|
+ class="flex h-20 flex-col items-center justify-center space-y-2"
|
|
|
+ >
|
|
|
+ <span class="text-sm text-gray-500">暂无发票附件</span>
|
|
|
+ <ElButton
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ @click="handleUploadClick('invoice')"
|
|
|
+ >
|
|
|
+ 上传附件
|
|
|
+ </ElButton>
|
|
|
+ </div>
|
|
|
+ <div v-else class="flex flex-wrap gap-3">
|
|
|
+ <div
|
|
|
+ v-for="item in invoiceDataList"
|
|
|
+ :key="item.attid"
|
|
|
+ class="group relative"
|
|
|
+ >
|
|
|
+ <a
|
|
|
+ v-if="item.atttype === 'pdf'"
|
|
|
+ :href="item.url"
|
|
|
+ target="_blank"
|
|
|
+ class="inline-flex items-center rounded-lg border border-blue-200 bg-blue-50 px-3 py-2 text-sm font-medium text-blue-600 transition-colors hover:bg-blue-100 hover:text-blue-700"
|
|
|
+ :title="item.attorginname || item.attname"
|
|
|
+ >
|
|
|
+ <i class="fas fa-file-pdf mr-2 text-red-500"></i>
|
|
|
+ {{ item.attorginname || `${item.attname}.${item.atttype}` }}
|
|
|
+ </a>
|
|
|
+ <ElImage
|
|
|
+ v-else-if="isImageFile(item.atttype)"
|
|
|
+ :src="item.url"
|
|
|
+ :preview-src-list="
|
|
|
+ invoiceDataList
|
|
|
+ .filter((i) => isImageFile(i.atttype))
|
|
|
+ .map((i) => i.url)
|
|
|
+ "
|
|
|
+ fit="cover"
|
|
|
+ style="width: 100px; height: 100px"
|
|
|
+ class="rounded border"
|
|
|
+ preview-teleported
|
|
|
+ />
|
|
|
+ <a
|
|
|
+ v-else
|
|
|
+ :href="item.url"
|
|
|
+ target="_blank"
|
|
|
+ class="inline-flex items-center rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-sm font-medium text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-700"
|
|
|
+ :title="item.attorginname || item.attname"
|
|
|
+ >
|
|
|
+ <i class="fas fa-file mr-2 text-gray-500"></i>
|
|
|
+ {{ item.attorginname || `${item.attname}.${item.atttype}` }}
|
|
|
+ </a>
|
|
|
+ <button
|
|
|
+ class="absolute right-1 top-1 flex h-6 w-6 items-center justify-center rounded-full bg-red-500 text-white opacity-0 transition-opacity duration-200 group-hover:opacity-100"
|
|
|
+ @click.stop="handleDeleteAttachment(item.attid, 'invoice')"
|
|
|
+ >
|
|
|
+ <X class="w-3 h-3" />
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</ElCard>
|
|
|
</div>
|
|
|
</Modal>
|
|
|
+
|
|
|
+ <!-- 上传对话框 -->
|
|
|
+ <ElDialog
|
|
|
+ v-model="uploadDialogVisible"
|
|
|
+ title="上传附件"
|
|
|
+ width="500px"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ >
|
|
|
+ <div class="py-4">
|
|
|
+ <ElUpload
|
|
|
+ class="w-full"
|
|
|
+ drag
|
|
|
+ :auto-upload="false"
|
|
|
+ :show-file-list="false"
|
|
|
+ :before-upload="beforeUpload"
|
|
|
+ :on-change="handleFileUpload"
|
|
|
+ :accept="currentUploadType === 'invoice' ? 'image/*,.pdf' : 'image/*'"
|
|
|
+ >
|
|
|
+ <div class="flex flex-col items-center justify-center py-6">
|
|
|
+ <i class="fas fa-cloud-upload-alt mb-4 text-4xl text-gray-400"></i>
|
|
|
+ <div class="mb-2 text-sm text-gray-600">
|
|
|
+ {{
|
|
|
+ currentUploadType === 'invoice'
|
|
|
+ ? '点击或拖拽文件到此区域上传'
|
|
|
+ : '点击或拖拽图片到此区域上传'
|
|
|
+ }}
|
|
|
+ </div>
|
|
|
+ <div class="text-xs text-gray-400">
|
|
|
+ {{
|
|
|
+ currentUploadType === 'invoice'
|
|
|
+ ? '支持JPG/PNG/GIF/BMP/PDF格式,文件大小不超过10MB'
|
|
|
+ : '支持JPG/PNG/GIF/BMP格式,文件大小不超过10MB'
|
|
|
+ }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </ElUpload>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <template #footer>
|
|
|
+ <div class="flex justify-end">
|
|
|
+ <ElButton @click="uploadDialogVisible = false">取消</ElButton>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </ElDialog>
|
|
|
</template>
|
|
|
|
|
|
<style scoped>
|