import request from '@/utils/request'

// 盲票列表
export function getTicketList(urlParams, data) {
  return request({
    url: '/api/v1/mp/admin/ticket/box/list',
    method: 'post',
    data,
    urlParams
  })
}

// 创建盲票组
export function ticketBoxCreate(data) {
  return request({
    url: '/api/v1/mp/admin/ticket/box/create',
    method: 'post',
    data
  })
}

// /api/v1/mp/wx/urlschema/generate
export function urlschemaGeneratee(data) {
  return request({
    url: '/api/v1/mp/wx/urlschema/generate',
    method: 'post',
    data
  })
}

// 盲票组导出
export function exportTicket(data) {
  return request({
    url: '/api/v1/mp/admin/ticket/box/export',
    method: 'post',
    data
  })
}
// 下载批量导入模板
export function importTemplate(){
  return request({
    url: '/api/v1/mp/admin/ticket/box/importTemplate',
    method: 'get'
  })
}


// 批量导入
export function importTicket(data, config = {}){
  var formData  = new FormData()
  Object.keys(data).forEach(key => {
    formData.append(key, data[key])
  })
  return request({
    url: '/api/v1/mp/admin/ticket/box/importTicket',
    method: 'post',
    data: formData ,
    ...config,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}
