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({
+ + 下载附件 + 下载合同 关 闭 - 下载