Commit 3ba5dc05 by liang ce

token和orgId封装

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