Commit bff0bb5a authored by agping's avatar agping

优化 活动列表

parent da46e192
...@@ -72,6 +72,28 @@ define (['doT', 'text!temp/red_envelope_list_template_tpl.html', 'css!style/home ...@@ -72,6 +72,28 @@ define (['doT', 'text!temp/red_envelope_list_template_tpl.html', 'css!style/home
$('#activity-bag-num').val(0); $('#activity-bag-num').val(0);
} }
}); });
//奖励有效期 input
$("#activity-day").change(function(){
var _this = $(this);
if(_this.val() > 0){
$("input[name='award-period'][value='" + 0 + "']").prop("checked", "checked");
}
});
//活动发放总次数 input
$("#activity-total-num").change(function(){
var _this = $(this);
if(_this.val() > 0){
$("input[name='activity-total'][value='" + 0 + "']").prop("checked", "checked");
}
});
//奖励有效期 input
$("#activity-bag-num").change(function(){
var _this = $(this);
if(_this.val() > 0){
$("input[name='activity-total-bag'][value='" + 0 + "']").prop("checked", "checked");
}
});
}, },
...@@ -155,7 +177,6 @@ define (['doT', 'text!temp/red_envelope_list_template_tpl.html', 'css!style/home ...@@ -155,7 +177,6 @@ define (['doT', 'text!temp/red_envelope_list_template_tpl.html', 'css!style/home
params.return_action=$("input[name='return_action']:checked").val(); params.return_action=$("input[name='return_action']:checked").val();
params.activity_start_time= (new Date($('#activity_start_date').val())).getTime()*0.001; params.activity_start_time= (new Date($('#activity_start_date').val())).getTime()*0.001;
params.activity_end_time= (new Date($('#activity_end_date').val())).getTime()*0.001; params.activity_end_time= (new Date($('#activity_end_date').val())).getTime()*0.001;
// params.use_period= $('#red-day').val();
//活动发放总次数 //活动发放总次数
if($("input[name='activity-total']:checked").val() == -1){ if($("input[name='activity-total']:checked").val() == -1){
params.total= -1; params.total= -1;
...@@ -177,9 +198,27 @@ define (['doT', 'text!temp/red_envelope_list_template_tpl.html', 'css!style/home ...@@ -177,9 +198,27 @@ define (['doT', 'text!temp/red_envelope_list_template_tpl.html', 'css!style/home
params.available= $('#activity-bag-num').val(); params.available= $('#activity-bag-num').val();
} }
params.activity_rule= $('#activity-rule').val(); params.activity_rule= $('#activity-rule').val();
//验证输入框大于等于0
if(!(params.money > 0)){
alert('请输入金额大于0!');
return;
};
if(!(params.use_period > 0)){
alert('请输入奖励有效期大于0!');
return;
};
if(!(params.total > 0)){
alert('请输入活动发放总次数大于0!');
return;
};
if(!(params.available > 0)){
alert('用户可得红包数大于0!');
return;
};
$.ajax ({ $.ajax ({
url: '/index/saveActivity',//获取列表 url: '/index/saveActivity',//获取列表
type: 'POST', type: 'POST',
...@@ -187,7 +226,11 @@ define (['doT', 'text!temp/red_envelope_list_template_tpl.html', 'css!style/home ...@@ -187,7 +226,11 @@ define (['doT', 'text!temp/red_envelope_list_template_tpl.html', 'css!style/home
data: params, data: params,
dataType: 'json', dataType: 'json',
success: function (data) { success: function (data) {
if(data.code == 200){
$('#modal-add').modal('hide')
}
alert(data.msg) alert(data.msg)
} }
}); });
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment