puzhibing
2024-02-05 640ff18d2d7f4be02ddb7f8f75e899f05545eb98
cloud-server-management/src/main/webapp/WEB-INF/view/system/tSite/TSite_add.html
@@ -49,35 +49,16 @@
        <div class="form-horizontal" id="carInfoForm">
            <input hidden id="role" value="${role}">
            @if(objectType==1){
            <div class="form-group" id="provinceCode">
                <label class="col-sm-3 control-label">*所在省:</label>
                <div class="col-sm-9">
                    <select style="width: 300px" class="form-control" id="pCode" name="pCode" onchange="TSite.oneChange(2)">
                        <option style="width: 300px" value="">选择省</option>
                        @for(obj in province){
                        <option style="width: 300px" value="${obj}">${obj}</option>
            <div class="form-group" >
                <label class="col-sm-3 control-label">*所属运营商:</label>
                <div class="col-sm-8">
                    <select style="width: 300px" class="form-control" id="yys" name="yys" onchange="TSite.oneChangeYys(this)">
                        <option style="width: 300px" value="">选择运营商</option>
                        @for(obj in yysList){
                        <option style="width: 300px" value="${obj.id}">${obj.name}</option>
                        @}
                    </select>
                </div>
            </div>
            @}
            @if(objectType==1){
            <div class="form-group" id="cityCode">
                <label class="col-sm-3 control-label">*所在市:</label>
                <div class="col-sm-9">
                    <select style="width: 300px" class="form-control" id="cCode" name="cCode" onchange="TSite.oneChangeNext(this)">
                        <option value="">请先选择省</option>
                    </select>
                </div>
            </div>
            @}
            @if(objectType==1){
            <div class="form-group" >
                <label class="col-sm-3 control-label">*所属账号:</label>
                <div class="col-sm-9">
                    <select style="width: 300px" class="form-control" id="account" name="account">
                        <option value="">请先选择省/市</option>
                    </select>
                    <input type="checkbox" value="0" name="pt" onchange="TSite.oneChangeYys(this)">平台</input>
                </div>
            </div>
            @}
@@ -85,12 +66,18 @@
                <label class="col-sm-3 control-label">*所属门店:</label>
                <div class="col-sm-9">
                    <select style="width: 300px" class="form-control" id="store" name="store"  >
                        <option disabled selected value="">请选择门店</option>
                        @if(objectType!=1){
                            @for(obj in stores){
                            <option style="width: 300px" value="${obj.id}">${obj.name}</option>
                            @}
                        @for(obj in stores){
                        <option style="width: 300px" value="${obj.id}">${obj.name}</option>
                        @}
                    </select>
                </div>
            </div>
            <div class="form-group" >
                <label class="col-sm-3 control-label">*场地类型:</label>
                <div class="col-sm-9">
                    <select style="width: 300px" class="form-control" id="siteTypeOne" name = "typeId" onchange="updateTime1()">
                        <option value="普通场地">普通场地</option>
                        <option value="智慧场地">智慧场地</option>
                    </select>
                </div>
            </div>
@@ -104,16 +91,16 @@
                        @}
                    </select>
                </div>
            </div>
             </div>
        <#input style="width: 300px" id="name" name="*场地名称" type="text"/>
            <div class="form-group" >
                <label class="col-sm-3 control-label">*可预约时间段:</label>
                <!-- <input style="width: 300px" class="form-control"  type="time">-->
                <div class="col-sm-9"  style="display: flex">
                    <input style="width: 136px;" value="开始时间" id="start-time" class="form-control" type="time">
                    <input style="width: 136px;" value="开始时间" id="start-time" class="form-control" type="time" >
                    <span style="margin-top: 7px">&nbsp;&nbsp;至&nbsp;&nbsp;</span>
                    <input style="width: 136px;" value="结束时间" id="end-time" class="form-control" type="time">
                    <input style="width: 136px;" value="结束时间" id="end-time" class="form-control" type="time" >
                </div>
            </div>
@@ -121,7 +108,7 @@
                <label class="col-sm-3 control-label">*现金价格:</label>
                <div class="col-sm-9" style="display: flex;">
                    <input style="width: 300px" class="form-control" id="cashPrice" name="playPaiCoin" placeholder="请输入价格" type="text">
                    <span style="margin-left: 5px;margin-top: 5px">元/半小时</span>
                    <span style="margin-left: 5px;margin-top: 5px" id="priceLabel3">元/半小时</span>
                </div>
            </div>
@@ -129,10 +116,44 @@
                <label class="col-sm-3 control-label">*玩湃币价格:</label>
                <div class="col-sm-9" style="display: flex;">
                    <input style="width: 300px" class="form-control" id="playPaiCoin" name="playPaiCoin" placeholder="请输入价格" type="text">
                    <span style="margin-left: 5px;margin-top: 5px">币/半小时</span>
                    <span style="margin-left: 5px;margin-top: 5px" id="priceLabel4">币/半小时</span>
                </div>
            </div>
            <div class="form-group" id="siteMore" style=" margin-left: 255px;">
                <div class="form-group">多场地配置:<i class="fa fa-plus" onclick="addBox()"></i></div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">是否可预定半场:</label>
                <div class="col-sm-9">
                    <input type="radio" name="ishalf" value="2" checked  onclick="updateHalf(1)"> 否
                    <input type="radio" name="ishalf" value="1" onclick="updateHalf(2)"> 是
                </div>
            </div>
            <div id="halfCode" hidden>
                <div class="form-group" style="margin-left: 100px;" >
                    <label class="col-sm-3 control-label">*现金价格:</label>
                    <div class="col-sm-9" style="display: flex;">
                        <input style="width: 300px" class="form-control" id="cashPriceOne" name="playPaiCoin" placeholder="请输入价格" type="text">
                        <span  id="priceLabel"  style="margin-left: 5px;margin-top: 5px">元/半小时</span>
                    </div>
                </div>
                <div class="form-group" style="margin-left: 100px;">
                    <label class="col-sm-3 control-label">*玩湃币价格:</label>
                    <div class="col-sm-9" style="display: flex;">
                        <input style="width: 300px" class="form-control" id="playPaiCoinOne" name="playPaiCoin" placeholder="请输入价格" type="text">
                        <span id="priceLabel1"  style="margin-left: 5px;margin-top: 5px">币/半小时</span>
                    </div>
                </div>
                <div class="form-group"  id="halfName" >
                    <label class="col-sm-3 control-label">*半场名称:</label>
                    <div class="col-sm-8" style="display: flex;">
                        <input style="width: 240px" class="form-control"  name="name2"  type="text"><i class="fa fa-plus" onclick="addBox1()" style="margin-left: 32px;margin-top: 10px;"></i>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">*场地责任险有效期:</label>
                <div class="col-sm-9">
@@ -151,7 +172,6 @@
                            <button class="btn btn-outline btn-success" type="file" onclick="UploadFileFn()"><i class="fa fa-upload"></i>上传文件</button>
                        </div>
                    </div>
                @if(objectType==1){
                <div class="row" id="app1">
                        <div class="form-group">
                            <label class="col-sm-3 control-label head-scu-label">*实景图片(请上传不超过五张图片): </label>
@@ -172,9 +192,14 @@
                        </div>
                    </div>
                </div>
                @}
                <#input style="width: 300px" id="ids" name="*添加闸机:" placeholder="请输入闸机ID" type="text"/>
                @if(objectType==1){
                <#input style="width: 300px" id="name" name="*添加闸机:" placeholder="请输入闸机ID" type="text"/>
                <div class="form-group"   style=" margin-left: 17%;" >
                    <label class="col-sm-1 control-label">场地说明:</label>
                    <div class="col-sm-5">
                        <textarea type="text/plain" id="editor"  style="height: 300px;width: 800px;"></textarea>
                    </div>
                </div>
                @}
<div class="row btn-group-m-t">
    <div class="col-sm-10 col-sm-offset-5" >
@@ -194,7 +219,110 @@
<script src="${ctxPath}/js/vue/vue.js"></script>
<script src="${ctxPath}/js/elementui/index.js"></script>
<link rel="stylesheet" href="${ctxPath}/js/elementui/index.css">
<link href="http://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css" rel="stylesheet" />
<script src="http://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js"></script>
<script>
    $(document).ready(function() {
        $('#yys').select2({
            width: '300px',
            placeholder: '选择运营商',
            allowClear: true,
            minimumResultsForSearch: 1 // To disable the search box, set this value to Infinity
        });
    });
    var vue2 = new Vue({
        el: '#app1',
        props: {
            // 数量限制
            limit: {
                type: Number,
                default: 2
            },
        },
        data: {
            autoUpload: true,//自动上传
            imageUrl1: '',//模型数据,用于上传图片完成后图片预览
            dialogVisible: false
        },
        methods: {
            handleAvatarSuccess(res, file) {
                TSite.goodsPicArray.push(file);
            },
            beforeAvatarUpload(file) {
                const isLt2M = file.size / 1024 / 1024 < 10;
                if (!isLt2M) {
                    this.$message.error('上传图片大小不能超过 10MB!');
                }
                return isLt2M;
            },
            handleRemove(file, fileList) {
                TSite.goodsPicArray = TSite.goodsPicArray.filter(item => {
                    return item.uid != file.uid;
                });
            },
        },
        created() {
        },
    });
    laydate.render({
        elem: '#start-time', type: "time", format: "HH:mm", ready: formatminutes
    });
    laydate.render({
        elem: '#end-time'
        , type: "time", format: "HH:mm", ready: formatminutes
    });
    function addBox() {
            var a="     <div class=\"col-sm-8 control-label\" id=\"far\">\n" +
                "                        <label class=\"col-sm-2 control-label\">*单个场地名</label>\n" +
                "                        <div class=\"col-sm-3\">\n" +
                "                            <input type=\"text\"  name=\"name1\"  class=\"form-control newWidth\" />&nbsp;\n" +
                "                        </div>  \n" +
                "                        <div class=\"col-sm-1\">\n" +
                "                            <i class=\"col-sm-1 fa fa-remove\" onclick=\"delBox(this)\" style=\"margin-top:10px\"></i>\n" +
                "                        </div>  \n" +
                "                    </div> "
        $("#siteMore").append($(a))
    }
    function addBox1() {
            var a="     <div class=\"col-sm-8 control-label\" id=\"far\" style=\"margin-left: 210px;\">\n" +
                "                        <label class=\"col-sm-2 control-label\">*半场名称:</label>\n" +
                "                        <div class=\"col-sm-3\">\n" +
                "                            <input type=\"text\"  name=\"name2\"  class=\"form-control newWidth\"  style=\"margin-left: 8px;width: 240px;\"/>&nbsp;\n" +
                "                        </div>  \n" +
                "                        <div class=\"col-sm-1\">\n" +
                "                            <i class=\"col-sm-1 fa fa-remove\" onclick=\"delBox(this)\" style=\"margin-top:10px\"></i>\n" +
                "                        </div>  \n" +
                "                    </div> "
        $("#halfName").append($(a))
    }
    function delBox(o) {
        $(o).parent("div").parent("div").remove()
    }
    function updateHalf(e) {
        if(e==1){
            $("#halfCode").hide()
        }else {
            $("#halfCode").show()
        }
    }
    var vue2 = new Vue({
        el: '#app1',
        props: {
@@ -243,5 +371,86 @@
            endTime.disabled = true;
        }
    });
    function updateTime1() {
        var selectedValue = document.getElementById("siteTypeOne").value;
        var priceLabel = document.getElementById("priceLabel");
        var priceLabel1 = document.getElementById("priceLabel1");
        var priceLabel3 = document.getElementById("priceLabel3");
        var priceLabel4 = document.getElementById("priceLabel4");
        if (selectedValue === "智慧场地") {
            console.log("=============智慧场地=")
            priceLabel.innerText = "元/15分钟";
            priceLabel1.innerText = "元/15分钟";
            priceLabel3.innerText = "元/15分钟";
            priceLabel4.innerText = "元/15分钟";
        } else {
            priceLabel.innerText = "元/半小时";
            priceLabel1.innerText = "元/半小时";
            priceLabel3.innerText = "元/半小时";
            priceLabel4.innerText = "元/半小时";
        }
        $("#end-time").val('');
        $("#start-time").val('');
    }
    function updateTime(e) {
        let one = $("#siteTypeOne").val()
        var timeInputs = document.querySelectorAll('input[type="time"]');
        console.log(timeInputs)
                var selectedTime='';
                if(e==1){
                    var selectedTime = $("#start-time").val();
                }else {
                    var selectedTime = $("#end-time").val();
                }
                var hour = selectedTime.split(':')[0];
                var minute = selectedTime.split(':')[1];
                if(one=="普通场地"){
                    console.log(
                        one
                    )
                    if (minute < 30 &&minute>0) {
                        minute = '30';
                    } else if (minute >30) {
                        hour++;
                        minute = '00';
                        if (hour<10){
                            hour = '0'+hour;
                        }
                    }
                }else {
                    console.log(
                        one,minute
                    )
                    if (minute <= 15 && minute>0) {
                        console.log(1)
                        minute = '15';
                    }else if(minute<=30){
                        console.log(2)
                        minute = '30';
                    }else if(minute<=45){
                        console.log(3)
                        minute = '45';
                    }else if (minute >45) {
                        console.log(4)
                        hour++;
                        minute = '00';
                        if (hour<10){
                            hour = '0'+hour;
                        }
                    }
                }
                if(e==1){
                    $("#start-time").val(hour + ':' + minute)
                }else {
                    $("#end-time").val(hour + ':' + minute)
                }
    }
</script>
@}