Browse Source

no message

linwenxin 1 month ago
parent
commit
9a094c847d
1 changed files with 21 additions and 22 deletions
  1. 21 22
      src/filters/index.js

+ 21 - 22
src/filters/index.js

@@ -1,13 +1,12 @@
-
 /**
  * 数字保留两位小数点
  * @param {number} num
  * @return {string}
  */
 export function priceFilter(num) {
-	if(!num) return '0.00';
-	num = Number(num);
-	return num.toFixed(2);
+  if (!num) return '0.00'
+  num = Number(num)
+  return num.toFixed(2)
 }
 
 /**
@@ -16,8 +15,8 @@ export function priceFilter(num) {
  * @return {string}
  */
 export function phoneFilter(val) {
-  if (!val) return '';
-  return val.slice(0, 3) + '****' + val.slice(7);
+  if (!val) return ''
+  return val.slice(0, 3) + '****' + val.slice(7)
 }
 
 /**
@@ -26,8 +25,8 @@ export function phoneFilter(val) {
  * @return {string}
  */
 export function dateToYYmmdd(date) {
-	if(!date) return '';
-	return date.slice(0, 10);
+  if (!date) return ''
+  return date.slice(0, 10)
 }
 
 /**
@@ -36,10 +35,10 @@ export function dateToYYmmdd(date) {
  * @return {string}
  */
 export function dateToYYmmdd2(date) {
-	if(!date) return '';
-	let newDate = date.slice(0, 10);
-	newDate = newDate.replace(/-/g, '.');
-	return newDate;
+  if (!date) return ''
+  let newDate = date.slice(0, 10)
+  newDate = newDate.replace(/-/g, '.')
+  return newDate
 }
 
 /**
@@ -48,8 +47,8 @@ export function dateToYYmmdd2(date) {
  * @return {string}
  */
 export function dateTommdd(date) {
-	if(!date) return '';
-	return date.slice(5, 10);
+  if (!date) return ''
+  return date.slice(5, 10)
 }
 
 /**
@@ -58,15 +57,15 @@ export function dateTommdd(date) {
  * @return {string}
  */
 export function dateToHHmmss(date) {
-	if(!date) return '';
-	return date.slice(11, 19);
+  if (!date) return ''
+  return date.slice(11, 19)
 }
 
 export function priceFilter2(val) {
-  if(val === 0) return '面议';
-	if(!val) return '-';
-	val = Number(val);
-	return `¥${val.toFixed(2)}`;
+  if (val === 0) return '面议'
+  if (!val) return '-'
+  val = Number(val)
+  return `¥${val.toFixed(2)}`
 }
 
 /**
@@ -74,8 +73,8 @@ export function priceFilter2(val) {
  * @returns {string}
  */
 export function timeFilter(date) {
-  date = new Date(date);
-  let time = date.getTime();
+  date = new Date(date)
+  let time = date.getTime()
   if (('' + time).length === 10) {
     time = parseInt(time) * 1000
   } else {