<!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">
                <input hidden type="text" name="performancesId" th:value="${id}">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>订单号：</label>
                            <input type="text" name="orderCode"/>
                        </li>
                        <li>
                            <label>订单号ID：</label>
                            <input type="text" name="orderTicketsId"/>
                        </li>
                        <li>
                            <label>购买人电话：</label>
                            <input type="text" name="userMobile"/>
                        </li>
                        <li>
                            <label>购买人姓名：</label>
                            <input type="text" name="userName"/>
                        </li>
                        <li>
                            <label>收货人电话：</label>
                            <input type="text" name="expressContacts"/>
                        </li>
                        <li>
                            <label>收货人姓名：</label>
                            <input type="text" name="expressPhone"/>
                        </li>
                        <li>
                            <label>订单状态：</label>
                            <select name="orderStatus" th:with="type=${@dict.getType('zhengzai_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="expressStatus" th:with="type=${@dict.getType('zhengzai_express_status')}">
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></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="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 placeOrderFlag = [[${@permission.hasPermi('kylin:performancesExpress:placeOrder')}]];

    var prefix = ctx + "kylin/performancesExpress";

    var orderStatusDic = [[${@dict.getType('zhengzai_order_status')}]];

    $(function () {
        var options = {
            url: prefix + "/performanceOrderList",
            modalName: "演出订单",
            placeOrderUrl: prefix + "/placeOrder",
            columns: [{
                checkbox: true
            },
                {
                    field: 'orderTicketsId',
                    title: '订单ID'
                },
                {
                    field: 'orderCode',
                    title: '订单号'
                },
                {
                    field: 'status',
                    title: '订单状态',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(orderStatusDic, value);
                    }
                },
                {
                    field: '',
                    title: '快递',
                    formatter: function (value, row, index) {
                        var expressType = '';
                        if (row.expressType == 1) {
                            expressType = "寄付";
                        } else {
                            expressType = "到付";
                        }
                        return '快递方式：'+expressType+'<br>'+'快递费：'+row.priceExpress;
                    }
                },
                {
                    field: '',
                    title: '购买用户',
                    formatter: function(value, row, index) {
                        var userId = row.userId;
                        var userMobile = row.userMobile;
                        var userName = row.userName;
                        return 'ID：'+userId+'<br>'+'姓名：'+userName+'<br>'+'手机号：'+userMobile;
                    }
                },
                {
                    field: '',
                    title: '收获用户',
                    formatter: function(value, row, index) {
                        var expressContacts = row.expressContacts;
                        var expressAddress = row.expressAddress;
                        var expressPhone = row.expressPhone;
                        return '姓名：'+expressContacts+'<br>'+'地址：'+expressAddress+'<br>'+'手机号：'+expressPhone;
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-danger btn-xs ' + placeOrderFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.orderTicketsId + '\', \'确定下单吗？\', table.options.placeOrderUrl)"></i>下单</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

</script>
</body>
</html>