<extend name="Public/base"/>
<block name="css">
    <link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
</block>
<block name="body">
    <script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
    <script type="text/javascript" src="__JS__/select2.min.js"></script>
    <style>
        .select2-container--default .select2-selection--single {
            color: #000;
            resize: none;
            border-width: 1px;
            border-style: solid;
            border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
            box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
            height:28px;border-radius:3px;font-size:12px;
        }
        .select2-container--default .select2-selection--single .select2-selection__rendered {
            line-height:35px;
            line-height:28px;
        }
        .select2-container--default .select2-selection--single .select2-selection__arrow {
            height:26px;
        }
        .select2-container--default .select2-search--dropdown .select2-search__field {
            height:26px;line-height:26px;font-size:12px;
        }
        .select2-results__option[aria-selected] {font-size:12px;}
    </style>


    <div class="cf main-place top_nav_list navtab_list">
        <div class="fr">
            <a <if condition="(I('type') eq 1) or (I('type') eq '') "> class="tabchose" </if>  href="{:U('app_lists',array('type'=>1))}">安卓APP</a>
            <a <if condition="I('type') eq 2"> class="tabchose" </if> href="{:U('app_lists',array('type'=>2))}">IOS APP</a>
        </div>
        <h3 class="page_title">游戏盒子APP分包</h3>
        <p class="description_text"></p>
    </div>


    <div class="cf top_nav_list">
        <empty name="model.extend">
            <div class="fl button_list">
                <div class="tools">
                    <a class=" ajax-post " target-form="ids" url="{:U("Apply/app_audit")}"><span class="button_icon button_icon9"></span>审 核</a>
                    <a class="  pack" id="org" target-form="ids" url="{:U("Apply/app_package")}" ><span class="button_icon button_icon23"></span>打 包</a>
                    <a class=" ajax-post confirm " target-form="ids" url="{:U('app_del?model='.$model['id'])}"><span class="button_icon button_icon2"></span>删 除</a>
                    <if condition="C(APP_AUTO_PACK) eq 0">
                        <a class="ajax-get" target-form="ids" url='{:U("set_config_auto_audit",array("val"=>1,"config_key"=>"APP_AUTO_PACK"))}'><span class="button_icon button_icon4"></span>开启自动审核</a>
                        <else/>
                        <a class="ajax-get" target-form="ids" url='{:U("set_config_auto_audit",array("val"=>0,"config_key"=>"APP_AUTO_PACK"))}'><span class="button_icon button_icon5"></span>关闭自动审核</a>
                    </if>
                </div>
            </div>
        </empty>
        <!-- 高级搜索 -->
        <div class="jssearch fl cf search_list">
            <div class="input-list search-title-box">
                <label>搜索:</label>
            </div>
            <div class="input-list input-list-promote search_label_rehab">
                <select id="promote_id" name="promote_id" class="select_gallery" >
                    <option value="">推广员账号</option>
                    <volist name=":get_promote_list(1)" id="vo">
                        <option promote-id="{$vo.id}" value="{$vo.id}">{$vo.account}</option>
                    </volist>
                </select>
            </div>
            <div class="input-list">
                <select name="status">
                    <option value="">审核状态</option>
                    <option value="0">未审核</option>
                    <option value="1">已审核</option>
                </select>
            </div>
            <div class="input-list">
                <select name="enable_status">
                    <option value="">打包状态</option>
                    <option value="0">未打包</option>
                    <option value="1">已打包</option>
                    <option value="2">准备打包</option>
                </select>
            </div>


            <input type="hidden" name="type" value="{$_GET['type']}">
            <div class="input-list">
                <a class="sch-btn" href="javascript:;" id="search" url="{:U('Apply/app_lists','model='.$model['name'] . '&row='.I('row'),false)}">搜索</a>
            </div>
        </div>
    </div>
    <!-- 数据列表 -->
    <div class="data_list">
        <div class="">
            <table>
                <!-- 表头 -->
                <thead>
                <tr>
                    <th>
                        <input class="check-all" type="checkbox">
                    </th>
                    <th>推广员账号</th>
                    <th>APP名称</th>
                    <th>申请时间</th>
                    <th>审核状态</th>
                    <th>打包状态</th>
                    <th>审核人员</th>
                    <th>审核时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <!-- 列表 -->
                <tbody>
                <empty name ="list_data">
                    <td colspan="10" class="text-center"> aOh! 暂时还没有内容! </td>
                    <else />
                    <volist name="list_data" id="data">
                        <tr>
                            <td><input class="ids" type="checkbox" value="{$data['id']}" name="ids[]" ></td>
                            <td>
                               <!-- <if condition="$is_admin eq true ">
                                    {:get_promote_account($data['promote_id'])}
                                    <else />
                                    {:encryptStr(get_promote_account($data['promote_id']))}
                                </if>-->
                                {:get_promote_account($data['promote_id'])}
                            </td>
                            <td>{$data.app_name}<if condition='$data.app_version == 1'>(安卓)<else/>(IOS)</if></td>
                            <!--  -->
                            <td>{:set_show_time($data['apply_time'])}</td>
                            <td><if condition="$data.status eq 0" ><span class="check_status_color">{:get_info_status($data['status'],5)}</span><else/>{:get_info_status($data['status'],5)}</if></td>
                            <td><if condition="$data.enable_status eq 0" ><span class="pack_status_color">未打包</span><elseif condition="$data.enable_status eq 1"/>已打包<elseif condition="$data.enable_status eq 2"/>准备打包</if></td>
                            <td>{:get_admin_nickname($data['dispose_id'])}</td>
                            <td>{:set_show_time($data['dispose_time'],'','other')}</td>
                            <td>
                                <a href="{:U('Apply/app_package?ids='.$data['id'])}" class="ajax-get  packer">打包</a>
                                <a href="" class="ajax-get  popbtn" data-url="{$data.dow_url}">查看url</a>
                            </td>
                        </tr>
                    </volist>
                </empty>
                </tbody>
            </table>
        </div>
    </div>
    <div class="page">
        <if condition="$role_export_check eq true">
            <a class="sch-btn" href="{:U('Export/app_subpackage_list',array_merge(['xlsname'=>'推广员管理_游戏盒子APP分包'.((I('type',1)==2)?'_IOSAPP':'_安卓APP')],I('get.')))}">导出</a>
        </if>
        {$_page|default=''}
    </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="{$m_title}">
            <input type="hidden" name="url" value="Apply/app_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>

</block>

<block name="script">
    <link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
    <php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
    <link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
    <script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
    <script type="text/javascript">
        //导航高亮
        highlight_subnav("{:U('Apply/app_lists')}");
        $(function(){
        <volist name=":I('get.')" id="vo">
                Think.setValue('{$key}',"{$vo}");
        </volist>
            $(".select_gallery").select2();
            //搜索功能
            $("#search").click(function(){
                var url = $(this).attr('url');
                var query  = $('.jssearch').find('input').serialize();
                query  += "&"+$('.jssearch').find('select').serialize();
                query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
                query = query.replace(/^&/g,'');
                if( url.indexOf('?')>0 ){
                    url += '&' + query;
                }else{
                    url += '?' + query;
                }
                window.location.href = url;
            });

            $('.popbtn').on('click',function() {
                var url= $(this).data('url');
                if(url.indexOf("./") == 0){
                    var urll="http://"+"{$_SERVER['HTTP_HOST']}"+url;
                }else{
                    var urll = url;
                }
                if(url){
                    layer.alert(urll,{icon: 1});
                }else{
                    layer.alert('暂未打包',{icon: 2});
                }
            });

            //回车自动提交
            $('.jssearch').find('input').keyup(function(event){
                if(event.keyCode===13){
                    $("#search").click();
                }
            });

            $('#time-start').datetimepicker({
                format: 'yyyy-mm-dd',
                language:"zh-CN",
                minView:2,
                autoclose:true
            });

            $('#datetimepicker').datetimepicker({
                format: 'yyyy-mm-dd',
                language:"zh-CN",
                minView:2,
                autoclose:true,
                pickerPosition:'bottom-left'
            });


            $('.pack').click(function() {
                var that = $(this);
                if(check_post_submit(that)) {
                    layer.load(1);
                    setTimeout(function(){
                        post_submit(that,layer);
                    },1000);
                } else {
                    updateAlert('请选择需要操作的数据','tip_error');
                    setTimeout(function(){
                        $('#tip').find('.tipclose').click();
                    },1500);
                }
                return false;
            });

            $(".packer").click(function () {
                layer.load(1);
            })

        })
    </script>
</block>