import axios from 'axios';
import qs from 'qs';
const baseURL = 'XXX';
axios.defaults.baseURL = baseURL;
axios.interceptors.request.use(function (config) {
config.headers['appId'] = 'guanwang';
config.headers['signKey'] = 123456;
return config
}, function (error) {
return Promise.reject(error)
})
axios.interceptors.response.use(response => {
let result = response.headers.result
if (result === '1') {
ElementUI.MessageBox.confirm("该账号在另一设备登陆,是否继续?", '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
ElementUI.Message({
type: 'success',
message: '即将跳转到登陆页面'
});
setTimeout(() => {
sessionStorage.removeItem('token');
sessionStorage.removeItem('userCode');
router.push('/login')
}, 2000)
}).catch(() => {
ElementUI.Message({
type: 'info',
message: '已取消'
});
})
} else if (result === '4') {
router.push({ path: 'authority' })
}
return response;
}, function (error) {
return Promise.reject(error);
});
export const getAccountInfo = params => {
return axios.get(`api/cardBill?alipayUserId=${params.alipayUserId}&cardNo=${params.cardNo}&year=${params.year}&month=${params.month}`)
.then(res => res.data);
}
export const getOrderDetail = params => {
return axios.post('webApi/getOrderDetail', qs.stringify(params)).then(res => res.data);
}
import axios from 'axios'
import {getOrderList, checkLogisticsInfo} from '@/api';
async created() {
this.userInfo = JSON.parse(localStorage.getItem('userInfo'))
const {result,message} = await getOrderList(this.userInfo);
console.log(result,message)
if(result && message.length > 0) {
localStorage.setItem('orderList',JSON.stringify(message));
this.orderListInfo = message;
} else {
this.$alert('没有查到订单,请详细对照手机号与车牌号', '提示', {
confirmButtonText: '确定',
});
}
}