apiVoucher.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import { get, post } from "./http";
  2. const prefix = 'devicesApi/dawn/api/v1/';
  3. export default apiVoucher = {
  4. /**
  5. * 使用兑换码兑换优惠券
  6. * @param {redemptionCode} data
  7. * @returns Promise
  8. */
  9. redeemVoucher(data) {
  10. return post(prefix + "redeem-voucher-by-redemption-code", data)
  11. },
  12. /**
  13. * 领券中心兑换优惠券
  14. * @param {voucherId} data
  15. * @returns Promise
  16. */
  17. purchaseVoucher(data) {
  18. return post(prefix + "redeem-voucher-by-voucher-id", data)
  19. },
  20. /**
  21. * 分页查询我的优惠券列表
  22. * @param {Object} data {lastVoucherId,voucherType}
  23. * @returns Promise
  24. */
  25. getMyVouchers(data) {
  26. return get(prefix + "user-vouchers", data)
  27. },
  28. /**
  29. * 分页查询优惠券贩卖列表
  30. * @param {Object} data {lastVoucherId,voucherType}
  31. * @returns Promise
  32. */
  33. getDealVouchers(data) {
  34. return get(prefix + "voucher-center", data)
  35. },
  36. /**
  37. * 获取优惠券类型选项
  38. * @returns Promise
  39. */
  40. getVoucherTypeOptions() {
  41. return get(prefix + "voucher-type-select")
  42. },
  43. /**
  44. * 获取充电桩可用的优惠券
  45. * @param {Object} data {chargeBoxId,connectorId,voucherType}
  46. * @returns Promise
  47. */
  48. getSelectionVoucher(data) {
  49. return get(prefix + "charge-can-use-vouchers", data)
  50. },
  51. /**
  52. * 获取优惠券详情
  53. * @param {String|Number} voucherId 优惠券ID
  54. * @returns Promise
  55. */
  56. getVoucherInfo(voucherId) {
  57. return get(prefix + "vouchers/" + voucherId)
  58. },
  59. /**
  60. * 分页获取积分历史列表
  61. * @param {String} lastId 上一页最后一项的pointsHistoryId
  62. * @returns Promise
  63. */
  64. getPointsHistory(lastId) {
  65. return get(prefix + "points-history", {lastPointsHistoryId: lastId})
  66. }
  67. }