import { request } from '@/service/request';

/**
 * 所有列表
 * @returns
 */
export function fetchGetActivityList(data: any) {
  return request({
    url: `/smqjh-system/sys-api/couponLocal/page`,
    method: 'get',
    params: data
  });
}

/**
 *
    新增
 * @param data
 * @returns
 */

export function fetchAddActivity(data: any) {
  return request({
    url: `/smqjh-system/sys-api/couponLocal/save`,
    method: 'post',
    data
  });
}

/**
 *
    编辑
 * @param data
 * @returns
 */

export function fetchEditActivity(data: any) {
  return request({
    url: `/smqjh-system/sys-api/couponLocal/update`,
    method: 'PUT',
    data
  });
}

/**
 *
    删除
 * @param data
 * @returns
 */

export function delActivity(id: any) {
  return request({
    url: `/smqjh-system/sys-api/couponLocal/delete/${id}`,
    method: 'DELETE'
  });
}

/**
 * 获取领取记录
 * @returns
 */
export function fetchList(data: any) {
  return request({
    url: `/smqjh-system/sys-api/memberCoupon/page`,
    method: 'get',
    params: data
  });
}

/**
 * 导入失败记录
 * @returns
 */
export function fetchFailList(data: any) {
  return request({
    url: `/smqjh-system/sys-api/memberCoupon/findByTypePage`,
    method: 'get',
    params: data
  });
}

/**
 *批量导入
 * @returns
 */
export function fetchImport(data: any) {
  return request({
    url: `/smqjh-system/sys-api/memberCoupon/uploadExcelGoods`,
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
}

/**
 * 下载失败记录
 * @returns
 */
export function fetchExportFailure(data: any) {
  return request({
    url: `/smqjh-system/sys-api/memberCoupon/downloadErrorExcel`,
    method: 'get',
    params: data
  });
}

/**
 *
    删除优惠券
 * @param data
 * @returns
 */

export function delCoupon(id: any) {
  return request({
    url: `/smqjh-system/sys-api/memberCoupon/delete/${id}`,
    method: 'DELETE'
  });
}
