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
  })
}

// 盲票组详情
export function ticketBoxDetail(data) {
  return request({
    url: '/api/v1/mp/admin/ticket/box/detail',
    method: 'post',
    data
  })
}

//
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',
    timeout: 15 * 60 * 1000,
    data
  })
}

// 导出印刷
export function exportDraw(data) {
  return request({
    url: '/api/v1/mp/admin/ticket/box/exportDraw',
    method: 'post',
    timeout: 15 * 60 * 1000,
    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'
    }
  })
}

// 上架、下架
export function ticketBoxPut(data) {
  return request({
    url: '/api/v1/mp/admin/ticket/box/put',
    method: 'post',
    data
  })
}

// 删除
export function ticketBoxRemove(data) {
  return request({
    url: '/api/v1/mp/admin/ticket/box/remove',
    method: 'post',
    data
  })
}

// 步进器修改
export function setListData(data) {
  return request({
    url: '/api/v1/mp/admin/ticket/box/update/sortWeight',
    method: 'post',
    data
  })
}

// 编辑盲票组
export function setListDetail(data) {
  return request({
    url: '/api/v1/mp/admin/ticket/box/update',
    method: 'post',
    data
  })
}


