<link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/css/bootstrap-datepicker.standalone.min.css">
<link rel="stylesheet" href="<?php echo base_url();?>public/plugins/datatables/jquery.dataTables.min.css">
<link rel="stylesheet" href="<?php echo base_url();?>public/plugins/datatables/extensions/Responsive/css/dataTables.responsive.css">
<script src="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
<script src="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
<div class="content_wrapper">

    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <form class="form-inline" role="form" method="POST" action="#" id="orderForm">
                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>用户ID:</label>
                                            <input type="text" class="form-control" placeholder="用户UID" name="userid" value="<?php echo $uid ?? '';?>">
                                        </div>

                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>订单ID:</label>
                                            <input type="text" class="form-control" placeholder="订单ID" name="orderid" value="<?php echo $orderid ?? '';?>">
                                        </div>

                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>Google流水号:</label>
                                            <input type="text" class="form-control" placeholder="Google流水号" name="sl_platform_serial_num" value="<?php echo $sl_platform_serial_num ?? '';?>">
                                        </div>

                                        <span class="gap"></span>
                                        <div class="form-group">
                                                <label>开始时间: </label>
                                                <input type="text" class="form-control datetimepicker" value="<?php echo $stime ?? '';?>" placeholder="开始时间" name="payment_stime" />
                                        </div>
                                        <span class="gap"></span>
                                        <div class="form-group">
                                                <label>结束时间: </label>
                                                <input type="text" class="form-control datetimepicker" value="<?php echo $etime ?? '';?>" placeholder="结束时间" name="payment_etime" />
                                        </div>

                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>渠道:</label>
                                            <select  name="channel" id="channel" class="selectpicker show-tick form-control">
                                                <option value="0">--请选择--</option>
                                                <?php foreach($channelList as $k=>$v) {?>
                                                    <option value="<?php echo $k;?>"><?php echo $v;?></option>
                                                <?php }?>
                                            </select>
                                        </div>

                                        <span class="gap"></span>
                                        <div class="form-group">
                                            <label>订单状态:</label>
                                            <select name="payment_type" class="form-control">
                                                <?php foreach ($statusMap as $status => $text) {?>
                                                    <option value="<?=$status?>" <?php if($status == $payment_type){ ?> selected<?php }?> ><?=$text?></option>
                                                <?php }?>
                                            </select>
                                        </div>

                                        <span class="gap"></span>
                                        <button type="button" class="btn btn-primary" id="searchBtn">查询</button>
                                        <a href="javascript:void(0)" onclick="exportRefundOrder()" class="btn btn-default" >退款订单导出</a>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>订单查询</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <div class="table-responsive">
                                        <table id="orderTable" class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
                                            <thead>
                                            <tr>
                                                <th>序号</th>
                                                <th>ID</th>
                                                <th>订单ID</th>
                                                <th>用户ID</th>
                                                <th>游戏内商品ID</th>
                                                <th>平台商品ID</th>
                                                <th>商品名称</th>
                                                <th>商品内容</th>
                                                <th>商品价格(美元)</th>
<!--                                                <th>本国货币价格</th>-->
                                                <th>下单时间</th>
                                                <th>发货时间</th>
                                                <th>支付渠道</th>
                                                <th>设备平台</th>
                                                <th>支付状态</th>
                                                <th>包名</th>
                                                <th>等级</th>
                                                <th>Google流水号</th>
                                                <th>商品内容</th>
                                                <th>操作</th>
                                            </tr>
                                            </thead>
                                            <tbody>
<!--                                            --><?php //
//                                                if(is_array($list)){
//                                                    foreach ($list as $key => $val) {
//                                            ?>
<!--                                            <tr>-->
<!--                                                <td>--><?php //echo $page + $key + 1;?><!--</td>-->
<!--                                                <td>--><?php //echo $val['id'];?><!--</td>-->
<!--                                                <td>--><?php //echo $val['sl_orderid'];?><!--</td>-->
<!--                                                <td>--><?php //echo '<a target = "_blank" href="#user/index/'.$val['sl_uid'].'">'.$val['sl_uid'].'</a>';?><!--</td>-->
<!--                                                <td>--><?php //echo $val['sl_gid'];?><!--</td>-->
<!--                                                <td>--><?php //echo $val['gpid'];?><!--</td>-->
<!--                                                <td>--><?php //echo $val['gdesc'];?><!--</td>-->
<!--                                                <td>$--><?php //echo $val['sl_pusd'];?><!--</td>-->
<!--                                                <td>--><?php //echo $val['gpriceThb'];?><!--</td>-->
<!--                                                <td>--><?php //echo date('Y-m-d H:i:s', $val['sl_order_time']);?><!--</td>-->
<!--                                                <td>--><?php //if( $val['sl_pay_time']){echo date('Y-m-d H:i:s', $val['sl_pay_time']);}?><!--</td>-->
<!--                                                <td>--><?php //echo $val['gchannel'];?><!--</td>-->
<!--                                                <td>--><?php //echo $val['gplatform'];?><!--</td>-->
<!--                                                <td>--><?php //echo $val['sl_status'];?><!--</td>-->
<!--                                            </tr>-->
<!--                                            --><?php //} } else{?>
<!--                                            <tr>-->
<!--                                                <td colspan="10">暂无数据</td>-->
<!--                                            </tr>-->
<!--                                            --><?php //} ?>
                                            </tbody>
                                        </table>
                                    </div>
<!--                                    <nav>-->
<!--                                        <ul class="pagination">-->
<!--                                            <li class="disabled"><a href="#">共<span class="pagetotal">--><?php //echo $total;?><!--</span>条</a></li>-->
<!--                                            --><?php //echo $pageurl;?>
<!--                                        </ul>-->
<!--                                    </nav>-->
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
    </div>

</div>


<div class="modal fade" id="reissueOrder" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title" id="myModalLabel">订单补发</h4>
            </div>
            <div id="msg-tip"></div>
            <form class="form-horizontal J_ajaxForm" role="form" method="post" action="#">
                <div class="modal-body">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">订单ID:</label>
                        <div class="col-sm-9">
                           <input type="text" class="form-control" disabled value="" id="orderId" name="orderId"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">用户ID:</label>
                        <div class="col-sm-9">
                           <input type="text" class="form-control" disabled value="" id="uid" name="uid"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">商品名称:</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" disabled value="" id="gdesc" name="gdesc"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">备注:</label>
                        <div class="col-sm-9 ">
                            <textarea class="form-control" rows="5" placeholder="备注" name="msg" id="msg"></textarea>
                        </div>
                    </div>
                </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal" id="modalCancel">关闭</button>
                    <button type="button" class="btn btn-primary" id="modalSubmitBtn">提交</button>
                </div>
            </form>
        </div>
    </div>
</div>


<div class="modal fade" id="detailOrder" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title" id="myModalLabel">订单查询</h4>
            </div>
            <div id="detail-msg-tip"></div>
            <form class="form-horizontal J_ajaxForm" role="form" method="post" action="#">
                <div class="modal-body">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">订单ID:</label>
                        <div class="col-sm-9">
                           <input type="text" class="form-control" disabled value="" id="detailOrderId" name="detailOrderId"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-3 control-label">订单流水号:</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" disabled value="" id="platSerialNum" name="platSerialNum"/>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>


<script>
    //选择日期
    $('.datetimepicker').datepicker({
        language:'zh-CN',
        format:'yyyy-mm-dd',
        zIndexOffset:906  //控制z-index
    });

    function exportRefundOrder() {
        var url = "<?php echo site_url().'/payment/exportRefundOrder'?>";
        url = url + "?orderid="+$('input[name="orderid"]').val()+"&userid="+$('input[name="userid"]').val()+"&sl_platform_serial_num="+$('input[name="sl_platform_serial_num"]').val()+"&payment_stime="+$('input[name="payment_stime"]').val()+'&payment_etime='+$('input[name="payment_etime"]').val()+"&channel="+$('#channel').val();
        window.open(url, "_blank");
    }

</script>
<script src="<?php echo base_url();?>public/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="<?php echo base_url();?>public/plugins/datatables/extensions/Responsive/js/dataTables.responsive.min.js"></script>
<script src="<?php echo base_url();?>public/js/common.js"></script>
<script src="<?php echo base_url();?>public/js/payment/index.js?version=<?php echo time(); ?>"></script>
