You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.8 KiB

import request, { baseUrl } from "@/utils/request";
import { getToken, removeToken, removeUserInfo } from "@/utils/auth";
export const getGoodsList = (params) => request('/erp/goods/list', params, 'get')
export const getGoodsById = (params) => request('/erp/goods/queryById', params, 'get')
export const getOrderList = (params) => request('/erp/order/list', params, 'get')
export const addOrder = (params) => request('/erp/order/add', params, 'post')
export const editOrder = (params) => request('/erp/order/edit', params, 'post')
export const getStatusList = (params) => request('/erp/order/queryState', params, 'get')
export const getStoreList = (params) => request('/erp/storeInfo/list', params, 'get')
export const getAddrList = (params) => request('/erp/addrManager/list', params, 'get')
export const addAddr = (params) => request('/erp/addrManager/add', params, 'post')
export const editAddr = (params) => request('/erp/addrManager/edit', params, 'post')
export const delAddr = (params) => request('/erp/addrManager/delete?id='+params, {} , 'delete')
export const getCode = (params) => request('/sys/randomImage/' + params, {}, 'get')
export const login = (params) => request('/sys/login', params, 'POST')
export const addCommit = (params) => request('/erp/bbs/add', params, 'post')
export const getCommits = (params) => request('/erp/bbs/list', params, 'get')
export const getCommit = (params) => request('/erp/bbs/queryById', params, 'get')
export const addCart = (params) => request('/erp/shoppingCart/add', params, 'post')
export const delCart = (params) => request('/erp/shoppingCart/delete?id='+params, {} , 'delete')
export const delCarts = (params) => request('/erp/shoppingCart/deleteBatch?ids='+params, {} , 'delete')
export const getCarts = (params) => request('/erp/shoppingCart/list', params , 'get')
export const uploadFile = (filePath) => {
return new Promise((resolve, reject) => {
uni.showLoading({
mask: true
})
uni.uploadFile({
url: baseUrl + '/sys/common/upload', //仅为示例,非真实的接口地址
filePath,
name: 'file',
header: {
'X-Access-Token': getToken(),
},
formData: {
biz: 'temp',
},
success: (res) => {
uni.hideLoading()
if (res.statusCode && res.statusCode === 401) {
removeToken()
removeUserInfo()
uni.showToast({
title: '登录超时',
icon: 'none'
})
setTimeout(() => {
uni.redirectTo({
url: '/pages/login/index1?status=' +1
})
}, 500)
return
}
const data = JSON.parse(res.data)
if (data.code === 500)
{
uni.showToast({
title: data.message,
icon: 'none'
})
return
}
resolve(data.message)
},
fail(e) {
uni.hideLoading()
reject(e)
console.log('e', e)
}
});
})
}