//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 channel_id = '';
// 房型售卖状态
var room_sale_status = "-1";
//基础房型关键字
var base_room_type = '';
var hotel_id = '';
var hotel_name = '';
var page_size = '10';
var start_date = getPar('start_date');
var qudao_least = 0;
var date_flag = 0;
var number = null;
var check_limit = new Array(); // {"1":"98", "2":"99", "3":"100", "4":"101", "5":"102", "6":"103"};
check_limit[1] = 98;
check_limit[2] = 99;
check_limit[3] = 100;
check_limit[4] = 101;
check_limit[5] = 102;
check_limit[6] = 103;
check_limit[7] = 104;
check_limit[8] = 105;
check_limit[9] = 106;
var limit_name = new Array();
limit_name[1] = '单人入住';
limit_name[2] = '双人入住';
limit_name[3] = '三人入住';
limit_name[4] = '四人入住';
limit_name[5] = '五人入住';
limit_name[6] = '六人入住';
limit_name[7] = '七人入住';
limit_name[8] = '八人入住';
limit_name[9] = '九人入住';
$(document).ready(function () {
$('#Wdate2').val(getDateTime(0));
$('#Wdate3').val(getDateByDay(7, getDateTime(0)));
baseHTML = $('#table-data tbody tr:first').prop('outerHTML');
childHTML = $('#table-data tbody tr:nth-child(2)').prop('outerHTML');
hotel_name = getPar('hotel_name');
hotel_id = getPar('hotel_id');
channel_id = getPar('channel_id');
initChannelList();
$("#current_date").val(getDateTime(0));
if (hotel_name !== "") {
$('#hotel_name').text(hotel_name);
}
// 设置tb_top_td
setTbTopTd();
// http
current = localStorage.getItem('current') === null ? 1 : localStorage.getItem('current');
getDataFromHttp();
// playPermission();
});
$(document).ready(function () {
//日期插件
$(".form_date").datetimepicker({
format: 'yyyy-mm-dd',
autoclose: true,
minView: 2,
pickerPosition: "bottom-left"
});
$("#channel_list").on('change', function () {
channel_id = $("#channel_list").val();
d1 = $("#current_date").val();
setTbTopTd();
current = 1;
getDataFromHttp();
})
$(".form_date_change").on('change', function () {
d1 = $("#current_date").val();
setTbTopTd();
current = 1;
getDataFromHttp();
})
// 今天
$('#today').bind('click', function () {
d1 = getDateTime(0);
setTbTopTd();
current = 1;
getDataFromHttp();
});
// 前7天
$('#before7').bind('click', function () {
d1 = getDateByDay(-7, d1);
setTbTopTd();
current = 1;
getDataFromHttp();
});
// 后7天
$('#after7').bind('click', function () {
d1 = getDateByDay(7, d1);
setTbTopTd();
current = 1;
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 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 addChild(selfOBJ) {
$selfOBJ = $(selfOBJ);
var room_type = $selfOBJ.parent().parent().attr('data-room-type');
var room_name = $selfOBJ.parent().parent().children().eq(1).text().trim();
$("#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;
case -1:
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);
}
// 将目标节点居中显示
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() {
$('#up_base_room').css('display', 'none');
$('#up_parent_room').css('display', 'none');
$('.main_style').css('display', 'none');
$('.modify_child_room').css('display', 'none');
$('#mask').css('display', 'none');
}
// 复选框事件
var child_true_count = 0;
function select_checked(index, selfOBJ) {
$selfOBJ = $(selfOBJ);
//index=0最上面的全选 index=1表示的是下面所有的
var top_check = $('.ace_check')[0];
var checkList = $('.ace_check');
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;
// }
}
}
if (!$selfOBJ.hasClass('child_room')) {
$("#room_list").find('[data-p-room-type=' + $selfOBJ.closest('tr').attr('data-room-type') + ']').find('input[type=checkbox]').prop('checked', $selfOBJ.prop('checked'))
}
}
// 浮动复选框事件
function alterCheck(obj) {
$obj = obj;
$('.ace_check')[0].checked = $obj.checked;
select_checked('0', $('.ace_check')[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;
var urlapi = base_api + "?type=room_RoomList&op=get_channel_room_info&channel_id=" + channel_id + "&hotel_id=" + hotel_id + "&start_date=" + d1 + "&sale_status=" + room_sale_status + "¤t=" + current
+ "&page_size=" + page_size;
ZZLog(urlapi);
$.ajaxSetup({
async: false
});
$.getJSON(urlapi, function (res_data) {
console.log(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).css('display', 'table-row-group');
$('#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();
}
// 添加好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();
}
}
$("#table-data").removeClass('hidden');
$("#table-thead").removeClass('hidden');
}).error(function (msg) {
$("#table-data").addClass('hidden');
$("#table-thead").addClass('hidden');
ZZAlertInfo('系统错误,请联系管理员!');
});
$.ajaxSetup({
async: true
});
$("#all_check_box").prop('checked', false);
}
// 给.base添加事件
function baseAddEvent() {
$('.base_room').each(function (index, domEle) {
$(this).children().eq(1).bind('click', function () {
var siblings = $(this).parent().siblings();
var parent_type = $(this).parent().attr('data-room-type');
if ($(this).find('img').attr('src') == 'images/down_arrow.png') {
$(this).find('img').attr('src', 'images/up_arrow.png');
siblings.each(function (item, value) {
if ($(this).attr('data-p-room-type') == parent_type) {
$(this).addClass('hidden');
}
});
} else if ($(this).find('img').attr('src') == 'images/up_arrow.png') {
$(this).find('img').attr('src', 'images/down_arrow.png');
siblings.each(function (item, value) {
if ($(this).attr('data-p-room-type') == parent_type) {
$(this).removeClass('hidden');
}
});
}
});
})
}
// 给.bday添加事件
var $temp_bday = null;
function bdayAddEvent() {
$('.bday').bind('click', function (e) {
number = $(this).attr('childindex'); //当前点击的是第几天
if ($temp_bday !== null) {
$temp_bday.css('background', '');
$temp_bday.css('color', '');
}
if ($temp_cday !== null) {
$temp_cday.css('background', '');
$temp_cday.css('color', '');
}
setParentData(this);
showCenterView('#up_parent_room');
$('#mask')
.css('display', 'block')
.css('background', 'white')
.css('opacity', '0');
var mouseTop = $(this).offset().top;
var td_height = parseInt($(this).css('height').replace('px', ''));
$(this).css('background', '#4191ff');
$(this).css('color', '#fff');
$('#up_parent_room')
.css('top', mouseTop + td_height + 'px')
.css('display', 'block')
.attr('')
$temp_bday = $(this);
})
}
// 给.cday添加事件
var $temp_cday = null;
function cdayAddEvent() {
$('.cday').bind('click', function () {
url = base_api;
number = $(this).attr('childindex')-1; //当前点击的是第几天
now_date = $('#f_date'+number).attr('f_date');
room_type = $(this).attr('data-room-type');
parent_room_type = $(this).attr('data-parent-room-type');
distrib_id = $("#channel_list").val();
var param = {
type: "room_distribRoomService",
op: "getRunDistribRoomNowInfo",
hotel_id: hotel_id,
room_type: room_type,
parent_room_type: parent_room_type,
now_date: now_date,
distrib_id: distrib_id
};
$.ajax({
url: url,
type: 'post',
data: param,
success: function (res_data) {
res_data = JSON.parse(res_data);
if(res_data != null) {
var gift = res_data['gift'] == ''?'无':res_data['gift'][0]['GIFT_NAME'];
var res = res_data['rowset'][0];
var latest_confirm_time = formatterTime(res['LATEST_COMFIRM_TIME']);
var latest_book_time = formatterTime(res['LASTEST_BOOK_TIME']);
var latest_cancel_time = formatterTime(res['LASTEST_CANCEL_DAY']);
if(res['AUTO_CLOSE'] == 1){
auto_close = '是';
}else if(res['AUTO_CLOSE'] == 0){
auto_close = '否';
}else{
auto_close = '不变';
}
$('#latest_confirm_time').html(latest_confirm_time);
$('#latest_book_time').html(latest_book_time);
$('#latest_cancel_time').html(latest_cancel_time);
$('#auto_close_info').html(auto_close);
$('#gift_info').html(gift);
}
}
});
if ($temp_cday !== null) {
$temp_cday.css('background', '');
$temp_cday.css('color', '');
}
if ($temp_bday !== null) {
$temp_bday.css('background', '');
$temp_bday.css('color', '');
}
if ($(this).attr('data-parent-room-type') !== '') {
setData(this);
showCenterView('#up_base_room');
$('#mask')
.css('display', 'block')
.css('background', 'white')
.css('opacity', '0');
var mouseTop = $(this).offset().top;
var td_height = parseInt($(this).css('height').replace('px', ''));
$(this).css('background', '#4191ff');
$(this).css('color', '#fff');
$('#up_base_room')
.css('top', mouseTop + td_height + 'px')
.css('display', 'block')
.attr('')
}
$temp_cday = $(this);
})
}
function formatterTime(obj){
var res = '';
if(obj == 0){
res = '不变';
}else if(obj == -1){
res = '不设置';
}else if(obj == null){
res = '无';
}else{
res = obj.replace(',','天前');
}
return res;
}
function setData(obj) {
$("#parent_room_type").val($(obj).attr('data-parent-room-type'));
$("#room_type").val($(obj).attr('data-room-type'));
$("#run_status").val($(obj).attr('data-status'));
$("#remain_count").val($(obj).attr('data-count'));
$("input[name='overSale'][value='" + $(obj).attr('data-over-sell') + "']").prop("checked", true);
if ($(obj).attr('data-count') === '177') {
$("#sell_type").val('分销价:');
} else {
$("#sell_type").val('零售价:');
}
$("#max_stock").val($(obj).attr('data-max-count'));
$("#sell_value").val($(obj).attr('data-value'));
}
function setParentData(obj) {
$("#b_parent_room_type").val($(obj).closest('tr').attr('data-room-type'));
// ::todo 渠道保底
var stock = $(obj).attr('data-value').split('/');
$("#count_buyout").val(stock[0]);
$("#count_keep").val(stock[1]);
$("#count_ask").val(stock[2]);
}
//销售规则
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);
if (d1 === "") {
/*if (localStorage.getItem("start_date") !== null) {
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;
}
$('#current_date').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 + " " + w1);
$('#f_date2').html(td2 + " " + w2);
$('#f_date3').html(td3 + " " + w3);
$('#f_date4').html(td4 + " " + w4);
$('#f_date5').html(td5 + " " + w5);
$('#f_date6').html(td6 + " " + w6);
$('#f_date7').html(td7 + " " + w7);
// 将日期为今天的星期设置为今天
$('th[f_date=' + getDateTime(0) + ']').html(getDateTime(0).substring(5) + ' 今天');
}
function setBaseHTML(tempHTML, tempDict) {
//对接的渠道,有前台按钮
if (tempDict['web_url'] !== undefined && tempDict['channel_data_id'] !== '0') {
$("#website a").attr('href', tempDict['web_url']);
$("#website").removeClass('hidden');
} else {
$("#website").addClass('hidden');
}
var HTML = '';
for (var i = 1; i <= 7; i++) {
var cstr = 'cstr' + i;
var date = 'date' + i;
var s = 's' + i;
window[cstr] = '';
window[date] = tempDict['date' + i]
window[s] = (window['date' + i]['buyout_count'] === '' ? '0' : window['date' + i]['buyout_count']) + '/' + (window['date' + i]['reserve_count'] === '' ? '0' : window['date' + i]['reserve_count']) + '/' + (window['date' + i]['inquiry_count'] === '' ? '0' : window['date' + i]['inquiry_count']);
}
tempHTML = tempHTML.replace('[房型名称]', tempDict['room_name']);
tempHTML = tempHTML.replace('[table_switch]', '');
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']);
for (var i = 1; i <= 7; i++) {
if (window['date' + i]['inventory_type'] !== "") {
window['cstr' + i] =
//'
'
'已售' + (window['date' + i]['saled_count'] === '' ? '0' : window['date' + i]['saled_count']) + ''
+ ' '
+ '剩余' + window['s' + i] + '';
//+ '采购:' + date1["base_price"] + '';
tempHTML = tempHTML.replace('[value' + i + ']', (window['date' + i]['buyout_count'] === '' ? '0' : window['date' + i]['buyout_count']) + '/' + (window['date' + i]['reserve_count'] === '' ? '0' : window['date' + i]['reserve_count']) + '/' + (window['date' + i]['inquiry_count'] === '' ? '0' : window['date' + i]['inquiry_count']));
} else {
tempHTML = tempHTML.replace('[value' + i + ']', "");
}
tempHTML = tempHTML.replace('[day' + i + ']', window['cstr' + i]);
}
rp_id = tempDict['rp_id'];
channel_base_room_id = tempDict['channel_base_room_id'];
if (channel_id == 675) // 当前渠道为阿里
{
// $('#rp').css('display', 'block');
// $('.rp').css('display', 'block');
tempHTML = tempHTML.replace('[close]', '关');
if (channel_base_room_id == 0) {
tempHTML = tempHTML.replace('[image]', '
');
} else {
tempHTML = tempHTML.replace('[image]', '
');
}
tempHTML = tempHTML.replace('[open]', '开');
} else {
tempHTML = tempHTML.replace('[close]', '');
tempHTML = tempHTML.replace('[image]', '');
tempHTML = tempHTML.replace('[open]', '');
}
HTML += tempHTML;
return HTML;
}
function setChildHTML(tempHTML, tempDict) {
tempHTML = tempHTML.replace('[room_type_id]', tempDict['room_type']);
tempHTML = tempHTML.replace('[p_room_type_id]', tempDict['parent_room_type']);
tempHTML = tempHTML.replace('[data-hotel-id]', tempDict['hotel_id']);
tempHTML = tempHTML.replace('[data-hotel-room-id]', tempDict['opera_hotel_room_id']);
var auth_status = '';
for (i = 1; i <= 7; i++) {
tmpData = tempDict['date' + i];
if (tmpData['price'] === '') { //没有价格就说明没有设置房态
// tempHTML.replace('[left]', tmpData['remain_count']);
tempHTML = tempHTML.replace('[p_room_type' + i + ']', '');
day_str = '