<!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="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>订单号：</label>
                                <input type="text" name="orderTicketsId"/>
                            </li>
                            <li>
                                <label>退款编号：</label>
                                <input type="text" name="orderRefundCode"/>
                            </li>
                            <li>
                                <label>退款状态：</label>
                                <select name="status">
                                    <option value="">全部</option>
                                    <option value="0">请求退款</option>
                                    <option value="2">取消退款</option>
                                    <option value="1">一审审核通过</option>
                                    <option value="5">一审驳回退款</option>
                                    <option value="7">等待退款</option>
                                    <option value="3">正在退款</option>
                                    <option value="4">完成退款</option>
                                    <option value="6">退款失败</option>
                                </select>
                            </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()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success multiple disabled" onclick="review()" shiro:hasPermission="kylin:refund:review">
                    批量一审
                </a>
                <a class="btn btn-primary multiple disabled" onclick="execute()" shiro:hasPermission="kylin:refund:execute">
                    批量二审
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll('确定取消选中的退款申请吗？', '/cancel')" shiro:hasPermission="kylin:refund:cancel">
                    批量取消
                </a>
                <a class="btn btn-warning multiple disabled" onclick="$.operate.removeAll('确定重新提交选中的退款审核吗？', '/reapply')" shiro:hasPermission="kylin:refund:reapply">
                    批量重新提交
                </a>
            </div>
            <div class="col-sm-12 select-table table-bordered">
                <table id="bootstrap-table"></table>
            </div>

            <form id="appTest">
                <div class="select-list">
                    <ul>
                        <li>
                            <input type="text" name="orderTicketsId" th:value="71619365224734720"/>
                            <input type="text" name="orderRefundBatchesId" th:value="222"/>
                            <input type="text" name="RefundPriceExpress" th:value="0"/>
                            <input type="text" name="reason" th:value="备注"/>
                        </li>
                        <li>
                            <div class="form-group">
                                <div class="col-sm-8">
                                    <label class="check-box">
                                        <input checked name="ticketEntityIds" type="checkbox" value="69485706304757740">展开/折叠
                                    </label>
                                    <label class="check-box">
                                        <input checked name="ticketEntityIds" type="checkbox" value="69485706304757739">全选/全不选
                                    </label>
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
            </form>

        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var detailFlag = [[${@permission.hasPermi('kylin:refund:detail')}]];
        var reviewFlag = [[${@permission.hasPermi('kylin:refund:review')}]];
        var executeFlag = [[${@permission.hasPermi('kylin:refund:execute')}]];
        var cancelFlag = [[${@permission.hasPermi('kylin:refund:cancel')}]];
        var reapplyFlag = [[${@permission.hasPermi('kylin:refund:reapply')}]];

        var prefix = ctx + "kylin/refund";

        function apply() {
            var data = $('#appTest').serializeArray();

            $.operate.save(prefix + "/apply", data);
        }
        function review() {
            alert(1)
        }
        function execute() {
            alert(2)
        }

        $(function() {
            var options = {
                url: prefix + "/list",
                detailUrl: prefix + "/details/{id}",
                cancelUrl: prefix + "/cancel",
                reapplyUrl: prefix + "/reapply",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'orderTicketsId',
                    title: '票务订单id'
                },
                {
                    field: 'title',
                    title: '演出名称'
                },
                {
                    field: 'price',
                    title: '退款金额'
                },
                {
                    field: 'statusName',
                    title: '退款状态'
                },
                {
                    field: 'createdAt',
                    title: '申请时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-info btn-xs' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.orderRefundsId + '\')"></i>查看</a> ');

                        actions.push('<a class="btn btn-success btn-xs ' + reviewFlag + '" href="javascript:void(0)" onclick="review(\'' + row.orderRefundsId + '\')"></i>一审</a> ');
                        actions.push('<a class="btn btn-primary btn-xs ' + executeFlag + '" href="javascript:void(0)" onclick="execute(\'' + row.orderRefundsId + '\')"></i>二审</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + cancelFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.orderRefundsId + '\', \'确定取消退款申请吗？\', table.options.cancelUrl)"></i>取消</a> ');
                        actions.push('<a class="btn btn-warning btn-xs ' + reapplyFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.orderRefundsId + '\', \'确定重新提交退款审核吗？\', table.options.reapplyUrl)"></i>重新提交</a> ');

                        actions.push('<a class="btn btn-warning btn-xs" href="javascript:void(0)" onclick="apply()"></i>提交申请</a> ');

                        return actions.join('');
                    }
                }]
            };

            $.table.init(options);

        });
    </script>
</body>
</html>