<!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('NFT订单列表')"/>
</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>
                        <div class="col-sm-12">
                            <li>
                                <label>藏品名称：</label>
                                <input type="text" name="name"/>
                            </li>
                            <li>
                                <label>用户ID：</label>
                                <input type="text" name="userId"/>
                            </li>
                            <li>
                                <label>短订单编号：</label>
                                <input type="text" name="shortOrderCode"/>
                            </li>
                            <li>
                                <label>订单编号：</label>
                                <input type="text" name="orderCode"/>
                            </li>
                            <li>
                                <label>哈希值：</label>
                                <input type="text" name="nftId"/>
                            </li>
                        </div>
                        <div class="col-sm-12">
                            <li>
                                <label>购买方式：</label>
                                <select name="orderType">
                                    <option value="">全部</option>
                                    <option value="1">购买</option>
                                    <option value="2">兑换</option>
                                    <option value="3">演出赠送</option>
                                    <option value="4">空投赠送</option>
                                </select>
                            </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="status"
                                        th:with="type=${@dict.getType('zhengzai_goblin_nft_order_status')}">
                                    <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" placeholder="开始日期" name="payTimeStart"/>
                                <span>-</span>
                                <input type="text" class="time-input" placeholder="结束日期" name="payTimeEnd"/>
                            </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>
                        </div>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-warning" onclick="$.table.exportExcel()"
               shiro:hasPermission="goblin:nftOrderRefund:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>

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

    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">

    var prefix = ctx + "goblin/nftOrder";
    var payTypeDic = [[${@dict.getType('zhengzai_pay_type')}]];
    var statusDic = [[${@dict.getType('zhengzai_goblin_nft_order_status')}]];

    $(function () {
        var options = {
            url: prefix + "/orderList",
            exportUrl: prefix + "/export",
            modalName: "NFT订单",
            columns: [
                {
                    field: 'userId',
                    title: '用户ID'
                },
                {
                    field: 'orderCode',
                    title: '订单编号'
                },
                {
                    field: 'orderType',
                    title: '购买方式',
                    formatter: function (value) {
                        switch (value) {
                            case 1:
                                return "购买";
                                break;
                            case 2:
                                return "兑换";
                                break;
                            case 3:
                                return "演出赠送";
                                break;
                            case 4:
                                return "空投赠送";
                                break;
                        }
                    },
                },
                {
                    field: 'payType',
                    title: '支付方式',
                    formatter: function (value) {
                        return $.table.selectDictLabel(payTypeDic, value);
                    },
                },
                {
                    field: 'priceActual',
                    title: '支付金额'
                },
                {
                    field: 'status',
                    title: '订单状态',
                    formatter: function (value) {
                        return $.table.selectDictLabel(statusDic, value);
                    },
                },
                {
                    field: 'createdAt',
                    title: '下单时间'
                },
                {
                    field: 'payTime',
                    title: '支付时间'
                },
                {
                    field: 'name',
                    title: '藏品名称'
                },
                {
                    field: 'tradingAt',
                    title: '上链时间'
                },
                {
                    field: 'nftId',
                    title: '哈希值'
                }]
        };

        $.table.init(options);

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