common.js 2.5 KB
/*
 * @Descripttion:公共 API
 * @version:1.0.0
 * @Author: limin
 * @Date: 2021-06-08 10:59:15
 * @LastEditors: limin
 * @LastEditTime: 2021-06-28 13:08:50
 */
import request from '@/plugins/axios'
const common = {
  /**
   * 根据code登录获取用户信息
   * @param {*} data 参数
   * @returns
   */
  login: function(code, type) {
    return request({
      url: `/user/login`,
      method: 'get',
      params: { code, employeeType: type }
    })
  },
  /**
   * 获取门店下的车品牌
   * @returns
   */
  getCarBrands: function() {
    return request({
      url: `/car/getCarBrands`,
      method: 'get'
    })
  },
  /**
   * 获取车品牌下的车系
   * @returns
   */
  getCarLines: function(carBrandId) {
    return request({
      url: `/car/getCarLines`,
      method: 'get',
      params: { carBrandId }
    })
  },
  /**
   * 获取车系下的车型
   * @returns
   */
  getCarModels: function(carLineId) {
    return request({
      url: `/car/getCarModels`,
      method: 'get',
      params: { carLineId }
    })
  },
  /**
   * 获取员工列表
   * @returns
   */
  getEmployees: function() {
    return request({
      url: `/user/getWeComEmployees`,
      method: 'get',
      loading: true
    })
  },
  upload: function(file) {
    let formData = new FormData()
    formData.append('file', file)
    return request.post('/file/uploadFile', formData, {
      'Content-Type': 'multipart/form-data'
    })
  },
  getjsconfig(requestUrl) {
    return request({
      url: `/ww/access/jsconfig`,
      method: 'get',
      params: { requestUrl }
    })
  },
  getagentconfig(requestUrl) {
    return request({
      url: `/ww/access/agentconfig`,
      method: 'get',
      params: { requestUrl }
    })
  },
  /**
   * 获取订单状态列表
   */
  getOrderStatus: function() {
    return request({
      loading: true,
      url: '/public/getOrderStatusEnum',
      method: 'get'
    })
  },
  /**
   * 获取客户信息配置数据列表
   */
  getConfigList: function(params = {}) {
    return request({
      url: '/config/getCustomerConfigList',
      method: 'get',
      params
    })
  },
  /**
   * 通过配置组值获取配置数据列表
   */
  getListByGroup: function(params = {}) {
    return request({
      url: '/config/getListByGroup',
      method: 'get',
      params
    })
  },
  /**
   * 获取跟进状态列表
   */
  getFollowStatus: function(params = {}) {
    return request({
      url: '/public/getFollowStatusEnum',
      method: 'get'
    })
  }
}
export default common