From c31f9914a85889bbe090d907ed53cc7a2fdcf8b6 Mon Sep 17 00:00:00 2001
From: 44323 <443237572@qq.com>
Date: 星期四, 28 十二月 2023 10:41:53 +0800
Subject: [PATCH] 11.27,9
---
cloud-server-management/src/main/webapp/static/modular/system/tSite/tSite.js | 364 +++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 307 insertions(+), 57 deletions(-)
diff --git a/cloud-server-management/src/main/webapp/static/modular/system/tSite/tSite.js b/cloud-server-management/src/main/webapp/static/modular/system/tSite/tSite.js
index 3c90189..5251cd8 100644
--- a/cloud-server-management/src/main/webapp/static/modular/system/tSite/tSite.js
+++ b/cloud-server-management/src/main/webapp/static/modular/system/tSite/tSite.js
@@ -21,21 +21,31 @@
TSite.initColumn = function () {
return [
{field: 'selectItem', checkbox: true},
- {title: '主键ID', field: 'id', visible: false, align: 'center', valign: 'middle'},
- {title: '省', field: 'province', visible: objectType==1?true:false, align: 'center', valign: 'middle',width:'20%',
+ {title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'},
+ {
+ title: '所属运营商', field: 'operator', visible: objectType==3?false:true, align: 'center', valign: 'middle',
+ formatter: function(value, row, index) {
+ if (!value || value.trim() === '' || value.trim() === 0) {
+ return '平台';
+ } else {
+ return value;
+ }
+ }
},
- {title: '市', field: 'city', visible: objectType==1?true:false, align: 'center', valign: 'middle',
+ {
+ title: '省', field: 'province', visible: objectType === 1 ? true : false, align: 'center', valign: 'middle', width: '20%',
+ },
+ {
+ title: '市', field: 'city', visible: objectType === 1 ? true : false, align: 'center', valign: 'middle',
},
{title: '门店名称', field: 'storeName', visible: true, align: 'center', valign: 'middle'},
- {title: '场地类型', field: 'siteTypeName', visible: true, align: 'center', valign: 'middle',
- },
- {title: '场地名称', field: 'name', visible: true, align: 'center', valign: 'middle',
- },
- {title: '场地责任险有效期', field: 'insuranceEndTime', visible: true, align: 'center', valign: 'middle',
- },
- {title: '状态', field: 'state', visible: true, align: 'center', valign: 'middle',
- formatter:function (data) {
- return {1:"上架中",2:"下架中"}[data]
+ {title: '场地类型', field: 'siteTypeName', visible: true, align: 'center', valign: 'middle'},
+ {title: '场地名称', field: 'name', visible: true, align: 'center', valign: 'middle'},
+ {title: '场地责任险有效期', field: 'insuranceEndTime', visible: true, align: 'center', valign: 'middle'},
+ {
+ title: '状态', field: 'state', visible: true, align: 'center', valign: 'middle',
+ formatter: function(data) {
+ return {1: '上架中', 2: '下架中'}[data];
}
}
];
@@ -159,6 +169,53 @@
ajax.set("province",oneId);
ajax.start();
};
+TSite.oneChangeYys = function(e){
+
+ var oneId;
+
+ var checkbox = document.querySelector('input[name="pt"]');
+ if (checkbox.checked) {
+ oneId=0;
+ console.log("选中是平台");
+ } else {
+ oneId = $("#yys").val();
+ console.log("运营商");
+ }
+ var ajax = new $ax(Feng.ctxPath + "/tSite/getChangeOne", function(data){
+ if(data!=null){
+ // var content1 = '<option value="0">平台</option>';
+ if (oneId == 0) {
+ console.log("锁住")
+ $("#yys").prop('disabled', true);
+ }else{
+ console.log("放开")
+ $("#yys").prop('disabled', false);
+ }
+
+ console.log("看看返回数据")
+ console.log(data)
+ var content='<option value="">选择门店</option>';
+ $.each(data, function(k,v) {
+ content += "<option value='"+v.id+"'>"+v.name+"</option>";
+ });
+ $("#store").empty().append(content);
+ }
+ });
+
+ if (typeof(oneId) == "undefined"){
+ console.log("===============")
+ oneId = $("#yys").val()
+ var button = document.getElementById("yys");
+ button.removeAttribute("disabled");
+
+ }
+
+ ajax.set("oneId",oneId);
+ ajax.start();
+
+
+
+};
// 场地管理首页 选择对应的省市
// 传1是场地管理首页 传2是场地管理添加页面
TSite.oneChange = function (e) {
@@ -178,10 +235,8 @@
}
});
}
-
var province = $('#pCode option:selected').text();
var val = $('#pCode option:selected').val();
-
var citySelect = document.getElementById("cCode");
var accountSelect = document.getElementById("account");
var storeSelect = document.getElementById("store");
@@ -194,22 +249,45 @@
$("#cCode").empty().append(content);
}
});
- if (val === ""){
- citySelect.innerHTML = '<option value="">请先选择省</option>';
-
- }
- if (e===2){
- accountSelect.innerHTML = '<option value="">请先选择省/市</option>';
- storeSelect.innerHTML = '<option value="">请先选择省/市</option>';
- }
- if (val === ""){
- startTime.disabled = true;
- endTime.disabled = true;
- }
+ // if (val === ""){
+ // citySelect.innerHTML = '<option value="">请先选择省</option>';
+ //
+ // }
+ // if (e===2){
+ // accountSelect.innerHTML = '<option value="">请先选择省/市</option>';
+ // storeSelect.innerHTML = '<option value="">请先选择省/市</option>';
+ // }
+ // if (val === ""){
+ // startTime.disabled = true;
+ // endTime.disabled = true;
+ // }
ajax.set("province",province);
ajax.start();
};
+
+
+
+TSite.oneChange1 = function (e) {
+ console.log(111)
+ var oneId=$(e).val();
+ var ajax = new $ax(Feng.ctxPath + "/tCompetition/onChange", function(data){
+ if(data!=null){
+
+ var content='<option value="">选择市</option>';
+
+ $.each(data, function(k,v) {
+ content += "<option value='"+v.code+"'>"+v.name+"</option>";
+ });
+ $("#cCode").empty().append(content);
+ }
+ });
+ ajax.set("oneId",oneId);
+ ajax.start();
+}
+
+
+
TSite.oneChangeNext = function (e) {
var startTime = document.getElementById('start-time');
@@ -341,7 +419,6 @@
var em = "";// 门店经营结束时间:分钟
TSite.addSubmit = function(){
-
var data = {
province:"",
city:"",
@@ -355,7 +432,18 @@
insuranceEndTime:"",
name:"",
insuranceImg:"",
- managementPlan:""
+ managementPlan:"",
+ operatorId:"",
+ typeName:"",
+ nextName:"",
+ ishalf:"",
+ cashPriceOne:"",
+ playPaiCoinOne:"",
+ halfName:"",
+ introduce:"",
+ imgs:"",
+ introduce:"",
+ ids:""
};
data.province = $("#pCode").val()
data.city = $("#cCode").val()
@@ -370,29 +458,184 @@
data.name = $("#name").val()
data.insuranceImg = $("#img").val()
data.managementPlan = $('#courseVideo').val()
+ data.typeName = $('#siteTypeOne').val()
var sh =data.appointmentStartTime.split(':')[0];
var sm =data.appointmentStartTime.split(':')[1];
var eh =data.appointmentEndTime.split(':')[0];
var em =data.appointmentEndTime.split(':')[1];
- if($("#pCode").val()==''){
- Feng.info("请选择省")
+
+ console.log(data.typeName)
+
+
+ if (data.typeName === "智慧场地"){
+ console.log("===========这是智慧球场")
+
+ console.log("====="+data.appointmentStartTime)
+
+ var value = data.appointmentStartTime;
+ var lastTwoDigits = value.slice(-2);
+
+ if (lastTwoDigits === "00" || lastTwoDigits === "15" || lastTwoDigits === "30" || lastTwoDigits === "45") {
+ console.log("Last two digits are 00, 15, 30, or 45");
+ } else {
+ Feng.error("智慧场地的可预约时间段是15分钟的倍数")
+ return;
+
+ }
+
+
+ var value1 = data.appointmentEndTime;
+ var lastTwoDigits1 = value1.slice(-2);
+
+ if (lastTwoDigits1 === "00" || lastTwoDigits1 === "15" || lastTwoDigits1 === "30" || lastTwoDigits1 === "45") {
+ console.log("Last two digits are 00, 15, 30, or 45");
+ } else {
+ Feng.error("智慧场地的可预约时间段是15分钟的倍数")
+ return;
+
+ }
+
+
+ }else {
+ console.log("===========这是普通球场")
+
+ console.log("====="+data.appointmentStartTime)
+ var value = data.appointmentStartTime;
+ var lastTwoDigits = value.slice(-2);
+
+ if (lastTwoDigits === "00" || lastTwoDigits === "30" ) {
+ console.log("Last two digits are 00, 15, 30, or 45");
+ } else {
+ Feng.info("普通场地可预约时间段需是30分钟的倍数")
+ return;
+ }
+
+
+ var value1 = data.appointmentEndTime;
+ var lastTwoDigits1 = value1.slice(-2);
+
+ if (lastTwoDigits1 === "00"|| lastTwoDigits1 === "30" ) {
+ console.log("Last two digits are 00, 15, 30, or 45");
+ } else {
+ Feng.info("普通场地可预约时间段需是30分钟的倍数")
+ return;
+
+ }
+
+
+
+ }
+
+ var SelectValue="";
+ var getSelectValueMenbers = $("input[name='pt']:checked").each(function(j) {
+ if (j >= 0) {
+ SelectValue += $(this).val()
+ }
+ });
+ if(SelectValue==''){
+ let yys = $("#yys").val()
+ if(yys==""){
+ Feng.info("请选择运营商")
+ return;
+ }
+ SelectValue= yys
+ }
+ data.operatorId= SelectValue;
+
+
+
+ let num24 = $('input[name="name1"]');
+ var nextName="";
+ for (let i = 0; i < num24.length; i++) {
+ if($(num24[i]).val()==''){
+ Feng.info("请填写场地名称")
+ return;
+ }
+ if(i==num24.length-1){
+ nextName += $(num24[i]).val()
+ }else {
+ nextName += $(num24[i]).val()+","
+ }
+ }
+ data.nextName= nextName;
+
+
+ var ishalf= $("input[name='ishalf']:checked").val();
+ data.ishalf= ishalf;
+ var halfName="";
+ if(ishalf==1){
+ let cashPriceOne = $("#cashPriceOne").val()
+ if(cashPriceOne=='' ){
+ Feng.info("请填写现金价格")
+ return;
+ }
+ data.cashPriceOne= cashPriceOne;
+
+ let playPaiCoinOne = $("#playPaiCoinOne").val()
+ if(playPaiCoinOne=='' ){
+ Feng.info("请填写玩湃币价格")
+ return;
+ }
+
+ data.playPaiCoinOne= playPaiCoinOne;
+ let num2 = $('input[name="name2"]');
+ for (let i = 0; i < num2.length; i++) {
+ if($(num2[i]).val()==''){
+ Feng.info("请填写半场名称")
+ return;
+ }
+ if(i==num2.length-1){
+ halfName += $(num2[i]).val()
+ }else {
+ halfName += $(num2[i]).val()+","
+ }
+ }
+ }
+
+
+ data.halfName= halfName;
+ data.ids= $("#ids").val();
+ let introduce ;
+ if (objectType==1){
+ introduce = TSite.editor.getContent();
+ }
+
+ console.log(introduce)
+ if(introduce==""){
+ Feng.info("请输入公告内容")
return;
}
- if($("#cCode").val()==''){
- Feng.info("请选择市")
- return;
+ data.introduce= introduce;
+
+
+ var goodImgs = this.goodsPicArray;
+ if(objectType==1){
+ if(goodImgs.length==0){
+ Feng.info("请上传实景图")
+ return;
+ }
}
- if($("#account").val()=='' ){
- Feng.info("请选择账号")
- return;
+
+ var imgOne ="";
+ for (let i = 0; i <goodImgs.length; i++) {
+ if(i==goodImgs.length-1){
+ imgOne += (goodImgs[i].response)
+ }else {
+ imgOne+=(goodImgs[i].response+",")
+ }
+
}
+ data.imgs = imgOne
+
+
+
if($("#store").val()=='' ){
Feng.info("请选择门店")
return;
}
if($("#siteTypeId").val()=='' ){
- Feng.info("请选择场地类型")
+ Feng.info("请选择场地分类")
return;
}
if($("#name").val()==''){
@@ -419,7 +662,6 @@
Feng.info("请输入场地责任险有效期")
return;
}
-
if($("#img").val()==''){
Feng.info("请上传场地责任有效期图片")
return;
@@ -495,8 +737,9 @@
data: JSON.stringify(data),
contentType: "application/json",
success: function (response) {
+ window.parent.TSite.table.refresh();
+ TSite.close();
Feng.success("添加成功");
- TSite.search();
},
error: function (xhr, status, error) {
Feng.error("添加失败!" + error);
@@ -520,6 +763,9 @@
queryData['name'] = $("#name").val();
// 门店名称
queryData['storeName'] = $("#storeName").val();
+ queryData['opId'] = $("#opId").val();
+ queryData['storeName'] = $("#storeName").val();
+
TSite.table.refresh({query: queryData});
};
@@ -532,6 +778,8 @@
$("#siteTypeId").val("");
$("#name").val("");
$("#insuranceEndTime").val("");
+ $("#opId").val("");
+ $("#storeName").val("");
TSite.search();
};
@@ -540,25 +788,27 @@
}
$(function () {
+ //初始化编辑器
+ TSite.editor = UE.getEditor('editor');
// 限制分钟选项为 0 和 30
- var timeInputs = document.querySelectorAll('input[type="time"]');
- timeInputs.forEach(function(input) {
- input.addEventListener('change', function() {
- var selectedTime = input.value;
- var hour = selectedTime.split(':')[0];
- var minute = selectedTime.split(':')[1];
- if (minute < 30 &&minute>0) {
- minute = '30';
- } else if (minute >30) {
- hour++;
- minute = '00';
- if (hour<10){
- hour = '0'+hour;
- }
- }
- input.value = hour + ':' + minute;
- });
- });
+ // var timeInputs = document.querySelectorAll('input[type="time"]');
+ // timeInputs.forEach(function(input) {
+ // input.addEventListener('change', function() {
+ // var selectedTime = input.value;
+ // var hour = selectedTime.split(':')[0];
+ // var minute = selectedTime.split(':')[1];
+ // if (minute < 30 &&minute>0) {
+ // minute = '30';
+ // } else if (minute >30) {
+ // hour++;
+ // minute = '00';
+ // if (hour<10){
+ // hour = '0'+hour;
+ // }
+ // }
+ // input.value = hour + ':' + minute;
+ // });
+ // });
var defaultColunms = TSite.initColumn();
--
Gitblit v1.7.1