Authored by chenchao

修复日期格式

@@ -3,6 +3,7 @@ var $ = require('jquery'), @@ -3,6 +3,7 @@ var $ = require('jquery'),
3 common = require('../../../common/common'), 3 common = require('../../../common/common'),
4 rejectPromotions=require('./partials/edit_reject'); 4 rejectPromotions=require('./partials/edit_reject');
5 var baseInfoEdit=require('./partials/edit_baseinfo'); 5 var baseInfoEdit=require('./partials/edit_baseinfo');
  6 +var date_util=require('./partials/_date_util');
6 /* 7 /*
7 * 获取业务数据 8 * 获取业务数据
8 */ 9 */
@@ -39,10 +40,20 @@ var ENUM = { @@ -39,10 +40,20 @@ var ENUM = {
39 {en:"reject",cn:"互斥促销"}, 40 {en:"reject",cn:"互斥促销"},
40 {en:"display",cn:"促销显示"},] 41 {en:"display",cn:"促销显示"},]
41 }; 42 };
  43 +var fixDateTime=function(){
  44 + if(PromotionInfo.startTime&&PromotionInfo.startTime>0){
  45 + PromotionInfo.startTime=date_util.getDateStr(PromotionInfo.startTime);
  46 + }
  47 + if(PromotionInfo.endTime&&PromotionInfo.endTime>0){
  48 + PromotionInfo.endTime=date_util.getDateStr(PromotionInfo.endTime);
  49 + }
  50 +}
  51 +//修复日期格式,只修改一次即可
  52 +fixDateTime();
42 //加载显示tab页内容 53 //加载显示tab页内容
43 var loadTabHtml=function(columnname){ 54 var loadTabHtml=function(columnname){
44 var default_html="<a href='#'>bad error</a>"; 55 var default_html="<a href='#'>bad error</a>";
45 - if (columnname === ENUM.tabName[0].en) {//baseinfo 56 + if (columnname === ENUM.tabName[0].en) {//baseinfo
46 var html_baseinfo=common.util.__template2($("#fm_baseInfo").html(), PromotionInfo); 57 var html_baseinfo=common.util.__template2($("#fm_baseInfo").html(), PromotionInfo);
47 $("#tab_body").html(html_baseinfo); 58 $("#tab_body").html(html_baseinfo);
48 baseInfoEdit.load({promotionId:PromotionInfo.id}); 59 baseInfoEdit.load({promotionId:PromotionInfo.id});
  1 +
  2 + var _date_util={
  3 + getDateStr:function(datetime) {
  4 + var date = new Date(datetime * 1000);
  5 + return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
  6 + }
  7 +}
  8 +module.exports = _date_util;