|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268 |
- //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]', '<img src="images/down_arrow.png">');
- 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] =
- //'<img data-inventory-type=' + date1["inventory_type"] + ' style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + date1["inventory_type"] + '.png"/>'
- '<span>已售' + (window['date' + i]['saled_count'] === '' ? '0' : window['date' + i]['saled_count']) + '</span></br>'
- + '<span> </span></br>'
- + '<span>剩余' + window['s' + i] + '</span>';
- //+ '<span>采购:' + date1["base_price"] + '</span>';
-
- 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]', '<img class=\"image_class\" src="images/OffSwitch.png" style=\"height: 14px;width: 53*16/36px;\" onclick=\"baseImageClick(this, 1)\" isopen="0">');
- } else {
- tempHTML = tempHTML.replace('[image]', '<img class=\"image_class\" src="images/OnSwitch.png" style=\"height: 14px;width: 53*16/36px;\" onclick=\"baseImageClick(this, 1)\" isopen="1">');
- }
- 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 = '<div class="none" >暂无</div>';
-
- channel_room_id = tempDict['channel_data_id'];
- channel_base_room_id = tempDict['channel_base_room_id'];
- rp_id = tempDict['rp_id'];
- } else {
- if(tmpData['gift_id'] === null || tmpData['gift_id'] === '0'){
- var day_str = '<div style="text-align: left" ><span>已售 ' + (tmpData['saled_count'] === '' ? '0' : tmpData['saled_count']) + '</span></br>'
- + '<div><span style="display: inline-block;">剩余 ' + tmpData['remaining_count'] + '</span><span class="label label-warning overRight">' + (tmpData['oversell_flag'] === '1' ? '超卖' : '') + '</span></div>'
- + '<span>' + (tempDict['sale_type'] === '177' ? '分销价 ' : '零售价') + tmpData['price'] + '</span></div>';
- }else{
- var day_str = '<div style="text-align: left" ><span>已售 ' + (tmpData['saled_count'] === '' ? '0' : tmpData['saled_count']) + '</span><span class="label label-danger gift-icon">礼</span></br>'
- + '<div><span style="display: inline-block;">剩余 ' + tmpData['remaining_count'] + '</span><span class="label label-warning overRight">' + (tmpData['oversell_flag'] === '1' ? '超卖' : '') + '</span></div>'
- + '<span>' + (tempDict['sale_type'] === '177' ? '分销价 ' : '零售价') + tmpData['price'] + '</span></div>';
- }
- var tmp_full = '';
- if (tmpData['run_full'] === '329') {
- tmp_full = '<div class="over-full" ></div>';
- }
-
- if (tmpData['run_status'] === '329') {
- tmp_full = '<div class="over-closing" ></div>';
- }
-
- day_str += tmp_full;
- tempHTML = tempHTML.replace('[p_room_type' + i + ']', tempDict['parent_room_type']);
- tempHTML = tempHTML.replace('[room_type' + i + ']', tempDict['room_type']);
- tempHTML = tempHTML.replace('[total_count' + i + ']', tmpData['remaining_count']);
- tempHTML = tempHTML.replace('[over_sell' + i + ']', tmpData['oversell_flag']);
- tempHTML = tempHTML.replace('[value' + i + ']', tmpData['price']);
- tempHTML = tempHTML.replace('[run_status' + i + ']', tmpData['run_status']);
- tempHTML = tempHTML.replace('[run_full' + i + ']', tmpData['run_full']);
- }
-
- if (auth_status === '') {
- auth_status = tempDict['NEW_AUTHORITY_STATUS'];
- if (auth_status === "0") {
- tempHTML = tempHTML.replace('isopen="1"', 'isopen="0"');
- tempHTML = tempHTML.replace('images/OnSwitch.png', 'images/OffSwitch.png');
- } else if (auth_status === "1") {
- tempHTML = tempHTML.replace('isopen="0"', 'isopen="1"');
- tempHTML = tempHTML.replace('images/OffSwitch.png"', 'images/OnSwitch.png"');
- } else { //当没有取到的时候,默认是没有授权
- tempHTML = tempHTML.replace('isopen="1"', 'isopen="0"');
- tempHTML = tempHTML.replace('images/OnSwitch.png', 'images/OffSwitch.png');
- }
- }
- channel_room_id = tempDict['channel_data_id']; // 渠道子房型id
- channel_base_room_id = tempDict['channel_base_room_id']; // 渠道基础房型id
- rp_id = tempDict['rp_id']; // 房型价格计划
- if (channel_id != 675) // 当渠道是携程
- {
- tempHTML = tempHTML.replace('[close1]', '关');
- if (channel_room_id == 0) {
- tempHTML = tempHTML.replace('[image1]', '<img class=\"image_class\" src="images/OffSwitch.png" style=\"height: 14px;width: 53*16/36px;\" onclick=\"mapping_onclick(this)\" isopen="0">');
- } else {
- tempHTML = tempHTML.replace('[image1]', '<img class=\"image_class\" src="images/OnSwitch.png" style=\"height: 14px;width: 53*16/36px;\" onclick=\"mapping_onclick(this)\" isopen="1">');
- }
-
- tempHTML = tempHTML.replace('[open1]', '开');
-
- tempHTML = tempHTML.replace('[close2]', '-');
- tempHTML = tempHTML.replace('[image2]', '-');
- tempHTML = tempHTML.replace('[open2]', '-');
- tempHTML = tempHTML.replace('[房型名称]', tempDict['room_name'] + (tempDict['mapping_id'] !== '0' ? '<br /><br /><span class="label label-success">' + tempDict['mapping_id'] + '</span>' : ''));
- } else if (channel_id == 675) {
-
- // $('.rp_image').css('display', 'block');
- tempHTML = tempHTML.replace('[close1]', '');
- tempHTML = tempHTML.replace('[image1]', '');
- tempHTML = tempHTML.replace('[open1]', '');
-
- tempHTML = tempHTML.replace('[close2]', '关');
- if (rp_id == 0 || rp_id == null) {
- tempHTML = tempHTML.replace('[image2]', '<img class=\"image_class\" src="images/OffSwitch.png" style=\"height: 14px;width: 53*16/36px;\" onclick=\"baseImageClick(this, 2)\" isopen="0">');
- } else {
- tempHTML = tempHTML.replace('[image2]', '<img class=\"image_class\" src="images/OnSwitch.png" style=\"height: 14px;width: 53*16/36px;\" onclick=\"baseImageClick(this, 2)\" isopen="1">');
- }
- tempHTML = tempHTML.replace('[open2]', '开');
- tempHTML = tempHTML.replace('[房型名称]', tempDict['room_name'] + (!(rp_id == 0 || rp_id == null) ? '<br /><br /><span class="label label-success">' + rp_id + '</span>' : ''));
- }
- tempHTML = tempHTML.replace('[cday' + i + ']', day_str);
- }
-
- return tempHTML;
- }
-
-
- // 点击按钮发送请求(阿里直连使用)
- function baseImageClick(obj, type) {
- loading();
- var start = new Date().getTime();
- var $par_tr = $(obj).closest('tr');
- var _hotel_id = hotel_id; // 酒店ID
- var is_open = $(obj).attr('isopen'); // 判断开关状态
-
- // 1. 基础房型直连, 2. rp开关
- if (type == 1) {
- var parent_room_type = $par_tr.attr('data-room-type'); // 基础房型id
- var utype = 'room_base_SetBaseRoom';
- var op = 'push_room';
-
- } else if (type == 2) {
- var parent_room_type = $par_tr.attr('data-p-room-type'); // 基础房型id
- var utype = 'room_base_SetBaseRoom';
- var op = 'push_rp';
- var room_type = $par_tr.attr('data-room-type-id');
- }
-
- if ($(obj).attr('isopen') == "0") {
- apiurl = base_api + "?type=" + utype + "&op=" + op + "&hotel_id=" + _hotel_id + "&parent_room_type=" + parent_room_type + "&room_type=" + room_type + "&is_open=" + is_open;
- ZZLog(apiurl);
- $.getJSON(apiurl, function (res_data) {
- if (res_data['code'] != 200) {
- ZZAlertInfo(res_data['msg']);
- } else {
- $('#today').trigger('click');
- }
- }).error(function (msg) {
-
- })
- } else {
- apiurl = base_api + "?type=" + utype + "&op=" + op + "&hotel_id=" + _hotel_id + "&parent_room_type=" + parent_room_type + "&room_type=" + room_type + "&is_open=" + is_open;
- ZZLog(apiurl);
- //alert('345');
- $.getJSON(apiurl, function (res_data) {
- if (res_data['code'] != 200) {
- ZZAlertInfo(res_data['msg']);
- } else {
- $('#today').trigger('click');
- }
- })
- }
- var end = new Date().getTime();
- if (end - start > 1500) {
- closeLoading();
- } else {
- setTimeout(closeLoading, 1500 - (end - start));
- }
- }
-
-
- 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 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;
- case -1:
- fast = "——";
- break;
- }
- if (fast !== "") {
- cstr3 = "[" + fast + "]";
- } else {
- cstr3 = "";
- }
- 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();
- }
- }
-
- /*
- 渠道商所有房型房态
- */
- function channelRoom(obj) {
- 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;
- }
-
-
- function showDialog() {
- $('#updateAll').unbind('click');
- $('#updateAll').bind('click', function () {
- input_time = $('#input_time').val();
- $('#start_date_update').val(input_time);
- $('#end_date_update').val(getDateByDay(6, input_time));
- if (check_distrib_id.length === 0) { //没有选中的情况,弹出提示框
- alert('请选中需要批量修改的渠道商!');
- return;
- }
- //$('#one').css('display','block');
- $('#mask').css('background', 'white');
- $('#mask').css('opacity', '0.5');
- $("#authorized_stock_num_many").val('');
- $("#distribution_price_many").val('');
- $("#retail_price_many").val('');
- showCenterView('#up_base_room');
-
- });
- }
-
- function saveChildUpdate() {
- //alert(new Date(d1).getDay()); //当前页面上第一天是星期几
- //当前点击的是第number个日期,可以获取到具体的日期
- //alert(number);
- var _td_date = $('.tb_title').children().eq(number).attr('f_date'); //当前点击的日期
- //alert(_td_date);return;
- var startDate = _td_date;
- var endDate = _td_date;
- var allCheckString = "2345671"; //para_week_day,存储过程中的参数
- var authorizedStock = $('#run_status').val();
- var authorizedStockNum = $('#remain_count').val();
- var distributionPrice = $('#sell_value').val() === '' ? 0 : $('#sell_value').val();
- var overSaleOne = $("input[name='overSale']:checked").val();
-
- if (startDate === "" || endDate === "" || allCheckString === "" || authorizedStock === "" || authorizedStockNum === "") {
- alert('您还有未输入的选项!');
- return;
- }
- if (distributionPrice === "" && retailPrice === "") {
- alert('您还有未输入的选项!');
- // alert('startDate:'+startDate);
- // alert('endDate:'+endDate);
- // alert('allCheckString:'+allCheckString);
- // alert('authorizedStock:'+authorizedStock);
- // alert('authorizedStockNum:'+authorizedStockNum);
- // alert('distributionPrice:'+distributionPrice);
- // alert('retailPrice:'+retailPrice);
- return;
- }
- parent_room_type = $("#parent_room_type").val();
- room_type_id = $("#room_type").val();
- distrib_id_checkd = channel_id;
- var urlapi = base_api;
- var param = {
- type: "hotel_SaleRuleInfo",
- op: "updateAuthorizeInfo",
- para_user_id: 1,
- para_hotel_id: hotel_id,
- para_base_room_type: parent_room_type,
- para_room_type: room_type_id,
- para_distrib_list: distrib_id_checkd,
- para_start_date: startDate,
- para_end_date: endDate,
- para_week_day: allCheckString,
- para_stock_type: authorizedStock,
- para_stock_num: authorizedStockNum,
- para_prod_price: distributionPrice,
- para_cus_price: distributionPrice,
- para_over_sale: overSaleOne,
- disable_validate: 'off'
- };
- // alert(urlapi + JSON.stringify(param));
- ZZLog(urlapi + JSON.stringify(param));
-
- $("#one_save").html('保存中');
- $('#one_save').css('background', 'darkgray');
- loading();
- $.ajax({
- url: urlapi,
- data: param,
- type: "post",
- dataType: "json",
- success: function (res_data) {
- closeLoading();
- ZZLog(res_data);
- if (res_data['code'] !== "0") {
- ZZAlertInfo(res_data['info']);
- } else {
- //alert(res_data);
- getDataFromHttp();
- ZZAlertInfo('修改成功' + res_data['info']);
- }
- $("#one_save").html('保存');
- $('#one_save').css('background', '#428bca');
- },
- error: function (msg) {
- $("#one_save").html('保存');
- $('#one_save').css('background', '#428bca');
- closeLoading();
- }
- })
-
-
- $('#one').css('display', 'none');
- clickMask();
- }
-
- function saveUpdate() {
- 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 = $('#count_buyout').val();
- var baoliu_count = $('#count_keep').val();
- var xianxun_count = $('#count_ask').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));
- $("#parent_save").html('保存中');
- loading();
- // $('.save_child').css('background-color', 'darkgray !important'); //不知道什么原因,不起作用
- $('#parent_save').attr('disabled', true);
- $.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();
- }
- $("#parent_save").html('保存');
- $('#parent_save').attr('disabled', false);
- closeLoading();
- })
-
-
- $('#one').css('display', 'none');
- clickMask();
- }
-
- // 授权开关, 进行渠道授权
- function image_onclick(obj) {
- loading();
- var start = new Date().getTime();
- var $par_tr = $(obj).closest('tr');
- var distrib_id = $("#channel_list").val();
- var parent_room_type = $par_tr.attr('data-p-room-type');
- var room_type_id = $par_tr.attr('data-room-type-id');
- if ($(obj).attr('isopen') == "0") { //变成打开授权状态
- //alert("distrib_id:"+distrib_id+" hotel_id:"+hotel_id+" parent_room_type"+parent_room_type+" room_type_id"+room_type_id);
- var apiurl = base_api + "?type=hotel_SaleRuleInfo&authorize_status=" + 1 + "&hotel_id=" + hotel_id + "&parent_room_type=" + parent_room_type + "&room_type=" + room_type_id + "&op=updateAuthorizeStatus&distrib_id_string=" + distrib_id;
- ZZLog(apiurl);
- //alert('123');
- $.getJSON(apiurl, function (res_data) {
- //alert("awefawfawefwaf");
- //console.log("数据:"+res_data);
- if (res_data['code'] != 0) {
- ZZAlertInfo(res_data['info']);
- } else {
- $(obj).attr('isopen', "1");
- $(obj).attr('src', "images/OnSwitch.png");
- }
- }).error(function (msg) {
-
- })
- } else {
- $(obj).attr('isopen', "0");
- $(obj).attr('src', "images/OffSwitch.png");
- var apiurl = base_api + "?type=hotel_SaleRuleInfo&authorize_status=" + 0 + "&hotel_id=" + hotel_id + "&parent_room_type=" + parent_room_type + "&room_type=" + room_type_id + "&op=updateAuthorizeStatus&distrib_id_string=" + distrib_id;
- ZZLog(apiurl);
- //alert('345');
- $.getJSON(apiurl, function (res_data) {
- //alert("awefawfawefwaf");
- ZZLog("数据:" + res_data);
-
- })
- }
- var end = new Date().getTime();
- if (end - start > 1500) {
- closeLoading();
- } else {
- setTimeout(closeLoading, 1500 - (end - start));
- }
- }
-
- // 直连开关提示,渠道为非飞猪提示直连操作
- function mapping_onclick(obj) {
- var distrib_id = $("#channel_list").val();
- if (distrib_id == 669) {
- ZZAlertInfo('携程渠道访问以下链接进行设置:\nhttp://cs1.zhizhuchuxing.com/hotel/set/index');
- return false;
- }
- if (distrib_id != 675) {
- ZZAlertInfo('不支持直连操作');
- return false;
- }
- // return false;
- /*loading();
- var start = new Date().getTime();
- var $par_tr = $(obj).closest('tr');
-
- var parent_room_type = $par_tr.attr('data-p-room-type');
- var room_type_id = $par_tr.attr('data-room-type-id');
- var _hotel_id = hotel_id;
- if ($(obj).attr('isopen') == "0") { //阿里直连房型
- var apiurl = 'http://cs1.wzzcx.com/hotel/ali/room-update?parent_room_type=' + parent_room_type + "&room_type=" + room_type_id + "&hotel_id=" + _hotel_id;
- ZZLog(apiurl);
- //alert('123');
- $.getJSON(apiurl, function (res_data) {
- if (res_data['code'] != 200) {
- ZZAlertInfo(res_data['msg']);
- } else {
- $(obj).attr('isopen', "1");
- $(obj).attr('src', "images/OnSwitch.png");
- }
- }).error(function (msg) {
-
- })
- } else { // 阿里房型断开直连
- $(obj).attr('isopen', "0");
- $(obj).attr('src', "images/OffSwitch.png");
- var apiurl = 'http://cs1.wzzcx.com/hotel/ali/room-update?parent_room_type=' + parent_room_type + "&room_type=" + room_type_id + "&hotel_id=" + _hotel_id;
- ZZLog(apiurl);
- //alert('345');
- $.getJSON(apiurl, function (res_data) {
- //alert("awefawfawefwaf");
- ZZLog("数据:" + res_data);
-
- })
- }
- var end = new Date().getTime();
- if (end - start > 1500) {
- closeLoading();
- } else {
- setTimeout(closeLoading, 1500 - (end - start));
- }*/
- }
-
-
- 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 open_new(obj, action) {
- var room = '';
- var tr;
- var arr = $('input.child_room:checked');
- if (arr.length <= 0) {
- ZZAlertInfo('请选择子房型!');
- return true;
- }
-
- $.each(arr, function (k, e) {
- tr = $(e).closest('tr');
- if (room !== '') {
- room += ',';
- }
- room += $(tr).attr('data-p-room-type') + ':' + $(tr).attr('data-room-type-id') + ':-';
- });
- var go_path = "zz-jd/distrib_change_price.html?action=" + action + "&hotel_name=" + hotel_name + "&hotel_id=" + hotel_id + "&start_date=" + d1 + "&room=" + room + "&channel_id=" + channel_id + "&channel_name=" + $("#channel_list>option:selected").html();
-
- $.cookie('user_path', "2", {path: "/", domain: domain_path});
- $.cookie("path_url", cookie_path + go_path, {domain: domain_path, path: "/"});
- window.open(system_path);
- }
-
- /**
- *获取渠道房型信息
- *
- */
- function getChannelRoomInfo(obj) {
- var url = base_api;
- var _hotel_id = $(obj).attr('data-hotel-id');
- var _opera_hotel_room_id = $(obj).attr('data-hotel-room-id');
- var _distrib_id = $("#channel_list").val();
- var param = {
- type: "room_distribRoomService",
- op: "getDistribRoomInfo",
- hotel_id: _hotel_id,
- opera_hotel_room_id: _opera_hotel_room_id,
- distrib_id: _distrib_id
- };
-
- var channel_name = '';
- if ($.inArray(parseInt(_distrib_id), [669, 1667, 1668, 1669, 1670]) != -1) {
- $("#breakfast option[value='2']").remove();
- $('#breakfast').append('<option value="2">不定</option>');
- channel_name = '<select class="form-control" id="distrib_room_name" name="roomNameRemark">\n' +
- ' <option value="-1">无</option>\n' +
- ' <option value="572">限时特惠</option>\n' +
- ' <option value="48042">限时促销</option>\n' +
- ' <option value="639904">今日特价</option>\n' +
- ' <option value="687096">特价大促销</option>\n' +
- ' <option value="611402">特惠专享</option>\n' +
- ' <option value="455904">特惠</option>\n' +
- ' <option value="498104">升级特惠</option>\n' +
- '</select>';
- $('.switch').removeClass('hide_div');
- } else {
- $("#breakfast option[value='2']").remove();
- $('.switch').addClass('hide_div');
- channel_name = '<input class="form-control" id="distrib_room_name" type="text" placeholder="请输入渠到名称"/>';
- }
- $('#channel_mapping_name').html(channel_name);
- $.ajax({
- url: url,
- type: 'post',
- data: param,
- success: function (res_data) {
- res_data = JSON.parse(res_data);
- var bed_arr = new Array();
- bed_arr[1] = '大床';
- bed_arr[2] = '双床';
- bed_arr[3] = '多床';
-
- var channel_bed_id = new Array();
- channel_bed_id[1] = 108;
- channel_bed_id[2] = 109;
- channel_bed_id[3] = 107;
-
- if (res_data['code'] == '0') {
- $('#opera_hotel_room_id').val(_opera_hotel_room_id);
- var data = res_data['rowset'][0];
- $('#distribe_name').val(data['SUPPLIER_NAME']);
- $('#opera_room_name').val(data['ROOM_NAME'] + data['INNER_IDENTIFY']);
- $('#distrib_room_name').val(data['DISTRIB_ROOM_NAME']);
- if (data['AUTHORITY_STATUS'] == 1) {
- $("#authority_status").attr('src', "images/OnSwitch.png");
- $('#authority_status').attr('isopen', '1');
- } else {
- $("#authority_status").attr('src', "images/OffSwitch.png");
- $('#authority_status').attr('isopen', '0');
- }
- // 床型展示
- var bed_option = '<option value="0">不限</option>';
- var bed = [];
- if (data['BED_TYPE'] == 0) {
- bed = data['BASE_BED_TYPE'].split(',');
- } else {
- bed = data['BED_TYPE'].split(',');
- }
- $(bed).each(function (i, n) {
- bed_option += '<option value="' + channel_bed_id[n] + '">' + bed_arr[n] + '</option>';
- });
- $('.bed_tye').empty();
- $('.bed_tye').append(bed_option);
-
- 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] = '九人入住';
-
- // check_limit[999] = 106;
-
- // check_limit[] = 98;
- // 入住人数 如果是0则不限人数,最多9人,-1 表示入住人数不限制,继承父级房型
- var limit_option = '<option value="-1">不限</option>';
- if (data['OCCUPANCY_LIMIT'] > 6) {
- data['OCCUPANCY_LIMIT'] = 9;
- for (var i = 1; i <= 9; i++) {
- limit_option += '<option value="' + check_limit[i] + '">' + limit_name[i] + '</option>';
- }
- } else {
- for (var i = 1; i <= data['OCCUPANCY_LIMIT']; i++) {
- limit_option += '<option value="' + check_limit[i] + '">' + limit_name[i] + '</option>';
- }
- }
-
- $('.check_in_num').empty();
- $('.check_in_num').append(limit_option);
- $('.check_in_num').val(check_limit[data['OCCUPANCY_LIMIT']]);
- // 入住人数end
- // 餐食数begin
- var breakfast_select = '';
- if (data['level'] == 3) {
- breakfast_select = '<span> 餐食数 </span><select class="form-control breakfast-num" id="breakfast-num">' +
- '<option value="128">无早</option>\n' +
- '<option value="126">单早</option>\n' +
- '<option value="127">双早</option>\n' +
- '<option value="125">三早</option>\n' +
- '<option value="117">四早</option>\n' +
- '<option value="118">五早</option>\n' +
- '<option value="119">六早</option>\n' +
- '<option value="120">七早</option>\n' +
- '<option value="121">七早</option>\n' +
- '<option value="122">八早</option>\n' +
- '<option value="123">九早</option>\n' +
- '<option value="124">十早</option></select>';
- $('#breakfast').val(2);
- $('.breakfast-hide').html(breakfast_select);
- $('.breakfast-num').val(data['ID']);
- } else {
- $('.breakfast-hide').html(breakfast_select);
- if (data['ID'] != '' && data['ID'] != null && data['ID'] != 0) {
- $('#breakfast').val(data['ID']);
- } else {
- $('#breakfast').val(-1);
- }
- }
-
- closeLoading();
- }
- }
- })
- }
-
- function setChannelRoomInfo(obj) {
- var url = base_api;
- var _hotel_id = $(obj).attr('data-hotel-id');
- var _opera_hotel_room_id = $(obj).attr('data-hotel-room-id');
- var _distrib_id = $("#channel_list").val();
- var param = {
- type: "room_distribRoomService",
- op: "setDistribRoomInfo",
- hotel_id: _hotel_id,
- opera_hotel_room_id: _opera_hotel_room_id,
- distrib_id: _distrib_id
- };
- $.ajax({
- url: url,
- type: 'post',
- data: param,
- success: function (res_data) {
- res_data = JSON.parse(res_data);
- if (res_data['code'] == '0') {
- $('#opera_hotel_room_id').val(_opera_hotel_room_id);
- var data = res_data['rowset'][0];
- var gift = res_data['rowset']['gift'];
- $('#distribe_name').val(data['SUPPLIER_NAME']);
- $('#opera_room_name').val(data['ROOM_NAME'] + data['INNER_IDENTIFY']);
- $('#distrib_room_name').val(data['DISTRIB_ROOM_NAME']);
- if (data['AUTHORITY_STATUS'] == 1) {
- $("#authority_status").attr('src', "images/OnSwitch.png");
- $('#authority_status').attr('isopen', '1');
- } else {
- $("#authority_status").attr('src', "images/OffSwitch.png");
- $('#authority_status').attr('isopen', '0');
- }
-
- if (data['LATEST_COMFIRM_TIME'] != null) {
- if (data['LATEST_COMFIRM_TIME'] == "-1") {
- $('#div_confirm').css('display', 'none');
- } else {
- $('#not_set_latest_comfirm').prop("checked", false);
- $('#set_latest_comfirm').prop("checked", "checked");
- var latest_comfirm_time = data['LATEST_COMFIRM_TIME'].split(",");
- $("#quick_confirm_day").val(latest_comfirm_time[0]);
- $("#quick_confirm_time").val(latest_comfirm_time[1]);
- $('#div_confirm').css('display', 'block');
- }
- } else {
- $('#not_set_latest_comfirm').prop("checked", "checked");
- $('#set_latest_comfirm').prop("checked", false);
- $('#div_confirm').css('display', 'none');
- }
-
- $("#gift_select").html('<option value="0">无</option>');
- for (var i = 0; i < gift.length; i++) {
- $("#gift_select").append("<option value='" + gift[i]['ID'] + "' data-content='" + gift[i]['GIFT_CONTENT'] + "'>" + gift[i]['GIFT_NAME'] + "</option>");
- $('.select_screen').comboSelect();
- }
- $('#gift_date_begin').val(getDateTime(0));
- $('#gift_date_end').val(getDateTime(0));
- closeLoading();
- }
- }
- })
- }
-
- /**
- * 礼盒选中项变更时,礼盒内容隐藏
- */
- $('#gift_select').change(function () {
- $("#gift_content").css('display', 'none');
- });
-
- /**
- * 查看礼盒内容
- */
- function gift_detail() {
- if ($("#gift_content").css('display') == "block") {
- $("#gift_content").css('display', 'none');
- } else {
- var gift_cotent = $("#gift_select").find("option:selected").attr("data-content");
- if (gift_cotent == undefined) {
- $("#gift_content").html('礼盒内容:无');
- } else {
- $("#gift_content").html('礼盒内容:' + gift_cotent);
- }
- $("#gift_content").css('display', 'block');
- }
- }
-
- /**
- * 切换授权开关按钮
- * @param obj
- */
- function authorityStatusMenu(obj) {
- if ($(obj).attr('isopen') == 0) {
- $(obj).attr('isopen', "1");
- $(obj).attr('src', "images/OnSwitch.png");
- } else {
- $(obj).attr('isopen', "0");
- $(obj).attr('src', "images/OffSwitch.png");
- }
-
- }
-
- function isSetLastestConfirm() {
- var check_val = $('input:radio[name="inlineRadioOptions"]:checked').val();
- if (check_val == -1) {
- $('#div_confirm').css('display', 'none');
- } else {
- $('#div_confirm').css('display', 'block');
- }
- }
-
- /**
- * 保存房型信息
- */
- function updateDistribRoomInfo() {
- loading();
- var _distrib_id = $("#channel_list").val();
- var _opera_hotel_room_id = $("#opera_hotel_room_id").val();
- var _distrib_room_name = $("#distrib_room_name").val();
- var _authority_status = $("#authority_status").attr('isopen');
- var _purcharse_channel = $('#purcharse_channel').val(); // 采购渠道
- var _bed_type = $('.bed_tye').val(); // 床型
- var _check_in_num = $('.check_in_num').val(); // 入住人数限制
- var _breakfast = -1;
- if ($('#breakfast').val() == 2) {
- _breakfast = $('#breakfast-num').val();
- } else {
- _breakfast = $('#breakfast').val();
- }
-
-
- var param = {
- type: "room_distribRoomService",
- op: "setDistribRoomInfo",
- opera_hotel_room_id: _opera_hotel_room_id,
- distrib_id: _distrib_id,
- distrib_room_name: _distrib_room_name,
- authority_status: _authority_status,
- breakfast_num: _breakfast,
- purcharse_channel: _purcharse_channel,
- bed_type: _bed_type,
- check_in_num: _check_in_num
- };
-
- if ($.inArray(parseInt(_distrib_id), [669, 1667, 1668, 1669, 1670]) != -1) {
- var _room_discounts_type = $('#room-discounts').val(); // 优惠类型
- var _room_discounts_value = $('#option-discounts').val(); // 优惠值
- var _members = $('.members').val(); // 会员类型
- var _show_channel = $("input[name='optionsRadios']:checked").val(); // 展示渠道
- var _fit_people_type = 0;
- var _fit_people_value = '';
- if ($('.fit-people').val() == 11) { // 适应人群及类型获取,不限值为所有
- _fit_people_type = 11;
- _fit_people_value = '1,2,3,4,5,6,7,8,10';
- } else { // 限定,取限定范围的值
- _fit_people_type = $('.fit-people-tye').val();
- $('.in-checkbox:checked').each(function (i, n) {
- _fit_people_value += $(this).val() + ',';
- });
- _fit_people_value = _fit_people_value.substring(0, _fit_people_value.length - 1);
- }
-
- param.room_discount_type = _room_discounts_type;
- param.room_discounts_value = _room_discounts_value;
- param.members = _members;
- param.show_channel = _show_channel;
- param.fit_people_type = _fit_people_type;
- param.fit_people_value = _fit_people_value;
- }
-
- $.ajax({
- url: base_api,
- type: 'post',
- data: param,
- success: function (res_data) {
- res_data = JSON.parse(res_data);
- if (res_data['code'] == '0') {
- $("#cancel").trigger("click");
- closeLoading();
- alert('修改成功!');
- return true;
- } else {
- closeLoading();
- alert('修改失败!');
- return false;
- }
- },
- error: function (e) {
- closeLoading();
- alert('修改失败!');
- return false;
- }
- })
- }
-
-
- /**
- * @author guhh
- * 获取渠道房型信息
- */
- function getDistribRoomInfo(obj) {
- var url = base_api;
- var _hotel_id = $(obj).prev().attr('data-hotel-id');
- var _opera_hotel_room_id = $(obj).prev().attr('data-hotel-room-id');
- var _distrib_id = $("#channel_list").val();
- var param = {
- type: "room_distribRoomService",
- op: "getDistribRunRoomInfo",
- hotel_id: _hotel_id,
- opera_hotel_room_id: _opera_hotel_room_id,
- distrib_id: _distrib_id
- };
- $.ajax({
- url: url,
- type: 'post',
- data: param,
- success: function (res_data) {
- res_data = JSON.parse(res_data);
- console.log(res_data);
- if(res_data != null){
- if (res_data['code'] == '0') {
- $('#opera_hotel_room_id').val(_opera_hotel_room_id);
- var data = res_data['rowset'][0];
- var gift = res_data['rowset']['gift'];
- $('#distribe_name').val(data['SUPPLIER_NAME']);
- $('#opera_room_name').val(data['ROOM_NAME'] + data['INNER_IDENTIFY']);
- $('#distrib_room_name').val(data['DISTRIB_ROOM_NAME']);
- $('#distrib_hotel_id').val(_hotel_id);
- $('#distrib_hotel_room_id').val(_opera_hotel_room_id);
- $('#distrib_base_room_type').val(data['PARENT_ROOM_TYPE']);
- $('#distrib_room_type').val(data['ROOM_TYPE']);
- if (data['AUTHORITY_STATUS'] == 1) {
- $("#authority_status").attr('src', "images/OnSwitch.png");
- $('#authority_status').attr('isopen', '1');
- } else {
- $("#authority_status").attr('src', "images/OffSwitch.png");
- $('#authority_status').attr('isopen', '0');
- }
-
- $("#gift_select").html('<option value="0" data-content="0">不设置</option>');
- for (var i = 0; i < gift.length; i++) {
- $("#gift_select").append("<option value='" + gift[i]['ID'] + "' data-content='" + gift[i]['GIFT_CONTENT'] +"'>" + gift[i]['GIFT_NAME'] + "</option>");
- $('.select_screen').comboSelect();
- }
- $('#gift_date_begin').val(getDateTime(0));
- $('#gift_date_end').val(getDateByDay(7, getDateTime(0)));
-
- closeLoading();
- }
- }
- }
- })
- }
-
- function getTimeRange(data, select, day, time, content) {
- if (data != null) {
- if (data == "-1") {
- $(select).val('-1');
- $(content).css('display', 'none');
- } else if (data == "0") {
- $(select).val('0');
- $(content).css('display', 'none');
- } else {
- $(select).val('2');
- var latest_comfirm_time = data.split(",");
- $(day).val(latest_comfirm_time[0]);
- $(time).val(latest_comfirm_time[1]);
- $(content).css('display', 'block');
- }
- } else {
- $(content).css('display', 'none');
- $(select).val('0');
- }
- }
-
- /**
- * 修改渠道房型信息
- */
- function updateDistribRoomTime() {
- var _distrib_id = $("#channel_list").val(); //渠道ID
- var _opera_hotel_room_id = $("#opera_hotel_room_id").val(); //渠道名称
- var _authority_status = $("#authority_status").attr('isopen'); //渠道授权开关
- var _is_set_confirm_time=$('.latest_confirm').val();
- var _is_set_schedule_time=$('.latest_schedule').val();
- var _is_set_cancel_time=$('.latest_cancel').val();
- var _quick_confirm_day = $('#quick_confirm_day').val(); //最晚立即确认时间-天数
- var _quick_confirm_time = $('#quick_confirm_time').val(); //最晚立即确认时间-时分秒
- var _quick_schedule_day = $('#quick_schedule_day').val(); //最晚预定时间-天数
- var _quick_schedule_time = $('#quick_schedule_time').val(); //最晚预定时间-时分秒
- var _quick_cancel_day = $('#quick_cancel_day').val(); //最晚取消时间-天数
- var _quick_cancel_time = $('#quick_cancel_time').val(); //最晚取消时间-时分秒
- var _gift_select = $('#gift_select').val(); //礼盒ID
- var _begin_date = $("#gift_date_begin").val(); //开始时间
- var _end_date = $("#gift_date_end").val(); //结束时间
- var _auto_close = $("#auto_close").val(); //库房自动关闭
- var _distrib_hotel_id = $("#distrib_hotel_id").val(); //酒店ID
- var _distrib_hotel_room_id = $("#distrib_hotel_room_id").val();
- var _distrib_base_room_type=$('#distrib_base_room_type').val(); //酒店基础房型ID
- var _distrib_room_type=$('#distrib_room_type').val(); //酒店字房型ID
- var r = /^\d+$/;
- if(_is_set_confirm_time == '2'){
- if (!r.test(_quick_confirm_day)) {
- alert("请输入正整数");
- return false;
- }
- }
- if(_is_set_schedule_time == '2'){
- if (!r.test(_quick_schedule_day)) {
- alert("请输入正整数");
- return false;
- }
- }
- if(_is_set_cancel_time == '2'){
- if (!r.test(_quick_cancel_day)) {
- alert("请输入正整数");
- return false;
- }
- }
-
- obj = document.getElementsByName("channel_week");
- check_val = [];
- for (k in obj) {
- if (obj[k].checked)
- check_val.push(obj[k].value);
- }
- var param = {
- type: "room_distribRoomService",
- op: "updateDistribRoomInfo",
- opera_hotel_room_id: _opera_hotel_room_id,
- distrib_id: _distrib_id,
- auto_close:_auto_close,
- authority_status: _authority_status,
- quick_confirm_day: _quick_confirm_day,
- quick_confirm_time: _quick_confirm_time,
- quick_schedule_day: _quick_schedule_day,
- quick_schedule_time: _quick_schedule_time,
- quick_cancel_day: _quick_cancel_day,
- quick_cancel_time: _quick_cancel_time,
- gift_select: _gift_select,
- begin_date: _begin_date,
- end_date: _end_date,
- weekstr: check_val,
- is_set_confirm_time:_is_set_confirm_time,
- is_set_schedule_time:_is_set_schedule_time,
- is_set_cancel_time:_is_set_cancel_time,
- distrib_hotel_id:_distrib_hotel_id,
- distrib_hotel_room_id:_distrib_hotel_room_id,
- distrib_base_room_type:_distrib_base_room_type,
- distrib_room_type:_distrib_room_type
- };
- $.ajax({
- url: base_api,
- type: 'post',
- data: param,
- success: function (res_data) {
- res_data = JSON.parse(res_data);
- console.log(res_data);
- if (res_data['code'] == '0') {
- $("#cancel1").trigger("click");
- closeLoading();
- alert('修改成功!');
- location.reload();
- return true;
- } else {
- closeLoading();
- alert('修改失败!');
- return false;
- }
- },
- error: function (e) {
- closeLoading();
- alert('修改失败!');
- return false;
- }
- })
- }
-
-
-
- // 改变适应人群下拉选择框显示或隐藏
- function changeLimit(e) {
- var people_value = $(e).val();
- if (people_value == 1) {
- $('.fit-district').removeClass('hide_div');
- } else {
- $('.fit-district').addClass('hide_div');
- $('.other-condition').addClass('hide_div');
- }
- }
-
- // 按照适应人群动态生成复选框
- function changeDistict(e) {
- var district_value = $(e).val();
- if (district_value == 899272 || district_value == 899274 || district_value == 899322) {
- html = '';
- } else {
- $('.other-condition').removeClass('hide_div');
- if (district_value == 2) { // 内宾
- html = '<input type="checkbox" value="1" class="in-checkbox" checked disabled>持中国身份证的居民';
- } else if (district_value == 3) { // 外宾
- html = '<input type="checkbox" value="4" class="in-checkbox" checked>持中国护照的侨胞<br/>\n' +
- '<input type="checkbox" value="5" class="in-checkbox" checked>持外国人工作许可证/居留许可证的外籍人士<br/>\n' +
- '<input type="checkbox" value="6" class="in-checkbox" checked>持非中国护照的外籍人士';
- } else if (district_value == 1) { // 中宾
- html = '<input type="checkbox" value="1" class="in-checkbox" checked disabled>持中国身份证的居民<br/>\n' +
- '<input type="checkbox" value="2" class="in-checkbox" checked disabled>持中国回乡证/中国护照的香港人士\n<br/>\n' +
- '<input type="checkbox" value="3" class="in-checkbox" checked disabled>持台胞证/护照的台湾人士\n<br/>\n' +
- '<input type="checkbox" value="4" class="in-checkbox" checked disabled>持中国护照的侨胞\n<br/>\n' +
- '<input type="checkbox" value="5" class="in-checkbox" checked disabled>持外国人工作许可证/居留许可证的外籍人士\n<br/>\n' +
- '<input type="checkbox" value="10" class="in-checkbox" checked disabled>持回乡证/中国护照的澳门人士\n<br/>\n';
- } else if (district_value == 2532721) { //此价格只适用于台湾客人
- html = '<input type="checkbox" value="3" checked disabled class="in-checkbox" >持台胞证/护照的台湾人士<br/>\n';
- } else if (district_value == 1332673) { // 内宾台湾及外籍人士
- html = '<input type="checkbox" value="1" checked disabled class="in-checkbox" >持中国身份证的居民<br/>\n' +
- '<input type="checkbox" value="3" checked disabled class="in-checkbox" >持台胞证/护照的台湾人士\n<br/>\n' +
- '<input type="checkbox" value="4" checked disabled class="in-checkbox" >持中国护照的侨胞\n<br/>\n' +
- '<input type="checkbox" value="5" checked disabled class="in-checkbox" >持外国人工作许可证/居留许可证的外籍人士\n<br/>\n' +
- '<input type="checkbox" value="6" checked disabled class="in-checkbox" >持非中国护照的外籍人士\n<br/>\n';
- } else if (district_value == 1332678) { //内宾港澳及外籍人士
- html = '<input type="checkbox" value="1" checked disabled class="in-checkbox" >持中国身份证的居民<br/>\n' +
- '<input type="checkbox" value="2" checked disabled class="in-checkbox" >持中国回乡证/中国护照的香港人士\n<br/>\n' +
- '<input type="checkbox" value="4" checked disabled class="in-checkbox" >持中国护照的侨胞\n<br/>\n' +
- '<input type="checkbox" value="5" checked disabled class="in-checkbox" >持外国人工作许可证/居留许可证的外籍人士\n<br/>\n' +
- '<input type="checkbox" value="6" checked disabled class="in-checkbox" >持非中国护照的外籍人士\n<br/>\n' +
- '<input type="checkbox" value="10" checked disabled class="in-checkbox" >持回乡证/中国护照的澳门人士\n<br/>\n';
- }
- }
-
- $('.other-condition').html(html);
- }
-
- // 优惠选择的隐藏和显示,动态加载优惠信息
- function roomDiscounts(e) {
- var value = $(e).val();
- if (value == -1 || value == 95) {
- $('.discount-select').addClass('hide_div');
- } else {
- $('.discount-select').removeClass('hide_div');
- var option = '';
- if (value == 10) {
- option += '<option value="113">2间起订</option>\n' +
- '<option value="1175">3间起订</option>\n' +
- '<option value="2334">5间起订</option>\n' +
- '<option value="8335">8间起订</option>\n' +
- '<option value="12964">10间起订</option>\n' +
- '<option value="15930">4间起订</option>\n' +
- '<option value="17502">7间起订</option>\n' +
- '<option value="49619">6间起订</option>\n' +
- '<option value="379123">9间起订</option>';
- } else if (value == 20) {
- option = '<option value="97">提前1天预订</option>\n' +
- '<option value="562">提前2天预订</option>\n' +
- '<option value="26">提前3天预订</option>\n' +
- '<option value="479">提前4天预订</option>\n' +
- '<option value="98">提前5天预订</option>\n' +
- '<option value="434">提前6天预订</option>\n' +
- '<option value="35">提前7天预订</option>\n' +
- '<option value="979">提前8天预订</option>\n' +
- '<option value="2298">提前9天预订</option>\n' +
- '<option value="799">提前10天预订</option>\n' +
- '<option value="510662">提前11天预订</option>\n' +
- '<option value="7105">提前12天预订</option>\n' +
- '<option value="22266">提前13天预订</option>\n' +
- '<option value="57">提前14天预订</option>\n' +
- '<option value="409">提前15天预订</option>\n' +
- '<option value="411931">提前16天预订</option>\n' +
- '<option value="379632">提前17天预订</option>\n' +
- '<option value="378788">提前18天预订</option>\n' +
- '<option value="513609">提前19天预订</option>\n' +
- '<option value="2914">提前20天预订</option>\n' +
- '<option value="114">提前21天预订</option>\n' +
- '<option value="13089">提前22天预订</option>\n' +
- '<option value="795169">提前23天预订</option>\n' +
- '<option value="13735">提前24天预订</option>\n' +
- '<option value="14138">提前25天预订</option>\n' +
- '<option value="17745">提前28天预订</option>\n' +
- '<option value="795294">提前29天预订</option>\n' +
- '<option value="274">提前30天预订</option>\n' +
- '<option value="134">提前45天预订</option>\n' +
- '<option value="106">提前60天预订</option>';
- } else if (value == 51) {
- option = '<option value="96">住1送1</option>\n' +
- '<option value="69">住2送1</option>\n' +
- '<option value="108">住3送1</option>\n' +
- '<option value="1335966">住3送2</option>\n' +
- '<option value="812">住4送1</option>\n' +
- '<option value="795382">住4送2</option>\n' +
- '<option value="1335983">住4送3</option>\n' +
- '<option value="522">住5送1</option>\n' +
- '<option value="795383">住5送2</option>\n' +
- '<option value="1335984">住5送3</option>\n' +
- '<option value="8932">住6送1</option>\n' +
- '<option value="795384">住6送2</option>\n' +
- '<option value="795385">住6送3</option>\n' +
- '<option value="3797">住7送1</option>\n' +
- '<option value="1335968">住7送2</option>\n' +
- '<option value="1335986">住7送3</option>\n' +
- '<option value="630396">住8送1</option>\n' +
- '<option value="1335971">住8送2</option>\n' +
- '<option value="1335987">住8送3</option>\n' +
- '<option value="3798">住9送1</option>\n' +
- '<option value="1335981">住9送2</option>\n' +
- '<option value="1335989">住9送3</option>\n' +
- '<option value="1335982">住10送2</option>\n' +
- '<option value="1335990">住10送3</option>';
- } else if (value == 76) {
- option =
- '<option value="34">连住2晚及以上</option>\n' +
- '<option value="42">连住3晚及以上</option>\n' +
- '<option value="140">连住4晚及以上</option>\n' +
- '<option value="441">连住5晚及以上</option>\n' +
- '<option value="12875">连住6晚及以上</option>\n' +
- '<option value="279">连住7晚及以上</option>\n' +
- '<option value="32">连住8晚及以上</option>\n' +
- '<option value="630395">连住9晚及以上</option>\n' +
- '<option value="8939">连住10晚及以上</option>';
- } else if (value == 86) {
- option = '<option value="90">住2晚或2晚的倍数</option>\n' +
- '<option value="89">住3晚或3晚的倍数</option>\n' +
- '<option value="91">住4晚或4晚的倍数</option>\n' +
- '<option value="92">住5晚或5晚的倍数</option>\n' +
- '<option value="87">住6晚或6晚的倍数</option>\n' +
- '<option value="93">住7晚或7晚的倍数</option>\n' +
- '<option value="88">住8晚或8晚的倍数</option>\n' +
- '<option value="94">住9晚或9晚的倍数</option>';
- }
- $('.option-discounts').empty();
- $('.option-discounts').append(option);
- }
- }
-
- // 餐食数动态调整
- function mealChange(e) {
- value = $(e).val();
- var meal_select = '';
- if (value == 2) {
- meal_select = '<span> 餐食数 </span><select class="form-control">' +
- '<option value="128">无早</option>\n' +
- '<option value="126">单早</option>\n' +
- '<option value="127">双早</option>\n' +
- '<option value="125">三早</option>\n' +
- '<option value="117">四早</option>\n' +
- '<option value="118">五早</option>\n' +
- '<option value="119">六早</option>\n' +
- '<option value="120">七早</option>\n' +
- '<option value="121">七早</option>\n' +
- '<option value="122">八早</option>\n' +
- '<option value="123">九早</option>\n' +
- '<option value="124">十早</option></select>';
- }
- $('.breakfast-hide').html(meal_select);
- }
-
-
|