<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">

<head>
    <th:block th:include="include :: header('财务导出')"/>
    <th:block th:include="include :: datetimepicker-css"/>
</head>
<style>
    td {
        horiz-align: center;
        text-align: left;
        padding: 10px;
    }

</style>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <div class="col-sm-12 search-collapse">
        <form id="formId">
            <div class="select-list">
                <ul>
                    <li>
                        <label>搜索类型：</label>
                        <select id="type" name="type">
                            <option value="0">请选择</option>
                            <option value="1">商品[订单时间]</option>
                            <option value="2">演出[订单时间]</option>
                            <option value="3">演出[演出id]</option>
                            <option value="4">演出[演出时间]</option>
                            <option value="5">会员[订单时间]</option>
                        </select>
                    </li>
                    <li>
                        <label>演出id：</label>
                        <input id="performanceId" type="text" name="performanceId"/>
                    </li>
                    <li>
                        <div class="form-group">
                            <label>时间范围：</label>
                            <input type="text" style="width: 200px;float: left"
                                   class="form-control" id="startTime" placeholder="开始时间选择" name="timeStart"/>
                            <span class="control-label"
                                  style="float: left;margin-left: 10px;margin-right: 10px"> - </span>
                            <input type="text" style="width: 200px;float: left"
                                   class="form-control" id="endTime" placeholder="结束时间选择" name="timeEnd"/>
                        </div>
                    </li>
                    <li>
                        <a class="btn btn-primary btn-rounded btn-sm" onclick="searchExport()"><i
                                class="fa fa-search"></i>导出</a>
                    </li>
                </ul>
            </div>
        </form>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>

<script th:inline="javascript">
    var prefix = ctx + "tools/export";

    $("input[name='timeStart']").datetimepicker({
        format: "yyyy-mm-dd hh:ii:ss",
        autoclose: true
    });

    $("input[name='timeEnd']").datetimepicker({
        format: "yyyy-mm-dd hh:ii:ss",
        autoclose: true
    });

    function searchExport() {
        var type = document.getElementById("type").value;
        var performanceId = document.getElementById("performanceId").value;
        var st = document.getElementById("startTime").value;
        var et = document.getElementById("endTime").value;
        if (type == 0) {
            alert("请选择导出类型");
        } else if (type == 1) {//商品导出逻辑
            if (st == "" || et == "") {
                alert("请选择时间范围");
            }
        } else if (type == 2) {//商品导出逻辑
            if (st == "" || et == "") {
                alert("请选择时间范围");
            }
        } else if (type == 4) {//商品导出逻辑
            if (st == "" || et == "") {
                alert("请选择时间范围");
            }
        } else if (type == 5) {//商品导出逻辑
            if (st == "" || et == "") {
                alert("请选择时间范围");
            }
        } else if (type == 3) {//演出导出逻辑
            if (performanceId == "") {
                alert("演出id不能为空");
            }
        }
        // $.ajax({
        //     url: prefix + "/platform/basicServices/alOss/upload",//路径是你控制器中上传图片的方法，下面controller里面我会写到
        //     data: formData,
        //     cache: false,
        //     contentType: false,
        //     processData: false,
        //     type: 'POST',
        //     success: function (res) {
        //     }
        // });
    }
</script>
</body>
</html>
