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

/**
 * 积分:配置:新增/更新
 * @param {Object} data
 */
export function pointsConfigPost(data) {
	return request({
		url: `${MARKET_URL}/admin/points/config`,
		method: "POST",
		data
	})
}

/**
 * 积分:配置:详情
 * @param {Object} data
 */
export function pointsConfigGet() {
	return request({
		url: `${MARKET_URL}/admin/points/config`,
		method: "GET"
	})
}

/**
 * 积分:商品:列表
 * @param {Object} data
 */
export function pointsGoodsPage(data) {
	return request({
		url: `${MARKET_URL}/admin/pointsGoods/page`,
		method: "GET",
		data
	})
}

/**
 * 积分:商品:新增/修改
 * @param {Object} data
 */
export function pointsGoodsPost(data) {
	return request({
		url: `${MARKET_URL}/admin/pointsGoods`,
		method: "POST",
		data
	})
}

/**
 * 积分-商品-删除
 * @param {Object} data
 */
export function pointsGoodsDel(id) {
	return request({
		url: `${MARKET_URL}/admin/pointsGoods/${id}`,
		method: "DELETE"
	})
}

/**
 * 积分:商品:详情
 * @param {Object} data
 */
export function pointsGoodsDetail(id) {
	return request({
		url: `${MARKET_URL}/admin/pointsGoods/${id}`,
		method: "GET"
	})
}

/**
 * 积分:积分商品:兑换记录
 * @param {Object} data
 */
export function goodsRecordPage(data) {
	return request({
		url: `${ORDER_URL}/admin/points/goodsRecord/page`,
		method: "GET",
		data
	})
}

/**
 * 积分:积分商品:商家核销
 * @param {Object} data
 */
export function goodsRecordCkecout(data) {
	return request({
		url: `${ORDER_URL}/admin/points/goodsRecord/checkout`,
		method: "post",
		data
	})
}

/**
 * 积分:积分商品:同意退单
 * @param {Object} data
 */
export function goodsRecordAgreeRefund(data) {
	return request({
		url: `${ORDER_URL}/admin/points/goodsRecord/agreeRefund`,
		method: "post",
		data
	})
}

/**
 * 积分:积分商品:驳回退单
 * @param {Object} data
 */
export function goodsRecordRejectRefund(data) {
	return request({
		url: `${ORDER_URL}/admin/points/goodsRecord/rejectRefund`,
		method: "post",
		data
	})
}

/**
 * 积分:获取用户所有门店下积分列表
 * @param {Object} data
 */
export function pointUserPage(data) {
	return request({
		url: `${MARKET_URL}/admin/points/userPage`,
		method: "GET",
		data
	})
}

/**
 * 积分:积分详情
 * @param {Object} data
 */
export function pointUserRecord(data) {
	return request({
		url: `${MARKET_URL}/admin/points/userRecord`,
		method: "GET",
		data
	})
}