import request, { postBlob, getBlob, handleImport } from '@/utils/request'

export function couponListPageV2(data) {
  return request({
    url: `/coupon/list/pageV2?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

export function couponListPageV2Export(data, name) {
  return postBlob({
    url: '/coupon/list/pageV2Export',
    data,
    name
  })
}


// 获取优惠券列表
export function getList(params) {
  return request({
    url: '/coupon/list/page',
    method: 'get',
    params
  })
}

// 新增优惠券
export function addCoupon(params) {
  return request({
    url: '/coupon/add',
    method: 'post',
    data: params
  })
}

// 编辑优惠券
export function editCoupon(params) {
  return request({
    url: '/coupon/update',
    method: 'post',
    data: params
  })
}

// 获取优惠券详情
export function getCouponDetail(params) {
  return request({
    url: '/coupon/detail',
    method: 'get',
    params
  })
}

// 变更优惠券标志
export function changeCouponFlag(params) {
  return request({
    url: '/coupon/change/flag',
    method: 'post',
    params
  })
}

// 获取分类列表
export function getClassifyList(params) {
  return request({
    url: '/goods/category/list',
    method: 'get',
    params
  })
}

// 获取商品列表
export function getGoodsList(params) {
  return request({
    url: '/coupon/list/spec/select',
    method: 'get',
    params
  })
}

// 获取标签列表
export function getTagList(params) {
  return request({
    url: '/tag/list',
    method: 'get',
    params
  })
}

// 获取会员列表
export function getMemberList(params) {
  return request({
    url: '/member/list/page',
    method: 'get',
    params
  })
}

// 补发业务员优惠券
export function reissueCoupon(params) {
  return request({
    url: '/coupon/reissue',
    method: 'post',
    data: params
  })
}