import request from '@/utils/request'

// 选择客户可使用的优惠券
export function getCouponItemlistByAppUserId(data) {
  return request({
    url: '/mapi/app/couponItem/getlistByAppUserId',
    method: 'post',
    data: data
  })
}

// 选择门店这块
export function getDiscountByStoreId(data) {
  return request({
    url: '/mapi/activity/discountInfo/getDiscountByStoreId',
    method: 'get',
    params: data
  })
}

// 查询优惠券列表
export function listCouponItem(query) {
  return request({
    url: '/mapi/app/couponItem/list',
    method: 'get',
    params: query
  })
}

// 查询优惠券详细
export function getCouponItem(id) {
  return request({
    url: '/mapi/app/couponItem/' + id,
    method: 'get'
  })
}

// 新增优惠券
export function sendCoupon(data) {
  return request({
    url: '/mapi/app/couponItem/sendCoupon',
    method: 'post',
    data: data
  })
}

// 修改优惠券
export function updateCouponItem(data) {
  return request({
    url: '/mapi/app/couponItem',
    method: 'put',
    data: data
  })
}

// 删除优惠券
export function delCouponItem(id) {
  return request({
    url: '/mapi/app/couponItem/' + id,
    method: 'delete'
  })
}


// 修改优惠券状态
export function updateCouponItemStatus(id,status) {
  const data = {
    id,
    status
  }
  return request({
    url: '/mapi/app/couponItem/updateStatus',
    method: 'post',
    data: data
  })
}
