优化添加

master
chenzhi 4 years ago
parent d662c89b7e
commit cafdc39f2a

@ -337,10 +337,22 @@ class PromoteCompanyController extends ThinkController
}else{
$data['contact_end']='';
}
if($data['validity_start_time'] >0){
$data['validity_start_time']=date("Y-m-d",$data['validity_start_time']);
}else{
$data['validity_start_time']='';
}
if($data['validity_end_time'] >0){
$data['validity_end_time']=date("Y-m-d",$data['validity_end_time']);
}else{
$data['validity_end_time']='';
}
if($data['resources'] == ''){
$data['resources'] ="[]";
}
$data['turnover_ratio'] = $data['turnover_ratio'] ? json_decode($data['turnover_ratio'], true) : $data['turnover_ratio'];
// $data['game_ids'] = explode(',', $data['game_ids']);
$this->assign('serviceAgreements', M('service_agreement', 'tab_')->select());
$this->assign('data', $data);
$this->display();

@ -40,7 +40,7 @@ class PromoteCompanyVerifyModel extends Model
$verifydata = [
"company_id"=>$p_id,
"company_name"=>$info['partner'],
"company_name"=>$info['company_name'],
"verify_status"=>0,
"create_time"=>time(),
'verify_log'=>json_encode(["create_user"=>$_SESSION['onethink_admin']['user_auth']['username'],"create_time"=>date("Y-m-d H:i:s")])

@ -412,8 +412,7 @@
</div>
</div>
<div class="pro_promot" style="display:none">
<form action="{:U('saveCompanyGame')}" id="ajaxForm" method="post" />
<input type="hidden" name="promote_id" id="se_promote_id" value="" />
<form id="promotForm" >
<div class="pro_promot_main">
<div class="pro_promot_title">
<div class="fl pro_promot_title_text">
@ -507,6 +506,7 @@
$('#submit').click(function(){
$('#form').submit();
});
var ids = [];
</script>
<script>
var doc = [];
@ -640,7 +640,7 @@
})
}
if(!flag) return false;
senddata.push({"name":"game_ids", "value":ids.join(",")});
//添加
$.ajax({
url:"{:U('add')}",
@ -851,14 +851,14 @@
var checked = 'checked';
$.post(url,{},function(res){
console.log(res);
if(res.code==1){
$(".pro_promot_select_list a").eq(0).addClass('active');
$(".pro_promot_select_list a").eq(0).siblings().removeClass('active');
var game_list = res.data.game_list;
var promote_info = res.data.promote_info;
var lis = [];
var promote_info = [];
promote_info['game_ids'] = ids;
$.each(game_list,function(index,ele){
if(ele.game_name.length>6){
@ -867,8 +867,10 @@
lis.push('<li class="fl pro_promot_game_con" data-short="'+ele.short+'">');
if(promote_info == ''){
if(promote_info['game_ids'].length == 0){
$(".jsgamecheckall").attr('checked',false);
lis.push('<input type="checkbox" value="'+ele.id+'" name="game_ids[]" class="fl pro_promot_game_check jsgameid" id="gameCheck'+index+'" />');
checked = '';
}else{
if(promote_info['game_ids'].indexOf(ele.id)>-1){
lis.push('<input type="checkbox" value="'+ele.id+'" name="game_ids[]" class="fl pro_promot_game_check jsgameid" checked="checked" id="gameCheck'+index+'" />');
@ -902,12 +904,17 @@
//保存修改
$(".pro_promot_btn_confirm").click(function(){
$("#ajaxForm").ajaxSubmit(function(res){
layer.msg(res.msg);
ids = [];
var res = $("#promotForm").serializeArray();
for (var key in res) {
if (res.hasOwnProperty(key)) {
var e = res[key];
ids.push(e['value']);
}
}
// layer.msg("编辑成功,保存并审核通过后生效");
$(".pro_promot").hide();
});
return false;
});
//关闭弹窗
$(".pro_promot_close").click(function(){
@ -916,7 +923,6 @@
//取消修改
$(".pro_promot_btn_cancel").click(function(){
$(".pro_promot").css("display","none");
layer.msg('修改已取消');
});
$(".jsgamecheckall").click(function(){

@ -3,6 +3,7 @@
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
<link rel="stylesheet" type="text/css" href="__STATIC__/webuploader/webuploader.css" media="all">
<link href="__STATIC__/icons_alibaba/iconfont.css" rel="stylesheet">
<link rel="stylesheet" href="__CSS__/pro_promote.css" type="text/css" />
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<style>
@ -287,6 +288,12 @@
<input type="text" class="txt " name="content" value="{$data.content}" placeholder="">
</td>
</tr>
<tr>
<td class="l">推广游戏:</td>
<td class="r" >
<a class="ajax-view">查看</a>
</td>
</tr>
<tr>
<td class="l noticeinfo"><i class="mustmark" style="margin-left:-7px">*</i>承担服务费:</td>
<td class="r table_radio">
@ -426,13 +433,68 @@
</form>
</div>
</div>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$meta_title}">
<input type="hidden" name="url" value="Partner/add">
<div class="pro_promot" style="display:none">
<form id="promotForm" >
<div class="pro_promot_main">
<div class="pro_promot_title">
<div class="fl pro_promot_title_text">
<div class="fl pro_promot_title_bigtext"> 可申请游戏</div> 选中的游戏将在对应的推广员后台进行展示,推广员可进行游戏申请</div>
<div class="pro_promot_close fr"><img src="__IMG__/icon_close.png"></div>
</div>
<div class="pro_promot_con">
<div class="pro_promot_account">推广公司:<span class="pro_promot_number"></span></div>
<div class="pro_promot_select">
<div class="pro_promot_select_title fl">选择游戏:</div>
<div class="pro_promot_select_list fl">
<a class="pro_promot_select_list_con fl active pro_promot_all pro_promot_mr20">全部 </a>
<a class="pro_promot_select_list_con fl" data-index="A">A</a>
<a class="pro_promot_select_list_con fl" data-index="B">B</a>
<a class="pro_promot_select_list_con fl" data-index="C">C</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="D">D</a>
<a class="pro_promot_select_list_con fl" data-index="E">E</a>
<a class="pro_promot_select_list_con fl" data-index="F">F</a>
<a class="pro_promot_select_list_con fl" data-index="G">G</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="H">H</a>
<a class="pro_promot_select_list_con fl" data-index="I">I</a>
<a class="pro_promot_select_list_con fl" data-index="J">J</a>
<a class="pro_promot_select_list_con fl" data-index="K">K</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="L">L</a>
<a class="pro_promot_select_list_con fl" data-index="M">M</a>
<a class="pro_promot_select_list_con fl" data-index="N">N</a>
<a class="pro_promot_select_list_con fl" data-index="O">O</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="P">P</a>
<a class="pro_promot_select_list_con fl" data-index="Q">Q</a>
<a class="pro_promot_select_list_con fl" data-index="R">R</a>
<a class="pro_promot_select_list_con fl" data-index="S">S</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="T">T</a>
<a class="pro_promot_select_list_con fl" data-index="U">U</a>
<a class="pro_promot_select_list_con fl" data-index="V">V</a>
<a class="pro_promot_select_list_con fl" data-index="W">W</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="X">X</a>
<a class="pro_promot_select_list_con fl" data-index="Y">Y</a>
<a class="pro_promot_select_list_con fl" data-index="Z">Z</a>
</div>
</div>
<div class="clear"></div>
<div class="pro_promot_game">
<div class="jsgamecheckallbox z_clearfix" >
<label class="custom-label">
<input type="checkbox" class="form_control jsgamecheckall" >
<i class="label_icon"></i>
<span class="label_text">全选</span></label>
</div>
<ul id="game_list" class="z_clearfix game_list" style="clear: both;">
</ul>
</div>
<div class="clear"></div>
<div class="pro_promot_btn">
<div class="fl pro_promot_btn_confirm">确定</div>
<div class="fr pro_promot_btn_cancel">取消</div>
</div>
</div>
</div>
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</div>
<script type="text/html" id="doctpl">
@ -466,6 +528,8 @@
$('#submit').click(function(){
$('#form').submit();
});
var ids = "{$data.game_ids}";
ids = ids.split(",");
var PROMOTE = {
juicerFun(){
var tpl =$("#doctpl").html();
@ -753,7 +817,7 @@
})
}
if(!flag) return false;
senddata.push({"name":"game_ids", "value":ids.join(",")});
//添加
$.ajax({
url:"{:U('PromoteCompany/edit')}",
@ -778,4 +842,123 @@
</script>
<script type="text/javascript">
//点击字母按照条件按钮筛选
$(".pro_promot_select_list_con").click(function(){
//选中高亮样式
$(this).addClass('active');
$(this).siblings().removeClass('active');
var that = $(this);
var index = $(this).attr("data-index");
$("#game_list li").each(function(index,ele){
var short = $(this).attr('data-short');
$(this).show();
if(that.attr('data-index')){
if(that.attr('data-index')!=short.charAt(0)){
$(this).hide();
}
}
})
});
//打开弹窗
$(".ajax-view").click(function(){
//获取游戏列表
var url = "{:U('getCompanyGame')}";
var checked = 'checked';
$.post(url,{},function(res){
if(res.code==1){
$(".pro_promot_select_list a").eq(0).addClass('active');
$(".pro_promot_select_list a").eq(0).siblings().removeClass('active');
var game_list = res.data.game_list;
var lis = [];
var promote_info = [];
promote_info['game_ids'] = ids;
$.each(game_list,function(index,ele){
if(ele.game_name.length>6){
ele.game_name = ele.game_name .substring(0,6)+"..."
}
lis.push('<li class="fl pro_promot_game_con" data-short="'+ele.short+'">');
if(promote_info['game_ids'].length == 0){
$(".jsgamecheckall").attr('checked',false);
lis.push('<input type="checkbox" value="'+ele.id+'" name="game_ids[]" class="fl pro_promot_game_check jsgameid" id="gameCheck'+index+'" />');
checked = '';
}else{
if(promote_info['game_ids'].indexOf(ele.id)>-1){
lis.push('<input type="checkbox" value="'+ele.id+'" name="game_ids[]" class="fl pro_promot_game_check jsgameid" checked="checked" id="gameCheck'+index+'" />');
}else{
$(".jsgamecheckall").attr('checked',false);
lis.push('<input type="checkbox" value="'+ele.id+'" name="game_ids[]" class="fl pro_promot_game_check jsgameid" id="gameCheck'+index+'" />');
checked = '';
}
}
lis.push('<label for="gameCheck'+index+'" class="fl"></label>');
lis.push('<span class="fl pro_promot_game_name">'+ele.game_name+'</span>');
lis.push('</li>');
});
$(".jsgamecheckall").attr('checked',checked);
$("#game_list").html(lis.join(''));
$(".pro_promot_number").text(res.data.promote_info.company_name);
$("#se_promote_id").val(res.data.promote_info.id);
$(".pro_promot").css("display","block");
jsgameid();
}else{
var tip_msg = res.info ? res.info : '操作失败';
layer.msg(tip_msg);
}
});
});
//保存修改
$(".pro_promot_btn_confirm").click(function(){
ids = [];
var res = $("#promotForm").serializeArray();
for (var key in res) {
if (res.hasOwnProperty(key)) {
var e = res[key];
ids.push(e['value']);
}
}
// layer.msg("编辑成功,保存并审核通过后生效");
$(".pro_promot").hide();
});
//关闭弹窗
$(".pro_promot_close").click(function(){
$(".pro_promot").css("display","none");
});
//取消修改
$(".pro_promot_btn_cancel").click(function(){
$(".pro_promot").css("display","none");
});
$(".jsgamecheckall").click(function(){
$(this).closest('.jsgamecheckallbox').siblings("#game_list").find(".jsgameid").prop("checked", this.checked);
});
function jsgameid(){
$(".jsgameid").click(function(){
var option = $(this).closest('ul').find(".jsgameid"),
checkall = $(this).closest('ul').siblings('.jsgamecheckallbox').find('.jsgamecheckall');
option.each(function(i){
if(!this.checked){
checkall.prop("checked", false);
return false;
}else{
checkall.prop("checked", true);
}
});
});
}
</script>
</block>

Loading…
Cancel
Save