import request from '@/utils/request'

//添加、修改
export function addMarketing(data) {
  return request({
    url: `/api/v1/mp/admin/marketing/${data.id ? 'update' : 'create'}`,
    method: 'post',
    data
  })
}

//查询列表
export function getMarketingList(urlParams, data) {
  return request({
    url: '/api/v1/mp/admin/marketing/list',
    method: 'post',
    data,
    urlParams
  })
}

//查询列表
export function ticketMarketingExport(data) {
  return request({
    url: '/api/v1/mp/admin/marketing/export',
    method: 'post',
    data,
  })
}

//查询详情
export function getMarketingDetail(id) {
  return request({
    url: `/api/v1/mp/admin/marketing/detail/${id}`,
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
  })
}

//删除
export function delMarketing(Id) {
  return request({
    url: `/api/v1/mp/admin/marketing/delete/${Id}`,
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
  })
}

//开启活动
export function setMarketingStatus(data) {
  return request({
    url: `/api/v1/mp/admin/marketing/on/${data}`,
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
  })
}

//关闭活动
export function setMarketingStatusOff(data) {
  return request({
    url: `/api/v1/mp/admin/marketing/off/${data}`,
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
  })
}
//查询活动数据列表
export function getMarketingDataCodeList(urlParams,id) {
  return request({
    url: `/api/v1/mp/admin/marketing/data/codeList/${id}`,
    method: 'post',
    urlParams,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
  })
}
export function getMarketingData(id) {
  return request({
    url: `/api/v1/mp/admin/marketing/data/${id}`,
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
  })
}

//复制活动
export function getMarketingCopy(id) {
  return request({
    url: `/api/v1/mp/admin/marketing/copy/${id}`,
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
  })
}
