<!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="title"/>
                        </li>
                        <li>
                            <label>城市名称：</label>
                            <input type="text" name="cityName"/>
                        </li>
                        <li>
                            <label>排序字段：</label>
                            <select name="orderItem">
                                <option value="created_at">创建时间</option>
                                <option value="">所有</option>
                                <option value="updated_at">修改时间</option>
                            </select>
                        </li>
                        <li>
                            <label>排序方式：</label>
                            <select name="orderSc">
                                <option value="desc">倒序</option>
                                <option value="">所有</option>
                                <option value="asc">正序</option>
                            </select>
                        </li>
                        <li style="visibility: hidden">
                            <label>演出状态：</label>
                            <select name="status">
                                <option value="-2">全部</option>
                                <option value="1">审核中</option>
                                <option value="3">审核通过</option>
                                <option value="4">审核拒绝</option>
                                <option value="6">售卖</option>
                                <option value="7">已下架</option>
                                <option value="8">售罄</option>
                                <option value="9">未开始</option>
                                <option value="10">演出结束</option>
                            </select>
                        </li>
                        <li>
                            <label>审核状态：</label>
                            <select name="auditStatus">
                                <option value="-2">全部</option>
                                <option value="0">审核中</option>
                                <option value="2">审核拒绝</option>
                            </select>
                        </li>
                        <li>
                            <label>停售时间：</label>
                            <select name="stopSellDay">
                                <option value="-2">全部</option>
                                <option value="0">今天</option>
                                <option value="1">明天</option>
                                <option value="-1">昨天</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-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var detailFlag = [[${@permission.hasPermi('kylin:performances:detail')}]];
    var expertFlag = [[${@permission.hasPermi('kylin:performances:expert')}]];
    var prefix = ctx + "kylin/performances";

    $(function () {
        var options = {
            url: prefix + "/list",
            detailUrl: prefix + "/details/{id}",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            // sortName: "sort",
            modalName: "演出",
            orderSc:"desc",
            orderItem:"created_at",
            columns: [{
                checkbox: true
            },
                {
                    field: 'title',
                    title: '演出名称'
                },
                {
                    field: 'performancesId',
                    title: '演出id'
                },
                {
                    field: 'timeStart',
                    title: '开演时间'
                },
                {
                    field: 'totalGeneral',
                    title: '供票总量'
                },
                {
                    field: 'saleGeneral',
                    title: '实销'
                },
                {
                    field: 'surplusGeneral',
                    title: '余票'
                },
                {
                    field: 'totalSalePrice',
                    title: '总销售款'
                },
                {
                    field: 'statusName',
                    title: '演出状态'
                },
                {
                    field: 'rejectTxt',
                    title: '拒绝理由'
                },
                {
                    field: 'sort',
                    title: '排序',
                    sortable: true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        if (row.auditStatus == 0) {
                            actions.push('<a class="btn btn-success btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.performancesId + '\')"><i class="fa fa-edit"></i>管理</a> ');
                        }else{
                            actions.push('<a class="btn btn-success btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.performancesId + '\')"><i class="fa fa-edit"></i>查看</a> ');
                        }
                        if (row.syncDamai == 1) {
                            actions.push('<a class="btn btn-warning btn-xs ' + expertFlag + '" href="javascript:void(0)" onclick="f(\'' + row.performancesId + '\')"><i class="fa fa-remove"></i>同步</a>');
                        }
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function f(id) {
        $.post(prefix + "/sync/damai",{performancesId:id},function (res) {
            alert(res.msg)
        });
    }
</script>
</body>
</html>
