Authored by chenchao

add baseinfo edit

... ... @@ -2,7 +2,7 @@
var $ = require('jquery'),
common = require('../../../common/common'),
rejectPromotions=require('./partials/edit_reject');
var baseInfoEdit=require('./partials/edit_baseinfo');
/*
* 获取业务数据
*/
... ... @@ -45,6 +45,7 @@ var loadTabHtml=function(columnname){
if (columnname === ENUM.tabName[0].en) {//baseinfo
var html_baseinfo=common.util.__template2($("#fm_baseInfo").html(), PromotionInfo);
$("#tab_body").html(html_baseinfo);
baseInfoEdit.load({promotionId:PromotionInfo.id});
}else if(columnname === ENUM.tabName[1].en) {//condition
var html_condition = $("#fm_condition").html()||default_html;
$("#tab_body").html(html_condition);
... ... @@ -64,6 +65,7 @@ var loadTabHtml=function(columnname){
$("#tab_body").html(html_display);
}
}
//tab 页组件
var t = new common.tab2({
el: "#basicTab",
... ...
console.log("edit promotion list in");
console.log("edit promotion baseinfo in");
var edit = require('../../common/edit');
var baseInfoEdit={
promotionId:null,
edit:null,
actionUrl:"/promotionInfo/update",
load:function(config){
var edit= new edit("#tab_body");
this.edit=edit;
if(config){
this.promotionId=config.promotionId
}
edit.init();
this.bindEvent();
},
bindEvent:function(){
$(document).on('click','#save',function(){return this.save()});
},
save:function(){
var e=this.edit;
e.submit(this.action, function (option) {
option.success = function (res) {
if (res.code == "200") {
e.$tip("提交成功", function () {
location.href = "/promotionInfo/edit/"+this.promotionId||"";
}, 'growl-success');
} else {
e.$tip(res.message);
}
return false;
};
option.error = function (res) {
e.$tip(res.message);
};
console.log(option.data);
});
return false;
}
};
\ No newline at end of file
... ...