filter.wxs 1.26 KB
var filters = {
        toFix:function(val,count){
            return val.toFixed(count)
        },
        replace_time:function(val){  
           if(!val) return "不限";
           return val.replace("00:00:00","");
        },
        
        replace_time2: function (val) {
          var a = val.split(" ");
          return a[0];
        },

        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;
        },

        pInt:function(t) {
            var d = parseInt(t); return d;
        },

        show_gui_ge:function(spec,color){
            if((spec=="" || spec==null)){
               if((color=="" || color==null)){ return "规格1";
               }else{return color; }
            }else{
               if((color=="" || color==null)){ return spec;
               }else{ return  spec+"/"+color; }
            }
        }
}
module.exports = {
     toFix: filters.toFix,
	 replace_time:filters.replace_time,
     replace_time2: filters.replace_time2,
     format_time:filters.format_time,
     pInt:filters.pInt,
     show_gui_ge:filters.show_gui_ge
}