no message
Showing
6 changed files
with
63 additions
and
6 deletions
| ... | @@ -714,6 +714,10 @@ function getremark(){ | ... | @@ -714,6 +714,10 @@ function getremark(){ |
| 714 | }) | 714 | }) |
| 715 | } | 715 | } |
| 716 | function submitSJ() { | 716 | function submitSJ() { |
| 717 | if(!lpName.value){ | ||
| 718 | ElMessage.warning(language.value == 0 ? '请填写开票人' : 'Please fill in the invoice recipient') | ||
| 719 | return | ||
| 720 | } | ||
| 717 | loading.value = true | 721 | loading.value = true |
| 718 | ElMessageBox.confirm(language.value == 0 ? '提交后无法修改开票人,确认提交吗?' : 'Confirm to submit ?', { | 722 | ElMessageBox.confirm(language.value == 0 ? '提交后无法修改开票人,确认提交吗?' : 'Confirm to submit ?', { |
| 719 | confirmButtonText: language.value == 0 ? '确定' : 'Confirm', | 723 | confirmButtonText: language.value == 0 ? '确定' : 'Confirm', | ... | ... |
| ... | @@ -663,6 +663,10 @@ function getremark() { | ... | @@ -663,6 +663,10 @@ function getremark() { |
| 663 | } | 663 | } |
| 664 | 664 | ||
| 665 | function submitSJ() { | 665 | function submitSJ() { |
| 666 | if(!lpName.value){ | ||
| 667 | ElMessage.warning(language.value == 0 ? '请填写开票人' : 'Please fill in the invoice recipient') | ||
| 668 | return | ||
| 669 | } | ||
| 666 | loading.value = true | 670 | loading.value = true |
| 667 | ElMessageBox.confirm(language.value == 0 ? '提交后无法修改开票人,确认提交吗?' : 'Confirm to submit ?', { | 671 | ElMessageBox.confirm(language.value == 0 ? '提交后无法修改开票人,确认提交吗?' : 'Confirm to submit ?', { |
| 668 | confirmButtonText: language.value == 0 ? '确定' : 'Confirm', | 672 | confirmButtonText: language.value == 0 ? '确定' : 'Confirm', | ... | ... |
| ... | @@ -54,4 +54,3 @@ export const payCallback = (data) => | ... | @@ -54,4 +54,3 @@ export const payCallback = (data) => |
| 54 | request("POST", `/api/order/palPayTicket/callback/`, data); | 54 | request("POST", `/api/order/palPayTicket/callback/`, data); |
| 55 | export const getCanInvoiceTicket = (data) => | 55 | export const getCanInvoiceTicket = (data) => |
| 56 | request("GET", `/api/order/getOrderInvoiceList`, data); | 56 | request("GET", `/api/order/getOrderInvoiceList`, data); |
| 57 | ... | ... |
This diff is collapsed.
Click to expand it.
| ... | @@ -3,9 +3,11 @@ | ... | @@ -3,9 +3,11 @@ |
| 3 | // import axios from "axios"; | 3 | // import axios from "axios"; |
| 4 | import axios from "axios/dist/axios"; | 4 | import axios from "axios/dist/axios"; |
| 5 | import { getToken } from "./local-store"; | 5 | import { getToken } from "./local-store"; |
| 6 | import { ElMessage } from "element-plus"; | 6 | import {ElLoading, ElMessage} from "element-plus"; |
| 7 | 7 | import { saveAs } from 'file-saver' | |
| 8 | import { useStorage } from "@vueuse/core/index"; | 8 | import { useStorage } from "@vueuse/core/index"; |
| 9 | import {blobValidate, tansParams} from "@/utils/ruoyi"; | ||
| 10 | import errorCode from "@/utils/errorCode"; | ||
| 9 | const language = useStorage("language", 0); | 11 | const language = useStorage("language", 0); |
| 10 | const baseURL = import.meta.env.VITE_TICKET_BASE_API | 12 | const baseURL = import.meta.env.VITE_TICKET_BASE_API |
| 11 | // const baseURL = VITE_TICKET_BASE_API; //"http://book.xiaojinyu.games"; // 这里填入你的基础 API URL | 13 | // const baseURL = VITE_TICKET_BASE_API; //"http://book.xiaojinyu.games"; // 这里填入你的基础 API URL |
| ... | @@ -44,6 +46,13 @@ http.interceptors.request.use( | ... | @@ -44,6 +46,13 @@ http.interceptors.request.use( |
| 44 | http.interceptors.response.use( | 46 | http.interceptors.response.use( |
| 45 | (response) => { | 47 | (response) => { |
| 46 | // 判断是否有异常 | 48 | // 判断是否有异常 |
| 49 | if ( | ||
| 50 | response.request.responseType === 'blob' || | ||
| 51 | response.request.responseType === 'arraybuffer' | ||
| 52 | ) { | ||
| 53 | return response | ||
| 54 | } | ||
| 55 | |||
| 47 | let error = null; // 若无异常此值为null | 56 | let error = null; // 若无异常此值为null |
| 48 | if (response.status !== 200) { | 57 | if (response.status !== 200) { |
| 49 | error = Error(`Request failed with statuCode ${response.status}`); | 58 | error = Error(`Request failed with statuCode ${response.status}`); |
| ... | @@ -54,6 +63,7 @@ http.interceptors.response.use( | ... | @@ -54,6 +63,7 @@ http.interceptors.response.use( |
| 54 | return Promise.reject(response.data); | 63 | return Promise.reject(response.data); |
| 55 | } | 64 | } |
| 56 | 65 | ||
| 66 | |||
| 57 | return response.data; | 67 | return response.data; |
| 58 | }, | 68 | }, |
| 59 | (error) => { | 69 | (error) => { |
| ... | @@ -62,13 +72,53 @@ http.interceptors.response.use( | ... | @@ -62,13 +72,53 @@ http.interceptors.response.use( |
| 62 | } | 72 | } |
| 63 | ); | 73 | ); |
| 64 | 74 | ||
| 75 | export function download(url, params, filename, config) { | ||
| 76 | return http.post( url,params, { | ||
| 77 | transformRequest: [ | ||
| 78 | (params) => { | ||
| 79 | return tansParams(params) | ||
| 80 | } | ||
| 81 | ], | ||
| 82 | headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, | ||
| 83 | responseType: 'blob', | ||
| 84 | ...config | ||
| 85 | }) | ||
| 86 | .then(async(res) => { | ||
| 87 | const data = res.data | ||
| 88 | console.log(blobValidate(data)) | ||
| 89 | const isBlob = blobValidate(data) | ||
| 90 | if (isBlob) { | ||
| 91 | let hz = '' | ||
| 92 | if (res.headers['content-disposition'].indexOf('zip') > -1 || res.headers['content-type'].indexOf('pdf') > -1) { | ||
| 93 | // if (res.headers['content-type'].indexOf('zip') > -1) { | ||
| 94 | // hz = '.zip' | ||
| 95 | // } else if (res.headers['content-type'].indexOf('pdf') > -1) { | ||
| 96 | // hz = '.pdf' | ||
| 97 | // } | ||
| 98 | const index = res.headers['content-disposition'].indexOf('=') | ||
| 99 | hz = res.headers['content-disposition'].substr(index + 1, res.headers['content-disposition'].length) | ||
| 100 | } | ||
| 101 | const blob = new Blob([data]) | ||
| 102 | saveAs(blob, hz ? filename = decodeURIComponent(hz) : filename) | ||
| 103 | } else { | ||
| 104 | const resText = await data.text() | ||
| 105 | const rspObj = JSON.parse(resText) | ||
| 106 | const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default'] | ||
| 107 | ElMessage.error(errMsg) | ||
| 108 | } | ||
| 109 | }).catch((r) => { | ||
| 110 | console.error(url,r) | ||
| 111 | ElMessage.error('下载文件出现错误,请联系管理员!') | ||
| 112 | }) | ||
| 113 | } | ||
| 114 | |||
| 65 | // 封装请求函数 | 115 | // 封装请求函数 |
| 66 | const request = (method, url, data = null) => { | 116 | function request(method, url, data = null){ |
| 67 | return http({ | 117 | return http({ |
| 68 | method, | 118 | method, |
| 69 | url, | 119 | url, |
| 70 | data, | 120 | data, |
| 71 | }); | 121 | }); |
| 72 | }; | 122 | } |
| 73 | 123 | ||
| 74 | export default request; | 124 | export default request; | ... | ... |
| ... | @@ -90,7 +90,7 @@ export default defineConfig(({ mode, command }) => { | ... | @@ -90,7 +90,7 @@ export default defineConfig(({ mode, command }) => { |
| 90 | rewrite: (p) => p.replace(/^\/dev-api/, '') | 90 | rewrite: (p) => p.replace(/^\/dev-api/, '') |
| 91 | }, | 91 | }, |
| 92 | '/ticket': { | 92 | '/ticket': { |
| 93 | target: 'http://192.168.1.131:8081/', | 93 | target: 'http://192.168.1.131:8098/', |
| 94 | // target: 'http://192.168.1.131:8081/', | 94 | // target: 'http://192.168.1.131:8081/', |
| 95 | // target: 'https://jijin.wtwuxicenter.com/h5', | 95 | // target: 'https://jijin.wtwuxicenter.com/h5', |
| 96 | // target: 'https://ticketh5.wdsfwuxicenter.com/h5/stage-api', | 96 | // target: 'https://ticketh5.wdsfwuxicenter.com/h5/stage-api', | ... | ... |
-
Please register or sign in to post a comment