Authored by chenchao

1. reject promotion list , remove current promotion

2. validate before save basic info
@@ -108,6 +108,7 @@ module.exports={ @@ -108,6 +108,7 @@ module.exports={
108 title:"设置促销显示", 108 title:"设置促销显示",
109 url:"/promotion/getActivePromotionInfoList", 109 url:"/promotion/getActivePromotionInfoList",
110 params:[ 110 params:[
  111 + {name: 'id', type: 'Number'},
111 {name: 'startTimeStr', type: 'string'}, 112 {name: 'startTimeStr', type: 'string'},
112 {name: 'endTimeStr', type: 'string'}, 113 {name: 'endTimeStr', type: 'string'},
113 {name: 'page',type: 'Number'}, 114 {name: 'page',type: 'Number'},
@@ -8,11 +8,15 @@ var baseInfoEdit={ @@ -8,11 +8,15 @@ var baseInfoEdit={
8 edit:null, 8 edit:null,
9 actionUrl:"/promotionInfo/update", 9 actionUrl:"/promotionInfo/update",
10 load:function(config){ 10 load:function(config){
  11 + var _g=this;
11 var _e= new edit("#tab_body",{}); 12 var _e= new edit("#tab_body",{});
12 this.edit=_e; 13 this.edit=_e;
13 if(config){ 14 if(config){
14 this.promotionId=config.promotionId 15 this.promotionId=config.promotionId
15 } 16 }
  17 + _e.on("validate", function () {
  18 + return _g.validate();
  19 + });
16 _e.init(); 20 _e.init();
17 this.bindEvent(); 21 this.bindEvent();
18 }, 22 },
@@ -20,6 +24,27 @@ var baseInfoEdit={ @@ -20,6 +24,27 @@ var baseInfoEdit={
20 var _g=this; 24 var _g=this;
21 $(document).on('click','#save_baseinfo',function(){return _g.save()}); 25 $(document).on('click','#save_baseinfo',function(){return _g.save()});
22 }, 26 },
  27 + validate:function(){
  28 + var promotionParams=PromotionInfo.promotionParams;
  29 + var status=$("#form_base_info").find("input#status").val();
  30 + if(status===1 || status=='1'){
  31 + var msg="先设置好促销操作和条件后才能开启";
  32 +
  33 + if(!promotionParams){
  34 + return msg;
  35 + }
  36 +
  37 + if(!promotionParams.promotionType){
  38 + return msg;
  39 + }
  40 +
  41 + if(!promotionParams.conditionParam){
  42 + return msg;
  43 + }
  44 + }
  45 +
  46 + return true;
  47 + },
23 save:function(){ 48 save:function(){
24 var _g=this; 49 var _g=this;
25 var e=this.edit; 50 var e=this.edit;
@@ -126,7 +126,8 @@ var rejectPromotions={ @@ -126,7 +126,8 @@ var rejectPromotions={
126 this.batchIds=_config.reject || []; 126 this.batchIds=_config.reject || [];
127 var parmsData={ 127 var parmsData={
128 startTimeStr: _config.startTimeStr, 128 startTimeStr: _config.startTimeStr,
129 - endTimeStr: _config.endTimeStr 129 + endTimeStr: _config.endTimeStr,
  130 + id:_config.promotionId
130 }; 131 };
131 var g=this, 132 var g=this,
132 _param=this.getParam({parmsData : parmsData}); 133 _param=this.getParam({parmsData : parmsData});