import http from '@/utils/request'

// 获取门票种类
export function getTicketCategory () {
  return http.post('/admin/ticketType/getTicketTypeCategory')
}

// 获取门票列表
export function getTicketTypeList (params) {
  return http.post('/admin/ticketType', { data: params })
}

// 获取门票详情
export function getTicketTypeInfo (params) {
  return http.post('/admin/ticketType/detail', { data: params })
}

// 根据游玩日期获取门票信息
export function getTicketTypeByDate (params) {
  return http.post('/admin/ticketType/get', { data: params })
}

// 新增门票
export function addTicket (params) {
  return http.post('/admin/ticketType/add', { data: params })
}

// 更新门票
export function updateTicket (params) {
  return http.post('/admin/ticketType/update', { data: params })
}

// 删除门票
export function deleteTicket (id) {
  let params = {
    idList: [id]
  }
  return http.post('/admin/ticketType/delete', { data: params })
}

// 获取景点列表
export function getScenic () {
  const params = {
    export: false,
    pageSize: -1,
    pageNum: 1
  }
  return http.post('/admin/scenic', { data: params })
}

// 获取景点列表
export function updateScenic (params) {
  return http.post('/admin/scenic/update', { data: params })
}

// 新建景点
export function createScenic (params) {
  return http.post('/admin/scenic/add', { data: params })
}

// 删除景点
export function delScenic (data) {
  return http.post('/admin/scenic/delete', { data: { idList: [data.id] } })
}

// 批量更新场次
export function batchUpdateTicketBatch (ticketTypeId, params) {
  return http.post(`/admin/batchConfig/saveOrUpdate/${ticketTypeId}`, { data: params })
}

// 新增场次
export function addTicketBatch (ticketTypeId, params) {
  return http.post(`/admin/batchConfig/add/${ticketTypeId}`, { data: params })
}

// 编辑场次
export function updateTicketBatch (params) {
  return http.post(`/admin/batchConfig/update`, { data: params })
}

// 删除场次
export function delTicketBatch (ids) {
  return http.post('/admin/batchConfig/delete', { data: { idList: ids } })
}

// 生成库存
export function createTicketInStock (params) {
  return http.post('/admin/ticketPrepareBatch/add', { data: params })
}
// 更新库存
export function updateTicketInStock (params) {
  return http.post('/admin/ticketPrepareBatch/update', { data: params })
}
// 删除库存
export function deleteTicketInStock (ids) {
  return http.post('/admin/ticketPrepareBatch/delete', { data: { idList: ids } })
}

// 获取库存列表
export function getTicketInStockLog (params) {
  return http.post('/admin/ticketPrepareBatch', { data: params })
}
// 激活
export function ticketInStockActivate (params) {
  return http.post('/admin/ticketPrepareDetail/active', { data: params })
}

export function getTicketInStockDetail (params) {
  return http.post('/admin/ticketPrepareDetail', { data: params })
}

// 打印
export function ticketInStockPrint (params) {
  return http.post('ticketInStock/ticketInStockPrint', { data: params })
}
// 退库
export function ticketBackToStock (params) {
  return http.post('ticketInStock/ticketBackToStock', { data: params })
}
// 预制详情
export function ticketInStockDetail (params) {
  return http.post('/admin/ticketPrepareDetail', { data: params })
}
// 任务列表
export function getMission (params) {
  return http.post('ticketInStock/getTicketInStockMissionList', { data: params })
}

// 获取日期段价格
export function getPeriodPrice (id) {
  return http.post(`ticketType/${id}/periodprice`)
}

// 设置日期段价格
export function setPeriodPrice (id, { data: params }) {
  return http.post(`ticketType/${id}/periodprice`, { data: params })
}

// 获取周价格
export function getWeekDayPrice (id) {
  return http.post(`ticketType/${id}/weekdayprice`)
}

// 设置周价格
export function setWeekDayPrice (id, { data: params }) {
  return http.post(`ticketType/${id}/weekdayprice`, { data: params })
}

// 获取价格策略
export function getTicketPriceStragegy () {
  return http.post(`config/ticketpricestragegy`)
}

// 任务详情
export function getMissionDetail (params) {
  return http.post('ticketInStock/getTicketInStockMissionDetail', { data: params })
}

// 预订单统计
export function ticketInStockStatistics (params) {
  return http.post('ticketInStock/ticketInStockStatistics', { data: params })
}

// 创建子项目
export function createSubProject (params) {
  return http.post('subProject/createSubProject', { data: params })
}

// 编辑子项目
export function updateSubProject (params) {
  return http.post('subProject/updateSubProject', { data: params })
}

// 数据权限列表
export function subProjectList (params) {
  return http.post('subProject/subProjectList', { data: params })
}

// 删除子项目
export function deleteSubProject (params) {
  return http.post('subProject/deleteSubProject', { data: params })
}

// 获取发票供应商
export function listInvoiceChannel (params) {
  return http.post('invoice/listInvoiceChannel', { data: params })
}

// 修改发票供应商接口参数
export function updateInvoiceChannel (params) {
  return http.post('invoice/updateInvoiceChannel', { data: params })
}

// 获取所有销售方
export function listInvoiceSales (params) {
  return http.post('invoice/listInvoiceSales', { data: params })
}

// 添加销售方
export function addInvoiceSale (params) {
  return http.post('invoice/addInvoiceSale', { data: params })
}

// 删除销售方
export function deleteInvoiceSale (params) {
  return http.post('invoice/deleteInvoiceSale', { data: params })
}

// 修改发票供应商接口参数
export function updateInvoiceSale (params) {
  return http.post('invoice/updateInvoiceSale', { data: params })
}

// 获取开票记录
export function listInvoiceRecord (params) {
  return http.post('invoice/listInvoiceRecord', { data: params })
}

// 获取预印票
export function getTicketInStockBySeq (params) {
  return http.post('ticketInStock/getTicketInStockBySeq', { data: params })
}

// 百旺云票平台 二维码
export function invoiceBaiWangGetFaceQrcode (params) {
  return http.post('invoice/invoiceBaiWangGetFaceQrcode', { data: params })
}

// 通过传预印票号和数量返回预印票
export function getTicketInStockByQrcodeAndNumber (params) {
  return http.post('ticketInStock/getTicketInStockByQrcodeAndNumber', { data: params })
}

// 预制门票详情
export function ticketInStockDetailStatistics (params) {
  return http.post('ticketInStock/ticketInStockDetailStatistics', { data: params })
}

export function exportTicketInStockDetail (params) {
  return http.post('exportMission/exportTicketInStockDetail', { data: params })
}

export function queueList (params) {
  return http.post('/queue/list', { data: params })
}

export function createQueue (params) {
  return http.post('/queue/createQueue', { data: params })
}

export function updateQueue (params) {
  return http.post('/queue/updateQueue', { data: params })
}

export function deleteQueue (id) {
  return http.post(`/queue/deleteQueue/${id}`)
}

export function listTransferLog (params) {
  return http.post('/queue/listTransferLog', { data: params })
}

export function signInAfterPass (params) {
  return http.post('/queue/signInAfterPass', { data: params })
}

// 获取票种排序
export function getTicketTypeSort (type) {
  return http.post(`/admin/ticketType/getSort/${type}`)
}

// 保存票种排序
export function saveTicketTypeSort (params) {
  return http.post('/admin/ticketType/saveSort', { data: params })
}
