| | |
| | | } |
| | | }, |
| | | /** |
| | | * 月日格式化 |
| | | * @param {Object} timestamp 时间戳 |
| | | */ |
| | | toMonthDay(timestamp) { |
| | | if (timestamp == null) { |
| | | return |
| | | } else { |
| | | const system = new Date(timestamp) |
| | | const month = system.getMonth() + 1 < 10 ? '0' + (system.getMonth() + 1) : system.getMonth() + 1 |
| | | const date = system.getDate() < 10 ? '0' + system.getDate() : system.getDate() |
| | | return month + '-' + date |
| | | } |
| | | }, |
| | | /** |
| | | * 时间格式化 |
| | | * @param {Object} timestamp |
| | | */ |
| | |
| | | if (cents < 10) { cents = '0' + cents } |
| | | for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++) { num = num.substring(0, num.length - (4 * i + 3)) + ',' + num.substring(num.length - (4 * i + 3)) } |
| | | return (((sign) ? '' : '-') + num + '.' + cents) |
| | | }, |
| | | /** |
| | | * 最大两位小数格式 |
| | | * @param {Object} num |
| | | */ |
| | | toMaxTwoDecimalPlaces(num) { |
| | | const numList = num.toString().split('.') |
| | | num = numList.length > 1 ? numList[1].length > 1 ? num.toFixed(2) : num : num |
| | | return num |
| | | } |
| | | } |
| | | const crud = Object.assign({}, data) |