import util from '@/utils/util.js'
const jsonType = {
	'content-type': 'application/json'
}
const formType = {
	'content-type': 'application/x-www-form-urlencoded'
}
const dataType = {
	'content-type': 'multipart/form-data'
}

let inventoryApiFun = function(vm) {
	// 接口公共前缀
	let parts = "/wxh-worker-rest/rest/parts/" //收货 inventory 模块
	/**
	 * 盘点列表
	 */
	let inventoryListByInventoryModules = async (params = {}) => await vm.$u.get(parts + vm.vuex_token +
		'/take/stock/take/stock', params);
	/**
	 * 盘点详情
	 */
	let inventoryDetailByInventoryModules = async (params = {}) => await vm.$u.get(parts + vm.vuex_token +
		'/take/stock/detail/' + params);
	/**
	 * 新增盘点
	 */
	let addInventoryByInventoryModules = async (params = {}) => await vm.$u.post(parts + vm.vuex_token +
		'/take/stock/detail/add', params, formType);
	/**
	 * 删除盘点
	 */
	let deleteInventoryByInventoryModules = async (params = {}) => await vm.$u.get(parts + vm.vuex_token +
		'/take/stock/detail/delete/' + params);
	/**
	 * 提交盘点
	 */
	let confirmInventoryByInventoryModules = async (params = {}) => await vm.$u.get(parts + vm.vuex_token +
		'/take/stock/take/submit/' + params);
	/**
	 * 提交盘点
	 */
	let applyReInventoryByInventoryModules = async (params = {}) => await vm.$u.get(parts + vm.vuex_token +
		'/take/stock/take/submit/' + params);
		/**
		 * 提查询是否开启盘点
		 */
		let getInventoryStartByInventoryModules = async (params = {}) => await vm.$u.get(parts + vm.vuex_token +
			'/take/stock/sign/start');
	const inventoryApi = {
		inventoryListByInventoryModules,
		inventoryDetailByInventoryModules,
		addInventoryByInventoryModules,
		deleteInventoryByInventoryModules,
		confirmInventoryByInventoryModules,
		applyReInventoryByInventoryModules,
		getInventoryStartByInventoryModules
	}
	return inventoryApi
}
module.exports = {
	inventoryApiFun
}
