<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1.0, user-scalable=no" name="viewport">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta name="referrer" content="always">
    <title>Payment List - China Highlights</title>
    <script src="http://www.mycht.cn/min?f=/js/jquery.min.js,/js/bootstrap.min.js,/js/navigation.js,/js/jquery.form.min.js"></script>
    <link href="/css/webht/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="/css/webht/flatpicker.min.css">
    <style type="text/css">
        .export_form_area{display: inline-block;padding: 6px;border: 1px solid #ccc;background-color: #ccc;/*position: absolute;top: 0;left: 17%;*/}
        .trigger_export_btn{position: absolute;top: 0;left: 50%;}
        .modal-dialog{ max-width: 1024px;}
        .navbar-header h1 {display: inline-block;margin-left: 30px;margin-right: 30px;}
        .input-group-btn{border: 1px solid #ccc;padding: 5px;}
        .search-btn{cursor: pointer; background: url(//data.chinahighlights.com/css/images/global/site-search-button.png) no-repeat center center;}
        .input-check{width: 20px;height: 20px;}
        label span{vertical-align: super;}
        .brand_text {color: #fff; padding: 2px 3px; border-radius: 4px;font-style: italic;}
        /* .wechat-color {background-color: #00C800;} */
        .wechat-color {background-color: #62B900;}
        .paypal-color {background-color: #002D89;}
        .alipay-color {background-color: #00AAEE;}
        .ipaylinks-color,.creditcard-color,.creditcard-ipaylinks-color {background-color: #A31022;}
        .modal {background-color: rgba(0,0,0,0.075);}
        .cht-color {background-color: #A31022;}
        .trippest-color {background-color: #E83201;}

        .app-color {background-color: #EC3A4F;}
        .hly-color {background-color: #009fe9;}
    </style>
    <style type="text/css" media="screen and (max-width:767px)">
        .navbar-header h1 {display: block; font-size: 20px;}
        .navbar-header a { margin-left: 10px; }
    </style>
</head>
<body>
    <!-- Button trigger modal -->
    <!-- 先隐藏 -->
    <button type="button" class="btn btn-primary trigger_export_btn hidden" data-toggle="modal" data-target="#exampleModal">
      导出收款记录 &gt;
    </button>
    <!-- Modal -->
    <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLabel">导出 Paypal 记录</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" role="form" method="post" id="search_list" action="/webht.php/apps/paypal/index/export_list/">
                        <div class="form-group row">
                            <label for="from_date" class="col-md-4">使用上次</label>
                            <div class="col-md-16">
                                <select class="form-control" id="date_history" name="date_history" onchange="set_start_date(this)">
                                    <option value="">选择一个开始记录</option>
                                    <?php
                                    if ( ! empty($record_flags)) {
                                        foreach ($record_flags as $kf => $vf) {
    echo "<option value=\"$vf->TEL_SN@" . strstr($vf->TEL_transactionDate, " ", true) . "@" . $vf->TEL_transactionCurrency . "\">"
        . " [" . strstr($vf->TEL_exportDate, " ", true) . "] "
        . $vf->TEL_transactionCurrency . " " .  $vf->TEL_transactionAmount . ' - '.  $vf->TEL_exportAmount
        . " / " . $vf->TEL_orderId . ' / '
        . substr($vf->TEL_transactionDate,0,16)
        . "</option>";
                                        }
                                    }
                                    ?>
                                </select>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label for="from_date" class="col-md-4">Date From</label>
                            <div class="col-md-16">
                                <input type="text" class="form-control col-md-8" id="from_date" name="from_date" placeholder="开始日期" required>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label for="to_date" class="col-md-4">To</label>
                            <div class="col-md-16">
                                <input type="text" class="form-control" id="to_date" name="to_date" placeholder="结束日期" required>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label for="currency" class="col-md-4">Currency</label>
                            <div class="col-md-16">
                                <select class="form-control" id="currency" name="currency" required>
                                    <option value="">所有币种</option>
                                    <option value="CNY">CNY</option>
                                    <option value="USD">USD</option>
                                    <option value="EUR">EUR</option>
                                    <option value="CAD">CAD</option>
                                    <option value="AUD">AUD</option>
                                    <option value="GBP">GBP</option>
                                    <option value="NZD">NZD</option>
                                    <option value="SGD">SGD</option>
                                    <option value="CHF">CHF</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label for="set_amount" class="col-md-4">总金额(元)</label>
                            <div class="col-md-16">
                                <input type="number" class="form-control" id="set_amount" name="set_amount" placeholder="总金额" onkeyup="set_target_amount(this)">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-24 ">
                                <button type="submit" class="btn btn-primary center-block">导出</button>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
                </div>
            </div>
        </div>
    </div>
    <div id="wrapper" class="chkVisible print-none">
    <div class="navbar-header" style="float:none;border-bottom: 1px solid #ccc;">
          <a class="navbar-brand text-muted" style="height: 52px;padding-top: 7px;padding-left: 30px;" href="https://www.mycht.cn/webht.php/index/index">
              <img width="150" style="height:40px;" src="/css/nav/img/6000.png">
          </a>
          <h1>Payment List</h1>
            <a <?php if($method_code==='') { ?> class="text-muted"<?php }  ?>
                href="/webht.php/apps/pay/paymentservice/note_list">ALL</a>
            &NonBreakingSpace;&boxv;&NonBreakingSpace;
            <a <?php if($method_code==='15016') { ?> class="text-muted"<?php } ?>
                href="<?php echo set_url_param(array('method'=>15016)) ?>">微信&raquo;</a>
            &NonBreakingSpace;
            <a <?php if($method_code==='15002') { ?> class="text-muted"<?php } ?>
                href="<?php echo set_url_param(array('method'=>15002)) ?>">PayPal&raquo;</a>
            &NonBreakingSpace;
            <a <?php if($method_code==='15018') { ?> class="text-muted"<?php } ?>
                href="<?php echo set_url_param(array('method'=>15018)) ?>">信用卡&raquo;</a>
            &NonBreakingSpace;
            <a <?php if($method_code==='15015') { ?> class="text-muted"<?php } ?>
                href="<?php echo set_url_param(array('method'=>15015)) ?>">支付宝&raquo;</a>
            &NonBreakingSpace;
            &boxv;&NonBreakingSpace;
            <a target="_blank" href="/webht.php/apps/pay/paymentservice/income_statistics">汇总统计&raquo;</a>

            <ul class="nav navbar-nav navbar-right pull-right" style="margin:7.5px 0;">
              <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><?php $userdata=$this->session->userdata('admin_chtcdn'); echo $userdata['OPI_Name']; ?> <span class="caret"></span></a>
                <ul class="dropdown-menu" role="menu">
                  <li><a href="<?php echo site_url('login/logout'); ?>">退出</a></li>
                </ul>
              </li>
            </ul>
        </div>
    </div>
    <div class="" id="content">
      <div class="container-fluid marginTop">
        <div class="row">
            <!-- left -->
            <div class="col-md-4 col-xs-24 print-none">
              <div class="row">
                  <form method="post" id="search_note_list" action="/webht.php/apps/pay/paymentservice/note_list/">
<!--                     <div class="input-group">
                        <label>
                            <input type="checkbox" name="" value="15016" checked readonly class="input-check"><span>微信</span>
                        </label>
                    </div> -->
                      <div class="input-group">
                          <input type="text" name="keywords" value="<?php echo isset($keywords) ? $keywords : ''; ?>" class="form-control" placeholder="订单号" style="height: 33px;-webkit-box-shadow: inset 0 0px 0px rgba(0,0,0,0.075);box-shadow: inset 0 0px 0px rgba(0,0,0,0.075);border-bottom:1px solid #ddd;">
                          <span class="input-group-addon search-btn" onclick="$('#search_note_list').submit();"></span>
                      </div>
                      <div id="datepicker"></div>
                  </form>
              </div>
              <p class="btn-lg"></p>
              <ul class="list-unstyled links">
                  <li><a class="text-primary" href="/webht.php/apps/pay/paymentservice/note_list">&gt;全部收款邮件</a></li>
                  <li class="btn-sm"></li>
                  <li><a class="text-primary" href="/webht.php/apps/pay/paymentservice/note_faillist" >&gt;错误通知列表</a></li>
                  <li class="btn-sm"></li>
                  <li><a class="text-primary" href="/webht.php/apps/pay/paymentservice/send_notify" target="_blank">&gt;手动处理通知</a></li>
                  <li class="btn-sm"></li>
                  <li><a class="text-primary" href="http://share.chtcdn.com/info.php/sendmail/send_mail" target="_blank">&gt;发送邮件</a></li>
                  <li class="btn-lg"></li>
              </ul>
              <div class="well well-sm hidden-xs" >
                  <h4>通知状态:</h4>
                  <p>1.send 表示通知正确发送给外联</p>
                  <p>2.unsend 表示通知在等待处理，5~10分钟系统处理一遍</p>
                  <p>3.sendfail 状态的需要手工设置正确的订单号</p>
                  <p>4.Pending 还未到账，需要人工检查，确认支付或者取消，需要手工关闭此通知</p>
                  <p>5.Denied 银行拒付，需要手工关闭此通知</p>
              </div>
            </div>
            <!-- left end -->
            <div class=" pay_form_div col-sm-20 col-xs-24" style="min-height:1024px;border-left:1px solid #ddd;">
                <table class="table table-bordered table-hover">
                    <thead>
                        <tr>
                            <th >#</th>
                            <th >主题</th>
                            <th width="260" class="hidden-xs">subject</th>
                            <th width="280" class="hidden-xs">交易号</th>
                            <th width="150">收单时间</th>
                            <th width="150" class="hidden-xs">通知时间</th>
                            <th>状态[通知/记录]</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        foreach ($notelist as $key => $item) {
                        ?>
                        <tr>
                            <td><?php echo $key+1; ?></td>
                            <td><span class="brand_text <?php echo strtolower(str_replace(" ","",$item->brand_name))."-color"; ?>"><?php echo $item->brand_name; ?></span>
                            <span class="brand_text <?php echo strtolower(str_replace(" ","",$item->OPN_fundSource))."-color"; ?>"><?php echo $item->OPN_fundSource; ?></span>

                                <?php echo $item->OPN_orderId . ' / ' . $item->OPN_orderAmount . $item->OPN_currency; ?></td>
                            <td class="hidden-xs">

                            <span class="brand_text <?php echo strtolower(str_replace(" ","",$item->app_name))."-color"; ?>"><?php echo $item->app_name; ?></span>

                                <?php
                                echo $item->OPN_subject;
                                ?>
                            </td>
                            <td class="hidden-xs"><?php echo $item->OPN_transactionId; ?></td>
                            <td><?php echo $item->OPN_acquiringTime; ?></td>
                            <td class="hidden-xs"><?php echo $item->OPN_noticeTime; ?></td>
                            <td>
                                <?php
                                $send_text = '';$send_class='';
                                if ($item->OPN_accountStatus !== 'recorded') {
                                    $send_class = 'btn-danger';
                                }
                                if ($item->OPN_noticeSendStatus !== 'send' && substr($item->OPN_noticeSendStatus, 0, 5) !== 'send-') {
                                    $send_class = 'btn-danger';
                                }
                                if ($item->OPN_noticeSendStatus === 'closed') {
                                    $send_class = '';
                                }
                                ?>
                                <?php if ($item->OPN_noticeType !== 'pay') {
                                    echo '<span class=text-danger >' . strtoupper($item->OPN_noticeType) . '</span><br>';
                                } ?>
                                <a href="javascript:void(0);" class="btn btn-sm <?php echo $send_class; ?>" onclick="show_gai_modal('<?php echo $item->OPN_SN; ?>')">
                                    <?php echo $item->OPN_noticeSendStatus .' / ' . $item->OPN_accountStatus; ?>
                                </a>
                            </td>
                        </tr>
                        <?php } ?>
                    </tbody>
                </table>
            </div>
            <!-- right end -->
        </div>
    </div>
    </div>
    <!-- 收款记录详情 -->
    <div class="modal" id="modal_set_gai" tabindex="-1" role="dialog" aria-labelledby="gaiModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                      <span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="gaiModalLabel">收款记录</h4>
                </div>
                <div class="modal-body" id="modal_set_gai_body">
                    ...
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-warning pull-left" onclick="close_gai()" >忽略此条收款</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-warning" onclick="submit_gai_modal()">保存</button>
                </div>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript" src="/js/flatpickr-4.4.4.min.js"></script>
<script type="text/javascript">
jQuery.browser = {};
(function () {
    jQuery.browser.msie = false;
    jQuery.browser.version = 0;
    if (navigator.userAgent.match(/MSIE ([0-9]+)\./)) {
        jQuery.browser.msie = true;
        jQuery.browser.version = RegExp.$1;
    }
})();
    $(document).ready(function() {
       $("#datepicker").flatpickr({
        inline: true,
        dateFormat: "Y-m-d",
        defaultDate: "<?php echo $date; ?>",
        onChange: function (selectedDates, dateStr, instance) {
            window.location.href = '/webht.php/apps/pay/paymentservice/note_list?date=' + dateStr;
        }
    });
    })
    function show_gai_modal(pn_id, new_order) {
      var url = '/webht.php/apps/pay/paymentservice/gai_modal/' + pn_id;
      if (new_order) url += '/' + new_order;
      $.ajax({
          type: "get",
          dataType: "json",
          url: url,
          success: function(data, textStatus) {
              $('#modal_set_gai_body').html(data);
              $('#modal_set_gai').modal('show');
          },
          error: function(msg) {
              alert('\u53d1\u751f\u9519\u8bef\uff0c\u8bf7\u8054\u7cfbYoyo...');
          }
      });
    }
    function close_gai() {
        var pn_id = $('#pn_id').val();
        var pn_txn_id = $('#pn_txn_id').val();
        if (confirm('是否忽略此记录： ' + pn_txn_id)) {
            $.ajax({
                type: "get",
                dataType: "json",
                url: '/webht.php/apps/pay/paymentservice/close_gai/' + pn_id,
                success: function(data, textStatus) {
                    alert(data);
                },
                error: function(msg) {
                    alert('\u53d1\u751f\u9519\u8bef\uff0c\u8bf7\u8054\u7cfbYOYO...');
                }
            });
        }
    }
    function submit_gai_modal() {
        $('#form_modal_gai').ajaxSubmit({
            success: function(data, textStatus) {
                alert(data);
            },
            error: function(msg) {
                console.log("error", msg);
                alert('\u53d1\u751f\u9519\u8bef\uff0c\u8bf7\u8054\u7cfbYOYO...');
            },
            dataType: 'json',
            timeout: 30000
        });
        return false;
    }
</script>
</html>
