import request, { postBlob, getBlob, handleImport } from '@/utils/request'

// 获取列表
export function listPageV2(data) {
  return request({
    url: `/websit/goods/p/list?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

//导出
export function pageExport(data, name) {
  return postBlob({
    url: '/websit/goods/p/list/export',
    data,
    name
  })
}

// 新增
export function add(data) {
  return request({
    url: `/websit/goods/add`,
    method: 'post',
    data
  })
}

// 编辑
export function edit(data) {
  return request({
    url: `/websit/goods/edit`,
    method: 'post',
    data
  })
}

// 详情
export function getDetail(params) {
  return request({
    url: `/websit/goods/detail`,
    method: 'post',
    params
  })
}

// 上下架
export function updateStatus(params) {
  return request({
    url: `/websit/goods/batch/update/status`,
    method: 'post',
    params
  })
}

// 字典数据
export function getTypeList(data) {
  return request({
    url: `/dictCompany/page`,
    method: 'post',
    data
  })
}

// 字典数据
export function getCategoryList(params) {
  return request({
    url: `/goods/category/list`,
    method: 'get',
    params
  })
}

export function listImport1(data) {
	return handleImport('/websit/goods/p/import', data.formdata, data.id || '')
}

export function listImport2(data) {
	return handleImport('/websit/goods/p/import2', data.formdata, data.id || '')
}