// 格式化钱
function formatMoney(num) {
  var _num = num - 0;
  if (isNaN(_num)) {
    return '0.00'
  }
  return _num.toLocaleString();
}
// 格式化时间
function formatTime(date, month_str, minute_str, status) {
  date = date.replace(getRegExp('-', 'g'), '/');
  var _date = null;
  _date = getDate(date);
  var year = _date.getFullYear();
  var month = _date.getMonth() + 1;
  var day = _date.getDate();
  var hour = _date.getHours();
  var minute = _date.getMinutes();
  var second = _date.getSeconds();
  if (status) {
    return [year, month, day].map(formatNumber).join(month_str || '/')
  }
  return [year, month, day].map(formatNumber).join(month_str || '/') + ' ' + [hour, minute, second].map(formatNumber).join(minute_str || ':');
}
// 格式化数字
function formatNumber(n) {
  n = n.toString();
  return n[1] ? n : '0' + n;
}
// 格式化价格
function getPriceForm(number) {
  var _num = ((number - 0) / 1000).toLocaleString();
  if (isNaN(_num)) {
    return '暂无报价'
  }
  return _num + 'K'
}

module.exports = {
  formatMoney: formatMoney,
  formatTime: formatTime,
  getPriceForm: getPriceForm,
}