import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/sc/wps/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/api/supplychain/wpsgoods/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/supplychain/wpsgoods/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/supplychain/wpsgoods/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/supplychain/wpsgoods/submit',
    method: 'post',
    data: row
  })
}

export const tree = () => {
  return request({
    url: '/api/redenvelopemall/categoryinfo/tree',
    method: 'get'
  })
}

export const zoneTypeOption = () => {
  return request({
    url: '/api/blade-system/dict-biz/dictionary?code=zone_type',
    method: 'get',
  })
}

export const importGoods = (ids, grossRate, categoryIds, zoneType) => {
  return request({
    url: '/api/sc/wps/importGoods',
    method: 'post',
    params: {
      ids,
      grossRate,
      categoryIds,
      zoneType
    }
  })
}

export const getGoodsClassify = (level, parentCode) => {
  return request({
    url: '/api/sc/wps/getGoodsClassify',
    method: 'get',
    params: {
      level,
      parentCode
    }
  })
}

export const importCheck = (brands) => {
  return request({
    url: '/api/sc/wps/importCheck',
    method: 'post',
    data: {"brandNames": brands}
  })
}

