Commit 3ba5dc05 by liang ce

token和orgId封装

parent 9c9f2ff1
import axios from 'axios' import axios from 'axios'
import qs from 'qs'
import { getToken, refreshToken } from './generateOrRefreshToken' import { getToken, refreshToken } from './generateOrRefreshToken'
import { message } from 'ant-design-vue'
const BASE_URL = process.env.VUE_APP_API_URL const BASE_URL = process.env.VUE_APP_API_URL
let loadingInstance // 创建Loading 的实例 let loadingInstance // 创建Loading 的实例
// 配置发送请求前的拦截器,设置token信息 // 配置发送请求前的拦截器,设置token信息
...@@ -25,29 +27,60 @@ axios.interceptors.request.use((config) => { ...@@ -25,29 +27,60 @@ axios.interceptors.request.use((config) => {
}) })
// 配置请求返回的拦截器, // 配置请求返回的拦截器,
axios.interceptors.response.use(res => { axios.interceptors.response.use(res => {
// if (res.data.resultCode === 0) {
return Promise.resolve(res) return Promise.resolve(res)
// } else {
// return Promise.reject()
// }
}, err => { }, err => {
debugger
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (err && err.response.data.code === 401) { console.log(err)
refreshToken().then(res => { if (err && err.response) {
console.log('refreshToken1', res) switch (err.response.status) {
resolve(err) case 401:
}) refreshToken().then(res => {
} else if (err && err.response.data.code === 426) { console.log('refreshToken1', res)
getToken().then((res) => { resolve(err)
console.log('getToken1', res) })
resolve(err) break
}) case 426:
getToken().then((res) => {
console.log('getToken1', res)
resolve(err)
})
break
case 504:
message.error('系统异常')
resolve(err)
break
case 500:
message.error('系统繁忙')
resolve(err)
break
default:
message.error('未知问题')
resolve(err)
reject(new Error(err))
}
} else { } else {
reject(new Error(err)) message.error('未知问题')
resolve(err)
} }
}) })
}) })
const $http = { const $http = {
post: (url, data) => { post: (url, data) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
axios.post(`${BASE_URL}${url}`, data, { let postData
if (data === undefined) {
postData = {
orgId: localStorage.getItem('orgId')
}
} else {
postData = data
postData.orgId = localStorage.getItem('orgId')
}
axios.post(`${BASE_URL}${url}`, postData, {
headers: { headers: {
'Content-Type': 'application/json; charset=UTF-8' 'Content-Type': 'application/json; charset=UTF-8'
} }
...@@ -56,9 +89,19 @@ const $http = { ...@@ -56,9 +89,19 @@ const $http = {
}) })
}) })
}, },
get: (url) => { get: (url, data) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
axios.get(`${BASE_URL}${url}`).then((res) => { let getData
if (data === undefined) {
getData = {
orgId: localStorage.getItem('orgId')
}
} else {
getData = data
getData.orgId = localStorage.getItem('orgId')
}
getData = qs.stringify(getData)
axios.get(`${BASE_URL}${url}?${getData}`).then((res) => {
return resolve(res) return resolve(res)
}) })
}) })
......
import * as dd from 'dingtalk-jsapi' import * as dd from 'dingtalk-jsapi'
import axios from 'axios' import axios from 'axios'
import qs from 'qs' import qs from 'qs'
import { getToken, refreshToken } from './generateOrRefreshToken' import { getToken, refreshToken, ispermission } from './generateOrRefreshToken'
let basurl = process.env.VUE_APP_API_URL let basurl = process.env.VUE_APP_API_URL
// axios.defaults.headers['Authorization'] = `Bearer ${localStorage.getItem('token')}` // axios.defaults.headers['Authorization'] = `Bearer ${localStorage.getItem('token')}`
const config = { const config = {
...@@ -35,6 +35,7 @@ const config = { ...@@ -35,6 +35,7 @@ const config = {
}) })
}) })
}, },
// dd.ready参数为回调函数,在环境准备就绪时触发,jsapi的调用需要保证在该回调函数触发后调用,否则无效。
ddready: (item) => { ddready: (item) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
dd.ready(function () { dd.ready(function () {
...@@ -43,20 +44,33 @@ const config = { ...@@ -43,20 +44,33 @@ const config = {
}) })
}, },
ddpermission: () => { ddpermission: () => {
// dd.ready参数为回调函数,在环境准备就绪时触发,jsapi的调用需要保证在该回调函数触发后调用,否则无效。 // 判断当前用户是否有权限登陆后台
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let isRefreshToken = new Date().getTime() - localStorage.getItem('start_time') < localStorage.getItem('expires_in') - 5 * 60 * 1000 ispermission().then(res => {
if (localStorage.getItem('access_token') && isRefreshToken) { // 判断登陆状态
resolve('ok') if (res === 40003) {
} else if (localStorage.getItem('refresh_token')) { resolve('noPermission')
refreshToken().then((res) => { } else {
resolve('ok') let isRefreshToken = new Date().getTime() - localStorage.getItem('start_time') < localStorage.getItem('expires_in') - 5 * 60 * 1000
}) if (localStorage.getItem('access_token') && isRefreshToken) {
} else { resolve('ok')
getToken().then(() => { } else if (localStorage.getItem('refresh_token')) {
resolve('ok') refreshToken().then((res) => {
}) if (res === 'ok') {
} resolve('ok')
}
})
} else {
getToken().then((res) => {
if (res === 'noPermission') {
resolve('noPermission')
} else {
resolve('ok')
}
})
}
}
})
}) })
}, },
ddchooseOne: () => { ddchooseOne: () => {
......
import * as dd from 'dingtalk-jsapi' import * as dd from 'dingtalk-jsapi'
import router from '../router'
import axios from 'axios' import axios from 'axios'
import qs from 'qs' import qs from 'qs'
var instance = axios.create() var instance = axios.create()
const BASE_URL = process.env.VUE_APP_API_URL const BASE_URL = process.env.VUE_APP_API_URL
// function generateOrRefreshToken () { // 封装instance请求拦截
// }
instance.interceptors.response.use(res => { instance.interceptors.response.use(res => {
return Promise.resolve(res) return Promise.resolve(res)
}, err => { }, err => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (err && err.response.status === 401 && err.response.data.code === 401) { if (err && err.response.status === 401 && err.response.data.code === 401) {
refreshToken().then(res => { refreshToken()
console.log('refreshToken1', res)
resolve(err)
})
} else if (err && err.response.status === 426 && err.response.data.code === 1) { } else if (err && err.response.status === 426 && err.response.data.code === 1) {
getToken().then((res) => { getToken().then(res => {
console.log('getToken1', res) if (res === 40003) {
resolve(err) router.push({
path: '/noPermission'
})
}
}) })
} }
}) })
}) })
function getToken () { function ispermission () {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// 获取用户的临时授权码
dd.runtime.permission.requestAuthCode({ dd.runtime.permission.requestAuthCode({
corpId: localStorage.getItem('orgId'), // 企业id corpId: localStorage.getItem('orgId'), // 企业id
onSuccess: function (info) { onSuccess: function (info) {
...@@ -34,37 +34,17 @@ function getToken () { ...@@ -34,37 +34,17 @@ function getToken () {
code: info.code, code: info.code,
orgId: localStorage.getItem('orgId') orgId: localStorage.getItem('orgId')
}) })
// 获取用户名和密码
return instance.post(`${BASE_URL}/mingpay/v1/skipAuth/getUserInfoByCode?${senddate}`).then((res) => { return instance.post(`${BASE_URL}/mingpay/v1/skipAuth/getUserInfoByCode?${senddate}`).then((res) => {
console.log(res.data.resultCode)
if (res.data.resultCode === 0) { if (res.data.resultCode === 0) {
return res.data.data.mingUserId // 有权限登录,返回用户信息
resolve('press')
} else if (res.data.resultCode === 40003) { } else if (res.data.resultCode === 40003) {
// eslint-disable-next-line prefer-promise-reject-errors // 无权限登录,返回40003code码
reject('noPermission') resolve(res.data.resultCode)
} }
}).then((mingUserId) => { }).catch((err) => {
let loginData = qs.stringify({ console.log(err)
username: mingUserId,
password: mingUserId,
scope: 'server',
grant_type: 'password'
})
return instance.post(`${BASE_URL}/auth/oauth/token`, loginData,
{
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Authorization': 'Basic bWluZ3BheS13ZWI6bWluZ3BheS13ZWI='
}
}).then((response) => {
console.log(response)
localStorage.setItem('access_token', response.data.access_token)
localStorage.setItem('refresh_token', response.data.refresh_token)
localStorage.setItem('expires_in', response.data.expires_in * 1000)
localStorage.setItem('start_time', new Date().getTime())
resolve('ok')
}).catch(() => {
resolve('noPermission')
})
}) })
}, },
onFail: function (err) { onFail: function (err) {
...@@ -73,7 +53,58 @@ function getToken () { ...@@ -73,7 +53,58 @@ function getToken () {
}) })
}) })
} }
// 获取用户名称和密码
function getToken () {
return new Promise((resolve, reject) => {
// 获取用户的临时授权码
dd.runtime.permission.requestAuthCode({
corpId: localStorage.getItem('orgId'), // 企业id
onSuccess: function (info) {
let senddate = qs.stringify({
code: info.code,
orgId: localStorage.getItem('orgId')
})
// 获取用户名和密码
return instance.post(`${BASE_URL}/mingpay/v1/skipAuth/getUserInfoByCode?${senddate}`).then((res) => {
if (res.data.resultCode === 0) {
// 有权限登录,返回用户信息
let mingUserId = res.data.data.mingUserId
let loginData = qs.stringify({
username: mingUserId,
password: mingUserId,
scope: 'server',
grant_type: 'password'
})
instance.post(`${BASE_URL}/auth/oauth/token`, loginData,
{
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Authorization': 'Basic bWluZ3BheS13ZWI6bWluZ3BheS13ZWI='
}
}).then((response) => {
localStorage.setItem('access_token', response.data.access_token)
localStorage.setItem('refresh_token', response.data.refresh_token)
localStorage.setItem('expires_in', response.data.expires_in * 1000)
localStorage.setItem('start_time', new Date().getTime())
resolve('ok')
}).catch(() => {
})
} else if (res.data.resultCode === 40003) {
// 无权限登录,返回40003code码
resolve(res.data.resultCode)
}
}).catch((err) => {
console.log(err)
})
},
onFail: function (err) {
console.log(err)
}
})
})
}
// 刷新token接口
function refreshToken () { function refreshToken () {
let loginData = qs.stringify({ let loginData = qs.stringify({
refresh_token: localStorage.getItem('refresh_token'), refresh_token: localStorage.getItem('refresh_token'),
...@@ -92,8 +123,9 @@ function refreshToken () { ...@@ -92,8 +123,9 @@ function refreshToken () {
localStorage.setItem('start_time', new Date().getTime()) localStorage.setItem('start_time', new Date().getTime())
resolve('ok') resolve('ok')
}).catch((err) => { }).catch((err) => {
console.log('refreshToken', err)
resolve(err) resolve(err)
}) })
}) })
} }
export { getToken, refreshToken } export { getToken, refreshToken, ispermission }
...@@ -72,10 +72,7 @@ export default { ...@@ -72,10 +72,7 @@ export default {
}, },
methods: { methods: {
getProductCategoryList () { getProductCategoryList () {
let getProductCategoryListData = { $http.post(`/mingpay/v1/isv/product/list_product_category`).then((res) => {
orgId: localStorage.getItem('orgId')
}
$http.post(`/mingpay/v1/isv/product/list_product_category`, getProductCategoryListData).then((res) => {
if (res.data.resultCode === 0) { if (res.data.resultCode === 0) {
this.dataSource = res.data.data this.dataSource = res.data.data
} }
...@@ -84,7 +81,6 @@ export default { ...@@ -84,7 +81,6 @@ export default {
changeItem () { changeItem () {
this.confirmLoading = true this.confirmLoading = true
let updateProductCategoryData = { let updateProductCategoryData = {
orgId: localStorage.getItem('orgId'),
productCategoryId: this.modelSource.productCategoryId, productCategoryId: this.modelSource.productCategoryId,
productCategoryName: this.productCategoryName, productCategoryName: this.productCategoryName,
sort: this.sort sort: this.sort
...@@ -127,19 +123,16 @@ export default { ...@@ -127,19 +123,16 @@ export default {
}, },
changeData (record, index) { changeData (record, index) {
let saveProductCategoryData = { let saveProductCategoryData = {
orgId: localStorage.getItem('orgId'),
productCategoryId: this.categoryName, productCategoryId: this.categoryName,
sort: this.sort sort: this.sort
} }
if (record.isDisplay === 'DISPLAY') { if (record.isDisplay === 'DISPLAY') {
saveProductCategoryData = { saveProductCategoryData = {
orgId: localStorage.getItem('orgId'),
productCategoryId: record.productCategoryId, productCategoryId: record.productCategoryId,
isDisplay: 'HIDDEN' isDisplay: 'HIDDEN'
} }
} else { } else {
saveProductCategoryData = { saveProductCategoryData = {
orgId: localStorage.getItem('orgId'),
productCategoryId: record.productCategoryId, productCategoryId: record.productCategoryId,
isDisplay: 'DISPLAY' isDisplay: 'DISPLAY'
} }
...@@ -186,7 +179,6 @@ export default { ...@@ -186,7 +179,6 @@ export default {
} }
this.confirmLoading = true this.confirmLoading = true
let saveProductCategoryData = { let saveProductCategoryData = {
orgId: localStorage.getItem('orgId'),
productCategoryName: this.productCategoryName, productCategoryName: this.productCategoryName,
sort: parseInt(this.sort) sort: parseInt(this.sort)
} }
......
...@@ -129,11 +129,10 @@ export default { ...@@ -129,11 +129,10 @@ export default {
}, },
// 获取收银员列表 // 获取收银员列表
getAgentList () { getAgentList () {
let AgentData = this.$qs.stringify({ let AgentData = {
orgId: localStorage.getItem('orgId'),
userType: '1' userType: '1'
}) }
$http.get(`/mingpay/v1/isv/cashier/list_cashier_all?${AgentData}`).then((res) => { $http.get(`/mingpay/v1/isv/cashier/list_cashier_all`, AgentData).then((res) => {
this.agentList = res.data.data.list this.agentList = res.data.data.list
}) })
}, },
...@@ -197,8 +196,7 @@ export default { ...@@ -197,8 +196,7 @@ export default {
currentPage: this.pagination.current, currentPage: this.pagination.current,
agentId: this.searchSource.agentId, agentId: this.searchSource.agentId,
payStatus: this.searchSource.payStatus, payStatus: this.searchSource.payStatus,
buyerId: this.searchSource.UserMessage.emplId, buyerId: this.searchSource.UserMessage.emplId
orgId: localStorage.getItem('orgId')
} }
$http.post(`/mingpay/v1/isv/order/list_order_page`, RechargeData).then((res) => { $http.post(`/mingpay/v1/isv/order/list_order_page`, RechargeData).then((res) => {
let data = res.data.data let data = res.data.data
......
...@@ -113,7 +113,6 @@ export default { ...@@ -113,7 +113,6 @@ export default {
let SubsidyListData = { let SubsidyListData = {
startTime: this.startTime, startTime: this.startTime,
endTime: this.endTime, endTime: this.endTime,
orgId: localStorage.getItem('orgId'),
pageNumber: 10, pageNumber: 10,
currentPage: this.pagination.current currentPage: this.pagination.current
} }
......
...@@ -94,84 +94,87 @@ function getBase64 (img, callback) { ...@@ -94,84 +94,87 @@ function getBase64 (img, callback) {
reader.addEventListener('load', () => callback(reader.result)) reader.addEventListener('load', () => callback(reader.result))
reader.readAsDataURL(img) reader.readAsDataURL(img)
} }
function dataURLtoFile(dataurl, filename) { function dataURLtoFile (dataurl, filename) {
var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1], var arr = dataurl.split(',')
bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n); var mime = arr[0].match(/:(.*?);/)[1]
while(n--){ var bstr = atob(arr[1])
u8arr[n] = bstr.charCodeAt(n); var n = bstr.length
var u8arr = new Uint8Array(n)
while (n--) {
u8arr[n] = bstr.charCodeAt(n)
} }
return new File([u8arr], filename, {type:mime}); return new File([u8arr], filename, { type: mime })
} }
function changeFileToBaseURL(file,fn){ function changeFileToBaseURL (file, fn) {
// 创建读取文件对象 // 创建读取文件对象
var fileReader = new FileReader(); var fileReader = new FileReader()
//如果file没定义返回null // 如果file没定义返回null
if(file == undefined) return fn(null); if (file === undefined) return fn(null)
// 读取file文件,得到的结果为base64位 // 读取file文件,得到的结果为base64位
fileReader.readAsDataURL(file); fileReader.readAsDataURL(file)
fileReader.onload = function(){ fileReader.onload = function () {
// 把读取到的base64 // 把读取到的base64
var imgBase64Data = this.result; var imgBase64Data = this.result
fn(imgBase64Data); fn(imgBase64Data)
} }
} }
function pressImg(param){ function pressImg (param) {
//如果没有回调函数就不执行 // 如果没有回调函数就不执行
if(param && param.succ){ if (param && param.succ) {
//如果file没定义返回null // 如果file没定义返回null
if(param.file == undefined) return param.succ(null); if (param.file === undefined) return param.succ(null)
//给参数附初始值 // 给参数附初始值
param.targetSize = param.hasOwnProperty("targetSize") ? param.targetSize : -1; param.targetSize = param.hasOwnProperty('targetSize') ? param.targetSize : -1
param.width = param.hasOwnProperty("width") ? param.width : -1; param.width = param.hasOwnProperty('width') ? param.width : -1
param.fileName = param.hasOwnProperty("fileName") ? param.fileName: "image"; param.fileName = param.hasOwnProperty('fileName') ? param.fileName : 'image'
param.quality = param.hasOwnProperty("quality") ? param.quality : 0.92; param.quality = param.hasOwnProperty('quality') ? param.quality : 0.92
var _this = this; var _this = this
// 得到文件类型 // 得到文件类型
var fileType = param.file.type; var fileType = param.file.type
// console.log(fileType) //image/jpeg // console.log(fileType) //image/jpeg
if(fileType.indexOf("image") == -1){ if (fileType.indexOf('image') === -1) {
console.log('请选择图片文件^_^'); console.log('请选择图片文件^_^')
return param.succ(null); return param.succ(null)
} }
//如果当前size比目标size小,直接输出 // 如果当前size比目标size小,直接输出
var size = param.file.size; var size = param.file.size
if(param.targetSize > size){ if (param.targetSize > size) {
return param.succ(param.file); return param.succ(param.file)
} }
// 读取file文件,得到的结果为base64位 // 读取file文件,得到的结果为base64位
changeFileToBaseURL(param.file,function(base64){ changeFileToBaseURL(param.file, function (base64) {
if(base64){ if (base64) {
var image = new Image(); var image = new Image()
image.src = base64; image.src = base64
image.onload = function(){ image.onload = function () {
// 获得长宽比例 // 获得长宽比例
var scale = this.width / this.height; var scale = this.width / this.height
// console.log(scale); // console.log(scale);
//创建一个canvas // 创建一个canvas
var canvas = document.createElement('canvas'); var canvas = document.createElement('canvas')
//获取上下文 // 获取上下文
var context = canvas.getContext('2d'); var context = canvas.getContext('2d')
//获取压缩后的图片宽度,如果width为-1,默认原图宽度 // 获取压缩后的图片宽度,如果width为-1,默认原图宽度
canvas.width = param.width == -1 ? this.width : param.width; canvas.width = param.width === -1 ? this.width : param.width
//获取压缩后的图片高度,如果width为-1,默认原图高度 // 获取压缩后的图片高度,如果width为-1,默认原图高度
canvas.height = param.width == -1 ? this.height : parseInt(param.width / scale); canvas.height = param.width === -1 ? this.height : parseInt(param.width / scale)
//把图片绘制到canvas上面 // 把图片绘制到canvas上面
context.drawImage(image, 0, 0, canvas.width, canvas.height); context.drawImage(image, 0, 0, canvas.width, canvas.height)
//压缩图片,获取到新的base64Url // 压缩图片,获取到新的base64Url
var newImageData = canvas.toDataURL(fileType,param.quality); var newImageData = canvas.toDataURL(fileType, param.quality)
//将base64转化成文件流 // 将base64转化成文件流
var resultFile = dataURLtoFile(newImageData,param.fileName); var resultFile = dataURLtoFile(newImageData, param.fileName)
//判断如果targetSize有限制且压缩后的图片大小比目标大小大,就弹出错误 // 判断如果targetSize有限制且压缩后的图片大小比目标大小大,就弹出错误
if(param.targetSize != -1 && param.targetSize < resultFile.size){ if (param.targetSize !== -1 && param.targetSize < resultFile.size) {
console.log("图片上传尺寸太大,请重新上传^_^"); console.log('图片上传尺寸太大,请重新上传^_^')
param.succ(null); param.succ(null)
}else{ } else {
//返回文件流 // 返回文件流
param.succ(resultFile); param.succ(resultFile)
} }
} }
} }
}); })
} }
} }
export default { export default {
...@@ -228,7 +231,6 @@ export default { ...@@ -228,7 +231,6 @@ export default {
methods: { methods: {
getProductCategoryList (type) { getProductCategoryList (type) {
let getProductCategoryListData = { let getProductCategoryListData = {
orgId: localStorage.getItem('orgId')
} }
if (type === 'action') { if (type === 'action') {
$http.post(`/mingpay/v1/isv/product/list_product_category`, getProductCategoryListData).then((res) => { $http.post(`/mingpay/v1/isv/product/list_product_category`, getProductCategoryListData).then((res) => {
...@@ -283,13 +285,11 @@ export default { ...@@ -283,13 +285,11 @@ export default {
let saveProductCategoryData let saveProductCategoryData
if (record.productStatus === 'UP') { if (record.productStatus === 'UP') {
saveProductCategoryData = { saveProductCategoryData = {
orgId: localStorage.getItem('orgId'),
productId: record.productId, productId: record.productId,
productStatus: 'DOWN' productStatus: 'DOWN'
} }
} else { } else {
saveProductCategoryData = { saveProductCategoryData = {
orgId: localStorage.getItem('orgId'),
productId: record.productId, productId: record.productId,
productStatus: 'UP' productStatus: 'UP'
} }
...@@ -340,17 +340,17 @@ export default { ...@@ -340,17 +340,17 @@ export default {
targetSize: 50 * 1024, targetSize: 50 * 1024,
quality: 0.5, quality: 0.5,
width: 180, width: 180,
succ:function(resultFile){ succ: function (resultFile) {
//如果不是null就是压缩成功 // 如果不是null就是压缩成功
if(resultFile){ if (resultFile) {
let file = resultFile let file = resultFile
let namelast = '.' + file.name.replace(/.+\./, '') let namelast = '.' + file.name.replace(/.+\./, '')
let g_object_name = that.random_string(10) + namelast let g_object_name = that.random_string(10) + namelast
$http.post('/mingpay/v1/file/getOSSUploadSignature').then((res) => { $http.post('/mingpay/v1/file/getOSSUploadSignature').then((res) => {
var data = that.doData(res.data.data, file, g_object_name) var data = that.doData(res.data.data, file, g_object_name)
that.doUpLoad(res.data.data.host, data) that.doUpLoad(res.data.data.host, data)
}) })
} }
} }
}) })
}, },
...@@ -370,7 +370,6 @@ export default { ...@@ -370,7 +370,6 @@ export default {
} }
if (this.changeType === 1) { if (this.changeType === 1) {
let saveProductCategoryData = { let saveProductCategoryData = {
orgId: localStorage.getItem('orgId'),
productName: this.addProduct.productName === this.tableSource[this.changeSourceIndex].productName ? '' : this.addProduct.productName, productName: this.addProduct.productName === this.tableSource[this.changeSourceIndex].productName ? '' : this.addProduct.productName,
productPrice: this.addProduct.productPrice === this.tableSource[this.changeSourceIndex].productPrice ? '' : this.addProduct.productPrice, productPrice: this.addProduct.productPrice === this.tableSource[this.changeSourceIndex].productPrice ? '' : this.addProduct.productPrice,
productIcon: this.fileList.length === 0 ? '' : this.addProduct.productIcon, productIcon: this.fileList.length === 0 ? '' : this.addProduct.productIcon,
...@@ -397,7 +396,6 @@ export default { ...@@ -397,7 +396,6 @@ export default {
}) })
} else { } else {
let saveProductData = { let saveProductData = {
orgId: localStorage.getItem('orgId'),
productName: this.addProduct.productName, productName: this.addProduct.productName,
productPrice: this.addProduct.productPrice, productPrice: this.addProduct.productPrice,
productIcon: this.addProduct.productIcon, productIcon: this.addProduct.productIcon,
......
...@@ -207,17 +207,16 @@ export default { ...@@ -207,17 +207,16 @@ export default {
// 获取账户列表 // 获取账户列表
queryAccountList () { queryAccountList () {
const _that = this const _that = this
let AccountData = this.$qs.stringify({ let AccountData = {
currentPage: this.pagination.current, currentPage: this.pagination.current,
pageNumber: this.pagination.defaultPageSize, pageNumber: this.pagination.defaultPageSize,
ddDeptIds: this.searchSource.ddchoosePeople.departmentIdList, ddDeptIds: this.searchSource.ddchoosePeople.departmentIdList,
ddUserIds: this.searchSource.ddchoosePeople.userIdList, ddUserIds: this.searchSource.ddchoosePeople.userIdList,
status: this.searchSource.accountStatus, status: this.searchSource.accountStatus,
cardNo: this.searchSource.cardNum, cardNo: this.searchSource.cardNum,
cardStatus: this.searchSource.cardStatus, cardStatus: this.searchSource.cardStatus
orgId: localStorage.getItem('orgId') }
}) $http.get(`/mingpay/v1/isv/account/queryAccountList`, AccountData).then((res) => {
$http.get(`/mingpay/v1/isv/account/queryAccountList?${AccountData}`).then((res) => {
_that.accountList = res.data.data.recordList _that.accountList = res.data.data.recordList
_that.pagination.total = parseInt(res.data.data.totalCount) _that.pagination.total = parseInt(res.data.data.totalCount)
}).catch((err) => { }).catch((err) => {
...@@ -349,7 +348,6 @@ export default { ...@@ -349,7 +348,6 @@ export default {
this.visible = false this.visible = false
this.rechargeData.orderPrice = this.form.getFieldsValue().orderPrice this.rechargeData.orderPrice = this.form.getFieldsValue().orderPrice
this.rechargeData.remark = this.form.getFieldsValue().remark this.rechargeData.remark = this.form.getFieldsValue().remark
this.rechargeData.orgId = localStorage.getItem('orgId')
$http.post(`/mingpay/v1/isv/charge/charge`, this.rechargeData).then((res) => { $http.post(`/mingpay/v1/isv/charge/charge`, this.rechargeData).then((res) => {
if (res.data.resultCode === 0) { if (res.data.resultCode === 0) {
this.form.resetFields() this.form.resetFields()
...@@ -381,17 +379,15 @@ export default { ...@@ -381,17 +379,15 @@ export default {
if (type === 3) { if (type === 3) {
accountOperationData = this.$qs.stringify({ accountOperationData = this.$qs.stringify({
ddUserId: userId, ddUserId: userId,
accountStatus: status, accountStatus: status
orgId: localStorage.getItem('orgId')
}) })
} else { } else {
accountOperationData = this.$qs.stringify({ accountOperationData = {
ddUserId: userId, ddUserId: userId,
cardStatus: status, cardStatus: status
orgId: localStorage.getItem('orgId') }
})
} }
$http.get(`/mingpay/v1/isv/account/${url}?${accountOperationData}`).then((res) => { $http.get(`/mingpay/v1/isv/account/${url}`, accountOperationData).then((res) => {
if (res.data.resultCode === 0) { if (res.data.resultCode === 0) {
this.queryAccountList() this.queryAccountList()
this.$message.success('操作成功') this.$message.success('操作成功')
...@@ -459,17 +455,15 @@ export default { ...@@ -459,17 +455,15 @@ export default {
if (type === 2) { if (type === 2) {
cardOperationData = this.$qs.stringify({ cardOperationData = this.$qs.stringify({
cardNo: this.updateBindCardStatusForm.getFieldsValue().cardNo, cardNo: this.updateBindCardStatusForm.getFieldsValue().cardNo,
ddUserId: this.selsctUserId, ddUserId: this.selsctUserId
orgId: localStorage.getItem('orgId')
}) })
} else if (type === 1) { } else if (type === 1) {
cardOperationData = this.$qs.stringify({ cardOperationData = {
cardNo: '', cardNo: '',
ddUserId: this.selsctUserId, ddUserId: this.selsctUserId
orgId: localStorage.getItem('orgId') }
})
} }
$http.get(`/mingpay/v1/isv/account/update_bind_card_status?${cardOperationData}`).then((res) => { $http.get(`/mingpay/v1/isv/account/update_bind_card_status`, cardOperationData).then((res) => {
if (res.data.resultCode === 0) { if (res.data.resultCode === 0) {
this.queryAccountList() this.queryAccountList()
this.visible2 = false this.visible2 = false
......
...@@ -73,10 +73,10 @@ export default { ...@@ -73,10 +73,10 @@ export default {
}, },
methods: { methods: {
getStatisticalProductPage () { getStatisticalProductPage () {
let data = this.$qs.stringify({ let data = {
grantNumber: this.grantNumber grantNumber: this.grantNumber
}) }
$http.get(`/mingpay/v1/isv/account/coupon_record_detail?${data}`).then((res) => { $http.get(`/mingpay/v1/isv/account/coupon_record_detail`, data).then((res) => {
console.log(res) console.log(res)
this.allowanceDetails = res.data.data this.allowanceDetails = res.data.data
}) })
......
...@@ -169,11 +169,10 @@ export default { ...@@ -169,11 +169,10 @@ export default {
methods: { methods: {
// 获取收银员列表 // 获取收银员列表
getAgentList () { getAgentList () {
let AgentData = this.$qs.stringify({ let AgentData = {
orgId: localStorage.getItem('orgId'),
userType: '1' userType: '1'
}) }
$http.get(`/mingpay/v1/isv/cashier/list_cashier_all?${AgentData}`).then((res) => { $http.get(`/mingpay/v1/isv/cashier/list_cashier_all`, AgentData).then((res) => {
this.agentList = res.data.data.list this.agentList = res.data.data.list
}) })
}, },
...@@ -194,10 +193,9 @@ export default { ...@@ -194,10 +193,9 @@ export default {
currentPage: this.pagination.current, currentPage: this.pagination.current,
pageNumber: this.pagination.defaultPageSize, pageNumber: this.pagination.defaultPageSize,
subsidyType: this.searchSource.type, subsidyType: this.searchSource.type,
agentId: this.searchSource.agentId, agentId: this.searchSource.agentId
orgId: localStorage.getItem('orgId')
}) })
$http.get(`/mingpay/v1/isv/account/list_couponRecord?${RecordData}`).then((res) => { $http.get(`/mingpay/v1/isv/account/list_couponRecord`, RecordData).then((res) => {
let data = res.data.data let data = res.data.data
this.recordsList = data.list this.recordsList = data.list
this.pagination.total = parseInt(data.total) this.pagination.total = parseInt(data.total)
...@@ -297,10 +295,9 @@ export default { ...@@ -297,10 +295,9 @@ export default {
money: values.orderPrice, money: values.orderPrice,
endTime: `${values['date-picker']} 23:59:59`, endTime: `${values['date-picker']} 23:59:59`,
remark: values.remark, remark: values.remark,
subsidyEnumType: values.select, subsidyEnumType: values.select
orgId: localStorage.getItem('orgId')
}) })
$http.get(`/mingpay/v1/isv/account/batch_create_subsidy?${RecordData}`).then((res) => { $http.get(`/mingpay/v1/isv/account/batch_create_subsidy`, RecordData).then((res) => {
if (res.data.resultCode === 0) { if (res.data.resultCode === 0) {
this.form.resetFields() this.form.resetFields()
this.userIdListObj = [] this.userIdListObj = []
......
...@@ -75,14 +75,13 @@ export default { ...@@ -75,14 +75,13 @@ export default {
}) })
}, },
deleteCashier (record) { deleteCashier (record) {
let DeleteCashierData = this.$qs.stringify({ let DeleteCashierData = {
ddUserId: record.userId, ddUserId: record.userId,
cashierStatus: '1', cashierStatus: '1',
orgId: localStorage.getItem('orgId'),
userType: '0', userType: '0',
id: record.id id: record.id
}) }
$http.get(`/mingpay/v1/isv/cashier/delete_cashier?${DeleteCashierData}`).then((res) => { $http.get(`/mingpay/v1/isv/cashier/delete_cashier`, DeleteCashierData).then((res) => {
if (res.data.resultCode === 0) { if (res.data.resultCode === 0) {
this.$message.success('操作成功') this.$message.success('操作成功')
this.getCashierList() this.getCashierList()
...@@ -94,13 +93,12 @@ export default { ...@@ -94,13 +93,12 @@ export default {
}) })
}, },
getCashierList () { getCashierList () {
let CashierListData = this.$qs.stringify({ let CashierListData = {
pageNumber: this.pagination.defaultPageSize, pageNumber: this.pagination.defaultPageSize,
currentPage: this.pagination.current, currentPage: this.pagination.current,
orgId: localStorage.getItem('orgId'),
userType: '0' userType: '0'
}) }
$http.get(`/mingpay/v1/isv/cashier/list_cashier?${CashierListData}`).then((res) => { $http.get(`/mingpay/v1/isv/cashier/list_cashier`, CashierListData).then((res) => {
this.pagination.total = parseInt(res.data.data.total) this.pagination.total = parseInt(res.data.data.total)
this.cashierManagementList = res.data.data.list this.cashierManagementList = res.data.data.list
}).catch(() => { }).catch(() => {
...@@ -118,14 +116,13 @@ export default { ...@@ -118,14 +116,13 @@ export default {
}, },
choosePeople () { choosePeople () {
config.ddready('ddchooseOne').then((res) => { config.ddready('ddchooseOne').then((res) => {
let insertCashierData = this.$qs.stringify({ let insertCashierData = {
cashierName: res[0].name, cashierName: res[0].name,
ddUserId: res[0].emplId, ddUserId: res[0].emplId,
cashierStatus: '0', cashierStatus: '0',
orgId: localStorage.getItem('orgId'),
userType: '0' userType: '0'
}) }
$http.get(`/mingpay/v1/isv/cashier/insert_cashier?${insertCashierData}`).then((res) => { $http.get(`/mingpay/v1/isv/cashier/insert_cashier`, insertCashierData).then((res) => {
if (res.data.resultCode === 0) { if (res.data.resultCode === 0) {
this.$message.success('添加成功') this.$message.success('添加成功')
this.getCashierList() this.getCashierList()
......
...@@ -47,14 +47,13 @@ export default { ...@@ -47,14 +47,13 @@ export default {
}, },
methods: { methods: {
queryLog () { queryLog () {
let queryLogData = this.$qs.stringify({ let queryLogData = {
desc: 'create_time', desc: 'create_time',
serviceId: 'mingpay-web', serviceId: 'mingpay-web',
orgId: localStorage.getItem('orgId'),
current: this.pagination.current, current: this.pagination.current,
size: this.pagination.defaultPageSize size: this.pagination.defaultPageSize
}) }
$http.get(`/mingpay/v1/log/query?${queryLogData}`).then((res) => { $http.get(`/mingpay/v1/log/query`, queryLogData).then((res) => {
if (res.data.resultCode === 0) { if (res.data.resultCode === 0) {
this.pagination.total = res.data.data.total this.pagination.total = res.data.data.total
this.logData = res.data.data.records this.logData = res.data.data.records
......
...@@ -66,10 +66,7 @@ export default { ...@@ -66,10 +66,7 @@ export default {
}, },
methods: { methods: {
queryOrgSetting () { queryOrgSetting () {
let querySettingData = { $http.post(`/mingpay/v1/isv/org_setting/query_org_setting_by_org_id`).then((res) => {
orgId: localStorage.getItem('orgId')
}
$http.post(`/mingpay/v1/isv/org_setting/query_org_setting_by_org_id`, querySettingData).then((res) => {
console.log(res) console.log(res)
this.OrgSettingData = res.data.data this.OrgSettingData = res.data.data
}).catch((err) => { }).catch((err) => {
......
...@@ -117,11 +117,10 @@ export default { ...@@ -117,11 +117,10 @@ export default {
methods: { methods: {
// 获取收银员列表 // 获取收银员列表
getAgentList () { getAgentList () {
let AgentData = this.$qs.stringify({ let AgentData = {
orgId: localStorage.getItem('orgId'),
userType: '1' userType: '1'
}) }
$http.get(`/mingpay/v1/isv/cashier/list_cashier_all?${AgentData}`).then((res) => { $http.get(`/mingpay/v1/isv/cashier/list_cashier_all`, AgentData).then((res) => {
this.agentList = res.data.data.list this.agentList = res.data.data.list
}) })
}, },
...@@ -176,15 +175,14 @@ export default { ...@@ -176,15 +175,14 @@ export default {
this.searchSource.agentId = value this.searchSource.agentId = value
}, },
queryRechargeList () { queryRechargeList () {
let RechargeData = this.$qs.stringify({ let RechargeData = {
pageNumber: 10, pageNumber: 10,
currentPage: this.pagination.current, currentPage: this.pagination.current,
agentId: this.searchSource.agentId, agentId: this.searchSource.agentId,
status: this.searchSource.status, status: this.searchSource.status,
ddUserId: this.searchSource.UserMessage.emplId, ddUserId: this.searchSource.UserMessage.emplId
orgId: localStorage.getItem('orgId') }
}) $http.get(`/mingpay/v1/isv/charge/list_charge`, RechargeData).then((res) => {
$http.get(`/mingpay/v1/isv/charge/list_charge?${RechargeData}`).then((res) => {
let data = res.data.data let data = res.data.data
this.pagination.total = parseInt(data.totalCount) this.pagination.total = parseInt(data.totalCount)
this.chargeList = data.recordList this.chargeList = data.recordList
......
...@@ -149,11 +149,10 @@ export default { ...@@ -149,11 +149,10 @@ export default {
}, },
methods: { methods: {
queryAgentList () { queryAgentList () {
let CashierListData = this.$qs.stringify({ let CashierListData = {
orgId: localStorage.getItem('orgId'),
userType: '0' userType: '0'
}) }
$http.get(`/mingpay/v1/isv/cashier/list_cashier_all?${CashierListData}`).then((res) => { $http.get(`/mingpay/v1/isv/cashier/list_cashier_all`, CashierListData).then((res) => {
this.agentList = res.data.data.list this.agentList = res.data.data.list
}).catch(() => { }).catch(() => {
this.$message.error('获取操作员信息失败') this.$message.error('获取操作员信息失败')
...@@ -173,13 +172,12 @@ export default { ...@@ -173,13 +172,12 @@ export default {
if (this.form.getFieldsValue().remark === undefined) { if (this.form.getFieldsValue().remark === undefined) {
this.$message.error('请输入备注') this.$message.error('请输入备注')
} else { } else {
let refundData = this.$qs.stringify({ let refundData = {
orderNo: this.refundSelect.orderNo, orderNo: this.refundSelect.orderNo,
ddUserId: this.refundSelect.ddUserId, ddUserId: this.refundSelect.ddUserId,
remark: this.form.getFieldsValue().remark || '', remark: this.form.getFieldsValue().remark || ''
orgId: localStorage.getItem('orgId') }
}) $http.get(`/mingpay/v1/isv/consume/refund`, refundData).then((res) => {
$http.get(`/mingpay/v1/isv/consume/refund?${refundData}`).then((res) => {
if (res.data.message === 'SUCCESS') { if (res.data.message === 'SUCCESS') {
this.$message.success('退款成功') this.$message.success('退款成功')
this.visible = false this.visible = false
...@@ -206,15 +204,14 @@ export default { ...@@ -206,15 +204,14 @@ export default {
}, },
// 获取消费列表 // 获取消费列表
queryRecordList () { queryRecordList () {
let RecordListData = this.$qs.stringify({ let RecordListData = {
currentPage: this.pagination.current, currentPage: this.pagination.current,
pageNumber: this.pagination.defaultPageSize, pageNumber: this.pagination.defaultPageSize,
status: this.searchSource.status, status: this.searchSource.status,
ddUserId: this.searchSource.UserMessage.emplId, ddUserId: this.searchSource.UserMessage.emplId,
agentId: this.searchSource.agentId, agentId: this.searchSource.agentId
orgId: localStorage.getItem('orgId') }
}) $http.get(`/mingpay/v1/isv/consume/list_expense_record`, RecordListData).then((res) => {
$http.get(`/mingpay/v1/isv/consume/list_expense_record?${RecordListData}`).then((res) => {
let data = res.data.data let data = res.data.data
this.recordsList = data.recordList this.recordsList = data.recordList
this.pagination.total = parseInt(data.totalCount) this.pagination.total = parseInt(data.totalCount)
......
...@@ -75,14 +75,13 @@ export default { ...@@ -75,14 +75,13 @@ export default {
}) })
}, },
deleteCashier (record) { deleteCashier (record) {
let DeleteCashierData = this.$qs.stringify({ let DeleteCashierData = {
ddUserId: record.userId, ddUserId: record.userId,
cashierStatus: '1', cashierStatus: '1',
orgId: localStorage.getItem('orgId'),
userType: '1', userType: '1',
id: record.id id: record.id
}) }
$http.get(`/mingpay/v1/isv/cashier/delete_cashier?${DeleteCashierData}`).then((res) => { $http.get(`/mingpay/v1/isv/cashier/delete_cashier`, DeleteCashierData).then((res) => {
if (res.data.resultCode === 0) { if (res.data.resultCode === 0) {
this.$message.success('操作成功') this.$message.success('操作成功')
this.getCashierList() this.getCashierList()
...@@ -94,13 +93,12 @@ export default { ...@@ -94,13 +93,12 @@ export default {
}) })
}, },
getCashierList () { getCashierList () {
let CashierListData = this.$qs.stringify({ let CashierListData = {
pageNumber: this.pagination.defaultPageSize, pageNumber: this.pagination.defaultPageSize,
currentPage: this.pagination.current, currentPage: this.pagination.current,
orgId: localStorage.getItem('orgId'),
userType: '1' userType: '1'
}) }
$http.get(`/mingpay/v1/isv/cashier/list_cashier?${CashierListData}`).then((res) => { $http.get(`/mingpay/v1/isv/cashier/list_cashier`, CashierListData).then((res) => {
this.pagination.total = parseInt(res.data.data.total) this.pagination.total = parseInt(res.data.data.total)
this.cashierManagementList = res.data.data.list this.cashierManagementList = res.data.data.list
}).catch(() => { }).catch(() => {
...@@ -118,14 +116,13 @@ export default { ...@@ -118,14 +116,13 @@ export default {
}, },
choosePeople () { choosePeople () {
config.ddready('ddchooseOne').then((res) => { config.ddready('ddchooseOne').then((res) => {
let insertCashierData = this.$qs.stringify({ let insertCashierData = {
cashierName: res[0].name, cashierName: res[0].name,
ddUserId: res[0].emplId, ddUserId: res[0].emplId,
cashierStatus: '0', cashierStatus: '0',
userType: '1', userType: '1'
orgId: localStorage.getItem('orgId') }
}) $http.get(`/mingpay/v1/isv/cashier/insert_cashier`, insertCashierData).then((res) => {
$http.get(`/mingpay/v1/isv/cashier/insert_cashier?${insertCashierData}`).then((res) => {
if (res.data.resultCode === 0) { if (res.data.resultCode === 0) {
this.$message.success('添加成功') this.$message.success('添加成功')
this.getCashierList() this.getCashierList()
......
...@@ -166,12 +166,11 @@ export default { ...@@ -166,12 +166,11 @@ export default {
return totalNum.toFixed(2) return totalNum.toFixed(2)
}, },
getAccountCheck () { getAccountCheck () {
let SubsidyListData = this.$qs.stringify({ let SubsidyListData = {
startTime: this.startTime, startTime: this.startTime,
endTime: this.endTime, endTime: this.endTime
orgId: localStorage.getItem('orgId') }
}) $http.get(`/mingpay/v1/isv/account/accountCheck`, SubsidyListData).then((res) => {
$http.get(`/mingpay/v1/isv/account/accountCheck?${SubsidyListData}`).then((res) => {
console.log(res.data.data) console.log(res.data.data)
if (res.data.resultCode === 0) { if (res.data.resultCode === 0) {
this.systemReconciliationDetails = res.data.data this.systemReconciliationDetails = res.data.data
......
...@@ -56,13 +56,12 @@ export default { ...@@ -56,13 +56,12 @@ export default {
}, },
methods: { methods: {
querySubsidyList () { querySubsidyList () {
let SubsidyListData = this.$qs.stringify({ let SubsidyListData = {
ddUserId: this.ddUserId, ddUserId: this.ddUserId,
currentPage: this.pagination.current, currentPage: this.pagination.current,
pageNumber: this.pagination.defaultPageSize, pageNumber: this.pagination.defaultPageSize
orgId: localStorage.getItem('orgId') }
}) $http.get(`/mingpay/v1/isv/account/query_subsidyList_by_user_id`, SubsidyListData).then((res) => {
$http.get(`/mingpay/v1/isv/account/query_subsidyList_by_user_id?${SubsidyListData}`).then((res) => {
let data = res.data.data let data = res.data.data
this.subsidyList = data.recordList this.subsidyList = data.recordList
this.pagination.total = parseInt(data.totalCount) this.pagination.total = parseInt(data.totalCount)
......
...@@ -6,8 +6,6 @@ import { Upload, Menu, Layout, Breadcrumb, Popover, Icon, Button, DatePicker, In ...@@ -6,8 +6,6 @@ import { Upload, Menu, Layout, Breadcrumb, Popover, Icon, Button, DatePicker, In
import 'ant-design-vue/dist/antd.css' import 'ant-design-vue/dist/antd.css'
import { config } from './api/config' import { config } from './api/config'
import './assets/css/global.css' import './assets/css/global.css'
import axios from 'axios'
import qs from 'qs'
Vue.use(Layout) Vue.use(Layout)
Vue.use(Upload) Vue.use(Upload)
...@@ -33,8 +31,6 @@ Vue.use(Input.TextArea) ...@@ -33,8 +31,6 @@ Vue.use(Input.TextArea)
Vue.use(message) Vue.use(message)
Vue.use(Pagination) Vue.use(Pagination)
Vue.config.productionTip = false Vue.config.productionTip = false
// Vue.prototype.$http = axios
Vue.prototype.$qs = qs
Vue.prototype.$confirm = Modal.confirm Vue.prototype.$confirm = Modal.confirm
Vue.prototype.$message = message Vue.prototype.$message = message
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment