import request from '@/utils/request'

export function addOrEdit(data) {
  return request({
    url: '/store/storeProduct/addOrEdit',
    method: 'post',
    data: data
  })
}
export function editPrice(data,price) {
  return request({
    url: '/store/storeProduct/price/'+price,
    method: 'post',
    data: data
  })
}
// 下载导入模板
export function importTemplate() {
  return request({
    url: '/store/storeProduct/importTemplate',
    method: 'get'
  })
}
export function genFormatAttr(productId,json) {
  return request({
    url: '/store/storeProduct/genFormatAttr/'+productId,
    method: 'post',
    data: json
  })
}
export function getAllStoreProductRule() {
  return request({
    url: '/store/storeProduct/getAllStoreProductRule',
    method: 'get'
  })
}

// 查询商品列表
export function listProduct(query) {
  return request({
    url: '/store/storeProduct/list',
    method: 'get',
    params: query
  })
}
// 查询商品商店列表
export function listStore() {
  return request({
    url: '/store/storeProduct/storeList',
    method: 'get'
  })
}
// 查询商品详细
export function getProduct(productId) {
  return request({
    url: '/store/storeProduct/' + productId,
    method: 'get'
  })
}

// 新增商品
export function addProduct(data) {
  return request({
    url: '/store/storeProduct',
    method: 'post',
    data: data
  })
}

// 修改商品
export function updateProduct(data) {
  return request({
    url: '/store/storeProduct',
    method: 'put',
    data: data
  })
}

// 删除商品
export function delProduct(productId) {
  return request({
    url: '/store/storeProduct/' + productId,
    method: 'delete'
  })
}

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

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

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

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

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



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

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


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


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

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


// 同步商品到580
export function sync580(productId) {
  return request({
    url: '/storeProduct/sync580/'+productId,
    method: 'post'
  })
}

export function updateIsShow(productIds) {
  return request({
    url: '/storeProduct/updateFsStoreProductIsShowBatch/' + (Array.isArray(productIds) ? productIds.join(',') : productIds),
    method: 'post'
  })
}


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


// 查询商品详细
export function getProductrAuthInfo(query) {
  return request({
    url: '/store/storeProduct/auditLog',
    method: 'get',
    params: query
  })
}


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


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

//成分检查
export function selectForbiddenKeywords(field, keywords) {
  return request({
    url: '/store/storeProduct/selectForbiddenKeywords',
    method: 'post',
    data:{field: field, keywords: keywords}
  })
}


// 获取器免列表
export function getExemptSecondMedicalDeviceList() {
  return request({
    url: '/store/exemptSecondMedicalDevice/getList',
    method: 'get'
  })
}



