coupons.js 4.39 KB
import api from '../request/http'
module.exports = {
  /**获取卡券列表 */
  getCardData(data) {
    return api.post({
      method: `scrm.api.coupon.app.list`,
      ...data
      // discountTypes: [3, 7]
    })
  },
  /**获取卡券数量 */
  getCouponNum() {
    return api.post({
      method: 'scrm.api.coupon.list.by.account.id',
      useMemberType: 0
    })
  },
  // 门店发现商城优惠券列表
  getMerchantCouponsListApi(data) {
    return api.post({
      method: `scrm.api.coupon.discover.goods.list`,
      ...data
    })
  },
  /**获取首页可以领取的券 */
  getHomeCardData(data) {
    let {
      merchantId
    } = wx.p.storage.get('merchant_info')
    if (merchantId) {
      merchantId = Number(JSON.parse(merchantId))
      data.merchantId = merchantId
    }
    return api.post({
      method: `scrm.api.coupon.list.merchant.account`,
      ...data
    })
  },

  /**领取优惠券 */
  toReciveCard(data) {
    let {
      merchantId
    } = wx.p.storage.get('merchant_info')
    if (merchantId) {
      merchantId = Number(JSON.parse(merchantId))
      data.merchantId = merchantId
    }
    return api.post({
      method: `scrm.api.coupon.customer.receive`,
      ...data,
      receiveWay: 1,
      receiveSource: 3
    })
  },
  /**卡券详情 */
  couponsDetail(data) {
    return api.post({
      method: `scrm.api.coupon.verification.code.detail`,
      ...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: `scrm.api.coupon.share.info`,
      ...data
    })
  },
  /**领取优惠券  */
  receiveCoupon(data) {
    return api.post({
        method: `scrm.api.coupon.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
    })
  },
  // 获取优惠券详情--道路救援
  getDigitalCoupons(data) {
    return api.post({
      method: `scrm.api.coupon.detail`,
      ...data
    })
  },
  // 领取发现模块的优惠券
  toReciveDiscoverCard(data) {
    let {
      merchantId
    } = wx.p.storage.get('merchant_info')
    if (merchantId) {
      merchantId = Number(JSON.parse(merchantId))
      data.merchantId = merchantId
    }
    return api.post({
      method: `scrm.api.coupon.customer.receive`,
      ...data,
      receiveWay: 9,
      receiveSource: 3
    })
  },
  // 获取优惠券和商品详情
  getEquityCouponsDetail(data) {
    return api.post({
      method: `scrm.api.coupon.brand.detail`,
      ...data
    })
  },
  // 领取权益优惠券
  getEquityCoupons(data) {
    return api.post({
      method: `scrm.api.coupon.user.url.get`,
      ...data
    })
  },
  //批量领取门店发现商城优惠券
  batchGetMerchantCouponsApi(data) {
    return api.post({
      method: `scrm.api.coupon.discover.goods.list.batch.receive`,
      ...data
    })
  },
  /**
   * 领取调查问卷 商城券
   */
  reciveQuestionnaireCoupon(data) {
    return api.post({
      method: `scrm.api.coupon.user.questionnaire.get`,
      ...data
    })
  },
}