<extend name="Public/base" />

<block name="body">
    <link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
    <script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
    <script type="text/javascript" src="__JS__/select2.min.js"></script>
    <script type="text/javascript" src="__STATIC__/layer3/layer.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;
        }

        .tooltip {
            position: relative;
            /* display: block; */
            /* color: #056dae; */
        }

        .tooltip .tooltiptext {
            display: none;
            width: 100%;
            background-color: #fff;
            text-align: center;
            border-radius: 6px;
            padding: 5px 10px 5px 5px;
            position: absolute;
            z-index: 1;
            bottom: 80%;
            left: 0;
            border: #000 solid 1px;
            line-height: 20px;
        }

        .tooltip .tooltiptext::after {
            content: "";
            position: absolute;
            top: 100%;
            left: 50%;
            margin-left: -5px;
            border-width: 5px;
            border-style: solid;
            border-color: black transparent transparent transparent;
        }

        .tooltip:hover .tooltiptext {
            color: #333;
            display: block;

        }
    </style>
    <!-- 标题栏 -->
    <div class="cf main-place top_nav_list navtab_list">

        <h3 class="page_title">订单校验</h3>
        <p class="description_text">说明:对游戏订单及平台币订单等进行比较校验</p>
    </div>
    <div class="cf top_nav_list">
        <!-- 高级搜索 -->
        <div class="jssearch search_list fl cf">
            <div class="input-list  search-title-box">
                <a class="sch-btn" href="javascript:history.go(-1)" style="background:#fff;color: #000;border: #000 solid 1px;width: 100px">返回</a>
            </div>
            <div class="input-list search-title-box">
                <label>搜索:</label>
            </div>
            <div class="input-list">
                <input type="text"  name="pay_order_number" placeholder="订单号检索" class="" value="{:I('pay_order_number')}" style="width: 220px"/>
            </div>
            <div class="input-list input-list-game search_label_rehab">
                <select id="is_read" name="is_read" class="select_gallery">
                    <option value="">请选择处理状态</option>
                    <foreach name="read_type" item="vo" >
                        <option value="{$key}" <?php echo I('is_read')."i" == $key."i" ? "selected" : ''; ?>>{$vo}</option>
                    </foreach>
                </select>
            </div>
            <div class="input-list input-list-game search_label_rehab">
                <select id="type" name="type" class="select_gallery">
                    <option value="">请选择异常原因</option>
                    <foreach name="check_type" item="vo" >
                        <option value="{$key}" <?php echo I('type') == $key ? "selected" : ''?>>{$vo}</option>
                    </foreach>
                </select>
            </div>
            <input type="hidden" name="row" value="{$_GET['row']}"/>
            <input type="hidden" name="compare_id" value="{$_GET['compare_id']}"/>
            <div class="input-list">
                <a class="sch-btn" href="javascript:;" id="search"
                    url="{:U('list',false)}">
                    搜索</a>
            </div>
        </div>
    </div>


    <!-- 数据列表 -->
    <div class="data_list">
        <div class="">
            <table>
                <!-- 表头 -->
                <thead>
                    <tr>
                        <th>订单号</th>
                        <th>支付渠道</th>
                        <th>状态</th>
                        <th>平台支付金额</th>
                        <th>商家订单金额</th>
                        <th>相差金额</th>
                        <th>原因分类</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <!-- 列表 -->
                <tbody>
                    <empty name="list_data">
                        <td colspan="15" class="text-center">aOh! 暂时还没有内容!</td>
                        <else />
                        <volist name="list_data" id="data">
                            <tr>
                                <td>{$data.pay_order_number}</td>
                                <td>{$data['pay_way']}</td>
                                <td>{$data['read_str']}</td>
                                <td>{$data.pt_pay_amount}</td>
                                <td>{$data.sj_pay_amount}</td>
                                <td>{$data.diff_money}</td>
                                <td>{$data.type}</td>
                                <td>
                                    <if condition="$data.is_read eq 1">
                                        <a style="color: #ff0000;" class="changeRead" href="javascript:;" url="{:U('changeRead',['id'=>$data['id'],'is_read'=>$data['is_read']])}">标记为未处理</a> 
                                    <else />
                                        <a href="javascript:;" class="changeRead" url="{:U('changeRead',['id'=>$data['id'],'is_read'=>$data['is_read']])}">标记为处理</a> 
                                    </if>
                                    
                                </td>
                            </tr>
                        </volist>
                    </empty>
                    <tr style="padding: 10px 0;height: 80px;">
                        <td colspan="3"><span>汇总(检索内所有数据统计)</span></td>
                        <td style="line-height:2;">
                            待处理:{$count_data['noread_pt_pay_amount']}   <br> 全部:{$count_data['pt_pay_amount']}   
                        </td>
                        <td style="line-height:2;">
                            待处理:{$count_data['noread_sj_pay_amount']}  <br>全部:{$count_data['sj_pay_amount']}
                        </td>
                        <td style="line-height:2;">
                            待处理:{$count_data['noread_diff_money']}  <br>全部:{$count_data['diff_money']}  
                        </td>
                        <td colspan="2">
                            校验数量:{$count_data['count']}
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    <div class="page">
        <a class="sch-btn" href="{:U(CONTROLLER_NAME.'/'.ACTION_NAME,array_merge(['export'=>1],I('get.')))}" target="_blank">导出</a>
        {$_page|default=''}
    </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 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">
    </script>
    <script type="text/javascript">

        //导航高亮
        highlight_subnav("{:U('FinanceCompare/index')}");
    </script>
    <script type="text/javascript">
   
        $(function () {
            $("#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.replace(url)
                // window.location.href = url;
            });
            $(".select_gallery").select2();
            $('.page a').click(function () {
                var href = $(this).attr('href');
                $(this).removeAttr('href');
                window.location.replace(href)
            });
            $(".changeRead").on("click",function(){
                var url = $(this).attr("url");
                var compare_id = $("input[name='compare_id']").val();
                $.ajax({
                    type: 'post',
                    url: url,
                    data:{compare_id:compare_id},
                    success: function(data) {
                        if(data.success){
                            layer.msg("处理成功",function(){
                                window.location.reload();
                            });
                        }else{
                            layer.alert(data.error);
                        }
                    },
                });
            })
            
        })
    </script>

</block>