diff --git a/src/api/oil-order.js b/src/api/oil-order.js index 4a885cd..4f274b3 100644 --- a/src/api/oil-order.js +++ b/src/api/oil-order.js @@ -1,80 +1,80 @@ import request from '@/utils/request' -const service_name = "oil-site" -const group_name = "oilSiteOrderInfo" +const service_name = 'oil-site' +const group_name = 'oilSiteOrderInfo' const Img_name = 'oil-interfaces' export default { - // 下单 - createOrder(data) { - return request({ - url: `/oil-site/oilSiteOrderInfo/createH5Order`, - method: 'post', - data: data - }) - }, - // 主动支付 - payOrder(data) { - return request({ - url: `/${service_name}/${group_name}/payOrder`, - method: 'post', - data: data - }) - }, - aggregatePay(data) { - return request({ - url: `/${service_name}/${group_name}/aggregatePay`, - method: 'post', - data: data - }) - }, - getOrderInfoByPage(data) { - return request({ - url: `/${service_name}/${group_name}/getOrderInfoByPage`, - method: 'post', - data: data - }) - }, - getOrderPayInfo(id) { - return request({ - url: `/${service_name}/${group_name}/getOrderPayInfoH5/${id}`, - method: 'get' - }) - }, - cancelOrder(id) { - return request({ - url: `/${service_name}/${group_name}/cancelOrder/${id}`, - method: 'get' - }) - }, - delOrder(id) { - return request({ - url: `/${service_name}/${group_name}/delOrder/${id}`, - method: 'get' - }) - }, - selOrder(id) { - return request({ - url: `/${service_name}/${group_name}/selOrder/${id}`, - method: 'get' - }) - }, - //尿素站订单接口 - findXoiUreaPage(data) { - return request({ - url: `/oil-finance/xoilUreaOrder/findXoiUreaPage`, - method: 'post', - data: data - }) - }, - findOneByOrderId(id) { - return request({ - url: `/oil-finance/xoilUreaOrder/findOneByOrderId?orderId=${id}`, - method: 'get' - }) - }, - queryBarrelOrderDetails(id) { - return request({ - url: `/oil-finance/xoilUreaOrderRelation/queryBarrelOrderDetails?orderId=${id}`, - method: 'get' - }) - }, + // 下单 + createOrder(data) { + return request({ + url: `/oil-site/oilSiteOrderInfo/createOrder`, + method: 'post', + data: data + }) + }, + // 主动支付 + payOrder(data) { + return request({ + url: `/${service_name}/${group_name}/payOrder`, + method: 'post', + data: data + }) + }, + aggregatePay(data) { + return request({ + url: `/${service_name}/${group_name}/aggregatePay`, + method: 'post', + data: data + }) + }, + getOrderInfoByPage(data) { + return request({ + url: `/${service_name}/${group_name}/getOrderInfoByPage`, + method: 'post', + data: data + }) + }, + getOrderPayInfo(id) { + return request({ + url: `/${service_name}/${group_name}/getOrderPayInfo/${id}`, + method: 'get' + }) + }, + cancelOrder(id) { + return request({ + url: `/${service_name}/${group_name}/cancelOrder/${id}`, + method: 'get' + }) + }, + delOrder(id) { + return request({ + url: `/${service_name}/${group_name}/delOrder/${id}`, + method: 'get' + }) + }, + selOrder(id) { + return request({ + url: `/${service_name}/${group_name}/selOrder/${id}`, + method: 'get' + }) + }, + //尿素站订单接口 + findXoiUreaPage(data) { + return request({ + url: `/oil-finance/xoilUreaOrder/findXoiUreaPage`, + method: 'post', + data: data + }) + }, + findOneByOrderId(id) { + return request({ + url: `/oil-finance/xoilUreaOrder/findOneByOrderId?orderId=${id}`, + method: 'get' + }) + }, + queryBarrelOrderDetails(id) { + return request({ + url: `/oil-finance/xoilUreaOrderRelation/queryBarrelOrderDetails?orderId=${id}`, + method: 'get' + }) + } } diff --git a/src/permission.js b/src/permission.js index e0eb11e..2481eb6 100644 --- a/src/permission.js +++ b/src/permission.js @@ -3,7 +3,7 @@ import useStore from './store/piniaIndex' import { obtainUrlPathParameterTarget } from '@/utils/index.js' -import { getToken, removeToken } from '@/utils/auth' +import { setToken, getToken, removeToken } from '@/utils/auth' import { Notify } from 'vant' let whiteList = ['/home'] @@ -16,17 +16,25 @@ router.beforeEach(async (to, from, next) => { // removeToken() !whiteList.includes(to.path) && store.getPosition() + // store.login({ username: '15098826302', networkId: '1522478429548756992' }) + if (!token) { + // let paramsTarget = obtainUrlPathParameterTarget(location.href) + // sessionStorage.setItem('paramsTarget', JSON.stringify(paramsTarget)) + // store.login(paramsTarget).then( + // () => { + // next() + // }, + // () => { + // Notify('登陆失败,请退出重试') + // } + // ) let paramsTarget = obtainUrlPathParameterTarget(location.href) - sessionStorage.setItem('paramsTarget', JSON.stringify(paramsTarget)) - store.login(paramsTarget).then( - () => { - next() - }, - () => { - Notify('登陆失败,请退出重试') - } - ) + if (paramsTarget.token) { + setToken(paramsTarget.token) + store.getUser() + next() + } else Notify('登陆失败,请退出重试') return } @@ -40,12 +48,13 @@ router.beforeEach(async (to, from, next) => { // } // } //拦截 如果不是去首页 还没有token直接去首页 - if (to.path !== '/' && !token) { - Notify('请检查登陆状态') - next({ path: '/' }) - } else { - next() - } + // if (to.path !== '/home' && !token) { + // Notify('请检查登陆状态') + // next({ path: '/' }) + // } else { + + // } + next() }, 0) }) diff --git a/src/store/piniaIndex.js b/src/store/piniaIndex.js index 1e3b42c..afda4a5 100644 --- a/src/store/piniaIndex.js +++ b/src/store/piniaIndex.js @@ -119,13 +119,14 @@ const instance = defineStore('user', { }) .then(res => { if (res.code === 20000) { - setToken(res.data.accessToken) - this.getUser() + // setToken(res.data.accessToken) + // this.getUser() } }) } return Promise.reject() }, + clearToken() { removeToken() } diff --git a/src/utils/request.js b/src/utils/request.js index d56eb4d..f70e139 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -63,8 +63,14 @@ service.interceptors.response.use( // let paramsTargetJson = sessionStorage.getItem('paramsTarget') // let paramsTarget = JSON.parse(paramsTargetJson) // instance.login(paramsTarget).then(location.reload()) - removeToken() - location.reload() + // removeToken() + // location.reload() + Notify({ + message: '登陆失败,请退出重试', + onClose: () => { + removeToken() + } + }) return } if (![20000].includes(res.code)) { diff --git a/src/views/cashier/cashierIndex.vue b/src/views/cashier/cashierIndex.vue index a162cd6..34181be 100644 --- a/src/views/cashier/cashierIndex.vue +++ b/src/views/cashier/cashierIndex.vue @@ -1,297 +1,306 @@ \ No newline at end of file +