import request, { postBlob, handleImport, getBlob } from '@/utils/request'
export function getDealerListV2(params) {
  return request({
    url: `/customer/list/v2?moduleId=${params.moduleId}`,
    method: 'post',
    data: params
  })
}
export function exportDealerListV2(data, name) {
  return postBlob({
    url: '/customer/user/export/v2',
    data,
    name
  })
}
export function getDealerStockListV2(params) {
  return request({
    url: `/customer/pt/list/v2?moduleId=${params.moduleId}`,
    method: 'post',
    data: params
  })
}
export function exportDealerStockListV2(data, name) {
  return postBlob({
    url: '/customer/pt/user/export/v2',
    data,
    name
  })
}

export function getStagecustomerListV2(params) {
  return request({
    url: `/StageCustomer/list/v2?moduleId=${params.moduleId}`,
    method: 'post',
    data: params
  })
}
export function exportStagecustomerV2(data, name) {
  return postBlob({
    url: '/StageCustomer/user/export/v2',
    data,
    name
  })
}
export function addStagecustomer(data) {
  return request({
    url: '/StageCustomer/add',
    method: 'post',
    data
  })
}
export function examineStagecustomer(params) {
  return request({
    url: '/StageCustomer/examine',
    method: 'post',
    params
  })
}
export function updateStagecustomer(data) {
  return request({
    url: '/StageCustomer/update',
    method: 'post',
    data
  })
}

export function getStageCustomerDetail(params) {
  return request({
    url: '/StageCustomer/detail',
    method: 'get',
    params
  })
}

export function importCustomerV2(data) {
  return handleImport('customer/import', data.formdata, data.id || '')
}
export function importCustomerPtV2(data) {
  return handleImport('customer/pt/importData', data.formdata, data.id || '')
}
export function downloadCustomerPtV2(data, name) {
  return getBlob({
    url: 'customer/pt/download',
    data,
    name
  })
}
//获取经销商列表
export function getDealerList(params) {
  return request({
    url: '/customer/list',
    method: 'get',
    params
  })
}
//经销商详情
export function getDealerInfo(params) {
  return request({
    url: '/customer/detail',
    method: 'get',
    params
  })
}
// 基础上设置前置仓或商家仓

export function updateCustomer(params) {
  return request({
    url: '/customer/update',
    method: 'post',
    params
  })
}
//经销商客户存货分类列表
export function getDealerStockList(params) {
  return request({
    url: '/customer/pt/list',
    method: 'get',
    params
  })
}
//新增经销商客户存货分类
export function getDealerStockAdd(data) {
  return request({
    url: '/customer/pt/add',
    method: 'post',
    data
  })
}
//删除经销商客户存货分类
export function deleDealerStockList(params) {
  return request({
    url: '/customer/pt/delete',
    method: 'post',
    params
  })
}
//经销商工程机配置列表
export function getDealerDepositList(params) {
  return request({
    url: '/customer/deposit/list',
    method: 'get',
    params
  })
}
//新增经销商工程机配置
export function getDealerDepositAdd(data) {
  return request({
    url: '/customer/deposit/add',
    method: 'post',
    data
  })
}
//删除经销商工程机配置
export function deleDealerDeposit(params) {
  return request({
    url: '/customer/deposit/delete',
    method: 'post',
    params
  })
}
//修改经销商工程机配置
export function editDealerDeposit(data) {
  return request({
    url: '/customer/deposit/update',
    method: 'post',
    data
  })
}
//经销商工程机配置详情
export function infoDealerDeposit(params) {
  return request({
    url: '/customer/deposit/detail',
    method: 'get',
    params
  })
}
//经销商申请列表
export function getDealerApplyList(params) {
  return request({
    url: '/customer/apply/list',
    method: 'get',
    params
  })
}

//字典
export function getDictionaries(params) {
  return request({
    url: '/common/dict/list',
    method: 'get',
    params
  })
}
//产品类别列表
export function getProductCategoryList(params) {
  return request({
    url: '/product-category/list',
    method: 'get',
    params
  })
}
//根据父级查询部门
export function getAdminWebsitByparent(params) {
  return request({
    url: '/admin/websit/byparent',
    method: 'get',
    params
  })
}
//帐号列表
export function getAdminUserList(params) {
  return request({
    url: '/admin/user/list',
    method: 'get',
    params
  })
}
//经销商客户存货分类-详情
export function getCustomerPtDetail(params) {
  return request({
    url: '/customer/pt/detail',
    method: 'get',
    params
  })
}
//修改经销商客户存货分类
export function getCustomerPtUpdate(data) {
  return request({
    url: '/customer/pt/update',
    method: 'post',
    data
  })
}
//经销商钱包列表
export function getWalletCustomerList(params) {
  return request({
    url: '/wallet/customer/list',
    method: 'get',
    params
  })
}
//经销商工程机配置详情列表
export function getCustomerDepositDetailList(params) {
  return request({
    url: '/customer/deposit/detailList',
    method: 'get',
    params
  })
}
//获取经销商
export function getListCustomer(params) {
  return request({
    url: '/pick/listCustomer',
    method: 'get',
    params
  })
}

//获取经销商
export function getK3DepartmentList(params) {
  return request({
    url: '/k3/department/list',
    method: 'get',
    params
  })
}

// 客户销售单导出
export function importCustomer(data, name) {
  return handleImport({
    url: '/customer/import',
    data,
    name
  })
}

//基础上设置自提和物流
export function updatePick(params) {
  return request({
    url: '/customer/updatePick',
    method: 'post',
    params
  })
}

// 经销商绑定售后系统
export function updateSystem(params) {
  return request({
    url: '/customer/updateSystem',
    method: 'post',
    params
  })
}
