import request from '@/utils/request'

// 新增优惠券
export const couponAdd = (data) => {
  return request({
    url: '/coupon/coupon/add',
    method: 'post',
    data
  })
}
// 查询优惠券列表
export function couponPage(query) {
  return request({
    url: `/coupon/coupon/page`,
    method: 'get',
    params: query
  })
}
// 获取优惠券详细信息
export function couponInfo(id) {
  return request({
    url: `/coupon/coupon/info/${id}`,
    method: 'get',
  })
}
// 修改优惠券
export const couponEdit = (data) => {
  return request({
    url: '/coupon/coupon/edit',
    method: 'post',
    data
  })
}
// 发布优惠券
export const couponReleased = (id) => {
  return request({
    url: `/coupon/coupon/released/${id}`,
    method: 'post',
  })
}
// 取消发布优惠券
export const couponCancelReleased = (id) => {
  return request({
    url: `/coupon/coupon/cancelReleased/${id}`,
    method: 'post',
  })
}
// 停止优惠券活动
export function couponStop(id) {
  return request({
    url: `/coupon/coupon/stop/${id}`,
    method: 'post',
  })
}
// 恢复优惠券活动
export function couponCancelStop(id) {
  return request({
    url: `/coupon/coupon/cancelStop/${id}`,
    method: 'post',
  })
}
// 删除优惠券
export function couponDel(id) {
  return request({
    url: `/coupon/coupon/del/${id}`,
    method: 'post',
  })
}
// 查询优惠券领取记录与使用情况列表
export function couponReceiveRecordPage(query) {
  return request({
    url: `/coupon/couponReceiveRecord/page`,
    method: 'get',
    params: query
  })
}
// 给优惠券增加发放量
export function addIssueNumber(data) {
  return request({
    url: `/coupon/coupon/addIssueNumber`,
    method: 'post',
    data
  })
}

// 新增商家的会员配置
export function businessUserRoleConfigAdd(data) {
  return request({
    url: `/business/businessUserRoleConfig/add`,
    method: 'post',
    data
  })
}
// 修改商家的会员配置
export function businessUserRoleConfigEdit(data) {
  return request({
    url: `/business/businessUserRoleConfig/edit`,
    method: 'post',
    data
  })
}
// 获取商家的会员配置详细信息
export function businessUserRoleConfigInfo(id) {
  return request({
    url: `/business/businessUserRoleConfig/info/${id}`,
    method: 'get',
  })
}
// 查询商家的会员配置列表
export function businessUserRoleConfigPage(query) {
  return request({
    url: `/business/businessUserRoleConfig/page`,
    method: 'get',
    params: query
  })
}
// 删除商家的会员配置
export function businessUserRoleConfigDel(ids) {
  return request({
    url: `/business/businessUserRoleConfig/del/${ids}`,
    method: 'post',
  })
}

// 获取商家商品级分销设置详细信息
export function distributionBusinessConfigInfo(query) {
  return request({
    url: `/system/distributionBusinessConfig/info`,
    method: 'get',
    params: query
  })
}

// 设置商家商品级分销设置
export function distributionBusinessConfigSet(data) {
  return request({
    url: `/system/distributionBusinessConfig/set`,
    method: 'post',
    data
  })
}