import { get, post } from "./http"; const prefix = 'devicesApi/dawn/api/v1/'; export default apiVoucher = { /** * 使用兑换码兑换优惠券 * @param {redemptionCode} data * @returns Promise */ redeemVoucher(data) { return post(prefix + "redeem-voucher-by-redemption-code", data) }, /** * 领券中心兑换优惠券 * @param {voucherId} data * @returns Promise */ purchaseVoucher(data) { return post(prefix + "redeem-voucher-by-voucher-id", data) }, /** * 分页查询我的优惠券列表 * @param {Object} data {lastVoucherId,voucherType} * @returns Promise */ getMyVouchers(data) { return get(prefix + "user-vouchers", data) }, /** * 分页查询优惠券贩卖列表 * @param {Object} data {lastVoucherId,voucherType} * @returns Promise */ getDealVouchers(data) { return get(prefix + "voucher-center", data) }, /** * 获取优惠券类型选项 * @returns Promise */ getVoucherTypeOptions() { return get(prefix + "voucher-type-select") }, /** * 获取充电桩可用的优惠券 * @param {Object} data {chargeBoxId,connectorId,voucherType} * @returns Promise */ getSelectionVoucher(data) { return get(prefix + "charge-can-use-vouchers", data) }, /** * 获取优惠券详情 * @param {String|Number} voucherId 优惠券ID * @returns Promise */ getVoucherInfo(voucherId) { return get(prefix + "vouchers/" + voucherId) }, /** * 分页获取积分历史列表 * @param {String} lastId 上一页最后一项的pointsHistoryId * @returns Promise */ getPointsHistory(lastId) { return get(prefix + "points-history", {lastPointsHistoryId: lastId}) } }