|
- //Author:fuhc
- //Date:20160919
- //
-
- var baseHTML = '';
- var childHTML = '';
- var firstDate = '';
- var d1 = "";
- var d2 = "";
- var d3 = "";
- var d4 = "";
- var d5 = "";
- var d6 = "";
- var d7 = "";
- var w1 = "";
- var w2 = "";
- var w3 = "";
- var w4 = "";
- var w5 = "";
- var w6 = "";
- var w7 = "";
-
- // 房型售卖状态
- var room_sale_status = "1";
- //基础房型关键字
- var base_room_type = '';
- var hotel_id = '';
- var hotel_name = '';
- var page_size = '5';
- var start_date = getPar('start_date');
- var qudao_least = 0;
- var date_flag = 0;
-
- $(document).ready(function () {
- $('#Wdate2').val(getDateTime(0));
- $('#Wdate3').val(getDateByDay(7, getDateTime(0)));
- baseHTML = $('.base').prop('outerHTML');
- childHTML = $('.child').prop('outerHTML');
- hotel_name = getPar('hotel_name');
- hotel_id = getPar('hotel_id');
-
- $("#lookLog").attr('go_path', 'zz-jd/hotel_log.html?hotel_id='+ hotel_id);
- if (hotel_name != "") {
- $('#hotel_name').text(hotel_name);
- }
- $('#channel_hotel_id').attr('href', 'channel_room_info.html?hotel_id=' + hotel_id + '&hotel_name=' + hotel_name + '');
- $('#room_order').attr('go_path', 'hotel/hotel/hotel-room-order?HOTEL_ID=' + hotel_id + '');
- // 设置tb_top_td
- setTbTopTd();
- // http
- current = localStorage.getItem('current') == null ? 1 : localStorage.getItem('current');
- getDataFromHttp();
- playPermission();
- $("#channel_room_link").attr('go_path', 'zz-jd/channel_room_info.html?channel_id=' + 669 + '&hotel_id=' + hotel_id + '&hotel_name=' + hotel_name);
-
- });
-
-
- $(document).ready(function () {
- // 今天
- $('#today').bind('click', function () {
- d1 = getDateTime(0);
- setTbTopTd();
- getDataFromHttp();
- });
- // 前7天
- $('#before7').bind('click', function () {
- d1 = getDateByDay(-7, d1);
- setTbTopTd();
- getDataFromHttp();
- });
- // 后7天
- $('#after7').bind('click', function () {
- d1 = getDateByDay(7, d1);
- setTbTopTd();
- getDataFromHttp();
- });
- // 售卖状态
- $('#sale_status').bind('change', function () {
- room_sale_status = $(this).val();
- });
- // 售卖状态
- $('#base_room_type').bind('change', function () {
- base_room_type = $(this).val();
- });
- //点击搜索
- $('#search').bind('click', function () {
- d1 = $('.Wdate').val();
- // 设置tb_top_td
- setTbTopTd();
- if (d1 != "") {
- // http
- current = 1;
- getDataFromHttp();
- }
-
- });
- // 新增房型
- $('#newAddRoom').bind('click', function () {
- var listURL = "add_room_type.html?hotel_id=" + hotel_id + "&hotel_name=" + hotel_name;
- listURL = encodeURI(listURL);
- $.cookie("path_url", cookie_path + "zz-jd/" + listURL, {domain: domain_path});
- window.open(system_path);
- //window.open(listURL);
- });
- // 点击保存
- $('.save_base').bind('click', function () {
- var childIndex = $temp_bday.attr('childIndex');
- var _td_date = $('.tb_title').children().eq(childIndex).attr('f_date');
- $('#base_price').val('-1');
- var _room_type = $temp_bday.parent().attr('data-room-type');
- var _hotel_id = hotel_id;
- var maiduan_count = $('#maiduan_count').val();
- var baoliu_count = $('#baoliu_count').val();
- var xianxun_count = $('#xianxun_count').val();
- var maiduan_cstr = "{" + _room_type + ",\"" + _td_date + "\",\"" + _td_date + "\"," + '2345671' + "," + '228' + "," + maiduan_count + "}";
- var xianxun_cstr = "{" + _room_type + ",\"" + _td_date + "\",\"" + _td_date + "\"," + '2345671' + "," + '229' + "," + xianxun_count + "}";
- var baoliu_cstr = "{" + _room_type + ",\"" + _td_date + "\",\"" + _td_date + "\"," + '2345671' + "," + '230' + "," + baoliu_count + "}";
- baoliu_cstr = baoliu_count === '' ? '' : baoliu_cstr;
- maiduan_cstr = maiduan_count === '' ? '' : maiduan_cstr;
- xianxun_cstr = xianxun_count === '' ? '' : xianxun_cstr;
- var cstr = baoliu_cstr + maiduan_cstr + xianxun_cstr;
- if (maiduan_count < 0 || baoliu_count < 0 || xianxun_count < 0) {
-
- ZZAlertInfo('库存数量请填写大于等于0的整数!', function () {
- })
- return;
- }
- if (cstr === '') {
- ZZAlertInfo('请完整填写库存数量,没有则填写0,至少一个不为空!', function () {
- })
- return;
- }
- if (parseInt(maiduan_count) + parseInt(baoliu_count) < qudao_least) {
- ZZAlertInfo('买断加保留数量不能小于渠道保底房间数!', function () {
- })
- return;
- }
- var urlapi = base_api;
- var param = {
- type: "room_base_SetBaseRoom",
- op: "AddBaseRoom",
- hotel_id: _hotel_id,
- room_info: cstr
- };
- ZZLog(urlapi + JSON.stringify(param));
- $(".save_base").html('保存中');
- loading();
- // $('.save_child').css('background-color', 'darkgray !important'); //不知道什么原因,不起作用
- $('.save_base').attr('style', 'cursor: pointer;background: darkgray!important;color: white;margin-left:26px;padding: 10px 20px;')
- $.post(urlapi, param, function (res_data) {
- res_data = JSON.parse(res_data);
- ZZLog(res_data);
- if (res_data['code'] != "0") {
- alert(res_data['info']);
- } else {
- clickMask();
- getDataFromHttp();
- }
- $(".save_base").html('保存');
- $('.save_base').attr('style', 'cursor: pointer;background: #428bca!important;color: white;margin-left:26px;padding: 10px 20px;');
- closeLoading();
- })
- })
- $('.save_child').bind('click', function () {
- var childIndex = $temp_cday.attr('childIndex');
- var _td_date = $('.tb_title').children().eq(childIndex).attr('f_date');
- var _child_maiduan_price = $("#child_maiduan_price").val();
- var _child_baoliu_price = $("#child_baoliu_price").val();
- var _child_xianxun_price = $("#child_xianxun_price").val();
- var _parent_room_type = $temp_cday.parent().attr('data-parent-room-type');
- var _room_type = $temp_cday.parent().attr('data-room-type');
- var _hotel_id = hotel_id;
- var _run_status = $('input[name="status"]:checked').val();
- if (_run_status == '') {
- ZZAlertInfo('请选择房态', function () {
- return;
- })
- }
- if (_child_maiduan_price == '' && _child_baoliu_price == '' && _child_xianxun_price == '') {
- ZZAlertInfo('请填写必要的采购价!', function () {
- return;
- })
- }
- if (isNaN(_child_maiduan_price) || isNaN(_child_baoliu_price) || isNaN(_child_xianxun_price)) {
- ZZAlertInfo('数据格式不正确');
- return;
- }
- var urlapi = base_api;
- var param = {
- type: "room_child_UpdateChildRoom",
- op: "update",
- run_status: _run_status,
- price_buyout: _child_maiduan_price,
- price_reserve: _child_baoliu_price,
- price_inquiry: _child_xianxun_price,
- run_date: _td_date,
- parent_room_type: _parent_room_type,
- room_type: _room_type,
- hotel_id: _hotel_id
- }
- ZZLog(urlapi + JSON.stringify(param));
- $(".save_child").html('保存中');
- loading();
- // $('.save_child').css('background-color', 'darkgray !important'); //不知道什么原因,不起作用
- $('.save_child').attr('style', 'cursor: pointer;background: darkgray!important;color: white;margin-left:26px;padding: 10px 20px;')
- $.post(urlapi, param, function (res_data) {
- res_data = JSON.parse(res_data);
- ZZLog(res_data);
- if (res_data['code'] != "0") {
- alert(res_data['info']);
- } else {
- clickMask();
- getDataFromHttp();
- }
- $(".save_child").html('保存');
- $('.save_child').attr('style', 'cursor: pointer;background: #428bca!important;color: white;margin-left:26px;padding: 10px 20px;');
- closeLoading();
- })
- // 房态
- })
- // 取消修改的弹框
- $('.cancel_base').bind('click', function () {
- clickMask();
- })
- $('.cancel_child').bind('click', function () {
- clickMask();
- })
- // 点击蒙板
- $('#mask').bind('click', function () {
- clickMask();
- })
-
- })
- // 新增子房型
- var cstr0 = '';
- var cstr1 = '';
- var cstr2 = '[无早]';
- var cstr3 = '';
- function appendBed(obj, bed_arr)
- {
- var bed_all_arr = new Array('不设置', '大床', '双床', '多床');
- var option = '<option value="0">不设置</option>';
- for(var i=0; i< bed_arr.length; i++)
- {
- option += '<option value="'+ bed_arr[i] +'">'+ bed_all_arr[bed_arr[i]] +'</option>';
- }
-
- if(obj.attr('has-append')== 'false')
- {
- obj.attr('has-append', 'true');
- obj.append(option);
- }
- }
- function addChild(selfOBJ) {
- $selfOBJ = $(selfOBJ);
- // var bed_all_arr = new Array('不设置', '大床', '双床', '多床');
- var room_type = $selfOBJ.parent().parent().attr('data-room-type');
- var room_name = $selfOBJ.parent().parent().children().eq(1).text().trim();
- var bed_type = $selfOBJ.parent().parent().attr('base-bed-type');
- var bed_arr = bed_type.split(',');
- var obj = $('#bed_type');
- appendBed(obj, bed_arr);
-
- /*
- var option = '<option value="0">不设置</option>';
- for(var i=0; i< bed_arr.length; i++)
- {
- option += '<option value="'+ bed_arr[i] +'">'+ bed_all_arr[bed_arr[i]] +'</option>';
- }
-
- if($('#bed_type').attr('has-append')== 'false')
- {
- $('#bed_type').attr('has-append', 'true');
- $('#bed_type').append(option);
- }
-
- if($('#modify_bed_type').attr('has-append') == 'false')
- {
- $('#modify_bed_type').attr('has-append', 'true');
- $('#modify_bed_type').append(option);
- }*/
-
- $("#div_maiduan_price").val('');
- $("#div_baoliu_price").val('');
- $("#div_xianxun_price").val('');
- ZZLog(room_name + '' + room_type);
- cstr0 = room_name;
- $('#div_room_name').text(room_name);
- $('#div_child_room_name').val(cstr0 + cstr1 + cstr2);
- $('#mask').css('background', 'black');
- $('#mask').css('opacity', '0.5');
- showCenterView('.main_style');
- }
- // 修改基础房型
- function updateBaseRoomInfo(selfOBJ) {
- localStorage.setItem('start_date', d1);
- localStorage.setItem('current', current);
- var room_type = $(selfOBJ).closest('tr').attr('data-room-type');
- var room_name = $(selfOBJ).attr('data-room-name');
- var start_date = $("#Wdate").val();
- var listURL = "modify_price_inventory.html?hotel_id=" + hotel_id + "&hotel_name=" + hotel_name + "&start_date=" + start_date + "&room_name=" + room_name + "&room_type=" + room_type;
- listURL = encodeURI(listURL);
- window.location.href = listURL;
- }
- // 选择入住人数
- function changePeople(selfOBJ) {
- var $selfOBJ = $(selfOBJ);
- var count = $selfOBJ.val();
- if (count < 100) {
- cstr1 = "(" + count + "人入住)";
- } else {
- cstr1 = '';
- }
- $('#div_child_room_name').val(cstr0 + cstr1 + cstr2);
- }
- //选择最晚预订日期
- function changeLastestBook(selfOBJ) {
- var $selfOBJ = $(selfOBJ);
- var fast = parseInt($selfOBJ.val());
- switch (fast) {
- case 0:
- fast = "";
- break;
- case 1:
- fast = "提前一天";
- break;
- case 2:
- fast = "提前二天";
- break;
- case 3:
- fast = "提前三天";
- break;
- case 4:
- fast = "提前四天";
- break;
- case 5:
- fast = "提前五天";
- break;
- case 6:
- fast = "提前六天";
- break;
- case 7:
- fast = "提前七天";
- break;
-
- }
- if (fast != "") {
- cstr3 = "[" + fast + "]";
- } else {
- cstr3 = "";
- }
- $('#div_child_room_name').val(cstr3 + cstr0 + cstr1 + cstr2);
- }
- // 选择早餐
- function changeBreakfast(selfOBJ) {
- var $selfOBJ = $(selfOBJ);
- var fast = parseInt($selfOBJ.val());
- switch (fast) {
- case 0:
- fast = "无早";
- break;
- case 1:
- fast = "单早";
- break;
- case 2:
- fast = "双早";
- break;
- case 3:
- fast = "三早";
- break;
- case 4:
- fast = "四早";
- break;
- case 5:
- fast = "五早";
- break;
- case 6:
- fast = "六早";
- break;
- case 7:
- fast = "七早";
- break;
- case 8:
- fast = "八早";
- break;
- case 9:
- fast = "九早";
- break;
- case 10 :
- fast = "十早";
- break;
- }
- cstr2 = "[" + fast + "]";
- $('#div_child_room_name').val(cstr0 + cstr1 + cstr2);
- }
- $(document).ready(function () {
- //
- $('#addChildSave').bind('click', function () {
- var _hotel_id = hotel_id;
- var _parent_room_type = $selfOBJ.parent().parent().attr('data-room-type');
-
- var _start_date = $('#Wdate2').val();
- var _end_date = $('#Wdate3').val();
- if (_start_date == "") {
- $('#Wdate2').focus();
- return;
- }
- if (_end_date == "") {
- $('#Wdate3').focus();
- return;
- }
- var _week_day = "";
- $('input[type="checkbox"][name="week"]:checked').each(function (index, domEle) {
- _week_day += $(domEle).val();
- });
- var _run_status = $('input[name="divRoom"]:checked').val();
- var _child_price_buyout = $('#div_maiduan_price').val();
- // if (_child_price_buyout == "") {
- // $('#div_maiduan_price').focus();
- // }
- var _child_price_reserve = $('#div_baoliu_price').val();
- var _child_price_inquiry = $('#div_xianxun_price').val();
- var _bed_type = $('#bed_type').val();
-
- _child_price_buyout = _child_price_buyout == '' ? -1 : _child_price_buyout;
- _child_price_reserve = _child_price_reserve == '' ? -1 : _child_price_reserve;
- _child_price_inquiry = _child_price_inquiry == '' ? -1 : _child_price_inquiry;
- var _people_count = $('#checkInCount').val();
- var _breakfast = $('#divBreakfast').val();
- if ($('#lastest_book_day_new').val() == -1) {
- var _lastest_book_time = -1;
- } else if ($('#lastest_book_day_new').val() == -2) {
- var _lastest_book_time = -2;
- } else {
- var _lastest_book_time = $('#lastest_book_day_new').val() + ',' + $('#lastest_book_date_new').val() + ':' + $('#lastest_book_time_new').val();
- }
- var _child_room_name = $('#div_child_room_name').val();
- if (_child_price_buyout == '' && _child_price_reserve == '' && _child_price_inquiry == '') {
- ZZAlertInfo('采购价不能全部为空');
- return false;
- } else if (_child_price_buyout == -1 && _child_price_reserve == -1 && _child_price_inquiry == -1) {
- ZZAlertInfo('采购价不能全部为0');
- return false;
- }
- if (_child_room_name == "") {
- ZZAlertInfo('子房型名称不能为空');
- return false;
- }
- if ($('#lastest_cancel_day_new').val() != -1) {
- var _lastest_cancel_day = $('#lastest_cancel_day_new').val() + ',' + $('#lastest_cancel_day_new1').val() + ':' + $('#lastest_cancel_day_new2').val();
- } else {
- var _lastest_cancel_day = -1;
- }
- var neibubs = $('#new_neibu').val();
-
- // var urlapi=base_api+"?type=room_AddChildRoom&hotel_id="+_hotel_id+
- // "&parent_room_type="+_parent_room_type+"&start_date="+_start_date+
- // "&end_date="+_end_date+"&week_day="+_week_day+"&run_status="+_run_status+
- // "&base_price="+_child_base_price+"&person_limit="+_people_count+
- // "&breakfast="+_breakfast+"&room_name="+_child_room_name;
- var urlapi = base_api;
- var param = {
- type: "room_child_AddChildRoom",
- hotel_id: _hotel_id,
- parent_room_type: _parent_room_type,
- start_date: _start_date,
- end_date: _end_date,
- week_day: _week_day,
- run_status: _run_status,
- price_buyout: _child_price_buyout,
- price_reserve: _child_price_reserve,
- price_inquiry: _child_price_inquiry,
- person_limit: _people_count,
- breakfast: _breakfast,
- room_name: _child_room_name,
- lastest_book_time: _lastest_book_time,
- lastest_cancel_day: _lastest_cancel_day,
- neibubs: neibubs,
- bed_type: _bed_type
- };
- ZZLog(urlapi + JSON.stringify(param));
- loading();
- $.ajax({
- url: urlapi,
- data: param,
- type: "post",
- dataType: "json",
- success: function (res_data) {
- ZZLog(res_data);
- if (res_data['code'] != "0") {
- alert(res_data['info']);
- } else {
- // 将弹出层隐藏
- clickMask();
- // 刷新数据
- getDataFromHttp();
- }
- closeLoading();
- },
- error: function (error) {
- alert('服务器异常,请联系管理员');
- ZZLog(error);
- closeLoading();
- }
- })
- })
- })
- // 将目标节点居中显示
- var $tempShowView = null;
- function showCenterView(classOrIdName) {
- $('#mask').css('display', 'block');
- $('#mask').css('z-index', '15');
- $showView = $(classOrIdName);
- $tempShowView = $showView;
- $showView.css('display', 'block');
- $showView.css('position', 'absolute');
- // $showView.css('top', $(window).height() / 2.2);
- $showView.css('top', $(window).height() / 3.2);
- $showView.css('left', '50%');
- $showView.css('z-index', '20');
- $showView.css('background', 'white');
- var w = $showView.css('width');
- var h = $showView.css('height');
- w = w.substr(0, w.length - 2);
- h = h.substr(0, h.length - 2);
- $showView.css('margin-top', '-' + h / 2 + 'px');
- $showView.css('margin-left', '-' + w / 2 + 'px');
- }
- // 点击蒙板
- function clickMask() {
- if ($temp_bday) {
- $('#up_base_room').css('display', 'none');
- $temp_bday.css('background', '');
- }
- if ($temp_cday) {
- $('#up_child_room').css('display', 'none');
- $temp_cday.css('background', '');
- }
- if ($tempShowView) {
- $('.main_style').css('display', 'none');
- $tempShowView.css('background', '');
- }
- if ($tempModify) {
- $('.modify_child_room').css('display', 'none');
- $tempModify.css('background', '');
- $('#modify_bed_type').html('');
- $('#modify_bed_type').attr('has-append', 'false');
- }
- $('#mask').css('display', 'none');
- }
- // 复选框事件
- var child_true_count = 0;
- function select_checked(index, selfOBJ) {
- $selfOBJ = $(selfOBJ);
- //index=0最上面的全选 index=1表示的是下面所有的
- var top_check = $('.ace')[0];
- var checkList = $('.ace');
- var checkCount = checkList.length - 1;
- var base_count = $('.baseace').length;
-
- for (var i = 1, m = checkList.length; i < m; i++) {
- if (index == '0') {
- checkList[i].checked = top_check.checked;
- } else if (index == '1') {
- // 当前的base为选中
- var room_type = $selfOBJ.closest('.base').attr('data-room-type');
- var t = $(checkList[i]).parent().parent().parent().attr('class');
- if (t == "child" + room_type) {
- checkList[i].checked = selfOBJ.checked;
- }
- } else {
- // if(selfOBJ==checkList[i] && selfOBJ.checked){
- // child_true_count+=1;
- // }
- // var t=$selfOBJ.parent().parent().parent().attr('class');
- // var parent_room_type=t.replace('child','');
- // var child_count=$('.child'+parent_room_type).length;
- // var ttt=$('.child'+parent_room_type);
- //
- // var room_type=$(checkList[i]).parent().parent().parent().attr('data-room-type');
- // ZZLog(child_count+"<><><>"+child_true_count);
- // if(room_type==parent_room_type && child_true_count==child_count){
- // checkList[i].checked=selfOBJ.checked;
- // }
-
- }
- }
-
- }
-
- // 复选框事件
- function alterCheck(obj)
- {
- $obj = obj;
- $('.ace')[0].checked = $obj.checked;
- select_checked(0, $('.ace')[0]);
- }
-
- function getDataFromHttp() {
- var urlapi = base_api + "?type=room_RoomList&hotel_id=" + hotel_id + "&start_date=" + d1 + "&sale_status=" + room_sale_status + "¤t=" + current + "&page_size=" + page_size + "&base_room_type=" + base_room_type;
- ZZLog(urlapi);
- $.ajaxSetup({
- async: false
- });
- $.getJSON(urlapi, function (res_data) {
- ZZLog(res_data);
- if (res_data['code'] != "0") {
- alert(res_data['info']);
- } else {
- var HTML = '';
- var room_list = res_data['room_list'];
- for (var i = 0, m = room_list.length; i < m; i++) {
- var tempDict = room_list[i];
- var tempHTML = '';
- if (tempDict['parent_room_type'] == "0") {
- tempHTML = baseHTML;
- HTML += setBaseHTML(tempHTML, tempDict);
- } else {
- tempHTML = childHTML;
- HTML += setChildHTML(tempHTML, tempDict);
- }
- }
-
- if (HTML) {
- $('#room_list').html(HTML);
- $('#table').show();
- if (res_data['total'] < 1) {
- $('.pageDiv').hide();
- } else {
- $(".pageDiv").createPage({
- pageCount: res_data['total_page'],//总页数
- current: current,//当前页
- turndown: 'true',//是否显示跳转框,显示为true,不现实为false,一定记得加上引号...
- backFn: function (p) {
- current = p;
- getDataFromHttp();
- }
- });
- $('.pageDiv').show();
- }
-
-
- $('#room_list').css('display', 'table-row-group');
- // 添加好innerHTML再添加事件
- baseAddEvent();
- bdayAddEvent();
- cdayAddEvent();
-
- onOffLineAddEvent();
- saleRule();
- $('.bday').each(function (index, domEle) {
- if ($(this).attr('data-value') == "") {
- $(this).css('background', '');
- $(this).css('text-align', 'center');
- $(this).css('vertical-align', 'middle');
- $(this).html('暂无');
- }
- })
- $('.cday').each(function (index, domEle) {
- if ($(this).attr('data-value') == "||") {
- $(this).html('暂无');
- $(this).css('text-align', 'center');
- $(this).css('vertical-align', 'middle');
- $(this).css('background', '');
- }
- })
- } else {
- $('#room_list').html(HTML);
- $('#table').show();
- }
- }
- }).error(function (data) {
-
- });
- }
- // 给.base添加事件
- function baseAddEvent() {
- $('.base').each(function (index, domEle) {
- $(this).children().eq(1).bind('click', function () {
- var room_type = $(this).attr('data-room-type');
- var $childOBJ = $('.child' + room_type);
- if ($childOBJ.css('display') == 'none') {
- $(this).children().eq(0).attr('src', "images/down_arrow.png");
- $childOBJ.css('display', 'table-row');
- } else {
- $(this).children().eq(0).attr('src', "images/up_arrow.png");
- $childOBJ.css('display', 'none');
- }
- });
- })
- }
- // 给.bday添加事件
- var $temp_bday = null;
- function bdayAddEvent() {
- $('.bday').bind('click', function (e) {
- if ($(this).attr('data-value') == "") {
- return;
- }
- $('#mask').css('display', 'block');
- $('#mask').css('background', 'white');
- $('#mask').css('opacity', '0');
- if ($temp_bday != null) {
- $temp_bday.css('background', '');
- }
- if ($temp_cday != null) {
- $('#up_child_room').css('display', 'none');
- $temp_cday.css('background', '');
- }
- // var childIndex=$(this).attr('childIndex');
- // td_date=$('.tb_title').children().eq(childIndex).attr('f_date');
- // ZZLog(td_date);
- // 得到鼠标的位置
- var mouseLeft = $(this).offset().left;
- var mouseTop = $(this).offset().top;
- var td_height = parseInt($(this).css('height').replace('px', ''));
- $(this).css('background', '#ddd');
- $('#up_base_room').css('top', mouseTop + td_height + 'px');
- $('#up_base_room').css('display', 'block');
- $('#base_stock_type').val($(this).children().eq(0).attr('data-inventory-type'));
- var num1 = $(this).attr('data-count');
- num1 = num1 == '' ? 0 : num1;
- $('#qudao_baodi').text('渠道保底' + num1 + '间');
- qudao_least = $(this).attr('data-count');
- var count = $(this).attr('data-value').split('/');
- $('#maiduan_count').val(count[0]);
- $('#baoliu_count').val(count[1]);
- $('#xianxun_count').val(count[2]);
- $temp_bday = $(this);
- })
- }
- // 给.cday添加事件
- var $temp_cday = null;
- function cdayAddEvent() {
- $('.cday').bind('click', function () {
- if ($(this).attr('data-value') == "||") {
- return;
- }
- $('#mask').css('display', 'block');
- $('#mask').css('background', 'white');
- $('#mask').css('opacity', '0');
- if ($temp_cday != null) {
- $temp_cday.css('background', '');
- }
- if ($temp_bday != null) {
- $('#up_base_room').css('display', 'none');
- $temp_bday.css('background', '');
- }
- $('#up_base_room').css('display', 'none');
-
- // 得到鼠标的位置
- var mouseLeft = $(this).offset().left;
- var mouseTop = $(this).offset().top;
- var td_height = parseInt($(this).css('height').replace('px', ''));
- $(this).css('background', '#ddd');
- $('#up_child_room').css('top', mouseTop + td_height + 'px');
- $('#up_child_room').css('display', 'block');
- $('#up_child_room').attr('')
- var is_close = $(this).attr('data-close')
- $('input[name="status"][value="' + is_close + '"]').attr("checked", true);
- $('input[name="status"][value="' + is_close + '"]').prop("checked", true);
- var child_price = $(this).attr('data-value').split('|');
- ZZLog(child_price);
- //买断价
- $('#child_maiduan_price').val(child_price[0]);
- //保留价
- $('#child_baoliu_price').val(child_price[1]);
- //现询价
- $('#child_xianxun_price').val(child_price[2]);
- //已售数量
- $temp_cday = $(this);
- })
- }
- function CancelChildRoom(obj) {
- var info = '确认要删除对应的子房型吗?请谨慎操作';
- ZZConfirm(info, function () {
- var room_type = $(obj).closest('tr').attr('data-room-type');
- if (room_type == undefined) {
- alert('缺少room_type参数');
- return;
- }
- var urlapi = base_api;
- var param = {
- type: "room_child_CancelChildRoom",
- hotel_id: hotel_id,
- room_type: room_type
- }
- ZZLog(urlapi + JSON.stringify(param));
- loading();
- $.ajax({
- url: urlapi,
- type: "post",
- data: param,
- success: function (res_data) {
- res_data = JSON.parse(res_data);
- ZZLog(res_data);
- if (res_data['code'] == 0) {
- ZZAlertInfo('删除成功')
- } else {
- ZZAlertInfo(res_data['info'])
- }
-
- // 刷新数据
- getDataFromHttp();
- closeLoading();
- }
- });
- })
-
- }
- //上下线
- function onOffLineAddEvent() {
- $('.child_on_off_line').bind('click', function () {
- //1 shangxian
- //0 xiaxian
- var info = '';
- var is_onsale = $(this).attr('data-value');
- var room_type = $(this).closest('tr').attr('data-room-type');
- var parent_room_type = $(this).closest('tr').attr('data-parent-room-type');
- if (room_type == undefined) {
- alert('缺少room_type参数');
- return;
- }
- info = is_onsale == '0' ? "确定上线?" : "确定下线?";
- ZZConfirm(info, function () {
- var urlapi = base_api;
- var param = {};
- if (is_onsale == 1) {
- param = {
- type: "room_child_OffLineChildRoom",
- hotel_id: hotel_id,
- room_type: room_type,
- parent_room_type: parent_room_type
- }
- } else {
- param = {
- type: "room_child_OnLineChildRoom",
- hotel_id: hotel_id,
- room_type: room_type,
- parent_room_type: parent_room_type
- }
- }
- ZZLog(urlapi + JSON.stringify(param));
- loading();
- $.ajax({
- url: urlapi,
- type: "post",
- data: param,
- success: function (res_data) {
- ZZLog(res_data);
- // 刷新数据
- getDataFromHttp();
- closeLoading();
- }
- });
- })
- });
- }
- //销售规则
- function saleRule() {
- $('.child_sale_rule').bind('click', function () {
- localStorage.setItem('start_date', d1);
- localStorage.setItem('current', current);
- var _hotel_id = hotel_id;
- var _parent_room_type = $(this).closest('tr').attr('data-parent-room-type');
- var _room_type = $(this).closest('tr').attr('data-room-type');
- var _room_type_str = $(this).closest('tr').children().eq(1).text();
- var _start_date = $("#Wdate").val();
- var listURL = "sell_rule_main.html?hotel_id=" + _hotel_id + "&room_type_id=" + _room_type + "&room_type_name=" + _room_type_str + "&parent_room_type=" + _parent_room_type + "&start_date=" + _start_date;
- listURL = encodeURI(listURL);
- window.location.href = listURL;
- })
- }
- // 设置表格头部的td
- function setTbTopTd() {
- // 设置标题的日期和星期
- var today = getDateTime(0);
-
- // localStorage.setItem("start_date", null);
-
- if (d1 == "") {
- /*if (localStorage.getItem("start_date") != null) {
- localStorage.setItem("start_date", today);
- d1 = localStorage.getItem("start_date");
- } else {
- d1 = today;
- }*/
- d1 = today;
- }
-
- if (date_flag == 0) {
- var start_date = getPar('start_date');
- if (start_date != '')
- d1 = getDateTime(0, new Date(start_date));
- date_flag = 1;
- }
- $('#Wdate').val(d1);
- d2 = after(d1);
- d3 = after(d2);
- d4 = after(d3);
- d5 = after(d4);
- d6 = after(d5);
- d7 = after(d6);
- w1 = getWeekDay(d1);
- w2 = getWeekDay(d2);
- w3 = getWeekDay(d3);
- w4 = getWeekDay(d4);
- w5 = getWeekDay(d5);
- w6 = getWeekDay(d6);
- w7 = getWeekDay(d7);
-
- $('#f_date1').attr('f_date', d1);
- $('#f_date2').attr('f_date', d2);
- $('#f_date3').attr('f_date', d3);
- $('#f_date4').attr('f_date', d4);
- $('#f_date5').attr('f_date', d5);
- $('#f_date6').attr('f_date', d6);
- $('#f_date7').attr('f_date', d7);
-
-
- var td1 = d1.substring(5);
- var td2 = d2.substring(5);
- var td3 = d3.substring(5);
- var td4 = d4.substring(5);
- var td5 = d5.substring(5);
- var td6 = d6.substring(5);
- var td7 = d7.substring(5);
-
-
- $('#f_date1').html(td1 + "</br>" + w1);
- $('#f_date2').html(td2 + "</br>" + w2);
- $('#f_date3').html(td3 + "</br>" + w3);
- $('#f_date4').html(td4 + "</br>" + w4);
- $('#f_date5').html(td5 + "</br>" + w5);
- $('#f_date6').html(td6 + "</br>" + w6);
- $('#f_date7').html(td7 + "</br>" + w7);
- // 将日期为今天的星期设置为今天
- $('th[f_date=' + getDateTime(0) + ']').html(getDateTime(0).substring(5) + '</br>今天');
- }
- function setBaseHTML(tempHTML, tempDict) {
- var HTML = '';
- var cstr1 = '';
- var date1 = tempDict['date1'];
- var s1 = (date1['buyout_count'] == '' ? '0' : date1['buyout_count']) + '/' + (date1['reserve_count'] == '' ? '0' : date1['reserve_count']) + '/' + (date1['inquiry_count'] == '' ? '0' : date1['inquiry_count']);
- var cstr2 = '';
- var date2 = tempDict['date2'];
- var s2 = (date2['buyout_count'] == '' ? '0' : date2['buyout_count']) + '/' + (date2['reserve_count'] == '' ? '0' : date2['reserve_count']) + '/' + (date2['inquiry_count'] == '' ? '0' : date2['inquiry_count']);
- var cstr3 = '';
- var date3 = tempDict['date3'];
- var s3 = (date3['buyout_count'] == '' ? '0' : date3['buyout_count']) + '/' + (date3['reserve_count'] == '' ? '0' : date3['reserve_count']) + '/' + (date3['inquiry_count'] == '' ? '0' : date3['inquiry_count']);
- var cstr4 = '';
- var date4 = tempDict['date4'];
- var s4 = (date4['buyout_count'] == '' ? '0' : date4['buyout_count']) + '/' + (date4['reserve_count'] == '' ? '0' : date4['reserve_count']) + '/' + (date4['inquiry_count'] == '' ? '0' : date4['inquiry_count']);
- var cstr5 = '';
- var date5 = tempDict['date5'];
- var s5 = (date5['buyout_count'] == '' ? '0' : date5['buyout_count']) + '/' + (date5['reserve_count'] == '' ? '0' : date5['reserve_count']) + '/' + (date5['inquiry_count'] == '' ? '0' : date5['inquiry_count']);
- var cstr6 = '';
- var date6 = tempDict['date6'];
- var s6 = (date6['buyout_count'] == '' ? '0' : date6['buyout_count']) + '/' + (date6['reserve_count'] == '' ? '0' : date6['reserve_count']) + '/' + (date6['inquiry_count'] == '' ? '0' : date6['inquiry_count']);
- var cstr7 = '';
- var date7 = tempDict['date7'];
- var s7 = (date7['buyout_count'] == '' ? '0' : date7['buyout_count']) + '/' + (date7['reserve_count'] == '' ? '0' : date7['reserve_count']) + '/' + (date7['inquiry_count'] == '' ? '0' : date7['inquiry_count']);
- tempHTML = tempHTML.replace('[房型名称]', tempDict['room_name']);
- tempHTML = tempHTML.replace('[update-room-name]', tempDict['room_name']);
- tempHTML = tempHTML.replace('[tr-room-type]', tempDict['room_type']);
- tempHTML = tempHTML.replace('[room-type]', tempDict['room_type']);
- tempHTML = tempHTML.replace('[total-count1]', date1['remain_count']);
- tempHTML = tempHTML.replace('[total-count2]', date2['remain_count']);
- tempHTML = tempHTML.replace('[total-count3]', date3['remain_count']);
- tempHTML = tempHTML.replace('[total-count4]', date4['remain_count']);
- tempHTML = tempHTML.replace('[total-count5]', date5['remain_count']);
- tempHTML = tempHTML.replace('[total-count6]', date6['remain_count']);
- tempHTML = tempHTML.replace('[total-count7]', date7['remain_count']);
- tempHTML = tempHTML.replace('[base-bed-type]', tempDict['bed_type']);
-
- if (date1['inventory_type'] != "") {
- cstr1 =
- //'<img data-inventory-type=' + date1["inventory_type"] + ' style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + date1["inventory_type"] + '.png"/>'
- '<span>已售' + (date1['saled_count'] == '' ? '0' : date1['saled_count']) + '</span></br>'
- + '<span> </span></br>'
- + '<span>剩余' + s1 + '</span>';
- //+ '<span>采购:' + date1["base_price"] + '</span>';
-
- tempHTML = tempHTML.replace('[value1]', (date1['buyout_count'] == '' ? '0' : date1['buyout_count']) + '/' + (date1['reserve_count'] == '' ? '0' : date1['reserve_count']) + '/' + (date1['inquiry_count'] == '' ? '0' : date1['inquiry_count']));
- } else {
- tempHTML = tempHTML.replace('[value1]', "");
- }
-
- tempHTML = tempHTML.replace('[day1]', cstr1);
- if (date2['inventory_type'] != "") {
- cstr2 =
- //'<img data-inventory-type=' + date2["inventory_type"] + ' style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + date2['inventory_type'] + '.png"/>'
- '<span>已售' + (date2['saled_count'] == '' ? '0' : date2['saled_count']) + '</span></br>'
- + '<span> </span></br>'
- + '<span>剩余' + s2 + '</span>'
- //+ '<span>采购:' + date2['base_price'] + '</span>'
- ;
- tempHTML = tempHTML.replace('[value2]', (date2['buyout_count'] == '' ? '0' : date2['buyout_count']) + '/' + (date2['reserve_count'] == '' ? '0' : date2['reserve_count']) + '/' + (date2['inquiry_count'] == '' ? '0' : date2['inquiry_count']));
- } else {
- tempHTML = tempHTML.replace('[value2]', "");
- }
- tempHTML = tempHTML.replace('[day2]', cstr2);
- if (date3['inventory_type'] != "") {
- cstr3 =
- //'<img data-inventory-type=' + date3["inventory_type"] + ' style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + date3['inventory_type'] + '.png"/>'
- '<span>已售' + (date3['saled_count'] == '' ? '0' : date3['saled_count']) + '</span></br>'
- + '<span> </span></br>'
- + '<span>剩余' + s3 + '</span>'
- // + '<span>采购:' + date3['base_price'] + '</span>'
- ;
- tempHTML = tempHTML.replace('[value3]', (date3['buyout_count'] == '' ? '0' : date3['buyout_count']) + '/' + (date3['reserve_count'] == '' ? '0' : date3['reserve_count']) + '/' + (date3['inquiry_count'] == '' ? '0' : date3['inquiry_count']));
- } else {
- tempHTML = tempHTML.replace('[value3]', "");
- }
- tempHTML = tempHTML.replace('[day3]', cstr3);
- if (date4['inventory_type'] != "") {
- cstr4 =
- //'<img data-inventory-type=' + date4["inventory_type"] + ' style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + date4['inventory_type'] + '.png"/>'
- '<span>已售' + (date4['saled_count'] == '' ? '0' : date4['saled_count']) + '</span></br>'
- + '<span> </span></br>'
- + '<span>剩余' + s4 + '</span>';
- //+ '<span>采购:' + date4['base_price'] + '</span>'
-
- tempHTML = tempHTML.replace('[value4]', (date4['buyout_count'] == '' ? '0' : date4['buyout_count']) + '/' + (date4['reserve_count'] == '' ? '0' : date4['reserve_count']) + '/' + (date4['inquiry_count'] == '' ? '0' : date4['inquiry_count']));
- } else {
- tempHTML = tempHTML.replace('[value4]', "");
- }
- tempHTML = tempHTML.replace('[day4]', cstr4);
- if (date5['inventory_type'] != "") {
- cstr5 =
- //'<img data-inventory-type=' + date5["inventory_type"] + ' style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + date5['inventory_type'] + '.png"/>'
- '<span>已售' + (date5['saled_count'] == '' ? '0' : date5['saled_count']) + '</span></br>'
- + '<span> </span></br>'
- + '<span>剩余' + s5 + '</span>'
- // + '<span>采购:' + date5['base_price'] + '</span>'
- ;
- tempHTML = tempHTML.replace('[value5]', (date5['buyout_count'] == '' ? '0' : date5['buyout_count']) + '/' + (date5['reserve_count'] == '' ? '0' : date5['reserve_count']) + '/' + (date5['inquiry_count'] == '' ? '0' : date5['inquiry_count']));
- } else {
- tempHTML = tempHTML.replace('[value5]', "");
- }
- tempHTML = tempHTML.replace('[day5]', cstr5);
- if (date6['inventory_type'] != "") {
- cstr6 =
- //'<img data-inventory-type=' + date6["inventory_type"] + ' style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + date6['inventory_type'] + '.png"/>'
- '<span>已售' + (date6['saled_count'] == '' ? '0' : date6['saled_count']) + '</span></br>'
- + '<span> </span></br>'
- + '<span>剩余' + s6 + '</span>';
- //+ '<span>采购:' + date6['base_price'] + '</span>';
- tempHTML = tempHTML.replace('[value6]', (date6['buyout_count'] == '' ? '0' : date6['buyout_count']) + '/' + (date6['reserve_count'] == '' ? '0' : date6['reserve_count']) + '/' + (date6['inquiry_count'] == '' ? '0' : date6['inquiry_count']));
- } else {
- tempHTML = tempHTML.replace('[value6]', "");
- }
- tempHTML = tempHTML.replace('[day6]', cstr6);
- if (date7['inventory_type'] != "") {
- cstr7 =
- //'<img data-inventory-type=' + date7["inventory_type"] + ' style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + date7['inventory_type'] + '.png"/>'
- '<span>已售' + (date7['saled_count'] == '' ? '0' : date7['saled_count']) + '</span></br>'
- + '<span> </span></br>'
- + '<span>剩余' + s7 + '</span>'
- // + '<span>采购:' + date7['base_price'] + '</span>'
- ;
- tempHTML = tempHTML.replace('[value7]', (date7['buyout_count'] == '' ? '0' : date7['buyout_count']) + '/' + (date7['reserve_count'] == '' ? '0' : date7['reserve_count']) + '/' + (date7['inquiry_count'] == '' ? '0' : date7['inquiry_count']));
- } else {
- tempHTML = tempHTML.replace('[value7]', "");
- }
- tempHTML = tempHTML.replace('[day7]', cstr7);
- HTML += tempHTML;
- return HTML;
- }
- function setChildHTML(tempHTML, tempDict) {
- var HTML = '';
- var cstr1 = '';
- var date1 = tempDict['date1'];
- var img1 = (date1['is_closed'] == "2" || date1['is_closed'] == "0") ? "man.png" : "";
- var cstr2 = '';
- var date2 = tempDict['date2'];
- var img2 = (date2['is_closed'] == "2" || date2['is_closed'] == "0") ? "man.png" : "";
- var cstr3 = '';
- var date3 = tempDict['date3'];
- var img3 = (date3['is_closed'] == "2" || date3['is_closed'] == "0") ? "man.png" : "";
- var cstr4 = '';
- var date4 = tempDict['date4'];
- var img4 = (date4['is_closed'] == "2" || date4['is_closed'] == "0") ? "man.png" : "";
- var cstr5 = '';
- var date5 = tempDict['date5'];
- var img5 = (date5['is_closed'] == "2" || date5['is_closed'] == "0") ? "man.png" : "";
- var cstr6 = '';
- var date6 = tempDict['date6'];
- var img6 = (date6['is_closed'] == "2" || date6['is_closed'] == "0") ? "man.png" : "";
- var cstr7 = '';
- var date7 = tempDict['date7'];
- var img7 = (date7['is_closed'] == "2" || date7['is_closed'] == "0") ? "man.png" : "";
- var t_str1 = img1 != "" ? '<img style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + img1 + '"/>' : "";
- var t_str2 = img2 != "" ? '<img style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + img2 + '"/>' : "";
- var t_str3 = img3 != "" ? '<img style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + img3 + '"/>' : "";
- var t_str4 = img4 != "" ? '<img style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + img4 + '"/>' : "";
- var t_str5 = img5 != "" ? '<img style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + img5 + '"/>' : "";
- var t_str6 = img6 != "" ? '<img style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + img6 + '"/>' : "";
- var t_str7 = img7 != "" ? '<img style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + img7 + '"/>' : "";
- //子房型已售数量
- var saled1 = date1['saled_count'];
- var saled2 = date2['saled_count'];
- var saled3 = date3['saled_count'];
- var saled4 = date4['saled_count'];
- var saled5 = date5['saled_count'];
- var saled6 = date6['saled_count'];
- var saled7 = date7['saled_count'];
- //买断采购价
- var mdprice1 = date1['price_buyout'];
- //保留采购价
- var blprice1 = date1['price_reserve'];
- //现询采购价
- var xxprice1 = date1['price_inquiry'];
-
- var mdprice2 = date2['price_buyout'];
- var blprice2 = date2['price_reserve'];
- var xxprice2 = date2['price_inquiry'];
-
- var mdprice3 = date3['price_buyout'];
- var blprice3 = date3['price_reserve'];
- var xxprice3 = date3['price_inquiry'];
-
- var mdprice4 = date4['price_buyout'];
- var blprice4 = date4['price_reserve'];
- var xxprice4 = date4['price_inquiry'];
-
- var mdprice5 = date5['price_buyout'];
- var blprice5 = date5['price_reserve'];
- var xxprice5 = date5['price_inquiry'];
-
- var mdprice6 = date6['price_buyout'];
- var blprice6 = date6['price_reserve'];
- var xxprice6 = date6['price_inquiry'];
-
- var mdprice7 = date7['price_buyout'];
- var blprice7 = date7['price_reserve'];
- var xxprice7 = date7['price_inquiry'];
- var rmb = '<span style="display:inline-block;font-family:;font-family: Microsoft YaHei,STXihei,MingLiu;" microsoftyahei",stxihei,mingliu;>¥</span>';
-
-
- var showsaled1 = saled1 == '' ? '<span>已售:-</span></br>' : '<span>已售:' + saled1 + '</span></br>';
- var showsaled2 = saled2 == '' ? '<span>已售:-</span></br>' : '<span>已售:' + saled2 + '</span></br>';
- var showsaled3 = saled3 == '' ? '<span>已售:-</span></br>' : '<span>已售:' + saled3 + '</span></br>';
- var showsaled4 = saled4 == '' ? '<span>已售:-</span></br>' : '<span>已售:' + saled4 + '</span></br>';
- var showsaled5 = saled5 == '' ? '<span>已售:-</span></br>' : '<span>已售:' + saled5 + '</span></br>';
- var showsaled6 = saled6 == '' ? '<span>已售:-</span></br>' : '<span>已售:' + saled6 + '</span></br>';
- var showsaled7 = saled7 == '' ? '<span>已售:-</span></br>' : '<span>已售:' + saled7 + '</span></br>';
- var showmdprice1 = mdprice1 == '' ? '<span>买断:' + '-' + '</span></br>' : '<span>买断:' + rmb + mdprice1 + '</span></br>';
- var showmdprice2 = mdprice2 == '' ? '<span>买断:' + '-' + '</span></br>' : '<span>买断:' + rmb + mdprice2 + '</span></br>';
- var showmdprice3 = mdprice3 == '' ? '<span>买断:' + '-' + '</span></br>' : '<span>买断:' + rmb + mdprice3 + '</span></br>';
- var showmdprice4 = mdprice4 == '' ? '<span>买断:' + '-' + '</span></br>' : '<span>买断:' + rmb + mdprice4 + '</span></br>';
- var showmdprice5 = mdprice5 == '' ? '<span>买断:' + '-' + '</span></br>' : '<span>买断:' + rmb + mdprice5 + '</span></br>';
- var showmdprice6 = mdprice6 == '' ? '<span>买断:' + '-' + '</span></br>' : '<span>买断:' + rmb + mdprice6 + '</span></br>';
- var showmdprice7 = mdprice7 == '' ? '<span>买断:' + '-' + '</span></br>' : '<span>买断:' + rmb + mdprice7 + '</span></br>';
- var showblprice1 = blprice1 == '' ? '<span>保留:' + '-' + '</span></br>' : '<span>保留:' + rmb + blprice1 + '</span></br>';
- var showblprice2 = blprice2 == '' ? '<span>保留:' + '-' + '</span></br>' : '<span>保留:' + rmb + blprice2 + '</span></br>';
- var showblprice3 = blprice3 == '' ? '<span>保留:' + '-' + '</span></br>' : '<span>保留:' + rmb + blprice3 + '</span></br>';
- var showblprice4 = blprice4 == '' ? '<span>保留:' + '-' + '</span></br>' : '<span>保留:' + rmb + blprice4 + '</span></br>';
- var showblprice5 = blprice5 == '' ? '<span>保留:' + '-' + '</span></br>' : '<span>保留:' + rmb + blprice5 + '</span></br>';
- var showblprice6 = blprice6 == '' ? '<span>保留:' + '-' + '</span></br>' : '<span>保留:' + rmb + blprice6 + '</span></br>';
- var showblprice7 = blprice7 == '' ? '<span>保留:' + '-' + '</span></br>' : '<span>保留:' + rmb + blprice7 + '</span></br>';
- var showxxprice1 = xxprice1 == '' ? '<span>现询:' + '-' + '</span></br>' : '<span>现询:' + rmb + xxprice1 + '</span></br>';
- var showxxprice2 = xxprice2 == '' ? '<span>现询:' + '-' + '</span></br>' : '<span>现询:' + rmb + xxprice2 + '</span></br>';
- var showxxprice3 = xxprice3 == '' ? '<span>现询:' + '-' + '</span></br>' : '<span>现询:' + rmb + xxprice3 + '</span></br>';
- var showxxprice4 = xxprice4 == '' ? '<span>现询:' + '-' + '</span></br>' : '<span>现询:' + rmb + xxprice4 + '</span></br>';
- var showxxprice5 = xxprice5 == '' ? '<span>现询:' + '-' + '</span></br>' : '<span>现询:' + rmb + xxprice5 + '</span></br>';
- var showxxprice6 = xxprice6 == '' ? '<span>现询:' + '-' + '</span></br>' : '<span>现询:' + rmb + xxprice6 + '</span></br>';
- var showxxprice7 = xxprice7 == '' ? '<span>现询:' + '-' + '</span></br>' : '<span>现询:' + rmb + xxprice7 + '</span></br>';
-
- tempHTML = tempHTML.replace('[房型名称]', tempDict['inner_identify'] != null ? (" " + tempDict['room_name'] + '|' + tempDict['inner_identify']) : (" " + tempDict['room_name']));
- tempHTML = tempHTML.replace('[tr-room-type]', tempDict['room_type']);
- tempHTML = tempHTML.replace('[bed-type]', tempDict['bed_type']);
- tempHTML = tempHTML.replace('[room-type]', tempDict['room_type']);
- tempHTML = tempHTML.replace('[下线]', tempDict['is_onsale'] == 1 ? "下线" : "上线");
- tempHTML = tempHTML.replace('[is_onsale]', tempDict['is_onsale']);
- tempHTML = tempHTML.replace('child', "child" + tempDict['parent_room_type']);
- tempHTML = tempHTML.replace('[parent-room-type]', tempDict['parent_room_type']);
- tempHTML = tempHTML.replace('[data-room-modify-info]', tempDict['occupancy_limit'] + '|' + tempDict['breakfast_include'] + '|' + tempDict['lastest_book_time'] + '|' + tempDict['lastest_cancel_day']);
- // tempHTML = tempHTML.replace('[total-count1]', date1['price_buyout']+'|'+date1['price_reserve']+'|'+date1['price_inquiry']);
- // tempHTML = tempHTML.replace('[total-count2]', date1['price_buyout']+'|'+date1['price_reserve']+'|'+date1['price_inquiry']);
- // tempHTML = tempHTML.replace('[total-count3]', date1['price_buyout']+'|'+date1['price_reserve']+'|'+date1['price_inquiry']);
- // tempHTML = tempHTML.replace('[total-count4]', date1['price_buyout']+'|'+date1['price_reserve']+'|'+date1['price_inquiry']);
- // tempHTML = tempHTML.replace('[total-count5]', date1['price_buyout']+'|'+date1['price_reserve']+'|'+date1['price_inquiry']);
- // tempHTML = tempHTML.replace('[total-count6]', date1['price_buyout']+'|'+date1['price_reserve']+'|'+date1['price_inquiry']);
- // tempHTML = tempHTML.replace('[total-count7]', date1['price_buyout']+'|'+date1['price_reserve']+'|'+date1['price_inquiry']);
- tempHTML = tempHTML.replace('[close1]', date1['is_closed']);
- tempHTML = tempHTML.replace('[close2]', date2['is_closed']);
- tempHTML = tempHTML.replace('[close3]', date3['is_closed']);
- tempHTML = tempHTML.replace('[close4]', date4['is_closed']);
- tempHTML = tempHTML.replace('[close5]', date5['is_closed']);
- tempHTML = tempHTML.replace('[close6]', date6['is_closed']);
- tempHTML = tempHTML.replace('[close7]', date7['is_closed']);
- //第一天
- cstr1 = t_str1 + showsaled1
- + showmdprice1 + showblprice1 + showxxprice1;
- tempHTML = tempHTML.replace('[value1]', mdprice1 + '|' + blprice1 + '|' + xxprice1);
- tempHTML = tempHTML.replace('[cday1]', cstr1);
- //第二天
- cstr2 = t_str2 + showsaled2
- + showmdprice2 + showblprice2 + showxxprice2;
- tempHTML = tempHTML.replace('[value2]', mdprice2 + '|' + blprice2 + '|' + xxprice2);
- tempHTML = tempHTML.replace('[cday2]', cstr2);
- //第三天
- cstr3 = t_str3 + showsaled3
- + showmdprice3 + showblprice3 + showxxprice3;
- tempHTML = tempHTML.replace('[value3]', mdprice3 + '|' + blprice3 + '|' + xxprice3);
- tempHTML = tempHTML.replace('[cday3]', cstr3);
- //第四天
- cstr4 = t_str4 + showsaled4
- + showmdprice4 + showblprice4 + showxxprice4;
- tempHTML = tempHTML.replace('[value4]', mdprice4 + '|' + blprice4 + '|' + xxprice4);
- tempHTML = tempHTML.replace('[cday4]', cstr4);
- //第五天
- cstr5 = t_str5 + showsaled5
- + showmdprice5 + showblprice5 + showxxprice5;
- tempHTML = tempHTML.replace('[value5]', mdprice5 + '|' + blprice5 + '|' + xxprice5);
- tempHTML = tempHTML.replace('[cday5]', cstr5);
- //第六天
- cstr6 = t_str6 + showsaled6
- + showmdprice6 + showblprice6 + showxxprice6;
- tempHTML = tempHTML.replace('[value6]', mdprice6 + '|' + blprice6 + '|' + xxprice6);
- tempHTML = tempHTML.replace('[cday6]', cstr6);
- //第七天
- cstr7 = t_str7 + showsaled7
- + showmdprice7 + showblprice7 + showxxprice7;
- tempHTML = tempHTML.replace('[value7]', mdprice7 + '|' + blprice7 + '|' + xxprice7);
- tempHTML = tempHTML.replace('[cday7]', cstr7);
-
- if (tempDict['is_onsale'] == 0) {
- tempHTML = tempHTML.replace(/cday/g, 'cday bg_ccc');
- }
- HTML += tempHTML;
- return HTML;
- }
- function getRoomID() {
- localStorage.setItem('start_date', d1);
- localStorage.setItem('current', current);
- var arrids = [];
- $('.childace').each(function (index, domEle) {
- if (domEle.checked) {
- arrids.push($(this).attr('room-type'));
- }
- });
- var ids = arrids.join(",");
- if (ids == '') {
- alert('请勾选子房型');
- return
- }
- var start_date = $('#Wdate').val();
- window.location.href = "batch_modify_hotel_price.html?hotel_id=" + hotel_id + "&ids=" + ids + "&start_date=" + start_date + "&hotel_name=" + hotel_name;
- }
- function getRoomStatus() {
- var arrids = [];
- $('.childace').each(function (index, domEle) {
- if (domEle.checked) {
- arrids.push($(this).attr('room-type'));
- }
- });
- var ids = arrids.join(",");
- if (ids == '') {
- alert('请勾选子房型');
- return
- }
- var start_date = $('#Wdate').val();
- window.location.href = "batch_modify_hotel_status.html?hotel_id=" + hotel_id + "&ids=" + ids + "&start_date=" + start_date + "&hotel_name=" + hotel_name;
- }
- //修改子房型
- var $tempModify = null;
- var param = [];
- var child_room_type = '';
- var parent_room_type1 = '';
- var parent_room_name = '';
- function modifyChildRoom(obj) {
- $showView = $(obj);
- $tempModify = $showView;
- $('#mask').css('background', 'black');
- $('#mask').css('opacity', '0.5');
- showCenterView('.modify_child_room');
- var obj = $(obj);
- var neibubs = '';
- var child_room_name = obj.closest('tr').children().eq(1).text().split('|');
- if (child_room_name.length >= 2) {
- neibubs = child_room_name[1];
- }
- child_room_name = child_room_name[0];
- child_room_type = obj.closest('tr').attr('data-room-type');
- parent_room_type1 = obj.closest('tr').attr('data-parent-room-type');
- obj.closest('tr').parent().children().find('.base').attr(parent_room_type1);
- var modify_room_info = obj.closest('tr').attr('data-room-modify-info');
- var base_bed_type = obj.closest('tr').attr('bed-type'); // 获取子房型床型
- var bed_arr = new Array();
- if(base_bed_type == 0)
- {
- // 获取基础房型的床型
- bed_type = $('.base[data-room-type="'+parent_room_type1+'"]').attr('base-bed-type'); // 获取基础房型床型
- bed_arr = bed_type.split(',');
- }else {
- bed_arr[0] =base_bed_type;
- }
- var room_bed_type = $('#modify_bed_type');
- appendBed(room_bed_type, bed_arr);
- var modify_room_info_arr = modify_room_info.split('|');
- if (modify_room_info_arr[2] != 'null') {
- if (modify_room_info_arr[2] == -1) {
- var book_time = '-1,01:00'.split(',');
- } else {
- var book_time = modify_room_info_arr[2].split(',');
- }
- } else {
- var book_time = '0,01:00'.split(',');
- }
- if (modify_room_info_arr[3] != 'null') {
- if (modify_room_info_arr[3] == -1) {
- var cancel_time = '-1,01:00'.split(',');
- } else {
- var cancel_time = modify_room_info_arr[3].split(',');
- }
- } else {
- var cancel_time = '0,01:00'.split(',');
- }
-
- $('.base').each(function (index, domEle) {
- var par = $(domEle).attr('data-room-type');
- if (par == parent_room_type1) {
- parent_room_name = $(this).children().eq(1).text().trim();
- }
- });
- $('#checkin_people').val(modify_room_info_arr[0]);
- $('#breakfast').val(modify_room_info_arr[1]);
- $('#lastest_book_day').val(book_time[0]);
- $('#lastest_book_date').val(book_time[1].split(':')[0]);
- $('#lastest_book_time').val(book_time[1].split(':')[1]);
- $('#lastest_cancel_day').val(cancel_time[0]);
- $('#lastest_cancel_day1').val(cancel_time[1].split(':')[0]);
- $('#lastest_cancel_day2').val(cancel_time[1].split(':')[1]);
- $('.data-base-room-name').text(parent_room_name);
- $('.data-child-room-name').val(child_room_name.trim());
- $('#modify_neibu').val(neibubs);
- $('#modify_bed_type').val(base_bed_type);
- $('.data-base-room-name').attr('data-base-room-type', parent_room_type1);
- }
- //修改子房型提交
- function commit() {
- if ($('#lastest_book_day').val() == -1) {
- var lastest_total = -1;
- } else if ($('#lastest_book_day').val() == -2) {
- var lastest_total = -2;
- } else {
- var lastest_total = $('#lastest_book_day').val() + ',' + $('#lastest_book_date').val() + ':' + $('#lastest_book_time').val();
- }
- if ($("#lastest_cancel_day").val() != -1) {
- var lastest_cancel_day = $("#lastest_cancel_day").val() + ',' + $("#lastest_cancel_day1").val() + ':' + $("#lastest_cancel_day2").val()
- } else {
- var lastest_cancel_day = -1
- }
- var neibubs = $('#modify_neibu').val();
- var modify_bed_type = $('#modify_bed_type').val();
- var param = {
- type: 'room_RoomList',
- op: 'modifyRoom',
- user_id: 1,
- hotel_id: hotel_id,
- room_type: child_room_type,
- parent_room_type: parent_room_type1,
- data_child_room_name: $('.data-child-room-name').val(),
- checkin_people: $('#checkin_people').val(),
- breakfast: $('#breakfast').val(),
- lastest_book_time: lastest_total,
- lastest_cancel_day: lastest_cancel_day,
- neibubs: neibubs,
- bed_type:modify_bed_type
- };
- ZZLog(param);
- loading();
- $.ajax({
- url: base_api,
- type: 'post',
- dataType: 'json',
- data: param,
- success: function (res_data) {
- ZZLog(res_data);
- if (res_data['code'] != "0") {
- alert(res_data['info']);
- } else {
- // 将弹出层隐藏
- clickMask();
- // 刷新数据
- getDataFromHttp();
- }
- closeLoading();
- },
- error: function (error) {
- alert('系统错误,请联系管理员');
- ZZLog(error);
- closeLoading();
- }
- })
- }
- // 修改选择入住人数
- function mdchangePeople(selfOBJ) {
- var $selfOBJ = $(selfOBJ);
- var count = $selfOBJ.val();
- if (count < 100) {
- cstr1 = "(" + count + "人入住)";
- } else {
- cstr1 = '';
- }
- var tstr = cstr3 + parent_room_name + cstr1 + cstr2;
- $('.data-child-room-name').val(tstr.trim());
- }
- //选择最晚预订时间
- function mdChangeLastestBook(selfOBJ) {
- var $selfOBJ = $(selfOBJ);
- var fast = parseInt($selfOBJ.val());
- switch (fast) {
- case 0:
- fast = "";
- break;
- case 1:
- fast = "提前一天";
- break;
- case 2:
- fast = "提前二天";
- break;
- case 3:
- fast = "提前三天";
- break;
- case 4:
- fast = "提前四天";
- break;
- case 5:
- fast = "提前五天";
- break;
- case 6:
- fast = "提前六天";
- break;
- case 7:
- fast = "提前七天";
- break;
- }
- if (fast != "") {
- cstr3 = "[" + fast + "]";
- } else {
- cstr3 = "";
- }
- cstr2 = "[" + $("#breakfast").find("option:selected").text() + "]";
- var tstr = cstr3 + parent_room_name + cstr1 + cstr2;
- $('.data-child-room-name').val(tstr.trim());
- }
- // 选择早餐
- function mdchangeBreakfast(selfOBJ) {
- var $selfOBJ = $(selfOBJ);
- var fast = parseInt($selfOBJ.val());
- switch (fast) {
- case 0:
- fast = "无早";
- break;
- case 1:
- fast = "单早";
- break;
- case 2:
- fast = "双早";
- break;
- case 3:
- fast = "三早";
- break;
- case 4:
- fast = "四早";
- break;
- case 5:
- fast = "五早";
- break;
- case 6:
- fast = "六早";
- break;
- case 7:
- fast = "七早";
- break;
- case 8:
- fast = "八早";
- break;
- case 9:
- fast = "九早";
- break;
- case 10 :
- fast = "十早";
- break;
- }
-
- cstr2 = "[" + fast + "]";
- var tstr = cstr3 + parent_room_name + cstr1 + cstr2;
- $('.data-child-room-name').val(tstr.trim());
- }
- //选择现询变999
- function xianxun999() {
- if ($('#base_stock_type').val() == 229) {
- $('#base_count').val(999)
- }
- }
- //查询
- function search() {
- base_room_type = $('#base_room_type').val();
- room_sale_status = $('#sale_status').val();
- d1 = $('.Wdate').val();
- // 设置tb_top_td
- setTbTopTd();
- if (d1 != "") {
- // http
- current = 1;
- getDataFromHttp();
- }
- }
-
|