新增推广公司游戏选择

master
chenzhi 5 years ago
parent bc75da8c14
commit d52ab03714

@ -668,4 +668,53 @@ WHERE old_change_promote_id in ({$promoteData})";
return $this->success('设置完成');
}
//
public function getCompanyGame()
{
if (IS_AJAX) {
//获取所有游戏
$game_list = M('game', 'tab_')->field('relation_game_id id,relation_game_name game_name,short')->where(['game_status'=>1,'down_port'=>1])->group("relation_game_id")->select();
$data['data']['game_list'] = empty($game_list) ? '' : $game_list;
//获取推广员信息
$promote_info = M('promote_company', 'tab_')->field('id,company_name,game_ids')->where(['id'=>I('id', 0, 'intval')])->find();
if (!empty($promote_info['game_ids'])) {
$promote_info['game_ids'] = explode(',', $promote_info['game_ids']);
}
$data['data']['promote_info'] = empty($promote_info) ? '' : $promote_info;
$data['msg'] = '请求成功';
$data['code'] = 1;
$this->ajaxReturn($data);
exit;
}
}
//更新推广员可推广游戏
public function saveCompanyGame()
{
if (IS_AJAX) {
$id = I('promote_id', 0, 'intval');
if (empty($id)) {
$this->ajaxReturn(['code'=>0,'msg'=>'请选择推广公司']);
}
$promoter = M('promote_company', 'tab_')->where(['id'=>$id])->find();
if (empty($promoter)) {
$this->ajaxReturn(['code'=>0,'msg'=>'未找到推广公司']);
}
$game_ids = I('game_ids', '');
if (!empty($game_ids)) {
$game_ids = implode(',', $game_ids);
} else {
$game_ids = '';
}
// 获取下级id
$res = M('promote_company', 'tab_')->where(['id'=>$id])->save(['game_ids'=>$game_ids]);
if ($res) {
$this->ajaxReturn(['code'=>1,'msg'=>'更新成功']);
} else {
$this->ajaxReturn(['code'=>0,'msg'=>'数据未发生变化']);
}
}
}
}

@ -1,8 +1,10 @@
<extend name="Public/base"/>
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<link rel="stylesheet" href="__CSS__/pro_promote.css" type="text/css" />
<script src="__STATIC__/jquery.form.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<style>
@ -46,7 +48,7 @@
<p class="description_text">说明:该功能是用于录入工会所属的推广公司名称 / 如需删除公司请先将公司底下会长移走后方可操作</p>
</div>
<div class="cf top_nav_list clearfix" style="display: inline;">
<div class="fl button_list">
<div class="fl button_list" style="margin: 5px 0;">
<div class="tools">
<a class="" href="{:U('add')}"><span class="button_icon button_icon1"></span>新增</a>
<!-- <a class="ajax-post confirm " target-form="ids" url="{:U('del')}"><span class="button_icon button_icon2"></span>删除</a> -->
@ -56,7 +58,7 @@
<div class="cf top_nav_list">
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list">
<div class="jssearch fl cf search_list" style="margin-bottom:0px">
<div class="input-list">
<input style="width: 200px;" type="text" name="company_name" class="search-input" value="{:I('company_name')}" placeholder="请输入公司名称搜索">&nbsp;
</div>
@ -95,8 +97,8 @@
</div>
</div>
<div class="cf top_nav_list clearfix">
<div class="fl button_list">
<div class="cf top_nav_list clearfix" style="margin-top: -15px;clear: both;height: 52px;">
<div class="fl button_list" style="margin: 0;">
<div class="tools">
<a class="ajax-post" target-form="ids" url="{:U('PromoteCompany/marketingDirectorShow', ['isShow'=>1])}"><span class="button_icon "></span>展示市场总监信息</a>
<a class="ajax-post" target-form="ids" url="{:U('PromoteCompany/marketingDirectorShow', ['isShow'=>2])}"><span class="button_icon "></span>隐藏市场总监信息</a>
@ -116,6 +118,9 @@
</th>
<th style="width:10%;min-width:150px;">操作</th>
<th>合作方名称</th>
<th>推广游戏</th>
<th>对应平台</th>
<th>公司性质</th>
<th>内外团归属</th>
@ -150,6 +155,7 @@
</if>
</td>
<td rowspan="{$data.row}">{$data.company_name}</td>
<td><a class="ajax-view" data-id="{$data.id}">查看</a></td>
<td rowspan="{$data.row}">{$data.platform_name}</td>
<td rowspan="{$data.row}">{$data.company_type}</td>
<td rowspan="{$data.row}">{$data.company_belong}</td>
@ -262,7 +268,71 @@
<input type="hidden" name="url" value="Partner/lists">
</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> -->
</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="" />
<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>
</div>
</block>
@ -328,4 +398,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 id = $(this).attr('data-id');
var checked = 'checked';
$.post(url,{id:id},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 promote_info = res.data.promote_info;
var lis = [];
$.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']==''){
lis.push('<input type="checkbox" value="'+ele.id+'" name="game_ids[]" class="fl pro_promot_game_check jsgameid" checked="checked" id="gameCheck'+index+'" />');
}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(){
$("#ajaxForm").ajaxSubmit(function(res){
layer.msg(res.msg);
$(".pro_promot").hide();
});
return false;
});
//关闭弹窗
$(".pro_promot_close").click(function(){
$(".pro_promot").css("display","none");
});
//取消修改
$(".pro_promot_btn_cancel").click(function(){
$(".pro_promot").css("display","none");
layer.msg('修改已取消');
});
$(".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>

@ -2071,3 +2071,7 @@ INSERT INTO `tab_service_agreement` (`id`, `name`, `content`, `status`, `creator
ALTER TABLE `tab_company_info`
ADD COLUMN `ali_account` varchar(128) NULL COMMENT '支付宝账号' AFTER `last_up_time`,
ADD COLUMN `fax_ratio` varchar(20) NULL COMMENT '开票税率' AFTER `ali_account`;
--20200630 cz
ALTER TABLE `tab_promote_company`
ADD COLUMN `game_ids` varchar(300) NOT NULL DEFAULT '' COMMENT '可申请游戏 空值表示所有' AFTER `marketing_director_show`;
Loading…
Cancel
Save