import request from '@/utils/request'
import { URL } from '@/config'


/**
 * @name 获取商品分类列表（下拉框）
 * @api 
 * @returns {
  *  "id": 256,                            1级分类ID
  *  "label": "安防监控",                   分类名称
  *  "children": [                         二级分类数组
  *      {
  *          "id": 257,                    二级分类ID
  *          "label": "室内摄像机",         分类名称
  *          "children": [],               三级分类数组
  *          "pid": null                   
  *      },
  *  ],
  *  "pid": null
  *}
 */

export function getList(params) {
  return request({
    url: URL.shop.product.base.getList,
    method: 'get',
    params,
  })
}



export function doEdit(data) {
  return request({
    url: URL.shop.product.base.doEdit,
    method: 'post',
    data,
  })
}

export function enable(data) {
  return request({
    url: URL.shop.product.base.enable,
    method: 'post',
    data,
  })
}

export function doDelete(data) {
  return request({
    url: URL.shop.product.base.doDelete,
    method: 'post',
    data,
  })
}

export function close(data) {
  return request({
    url: URL.shop.product.base.close,
    method: 'post',
    data,
  })
}

export function editFiled(data) {
  return request({
    url: URL.shop.product.base.editFiled,
    method: 'post',
    data,
  })
}

export function editState(data) {
  return request({
    url: URL.shop.product.base.editState,
    method: 'post',
    data,
  })
}

export function addDistProduct(data) {
  return request({
    url: URL.shop.product.base.addDistProduct,
    method: 'post',
    data,
  })
}

export function addBatchDistProduct(data) {
  return request({
    url: URL.shop.product.base.addBatchDistProduct,
    method: 'post',
    data,
  })
}

export function saveProduct(data) {
  return request({
    url: URL.shop.product.base.saveProduct,
    method: 'post',
    data,
  })
}

export function getxfz(data) {
  return request({
    url: URL.shop.product.base.getxfz,
    method: 'get',
    data,
  })
}

export function verify(data) {
  return request({
    url: URL.shop.product.base.verify,
    method: 'post',
    data,
  })
}

export function saveCourse(data) {
  return request({
    url: URL.shop.product.base.saveCourse,
    method: 'post',
    data,
  })
}

export function getCourseList(params) {
  return request({
    url: URL.shop.product.base.getCourseList,
    method: 'get',
    params,
  })
}

export function expProductTemp(data) {
  return request({
    url: URL.shop.product.base.expProductTemp,
    method: 'post',
    data,
    responseType: 'blob',
  })
}

export function impProductTemp(data) {
  return request({
    url: URL.shop.product.base.impProductTemp,
    method: 'post',
    data,
  })
}

export function exportFile(data) {
  return request({
    url: URL.shop.product.base.exportFile,
    method: 'post',
    data,
  })
}
