import request from '@/utils/request'

// 查询物料列表
export function listGoods(query) {
  return request({
    url: '/system/goods/list',
    method: 'get',
    params: query
  })
}

// 查询物料详细
export function getGoods(id) {
  return request({
    url: '/system/goods/' + id,
    method: 'get'
  })
}

// 新增物料
export function addGoods(data) {
  return request({
    url: '/system/goods',
    method: 'post',
    data: data
  })
}

// 修改物料
export function updateGoods(data) {
  return request({
    url: '/system/goods',
    method: 'put',
    data: data
  })
}

// 删除物料
export function delGoods(id) {
  return request({
    url: '/system/goods/' + id,
    method: 'delete'
  })
}
// 启用
export function enabled(id) {
  return request({
    url: '/system/goods/enable/' + id,
    method: 'delete'
  })
}

// 禁用
export function disabled(id) {
  return request({
    url: '/system/goods/disable/' + id,
    method: 'delete'
  })
}

// 状态修改
export function changeStatus(id, status) {
  const data = {
    id,
    status
  }
  return request({
    url: '/system/goods/changeStatus',
    method: 'put',
    data: data
  })
}