import Vue from 'vue'

Vue.filter('money', function(val) {//格式化金额
	if(!val) return '0.00';
	let tempVal = parseFloat(val).toFixed(3)
	let realVal = tempVal.substring(0, tempVal.length - 1)
	var intPart = Number(realVal) - Number(realVal)%1; //获取整数部分（这里是windy93的方法）
	var intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,'); //将整数部分逢三一断
	var value2Array = realVal.toString().split(".");
	var floatPart = value2Array[1].toString(); //拿到小数部分
	return intPartFormat + "." + floatPart;
})