| | |
| | | TSiteInfo.close = function() { |
| | | parent.layer.close(window.parent.TSite.layerIndex); |
| | | } |
| | | |
| | | /** |
| | | * 下一步:切换到价格配置 |
| | | */ |
| | | TSiteInfo.nextStep = function() { |
| | | var siteName = $("#name").val(); |
| | | var isHalf = $("input[name='ishalf']:checked").val() || 2; |
| | | |
| | | // 验证场地名称 |
| | | if (!siteName) { |
| | | Feng.error("请输入场地名称!"); |
| | | return; |
| | | } |
| | | |
| | | // 收集子场地名称 |
| | | var nextNames = []; |
| | | $("input[name='name1']").each(function() { |
| | | var val = $(this).val(); |
| | | if (val) { |
| | | nextNames.push(val); |
| | | } |
| | | }); |
| | | |
| | | // 收集半场名称 |
| | | var halfNames = []; |
| | | $("input[name='name2']").each(function() { |
| | | var val = $(this).val(); |
| | | if (val) { |
| | | halfNames.push(val); |
| | | } |
| | | }); |
| | | |
| | | // 保存信息到全局变量 |
| | | TSiteInfo.priceConfig = { |
| | | siteName: siteName, |
| | | isHalf: isHalf, |
| | | nextNames: nextNames, |
| | | halfNames: halfNames, |
| | | timeSlots: [], |
| | | priceData: {} |
| | | }; |
| | | |
| | | // 显示场地信息 |
| | | $("#display_site_name").text(siteName); |
| | | if (nextNames.length > 0) { |
| | | $("#display_next_names").html(" | <strong>子场地:</strong>" + nextNames.join('、')); |
| | | } |
| | | if (isHalf == 1 && halfNames.length > 0) { |
| | | $("#display_half_names").html(" | <strong>半场:</strong>" + halfNames.join('、')); |
| | | } |
| | | |
| | | // 切换步骤 |
| | | $("#step1_basic_info").removeClass('active'); |
| | | $("#step2_price_config").addClass('active'); |
| | | |
| | | // 初始化价格配置 |
| | | TSiteInfo.initPriceConfig(); |
| | | |
| | | // 滚动到顶部 |
| | | $('html, body').animate({scrollTop: 0}, 300); |
| | | } |
| | | |
| | | /** |
| | | * 上一步:返回基本信息 |
| | | */ |
| | | TSiteInfo.previousStep = function() { |
| | | $("#step2_price_config").removeClass('active'); |
| | | $("#step1_basic_info").addClass('active'); |
| | | |
| | | // 滚动到顶部 |
| | | $('html, body').animate({scrollTop: 0}, 300); |
| | | } |
| | | |
| | | /** |
| | | * 初始化价格配置 |
| | | */ |
| | | TSiteInfo.initPriceConfig = function() { |
| | | // 监听人群选择 |
| | | $("#audience_booking, #audience_walkin").off('change').on('change', function() { |
| | | TSiteInfo.updateAudienceUI(); |
| | | }); |
| | | |
| | | // 清空价格表 |
| | | $("#booking_price_tbody").empty(); |
| | | $("#walkin_price_tbody").empty(); |
| | | |
| | | // 初始化计数器 |
| | | TSiteInfo.bookingRowIndex = 0; |
| | | TSiteInfo.walkinRowIndex = 0; |
| | | |
| | | // 生成表头 |
| | | TSiteInfo.buildTableHeaders(); |
| | | |
| | | // 更新界面 |
| | | TSiteInfo.updateAudienceUI(); |
| | | |
| | | // 初始化是否可预定半场状态 |
| | | var isHalf = TSiteInfo.priceConfig.isHalf; |
| | | if (isHalf == 1) { |
| | | $("input[name='ishalf_step2'][value='1']").prop('checked', true); |
| | | $("#halfCode_step2").show(); |
| | | } else { |
| | | $("input[name='ishalf_step2'][value='2']").prop('checked', true); |
| | | $("#halfCode_step2").hide(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 添加场地名 |
| | | */ |
| | | TSiteInfo.addFieldBox = function() { |
| | | var html = '<div class="field-item">' + |
| | | '<label>*单个场地名</label>' + |
| | | '<input type="text" name="name1_step2" class="form-control" style="flex:1;margin-right:10px;" placeholder="请输入场地名"/>' + |
| | | '<i class="fa fa-remove btn-remove" onclick="TSiteInfo.removeFieldBox(this)"></i>' + |
| | | '</div>'; |
| | | $("#field_container").append(html); |
| | | } |
| | | |
| | | /** |
| | | * 删除场地名 |
| | | */ |
| | | TSiteInfo.removeFieldBox = function(btn) { |
| | | $(btn).closest('.field-item').remove(); |
| | | } |
| | | |
| | | /** |
| | | * 添加半场名称 |
| | | */ |
| | | TSiteInfo.addHalfFieldBox = function() { |
| | | var html = '<div class="field-item">' + |
| | | '<label>*半场名称</label>' + |
| | | '<input type="text" name="name2_step2" class="form-control" style="flex:1;margin-right:10px;" placeholder="请输入半场名称"/>' + |
| | | '<i class="fa fa-remove btn-remove" onclick="TSiteInfo.removeHalfFieldBox(this)"></i>' + |
| | | '</div>'; |
| | | $("#half_field_container").append(html); |
| | | } |
| | | |
| | | /** |
| | | * 删除半场名称 |
| | | */ |
| | | TSiteInfo.removeHalfFieldBox = function(btn) { |
| | | $(btn).closest('.field-item').remove(); |
| | | } |
| | | |
| | | /** |
| | | * 更新半场字段显示 |
| | | */ |
| | | TSiteInfo.updateHalfField = function(value) { |
| | | if (value == 1) { |
| | | $("#halfCode_step2").show(); |
| | | // 更新isHalf并重新生成表头 |
| | | TSiteInfo.priceConfig.isHalf = 1; |
| | | } else { |
| | | $("#halfCode_step2").hide(); |
| | | TSiteInfo.priceConfig.isHalf = 2; |
| | | } |
| | | // 重新生成表头 |
| | | TSiteInfo.buildTableHeaders(); |
| | | } |
| | | |
| | | /** |
| | | * 更新人群相关UI |
| | | */ |
| | | TSiteInfo.updateAudienceUI = function() { |
| | | var bookingChecked = $("#audience_booking").is(':checked'); |
| | | var walkinChecked = $("#audience_walkin").is(':checked'); |
| | | |
| | | // 显示/隐藏订场表格 |
| | | if (bookingChecked) { |
| | | $("#booking_section").show(); |
| | | } else { |
| | | $("#booking_section").hide(); |
| | | } |
| | | |
| | | // 显示/隐藏散客表格和容纳散客数 |
| | | if (walkinChecked) { |
| | | $("#walkin_section").show(); |
| | | $("#walkin_capacity_group").show(); |
| | | } else { |
| | | $("#walkin_section").hide(); |
| | | $("#walkin_capacity_group").hide(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 构建表头 |
| | | */ |
| | | TSiteInfo.buildTableHeaders = function() { |
| | | var isHalf = TSiteInfo.priceConfig.isHalf; |
| | | |
| | | var headerHtml = '<tr>' + |
| | | '<th rowspan="3" width="120">时段开始</th>' + |
| | | '<th rowspan="3" width="120">时段结束</th>'; |
| | | |
| | | // 周一到周日的表头 |
| | | var weekDays = ['周一', '周二', '周三', '周四', '周五', '周六', '周日']; |
| | | |
| | | if (isHalf == 1) { |
| | | // 如果可预订半场,每天有4列(全场×2 + 半场×2) |
| | | for (var i = 0; i < weekDays.length; i++) { |
| | | headerHtml += '<th colspan="4">' + weekDays[i] + '</th>'; |
| | | } |
| | | headerHtml += '<th rowspan="3" width="80">操作</th>' + |
| | | '</tr>' + |
| | | '<tr>'; |
| | | |
| | | // 第二行:全场/半场 |
| | | for (var i = 0; i < weekDays.length; i++) { |
| | | headerHtml += '<th colspan="2">全场</th>' + |
| | | '<th colspan="2">半场</th>'; |
| | | } |
| | | headerHtml += '</tr>' + |
| | | '<tr>'; |
| | | |
| | | // 第三行:现金/玩湃币 |
| | | for (var i = 0; i < weekDays.length; i++) { |
| | | headerHtml += '<th width="80">现金</th>' + |
| | | '<th width="80">玩湃币</th>' + |
| | | '<th width="80">现金</th>' + |
| | | '<th width="80">玩湃币</th>'; |
| | | } |
| | | } else { |
| | | // 如果不可预订半场,每天有2列(全场×2) |
| | | for (var i = 0; i < weekDays.length; i++) { |
| | | headerHtml += '<th colspan="2">' + weekDays[i] + '</th>'; |
| | | } |
| | | headerHtml += '<th rowspan="3" width="80">操作</th>' + |
| | | '</tr>' + |
| | | '<tr>'; |
| | | |
| | | // 第二行:全场 |
| | | for (var i = 0; i < weekDays.length; i++) { |
| | | headerHtml += '<th colspan="2">全场</th>'; |
| | | } |
| | | headerHtml += '</tr>' + |
| | | '<tr>'; |
| | | |
| | | // 第三行:现金/玩湃币 |
| | | for (var i = 0; i < weekDays.length; i++) { |
| | | headerHtml += '<th width="80">现金</th>' + |
| | | '<th width="80">玩湃币</th>'; |
| | | } |
| | | } |
| | | |
| | | headerHtml += '</tr>'; |
| | | |
| | | // 设置表头 |
| | | $("#booking_thead").html(headerHtml); |
| | | $("#walkin_thead").html(headerHtml); |
| | | } |
| | | |
| | | /** |
| | | * 添加订场时段 |
| | | */ |
| | | TSiteInfo.addBookingTimeSlot = function() { |
| | | var isHalf = TSiteInfo.priceConfig.isHalf; |
| | | var index = TSiteInfo.bookingRowIndex++; |
| | | |
| | | var html = '<tr data-index="' + index + '">' + |
| | | '<td><input type="time" class="form-control" id="booking_start_' + index + '" value="09:00"></td>' + |
| | | '<td><input type="time" class="form-control" id="booking_end_' + index + '" value="10:00"></td>'; |
| | | |
| | | // 周一到周日,每天的价格输入框 |
| | | for (var day = 1; day <= 7; day++) { |
| | | if (isHalf == 1) { |
| | | // 全场现金、全场玩湃币、半场现金、半场玩湃币 |
| | | html += '<td><input type="number" class="form-control price-input" id="booking_' + index + '_' + day + '_full_cash" min="0" step="0.01" placeholder="0"></td>' + |
| | | '<td><input type="number" class="form-control price-input" id="booking_' + index + '_' + day + '_full_coin" min="0" step="0.01" placeholder="0"></td>' + |
| | | '<td><input type="number" class="form-control price-input" id="booking_' + index + '_' + day + '_half_cash" min="0" step="0.01" placeholder="0"></td>' + |
| | | '<td><input type="number" class="form-control price-input" id="booking_' + index + '_' + day + '_half_coin" min="0" step="0.01" placeholder="0"></td>'; |
| | | } else { |
| | | // 全场现金、全场玩湃币 |
| | | html += '<td><input type="number" class="form-control price-input" id="booking_' + index + '_' + day + '_full_cash" min="0" step="0.01" placeholder="0"></td>' + |
| | | '<td><input type="number" class="form-control price-input" id="booking_' + index + '_' + day + '_full_coin" min="0" step="0.01" placeholder="0"></td>'; |
| | | } |
| | | } |
| | | |
| | | html += '<td><button type="button" class="btn btn-sm btn-danger" onclick="TSiteInfo.removeTimeSlot(this)"><i class="fa fa-trash"></i></button></td>' + |
| | | '</tr>'; |
| | | |
| | | $("#booking_price_tbody").append(html); |
| | | } |
| | | |
| | | /** |
| | | * 添加散客时段 |
| | | */ |
| | | TSiteInfo.addWalkinTimeSlot = function() { |
| | | var isHalf = TSiteInfo.priceConfig.isHalf; |
| | | var index = TSiteInfo.walkinRowIndex++; |
| | | |
| | | var html = '<tr data-index="' + index + '">' + |
| | | '<td><input type="time" class="form-control" id="walkin_start_' + index + '" value="09:00"></td>' + |
| | | '<td><input type="time" class="form-control" id="walkin_end_' + index + '" value="10:00"></td>'; |
| | | |
| | | // 周一到周日,每天的价格输入框 |
| | | for (var day = 1; day <= 7; day++) { |
| | | if (isHalf == 1) { |
| | | // 全场现金、全场玩湃币、半场现金、半场玩湃币 |
| | | html += '<td><input type="number" class="form-control price-input" id="walkin_' + index + '_' + day + '_full_cash" min="0" step="0.01" placeholder="0"></td>' + |
| | | '<td><input type="number" class="form-control price-input" id="walkin_' + index + '_' + day + '_full_coin" min="0" step="0.01" placeholder="0"></td>' + |
| | | '<td><input type="number" class="form-control price-input" id="walkin_' + index + '_' + day + '_half_cash" min="0" step="0.01" placeholder="0"></td>' + |
| | | '<td><input type="number" class="form-control price-input" id="walkin_' + index + '_' + day + '_half_coin" min="0" step="0.01" placeholder="0"></td>'; |
| | | } else { |
| | | // 全场现金、全场玩湃币 |
| | | html += '<td><input type="number" class="form-control price-input" id="walkin_' + index + '_' + day + '_full_cash" min="0" step="0.01" placeholder="0"></td>' + |
| | | '<td><input type="number" class="form-control price-input" id="walkin_' + index + '_' + day + '_full_coin" min="0" step="0.01" placeholder="0"></td>'; |
| | | } |
| | | } |
| | | |
| | | html += '<td><button type="button" class="btn btn-sm btn-danger" onclick="TSiteInfo.removeTimeSlot(this)"><i class="fa fa-trash"></i></button></td>' + |
| | | '</tr>'; |
| | | |
| | | $("#walkin_price_tbody").append(html); |
| | | } |
| | | |
| | | /** |
| | | * 删除时段 |
| | | */ |
| | | TSiteInfo.removeTimeSlot = function(btn) { |
| | | $(btn).closest('tr').remove(); |
| | | } |
| | | |
| | | /** |
| | | * 检查时段是否重叠 |
| | | */ |
| | | TSiteInfo.checkTimeOverlap = function(start1, end1, start2, end2) { |
| | | // 将时间字符串转换为分钟数便于比较 |
| | | var toMinutes = function(time) { |
| | | var parts = time.split(':'); |
| | | return parseInt(parts[0]) * 60 + parseInt(parts[1]); |
| | | }; |
| | | |
| | | var s1 = toMinutes(start1); |
| | | var e1 = toMinutes(end1); |
| | | var s2 = toMinutes(start2); |
| | | var e2 = toMinutes(end2); |
| | | |
| | | // 检查重叠:时段1的结束时间 > 时段2的开始时间 且 时段1的开始时间 < 时段2的结束时间 |
| | | return (e1 > s2 && s1 < e2); |
| | | } |
| | | |
| | | /** |
| | | * 验证订场和散客时段不重叠 |
| | | */ |
| | | TSiteInfo.validateNoTimeOverlap = function() { |
| | | var bookingTimeSlots = []; |
| | | var walkinTimeSlots = []; |
| | | |
| | | // 收集订场时段 |
| | | $("#booking_price_tbody tr").each(function() { |
| | | var index = $(this).data('index'); |
| | | var startTime = $("#booking_start_" + index).val(); |
| | | var endTime = $("#booking_end_" + index).val(); |
| | | if (startTime && endTime) { |
| | | bookingTimeSlots.push({start: startTime, end: endTime}); |
| | | } |
| | | }); |
| | | |
| | | // 收集散客时段 |
| | | $("#walkin_price_tbody tr").each(function() { |
| | | var index = $(this).data('index'); |
| | | var startTime = $("#walkin_start_" + index).val(); |
| | | var endTime = $("#walkin_end_" + index).val(); |
| | | if (startTime && endTime) { |
| | | walkinTimeSlots.push({start: startTime, end: endTime}); |
| | | } |
| | | }); |
| | | |
| | | // 检查订场时段之间是否重叠 |
| | | for (var i = 0; i < bookingTimeSlots.length; i++) { |
| | | for (var j = i + 1; j < bookingTimeSlots.length; j++) { |
| | | if (TSiteInfo.checkTimeOverlap( |
| | | bookingTimeSlots[i].start, bookingTimeSlots[i].end, |
| | | bookingTimeSlots[j].start, bookingTimeSlots[j].end |
| | | )) { |
| | | Feng.error("订场价格表中存在重叠的时段:" + |
| | | bookingTimeSlots[i].start + "-" + bookingTimeSlots[i].end + " 与 " + |
| | | bookingTimeSlots[j].start + "-" + bookingTimeSlots[j].end); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 检查散客时段之间是否重叠 |
| | | for (var i = 0; i < walkinTimeSlots.length; i++) { |
| | | for (var j = i + 1; j < walkinTimeSlots.length; j++) { |
| | | if (TSiteInfo.checkTimeOverlap( |
| | | walkinTimeSlots[i].start, walkinTimeSlots[i].end, |
| | | walkinTimeSlots[j].start, walkinTimeSlots[j].end |
| | | )) { |
| | | Feng.error("散客价格表中存在重叠的时段:" + |
| | | walkinTimeSlots[i].start + "-" + walkinTimeSlots[i].end + " 与 " + |
| | | walkinTimeSlots[j].start + "-" + walkinTimeSlots[j].end); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 保存价格配置 |
| | | */ |
| | | TSiteInfo.savePriceConfig = function() { |
| | | // 验证人群选择 |
| | | var bookingChecked = $("#audience_booking").is(':checked'); |
| | | var walkinChecked = $("#audience_walkin").is(':checked'); |
| | | |
| | | if (!bookingChecked && !walkinChecked) { |
| | | Feng.error("请至少选择一种面向人群!"); |
| | | return; |
| | | } |
| | | |
| | | // 验证容纳散客数 |
| | | if (walkinChecked) { |
| | | var walkinCapacity = parseInt($("#walkin_capacity").val()); |
| | | if (!walkinCapacity || walkinCapacity <= 0) { |
| | | Feng.error("请输入有效的容纳散客数!"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | // 验证时段不重叠 |
| | | if (!TSiteInfo.validateNoTimeOverlap()) { |
| | | return; |
| | | } |
| | | |
| | | // 收集价格数据 |
| | | var priceDetails = TSiteInfo.collectPriceData(); |
| | | |
| | | if (priceDetails.length === 0) { |
| | | Feng.error("请至少添加一个时段并填写价格!"); |
| | | return; |
| | | } |
| | | |
| | | var siteId = $("#siteId").val(); |
| | | if (!siteId) { |
| | | Feng.error("场地ID不存在,请先保存场地基本信息!"); |
| | | return; |
| | | } |
| | | |
| | | // 收集场地配置 |
| | | var nextNames = []; |
| | | $("input[name='name1_step2']").each(function() { |
| | | var val = $(this).val(); |
| | | if (val) { |
| | | nextNames.push(val); |
| | | } |
| | | }); |
| | | |
| | | var halfNames = []; |
| | | $("input[name='name2_step2']").each(function() { |
| | | var val = $(this).val(); |
| | | if (val) { |
| | | halfNames.push(val); |
| | | } |
| | | }); |
| | | |
| | | var isHalf = $("input[name='ishalf_step2']:checked").val(); |
| | | |
| | | // 构建提交数据 |
| | | var targetAudience = []; |
| | | if (bookingChecked) targetAudience.push('1'); |
| | | if (walkinChecked) targetAudience.push('2'); |
| | | |
| | | var data = { |
| | | siteId: parseInt(siteId), |
| | | targetAudience: targetAudience.join(','), |
| | | walkinCapacity: walkinChecked ? parseInt($("#walkin_capacity").val()) : 0, |
| | | nextName: nextNames.join(','), |
| | | halfName: halfNames.join(','), |
| | | isHalf: parseInt(isHalf), |
| | | priceDetails: priceDetails |
| | | }; |
| | | |
| | | // 确认提交 |
| | | layer.confirm('确定要保存价格配置吗?', { |
| | | btn: ['确定', '取消'] |
| | | }, function(index) { |
| | | layer.close(index); |
| | | |
| | | // 提交到后端 |
| | | $.ajax({ |
| | | url: Feng.ctxPath + "/tSite/savePriceConfig", |
| | | type: "POST", |
| | | data: JSON.stringify(data), |
| | | contentType: "application/json", |
| | | success: function(response) { |
| | | Feng.success("价格配置保存成功!"); |
| | | // 刷新列表 |
| | | if (window.parent.TSite && window.parent.TSite.table) { |
| | | window.parent.TSite.table.refresh(); |
| | | } |
| | | // 关闭页面 |
| | | setTimeout(function() { |
| | | TSiteInfo.close(); |
| | | }, 1500); |
| | | }, |
| | | error: function(xhr, status, error) { |
| | | var errorMsg = "保存失败"; |
| | | if (xhr.responseJSON && xhr.responseJSON.message) { |
| | | errorMsg = xhr.responseJSON.message; |
| | | } |
| | | Feng.error(errorMsg); |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 收集价格数据 |
| | | */ |
| | | TSiteInfo.collectPriceData = function() { |
| | | var priceDetails = []; |
| | | var isHalf = TSiteInfo.priceConfig.isHalf; |
| | | var bookingChecked = $("#audience_booking").is(':checked'); |
| | | var walkinChecked = $("#audience_walkin").is(':checked'); |
| | | |
| | | // 收集订场价格 |
| | | if (bookingChecked) { |
| | | $("#booking_price_tbody tr").each(function() { |
| | | var index = $(this).data('index'); |
| | | var startTime = $("#booking_start_" + index).val(); |
| | | var endTime = $("#booking_end_" + index).val(); |
| | | |
| | | // 验证时段 |
| | | if (!startTime || !endTime) { |
| | | Feng.error("订场价格配置中存在空的时段!"); |
| | | return false; |
| | | } |
| | | |
| | | if (startTime >= endTime) { |
| | | Feng.error("订场价格配置中,结束时间必须大于开始时间!"); |
| | | return false; |
| | | } |
| | | |
| | | // 遍历周一到周日 |
| | | for (var day = 1; day <= 7; day++) { |
| | | var fullCash = parseFloat($("#booking_" + index + "_" + day + "_full_cash").val() || 0); |
| | | var fullCoin = parseFloat($("#booking_" + index + "_" + day + "_full_coin").val() || 0); |
| | | |
| | | // 全场价格 |
| | | if (fullCash > 0 || fullCoin > 0) { |
| | | priceDetails.push({ |
| | | startTime: startTime, |
| | | endTime: endTime, |
| | | dayOfWeek: day, |
| | | targetAudience: 1, |
| | | fieldType: 'full', |
| | | cashPrice: fullCash, |
| | | coinPrice: fullCoin |
| | | }); |
| | | } |
| | | |
| | | // 半场价格(如果可预订半场) |
| | | if (isHalf == 1) { |
| | | var halfCash = parseFloat($("#booking_" + index + "_" + day + "_half_cash").val() || 0); |
| | | var halfCoin = parseFloat($("#booking_" + index + "_" + day + "_half_coin").val() || 0); |
| | | |
| | | if (halfCash > 0 || halfCoin > 0) { |
| | | priceDetails.push({ |
| | | startTime: startTime, |
| | | endTime: endTime, |
| | | dayOfWeek: day, |
| | | targetAudience: 1, |
| | | fieldType: 'half', |
| | | cashPrice: halfCash, |
| | | coinPrice: halfCoin |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 收集散客价格 |
| | | if (walkinChecked) { |
| | | $("#walkin_price_tbody tr").each(function() { |
| | | var index = $(this).data('index'); |
| | | var startTime = $("#walkin_start_" + index).val(); |
| | | var endTime = $("#walkin_end_" + index).val(); |
| | | |
| | | // 验证时段 |
| | | if (!startTime || !endTime) { |
| | | Feng.error("散客价格配置中存在空的时段!"); |
| | | return false; |
| | | } |
| | | |
| | | if (startTime >= endTime) { |
| | | Feng.error("散客价格配置中,结束时间必须大于开始时间!"); |
| | | return false; |
| | | } |
| | | |
| | | // 遍历周一到周日 |
| | | for (var day = 1; day <= 7; day++) { |
| | | var fullCash = parseFloat($("#walkin_" + index + "_" + day + "_full_cash").val() || 0); |
| | | var fullCoin = parseFloat($("#walkin_" + index + "_" + day + "_full_coin").val() || 0); |
| | | |
| | | // 全场价格 |
| | | if (fullCash > 0 || fullCoin > 0) { |
| | | priceDetails.push({ |
| | | startTime: startTime, |
| | | endTime: endTime, |
| | | dayOfWeek: day, |
| | | targetAudience: 2, |
| | | fieldType: 'full', |
| | | cashPrice: fullCash, |
| | | coinPrice: fullCoin |
| | | }); |
| | | } |
| | | |
| | | // 半场价格(如果可预订半场) |
| | | if (isHalf == 1) { |
| | | var halfCash = parseFloat($("#walkin_" + index + "_" + day + "_half_cash").val() || 0); |
| | | var halfCoin = parseFloat($("#walkin_" + index + "_" + day + "_half_coin").val() || 0); |
| | | |
| | | if (halfCash > 0 || halfCoin > 0) { |
| | | priceDetails.push({ |
| | | startTime: startTime, |
| | | endTime: endTime, |
| | | dayOfWeek: day, |
| | | targetAudience: 2, |
| | | fieldType: 'half', |
| | | cashPrice: halfCash, |
| | | coinPrice: halfCoin |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | return priceDetails; |
| | | } |
| | | |
| | | function UploadFileFn(){ |
| | | $('#upFile').click(); |
| | | } |