<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/data.css" rel="stylesheet">
<link href="__CSS__/20180207/game.css" rel="stylesheet" >
<style>
    .tb110 .zclip embed{margin-bottom: 45px;}
    .trunk-list{position: relative;min-height: 66vh;}
	.pagenation{position: relative;text-align: center;line-height: 5vh;bottom: 1%;}
	.input-box {display:inline-block;width:100px;}
	.input-box input {width:60px;border:1px solid #3A97FF;border-radius:3px;text-align:center;height: 24px;}
  .input-box~.input-box{margin-top:2px;}
	.apply-my_game-list .trunk-list .table th {width:10%;}
	.apply-my_game-list .trunk-list .table .pid th {width:10%;}
</style>

</block>

<block name="body">
    <div class="page-list normal_list apply-my_game-list">
      <div class="trunk-title">
      	<div class="location">
			<div class="location-container">当前位置:<span>游戏管理></span><span>子渠道游戏</span></div>
		</div>
      	<img src="__IMG__/20180207/icon_normal_game.png"><span class="title_main">游戏列表</span>
      </div>
      <div class="trunk-content article">
          <div class="trunk-search clearfix">
            <div class="tab fl">
              <a href="{:U('Apply/index')}" class="">申请游戏</a>
              <a href="{:U('my_game')}" class="">我的游戏</a>
							<lt name="Think.const.PRO_GRADE" value="3">
              <a href="#" class="current">子渠道游戏</a>
							</lt>
            </div>
            <form action="{:U('child_game',array('row'=>I('get.row')))}" method="post" enctype="multipart/form-data">
              <div class="form-group normal_space fr">
                <input type="submit" class="submit"  id="search" value="查询">
              </div>
              <div class="form-group normal_space fr">
                <label class="form-title select-title"></label>
                <div class="select-time">
                  <input type="text" id="sdate" class="txt" name="time_start" value="{:I('time_start')}" placeholder="开始时间">
                </div>
                <label class="form-title select-title">&nbsp;—&nbsp;</label>
                <div class="select-time">
                  <input type="text" id="edate" class="txt" name="time_end" value="{:I('time_end')}" placeholder="结束时间">
                </div>
              </div>

              <div class="form-group normal_space fr">
                  <select id="game_id" name="game_id" class="reselect select_gallery" style="min-width:200px;width: 175px;">
                      <option value="">请选择游戏</option>
                      <volist name=":get_promote_serach_game()" id="vo">
                          <option value="{$vo.id}" title="{$vo.relation_game_name}">{$vo.relation_game_name}</option>
                      </volist>
                  </select>
              </div>
              <div class="form-group fr">
                  <select name="promote_id" class="reselect select_gallery" style="min-width:170px;" >
                      <option value="" >子渠道帐号</option>
                      <volist name=":get_promote_chlid_account(PID)" id="vo">
                      <option value="{$vo.id}" >{$vo.account}</option>
                      </volist>
                  </select>
              </div>
            </form>
          </div>
          <div class="trunk-list">
		  
		   <div class="div_bgtab">  
              <table class="table normal_table zwm_tab">
                  <tr class="odd <if condition='get_parent_id(PID) eq 0'>pid</if>">
                  <th class="">子渠道账号</th>
                  <th class="">ICON</th>
                  <th class="">游戏名称</th>
                  <th>平台</th>
                  <th>类型</th>
                  <th>包的大小</th>
                  <th>审核时间</th>
									<eq name="Think.const.PRO_GRADE" value="1">
                  <th>注册单价(元)</th>
                  <th>分成比例(%)</th>
									</eq>
                  <th>投放平台</th>
                  </tr>
                  <empty name="list_data">
                 
                  <tr><td colspan="9" style="text-align: center;height: 45vh;"><img src="__IMG__/20180207/icon_wushujv2.png"/><p style="line-height: 40px;color: #A5A5A5;">暂无数据</p></td></tr>
                  
                  <else />
                  <volist name="list_data" id="vo">
                  <tr>
									<td>{$vo.promote_account}</td>
                  <td><a href="javascript:;" class="bg_st">
                      <span class="img_table">
                        <div class="img_cell">
                          <div class="cell_con">手游</div>
                        </div>
												<span class="placeholder-graphic placeholder-graphic_icon">
                        <img src="__ROOT__{$vo.icon|get_cover='path'}" style="position: absolute;left: 0;width: 34px;height: 34px;<if condition="$vo.icon eq '0'">display: none;</if>">
												</span>
                      </span>
                      
                    </a></td>
                  <td class="<if condition='get_parent_id(PID) eq 0'>td2<else />td12</if>">
                    
                    <span class="name_a" title="{$vo.game_name}">{$vo['relation_game_name']}</span>
                  </td>
                   <td>
            <if condition="$vo.sdk_version eq 1 and $vo.applyid gt 0 and $vo.applystatus eq 1"> <p class="p_icon"><img src="/Public/Home/images/20180207/andriod.png" height="20" width="20"></p> </if>
            <if condition="$vo.sdk_version eq 2 and $vo.applyid gt 0 and $vo.applystatus eq 1"> <p class="p_icon"><img src="/Public/Home/images/20180207/IOS.png" height="20" width="20"></p> </if>
            <if condition="$vo.tsdk_version eq 1 and $vo.tapplyid gt 0 and $vo.tapplystatus eq 1">  <p class="p_icon"><img src="/Public/Home/images/20180207/andriod.png" height="20" width="20"></p> </if>
            <if condition="$vo.tsdk_version eq 2 and $vo.tapplyid gt 0 and $vo.tapplystatus eq 1">  <p class="p_icon"><img src="/Public/Home/images/20180207/IOS.png" height="20" width="20"></p> </if>
            </td>
                  <td title="{$vo['game_type_name']}">{:msubstr2($vo['game_type_name'],0,6)}</td>
                  <td>
									
									<if condition="$vo.applyid gt 0 and $vo.applystatus eq 1">
									<p>{$vo.game_size|default=0}</p></if>
									
									<if condition="$vo.tapplyid gt 0 and $vo.tapplystatus eq 1">
                 <if condition="$vo.tid neq ''">
                 <p>{:get_game_source_info($vo['tid'])['file_size']}</p></if></if>
                 </td>
                  <td>{$vo.dispose_time|date='Y-m-d',###}</td>

<eq name="Think.const.PRO_GRADE" value="1">									
                    <if condition="get_parent_id(PID) eq 0">
                  <td>
										<if condition="$vo.applyid gt 0 and $vo.applystatus eq 1">
										<label class="input-box jsinputbox">
										<input type="text" placeholder="填写" style=" " maxlength="6" data-default="0" data-type="1" data-id="{$vo.applyid}" value="<notempty  name='vo.applymoney'>{$vo.applymoney|default=0}<else />{$vo['money']|default=0}</notempty>" />
										</label>
										</if>
										<if condition="$vo.tapplyid gt 0 and $vo.tapplystatus eq 1">
                    <if condition="$vo.tid neq ''">
                      <label class="input-box jsinputbox">
                      <input type="text" placeholder="填写" style="" maxlength="6" data-default="0" data-type="1" data-id="{:get_apply_id($vo['promote_id'],$vo['tid'])}" 
                      value="<if condition="get_apply_id($vo['promote_id'],$vo['tid'],1) neq ''" >{:get_apply_id($vo['promote_id'],$vo['tid'],1)}<else/>{$vo['tmoney']|default=0}</if>" >
                      </label>
                    </if>
										</if>
										
                  </td>
                  <td>
									<if condition="$vo.applyid gt 0 and $vo.applystatus eq 1">
										<label class="input-box jsinputbox">
										<input type="text" placeholder="填写" style="" maxlength="6" data-default="0.00" data-type="2" data-id="{$vo.applyid}" value="<notempty  name='vo.applyratio'>{$vo.applyratio|default=0}<else />{$vo.ratio|default=0}</notempty>" />
										</label>
									</if>
									<if condition="$vo.tapplyid gt 0 and $vo.tapplystatus eq 1">
                    <if condition="$vo.tid neq ''">
                      <label class="input-box jsinputbox">
                      <input type="text" style="" placeholder="填写" maxlength="6" data-default="0.00" data-type="2" data-id="{:get_apply_id($vo['promote_id'],$vo['tid'])}" 
                      value="<if condition="get_apply_id($vo['promote_id'],$vo['tid'],2) neq ''" >{:get_apply_id($vo['promote_id'],$vo['tid'],2)}<else/>{$vo['tratio']|default=0}</if>" >
                    </label>
                    </if>
                  </if>
                  </td>
                    </if>
										
</eq>										
										<td>
									<if condition="$vo.applyid gt 0 and $vo.applystatus eq 1">
										<p>
										<gt name='vo.launch_count' value='0'>
										<a href="javascript:;" class="jslooklaunch launch_count" data-game="{$vo.game_name}" data-promote="{$vo.promote_account}" data-url="<gt name='vo.applyid' value='0'>{:U('launch',array('applyid'=>$vo['applyid'],'sdk_version'=>$vo['sdk_version'],'rgid'=>$vo['relation_game_id']))}</gt>">{$vo.launch_count|default=0}</a>
										<else />0
										</gt>
										</p>
									</if>
									<if condition="$vo.tapplyid gt 0 and $vo.tapplystatus eq 1">
										<p>
										<gt name='vo.tlaunch_count' value='0'>
										<a href="javascript:;" class="jslooklaunch launch_count" data-game="{$vo.tgame_name}" data-promote="{$vo.promote_account}" data-url="<gt name='vo.tapplyid' value='0'>{:U('launch',array('applyid'=>$vo['tapplyid'],'sdk_version'=>$vo['tsdk_version'],'rgid'=>$vo['relation_game_id']))}</gt>">{$vo.tlaunch_count|default=0}</a>
										<else />0
										</gt>
										</p>
									</if>
									</td>
                  
                  </tr>
                  </volist>
                  </empty>
              </table> 
			  </div>
              
              <div class="pagenation clearfix">
								<a class="sch-btn" href="{:U('Export/expUser',array(
            'id'=>10,
            'user_account'=>I('user_account'),
            'game_id'=>I('game_id'),
            'time-start'=>I('time_start'),
            'time-end'=>I('time_end'),
            'game_name'=>I('game_name'),
            'sdk_version'=>I('POST.sdk_version'),
            'promote_id'=>I('POST.promote_id'),
            'type'=>I('POST.type'),'xlsname'=>'游戏管理_游戏列表_子渠道游戏'
            ))}" >导出</a>
								{$_page}
							</div>
          </div>
      </div>
    </div>
</block>
<block name='script'>
<link rel="stylesheet" type="text/css" href="__CSS__/p_jquery.datetimepicker.css">
<script type="text/javascript" src="__JS__/jquery.datetimepicker.js"></script>
<script src="__STATIC__/zeroclipboard/jquery.zclip.min.js"></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script type="text/javascript">
highlight_subnav("{:U('Apply/index')}");
setValue('promote_id',{$Think.request.promote_id|default='""'});
setValue('game_id',{$Think.request.game_id|default='""'});
setValue('row','{:I("get.row",10)}');
$(function(){
  
  //搜索功能
 $("#search").click(function(){
    var starttime = $.trim($('#sdate').val());
    var endtime = $.trim($('#edate').val());
    if (starttime > endtime) {
      layer.msg('开始时间必须小于等于结束时间');
      return false;
    }
        
  });
	
	
	$('.jslooklaunch').on('click',function() {
		var that = $(this);
		var gamename = $.trim(that.attr('data-game'));
		var promote = $.trim(that.attr('data-promote'));
		var url = $.trim(that.attr('data-url'));
		
		if(url) {
			
			layer.open({
				type: 2,
				title: "子渠道【"+promote+"】的游戏【"+gamename+"】投放平台列表",
				shadeClose: true,
				shade: 0.8,
				area: ['1062px', '80%'],
				content: url,//iframe的url
			});
			
		}

		return false;
	});


  $(".select_gallery").select2();
  $('.download').click(function(){
    var href= $(this).attr('href');
    var text= $(this).text();
    if(text =='下载'){
      if( href =='#'|| href =='javascript:;' ){
          layer.msg("暂无下载内容",{icon:2});
          return false;
      }
    }
  });
	

	$('.jsinputbox input').on('blur',function() {
		var that = $(this),val = $.trim(that.val());
		
		var e = event || window.event;

		if (val) {


			if (/^(0|[1-9]\d*)(\.\d{1,2})?$/.test(val)) {


        if(that.attr('data-type')==2 && val>100){
          layer.msg('分成比例不能大于100');
          return;
        }
					changevalue(that,val);
				
			} else {
				layer.msg('请输入正确的数字');
			}
		} else {
			that.val(that.attr('data-default'));
		}
		return false;
	});
	
	function changevalue(that,val) {
		if (that.hasClass('disabled')) {return false;}
		$.ajax({
			type:'post',
			data:{type:that.attr('data-type'),value:val,id:that.attr('data-id')},
			dataType:'json',
			url:'{:U("changevalue")}',
			beforeSend:function() {that.addClass('disabled');},
			success:function(data) {
				that.removeClass('disabled');
				if (parseInt(data.status) == 1) {
					layer.msg(data.info);
				} else {
					layer.msg(data.info);		
				}
			},
			error:function(){
				that.removeClass('disabled');
				layer.msg('服务器故障,请稍候再试...');				
			},
		});
	
	}
	
	
	$('#sdate').datetimepicker({
    lang:'ch',
    format:'Y-m-d',
    formatDate:'Y-m-d',
    scrollMonth:false,
    scrollTime:false,
    scrollInput:false,
    timepicker:false
  });
	
	$('#edate').datetimepicker({
    lang:'ch',
    format:'Y-m-d',
    formatDate:'Y-m-d',
    scrollMonth:false,
    scrollTime:false,
    scrollInput:false,
    timepicker:false
  });

    $('a.copy').zclip({
          path: '__STATIC__/zeroclipboard/ZeroClipboard.swf',
          
          copy: function(){
              return $(this).attr('data-url');
          },
          beforeCopy:function(){
            $(this).addClass("proc");
          },
          afterCopy:function(){
            $(this).removeClass("copy");
            if( $(this).attr('data-url')=="" || $(this).attr('data-url')== null ){
              layer.msg("暂无下载内容",{icon:2});
             }else{
              layer.msg("复制成功",{icon:1,time:1000});
            }
          }
    });
})

</script>
</block>