myCoupon.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import request from '@/utils/request'
  2. // api地址
  3. const api = {
  4. list: 'clientApi/myCoupon/list',
  5. remove: 'clientApi/myCoupon/remove',
  6. mydetail: 'clientApi/userCouponApi/detail',
  7. detail: 'clientApi/coupon/detail'
  8. }
  9. // 会员卡券列表
  10. export const list = (param, option) => {
  11. const options = {
  12. isPrompt: true, //(默认 true 说明:本接口抛出的错误是否提示)
  13. load: true, //(默认 true 说明:本接口是否提示加载动画)
  14. ...option
  15. }
  16. return request.get(api.list, param, options)
  17. }
  18. // 卡券详情
  19. export function detail(couponId, userCouponId, userCouponCode) {
  20. if (parseInt(userCouponId) > 0 || userCouponCode.length > 0) {
  21. if (userCouponId == undefined) {
  22. userCouponId = 0
  23. }
  24. if (userCouponCode == undefined) {
  25. userCouponCode = ""
  26. }
  27. return request.get(api.mydetail, { userCouponId, userCouponCode })
  28. } else {
  29. return request.post(api.detail, { couponId })
  30. }
  31. }
  32. // 删除卡券
  33. export function remove(userCouponId) {
  34. return request.post(api.remove, { userCouponId })
  35. }