<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('个人收支明细列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="time-form">
                    <div class="select-list">
                        <ul>
                            <input type="hidden" id="perId" name="perId" th:value="${perId}"/>
                            <input type="hidden" id="walletAccountNo" name="walletAccountNo" th:value="${walletAccountNo}"/>
                            <li>
                                <label>交易时间：</label>
                                <input type="text" class="time-input" id="startTime" name="startTime"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" name="endTime"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('time-form')"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                                <a class="btn btn-warning btn-rounded btn-sm" href="/manage/per-wallet/per-wallet-list-view"><i class="fa fa-refresh"></i>&nbsp;返回</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: bootstrap-select-js" />
    <th:block th:include="include :: jquery-cxselect-js" />
    <script th:inline="javascript">
        var removeFlag = [[${@permission.hasPermi('per-wallet:remove')}]];
        var prefix = ctx + "manage/per-wallet";

        $(function() {
            var options = {
                url: prefix + "/get-per-wallet-account-trade-detail",
                modalName: "收支明细详情",
                columns: [
                {
                    field: 'perId',
                    title: '序号'
                },
                {
                    field: 'trade_date',
                    title: '交易时间'
                },
                {
                    field: 'trade_flow_no',
                    title: '交易流水号'
                },
                {
                    field: 'amount',
                    title: '交易金额'
                },
                {
                    field: 'balance',
                    title: '交易后余额'
                },
                {
                    field: 'direction',
                    title: '资金流向'
                },
                {
                    field: 'hand_status',
                    title: '处理状态'
                },
                {
                    field: 'create_date',
                    title: '订单创建时间'
                },
                {
                    field: 'trade_type',
                    title: '交易类型'
                },
                {
                    field: 'memo',
                    title: '备注'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        var perTradeInfoClick = "perTradeInfo(" + index + ")";
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="' + perTradeInfoClick + '"><i class="fa fa-edit"></i>明细详情</a> ');
                        return actions.join('');
                    }
                }]
            };
            var _n = new Date();
            var initStart = new Date(_n.getTime()-2592000000);
            $('#startTime').val(initStart.format("yyyy-MM-dd"));
            $('#endTime').val(_n.format("yyyy-MM-dd"));
            $.table.init(options);
        });
        //账户信息
        function perTradeInfoView() {
            $.modal.open('账户信息', prefix+'/per-trade-detail-view', '900', '600');
        }

        //点击编辑弹窗
        function perTradeInfo(index) {
            pageParam = { //页面传递参数
                mark: "upd",
                row: $("#bootstrap-table").bootstrapTable('getData')[index]
            }
            perTradeInfoView();
        }

    </script>
</body>
</html>