filters.js 855 Bytes
//过滤器
/* eslint-disable */
import Vue from 'vue'
const overThousandFilter = val => {
  if (typeof val != 'number') {
    return false
  }
  if (val < 1000) return val
  let a = val + ''
  let b = a.split('')
  b.splice(-3, 0, ',')
  return b.join('')
}
//来源 value值转为对应label(来源)
const toLabel = value => {
  if (value !== 0 && !value) {
    return
  }

  let sourceList = JSON.parse(window.localStorage.getItem('sourceList'))
  if (sourceList) {
    let curElement = sourceList.find(item => {
      return item.value === value
    })
    return curElement.label
  }
}
const tagType = value => {
  let type = ''
  if (JSON.parse(sessionStorage.getItem('SCRM_BASE_SESSION')).merchantModel == 1) {
    type = '集团'
  } else {
    type = '企业'
  }
  return type
}
export default {
  overThousandFilter,
  toLabel,
  tagType
}