82d4fb2e by zhangmeng

旅游

1 parent 1689e66e
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
22 "echarts": "5.4.0", 22 "echarts": "5.4.0",
23 "echarts-wordcloud": "^2.1.0", 23 "echarts-wordcloud": "^2.1.0",
24 "element-plus": "2.6.1", 24 "element-plus": "2.6.1",
25 "file-saver": "2.0.5", 25 "file-saver": "^2.0.5",
26 "flag-icon-css": "^4.1.7", 26 "flag-icon-css": "^4.1.7",
27 "fuse.js": "6.6.2", 27 "fuse.js": "6.6.2",
28 "guid": "^0.0.12", 28 "guid": "^0.0.12",
......
...@@ -16,6 +16,7 @@ import { sendNotification } from '@/assets/lib/extend' ...@@ -16,6 +16,7 @@ import { sendNotification } from '@/assets/lib/extend'
16 import _ from 'lodash' 16 import _ from 'lodash'
17 // const language = cache.local.get('language') || 0 17 // const language = cache.local.get('language') || 0
18 import { useStorage } from '@vueuse/core/index' 18 import { useStorage } from '@vueuse/core/index'
19
19 const language = useStorage('language', 0) 20 const language = useStorage('language', 0)
20 let downloadLoadingInstance 21 let downloadLoadingInstance
21 // 是否显示重新登录 22 // 是否显示重新登录
...@@ -184,6 +185,7 @@ service.interceptors.response.use( ...@@ -184,6 +185,7 @@ service.interceptors.response.use(
184 }, 185 },
185 (error) => { 186 (error) => {
186 console.log('err' + error) 187 console.log('err' + error)
188 alert(error)
187 let { message } = error 189 let { message } = error
188 if (message === 'Network Error') { 190 if (message === 'Network Error') {
189 message = '后端接口连接异常' 191 message = '后端接口连接异常'
...@@ -200,7 +202,7 @@ service.interceptors.response.use( ...@@ -200,7 +202,7 @@ service.interceptors.response.use(
200 ) 202 )
201 203
202 // 通用下载方法 204 // 通用下载方法
203 export function download(url, params, filename, config) { 205 export function download(url, params, filename, config, mimeType) {
204 downloadLoadingInstance = ElLoading.service({ 206 downloadLoadingInstance = ElLoading.service({
205 text: '正在下载数据,请稍候', 207 text: '正在下载数据,请稍候',
206 background: 'rgba(0, 0, 0, 0.7)' 208 background: 'rgba(0, 0, 0, 0.7)'
...@@ -230,16 +232,38 @@ export function download(url, params, filename, config) { ...@@ -230,16 +232,38 @@ export function download(url, params, filename, config) {
230 const index = res.headers['content-disposition'].indexOf('=') 232 const index = res.headers['content-disposition'].indexOf('=')
231 hz = res.headers['content-disposition'].substr(index + 1, res.headers['content-disposition'].length) 233 hz = res.headers['content-disposition'].substr(index + 1, res.headers['content-disposition'].length)
232 } 234 }
233 const blob = new Blob([data]) 235
236 let blob
237 if (mimeType) {
238 blob = new Blob([data], { type: mimeType })
239 } else {
240 blob = new Blob([data])
241 }
242
234 saveAs(blob, hz ? filename = decodeURIComponent(hz) : filename) 243 saveAs(blob, hz ? filename = decodeURIComponent(hz) : filename)
244 // // 创建一个指向该 Blob 的 URL
245 // const url = URL.createObjectURL(blob)
246 // // 创建一个临时的 <a> 元素来触发下载
247 // const a = document.createElement('a')
248 //
249 // a.href = url
250 // a.download = filename
251 // document.body.appendChild(a)
252 // a.click()
253 // // 清理并移除 <a> 元素
254 // document.body.removeChild(a)
255 // // 释放 Blob URL 占用的内存
256 // URL.revokeObjectURL(url)
235 } else { 257 } else {
236 const resText = await data.text() 258 const resText = await data.text()
237 const rspObj = JSON.parse(resText) 259 const rspObj = JSON.parse(resText)
238 const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default'] 260 const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
239 ElMessage.error(errMsg) 261 ElMessage.error(errMsg)
240 downloadLoadingInstance.close() 262 downloadLoadingInstance.close()
263 return Promise.resolve(true)
241 } 264 }
242 downloadLoadingInstance.close() 265 downloadLoadingInstance.close()
266 return Promise.resolve(true)
243 }) 267 })
244 .catch((r) => { 268 .catch((r) => {
245 console.error(r) 269 console.error(r)
......
...@@ -676,6 +676,7 @@ function getData() { ...@@ -676,6 +676,7 @@ function getData() {
676 form.value = { 676 form.value = {
677 pickUpBo: {} 677 pickUpBo: {}
678 } 678 }
679
679 booking.getCarBilldetailbyId({ orderId: orderId.value }).then(res => { 680 booking.getCarBilldetailbyId({ orderId: orderId.value }).then(res => {
680 form.value = res.data 681 form.value = res.data
681 matchId.value = res.data.activeId 682 matchId.value = res.data.activeId
...@@ -908,7 +909,6 @@ function ScenicInfo() { ...@@ -908,7 +909,6 @@ function ScenicInfo() {
908 }) 909 })
909 } 910 }
910 911
911
912 function photographyOrder() { 912 function photographyOrder() {
913 return booking.getPhotoOrderInfo({ orderId: orderId.value }).then(res => { 913 return booking.getPhotoOrderInfo({ orderId: orderId.value }).then(res => {
914 form.value = res.data 914 form.value = res.data
...@@ -920,14 +920,9 @@ function photographyOrder() { ...@@ -920,14 +920,9 @@ function photographyOrder() {
920 }) 920 })
921 } 921 }
922 922
923 function photographyInfo() { 923 async function photographyInfo() {
924 booking.getPhotoOrderInfoByLogex({ aspId: form.value.aspId }).then(res => { 924 const res = await booking.getPhotoOrderInfoByLogex({ aspId: form.value.aspId })
925 formInfo.value = res.data 925 formInfo.value = res.data
926 })
927 // .catch((e) => {
928 // console.log(e)
929 // errorBox.value = true
930 // })
931 } 926 }
932 927
933 const cancel = () => { 928 const cancel = () => {
...@@ -961,11 +956,11 @@ function exportPdf() { ...@@ -961,11 +956,11 @@ function exportPdf() {
961 if (language.value == 0) { 956 if (language.value == 0) {
962 proxy.download('/ota/orderRoom/downRoomConfirmation', { 957 proxy.download('/ota/orderRoom/downRoomConfirmation', {
963 ...obj 958 ...obj
964 }, `订房确认书.pdf`) 959 }, `订房确认书.pdf`, {}, 'application/pdf')
965 } else { 960 } else {
966 proxy.download('/ota/orderRoom/downRoomConfirmation', { 961 proxy.download('/ota/orderRoom/downRoomConfirmation', {
967 ...obj 962 ...obj
968 }, `Hotel Reservation`) 963 }, `Hotel Reservation`, {}, 'application/pdf')
969 } 964 }
970 } 965 }
971 966
...@@ -1003,11 +998,12 @@ function submitSJ() { ...@@ -1003,11 +998,12 @@ function submitSJ() {
1003 cancelButtonText: language.value == 0 ? '取消' : 'Cancel', 998 cancelButtonText: language.value == 0 ? '取消' : 'Cancel',
1004 type: 'warning' 999 type: 'warning'
1005 }).then(() => { 1000 }).then(() => {
1001 form.value.receiptFlag = '0'
1006 showSJ() 1002 showSJ()
1007 }) 1003 })
1008 } 1004 }
1009 1005
1010 const showSJ = () => { 1006 const showSJ = async() => {
1011 // 查看电子收据预览信息 1007 // 查看电子收据预览信息
1012 var obj = { 1008 var obj = {
1013 orderId: orderId.value, 1009 orderId: orderId.value,
...@@ -1020,13 +1016,11 @@ const showSJ = () => { ...@@ -1020,13 +1016,11 @@ const showSJ = () => {
1020 // proxy.download(`/ota/norder/getReceipt/${obj.orderId}`, { 1016 // proxy.download(`/ota/norder/getReceipt/${obj.orderId}`, {
1021 // ...obj 1017 // ...obj
1022 // }, `Receipt_${new Date().getTime()}.pdf`) 1018 // }, `Receipt_${new Date().getTime()}.pdf`)
1023
1024 // 报名 1019 // 报名
1025 proxy.download(`/ota/norder/getReceipt/${obj.orderId}`, { 1020 await proxy.download(`/ota/norder/getReceipt/${obj.orderId}`, {
1026 ...obj 1021 ...obj
1027 }, `Receipt_${new Date().getTime()}.pdf`) 1022 }, `Receipt.pdf`, {}, 'application/pdf')
1028 showSJDialog.value = false 1023 showSJDialog.value = false
1029 getData()
1030 } 1024 }
1031 </script> 1025 </script>
1032 1026
......
...@@ -689,7 +689,7 @@ function exportSignList(n) { ...@@ -689,7 +689,7 @@ function exportSignList(n) {
689 } 689 }
690 proxy.download('/league/sign/exportCn', { 690 proxy.download('/league/sign/exportCn', {
691 ...obj 691 ...obj
692 }, `${fileName}_${new Date().getTime()}.xlsx`) 692 }, `${fileName}_${new Date().getTime()}.xlsx`, {}, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
693 } else { 693 } else {
694 if (n == 1) { 694 if (n == 1) {
695 fileName = 'Participant List' 695 fileName = 'Participant List'
...@@ -698,7 +698,7 @@ function exportSignList(n) { ...@@ -698,7 +698,7 @@ function exportSignList(n) {
698 } 698 }
699 proxy.download('/league/sign/exportEn', { 699 proxy.download('/league/sign/exportEn', {
700 ...obj 700 ...obj
701 }, `${fileName}_${new Date().getTime()}.xlsx`) 701 }, `${fileName}_${new Date().getTime()}.xlsx`, {}, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
702 } 702 }
703 } 703 }
704 704
...@@ -713,12 +713,12 @@ function exportPdf() { ...@@ -713,12 +713,12 @@ function exportPdf() {
713 fileName = '设项报名清单' 713 fileName = '设项报名清单'
714 proxy.download('/pdf/exportMySignInfoList', { 714 proxy.download('/pdf/exportMySignInfoList', {
715 ...obj 715 ...obj
716 }, `${fileName}_${new Date().getTime()}.pdf`) 716 }, `${fileName}_${new Date().getTime()}.pdf`, {}, 'application/pdf')
717 } else { 717 } else {
718 fileName = 'LIST OF REGISTERED COMPETITIONS' 718 fileName = 'LIST OF REGISTERED COMPETITIONS'
719 proxy.download('/pdf/exportMySignInfoList', { 719 proxy.download('/pdf/exportMySignInfoList', {
720 ...obj 720 ...obj
721 }, `${fileName}_${new Date().getTime()}.pdf`) 721 }, `${fileName}_${new Date().getTime()}.pdf`, {}, 'application/pdf')
722 } 722 }
723 } 723 }
724 724
...@@ -756,6 +756,7 @@ function submitSJ() { ...@@ -756,6 +756,7 @@ function submitSJ() {
756 cancelButtonText: language.value == 0 ? '取消' : 'Cancel', 756 cancelButtonText: language.value == 0 ? '取消' : 'Cancel',
757 type: 'warning' 757 type: 'warning'
758 }).then(() => { 758 }).then(() => {
759 form.value.receiptFlag = '0'
759 showSJ() 760 showSJ()
760 }) 761 })
761 } 762 }
...@@ -794,9 +795,8 @@ const showSJ = () => { ...@@ -794,9 +795,8 @@ const showSJ = () => {
794 // 报名 795 // 报名
795 proxy.download(`/league/signOrder/getReceipt/${obj.orderId}`, { 796 proxy.download(`/league/signOrder/getReceipt/${obj.orderId}`, {
796 ...obj 797 ...obj
797 }, `Receipt_${new Date().getTime()}.pdf`) 798 }, `Receipt_${new Date().getTime()}.pdf`, {}, 'application/pdf')
798 showSJDialog.value = false 799 showSJDialog.value = false
799 getData()
800 } 800 }
801 </script> 801 </script>
802 802
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!