From 0427e23fbf903575295129ba1152c2d2a82f72a4 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Tue, 25 Feb 2025 17:33:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=BF=E7=A7=9F=E6=96=B9=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../orderManagement/components/order-home.vue | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/views/user/orderManagement/components/order-home.vue b/src/views/user/orderManagement/components/order-home.vue index 04b3c7e..c8d10f0 100644 --- a/src/views/user/orderManagement/components/order-home.vue +++ b/src/views/user/orderManagement/components/order-home.vue @@ -390,6 +390,29 @@ const downloadContract = () => { // } } +// 下载合同附件 +const downloadAnnex = async () => { + const baseUrl = window.location.origin; + const fileUrl = `${baseUrl}/contract-annex.docx`; + + try { + const response = await fetch(fileUrl); + if (!response.ok) throw new Error('网络响应不正常'); + + const blob = await response.blob(); + const url = window.URL.createObjectURL(blob); + const a = document.createElement('a'); + a.style.display = 'none'; + a.href = url; + a.download = 'contract-annex.docx'; // 设置下载文件名 + document.body.appendChild(a); + a.click(); + window.URL.revokeObjectURL(url); + } catch (error) { + console.error('下载失败:', error); + } +} + const confirmFail = async (item: any) => { ElMessageBox.confirm('是否确定取消订单?', { confirmButtonText: '确定', @@ -1454,10 +1477,12 @@ const pickUpCodeForm = reactive({
+ + 下载附件 + 下载合同 关 闭 - 下载