var filters = {
        toFix:function(val,count){
            return val.toFixed(count)
        },
        format_time:function(ts,isFull) {
           var d = getDate(ts*1000)
           var fm=[d.getFullYear(), d.getMonth()+1, d.getDate()].join('-');
           if(isFull==1)
              fm=fm + ' '+ [d.getHours(), d.getMinutes(), d.getSeconds()].join(':')
           return fm;
        },
         //全场为 红色  商品除了全场为蓝色   卡项为绿色
        setcolor:function(ind){
          if(ind==0) return "red";
          if(ind==1) return "blue";
          if(ind==2) return "blue";          
          if(ind==11) return "blue";

          if(ind==12) return "blue";
          if(ind==13) return "blue";
          
          if(ind==14) return "blue";
          if(ind==20) return "blue";

          if(ind==21) return "green";
          if(ind==22) return "green";

          if(ind==24) return "green";
          if(ind==25) return "green";
          return "";
        },
      setbgcolor: function (ind) {
        if (ind == 0) return "#ffa1b9";//红
        if (ind == 1) return "#a3bcff";//蓝
        if (ind == 2) return "#a3bcff";//蓝
        if (ind == 11) return "#a3bcff";//蓝
        if (ind == 12) return "#a3bcff";//蓝       

        if (ind==13) return "#a3bcff";//蓝

        if (ind==14) return "#a3bcff";//蓝
        if (ind == 20) return "#a3bcff";//蓝
        if (ind==21) return "#59e1d2";//绿
        if (ind==22) return "#59e1d2";//绿

        if (ind==24) return "#59e1d2";//绿
        if (ind==25) return "#59e1d2";//绿
        return "";
      },


    get_type:function(ind){
        if (ind == 0 || ind == null) return "全场通用";
        if (ind == 1) return "品牌";
        if (ind == 2) return "品类";
        if (ind == 11) return "用途";
        if (ind == 12) return "分类一";
        if (ind == 13) return "自定义";
        if (ind == 14) return "分类二";
        if (ind == 20) return "单品";
        if (ind == 21) return "卡项类别";
        if (ind == 22) return "自选项目";
        if (ind == 24) return "全部卡项";
        if (ind == 25) return "卡项";
        return "";
    },
    get_type_card:function(ind){
        if (ind == 0 || ind == null) return "全场通用";
        if (ind == 1) return "指定品牌";
        if (ind == 2) return "指定品类";
        if (ind == 11) return "指定用途";
        if (ind == 12) return "指定分类一";
        if (ind == 14) return "指定分类二";
        if (ind == 13) return "自定义";
        if (ind == 20) return "指定单品";
        if (ind == 21) return "卡项类别";
        if (ind == 22) return "自选项目";
        if (ind == 24) return "全部卡项";
        if (ind == 25) return "卡项";
        return "";
    },


       format_huiche:function (text) {
        if (!text) {
          return "";
        }
        var reg = getRegExp('\\\\n', 'g')
        return text.replace(reg, '\n')
      }
}

module.exports = {
  toFix: filters.toFix,
	format_time:filters.format_time,
	setcolor:filters.setcolor,
  setbgcolor: filters.setbgcolor,
  get_type: filters.get_type,
  get_split_name: filters.get_split_name,
  get_type_card: filters.get_type_card,
  format_huiche: filters.format_huiche,
}