瀏覽代碼

计算金额

shish 5 年之前
父節點
當前提交
05cb54b132
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      ghsApp/src/utils/util.js

+ 7 - 1
ghsApp/src/utils/util.js

@@ -82,6 +82,11 @@ const isNumber = num => {
 	return typeof num == "number" && num.constructor == Number;
 };
 
+//是否金额
+const isMoney = money =>{
+	return /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(money)
+}
+
 // 是否为日期类型
 const isDate = date => {
 	return typeof date == "object" && date.constructor == Date;
@@ -309,5 +314,6 @@ export default {
 	getCheckLogin,
 	numberFormat,
 	isString,
-	unique
+	unique,
+	isMoney
 };