// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import request from "@/plugins/request";

/**
 * @description erp设置
 * @param {Object} param data {Object} 传值参数
 */
export function erpConfig() {
  return request({
    url: "erp/config",
    method: "get",
  });
}

/**
 * @description erp门店列表
 * @param {Object} param data {Object} 传值参数
 */
export function erpShop(data) {
  return request({
    url: "store/erp/shop",
    method: "get",
    params: data,
  });
}

/**
 * @description 导入erp
 * @param {Object} param data {Object} 传值参数
 */
export function erpProduct(data) {
  return request({
    url: "product/import_erp_product",
    method: "post",
    data,
  });
}

/**
 * @description 查询仓库商品列表
 * @param {Object} param data {Object} 传值参数
 */
export function erpGoods(data) {
  return request({
    url: "/erp/goods",
    method: "get",
    data,
  });
}

/**
 * @description 用户列表
 * @param {Object} param data {Object} 传值参数
 */
export function getUserList(data) {
  return request({
    url: "/erp/user/list",
    method: "get",
    params: data,
  });
}


/**
 * @description 用户详情
 * @param {Object} param id {number} 传值参数
 */
export function getUserInfo(id) {
  return request({
    url: "/erp/user/info/" + id,
    method: "get"
  });
}

/**
 * @description 仓库列表
 * @param {Object} param data {Object} 传值参数
 */
export function getGodownList(data) {
  return request({
    url: "/erp/Warehouse/list",
    method: "get",
    params: data,
  });
}


/**
 * @description 创建/编辑仓库
 * @param {Object} param data {Object} 传值参数 
 */
export function createGodown(id,data) {
  return request({
    url: "/erp/Warehouse/create/" + id,
    method: "post",
	data,
  });
}

/**
 * @description 仓库详情
 * @param {Object} param data {Object} 传值参数 
 */
export function getGodownInfo(id) {
  return request({
    url: "/erp/Warehouse/info/" + id,
    method: "get"
  });
}

/**
 * @description 仓位列表
 * @param {Object} param data {Object} 传值参数
 */
export function getPositionList(data) {
  return request({
    url: "/erp/Warehouse/position",
    method: "get",
    params: data,
  });
}

/**
 * @description 添加/编辑仓位
 * @param {Object} param data {Object} 传值参数
 */
export function createPosition(data) {
  return request({
    url: "/erp/Warehouse/position_save",
    method: "post",
    data
  });
}

//Warehouse/position_info/
/**
 * @description 仓位详情
 * @param {Object} param data {Object} 传值参数
 */
export function getPosition(id) {
  return request({
    url: "/erp/Warehouse/position_info/" + id,
    method: "get",
  });
}



/**
 * @description 要货列表
 * @param {Object} param data {Object} 传值参数
 */
export function getWantList(data) {
  return request({
    url: "/erp/want/list",
    method: "get",
    params: data,
  });
}


/**
 * @description 采购列表
 * @param {Object} param data {Object} 传值参数
 */
export function getPurchaselist(data) {
  return request({
    url: "/erp/purchase/list",
    method: "get",
    params: data,
  });
}

/**
 * @description 出库列表
 * @param {Object} param data {Object} 传值参数
 */
export function getOutList(data) {
  return request({
    url: "/erp/out/list",
    method: "get",
    params: data,
  });
}

/**
 * @description 库间流转/商品在途列表
 * @param {Object} param data {Object} 传值参数
 */
export function getOutSimpleList(data) {
  return request({
    url: "/erp/out/simple_lst",
    method: "get",
    params: data,
  });
}

/**
 * @description 库间流转/商品在途列表
 * @param {Object} param data {Object} 传值参数
 */
export function getReceiveList(data) {
  return request({
    url: "/erp/store_delivery_lst",
    method: "get",
    params: data,
  });
}


/**
 * @description 入库列表
 * @param {Object} param data {Object} 传值参数
 */
export function getInList(data) {
  return request({
    url: "/erp/in/list",
    method: "get",
    params: data,
  });
}

/**
 * @description 调价列表
 * @param {Object} param data {Object} 传值参数
 */
export function getAdjustList(data) {
  return request({
    url: "/erp/goods/adjust_price_lst",
    method: "get",
    params: data,
  });
}

//goods/adjust_price
/**
 * @description 创建修改调价
 * @param {Object} param data {Object} 传值参数
 */
export function createAdjust(data) {
  return request({
    url: "/erp/goods/adjust_price",
    method: "post",
    data,
  });
}
/**
 * @description 要货商品列表
 * @param {Object} param data {Object} 传值参数
 */
export function getOutGoods(data) {
  return request({
    url: "/erp/Warehouse/out_goods_lst",
    method: "get",
    params: data,
  });
}

/**
 * @description 商品批次列表
 * @param {Object} param data {Object} 传值参数
 */
export function getProductBatch(data) {
  return request({
    url: "/erp/Warehouse/product_batch",
    method: "get",
    params: data,
  });
}


/**
 * @description 创建编辑要货单
 * @param {Object} param data {Object} 传值参数
 */
export function createWant(id,data) {
  return request({
    url: "/erp/want/create/" + id,
    method: "post",
    data,
  });
}

/**
 * @description 要货单详情
 * @param {Object} param data {Object} 传值参数
 */
export function getWantInfo(id) {
  return request({
    url: "/erp/want/info/" + id,
    method: "get",
  });
}


/**
 * @description 要货单审核
 * @param {Object} param data {Object} 传值参数
 */
export function seveWant(id,data) {
  return request({
    url: "/erp/want/auth_save/" + id,
    method: "post",
	data
  });
}

/**
 * @description 采购单审核
 * @param {Object} param data {Object} 传值参数
 */
export function sevePurchase(id,data) {
  return request({
    url: "/erp/purchase/auth_save/" + id,
    method: "post",
	data
  });
}

/**
 * @description 创建采购单
 * @param {Object} param data {Object} 传值参数
 */
export function createPurchase(id,data) {
  return request({
    url: "/erp/purchase/create/" + id,
    method: "post",
	data
  });
}

/**
 * @description 获取汇总采购单商品
 * @param {Object} param data {Object} 传值参数
 */
export function getPurchaseGoods(data) {
  return request({
    url: "/erp/purchase/goods",
    method: "get",
	params:data
  });
}

//user/create
/**
 * @description 创建用户
 * @param {Object} param data {Object} 传值参数
 */
export function createUser(id,data) {
  return request({
    url: "/erp/user/create/" + id,
    method: "post",
	data
  });
}

/**
 * @description 采购单详情
 * @param {Object} param data {Object} 传值参数
 */
export function getPurchaseInfo(id) {
  return request({
    url: "/erp/purchase/info/" + id,
    method: "get",
  });
}

/**
 * @description 完成采购单
 * @param {Object} param data {Object} 传值参数
 */
export function savePurchase(id,data) {
  return request({
    url: "/erp/purchase/save/" + id,
    method: "post",
	data
  });
}


/**
 * @description 采购单详情
 * @param {Object} param data {Object} 传值参数
 */
export function getPurchaseDetail(id) {
  return request({
    url: "/erp/purchase/get_order_id/" + id,
    method: "get"
  });
}

/**
 * @description 采购单详情
 * @param {Object} param data {Object} 传值参数
 */
export function getPurchaseId(id) {
	return request({
	  url: "/erp/purchase/get_order_id/" + id,
	  method: "get"
	});
}

/**
 * @description 创建入库
 * @param {Object} param data {Object} 传值参数
 */
export function createRuku(data,id) {
	return request({
	  url: "/erp/in/create/" + id,
	  method: "post",
	  data
	});
}

/**
 * @description 盘点单列表
 * @param {Object} param data {Object} 传值参数
 */
export function getInventoryList(data) {
	return request({
	  url: "/erp/Warehouse/inventory_lst",
	  method: "get",
	  params:data
	});
}

/**
 * @description 盘点单审核
 * @param {Object} param data {Object} 传值参数
 */
export function authInventory(data) {
	return request({
	  url: "/erp/Warehouse/inventory_auth",
	  method: "post",
	  data
	});
}

/**
 * @description 创建盘点单
 * @param {Object} param data {Object} 传值参数
 */
export function saveInventory(data) {
	return request({
	  url: "/erp/Warehouse/inventory_save",
	  method: "post",
	  data
	});
}

/**
 * @description 盘点商品列表
 * @param {Object} param data {Object} 传值参数
 */
export function getInventoryGoods(data) {
	return request({
	  url: "/erp/Warehouse/position_info_lst",
	  method: "get",
	  params:data
	});
}

/**
 * @description 盘点单详情
 * @param {Object} param data {Object} 传值参数
 */
export function getInventoryInfo(id) {
	return request({
	  url: "/erp/Warehouse/inventory_info/"+ id,
	  method: "get"
	});
}

/**
 * @description 仓库仓位商品列表
 * @param {Object} param data {Object} 传值参数
 */
export function getGoodsList(data) {
	return request({
	  url: "/erp/Warehouse/position_info_list",
	  method: "get",
	  params:data
	});
}


//Warehouse/ware_out
//
/**
 * @description 出库列表
 * @param {Object} param data {Object} 传值参数
 */
export function getOutLists(data) {
	return request({
	  url: "/erp/Warehouse/ware_out",
	  method: "get",
	  params:data
	});
}

/**
 * @description 入库列表
 * @param {Object} param data {Object} 传值参数
 */
export function getInLists(data) {
	return request({
	  url: "/erp/Warehouse/ware_in",
	  method: "get",
	  params:data
	});
}

/**
 * @description 调出商品列表
 * @param {Object} param data {Object} 传值参数
 */
export function getOutGoodList(data) {
	return request({
	  url: "/erp/out_lst",
	  method: "get",
	  params:data
	});
}

/**
 * @description 创建调出
 * @param {Object} param data {Object} 传值参数
 */
export function createOut(data) {
	return request({
	  url: "/erp/out/create",
	  method: "post",
	  data
	});
}

/**
 * @description 调出单详情
 * @param {Object} param data {Object} 传值参数
 */
export function getOutInfo(id) {
	return request({
	  url: "/erp/out/info/" + id,
	  method: "get",
	});
}

/**
 * @description 调出单详情
 * @param {Object} param data {Object} 传值参数
 */
export function editOut(id,data) {
	return request({
	  url: "/erp/out/update/" + id,
	  method: "post",
	  data
	});
}

/**
 * @description 调出单详情
 * @param {Object} param data {Object} 传值参数
 */
export function outSave(id,data) {
	return request({
	  url: "/erp/out/auth_save/" + id,
	  method: "post",
	  data
	});
}

//store_delivery
/**
 * @description 调出单详情
 * @param {Object} param data {Object} 传值参数
 */
export function storeReceipt(data) {
	return request({
	  url: "/erp/store_delivery",
	  method: "post",
	  data
	});
}
//stock/auth
/**
 * @description 门店收货审核
 * @param {Object} param data {Object} 传值参数
 */
export function storeAuth(data) {
	return request({
	  url: "/erp/stock/auth",
	  method: "post",
	  data
	});
}

//stock/info
/**
 * @description 门店收货审核
 * @param {Object} param data {Object} 传值参数
 */
export function storeInfo(data) {
	return request({
	  url: "/erp/stock/info",
	  method: "get",
	  params:data
	});
}

//ware_delivery
/**
 * @description 库间收货
 * @param {Object} param data {Object} 传值参数
 */
export function wareDelivery(data) {
	return request({
	  url: "/erp/ware_delivery",
	  method: "post",
	 data
	});
}

/**
 * @description 入库上架
 * @param {Object} param data {Object} 传值参数
 */
export function listing(data) {
	return request({
	  url: "/erp/in/in_stock",
	  method: "post",
	 data
	});
}

/**
 * @description 入库详情
 * @param {Object} param data {Object} 传值参数
 */
export function getInInfo(id) {
	return request({
	  url: "/erp/in/info/" + id,
	  method: "get",
	});
}

/**
 * @description 商品列表
 * @param {Object} param data {Object} 传值参数
 */
export function getGoods(data) {
	return request({
	  url: "/erp/goods/list",
	  method: "get",
	  params: data
	});
}

//goods/info/
/**
 * @description 商品详情
 * @param {Object} param data {Object} 传值参数
 */
export function getGoodInfo(id) {
	return request({
	  url: "/erp/goods/info/" + id,
	  method: "get"
	});
}

/**
 * @description 创建批次
 * @param {Object} param data {Object} 传值参数
 */
export function batch_save(data) {
	return request({
	  url: "/erp/Product/batch_save",
	  method: "post",
	  data
	});
}

/**
 * @description 创建商品
 * @param {Object} param data {Object} 传值参数
 */
export function addProduct(id,data) {
	return request({
	  url: "/erp/goods/create/" + id,
	  method: "post",
	  data
	});
}

/**
 * @description 批次列表
 * @param {Object} param data {Object} 传值参数
 */
export function getBatchList(data) {
	return request({
	  url: "/erp/Product/batch_lst",
	  method: "get",
	  params:data
	});
}

/**
 * @description 报损单列表
 * @param {Object} param data {Object} 传值参数
 */
export function getLossList(data) {
	return request({
	  url: "/erp/loss/lst",
	  method: "get",
	  params:data
	});
}

/**
 * @description 创建报损单
 * @param {Object} param data {Object} 传值参数
 */
export function createLoss(data) {
	return request({
	  url: "/erp/loss/save",
	  method: "post",
	  data
	});
}

//

/**
 * @description 报损理由
 * @param {Object} param data {Object} 传值参数
 */
export function getYlist() {
	return request({
	  url: "/setting/group_data?status=1&gid=70",
	  method: "get"
	});
}

/**
 * @description 报损详情
 * @param {Object} param data {Object} 传值参数
 */
export function getLossDetail(id) {
	return request({
	  url: "/erp/loss/info/" + id,
	  method: "get"
	});
}

/**
 * @description 报损详情
 * @param {Object} param data {Object} 传值参数
 */
export function getlqList(data) {
	return request({
	  url: "/erp/warehouse/position_info_lst",
	  method: "get",
	  params:data
	});
}
/*
Route::get('user/list', 'v1.erp.User/index')->option(['real_name' => '用户列表']);
Route::get('user/info/:id', 'v1.erp.User/info')->option(['real_name' => '用户详情']);
Route::post('user/create/:id', 'v1.erp.User/create')->option(['real_name' => '创建用户']);

//要货
Route::get('want/list', 'v1.erp.Want/index')->option(['real_name' => '要货列表']);
Route::get('want/info/:id', 'v1.erp.Want/info')->option(['real_name' => '要货详情']);
Route::post('want/create/:id', 'v1.erp.Want/create')->option(['real_name' => '创建要货']);
Route::put('want/auth_save/:id', 'v1.erp.Want/auth_save')->option(['real_name' => '审核要货']);
Route::delete('want/del/:id', 'v1.erp.Want/del')->option(['real_name' => '删除要货']);

//采购
Route::get('purchase/list', 'v1.erp.Purchase/index')->option(['real_name' => '采购列表']);
Route::get('purchase/info/:id', 'v1.erp.Purchase/info')->option(['real_name' => '采购详情']);
Route::post('purchase/create/:id', 'v1.erp.Purchase/create')->option(['real_name' => '创建采购']);
Route::put('purchase/auth_save/:id', 'v1.erp.Purchase/auth_save')->option(['real_name' => '审核+++++++采购']);
Route::delete('purchase/del/:id', 'v1.erp.Purchase/del')->option(['real_name' => '删除采购']);
Route::get('purchase/in_status/:purchase_order_id', 'v1.erp.Purchase/in_status')->option(['real_name' => '采购入库状态']);
Route::get('purchase/get_order_id/:purchase_order_id', 'v1.erp.Purchase/get_order_id')->option(['real_name' => '采购单号']);

//入库
Route::get('in/list', 'v1.erp.Inbound/index')->option(['real_name' => '入库列表']);
Route::get('in/info/:id', 'v1.erp.Inbound/info')->option(['real_name' => '入库详情']);
Route::post('in/create/:id', 'v1.erp.Inbound/create')->option(['real_name' => '创建入库']);
Route::put('in/auth_save/:id', 'v1.erp.Inbound/auth_save')->option(['real_name' => '审核入库']);
Route::delete('in/del/:id', 'v1.erp.Inbound/del')->option(['real_name' => '删除入库']);
Route::get('in/get_order_id/:in_order_id', 'v1.erp.Inbound/get_order_id')->option(['real_name' => '入库单号']);
Route::get('in/in_status/:in_order_id', 'v1.erp.Inbound/in_status')->option(['real_name' => '入库状态']);
Route::get('Warehouse/list', 'v1.erp.Warehouse/index')->option(['real_name' => '仓库列表']);
Route::post('Warehouse/create/:id', 'v1.erp.Warehouse/create')->option(['real_name' => '创建仓库']);
Route::delete('Warehouse/del/:id', 'v1.erp.Warehouse/del')->option(['real_name' => '删除仓库']);
Route::get('Warehouse/position', 'v1.erp.Warehouse/position')->option(['real_name' => '仓位列表']);
Route::post('Warehouse/position_save', 'v1.erp.Warehouse/position_save')->option(['real_name' =>'仓位保存']);
Route::get('Warehouse/position_info/:id', 'v1.erp.Warehouse/position_info')->option(['real_name' => '仓位详情']);
Route::post('Warehouse/position_save/:id', 'v1.erp.Warehouse/position_save')->option(['real_name' => '仓位修改']);
Route::get('Warehouse/position_info_list', 'v1.erp.Warehouse/position_info_list')->option(['real_name' => '仓位商品列表']);
Route::get('Warehouse/position_info_lst', 'v1.erp.Warehouse/position_info_lst')->option(['real_name' => '仓位商品列表1']);
Route::get('Warehouse/out_goods_lst', 'v1.erp.Warehouse/out_goods_lst')->option(['real_name' => '出库商品列表']);
Route::get('Warehouse/product_batch', 'v1.erp.Warehouse/product_batch')->option(['real_name' => '商品批次列表']);
Route::get('Warehouse/inventory_lst', 'v1.erp.Warehouse/inventory_lst')->option(['real_name' => '盘点单列表']);
Route::post('Warehouse/inventory_save', 'v1.erp.Warehouse/inventory_save')->option(['real_name' => '盘点单保存']);
Route::post('Warehouse/inventory_auth', 'v1.erp.Warehouse/inventory_auth')->option(['real_name' => '盘点单审核']);
Route::get('Warehouse/inventory_info/:id', 'v1.erp.Warehouse/inventory_info')->option(['real_name' => '盘点单详情']);

//出库
Route::get('out/list', 'v1.erp.Outbound/index')->option(['real_name' => '出库列表']);
Route::get('out/info/:id', 'v1.erp.Outbound/info')->option(['real_name' => '出库详情']);
Route::post('out/create/:id', 'v1.erp.Outbound/create')->option(['real_name' => '创建出库']);
Route::put('out/auth_save/:id', 'v1.erp.Outbound/auth_save')->option(['real_name' => '审核出库']);
Route::delete('out/del/:id', 'v1.erp.Outbound/del')->option(['real_name' => '删除出库']);
Route::get('out/simple_lst', 'v1.erp.Outbound/simple_lst')->option(['simple_lst' => '出库（库间流转，商品在途）列表']);
Route::get('out/new_lst', 'v1.erp.Outbound/new_lst')->option(['real_name' => '出库列表新']);

//收货
Route::post('ware_delivery', 'v1.erp.Inbound/ware_delivery')->option(['real_name' => '库间收货']);//库间收货
Route::post('store_delivery', 'v1.erp.Inbound/store_delivery')->option(['real_name' => '门店收货']);//门店收货
Route::get('store_delivery_lst', 'v1.erp.Inbound/store_delivery_lst')->option(['real_name' => '收货列表']);
Route::post('stock/auth', 'v1.erp.stock/auth')->option(['real_name' => '门店收货审核']);//门店收货审核
Route::get('stock/info', 'v1.erp.stock/info')->option(['real_name' => '门店收货详情']);//门店收货详情

*/


// Route::get('Warehouse/list', 'v1.erp.Warehouse/index')->option(['real_name' => '仓库列表']);
// Route::get('Warehouse/info/:id', 'v1.erp.Warehouse/info')->option(['real_name' => '仓库详情']);
// Route::post('Warehouse/create/:id', 'v1.erp.Warehouse/create')->option(['real_name' => '创建仓库']);
// Route::delete('Warehouse/del/:id', 'v1.erp.Warehouse/del')->option(['real_name' => '删除仓库']);
// Route::get('Warehouse/position', 'v1.erp.Warehouse/position')->option(['real_name' => '仓库位置']);
// Route::post('Warehouse/position_save', 'v1.erp.Warehouse/position_save')->option(['real_name' =>'仓位保存']);
// Route::delete('Warehouse/position_del/:id', 'v1.erp.Warehouse/position_del')->option(['real_name' => '删除仓位']);
// Route::get('Warehouse/position_info/:id', 'v1.erp.Warehouse/position_info')->option(['real_name' => '仓位详情']);
// Route::get('Warehouse/position_info_list', 'v1.erp.Warehouse/position_info_list')->option(['real_name' => '仓位商品列表']);
// Route::get('Warehouse/position_info_lst', 'v1.erp.Warehouse/position_info_lst')->option(['real_name' => '仓位商品列表1']);
// Route::get('Warehouse/out_goods_lst', 'v1.erp.Warehouse/out_goods_lst')->option(['real_name' => '出库商品列表']);
// Route::get('Warehouse/product_batch', 'v1.erp.Warehouse/product_batch')->option(['real_name' => '商品批次列表']);
// Route::get('Warehouse/inventory_lst', 'v1.erp.Warehouse/inventory_lst')->option(['real_name' => '盘点单列表']);
// Route::post('Warehouse/inventory_save', 'v1.erp.Warehouse/inventory_save')->option(['real_name' => '盘点单保存']);
// Route::post('Warehouse/inventory_auth', 'v1.erp.Warehouse/inventory_auth')->option(['real_name' => '盘点单审核']);
// Route::get('Warehouse/inventory_info/:id', 'v1.erp.Warehouse/inventory_info')->option(['real_name' => '盘点单详情']);
// Route::get('Warehouse/ware_user', 'v1.erp.Warehouse/ware_user')->option(['real_name' =>'仓库用户列表']);
// Route::get('Warehouse/ware_purchase', 'v1.erp.Warehouse/ware_purchase')->option(['real_name' =>'仓库采购订单']);
// Route::get('Warehouse/ware_out', 'v1.erp.Warehouse/ware_out')->option(['real_name' =>'仓库出库订单']);
// Route::get('Warehouse/ware_in', 'v1.erp.Warehouse/ware_in')-


// Route::get('goods/list', 'v1.erp.Goods/index')->option(['real_name' => '商品列表']);
// Route::get('goods/info/:id', 'v1.erp.Goods/info')->option(['real_name' => '商品详情']);
// Route::post('goods/create/:id', 'v1.erp.Goods/create')->option(['real_name' => '创建商品']);
// Route::get('goods/adjust_price_lst', 'v1.erp.Goods/adjust_price_lst')->option(['real_name' => '商品调价']);
// Route::post('goods/adjust_price', 'v1.erp.Goods/adjust_price')->option(['real_name' => '商品调价保存']);
// Route::get('goods/adjust_price_info', 'v1.erp.Goods/adjust_price_info')->option(['real_name' => '调价详情']);

// Route::post('Product/batch_save', 'v1.erp.Goods/batch_save')->name('batch_save');//创建批次
// Route::get('Product/batch_lst', 'v1.erp.Goods/batch_lst')->name('batch_lst');//批次列表


// Route::get('goods/list', 'v1.erp.Goods/index')->option(['real_name' => '商品列表']);
// Route::get('goods/info/:id', 'v1.erp.Goods/info')->option(['real_name' => '商品详情']);
// Route::post('goods/create/:id', 'v1.erp.Goods/create')->option(['real_name' => '创建商品']);
// Route::get('goods/adjust_price_lst', 'v1.erp.Goods/adjust_price_lst')->option(['real_name' => '商品调价']);
// Route::post('goods/adjust_price', 'v1.erp.Goods/adjust_price')->option(['real_name' => '商品调价保存']);
// Route::get('goods/adjust_price_info', 'v1.erp.Goods/adjust_price_info')->option(['real_name' => '调价详情']);