coupons.js 5.65 KB
import api from '~/utils/request/request'
const path = 'scrm.api.coupon.'
const ghPath = 'scrm.api.carlife.cgacar.'
import { defaultMerchantId } from '~/utils/request/environment'
module.exports = {
  /**获取卡券列表 */
  getCardData(data) {
    return api.post({
      method: `${path}app.list`,
      ...data
      // discountTypes: [3, 7]
    })
  },
  //获取领券中心优惠券列表
  getCarCenterdData(data){
    return api.post({
      method: `${path}user.receive.center.list`,
      ...data
    })
  },
  /**获取卡券数量 */
  getCouponNum() {
    return api.post({
      method: 'scrm.api.coupon.list.by.account.id',
      useMemberType: 0
    })
  },
  /**获取首页可以领取的券 */
  getHomeCardData(data) {
    let merchantId = wx.$storage.get('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.$storage.get('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,
      receiveSource: 3
    })
  },
   /**领取中心优惠券 */
  reciveCenterCouponApi(data){
    return api.post({
      method: `${path}user.receive.center.get`,
      ...data
    })
  },

  /**卡券详情 */
  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
    })
  },
  // 获取优惠券详情--道路救援
  getDigitalCoupons(data) {
    return api.post({
      method: `scrm.api.coupon.detail`,
      ...data
    })
  },
  // 领取发现模块的优惠券
  toReciveDiscoverCard(data) {
    let merchantId = wx.$storage.get('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: 9,
      receiveSource: 3
    })
  },
   // 门店发现商城优惠券列表
   getMerchantCouponsListApi(data) {
    return api.post({
      method: `scrm.api.coupon.discover.goods.list`,
      ...data
    })
  },
  //批量领取门店发现商城优惠券
  batchGetMerchantCouponsApi(data) {
    return api.post({
      method: `scrm.api.coupon.discover.goods.list.batch.receive`,
      ...data
    })
  },
// 分页查询发现专区车主优选油劵列表(小程序)
    getDiscoverOilList(data) {
      return api.post({
        method: `scrm.api.shopmall.goods.discover.oil.coupon.page`,
        ...data
      })
    },
    getUserCouponCount(data) {
      return api.post({
        method: `scrm.api.shopmall.goods.oil.coupon.user.count`,
        ...data
      })
    },
}