<!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">
                                    <option value="">全部</option>
                                    <option value="1">申请退款</option>
                                    <option value="2">退款成功</option>
                                    <option value="3">退款失败</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>
                        </div>
                    </ul>
                </div>
            </form>
        </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')}]];

    $(function () {
        var options = {
            url: prefix + "/refundList",
            columns: [
                {
                    field: 'refundCode',
                    title: '退款编号'
                },
                {
                    field: 'price',
                    title: '退款金额'
                },
                {
                    field: 'status',
                    title: '退款状态',
                    formatter: function (value) {
                        switch (value) {
                            case 1:
                                return "申请退款";
                                break;
                            case 2:
                                return "退款成功";
                                break;
                            case 3:
                                return "退款失败";
                                break;
                        }
                    },
                },
                {
                    field: 'refundAt',
                    title: '退款时间'
                },
                {
                    field: 'errorReason',
                    title: '失败原因',
                    formatter: function (value, row) {
                        if (row.status == 3) {
                            return value;
                        } else {
                            return '';
                        }
                    },
                    cellStyle: function () {
                        return {css: {"color": "red", "font-weight": "bold"}};
                    },
                },
                {
                    field: 'createdAt',
                    title: '申请时间'
                },
                {
                    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 "空投赠送";
                        }
                    },
                },
                {
                    field: 'payType',
                    title: '支付方式',
                    formatter: function (value) {
                        return $.table.selectDictLabel(payTypeDic, value);
                    },
                },
                {
                    field: 'payTime',
                    title: '支付时间'
                },
                {
                    field: 'name',
                    title: '藏品名称'
                },
                {
                    field: 'tradingAt',
                    title: '上链时间'
                },
                {
                    field: 'nftId',
                    title: '哈希值'
                }]
        };

        $.table.init(options);

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