<!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="orderNo"/>
                            </li>
                            <li>
                                <label>电话：</label>
                                <input type="text" name="mobile"/>
                            </li>
                            <li>
                                <label>支付方式：</label>
                                <select name="payType" th:with="type=${@dict.getType('zhengzai_pay_type')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>订单状态：</label>
                                <select name="state" th:with="type=${@dict.getType('zhengzai_member_order_status')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>购买方式：</label>
                                <select name="mode" th:with="type=${@dict.getType('zhengzai_buy_mode')}">
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>客户端：</label>
                                <select name="source" th:with="type=${@dict.getType('zhengzai_order_source')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label>支付时间： </label>
                                <input type="text" class="time-input" id="timeStart" placeholder="开始日期" name="paymentAtStart"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="timeEnd" placeholder="结束日期" name="paymentAtEnd"/>
                            </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" onclick="$.operate.add()" shiro:hasPermission="kylin:order:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="kylin:order:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="kylin:order:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="kylin:order: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>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var detailFlag = [[${@permission.hasPermi('adam:order:orderList')}]];
        var prefix = ctx + "adam/order/orderList";
        var orderStatusDic = [[${@dict.getType('zhengzai_member_order_status')}]];

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                detailUrl: prefix + "/detail/{id}",
                modalName: "【请填写功能名称】",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'orderNo',
                    title: '订单号'
                },
                {
                    field: 'state',
                    title: '订单状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(orderStatusDic, value);
                    }
                },
                {
                    field: 'payType',
                    title: '支付方式'
                },
                {
                    field: 'price',
                    title: '价格(元)'
                },
                {
                    field: 'paymentAt',
                    title: '支付时间'
                    // formatter: function(value, row, index) {
                    //     return [[${#dates.format(value, 'yyyy-MM-dd')}]];
                    // }
                },
                {
                    field: 'createdAt',
                    title: '创建时间'
                },
                {
                    field: 'uid',
                    title: '用户ID'
                },
                {
                    field: 'mobile',
                    title: '手机号'
                },
                {
                    field: 'source',
                    title: '客户端'
                },
                // {
                //     field: 'state',
                //     title: '快递状态'
                // },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-warning btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.orderNo + '\')"><i class="fa fa-search"></i>详细</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>