import http from '@/http/http.js'
const request = http.request
const ORDER_URL = 'order'
const Market_BaseUrl = 'market'

/**
 * 拼团商品-列表
 * @param {Object} data
 */
export function getGbWarePage(data) {
	return request({
		url: `${ORDER_URL}/admin/ware/getGbWarePage`,
		method: "GET",
		data
	})
}

/**
 * 拼团商品-新增
 * @param {Object} data
 */
export function addGbWare(data) {
	return request({
		url: `${ORDER_URL}/admin/ware/addGbWare`,
		method: "post",
		data
	})
}

/**
 * 拼团商品-列表
 * @param {Object} data
 */
export function updateGbWareById(data) {
	return request({
		url: `${ORDER_URL}/admin/ware/updateGbWareById`,
		method: "post",
		data
	})
}

/**
 * 拼团商品-修改状态
 * @param {Object} data
 */
export function editOnlineStatus(data) {
	return request({
		url: `${ORDER_URL}/admin/ware/editOnlineStatus`,
		method: "post",
		data
	})
}

/**
 * 拼团商品-删除
 * @param {Object} data
 */
export function deleteGbWare(id) {
	return request({
		url: `${ORDER_URL}/admin/ware/deleteGbWare/${id}`,
		method: "DELETE"
	})
}

/**
 * 拼团商品:订单列表
 * @param {Object} data
 */
export function gbOrderPage(data) {
	return request({
		url: `${ORDER_URL}/admin/gbOrder/page`,
		method: "GET",
		data
	})
}

/**
 * 拼团商品-活动开关
 * @param {Object} data
 */
export function upShopConfig(data) {
	return request({
		url: `${ORDER_URL}/admin/ware/upShopConfig`,
		method: "POST",
		data
	})
}

/**
 * 拼团订单-退单/同意退单
 * @param {Object} data
 */
export function agreeRefund(data) {
	return request({
		url: `${ORDER_URL}/admin/gbOrder/agreeRefund`,
		method: "POST",
		data
	})
}

/**
 * 拼团订单-驳回退单
 * @param {Object} data
 */
export function rejectRefund(data) {
	return request({
		url: `${ORDER_URL}/admin/gbOrder/rejectRefund`,
		method: "POST",
		data
	})
}

/**
 * 拼团商品:核销
 * @param {Object} data
 */
export function checkout(data) {
	return request({
		url: `${ORDER_URL}/admin/gbOrder/checkout`,
		method: "POST",
		data
	})
}

/**
 * 拼团商品:拼团商品详情
 * @param {Object} data
 */
export function wareDetail(data) {
	return request({
		url: `${ORDER_URL}/admin/ware/ware/detail`,
		method: "get",
		data
	})
}

/**
 * 套餐推广:添加套餐
 * @param {*} data 
 * @returns 
 */
export function packageAddEdit(data) {
	return request({
		url: `${Market_BaseUrl}/admin/package`,
		method: data.id ? 'put' : 'post',
		data,
	});
}

/**
 * 套餐推广:获取套餐列表
 * @param {*} data 
 * @returns 
 */
export function packageGet(params) {
	return request({
		url: `${Market_BaseUrl}/admin/package`,
		method: 'get',
		params,
	});
}

/**
 * 套餐推广:获取套餐推广开关
 * @param {*} data 
 * @returns 
 */
export function packageSwitchGet() {
	return request({
		url: `${Market_BaseUrl}/admin/package/switch`,
		method: 'get'
	});
}

/**
 * 套餐推广:修改套餐推广开关
 * @param {*} data 
 * @returns 
 */
export function packageSwitchPut(data) {
	return request({
		url: `${Market_BaseUrl}/admin/package/switch`,
		method: 'put',
		data
	});
}

/**
 * 套餐推广:删除套餐
 * @param {*} data 
 * @returns 
 */
export function packageDel(id) {
	return request({
		url: `${Market_BaseUrl}/admin/package/${id}`,
		method: 'DELETE'
	});
}

/**
 * 套餐推广:确认删除套餐
 * @param {*} data 
 * @returns 
 */
export function packageSureDel(id) {
	return request({
		url: `${Market_BaseUrl}/admin/package/sure/${id}`,
		method: 'DELETE'
	});
}

/**
 * 套餐推广:修改套餐推广开关
 * @param {*} data 
 * @returns 
 */
export function packageOnline(data) {
	return request({
		url: `${Market_BaseUrl}/admin/package/online`,
		method: 'put',
		data
	});
}

/**
 * 套餐推广:获取套餐推广订单列表
 * @param {*} data 
 * @returns 
 */
export function packageOrder(params) {
	return request({
		url: `${Market_BaseUrl}/admin/package/order`,
		method: 'GET',
		params
	});
}

/**
 * 套餐推广:订单统计
 * @param {*} data 
 * @returns 
 */
export function packageOrderStat(params) {
	return request({
		url: `${Market_BaseUrl}/admin/package/order/stat`,
		method: 'GET',
		params
	});
}

/**
 * 套餐推广:确认退单
 * @param {*} data 
 * @returns 
 */
export function packageConfirmRefund(data) {
	return request({
		url: `${ORDER_URL}/admin/ppOrder/confirmRefund`,
		method: 'post',
		data
	});
}

/**
 * 套餐推广:驳回退单
 * @param {*} data 
 * @returns 
 */
export function packageRejectRefund(data) {
	return request({
		url: `${ORDER_URL}/admin/ppOrder/rejectRefund`,
		method: 'post',
		data
	});
}

/**
 * 套餐推广:核销
 * @param {*} data 
 * @returns 
 */
export function packageCheckout(data) {
	return request({
		url: `${ORDER_URL}/admin/ppOrder/checkout`,
		method: 'post',
		data
	});
}

/**
 * 套餐推广:获取套餐详情
 * @param {*} data 
 * @returns 
 */
export function packageDetail(data) {
	return request({
		url: `${Market_BaseUrl}/admin/package/detail/${data.id}`,
		method: 'GET',
		data: {
			shopId: data.shopId
		}
	});
}