import request from '@/utils/request'

// 查询商品列表
export function listStoreProduct(query) {
  return request({
    url: '/store/store/storeProduct/list',
    method: 'get',
    params: query
  })
}

export function batchModify(param) {
  return request({
    url: '/store/store/storeProduct/batchModify',
    method: 'post',
    data: param
  })
}

export function batchAudit(param) {
  return request({
    url: '/store/store/storeProduct/batchAudit',
    method: 'post',
    data: param
  })
}

// 查询商品详细
export function getStoreProduct(productId) {
  return request({
    url: '/store/store/storeProduct/' + productId,
    method: 'get'
  })
}


export function addOrEdit(data) {
  return request({
    url: '/store/store/storeProduct/addOrEdit',
    method: 'post',
    data: data
  })
}

export function importTemplate() {
  return request({
    url: '/store/store/storeProduct/importTemplate',
    method: 'get'
  })
}


// 删除商品
export function delStoreProduct(productId) {
  return request({
    url: '/store/store/storeProduct/' + productId,
    method: 'delete'
  })
}
// 复制商品
export function copyStoreProduct(productId) {
  return request({
    url: '/store/store/storeProduct/copyStoreProduct?productId=' + productId,
    method: 'get'
  })
}

// 批量复制商品
export function bulkCopy(productId) {
  return request({
    url: '/store/store/storeProduct/bulkCopy/' + productId,
    method: 'get'
  })
}

// 导出商品
export function exportStoreProduct(query) {
  return request({
    url: '/store/store/storeProduct/export',
    method: 'get',
    params: query
  })
}

export function genFormatAttr(productId,json) {
  return request({
    url: '/store/store/storeProduct/genFormatAttr/'+productId,
    method: 'post',
    data: json
  })
}


export function getStoreProductAttrValueList(query) {
  return request({
    url: '/store/store/storeProduct/getStoreProductAttrValueList',
    method: 'get',
    params: query
  })
}


export function getStoreTuiProductAttrValueList(query) {
  return request({
    url: '/store/store/storeProduct/getStoreTuiProductAttrValueList',
    method: 'get',
    params: query
  })
}

export function productBySearCh(query) {
  return request({
    url: '/store/store/storeProduct/listBySearch',
    method: 'get',
    params: query
  })
}


