import request from '@/utils/request'

// 创建优惠券信息
export function createCoupon(data) {
  return request({
    url: '/ecw/coupon/createOrUpdate',
    method: 'post',
    data: data
  })
}

// 更新优惠券信息
export function updateCoupon(data) {
  return request({
    url: '/ecw/coupon/createOrUpdate',
    method: 'post',
    data: data
  })
}

// 删除优惠券信息
export function deleteCoupon(id) {
  return request({
    url: '/ecw/coupon/delete?id=' + id,
    method: 'delete'
  })
}

// 获得优惠券信息
export function getCoupon(id) {
  return request({
    url: '/ecw/coupon/get?id=' + id,
    method: 'get'
  })
}

// 获得优惠券信息分页
export function getCouponPage(query) {
  return request({
    url: '/ecw/coupon/page',
    method: 'get',
    params: query
  })
}

// 导出优惠券信息 Excel
export function exportCouponExcel(query) {
  return request({
    url: '/ecw/coupon/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
