import request from '@/utils/request'
import Qs from 'qs'

export function listPackage(query) {
  return request({
    url: '/couponpackage/list',
    method: 'get',
    params: query,
    paramsSerializer: function(params) {
      return Qs.stringify(params, { arrayFormat: 'repeat' })
  }
  })
}
export function createPackage(data) {
  return request({
    url: '/couponpackage/create',
    method: 'post',
    data
  })
}

export function readPackage(query) {
  return request({
    url: '/couponpackage/read',
    method: 'get',
    params: query
  })
}

export function deletepackage(query) {
  return request({
    url: '/couponpackage/delete',
    method: 'get',
    params: query
  })
}
export function exportCoupon(query) {
  return request({
    url: '/couponpackage/export',
    method: 'post',
    params: query,
    paramsSerializer: function(params) {
      return Qs.stringify(params, { arrayFormat: 'repeat' })
    },
    responseType: 'blob',
  })
}

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

export function listPackageDetailExport(query) {
  return request({
    url: '/couponPackageDetail/list',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

export function packageDetailRead(query) {
  return request({
    url: '/couponPackageDetail/read',
    method: 'get',
    params: query
  })
}

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


export function packageDetailDelete(query) {
  return request({
    url: '/couponPackageDetail/delete',
    method: 'get',
    params: query
  })
}

export function packageDetailRSend(query) {
  return request({
    url: '/couponPackageDetail/rsend',
    method: 'get',
    params: query
  })
}

export function packageImport(data, config) {
  return request({
      url: '/couponPackageDetail/import',
      method: 'post',
      config: config,
      data
  })
}