import http from '@/http/yskApi/http.js'
const request = http.request

/**
 * 获取订单列表
 * @returns
 */
export function getOrderList(data, urlType = 'order') {
	return request({
		url: `/order/admin/order`,
		method: "GET",
		data: {
			...data
		}
	})
}

/**
 * 订单详情
 * @returns
 */
export function getOrderById(data, urlType = 'order') {
	return request({
		url: `/order/admin/order/getOrderById`,
		method: "GET",
		data: {
			...data
		}
	})
}

/**
 * 历史订单(多次下单使用)
 * @returns
 */
export function getHistoryOrder(data, urlType = '/order') {
	return request({
		url: `/order/admin/order/historyOrder`,
		method: "GET",
		data: {
			...data
		}
	})
}

/**
 * 生成订单
 * @returns
 */
export function createOrder(data, urlType = 'order') {
	return request({
		url: `/order/admin/order/createOrder`,
		method: "POST",
		data: {
			...data
		}
	})
}

/**
 * 订单退款 只传订单id
 * @returns
 */
export function refundOrder(data, urlType = 'order') {
	return request({
		url: `/order/admin/order/refundOrder`,
		method: "POST",
		data: {
			...data
		}
	})
}

/**
 * 订单打印
 * @returns
 */
export function printOrder(data, urlType = 'order') {
	return request({
		url: `/order/admin/order/print`,
		method: "POST",
		data: {
			...data
		}
	})
}

/**
 * 清空历史订单
 * @returns
 */
export function cancelOrder(data, urlType = 'order') {
	return request({
		url: `/order/admin/order/cancelOrder`,
		method: "POST",
		data: {
			...data
		}
	})
}

/**
 * 清空某一次历史订单
 * @returns
 */
export function rmPlaceOrder(data, urlType = 'order') {
	return request({
		url: `/${urlType}/admin/order/rmPlaceOrder`,
		method: "POST",
		data: {
			...data
		}
	})
}


