bigdatautilApi.js 1.16 KB
const url = '/rop-scrm-bigdatautil/router'

import { util } from 'utils'
export default {
  /**埋点 */
  reportTrack (id, view = true) {
    let userInfo = util.getUserInfo()
    let params = util.getLocalStorage('wx_scrm_link_params') || {}
    let ISWXWORK = util.getLocalStorage('is_wxwork')
    if(ISWXWORK){
      if(userInfo.loginList.length && userInfo.loginList[0].phone) userInfo.phone = userInfo.loginList[0].phone
    }
    let data = {
      open_id: userInfo.openid || userInfo.uuid,
      staff_id: params && params.staffId || '',
      staff_uuid: params && params.shareStaffUuid || '',
      user_phone: params && params.userPhone || '',
      create_time: new Date().format('yyyy-MM-dd hh:mm:ss'),
      item_type: 3,
      customer_phone: userInfo.phone || '',
      action_type: view ? 1 : 4, //1浏览 4分享
      item_id: id,
      business_type: 1,
      add_way: 104,
      merchant_id: params && params.merchantId || '',
      user_open_id: params && params.openId || ''
    }
    return window.$HTTP({
      url,
      data: {
        method: 'entmicro.api.customercollect.reportCustomerList',
        jsonList: [JSON.stringify(data)]
      },
    })
  }
}