import http from "@/http/http.js";
const request = http.request;
const urlType = "market";

/**
 * 限时折扣-分页
 * @param {Object} data
 */
export function limitTimeDiscountPage(data) {
	return request({
		url: `${urlType}/admin/limitTimeDiscount/page`,
		method: "GET",
		data
	});
}

/**
 * 删除限时折扣
 * @param {Object} data
 */
export function limitTimeDiscountDel(id) {
	return request({
		url: `${urlType}/admin/limitTimeDiscount?id=${id}`,
		method: "DELETE"
	});
}

/**
 * 限时折扣-新增/编辑
 * @param {Object} data
 */
export function limitTimeDiscount(data) {
	return request({
		url: `${urlType}/admin/limitTimeDiscount`,
		method: data.id ? 'put' : 'post',
		data
	});
}

/**
 * 优惠券-分页
 * @param {Object} params
 */
export function couponPage(params) {
	return request({
		url: `${urlType}/admin/coupon/page`,
		method: "GET",
		params
	});
}

/**
 * 优惠券-添加/编辑
 * @param {Object} params
 */
export function couponAdd(data) {
	return request({
		url: `${urlType}/admin/coupon`,
		method: data.id ? 'put' : 'post',
		data
	});
}

/**
 * 优惠券-删除
 * @param id
 */
export function couponDel(id) {
	return request({
		url: `${urlType}/admin/coupon?id=${id}&type=0`,
		method: 'delete'
	});
}

/**
 * 优惠券-详情
 * @param id
 */
export function couponDetail(id) {
	return request({
		url: `${urlType}/admin/coupon/${id}`,
		method: "GET"
	});
}

/**
 * 消费赠券-添加
 * @param {Object} data
 */
export function couponPost(data) {
	return request({
		url: `${urlType}/admin/consumerCoupon/addConsumerCoupon`,
		method: 'post',
		data
	});
}

/**
 * 消费赠券-更新
 * @param {Object} data
 */
export function updateConsumerCouponById(data) {
	return request({
		url: `${urlType}/admin/consumerCoupon/updateConsumerCouponById`,
		method: 'put',
		data
	});
}

/**
 * 消费赠券-分页
 * @param {Object} data
 */
export function getConsumerCouponPage(params) {
	return request({
		url: `${urlType}/admin/consumerCoupon/getConsumerCouponPage`,
		method: 'get',
		params
	});
}

/**
 * 消费赠券-删除
 * @param {Object} data
 */
export function deleteConsumerCoupon(id) {
	return request({
		url: `${urlType}/admin/consumerCoupon/deleteConsumerCoupon?id=${id}`,
		method: 'DELETE',
	});
}

/**
 * 消费赠券-详情
 * @param {Object} data
 */
export function getConsumerCouponById(params) {
	return request({
		url: `${urlType}/admin/consumerCoupon/getConsumerCouponById`,
		method: 'get',
		params
	});
}

/**
 * 优惠券列表/已领取详情
 * @param {Object} data
 */
export function couponGetRecord(params) {
	return request({
		url: `${urlType}/admin/coupon/record`,
		method: 'get',
		params
	});
}

/**
 * 智慧充值规/配置信息修改
 * @param {Object} data
 */
export function shopRechargePost(data) {
	return request({
		url: `${urlType}/admin/shopRecharge`,
		method: 'post',
		data
	});
}

/**
 * 智慧充值规/配置信息获取
 * @param {Object} data
 */
export function shopRechargeGet(data) {
	return request({
		url: `${urlType}/admin/shopRecharge`,
		method: 'get',
		data
	});
}

/**
 * 获取店铺用户充值记录
 * @param {Object} data
 */
export function shopUserFlow(data) {
	return request({
		url: `/account/admin/shopUser/flow`,
		method: 'get',
		data
	});
}


export function getShopUser(data) {
	return request({
		url: `account/admin/shopUser`,
		method: 'get',
		data
	});
}
