commodity.js 4.39 KB
import request from '@/utils/request'

//* ******************** 添加商品  *********************
// 选择商品分组查询
export function getGroupSelect(data) {
  return request({
    url: '/product/getGroupSelect',
    method: 'post',
    data
  })
}

// 商品分类
export function getClassifySelect(data) {
  return request({
    url: '/product/getClassifySelect',
    method: 'post',
    data
  })
}

// 商品管理查询
export function getClassifyGetAll(data) {
  return request({
    url: '/product/getAll',
    method: 'post',
    data
  })
}

// 修改商品查询
export function getClassifyGetById(data) {
  return request({
    url: '/product/getById',
    method: 'post',
    data
  })
}

// 修改商品
export function getClassifyUpdate(data) {
  return request({
    url: '/product/update',
    method: 'post',
    data
  })
}

// 品牌列表
export function getBrandList() {
  return request({
    url: '/product/getBrandList',
    method: 'POST'
  })
}

// 新增商品
export function getClassifyAdd(data) {
  return request({
    url: '/product/save',
    method: 'post',
    data
  })
}
// 商品上下架
export function getClassifyStart(data) {
  return request({
    url: '/product/start',
    method: 'post',
    data
  })
}

// 商品分类
export function getClassify(data) {
  return request({
    url: '/product/getClassify',
    method: 'post',
    data
  })
}

// 删除商品
export function getClassifyDelete(data) {
  return request({
    url: '/product/delete',
    method: 'post',
    data
  })
}

// 导入商品模板表下载
export const downloadTemplate = (data = {}) => {
  return request({
    url: 'product/downloadTemplate',
    method: 'post',
    data,
    responseType: 'blob'
    // type:"application/vnd.ms-excel;charset=utf-8"
  })
}

// 上传商品模板
export const importProduct = (data = {}) => {
  return request({
    url: 'product/importProduct',
    method: 'post',
    data,
    headers: {
      'Content-type': 'multipart/form-data'
    }
  })
}

//* ******************** 商品分组  *********************
// 分组查询
export function commodityListGetAll(data) {
  return request({
    url: '/group/getAll',
    method: 'post',
    data
  })
}

// 分组详情查询
export function commodityListGetById(data) {
  return request({
    url: '/group/getById',
    method: 'post',
    data
  })
}
// 分组删除
export function commodityListDelete(data) {
  return request({
    url: '/group/delete',
    method: 'post',
    data
  })
}
// 修改分组
export function commodityListUpdate(data) {
  return request({
    url: '/group/update',
    method: 'post',
    data
  })
}
// 添加分组
export function commodityListAdd(data) {
  return request({
    url: '/group/save',
    method: 'post',
    data
  })
}
// 分组商品查询
export function getGroupList(data) {
  return request({
    url: '/group/getProducts',
    method: 'post',
    data
  })
}

//* ******************** 设置会员价格  *********************

// 商品会员价格数据查询
export function getProductMembers(data) {
  return request({
    url: '/product/getProductMembers',
    method: 'post',
    data
  })
}

// 商品设置会员价
export function setProductMember(data) {
  return request({
    url: '/product/setProductMember',
    method: 'post',
    data
  })
}

// 清除商品会员价
export function clearProductMember(data) {
  return request({
    url: '/product/clearProductMember',
    method: 'post',
    data
  })
}

// 导出商品信息
export function productExport(data) {
  return request({
    url: '/product/exportProduct',
    method: 'post',
    data,
    responseType: 'blob'
  })
}
// 拆分
export function chFen(data) {
  return request({
    url: '/product/dismantleCombinationProduct',
    method: 'post',
    data,
    responseType: 'blob'
  })
}

//  采购接口
  // 查询
  export function cereInventoryQueryByPage(data) {
    return request({
      url: '/cereInventory/getAll',
      method: 'post',
      data
    })
  }
  // 新增
  export function cereInventoryAdd(data) {
    return request({
      url: '/cereInventory/add',
      method: 'post',
      data
    })
  }
  // 编辑
  export function cereInventoryEdit(data) {
    return request({
      url: '/cereInventory/edit',
      method: 'post',
      data
    })
  }
  // 编辑
  export function cereInventoryDel(data) {
    return request({
      url: `cereInventory/delete/${data.id}`,
      method: 'get',
      data
    })
  }