import request from '@/utils/request'

// 查询充值模板列表
export function listRechargeTemplate(query) {
  return request({
    url: '/store/recharge-templates/list',
    method: 'post',
    data: query
  })
}

// 查询充值模板详细
export function getRechargeTemplate(id) {
  return request({
    url: '/store/recharge-templates/' + id,
    method: 'get'
  })
}

// 新增充值模板
export function addRechargeTemplate(data) {
  return request({
    url: '/recharge-templates',
    method: 'post',
    data: data
  })
}

// 修改充值模板
export function updateRechargeTemplate(data) {
  return request({
    url: '/store/recharge-templates/' + data.id,
    method: 'put',
    data: data
  })
}

// 删除充值模板
export function delRechargeTemplate(id) {
  return request({
    url: '/store/recharge-templates/' + id,
    method: 'delete'
  })
}

// 修改充值模板状态
export function updateRechargeTemplateStatus(id, status) {
  return request({
    url: '/store/recharge-templates/' + id + '/status',
    method: 'put',
    params: {
      status: status
    }
  })
}


/**
 * 获取优惠券列表
 * @param {Object} query 查询参数
 * @returns {Promise} 请求结果
 */
export function getCouponList(query) {
  return request({
    url: '/store/recharge-templates/getCouponList',
    method: 'get',
    params: query
  })
}
