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

// 获取列表
export function getList(params) {
  return request({
    url: '/engin-info-order/list',
    method: 'get',
    params
  })
}

// 获取详情
export function getDetail(params) {
  return request({
    url: '/retail/detail',
    method: 'get',
    params
  })
}

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

// 工程信息单 - 获取产品列表
export function getEnginProductList(params) {
  return request({
    url: '/bus/price/list',
    method: 'get',
    params
  })
}

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

// 工程信息单 - 获取列表
export function v2EnginInfoOrderList(data) {
  return request({
    url: `/v2/engin-info-order/list?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

//工程信息单-导出
export function v2EnginInfoOrderListExport(data, name) {
  return postBlob({
    url: '/v2/engin-info-order/list/export',
    method: 'post',
    data,
    name
  })
}

// 工程信息单 - 获取列表
export function getEnginList(params) {
  return request({
    url: '/engin-info-order/list',
    method: 'get',
    params
  })
}

// 工程信息单 - 获取详情
export function getEnginDetail(params) {
  return request({
    url: '/engin-info-order/detail',
    method: 'get',
    params
  })
}

// 工程信息单 - 审批
export function examineEngin(params) {
  return request({
    url: '/engin-info-order/examine',
    method: 'post',
    data: params
  })
}

// 工程信息单 - 新增
export function addEngin(params) {
  return request({
    url: '/engin-info-order/add',
    method: 'post',
    data: params
  })
}

// 工程信息单 - 编辑
export function editEngin(params) {
  return request({
    url: '/engin-info-order/edit',
    method: 'post',
    data: params
  })
}

// 工程信息单 - 编辑日期
export function editDateEngin(params) {
  return request({
    url: '/engin-info-order/upd-date',
    method: 'post',
    data: params
  })
}

// 工程信息单 - 提交审核
export function submitEngin(params) {
  return request({
    url: '/engin-info-order/submit',
    method: 'post',
    data: params
  })
}

// 工程信息单 - 申请
export function applyEngin(params) {
  return request({
    url: '/engin-info-order/submit-on-list',
    method: 'post',
    params
  })
}

// 工程信息单 - 撤回
export function withdrawEngin(params) {
  return request({
    url: '/engin-info-order/revoke',
    method: 'post',
    params
  })
}

// 工程信息单 - 弃审
export function abandonEngin(params) {
  return request({
    url: '/engin-info-order/abandon',
    method: 'post',
    params
  })
}

// 工程信息单 - 删除
export function deleteEngin(params) {
  return request({
    url: '/engin-info-order/del',
    method: 'post',
    params
  })
}

// 工程信息单 - 直调完结
export function overEngin(params) {
  return request({
    url: '/engin-info-order/end-status-upd',
    method: 'post',
    params
  })
}

// 家用工程订单-列表统计
export function v2EnginOrderHomeCountList(data) {
  return request({
    url: `/v2/engin-order/home/count-list?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

// 家用工程订单-列表
export function v2EnginOrderHomeList(data) {
  return request({
    url: `/v2/engin-order/home/list?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

//家用工程订单-导出
export function v2EnginOrderHomeListExport(data, name) {
  return postBlob({
    url: '/v2/engin-order/home/list/export',
    method: 'post',
    data,
    name
  })
}

// 商用工程订单-列表
export function v2EnginOrderTradeList(data) {
  return request({
    url: `/v2/engin-order/trade/list?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

//商用工程订单-导出
export function v2EnginOrderTradeListExport(data, name) {
  return postBlob({
    url: '/v2/engin-order/trade/list/export',
    method: 'post',
    data,
    name
  })
}

// 工程订单 - 获取列表
export function getOrderList(params) {
  return request({
    url: '/engin-order/list',
    method: 'get',
    params
  })
}

// 工程订单 - 获取详情
export function getOrderDetail(params) {
  return request({
    url: '/engin-order/detail',
    method: 'get',
    params
  })
}

// 工程订单 - 直调完结
export function overOrder(params) {
  return request({
    url: '/engin-order/end-direct-transfer',
    method: 'post',
    params
  })
}

// 工程订单 - 直调发货
export function deliverOrder(params) {
  return request({
    url: '/invoice/rak/addProjectRak',
    method: 'post',
    data: params
  })
}

// 工程订单 - 提前开票
export function directOrder(params) {
  return request({
    url: '/requisition/add',
    method: 'post',
    data: params
  })
}

// 家用工程订单 - 获取工程登录列表
export function getHomeLoginList(params) {
  return request({
    url: '/engin-sys/api/list',
    method: 'get',
    params
  })
}

// 家用工程订单 - 获取工程登录详情
export function getHomeLoginDetail(params) {
  return request({
    url: '/engin-sys/api/detail',
    method: 'get',
    params
  })
}

// 家用工程订单 - 新增
export function addHome(params) {
  return request({
    url: '/engin-order/home-add',
    method: 'post',
    data: params
  })
}

// 家用工程订单 - 编辑
export function editHome(params) {
  return request({
    url: '/engin-order/home-edit',
    method: 'post',
    data: params
  })
}

// 家用工程订单 - 编辑日期
export function editDateHome(params) {
  return request({
    url: '/engin-order/home-upd-date',
    method: 'post',
    data: params
  })
}

// 家用工程订单 - 编辑备注
export function editRemarkHome(params) {
  return request({
    url: '/engin-order/home-upd-note',
    method: 'post',
    data: params
  })
}

// 家用工程订单 - 提交审核
export function submitHome(params) {
  return request({
    url: '/engin-order/home-submit',
    method: 'post',
    data: params
  })
}

// 家用工程订单 - 申请
export function applyHome(params) {
  return request({
    url: '/engin-order/home-submit-on-list',
    method: 'post',
    params
  })
}

// 家用工程订单 - 撤回
export function withdrawHome(params) {
  return request({
    url: '/engin-order/home-revoke',
    method: 'post',
    params
  })
}

// 家用工程订单 - 弃审
export function abandonHome(params) {
  return request({
    url: '/engin-order/home-abandon',
    method: 'post',
    params
  })
}

// 家用工程订单 - 删除
export function deleteHome(params) {
  return request({
    url: '/engin-order/home-del',
    method: 'post',
    params
  })
}

// 家用工程订单 - 关闭订单
export function closeHome(params) {
  return request({
    url: '/engin-order/home-close',
    method: 'post',
    params
  })
}

// 家用工程订单 - 审批
export function examineHome(params) {
  return request({
    url: '/engin-order/home-examine',
    method: 'post',
    data: params
  })
}

// 家用工程订单 - 退订
export function returnHome(params) {
  return request({
    url: '/engin-order/home-refund',
    method: 'post',
    data: params
  })
}

// 商用工程订单 - 获取工程登录列表
export function getComLoginList(params) {
  return request({
    url: '/engin-info/list',
    method: 'get',
    params
  })
}

// 商用工程订单 - 获取工程登录详情
export function getComLoginDetail(params) {
  return request({
    url: '/engin-info/ref/detail',
    method: 'get',
    params
  })
}

// 商用工程订单 - 新增
export function addCom(params) {
  return request({
    url: '/engin-order/trade-add',
    method: 'post',
    data: params
  })
}

// 商用工程订单 - 编辑
export function editCom(params) {
  return request({
    url: '/engin-order/trade-edit',
    method: 'post',
    data: params
  })
}

// 商用工程订单 - 编辑日期
export function editDateCom(params) {
  return request({
    url: '/engin-order/trade-upd-date',
    method: 'post',
    data: params
  })
}

// 商用工程订单 - 编辑备注
export function editRemarkCom(params) {
  return request({
    url: '/engin-order/trade-upd-note',
    method: 'post',
    data: params
  })
}

// 商用工程订单 - 提交审核
export function submitCom(params) {
  return request({
    url: '/engin-order/trade-submit',
    method: 'post',
    data: params
  })
}

// 商用工程订单 - 申请
export function applyCom(params) {
  return request({
    url: '/engin-order/trade-submit-on-list',
    method: 'post',
    params
  })
}

// 商用工程订单 - 撤回
export function withdrawCom(params) {
  return request({
    url: '/engin-order/trade-revoke',
    method: 'post',
    params
  })
}

// 商用工程订单 - 弃审
export function abandonCom(params) {
  return request({
    url: '/engin-order/trade-abandon',
    method: 'post',
    params
  })
}

// 商用工程订单 - 删除
export function deleteCom(params) {
  return request({
    url: '/engin-order/trade-del',
    method: 'post',
    params
  })
}

// 商用工程订单 - 关闭订单
export function closeCom(params) {
  return request({
    url: '/engin-order/trade-close',
    method: 'post',
    params
  })
}

// 商用工程订单 - 审批
export function examineCom(params) {
  return request({
    url: '/engin-order/trade-examine',
    method: 'post',
    data: params
  })
}

// 商用工程订单 - 退订
export function returnCom(params) {
  return request({
    url: '/engin-order/trade-refund',
    method: 'post',
    data: 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 getWalletList(params) {
  return request({
    url: '/wallet/customer/list',
    method: 'get',
    params
  })
}

// 打开/关闭信息单
export function setOrderIsClose(params) {
  return request({
    url: '/engin-info-order/close/update',
    method: 'post',
    params
  })
}

// 信息货品删除
export function delItem(params) {
  return request({
    url: '/engin-info-order/del-item',
    method: 'post',
    params
  })
}

// 工程订单列表统计
export function getEnginCountList(params) {
  return request({
    url: '/engin-order/count-list',
    method: 'get',
    params
  })
}

// 商用工程登录单-引用
export function getLoginOrderList(params) {
  return request({
    url: '/trade/login/order/ref',
    method: 'post',
    params
  })
}
