c3fb61cf by 杨炀

no message

1 parent d793ca6b
......@@ -714,6 +714,10 @@ function getremark(){
})
}
function submitSJ() {
if(!lpName.value){
ElMessage.warning(language.value == 0 ? '请填写开票人' : 'Please fill in the invoice recipient')
return
}
loading.value = true
ElMessageBox.confirm(language.value == 0 ? '提交后无法修改开票人,确认提交吗?' : 'Confirm to submit ?', {
confirmButtonText: language.value == 0 ? '确定' : 'Confirm',
......
......@@ -663,6 +663,10 @@ function getremark() {
}
function submitSJ() {
if(!lpName.value){
ElMessage.warning(language.value == 0 ? '请填写开票人' : 'Please fill in the invoice recipient')
return
}
loading.value = true
ElMessageBox.confirm(language.value == 0 ? '提交后无法修改开票人,确认提交吗?' : 'Confirm to submit ?', {
confirmButtonText: language.value == 0 ? '确定' : 'Confirm',
......
......@@ -54,4 +54,3 @@ export const payCallback = (data) =>
request("POST", `/api/order/palPayTicket/callback/`, data);
export const getCanInvoiceTicket = (data) =>
request("GET", `/api/order/getOrderInvoiceList`, data);
......
......@@ -3,9 +3,11 @@
// import axios from "axios";
import axios from "axios/dist/axios";
import { getToken } from "./local-store";
import { ElMessage } from "element-plus";
import {ElLoading, ElMessage} from "element-plus";
import { saveAs } from 'file-saver'
import { useStorage } from "@vueuse/core/index";
import {blobValidate, tansParams} from "@/utils/ruoyi";
import errorCode from "@/utils/errorCode";
const language = useStorage("language", 0);
const baseURL = import.meta.env.VITE_TICKET_BASE_API
// const baseURL = VITE_TICKET_BASE_API; //"http://book.xiaojinyu.games"; // 这里填入你的基础 API URL
......@@ -44,6 +46,13 @@ http.interceptors.request.use(
http.interceptors.response.use(
(response) => {
// 判断是否有异常
if (
response.request.responseType === 'blob' ||
response.request.responseType === 'arraybuffer'
) {
return response
}
let error = null; // 若无异常此值为null
if (response.status !== 200) {
error = Error(`Request failed with statuCode ${response.status}`);
......@@ -54,6 +63,7 @@ http.interceptors.response.use(
return Promise.reject(response.data);
}
return response.data;
},
(error) => {
......@@ -62,13 +72,53 @@ http.interceptors.response.use(
}
);
export function download(url, params, filename, config) {
return http.post( url,params, {
transformRequest: [
(params) => {
return tansParams(params)
}
],
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
responseType: 'blob',
...config
})
.then(async(res) => {
const data = res.data
console.log(blobValidate(data))
const isBlob = blobValidate(data)
if (isBlob) {
let hz = ''
if (res.headers['content-disposition'].indexOf('zip') > -1 || res.headers['content-type'].indexOf('pdf') > -1) {
// if (res.headers['content-type'].indexOf('zip') > -1) {
// hz = '.zip'
// } else if (res.headers['content-type'].indexOf('pdf') > -1) {
// hz = '.pdf'
// }
const index = res.headers['content-disposition'].indexOf('=')
hz = res.headers['content-disposition'].substr(index + 1, res.headers['content-disposition'].length)
}
const blob = new Blob([data])
saveAs(blob, hz ? filename = decodeURIComponent(hz) : filename)
} else {
const resText = await data.text()
const rspObj = JSON.parse(resText)
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
ElMessage.error(errMsg)
}
}).catch((r) => {
console.error(url,r)
ElMessage.error('下载文件出现错误,请联系管理员!')
})
}
// 封装请求函数
const request = (method, url, data = null) => {
function request(method, url, data = null){
return http({
method,
url,
data,
});
};
}
export default request;
......
......@@ -90,7 +90,7 @@ export default defineConfig(({ mode, command }) => {
rewrite: (p) => p.replace(/^\/dev-api/, '')
},
'/ticket': {
target: 'http://192.168.1.131:8081/',
target: 'http://192.168.1.131:8098/',
// target: 'http://192.168.1.131:8081/',
// target: 'https://jijin.wtwuxicenter.com/h5',
// target: 'https://ticketh5.wdsfwuxicenter.com/h5/stage-api',
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!