<!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>
<style>
    .img-details {
        width: 300px;
        height: 400px;
    }

    .img-Approval {
        max-width: 300px;
        height: 400px;
    }
</style>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeIn">
    <div class="row">
        <div class="col-sm-12">
            <div class="tabs-container">
                <ul class="nav nav-tabs">
                    <li id="li-tab-2" class="active"><a data-toggle="tab" href="#tab-2" aria-expanded="false">演出详情</a>
                    </li>
                    <li id="li-tab-1"><a data-toggle="tab" href="#tab-1" aria-expanded="true" id="tab-nav-1"> 演出数据</a>
                    </li>
                    <li id="li-tab-6"><a data-toggle="tab" href="#tab-6" aria-expanded="false" onclick="refundConfigInfo()">退款管理</a>
                    </li>
                    <li id="li-tab-10"><a data-toggle="tab" href="#tab-10" aria-expanded="false" onclick="refundPoundageInfo()">阶段退票</a>
                    </li>
                    <li id="li-tab-7"><a data-toggle="tab" href="#tab-7" aria-expanded="false" onclick="transferInfo()">转赠配置</a>
                    </li>
                    <li id="li-tab-3"><a data-toggle="tab" href="#tab-3" aria-expanded="false" onclick="memberInfo()">会员信息配置</a>
                    </li>
                    <li id="li-tab-4"><a data-toggle="tab" href="#tab-4" aria-expanded="false" onclick="agentInfo()">代理配置</a>
                    </li>
                    <li id="li-tab-5"><a data-toggle="tab" href="#tab-5" aria-expanded="false" onclick="damaiInfo()">大麦配置</a>
                    </li>
                    <li id="li-tab-8"><a data-toggle="tab" href="#tab-8" aria-expanded="false" onclick="importInfo()">订单导入</a>
                    </li>
                    <li id="li-tab-9"><a data-toggle="tab" href="#tab-9" aria-expanded="false" onclick="payTxtInfo()">支付文案</a>
                    </li>
                    <li id="li-tab-11"><a data-toggle="tab" href="#tab-11" aria-expanded="false" onclick="subscribeInfo()">预约统计</a>
                    </li>
                </ul>
                <div class="tab-content">
                    <div id="tab-1" class="tab-pane">
                        <div class="panel-body">
                            <!-- 导出按钮 -->
                            <div class="m-t-md" style="text-align: left; margin-bottom: 2px">
                                <button type="button" class="btn btn-primary" onclick="exportTableData()">导出数据</button>
                            </div>
                            <div id="tab-1" class="tab-pane">
                                <iframe id="tab_iframe_1" name="tab_iframe_1" marginwidth=0 marginheight=0 width=100%
                                        height=800px frameborder=0></iframe>
                            </div>
                        </div>
                    </div>
                    <div id="tab-2" class="tab-pane active">
                        <div class="panel-body" id="performance_config">
                            <strong>相关配置</strong>
                            <div th:width="max" style="margin-top: 10px">
                                <strong>是否显示当前演出</strong>
                                <div class="radio check-box">
                                    <input type="radio" value="1" name="isShowCheck"> 显示</label>
                                </div>
                                <div class="radio check-box">
                                    <input type="radio" value="0" name="isShowCheck"> 不显示</label>
                                </div>
                                <button type="button" class="btn btn-w-m btn-success" name="isShowBtn"
                                        onclick="submitHandler()">保存配置
                                </button>
                            </div>
                        </div>
                        <div class="panel-body" id="performance_platform">
                            <strong>同步票务平台</strong>
                            <div th:width="max" style="margin-top: 10px">
                                <button type="button" class="btn btn-w-m btn-success" name="synPerform"
                                        onclick="synPerform()">同步演出
                                </button>
                                <button type="button" class="btn btn-w-m btn-success" name="synOrder"
                                        onclick="synOrder()">同步订单
                                </button>
                            </div>
                        </div>
                        <div class="panel-body" th:width="max" style="margin-top: 10px">
                            <form class="form-horizontal m" id="form-performances-edit"
                                  th:object="${kylinPerformanceMisVo}">
                                <div>
                                    <h4>场地核进度：</h4>
                                    <span th:if="*{fieldAuditStatus==0}">通过</span>
                                    <span th:if="*{fieldAuditStatus==1}" style="color: red">待审核</span>
                                    <span th:if="*{fieldAuditStatus==2}" style="color: red">拒绝</span>
                                </div>
                                <div>
                                    <h4>演出封面：</h4>
                                    <img class="img-details" name="img" th:src="*{imgPoster}"
                                         th:onclick="click_big([[*{imgPoster}]])">
                                </div>
                                </br>
                                <div class="panel panel-info">
                                    <div class="panel-heading">
                                        <label>演出名称：</label>
                                        <span th:text="*{title}"></span>
                                    </div>
                                    <div class="panel-footer">
                                        <label>是否实名：</label>
                                        <span th:if="*{isTrueName==1}">是</span>
                                        <span th:if="*{isTrueName==0}">否</span>
                                    </div>
                                    <div class="panel-footer">
                                        <label>演出账号限购：</label>
                                        <span th:text="*{limitCount}"></span>
                                    </div>
                                    <div class="panel-footer">
                                        <label>演出实名限购：</label>
                                        <span th:text="*{idCount}"></span>
                                    </div>
                                    <div class="panel-footer">
                                        <label>场次实名限购：</label>
                                        <span th:each="dict : ${kylinPerformanceMisVo.ticketTimes}"
                                              th:if="${dict.realNameLimit == 1}"
                                              th:text="${dict.title} + ' '"
                                              style="display: inline;">
                                        </span>
                                    </div>
                                    <div class="panel-footer">
                                        <label>时间：</label>
                                        <span th:text="*{timeStart}"></span>
                                        <span> - </span>
                                        <span th:text="*{timeEnd}"></span>
                                    </div>
                                    <div class="panel-footer">
                                        <label>演出类型：</label>
                                        <span th:if="*{type==101}">音乐节</span>
                                        <span th:if="*{type==102}">小型演出</span>
                                        <span th:if="*{type==103}">巡演</span>
                                    </div>
                                    <div class="panel-footer">
                                        <label>场地：</label>
                                        <span th:text="*{fieldName}"></span>
                                    </div>
                                    <div class="panel-footer">
                                        <label>价格：</label>
                                        <span th:text="*{price}"></span>
                                    </div>
                                    <div class="panel-footer">
                                        <label>停售时间：</label>
                                        <span th:text="*{stopSellTime}"></span>
                                    </div>
                                    <div class="panel-footer">
                                        <label>主办方：</label>
                                        <span th:text="*{sponsor}"></span>
                                        <div>
                                            <label>联系人：</label>
                                            <span th:text="*{contacts}"></span>
                                            <label style="margin-left: 15px; padding-left: 15px; border-left: #1a2226 solid 1px">联系电话：</label>
                                            <span th:text="*{mobile}"></span>
                                        </div>
                                    </div>
                                </div>
                                <div>
                                    <h4>演出批文：</h4>
                                    <img class="img-Approval" name="img" th:src="*{approvalUrl}"
                                         th:onclick="click_big([[*{approvalUrl}]])">
                                </div>
                                </br>
                                <h4>演出详情：</h4>
                                <div class="ibox float-e-margins" id="eg">
                                    <div class="click2edit wrapper imgwid" id="subText">
                                    </div>
                                </div>
                                <div>
                                    <h4>演出公告：</h4>
                                    <input name="notice" th:field="*{notice}" class="form-control" type="text" readonly>
                                </div>
                                <h4>演出公告：</h4>


                                <div id="noticeImg" class="ibox float-e-margins ">
                                    <h4 class="ibox-title">购票须知：</h4>
                                    <div class="form-group" th:each="dict : ${kylinPerformanceMisVo.noticeImageList}">
                                        <div class="col-sm-1 b-r" style="text-align: center">
                                            <img class="img-circle notice" th:src="${dict.imgUrl}"/>
                                        </div>
                                        <div class="col-sm-11">
                                            <h5 th:text="${dict.title}"></h5>
                                            <p th:text="${dict.message}"></p>
                                        </div>
                                    </div>
                                </div>
                                <div th:each="dict : ${kylinPerformanceMisVo.ticketTimes}">
                                    <div th:each="dict2 : ${dict.ticket}" class="panel panel-info">
                                        <div class="panel-heading">
                                            <span>票种名称：</span>
                                            <span th:text="${dict2.title}"></span>
                                        </div>
                                        <div class="panel-footer">
                                            <span>适用日期：</span>
                                            <span th:text="${dict2.useStart}"></span>
                                            <span> - </span>
                                            <span th:text="${dict2.useEnd}"></span>
                                        </div>
                                        <div class="panel-footer">
                                            <span>价格：</span>
                                            <span th:text="${dict2.price}"></span>
                                        </div>
                                        <div class="panel-footer">
                                            <span>票种说明：</span>
                                            <span th:text="${dict2.describes}"></span>
                                        </div>
                                        <div class="panel-footer" th:if="${dict2.isElectronic==1}">
                                            <span>电子票说明：</span>
                                            <span th:text="${dict2.describeElectronic}"></span>
                                        </div>
                                        <div class="panel-footer" th:if="${dict2.isExpress==1}">
                                            <span>快递票说明：</span>
                                            <span th:text="${dict2.describeExpress}"></span>
                                        </div>
                                        <div class="panel-footer" th:if="${dict2.limitCount == 0}">
                                            <span>账号限购：</span>
                                            <span>账号不限购</span>
                                        </div>
                                        <div class="panel-footer" th:if="${dict2.limitCount != 0}">
                                            <span>账号限购：</span>
                                            <span th:text="${dict2.limitCount}">不限购</span>
                                        </div>

                                        <div class="panel-footer" th:if="${dict2.idCount == 0}">
                                            <span>实名限购：</span>
                                            <span>实名不限购</span>
                                        </div>
                                        <div class="panel-footer" th:if="${dict2.idCount != 0}">
                                            <span>实名限购：</span>
                                            <span th:text="${dict2.idCount}">不限购</span>
                                        </div>

                                        <div class="panel-footer">
                                            <span>库存总量：</span>
                                            <span th:text="${dict2.totalGeneral}"></span>
                                        </div>
                                        <div class="panel-footer">
                                            <span>开始售票时间：</span>
                                            <span th:text="${dict2.timeStart}"></span>
                                        </div>
                                        <div class="panel-footer">
                                            <span>是否学生票：</span>
                                            <span th:if="${dict2.isStudent==1}">是</span>
                                            <span th:if="${dict2.isStudent==0}">否</span>
                                        </div>
                                        <div class="panel-footer">
                                            <span>是否显示二维码：</span>
                                            <span th:if="${dict2.isShowCode==1}">是</span>
                                            <span th:if="${dict2.isShowCode==0}">否</span>
                                        </div>
                                        <div class="panel-footer" th:if="${dict2.isShowCode==1}">
                                            <span>二维码显示时间：</span>
                                            <span th:text="${dict2.qrCodeShowTime}"></span>
                                        </div>
                                        <div class="panel-footer">
                                            <span>取票方式：</span>
                                            <span th:if="${dict2.isElectronic==1}">电子票</span>
                                            <span th:if="${dict2.isExpress==1}">快递票</span>
                                        </div>
                                        <div class="panel-footer" th:if="${dict2.isExpress==1}">
                                            <span>快递票停售时间：</span>
                                            <span th:text="${dict2.timeEndExpress}"></span>
                                        </div>
                                        <div th:each="dict3 : ${dict2.ExpressModuleList}" class="">
                                            <div class="panel-footer">
                                                <!--                                                <span>快递编号：</span>-->
                                                <!--                                                <span th:text="${dict3.productCode}"></span>-->
                                                <!--                                                <br/>-->
                                                <span>快递名称：</span>
                                                <span th:text="${dict3.title}"></span>
                                                <br/>
                                                <span>预估价格：</span>
                                                <span th:text="${dict3.estimatePriceMin}"></span>
                                                <span> - </span>
                                                <span th:text="${dict3.estimatePriceMax}"></span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <div class="panel-body" th:width="max" style="margin-top: 10px" name="auditBtn">
                            <div class="radio check-box">
                                <input type="radio" value="1" name="auditCheck"> 同意</label>
                            </div>
                            <div class="radio check-box">
                                <input type="radio" value="0" name="auditCheck"> 拒绝</label>
                            </div>
                            <input name="rejectTxt" class="form-control" type="text"/>
                            <button type="button" class="btn btn-w-m btn-success"
                                    style="margin-top: 10px"
                                    onclick="aduitHandler()">审核
                            </button>
                        </div>
                    </div>
                    <div id="tab-3" class="tab-pane">
                        <div class="panel-body">
                            <iframe id="content_iframe" name="content_iframe" marginwidth=0 marginheight=0 width=100%
                                    height=800px frameborder=0></iframe>
                        </div>
                    </div>
                    <div id="tab-4" class="tab-pane">
                        <div class="panel-body">
                            <iframe id="agent_iframe" name="agent_iframe" marginwidth=0 marginheight=0 width=100%
                                    height=800px frameborder=0></iframe>
                        </div>
                    </div>
                    <div id="tab-5" class="tab-pane">
                        <div class="panel-body">
                            <iframe id="damai_iframe" name="damai_iframe" marginwidth=0 marginheight=0 width=100%
                                    height=800px frameborder=0></iframe>
                        </div>
                    </div>
                    <div id="tab-6" class="tab-pane">
                        <div class="panel-body">
                            <iframe id="refundConfig_iframe" name="refundConfig_iframe" marginwidth=0 marginheight=0
                                    width=100%
                                    height=800px frameborder=0></iframe>
                        </div>
                    </div>
                    <div id="tab-10" class="tab-pane">
                        <div class="panel-body">
                            <iframe id="refundPoundage_iframe" name="refundPoundage_iframe" marginwidth=0 marginheight=0
                                    width=100%
                                    height=800px frameborder=0></iframe>
                        </div>
                    </div>
                    <div id="tab-7" class="tab-pane">
                        <div class="panel-body">
                            <iframe id="transfer_iframe" name="transfer_iframe" marginwidth=0 marginheight=0 width=100%
                                    height=800px frameborder=0></iframe>
                        </div>
                    </div>
                    <div id="tab-8" class="tab-pane">
                        <div class="panel-body">
                            <form class="form-horizontal m" th:object="${kylinPerformanceMisVo}">
                                <input name="title" th:field="*{title}" class="form-control" type="text" readonly>
                            </form>
                            <iframe id="order_import_iframe" name="order_import_iframe" marginwidth=0 marginheight=0
                                    width=100%
                                    height=800px frameborder=0></iframe>
                        </div>
                    </div>
                    <div id="tab-9" class="tab-pane">
                        <div class="panel-body">
                            <form class="form-horizontal m" th:object="${kylinPerformanceMisVo}">
                                <input name="title" th:field="*{title}" class="form-control" type="text" readonly>
                            </form>
                            <iframe id="pay_txt_iframe" name="order_import_iframe" marginwidth=0 marginheight=0
                                    width=100%
                                    height=800px frameborder=0></iframe>
                        </div>
                    </div>
                    <div id="tab-11" class="tab-pane">
                        <div class="panel-body">
                            <iframe id="subscribe_iframe" name="subscribe_iframe" marginwidth=0 marginheight=0
                                    width=100%
                                    height=800px frameborder=0></iframe>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var prefix = ctx + "kylin/performances"
    const isShow = '[[${kylinPerformanceMisVo.isShow}]]';
    const auditStatus = '[[${kylinPerformanceMisVo.auditStatus}]]';
    const status = '[[${kylinPerformanceMisVo.status}]]';
    const fieldStatus = '[[${kylinPerformanceMisVo.fieldAuditStatus}]]';
    const endTime = new Date('[[${kylinPerformanceMisVo.timeEnd}]]'.replaceAll("\"", "")).valueOf();
    const now = new Date().valueOf();
    // const et = new Date(endTime.replaceAll("\"", "")).valueOf();
    //获取当前时间
    function FormatDate() {
        var now = new Date();
        var year = now.getFullYear();
        var month = now.getMonth();
        var date = now.getDate();
        month = month + 1;
        if (month < 10) {
            month = "0" + month;
        }
        if (date < 10) {
            date = "0" + date;
        }
        var time = year + "-" + month + "-" + date;
        return time;
    }

    var agentFlag = [[${@permission.hasPermi('kylin:performances:agent')}]];
    if (agentFlag == "hidden") {
        document.getElementById("li-tab-4").style.display = "none";
    }

    var otherFlag = [[${@permission.hasPermi('kylin:performances:audit')}]];
    if (otherFlag == "hidden") {
        document.getElementById("li-tab-2").style.display = "none";
        document.getElementById("tab-2").style.display = "none";
    }

    var refundFlag = [[${@permission.hasPermi('kylin:performances:refund')}]];
    if (refundFlag == "hidden") {
        document.getElementById("li-tab-6").style.display = "none";
    }

    var memberFlag = [[${@permission.hasPermi('kylin:performances:member')}]];
    if (memberFlag == "hidden") {
        document.getElementById("li-tab-3").style.display = "none";
    }

    var damaiFlag = [[${@permission.hasPermi('kylin:performances:damai')}]];
    if (damaiFlag == "hidden") {
        document.getElementById("li-tab-5").style.display = "none";
    }

    var dataFlag = [[${@permission.hasPermi('kylin:performances:data')}]];
    if (dataFlag == "hidden") {
        document.getElementById("li-tab-1").style.display = "none";
    }

    var transferFlag = [[${@permission.hasPermi('kylin:performances:transfer')}]];
    if (transferFlag == "hidden") {
        document.getElementById("li-tab-7").style.display = "none";
    }

    var orderImportFlag = [[${@permission.hasPermi('kylin:performances:orderImport')}]];
    if (orderImportFlag == "hidden") {
        document.getElementById("li-tab-8").style.display = "none";
    }

    var payTxt = [[${@permission.hasPermi('kylin:performances:payTxt')}]];
    if (payTxt == "hidden") {
        document.getElementById("li-tab-9").style.display = "none";
    }
    //预约演出
    var subscribe = [[${@permission.hasPermi('kylin:performances:subscribe')}]];
    if (subscribe == "hidden") {
        document.getElementById("li-tab-11").style.display = "none";
    }
    if (auditStatus == 1 || fieldStatus == 1 || fieldStatus == 2 || auditStatus == 2) {
        document.getElementsByName("auditBtn")[0].style.display = "none";
    }

    if (isShow == 1) {
        document.getElementsByName("isShowCheck")[0].checked = true;
    } else {
        document.getElementsByName("isShowCheck")[1].checked = true;
    }
    if (now > endTime && status>3 && status!=7) {
        // document.getElementById("performance_platform").style.display = "none";
    } else {
        document.getElementById("performance_platform").style.display = "none";
    }

    //修改 演出是否显示
    function submitHandler() {
        var param = {
            "isShow": document.getElementsByName("isShowCheck")[0].checked ? 1 : 0,
            "performancesId": '[[${kylinPerformanceMisVo.performancesId}]]'.replaceAll("\"", "")
        };
        $.operate.post(prefix + "/isShow", param, function (res) {
        });
    }

    //同步票务平台
    function synPerform() {
        var param = {
            "performancesId": '[[${kylinPerformanceMisVo.performancesId}]]'.replaceAll("\"", "")
        };
        $.operate.post(prefix + "/syncTicketSysPerformance/", param, function (res) {
        });
    }

    function synOrder() {
        var param = {
            "performancesId": '[[${kylinPerformanceMisVo.performancesId}]]'.replaceAll("\"", "")
        };
        $.operate.post(prefix + "/syncTicketSysOrder/", param, function (res) {
        });
    }

    //演出审核
    function aduitHandler() {
        const auditStatus = document.getElementsByName("auditCheck")[0].checked ? 3 : 4;
        var auditRejectTxt = ""
        if (4 === auditStatus) {
            auditRejectTxt = document.getElementsByName("rejectTxt")[0].value;
        }

        if (4 === auditStatus && auditRejectTxt === "") {
            alert("请填写拒绝理由");
        } else {
            var param = {
                "status": auditStatus,
                "performancesId": '[[${kylinPerformanceMisVo.performancesId}]]'.replaceAll("\"", ""),
                "rejectTxt": auditRejectTxt
            };
            $.operate.post(prefix + "/audit", param, function (res) {
                // $.modal.close();
                // $.table.refresh();
                location.reload();
            });
        }
    }

    // 演出详情 购票须知
    var subText = document.getElementById("subText")
    subText.innerHTML = '[[${kylinPerformanceMisVo.details}]]'.replaceAll("\"", "");

    // 演出详情 购票须知
    var notice = document.getElementById("notice")
    notice.innerHTML = '[[${kylinPerformanceMisVo.notice}]]'.replaceAll("\"", "");

    //会员详情
    function memberInfo() {
        document.getElementById("content_iframe").src = "../memberInfo/" + '[[${kylinPerformanceMisVo.performancesId}]]'.replaceAll("\"", "");
    }

    //代理详情
    function agentInfo() {
        document.getElementById("agent_iframe").src = "../agent/" + '[[${kylinPerformanceMisVo.performancesId}]]'.replaceAll("\"", "");
    }

    //大麦详情
    function damaiInfo() {
        document.getElementById("damai_iframe").src = "../damai/" + '[[${kylinPerformanceMisVo.performancesId}]]'.replaceAll("\"", "");
    }

    //退款管理
    function refundConfigInfo() {
        document.getElementById("refundConfig_iframe").src = "../refundConfig/" + '[[${kylinPerformanceMisVo.performancesId}]]'.replaceAll("\"", "");
    }
    //阶梯退票
    function refundPoundageInfo() {
        document.getElementById("refundPoundage_iframe").src = `../refundPoundage/${'[[${kylinPerformanceMisVo.performancesId}]]'.replaceAll("\"", "")}`
    }

    //转赠配置
    function transferInfo() {
        document.getElementById("transfer_iframe").src = "../transferConfig/" + '[[${kylinPerformanceMisVo.performancesId}]]'.replaceAll("\"", "");
    }

    //订单导入
    function importInfo() {
        document.getElementById("order_import_iframe").src = "../orderImport/" + '[[${kylinPerformanceMisVo.performancesId}]]'.replaceAll("\"", "");
    }

    //支付文案
    function payTxtInfo() {
        document.getElementById("pay_txt_iframe").src = "../payTxt/" + '[[${kylinPerformanceMisVo.performancesId}]]'.replaceAll("\"", "");
    }
    //预约统计
    function subscribeInfo() {
        document.getElementById("subscribe_iframe").src = "../subscribe/" + '[[${kylinPerformanceMisVo.performancesId}]]'.replaceAll("\"", "");
    }

    $("#tab-nav-1").bind("click", function () {
        $("#tab_iframe_1").attr("src", prefix + "/performanceStatic/" + '[[${kylinPerformanceMisVo.performancesId}]]'.replaceAll("\"", ""));
    });

    // 点击图片放大
    function click_big(url) {
        var img_url = url
        if (url.indexOf("x-oss-process") != "-1") {
            img_url = url.split("?")[0]
        }
        var json = {
            "data": [   //相册包含的图片，数组格式
                {
                    "alt": "图片",
                    "src": img_url, //原图地址
                }
            ]
        };
        layer.photos({
            photos: json,
            closeBtn: 1, //右上角按钮，可通过配置1和2来展示，如果不显示，则closeBtn: 0
            anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
        });
    }

    /**
     * 导出文件
     */
    function exportTableData() {
        var performancesId = '[[${kylinPerformanceMisVo.performancesId}]]'.replaceAll("\"", "")
        var url = prefix + '/performance/export?performanceId=' + performancesId;
        window.location.href = url; // 直接触发下载
    }
</script>
</body>
</html>
