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

export function getRetailListV2(data) {
  return request({
    url: `/retail/listP/v2?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}


export function exportRetailListV2(data, name) {
  return postBlob({
    url: '/retail/listP/v2/export',
    method: 'post',
    data,
    name
  })
}
// 获取列表
export function getList(params) {
  return request({
    url: '/retail/list',
    method: 'get',
    params
  })
}
 
// 获取详情
export function getDetail(params) {
  return request({
    url: '/retail/detail',
    method: 'get',
    params
  })
}

// 关闭
export function closeData(params) {
  return request({
    url: '/retail/close',
    method: 'post',
    params
  })
}

// 审批
export function examineData(params) {
  return request({
    url: '/retail/examine',
    method: 'post',
    params
  })
}

// 退订
export function returnData(params) {
  return request({
    url: '/retail/return',
    method: 'post',
    params
  })
}

// 提交审核
export function submitData(params) {
  return request({
    url: '/retail/submit',
    method: 'post',
    params
  })
}

// 新增
export function addData(params) {
  return request({
    url: '/retail/add',
    method: 'post',
    data: params
  })
}

// 编辑
export function editData(params) {
  return request({
    url: '/retail/update',
    method: 'post',
    data: params
  })
}

// 获取销售类型列表
export function getSalesTypeList(params) {
  return request({
    url: '/sale/type/list',
    method: 'get',
    params
  })
}

// 获取产品列表
export function getGoodsList(params) {
  return request({
    url: '/retail/product/list',
    method: 'get',
    params
  })
}

// 获取钱包列表
export function getWalletList(params) {
  return request({
    url: '/wallet/customer/list',
    method: 'get',
    params
  })
}

// 获取仓库列表
export function getWarehouseList(params) {
  return request({
    url: '/stock/manager/listStock',
    method: 'get',
    params
  })
}

// 检查库存
export function checkStock(params) {
  return request({
    url: '/stock/manager/stockStatus',
    method: 'get',
    params
  })
}

export function submitCancel(params) {
  return request({
    url: '/retail/submit/cancel',
    method: 'post',
    params
  })
}
// 销售类型
export function typeList(params) {
  return request({
    url: '/sale/type/list',
    method: 'get',
    params
  })
}

// 销售政策
export function policyList(params) {
  return request({
    url: '/policy/list',
    method: 'get',
    params
  })
}

// 根据政策id和物料id反查政策条件
export function getpolicyList(params) {
  return request({
    url: '/policy/condition/get',
    method: 'get',
    params
  })
}

// 政策条件的机型列表
export function getConditionList(params) {
  return request({
    url: '/policy/condition/material/list',
    method: 'get',
    params
  })
}

export function getpolicyTypeList(params) {
  return request({
    url: '/policy/type1/material/list',
    method: 'get',
    params
  })
}

export function getMaterialTypeList(params) {
  return request({
    url: '/policy/material/list',
    method: 'get',
    params
  })
}

// 弃审
export function abandonData(params) {
  return request({
    url: '/retail/abandon',
    method: 'post',
    params
  })
}

export function getConditionDetail(params) {
  return request({
    url: '/policy/condition/detail',
    method: 'get',
    params
  })
}

// 政策条件
export function getPolicyConditionList(params) {
  return request({
    url: '/policy/condition/list',
    method: 'get',
    params
  })
}

// 业务员
export function getUserList(params) {
  return request({
    url: '/admin/user/list',
    method: 'get',
    params
  })
}

export function deleteList(params) {
  return request({
    url: '/retail/delete',
    method: 'post',
    params
  })
}

// 判断是否为生活电器品类
export function hasRak(params) {
  return request({
    url: '/invoice/rak/ifRak',
    method: 'post',
    params
  })
}
