import http from '@/request/index.js';
export const state = {
	orderDelData: [] ,//采购计划详情数据
	batchData:{} //批次数据
};
export const mutations = {
	setOrderDelsData(state, data) {
		state.orderDelData = data
	},
	setBatchData(state, data) {
		state.batchData = data
	},
}
export const actions = {
	getOrderAwaitData({
		commit,
		rootState
	}, data) {
		return new Promise((resolve, reject) => {
			http('orderOutbond.awaitData', {
				...data.pam,
			}, '加载中').then(res => {
				if (res.success == true) {
					data.that.$refs.paging.complete(res.data.records);
				}
			}).catch(e => {
				reject(e)
			})

		})
	},
	getOrderAreadyData({
		commit,
		rootState
	}, data) {
		return new Promise((resolve, reject) => {
			http('orderOutbond.readyData', {
				...data.pam,
			}, '加载中').then(res => {
				if (res.success == true) {
					data.that.$refs.paging.complete(res.data.records);
				}
			}).catch(e => {
				reject(e)
			})
	
		})
	},
	getOrderAwaitDetail({
		commit,
		rootState
	}, data) {
		return new Promise((resolve, reject) => {
			http('orderOutbond.awaitDelData', {
				...data,
				current: 1,
				size: 10000
			}, '加载中').then(res => {
				if (res.success == true) {
					commit('setOrderDelsData', res.data);
				}
			}).catch(e => {
				reject(e)
			})
		})
	},
	getOrderReadyDetail({
		commit,
		rootState
	}, data) {
		return new Promise((resolve, reject) => {
			http('orderOutbond.readyDelData', {
				...data,
				current: 1,
				size: 10000
			}, '加载中').then(res => {
				if (res.success == true) {
					commit('setOrderDelsData', res.data);
				}
			}).catch(e => {
				reject(e)
			})
		})
	},
}