promotionInfoRefresh.js 1.35 KB

var $ = require('jquery'),
	common = require('../../../../common/common');
var date_util=require('./_date_util');
var fixDateTime=function(){
    if(PromotionInfo.startTime&&PromotionInfo.startTime>0){
        PromotionInfo.startTimeStr=date_util.getDateStr(PromotionInfo.startTime);
    }
    if(PromotionInfo.endTime&&PromotionInfo.endTime>0){
        PromotionInfo.endTimeStr=date_util.getDateStr(PromotionInfo.endTime);
    }
}


var PromotionInfoRefresh={
    actionUrl:"/promotionInfo/detail",
    tabLoader:null,
    columnName:null,
    refresh : function(_params){
        var _g=this;
        _g.tabLoader=_params.tabLoader;
            _g.columnName=_params.columnName;
        var reqData={param: _params.promotionId};
        common.util.__ajax2({url : _g.actionUrl, data:reqData},function(rs){
                if(rs.code == 200){
                    PromotionInfo=rs.data;
                    //修复日期格式,只修改一次即可
                    fixDateTime();
                    _g.tabLoader.loadTabHtml(_g.columnName);
                }else{
                    common.util.__tip(rs.message || rs.data.message);
                    
                } 
                return false;               
            },function(rs){
                common.util.__tip("加载失败!", "warning");
            });   
    }
}

module.exports = PromotionInfoRefresh;