import http from '@/request/index.js';
export const state = {
	outboundData: [], //列表数据
	detailsData: [] // 列表详情数据
};
export const mutations = {
	setboundData(state, data) {
		state.outboundData = data
	},
	setDetailsData(state, data) {
		state.detailsData = data
	}
}
export const actions = {
	getoutbondData({
		commit,
		rootState
	}, data) {
		return new Promise((resolve, reject) => {
			http('outbound.getListData', data, '加载中').then(res => {
				if (res.code == "0" && res.success == "true") {
					commit('setboundData', res.data);
				} else {
					commit('setboundData', []);
				}
			}).catch(e => {
				reject(e)
			})
		})
	},
	getDetailsData({
		commit,
		rootState
	}, data) {
		return new Promise((resolve, reject) => {
			http('outbound.getDetailsData', data, '加载中').then(res => {
				if (res.code == "0" && res.success == "true") {
					commit('setDetailsData', res.data);
				} else {
					commit('setDetailsData', []);
				}
			}).catch(e => {
				reject(e)
			})
		})
	}
}