import apis from '@/configs/http';
import { redirectToLogin, redirectTo } from '@/common/NavFuncs';

export default {
	namespaced: true,
	actions: {
		getProvinceAll({ commit },param) {
			return apis.sz.post('/TOrder/getProvinceAll',param)
				.then(res => {
					const { data } = res;
					return data;
				});
		},
		getProvince({ commit },param) {
			return apis.sz.post('/TOrder/getProvince',param)
				.then(res => {
					const { data } = res;
					return data;
				});
		},
		getEquipmentStatistics({ commit },param) {
			return apis.sz.post('/TOrder/getEquipmentStatistics',param)
				.then(res => {
					const { data } = res;
					return data;
				});
		},
		getStatistics({ commit },param) {
			return apis.sz.post('/TOrder/getStatistics',param)
				.then(res => {
					const { data } = res;
					return data;
				});
		},
		//得出日，周，月，年的统计数据。
		// getMainStatistics({ commit },param) {
		// 	return apis.sz.post('/TOrder/getMainStatistics',param)
		// 		.then(res => {
		// 			const { data } = res;
		// 			return data;
		// 		});
		// },
		//得出日，周，月，年的统计数据。
		getMainStatistics({ commit },param) {
			return apis.sz.post('/TCleanHistory/getMainStatistics',param)
				.then(res => {
					const { data } = res;
					return data;
				});
		},
		getEquipmentListByUser({ commit },param) {
			return apis.sz.post('/TEquipment/getEquipmentListByUser',param)
				.then(res => {
					const { data } = res;
					return data;
				});
		},
		getEquipmentListByProvince({ commit },param) {
			return apis.sz.post('/TEquipment/getEquipmentListByProvince',param)
				.then(res => {
					const { data } = res;
					return data;
				});
		},
		updata({ commit },param) {
			return apis.sz.post('/TEquipment/updateName',param)
				.then(res => {
					const { data } = res;
					return res;
				});
		},
		getMachineNum({ commit },param) {
			return apis.sz.post('/TEquipment/getMachineNum',param)
				.then(res => {
					const { data } = res;
					return data;
				});
		},
		//修改定时清洗规则
		updateRule({ commit },param) {
			return apis.sz.post('/TEquipment/updateRule',param)
				.then(res => {
					const { data } = res;
					return data;
				});
		},
		//获取价格
		getPrice({ commit },name) {
			return apis.sz.post('/TPromoCode/getPrice',name)
				.then(res => {
					const { data } = res;
					return data;
				});
		},
		//支付
		pay({ commit },param) {
			return apis.sz.post('/TOrder/pay',param)
				.then(res => {
					const { data } = res;
					return data;
				});
		},
		//获取参数
		getParameters({ commit },param) {
			return apis.sz.post('/TEquipment/getParameters',param)
				.then(res => {
					const { data } = res;
					return data;
				});
		},
		//修改参数
		updateParameters({ commit },param) {
			return apis.sz.post('/TEquipment/updateParameters',param)
				.then(res => {
					const { data } = res;
					return data;
				});
		},
	}
}

