<!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('主财务单列表')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
</head>
<body class="gray-bg">

<div class="ui-layout-center">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="financial-form">
                    <div class="select-list">
                        <ul>
                            <li>
                                订单号：<input type="text" id="orderMasterCode" name="orderMasterCode"/>
                            </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-warning" onclick="$.table.exportExcel()"
                   shiro:hasPermission="financial:master:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>

<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('financial:master:edit')}]];
    var payTypeDict = [[${@dict.getType ('pay_type')}]];
    var payStatusDict = [[${@dict.getType ('pay_status')}]];
    var prefix = ctx + "financial/master";

    $(function () {
        var panehHidden = false;
        if ($(this).width() < 769) {
            panehHidden = true;
        }
        $('body').layout({initClosed: panehHidden, west__size: 185});
        // 回到顶部绑定
        if ($.fn.toTop !== undefined) {
            var opt = {
                win: $('.ui-layout-center'),
                doc: $('.ui-layout-center')
            };
            $('#scroll-up').toTop(opt);
        }
        queryFinancialList();
    });

    function queryFinancialList() {
        var options = {
            url: prefix + "/list",
            exportUrl: prefix + "/export",
            sortName: "createTime",
            sortFinancial: "desc",
            modalName: "财务单",
            columns: [
                {
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '财务单ID',
                    visible: false
                },
                {
                    field: 'orderMasterId',
                    title: '主订单序号',
                    visible: false
                },
                {
                    field: 'orderMasterCode',
                    title: '主订单编码'
                },
                {
                    field: 'totalMoney',
                    title: '整单总金额'
                },
                {
                    field: 'discountMoney',
                    title: '优惠金额'
                },
                {
                    field: 'payMoney',
                    title: '实付金额'
                },
                {
                    field: 'payType',
                    title: '支付方式',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(payTypeDict, value);
                    }
                },
                {
                    field: 'payStatus',
                    title: '支付状态',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(payStatusDict, value);
                    }
                },
                {
                    field: 'payTime',
                    title: '付款时间'
                },
                {
                    field: 'createTime',
                    title: '创建时间'
                }
            ]
        };
        $.table.init(options);
    }

</script>
</body>

</html>