apiVoucher.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. getVoucherInfo(voucherId) {
  52. return get(prefix + "vouchers/" + voucherId)
  53. }
  54. }