/**
 * 商品借出相关API
 */

import request from '@/utils/request'

/**
 * 归还商品借出
 * @param id
 * @param parmas
 */
export function returnGoodsLend(id, parmas) {
  return request({
    url: `admin/lend/form/return/${id}`,
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: parmas
  })
}

/**
 * 批量确认商品借出单
 * @param id
 */
export function lendFormConfirm(ids) {
  return request({
    url: `admin/lend/form/confirm/${ids}`,
    method: 'post'
  })
}

/**
 * 获取商品借出列表
 * @param params
 */
export function getgoodsLendAddList(params) {
  return request({
    url: 'admin/lend/form',
    method: 'get',
    loaidng: false,
    params
  })
}

/**
 * 修改商品借出
 * @param id
 * @param parmas
 */
export function editgoodsLendAdd(id, parmas) {
  return request({
    url: `admin/lend/form/${id}`,
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: parmas
  })
}

/**
 * 添加商品借出
 * @param params
 */
export function addgoodsLendAdd(params) {
  return request({
    url: 'admin/lend/form',
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: params
  })
}

/**
 * 删除商品借出
 * @param id
 */
export function deletegoodsLendAdd(id) {
  return request({
    url: `admin/lend/form/${id}`,
    method: 'delete'
  })
}

/**
 * 商品借出详情
 * @param id
 */
export function getgoodsLendAddInfo(id) {
  return request({
    url: `admin/lend/form/${id}`,
    method: 'get'
  })
}

/**
 * 审核商品借出
 * @param params
 */
export function auditGoodsLend(id, parmas) {
  return request({
    url: `admin/lend/form/${id}/audit`,
    method: 'post',
    data: parmas
  })
}

/**
 * 获取商品借出详情
 * @param params
 */
export function getGoodsLendInfo(id) {
  return request({
    url: `admin/lend/form/${id}`,
    method: 'get',
    loaidng: false
  })
}

/**
 * 查询待归还的借出单商品分页列表数据
 * @param params
 */
export function getGoodsLendListWaitReturn(params) {
  return request({
    url: 'admin/lend/form/list-wait-return',
    method: 'get',
    loaidng: false,
    params
  })
}

/**
 * 获取商品借出列表
 * @param params
 */
export function getGoodsLendList(params) {
  return request({
    url: 'admin/lend/form',
    method: 'get',
    loaidng: false,
    params
  })
}

/**
 * 添加商品借出
 * @param params
 */
export function addGoodsLend(parmas) {
  return request({
    url: `admin/lend/form`,
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: parmas
  })
}

/**
 * 更新商品借出
 * @param id
 * @param parmas
 */
export function editGoodsLend(id, parmas) {
  return request({
    url: `admin/lend/form/${id}`,
    method: 'put',
    headers: { 'Content-Type': 'application/json' },
    data: parmas
  })
}

/**
 * 删除商品借出
 * @param id
 */
export function deleteGoodsLend(ids) {
  return request({
    url: `admin/lend/form/${ids}`,
    method: 'delete'
  })
}

//待入库商品信息
export function warehouseEntry(ids) {
  return request({
    url: `admin/erp/warehouseEntry`,
    method: 'get'
  })
}

// 获取库位列表
export function query(ids) {
  return request({
    url: `/admin/erp/warehouse/area/query `,
    method: 'get'
  })
}

// 获取库位列表
export function create(parmas) {
  return request({
    url: `/admin/erp/warehouse/area/create `,
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: parmas
  })
}

// 获取库位列表
export function update(parmas) {
  return request({
    url: `/admin/erp/warehouse/area/update `,
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: parmas
  })
}

/**
 * 删除
 * @param id
 */
export function deletes(parmas){
  return request({
    url: `/admin/erp/warehouse/area/delete`,
    method: 'delete',
    headers: { 'Content-Type': 'application/json' },
    data: parmas
  })
}

//  /admin/sale/channel

export function channel(params) {
  return request({
    url: `/admin/sale/channel`,
    method: 'get',
    loaidng: false,
    params
  })
}

//渠道添加 /admin/sale/channel
export function addChannel(parmas) {
  return request({
    url: `/admin/sale/channel`,
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: parmas
  })
}
// 渠道修改/admin/sale/channel/${id}
export function editChannel(id, parmas) {
  return request({
    url: `/admin/sale/channel/${id}`,
    method: 'put',
    headers: { 'Content-Type': 'application/json' },
    data: parmas
  })
}

// 删除 /admin/sale/channel/{id}

export function deleteChannel(ids) {
  return request({
    url: `/admin/sale/channel/${ids}`,
    method: 'delete'
  })
}

// 获取详情 /admin/erp/warehouse/area/info

export function getInfo(parmas) {
  return request({
    url: `/admin/erp/warehouse/area/info`,
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: parmas
  })
}

/* 库位区域列表 */
export function getListAreaType(params) {
  return request({
    url: `/admin/erp/warehouse/area/listAreaType`,
    method: 'get',
    loaidng: false,
    params
  })
}

/* 库位区域新增 */
export function addCreateAreaType(parmas) {
  return request({
    url: `/admin/erp/warehouse/area/createAreaType`,
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: parmas
  })
}

/* 库位区域修改 */
export function editUpdateAreaType(id, parmas) {
  return request({
    url: `/admin/erp/warehouse/area/updateAreaType/${id}`,
    method: 'put',
    headers: { 'Content-Type': 'application/json' },
    data: parmas
  })
}

/* 库位区域删除 */
export function removeAreaType(ids) {
  return request({
    url: `/admin/erp/warehouse/area/removeAreaType/${ids}`,
    method: 'delete'
  })
}

/* 根据库位获取当前商品/admin/erp/warehouse/area/goodNotAreaList */
export function goodNotAreaList(id,params) {
  return request({
    url: `/admin/erp/warehouse/area/goodNotAreaList/${id}`,
    method: 'get',
    loaidng: false,
    params
  })
}

/* 添加 /admin/erp/warehouse/area/bindAreaStock/{warehouseId}/{warehouseAreaId} */

export function bindAreaStock(warehouseId,warehouseAreaId,parmas) {
  return request({
    url: `/admin/erp/warehouse/area/bindAreaStock/${warehouseId}/${warehouseAreaId}`,
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    data: parmas
  })
}
