
@{
    ViewData["Title"] = "手续费列表";
    Layout = "~/Pages/Shared/_MainLayout.cshtml";
}


<div class="row">
    <div class="col-sm-12">
        <div class="ibox-content m-b-sm border-bottom">
            <form id="toolbar">
                <div class="form-inline" style="line-height:40px;">
                    <div class="form-group">
                        <label>交易时间</label>
                        <input class="form-control layer-date" id="start" style="width:120px;" placeholder="交易开始时间" value="@ViewBag.start" />
                        <input class="form-control layer-date" id="end" style="width:120px" placeholder="交易结束时间" value="@ViewBag.end" />
                    </div>
                    <div class="form-group">
                        <label>&nbsp;</label>
                        <button type="button" class="btn btn-primary" onclick="list();"><i class="fa fa-search"></i>&nbsp;查询</button>
                        <button id="btnexport" style="display:none;" type="button" class="btn btn-success" onclick="ExportCSV()">导出</button>
                    </div>
                </div>
            </form>
        </div>

        <div class="ibox-content m-b-sm border-bottom">
            <table id="roletable" class="table table-hover table-bordered table-condensed table-striped" style="table-layout:fixed;">
                <thead>
                    <tr>
                        <th>付款主体</th>
                        <th>交易银行卡号</th>
                        <th>所属银行</th>
                        <th>持卡人</th>
                        <th>手续费cny</th>
                        <th>产生时间</th>
                    </tr>
                </thead>
                <tbody id="tb">
                </tbody>
            </table>
        </div>

    </div>
</div>

@section scripts{
    <script type="text/javascript">
        var tb;
        $(document).ready(function () {
            list();
        })

        function list() {
            var start = $('#start').val();
            var end = $('#end').val();

            $.submit({
                url: '@Url.Content("~/Reports/Finance/ListFinanceHandleFeeJson")',
                paramData: 'start=' + start + '&end=' + end +'&paycompanyid=@(ViewBag.paycompanyid)&headname=@(ViewBag.headname)',
                func: function (result) {
                    $('#tb').html('');
                    if (result.success) {
                        for (var i in result.data) {
                            var obj = result.data[i];
                            var s = '<tr>';
                            s += '<td>' + obj.subject_name_from + '</td>';
                            s += '<td>' + obj.bank_card_from + '</td>';
                            s += '<td>' + obj.bank_name_from + '</td>';
                            s += '<td>' + obj.bank_card_user_from + '</td>';
                            s += '<td>' + obj.pay_money_rMB + '</td>';
                            s += '<td>' + obj.create_time + '</td>';
                            s += '</tr>';
                            $('#tb').append(s);
                        }

                        //合计
                        $('#tb').append('<tr><td colspan="3"></td><td>合计</td><td>' + result.total + '</td><td></td></tr>');

                    }
                    else {
                        alert('获取数据出现异常')
                    }
                }
            })

        }

        function ExportCSV() {
            var start = $('#start').val();
            var end = $('#end').val();

            window.open('@Url.Content("~/Reports/Finance/ExportListFinanceHandleFee")' + '?paycompanyid=@(ViewBag.paycompanyid)' + '&start=' + start + '&end=' + end, '_blank');

        }

    </script>
}

