import request from '@/utils/request'

// 查询物料明细列表
export function listSku(query) {
    return request({
        url: '/mapi/core/sku/list',
        method: 'get',
        params: query
    })
}

// 查询物料明细详细
export function getSku(id) {
    return request({
        url: '/mapi/core/sku/' + id,
        method: 'get'
    })
}

// 新增物料明细
export function addSku(data) {
    return request({
        url: '/mapi/core/sku',
        method: 'post',
        data: data
    })
}

// 修改物料明细
export function updateSku(data) {
    return request({
        url: '/mapi/core/sku',
        method: 'put',
        data: data
    })
}

// 删除物料明细
export function delSku(id) {
    return request({
        url: '/mapi/core/sku/' + id,
        method: 'delete'
    })
}


// 修改物料明细状态
export function updateSkuStatus(id,status) {
    const data = {
        id,
        status
    }
    return request({
        url: '/mapi/core/sku/updateStatus',
        method: 'post',
        data: data
    })
}


// 查询物料明细列表
export function purchaseListSku(id) {
  return request({
    url: '/mapi/core/sku/purchase/list',
    method: 'get',
    params: { "id": id }
  })
}

// 零售商品列表
export function getGoodsListToGoodsRetail(data) {
  return request({
    url: '/mapi/core/sku/goodsRetail/getGoodsList',
    method: 'post',
    data: data
  })
}

// 零售商品物料列表
export function getGoodsSkuListToGoodsRetail(goodsId) {
  return request({
    url: '/mapi/core/sku/goodsRetail/getGoodsSkuList',
    method: 'get',
    params: { "id": goodsId }
  })
}
