import request from '@/utils/request'

export function listCoupon(query) {
  return request({
    url: '/coupon/list',
    method: 'get',
    params: query
  })
}

export function createCoupon(data) {
  return request({
    url: '/coupon/create',
    method: 'post',
    data
  })
}

export function readCoupon(id) {
  return request({
    url: '/coupon/read',
    method: 'get',
    params: { id }
  })
}

export function updateCoupon(data) {
  return request({
    url: '/coupon/update',
    method: 'post',
    data
  })
}

export function deleteCoupon(data) {
  return request({
    url: '/coupon/delete',
    method: 'post',
    data
  })
}

export function listCouponUser(query) {
  return request({
    url: '/coupon/listuser',
    method: 'get',
    params: query
  })
}
//导出
export function exportData(query) {
  return request({
      url: '/coupon/export',
      method: 'post',
      params: query,
      responseType: 'blob'
  })
}
export function batchCollection(data) {
  return request({
    url: '/coupon/batchCollection',
    method: 'post',
    data
  })
}

export function sendSms(query) {
  return request({
    url: '/coupon/send',
    method: 'get',
    params: query
  })
}

export function changeFraUsable(query) {
  return request({
    url: '/coupon/changeFraUsable',
    method: 'get',
    params: query
  })
}