coupon.js 1.53 KB
Newer Older
1 2 3 4 5
import request from '@/utils/request'

// 创建优惠券信息
export function createCoupon(data) {
  return request({
zhengyi's avatar
zhengyi committed
6
    url: '/product/coupon/createOrUpdate',
7 8 9 10 11 12 13 14
    method: 'post',
    data: data
  })
}

// 更新优惠券信息
export function updateCoupon(data) {
  return request({
zhengyi's avatar
zhengyi committed
15
    url: '/product/coupon/update',
16
    method: 'put',
17 18 19 20 21 22 23
    data: data
  })
}

// 删除优惠券信息
export function deleteCoupon(id) {
  return request({
zhengyi's avatar
zhengyi committed
24
    url: '/product/coupon/delete?id=' + id,
25 26 27 28 29 30 31
    method: 'delete'
  })
}

// 获得优惠券信息
export function getCoupon(id) {
  return request({
zhengyi's avatar
zhengyi committed
32
    url: '/product/coupon/get?couponId=' + id,
33 34 35 36 37 38 39
    method: 'get'
  })
}

// 获得优惠券信息分页
export function getCouponPage(query) {
  return request({
zhengyi's avatar
zhengyi committed
40
    url: '/product/coupon/page',
41 42 43 44 45
    method: 'get',
    params: query
  })
}

46 47 48
// 获得优惠券下拉
export function getCouponSelect(query) {
  return request({
zhengyi's avatar
zhengyi committed
49
    url: '/product/coupon/select',
50 51 52 53 54
    method: 'get',
    params: query
  })
}

55 56 57
// 导出优惠券信息 Excel
export function exportCouponExcel(query) {
  return request({
zhengyi's avatar
zhengyi committed
58
    url: '/product/coupon/export-excel',
59 60 61 62 63
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
64 65 66 67 68 69 70 71

// 获得用户可用优惠券
export function getCustomerAvailableCouponList(data){
  return request({
    url: '/product/coupon/customer/available/couponList',
    method: 'post',
    data
  })
72 73 74 75 76 77 78 79 80
}

// 更新优惠券有效期
export function updateEndtime(data){
  return request({
    url: '/product/coupon/update/endTime',
    method: 'put',
    data
  })
81
}