coupons.js 4.77 KB
import api from './request'
const path = 'scrm.api.coupon.'
const ghPath = 'scrm.api.carlife.cgacar.'
import {
  defaultMerchantId
} from '../api/environment'
module.exports = {
  /**获取卡券列表 */
  getCardData(data) {
    return api.post({
      method: `${path}app.list`,
      ...data,
      // discountTypes: [3, 7]
    })
  },
  /**获取卡券数量 */
  getCouponNum() {
    return api.post({
      method: 'scrm.api.coupon.list.by.account.id',
      useMemberType: 0,
    })
  },
  /**获取首页可以领取的券 */
  getHomeCardData(data) {
    let merchantId = wx.getStorageSync('srcm_shopmall_merchant_id')
    if (merchantId) {
      merchantId = Number(JSON.parse(merchantId))
      data.merchantId = merchantId
    }
    if (merchantId) {
      data.merchantId = merchantId
    }
    return api.post({
      method: `${path}list.merchant.account`,
      ...data,
    })
  },
  /**领取优惠券 */
  toReciveCard(data) {
    let merchantId = wx.getStorageSync('srcm_shopmall_merchant_id')
    if (merchantId) {
      merchantId = Number(JSON.parse(merchantId))
      data.merchantId = merchantId
    } else {
      data.merchantId = defaultMerchantId
    }
    return api.post({
      method: `${path}customer.receive`,
      ...data,
      receiveWay: 1,
      receiveSource: 3,
    })
  },
  /**卡券详情 */
  couponsDetail(data) {
    return api.post({
      method: `${path}verification.code.detail`,
      ...data,
    })
  },
  /**广汇卡券 卡券全部列表 */
  ghCouponsData() {
    return api.post({
      method: `${ghPath}coupon.list.benefits`,
    })
  },
  /**广汇卡券 抵用记录列表 */
  ghDealNote() {
    return api.post({
      method: `${ghPath}coupon.list.credit.cards`,
    })
  },
  /**广汇卡券 发布确认列表 */
  ghDealPublish() {
    return api.post({
      method: `${ghPath}coupon.list.card.deal`,
    })
  },
  /**广汇卡券 抵用确认列表 */
  ghDealResist() {
    return api.post({
      method: `${ghPath}coupon.list.resist.deal`,
    })
  },
  /**抵用确认提交 */
  ghSumbitResist(data) {
    return api.post({
      method: `${ghPath}coupon.resist.deal`,
      ...data
    })
  },
  /**发布确认提交 */
  ghSumbitPublish(data) {
    return api.post({
      method: `${ghPath}coupon.card.deal`,
      ...data
    })
  },
  /**免费领取体验卡 */
  tolqFreecard(data) {
    return api.post({
      method: `scrm.api.equity.h5.free.card.receive`,
      ...data
    }, true)
  },
  /**获取体验卡天数 */
  getFreeCardDay(data) {
    return api.post({
      method: `scrm.api.equity.class.free.day.get`,
      ...data
    })
  },
  /** 获取企微分享优惠卷信息 */
  getCouponInfo(data) {
    return api.post({
      method: `${path}share.info`,
      ...data,
    })
  },
  /**领取优惠券  */
  receiveCoupon(data) {
    return api.post({
      method: `${path}share.receive`,
      ...data,
      receiveSource: 4
    }, true)
  },
  /**获取套餐详情(权益) */
  packageInfo(data) {
    return api.post({
      method: `scrm.api.equity.main.page.package.detail.get`,
      ...data
    })
  },
  /**获取门店单号(权益) */
  createOrderNum(data) {
    return api.post({
      method: `scrm.api.equity.merchant.order.code.create`,
      ...data
    })
  },
  /**创建门店订单(权益) */
  createOrder(data) {
    return api.post({
      method: `scrm.api.equity.merchant.order.create`,
      ...data
    })
  },
  /**获取折扣券 兑换券详情  */
  getWWCoupon(data) {
    return api.post({
      method: `scrm.api.coupon.verification.code.detail`,
      ...data
    })
  },
  /** 检查是否领取优惠券 */
  checkCoupon(data) {
    return api.post({
      method: `scrm.api.coupon.share.receive.check`,
      ...data
    })
  },
  // 定向礼包详情
  giftsDetail(data) {
    return api.post({
      method: `scrm.api.coupon.directional.gift.detail`,
      ...data
    })
  },
  // 定向礼包领取
  giftsRecive(data) {
    return api.post({
      method: `scrm.api.coupon.user.directional.gift.create`,
      ...data
    })
  },
  /**查询会员开通的套餐列表 */
  getVipList(data) {
    return api.post({
      method: `scrm.api.equity.package.info.list.with.account`,
      pageSize: 9999,
      ...data
    })
  },
   /**  查询包含已使用卡券的会员套餐列表 */
  getVipUsedList(data){
    return api.post({
      method: `scrm.api.equity.package.info.list.with.used.service`,
      pageSize: 9999,
      ...data
    })
  },
  /** 查询包含失效卡券的会员套餐列表 */
  getVipFailList(data){
    return api.post({
      method: `scrm.api.equity.package.info.list.with.invalid.service`,
      pageSize: 9999,
      ...data
    })
  },
  // 获取优惠券详情--道路救援
  getDigitalCoupons(data){
    return api.post({
      method: `scrm.api.coupon.detail`,
      ...data
    })
  }
}