import request, { postBlob, handleImport, getBlob } from '@/utils/request'
export function getMaterialListV2(params) {
  return request({
    url: `/k3/material/list/v2?moduleId=${params.moduleId}`,
    method: 'post',
    data: params
  })
}
export function exportMaterialListV2(data, name) {
  return postBlob({
    url: '/k3/material/export/v2',
    data,
    name
  })
}

export function getMachineLlistV2(params) {
  return request({
    url: `/v2/machine-record/list?moduleId=${params.moduleId}`,
    method: 'post',
    data: params
  })
}
export function exportMachineLlistV2(data, name) {
  return postBlob({
    url: '/v2/machine-record/list/export',
    data,
    name
  })
}

export function getCategoryListV2(params) {
  return request({
    url: `/v2/k3/category/list?moduleId=${params.moduleId}`,
    method: 'post',
    data: params
  })
}
export function exportCategoryListV2(data, name) {
  return postBlob({
    url: '/v2/k3/category/list/export',
    data,
    name
  })
}

export function getProductListV2(params) {
  return request({
    url: `/v2/product-compose/list?moduleId=${params.moduleId}`,
    method: 'post',
    data: params
  })
}
export function exportProductListV2(data, name) {
  return postBlob({
    url: '/v2/product-compose/list/export',
    data,
    name
  })
}

export function getList(params) {
  return request({
    url: '/admin/user/mch/list',
    method: 'get',
    params
  })
}
export function getCategoryList(params) {
  return request({
    url: '/k3/category/list',
    method: 'get',
    params
  })
}

export function editCategory(params) {
  return request({
    url: '/k3/material/edit',
    method: 'post',
    data: params
  })
}

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

export function getMaterialDetail(params) {
  console.log(params, 999)
  return request({
    url: '/k3/material/detail',
    method: 'get',
    params
  })
}

export function getProductDelete(params) {
  return request({
    url: '/product-price/delete',
    method: 'post',
    params: { ids: params.join(',') }
  })
}

export function getMachineLlist(params) {
  return request({
    url: '/machine-record/list',
    method: 'get',
    params
  })
}

export function getMachineEdit(params) {
  return request({
    url: '/machine-record/edit',
    method: 'post',
    data: params
  })
}

export function getMachineDel(params) {
  return request({
    url: '/machine-record/del',
    method: 'post',
    data: params
  })
}

export function getMachineAdd(params) {
  return request({
    url: '/machine-record/add',
    method: 'post',
    data: params
  })
}

// 产品对应关系

export function getProductAdd(params) {
  return request({
    url: '/product-compose/add',
    method: 'post',
    data: params
  })
}

export function getProductDel(params) {
  return request({
    url: '/product-compose/del',
    method: 'post',
    params
  })
}

export function getProductDetail(params) {
  return request({
    url: '/product-compose/detail',
    method: 'get',
    params
  })
}

export function getProductEdit(params) {
  return request({
    url: '/product-compose/edit',
    method: 'post',
    data: params
  })
}

//  /product-compose/export

export function getProductList(params) {
  return request({
    url: '/product-compose/list',
    method: 'get',
    params
  })
}

// 产品调价单管理

export function getProductRriceAdd(params) {
  return request({
    url: '/product-upd-price/add',
    method: 'post',
    data: params
  })
}

export function getDistList(params) {
  return request({
    url: '/common/dict/list',
    method: 'get',
    params
  })
}

export function getProductRricedel(params) {
  return request({
    url: '/product-upd-price/del',
    method: 'post',
    params: { ids: params.join(',') }
  })
}

export function getProductRriceDetail(params) {
  return request({
    url: '/product-upd-price/detail',
    method: 'get',
    params
  })
}

export function getProductRriceEdit(params) {
  return request({
    url: '/product-upd-price/edit',
    method: 'post',
    data: params
  })
}
// 弃审产品调价单
export function productUpdPriceReview(params) {
  return request({
    url: '/product-upd-price/review',
    method: 'post',
    params
  })
}


// 产品调价单-列表
export function v2ProductUpdPriceList(data) {
  return request({
    url: `/v2/product-upd-price/list?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

//产品调价单-导出
export function v2ProductUpdPriceListExport(data, name) {
  return postBlob({
    url: '/v2/product-upd-price/list/export',
    method: 'post',
    data,
    name
  })
}

//工程师组别配置API-模板下载
export function productUpdPriceDownload(data, name) {
  return getBlob({
    url: 'product-upd-price/download',
    data,
    name
  })
}
//导入调价单-导入
export function productUpdPriceMaterialImport(data) {
  return handleImport('/product-upd-price/material/import', data.formdata, data.id || '')
}

export function getProductRriceList(params) {
  return request({
    url: '/product-upd-price/list',
    method: 'get',
    params
  })
}

export function getProductRriceRevoke(params) {
  return request({
    url: '/product-upd-price/revoke',
    method: 'get',
    params
  })
}

export function getProductRriceSubmit(params) {
  return request({
    url: '/product-upd-price/submit',
    method: 'get',
    params
  })
}

// 产品调价单-列表
export function v2ProductPriceList(data) {
  return request({
    url: `/v2/product-price/list?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

//产品调价单-导出
export function v2ProductPriceListExport(data, name) {
  return postBlob({
    url: '/v2/product-price/list/export',
    method: 'post',
    data,
    name
  })
}

// 产品价格列表
export function getProductPriceList(params) {
  return request({
    url: '/product-price/list',
    method: 'get',
    params
  })
}

export function getTypeList(params) {
  return request({
    url: '/sale/type/list',
    method: 'get',
    params
  })
}

export function getTree(params) {
  return request({
    url: '/admin/websit/tree',
    method: 'get',
    params
  })
}

export function getRebate(params) {
  return request({
    url: '/wallet/rebate/list',
    method: 'get',
    params
  })
}

export function getWalletList(params) {
  return request({
    url: '/wallet/list',
    method: 'get',
    params
  })
}

//产品类别

//产品类别列表
export function getProductCategoryList(params) {
  return request({
    url: '/product-category/list',
    method: 'get',
    params
  })
}
//产品类别小类列表
export function getProductCategorySubList(params) {
  return request({
    url: '/product-category/sub-list',
    method: 'get',
    params
  })
}
//新增产品类别
export function getProductCategoryAdd(data) {
  return request({
    url: '/product-category/add',
    method: 'post',
    data
  })
}
//编辑产品类别
export function getProductCategoryEdit(data) {
  return request({
    url: '/product-category/edit',
    method: 'post',
    data
  })
}
//金蝶存货类别列表
export function getProductCategoryKingDeeCategoryList() {
  return request({
    url: '/product-category/king-dee-category-list',
    method: 'get'
  })
}
//new金蝶存货类别列表
export function getKingDeeCategory() {
  return request({
    url: '/product-category/king-dee-category',
    method: 'get'
  })
}

//新增产品类别小类
export function getProductCategoryAddSub(data) {
  return request({
    url: '/product-category/add-sub',
    method: 'post',
    data
  })
}

//删除产品类别小类
export function getProductCategoryDelSub(params) {
  return request({
    url: '/product-category/del-sub',
    method: 'post',
    params
  })
}
//删除产品类别
export function getProductCategoryDel(params) {
  return request({
    url: '/product-category/del',
    method: 'post',
    params
  })
}

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

export function getPriceSubmit(params) {
  return request({
    url: '/product-upd-price/submit',
    method: 'POST',
    params
  })
}

export function handlePriceRevoke(params) {
  return request({
    url: '/product-price/revoke',
    method: 'POST',
    params
  })
}

export function handleEdit(params) {
  return request({
    url: '/product-upd-price/edit',
    method: 'POST',
    data: params
  })
}

export function examineData(params) {
  return request({
    url: '/product-upd-price/confirm',
    method: 'POST',
    params
  })
}

export function getProductRriceConfirm(params) {
  return request({
    url: '/product-upd-price/confirm',
    method: 'POST',
    params
  })
}
