shopmallApi.js 2.91 KB
import api from '~/utils/request/request'
import USERAPI from '~/api/usersApi/index'
export default {
  /**众筹详情 */
  getActivityDetail(id) {
    return api.post({
        method: 'scrm.api.shopmall.weapp.activity.detail',
        id
      },
      true
    )
  },
  /**参团人数 */
  getActivityGroup(id) {
    return api.post({
        method: 'scrm.api.shopmall.weapp.activity.group2',
        id
      },
      true
    )
  },
  /** 创建订单(立即购买) */
  createOrder(data) {
    return api.post({
        method: 'scrm.api.shopmall.weapp.order.create',
        ...data
      },
      true
    )
  },
  /**创建支付订单(去付款) */
  payOrder(data) {
    return api.post({
        method: 'scrm.api.shopmall.weapp.order.createPay',
        ...data
      },
      true
    )
  },
  /**海报  */
  getPoster(data) {
    data.sessionId = wx.$util.getSessionId()
    return api.post({
        method: 'scrm.api.shopmall.weapp.crowdFunding.poster',
        ...data
      },
      true
    )
  },
  /** 订单详情 */
  getOrderList(activityId) {
    return api.post({
        method: 'scrm.api.shopmall.weapp.crowdFunding.order.list',
        activityId
      },
      true
    )
  },
  // 根据众筹id获取直播详情
  getLiveDetail(id) {
    return api.post({
        method: 'scrm.api.shopmall.weapp.activity.live.broadcast.detail',
        id
      },
      true
    )
  },
  // 直播IM用户签名
  getLiveSig(data) {
    return api.post({
        method: 'scrm.api.shopmall.weapp.live.activity.usersig',
        ...data
      },
      true
    )
  },
  /** 查询分享人信息 */
  getStaffInfo(data) {
    return api.post({
      method: 'scrm.api.shopmall.activity.share.user.info',
      ...data
    })
  },
  /** 广汇留资 */
  recordSave(data) {
    return api.post({
      method: `scrm.api.shopmall.gh.customer.record.save`,
      ...data
    })
  },
  /**直播间埋点*/
  async liveRoomReport(data) {
    const userInfo = wx.$util.getUserInfo(),
      userProfile = wx.$storage.get('user_profile'),
      {
        openId
      } = await USERAPI.getWXUserInfo()
    let obj = {
      accountId: userInfo.accountId || '',
      accountName: userInfo.nickName || userProfile.nickName || '微信用户',
      customerAvatar: userInfo.headImgUrl || userProfile.avatarUrl || 'https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132',
      customerOpenId: openId || userInfo.openId || '',
      customerUnionId: userInfo.unionId || '',
      customerPhone: userInfo.phone || '',
      merchantId: userInfo.merchantId || '',
      merchantName: userInfo.merchantName || '',
      bizDataType: 1,
      operationType: 3,
      operationDate: new Date().format('yyyy-MM-dd hh:mm:ss'),
      visitSource: '小程序-众筹'
    }
    return api.post({
      method: 'scrm.api.shopmall.livebroadcast.report',
      ...data,
      ...obj
    })
  },
}