Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 

1515 wiersze
61 KiB

  1. //Author:fuhc
  2. //Date:20160919
  3. //
  4. var baseHTML = '';
  5. var childHTML = '';
  6. var firstDate = '';
  7. var d1 = "";
  8. var d2 = "";
  9. var d3 = "";
  10. var d4 = "";
  11. var d5 = "";
  12. var d6 = "";
  13. var d7 = "";
  14. var w1 = "";
  15. var w2 = "";
  16. var w3 = "";
  17. var w4 = "";
  18. var w5 = "";
  19. var w6 = "";
  20. var w7 = "";
  21. // 房型售卖状态
  22. var room_sale_status = "1";
  23. //基础房型关键字
  24. var base_room_type = '';
  25. var hotel_id = '';
  26. var hotel_name = '';
  27. var page_size = '5';
  28. var start_date = getPar('start_date');
  29. var qudao_least = 0;
  30. var date_flag = 0;
  31. $(document).ready(function () {
  32. $('#Wdate2').val(getDateTime(0));
  33. $('#Wdate3').val(getDateByDay(7, getDateTime(0)));
  34. baseHTML = $('.base').prop('outerHTML');
  35. childHTML = $('.child').prop('outerHTML');
  36. hotel_name = getPar('hotel_name');
  37. hotel_id = getPar('hotel_id');
  38. $("#lookLog").attr('go_path', 'zz-jd/hotel_log.html?hotel_id='+ hotel_id);
  39. if (hotel_name != "") {
  40. $('#hotel_name').text(hotel_name);
  41. }
  42. $('#channel_hotel_id').attr('href', 'channel_room_info.html?hotel_id=' + hotel_id + '&hotel_name=' + hotel_name + '');
  43. $('#room_order').attr('go_path', 'hotel/hotel/hotel-room-order?HOTEL_ID=' + hotel_id + '');
  44. // 设置tb_top_td
  45. setTbTopTd();
  46. // http
  47. current = localStorage.getItem('current') == null ? 1 : localStorage.getItem('current');
  48. getDataFromHttp();
  49. playPermission();
  50. $("#channel_room_link").attr('go_path', 'zz-jd/channel_room_info.html?channel_id=' + 669 + '&hotel_id=' + hotel_id + '&hotel_name=' + hotel_name);
  51. });
  52. $(document).ready(function () {
  53. // 今天
  54. $('#today').bind('click', function () {
  55. d1 = getDateTime(0);
  56. setTbTopTd();
  57. getDataFromHttp();
  58. });
  59. // 前7天
  60. $('#before7').bind('click', function () {
  61. d1 = getDateByDay(-7, d1);
  62. setTbTopTd();
  63. getDataFromHttp();
  64. });
  65. // 后7天
  66. $('#after7').bind('click', function () {
  67. d1 = getDateByDay(7, d1);
  68. setTbTopTd();
  69. getDataFromHttp();
  70. });
  71. // 售卖状态
  72. $('#sale_status').bind('change', function () {
  73. room_sale_status = $(this).val();
  74. });
  75. // 售卖状态
  76. $('#base_room_type').bind('change', function () {
  77. base_room_type = $(this).val();
  78. });
  79. //点击搜索
  80. $('#search').bind('click', function () {
  81. d1 = $('.Wdate').val();
  82. // 设置tb_top_td
  83. setTbTopTd();
  84. if (d1 != "") {
  85. // http
  86. current = 1;
  87. getDataFromHttp();
  88. }
  89. });
  90. // 新增房型
  91. $('#newAddRoom').bind('click', function () {
  92. var listURL = "add_room_type.html?hotel_id=" + hotel_id + "&hotel_name=" + hotel_name;
  93. listURL = encodeURI(listURL);
  94. $.cookie("path_url", cookie_path + "zz-jd/" + listURL, {domain: domain_path});
  95. window.open(system_path);
  96. //window.open(listURL);
  97. });
  98. // 点击保存
  99. $('.save_base').bind('click', function () {
  100. var childIndex = $temp_bday.attr('childIndex');
  101. var _td_date = $('.tb_title').children().eq(childIndex).attr('f_date');
  102. $('#base_price').val('-1');
  103. var _room_type = $temp_bday.parent().attr('data-room-type');
  104. var _hotel_id = hotel_id;
  105. var maiduan_count = $('#maiduan_count').val();
  106. var baoliu_count = $('#baoliu_count').val();
  107. var xianxun_count = $('#xianxun_count').val();
  108. var maiduan_cstr = "{" + _room_type + ",\"" + _td_date + "\",\"" + _td_date + "\"," + '2345671' + "," + '228' + "," + maiduan_count + "}";
  109. var xianxun_cstr = "{" + _room_type + ",\"" + _td_date + "\",\"" + _td_date + "\"," + '2345671' + "," + '229' + "," + xianxun_count + "}";
  110. var baoliu_cstr = "{" + _room_type + ",\"" + _td_date + "\",\"" + _td_date + "\"," + '2345671' + "," + '230' + "," + baoliu_count + "}";
  111. baoliu_cstr = baoliu_count === '' ? '' : baoliu_cstr;
  112. maiduan_cstr = maiduan_count === '' ? '' : maiduan_cstr;
  113. xianxun_cstr = xianxun_count === '' ? '' : xianxun_cstr;
  114. var cstr = baoliu_cstr + maiduan_cstr + xianxun_cstr;
  115. if (maiduan_count < 0 || baoliu_count < 0 || xianxun_count < 0) {
  116. ZZAlertInfo('库存数量请填写大于等于0的整数!', function () {
  117. })
  118. return;
  119. }
  120. if (cstr === '') {
  121. ZZAlertInfo('请完整填写库存数量,没有则填写0,至少一个不为空!', function () {
  122. })
  123. return;
  124. }
  125. if (parseInt(maiduan_count) + parseInt(baoliu_count) < qudao_least) {
  126. ZZAlertInfo('买断加保留数量不能小于渠道保底房间数!', function () {
  127. })
  128. return;
  129. }
  130. var urlapi = base_api;
  131. var param = {
  132. type: "room_base_SetBaseRoom",
  133. op: "AddBaseRoom",
  134. hotel_id: _hotel_id,
  135. room_info: cstr
  136. };
  137. ZZLog(urlapi + JSON.stringify(param));
  138. $(".save_base").html('保存中');
  139. loading();
  140. // $('.save_child').css('background-color', 'darkgray !important'); //不知道什么原因,不起作用
  141. $('.save_base').attr('style', 'cursor: pointer;background: darkgray!important;color: white;margin-left:26px;padding: 10px 20px;')
  142. $.post(urlapi, param, function (res_data) {
  143. res_data = JSON.parse(res_data);
  144. ZZLog(res_data);
  145. if (res_data['code'] != "0") {
  146. alert(res_data['info']);
  147. } else {
  148. clickMask();
  149. getDataFromHttp();
  150. }
  151. $(".save_base").html('保存');
  152. $('.save_base').attr('style', 'cursor: pointer;background: #428bca!important;color: white;margin-left:26px;padding: 10px 20px;');
  153. closeLoading();
  154. })
  155. })
  156. $('.save_child').bind('click', function () {
  157. var childIndex = $temp_cday.attr('childIndex');
  158. var _td_date = $('.tb_title').children().eq(childIndex).attr('f_date');
  159. var _child_maiduan_price = $("#child_maiduan_price").val();
  160. var _child_baoliu_price = $("#child_baoliu_price").val();
  161. var _child_xianxun_price = $("#child_xianxun_price").val();
  162. var _parent_room_type = $temp_cday.parent().attr('data-parent-room-type');
  163. var _room_type = $temp_cday.parent().attr('data-room-type');
  164. var _hotel_id = hotel_id;
  165. var _run_status = $('input[name="status"]:checked').val();
  166. if (_run_status == '') {
  167. ZZAlertInfo('请选择房态', function () {
  168. return;
  169. })
  170. }
  171. if (_child_maiduan_price == '' && _child_baoliu_price == '' && _child_xianxun_price == '') {
  172. ZZAlertInfo('请填写必要的采购价!', function () {
  173. return;
  174. })
  175. }
  176. if (isNaN(_child_maiduan_price) || isNaN(_child_baoliu_price) || isNaN(_child_xianxun_price)) {
  177. ZZAlertInfo('数据格式不正确');
  178. return;
  179. }
  180. var urlapi = base_api;
  181. var param = {
  182. type: "room_child_UpdateChildRoom",
  183. op: "update",
  184. run_status: _run_status,
  185. price_buyout: _child_maiduan_price,
  186. price_reserve: _child_baoliu_price,
  187. price_inquiry: _child_xianxun_price,
  188. run_date: _td_date,
  189. parent_room_type: _parent_room_type,
  190. room_type: _room_type,
  191. hotel_id: _hotel_id
  192. }
  193. ZZLog(urlapi + JSON.stringify(param));
  194. $(".save_child").html('保存中');
  195. loading();
  196. // $('.save_child').css('background-color', 'darkgray !important'); //不知道什么原因,不起作用
  197. $('.save_child').attr('style', 'cursor: pointer;background: darkgray!important;color: white;margin-left:26px;padding: 10px 20px;')
  198. $.post(urlapi, param, function (res_data) {
  199. res_data = JSON.parse(res_data);
  200. ZZLog(res_data);
  201. if (res_data['code'] != "0") {
  202. alert(res_data['info']);
  203. } else {
  204. clickMask();
  205. getDataFromHttp();
  206. }
  207. $(".save_child").html('保存');
  208. $('.save_child').attr('style', 'cursor: pointer;background: #428bca!important;color: white;margin-left:26px;padding: 10px 20px;');
  209. closeLoading();
  210. })
  211. // 房态
  212. })
  213. // 取消修改的弹框
  214. $('.cancel_base').bind('click', function () {
  215. clickMask();
  216. })
  217. $('.cancel_child').bind('click', function () {
  218. clickMask();
  219. })
  220. // 点击蒙板
  221. $('#mask').bind('click', function () {
  222. clickMask();
  223. })
  224. })
  225. // 新增子房型
  226. var cstr0 = '';
  227. var cstr1 = '';
  228. var cstr2 = '[无早]';
  229. var cstr3 = '';
  230. function appendBed(obj, bed_arr)
  231. {
  232. var bed_all_arr = new Array('不设置', '大床', '双床', '多床');
  233. var option = '<option value="0">不设置</option>';
  234. for(var i=0; i< bed_arr.length; i++)
  235. {
  236. option += '<option value="'+ bed_arr[i] +'">'+ bed_all_arr[bed_arr[i]] +'</option>';
  237. }
  238. if(obj.attr('has-append')== 'false')
  239. {
  240. obj.attr('has-append', 'true');
  241. obj.append(option);
  242. }
  243. }
  244. function addChild(selfOBJ) {
  245. $selfOBJ = $(selfOBJ);
  246. // var bed_all_arr = new Array('不设置', '大床', '双床', '多床');
  247. var room_type = $selfOBJ.parent().parent().attr('data-room-type');
  248. var room_name = $selfOBJ.parent().parent().children().eq(1).text().trim();
  249. var bed_type = $selfOBJ.parent().parent().attr('base-bed-type');
  250. var bed_arr = bed_type.split(',');
  251. var obj = $('#bed_type');
  252. appendBed(obj, bed_arr);
  253. /*
  254. var option = '<option value="0">不设置</option>';
  255. for(var i=0; i< bed_arr.length; i++)
  256. {
  257. option += '<option value="'+ bed_arr[i] +'">'+ bed_all_arr[bed_arr[i]] +'</option>';
  258. }
  259. if($('#bed_type').attr('has-append')== 'false')
  260. {
  261. $('#bed_type').attr('has-append', 'true');
  262. $('#bed_type').append(option);
  263. }
  264. if($('#modify_bed_type').attr('has-append') == 'false')
  265. {
  266. $('#modify_bed_type').attr('has-append', 'true');
  267. $('#modify_bed_type').append(option);
  268. }*/
  269. $("#div_maiduan_price").val('');
  270. $("#div_baoliu_price").val('');
  271. $("#div_xianxun_price").val('');
  272. ZZLog(room_name + '' + room_type);
  273. cstr0 = room_name;
  274. $('#div_room_name').text(room_name);
  275. $('#div_child_room_name').val(cstr0 + cstr1 + cstr2);
  276. $('#mask').css('background', 'black');
  277. $('#mask').css('opacity', '0.5');
  278. showCenterView('.main_style');
  279. }
  280. // 修改基础房型
  281. function updateBaseRoomInfo(selfOBJ) {
  282. localStorage.setItem('start_date', d1);
  283. localStorage.setItem('current', current);
  284. var room_type = $(selfOBJ).closest('tr').attr('data-room-type');
  285. var room_name = $(selfOBJ).attr('data-room-name');
  286. var start_date = $("#Wdate").val();
  287. 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;
  288. listURL = encodeURI(listURL);
  289. window.location.href = listURL;
  290. }
  291. // 选择入住人数
  292. function changePeople(selfOBJ) {
  293. var $selfOBJ = $(selfOBJ);
  294. var count = $selfOBJ.val();
  295. if (count < 100) {
  296. cstr1 = "(" + count + "人入住)";
  297. } else {
  298. cstr1 = '';
  299. }
  300. $('#div_child_room_name').val(cstr0 + cstr1 + cstr2);
  301. }
  302. //选择最晚预订日期
  303. function changeLastestBook(selfOBJ) {
  304. var $selfOBJ = $(selfOBJ);
  305. var fast = parseInt($selfOBJ.val());
  306. switch (fast) {
  307. case 0:
  308. fast = "";
  309. break;
  310. case 1:
  311. fast = "提前一天";
  312. break;
  313. case 2:
  314. fast = "提前二天";
  315. break;
  316. case 3:
  317. fast = "提前三天";
  318. break;
  319. case 4:
  320. fast = "提前四天";
  321. break;
  322. case 5:
  323. fast = "提前五天";
  324. break;
  325. case 6:
  326. fast = "提前六天";
  327. break;
  328. case 7:
  329. fast = "提前七天";
  330. break;
  331. }
  332. if (fast != "") {
  333. cstr3 = "[" + fast + "]";
  334. } else {
  335. cstr3 = "";
  336. }
  337. $('#div_child_room_name').val(cstr3 + cstr0 + cstr1 + cstr2);
  338. }
  339. // 选择早餐
  340. function changeBreakfast(selfOBJ) {
  341. var $selfOBJ = $(selfOBJ);
  342. var fast = parseInt($selfOBJ.val());
  343. switch (fast) {
  344. case 0:
  345. fast = "无早";
  346. break;
  347. case 1:
  348. fast = "单早";
  349. break;
  350. case 2:
  351. fast = "双早";
  352. break;
  353. case 3:
  354. fast = "三早";
  355. break;
  356. case 4:
  357. fast = "四早";
  358. break;
  359. case 5:
  360. fast = "五早";
  361. break;
  362. case 6:
  363. fast = "六早";
  364. break;
  365. case 7:
  366. fast = "七早";
  367. break;
  368. case 8:
  369. fast = "八早";
  370. break;
  371. case 9:
  372. fast = "九早";
  373. break;
  374. case 10 :
  375. fast = "十早";
  376. break;
  377. }
  378. cstr2 = "[" + fast + "]";
  379. $('#div_child_room_name').val(cstr0 + cstr1 + cstr2);
  380. }
  381. $(document).ready(function () {
  382. //
  383. $('#addChildSave').bind('click', function () {
  384. var _hotel_id = hotel_id;
  385. var _parent_room_type = $selfOBJ.parent().parent().attr('data-room-type');
  386. var _start_date = $('#Wdate2').val();
  387. var _end_date = $('#Wdate3').val();
  388. if (_start_date == "") {
  389. $('#Wdate2').focus();
  390. return;
  391. }
  392. if (_end_date == "") {
  393. $('#Wdate3').focus();
  394. return;
  395. }
  396. var _week_day = "";
  397. $('input[type="checkbox"][name="week"]:checked').each(function (index, domEle) {
  398. _week_day += $(domEle).val();
  399. });
  400. var _run_status = $('input[name="divRoom"]:checked').val();
  401. var _child_price_buyout = $('#div_maiduan_price').val();
  402. // if (_child_price_buyout == "") {
  403. // $('#div_maiduan_price').focus();
  404. // }
  405. var _child_price_reserve = $('#div_baoliu_price').val();
  406. var _child_price_inquiry = $('#div_xianxun_price').val();
  407. var _bed_type = $('#bed_type').val();
  408. _child_price_buyout = _child_price_buyout == '' ? -1 : _child_price_buyout;
  409. _child_price_reserve = _child_price_reserve == '' ? -1 : _child_price_reserve;
  410. _child_price_inquiry = _child_price_inquiry == '' ? -1 : _child_price_inquiry;
  411. var _people_count = $('#checkInCount').val();
  412. var _breakfast = $('#divBreakfast').val();
  413. if ($('#lastest_book_day_new').val() == -1) {
  414. var _lastest_book_time = -1;
  415. } else if ($('#lastest_book_day_new').val() == -2) {
  416. var _lastest_book_time = -2;
  417. } else {
  418. var _lastest_book_time = $('#lastest_book_day_new').val() + ',' + $('#lastest_book_date_new').val() + ':' + $('#lastest_book_time_new').val();
  419. }
  420. var _child_room_name = $('#div_child_room_name').val();
  421. if (_child_price_buyout == '' && _child_price_reserve == '' && _child_price_inquiry == '') {
  422. ZZAlertInfo('采购价不能全部为空');
  423. return false;
  424. } else if (_child_price_buyout == -1 && _child_price_reserve == -1 && _child_price_inquiry == -1) {
  425. ZZAlertInfo('采购价不能全部为0');
  426. return false;
  427. }
  428. if (_child_room_name == "") {
  429. ZZAlertInfo('子房型名称不能为空');
  430. return false;
  431. }
  432. if ($('#lastest_cancel_day_new').val() != -1) {
  433. var _lastest_cancel_day = $('#lastest_cancel_day_new').val() + ',' + $('#lastest_cancel_day_new1').val() + ':' + $('#lastest_cancel_day_new2').val();
  434. } else {
  435. var _lastest_cancel_day = -1;
  436. }
  437. var neibubs = $('#new_neibu').val();
  438. // var urlapi=base_api+"?type=room_AddChildRoom&hotel_id="+_hotel_id+
  439. // "&parent_room_type="+_parent_room_type+"&start_date="+_start_date+
  440. // "&end_date="+_end_date+"&week_day="+_week_day+"&run_status="+_run_status+
  441. // "&base_price="+_child_base_price+"&person_limit="+_people_count+
  442. // "&breakfast="+_breakfast+"&room_name="+_child_room_name;
  443. var urlapi = base_api;
  444. var param = {
  445. type: "room_child_AddChildRoom",
  446. hotel_id: _hotel_id,
  447. parent_room_type: _parent_room_type,
  448. start_date: _start_date,
  449. end_date: _end_date,
  450. week_day: _week_day,
  451. run_status: _run_status,
  452. price_buyout: _child_price_buyout,
  453. price_reserve: _child_price_reserve,
  454. price_inquiry: _child_price_inquiry,
  455. person_limit: _people_count,
  456. breakfast: _breakfast,
  457. room_name: _child_room_name,
  458. lastest_book_time: _lastest_book_time,
  459. lastest_cancel_day: _lastest_cancel_day,
  460. neibubs: neibubs,
  461. bed_type: _bed_type
  462. };
  463. ZZLog(urlapi + JSON.stringify(param));
  464. loading();
  465. $.ajax({
  466. url: urlapi,
  467. data: param,
  468. type: "post",
  469. dataType: "json",
  470. success: function (res_data) {
  471. ZZLog(res_data);
  472. if (res_data['code'] != "0") {
  473. alert(res_data['info']);
  474. } else {
  475. // 将弹出层隐藏
  476. clickMask();
  477. // 刷新数据
  478. getDataFromHttp();
  479. }
  480. closeLoading();
  481. },
  482. error: function (error) {
  483. alert('服务器异常,请联系管理员');
  484. ZZLog(error);
  485. closeLoading();
  486. }
  487. })
  488. })
  489. })
  490. // 将目标节点居中显示
  491. var $tempShowView = null;
  492. function showCenterView(classOrIdName) {
  493. $('#mask').css('display', 'block');
  494. $('#mask').css('z-index', '15');
  495. $showView = $(classOrIdName);
  496. $tempShowView = $showView;
  497. $showView.css('display', 'block');
  498. $showView.css('position', 'absolute');
  499. // $showView.css('top', $(window).height() / 2.2);
  500. $showView.css('top', $(window).height() / 3.2);
  501. $showView.css('left', '50%');
  502. $showView.css('z-index', '20');
  503. $showView.css('background', 'white');
  504. var w = $showView.css('width');
  505. var h = $showView.css('height');
  506. w = w.substr(0, w.length - 2);
  507. h = h.substr(0, h.length - 2);
  508. $showView.css('margin-top', '-' + h / 2 + 'px');
  509. $showView.css('margin-left', '-' + w / 2 + 'px');
  510. }
  511. // 点击蒙板
  512. function clickMask() {
  513. if ($temp_bday) {
  514. $('#up_base_room').css('display', 'none');
  515. $temp_bday.css('background', '');
  516. }
  517. if ($temp_cday) {
  518. $('#up_child_room').css('display', 'none');
  519. $temp_cday.css('background', '');
  520. }
  521. if ($tempShowView) {
  522. $('.main_style').css('display', 'none');
  523. $tempShowView.css('background', '');
  524. }
  525. if ($tempModify) {
  526. $('.modify_child_room').css('display', 'none');
  527. $tempModify.css('background', '');
  528. $('#modify_bed_type').html('');
  529. $('#modify_bed_type').attr('has-append', 'false');
  530. }
  531. $('#mask').css('display', 'none');
  532. }
  533. // 复选框事件
  534. var child_true_count = 0;
  535. function select_checked(index, selfOBJ) {
  536. $selfOBJ = $(selfOBJ);
  537. //index=0最上面的全选 index=1表示的是下面所有的
  538. var top_check = $('.ace')[0];
  539. var checkList = $('.ace');
  540. var checkCount = checkList.length - 1;
  541. var base_count = $('.baseace').length;
  542. for (var i = 1, m = checkList.length; i < m; i++) {
  543. if (index == '0') {
  544. checkList[i].checked = top_check.checked;
  545. } else if (index == '1') {
  546. // 当前的base为选中
  547. var room_type = $selfOBJ.closest('.base').attr('data-room-type');
  548. var t = $(checkList[i]).parent().parent().parent().attr('class');
  549. if (t == "child" + room_type) {
  550. checkList[i].checked = selfOBJ.checked;
  551. }
  552. } else {
  553. // if(selfOBJ==checkList[i] && selfOBJ.checked){
  554. // child_true_count+=1;
  555. // }
  556. // var t=$selfOBJ.parent().parent().parent().attr('class');
  557. // var parent_room_type=t.replace('child','');
  558. // var child_count=$('.child'+parent_room_type).length;
  559. // var ttt=$('.child'+parent_room_type);
  560. //
  561. // var room_type=$(checkList[i]).parent().parent().parent().attr('data-room-type');
  562. // ZZLog(child_count+"<><><>"+child_true_count);
  563. // if(room_type==parent_room_type && child_true_count==child_count){
  564. // checkList[i].checked=selfOBJ.checked;
  565. // }
  566. }
  567. }
  568. }
  569. // 复选框事件
  570. function alterCheck(obj)
  571. {
  572. $obj = obj;
  573. $('.ace')[0].checked = $obj.checked;
  574. select_checked(0, $('.ace')[0]);
  575. }
  576. function getDataFromHttp() {
  577. var urlapi = base_api + "?type=room_RoomList&hotel_id=" + hotel_id + "&start_date=" + d1 + "&sale_status=" + room_sale_status + "&current=" + current + "&page_size=" + page_size + "&base_room_type=" + base_room_type;
  578. ZZLog(urlapi);
  579. $.ajaxSetup({
  580. async: false
  581. });
  582. $.getJSON(urlapi, function (res_data) {
  583. ZZLog(res_data);
  584. if (res_data['code'] != "0") {
  585. alert(res_data['info']);
  586. } else {
  587. var HTML = '';
  588. var room_list = res_data['room_list'];
  589. for (var i = 0, m = room_list.length; i < m; i++) {
  590. var tempDict = room_list[i];
  591. var tempHTML = '';
  592. if (tempDict['parent_room_type'] == "0") {
  593. tempHTML = baseHTML;
  594. HTML += setBaseHTML(tempHTML, tempDict);
  595. } else {
  596. tempHTML = childHTML;
  597. HTML += setChildHTML(tempHTML, tempDict);
  598. }
  599. }
  600. if (HTML) {
  601. $('#room_list').html(HTML);
  602. $('#table').show();
  603. if (res_data['total'] < 1) {
  604. $('.pageDiv').hide();
  605. } else {
  606. $(".pageDiv").createPage({
  607. pageCount: res_data['total_page'],//总页数
  608. current: current,//当前页
  609. turndown: 'true',//是否显示跳转框,显示为true,不现实为false,一定记得加上引号...
  610. backFn: function (p) {
  611. current = p;
  612. getDataFromHttp();
  613. }
  614. });
  615. $('.pageDiv').show();
  616. }
  617. $('#room_list').css('display', 'table-row-group');
  618. // 添加好innerHTML再添加事件
  619. baseAddEvent();
  620. bdayAddEvent();
  621. cdayAddEvent();
  622. onOffLineAddEvent();
  623. saleRule();
  624. $('.bday').each(function (index, domEle) {
  625. if ($(this).attr('data-value') == "") {
  626. $(this).css('background', '');
  627. $(this).css('text-align', 'center');
  628. $(this).css('vertical-align', 'middle');
  629. $(this).html('暂无');
  630. }
  631. })
  632. $('.cday').each(function (index, domEle) {
  633. if ($(this).attr('data-value') == "||") {
  634. $(this).html('暂无');
  635. $(this).css('text-align', 'center');
  636. $(this).css('vertical-align', 'middle');
  637. $(this).css('background', '');
  638. }
  639. })
  640. } else {
  641. $('#room_list').html(HTML);
  642. $('#table').show();
  643. }
  644. }
  645. }).error(function (data) {
  646. });
  647. }
  648. // 给.base添加事件
  649. function baseAddEvent() {
  650. $('.base').each(function (index, domEle) {
  651. $(this).children().eq(1).bind('click', function () {
  652. var room_type = $(this).attr('data-room-type');
  653. var $childOBJ = $('.child' + room_type);
  654. if ($childOBJ.css('display') == 'none') {
  655. $(this).children().eq(0).attr('src', "images/down_arrow.png");
  656. $childOBJ.css('display', 'table-row');
  657. } else {
  658. $(this).children().eq(0).attr('src', "images/up_arrow.png");
  659. $childOBJ.css('display', 'none');
  660. }
  661. });
  662. })
  663. }
  664. // 给.bday添加事件
  665. var $temp_bday = null;
  666. function bdayAddEvent() {
  667. $('.bday').bind('click', function (e) {
  668. if ($(this).attr('data-value') == "") {
  669. return;
  670. }
  671. $('#mask').css('display', 'block');
  672. $('#mask').css('background', 'white');
  673. $('#mask').css('opacity', '0');
  674. if ($temp_bday != null) {
  675. $temp_bday.css('background', '');
  676. }
  677. if ($temp_cday != null) {
  678. $('#up_child_room').css('display', 'none');
  679. $temp_cday.css('background', '');
  680. }
  681. // var childIndex=$(this).attr('childIndex');
  682. // td_date=$('.tb_title').children().eq(childIndex).attr('f_date');
  683. // ZZLog(td_date);
  684. // 得到鼠标的位置
  685. var mouseLeft = $(this).offset().left;
  686. var mouseTop = $(this).offset().top;
  687. var td_height = parseInt($(this).css('height').replace('px', ''));
  688. $(this).css('background', '#ddd');
  689. $('#up_base_room').css('top', mouseTop + td_height + 'px');
  690. $('#up_base_room').css('display', 'block');
  691. $('#base_stock_type').val($(this).children().eq(0).attr('data-inventory-type'));
  692. var num1 = $(this).attr('data-count');
  693. num1 = num1 == '' ? 0 : num1;
  694. $('#qudao_baodi').text('渠道保底' + num1 + '间');
  695. qudao_least = $(this).attr('data-count');
  696. var count = $(this).attr('data-value').split('/');
  697. $('#maiduan_count').val(count[0]);
  698. $('#baoliu_count').val(count[1]);
  699. $('#xianxun_count').val(count[2]);
  700. $temp_bday = $(this);
  701. })
  702. }
  703. // 给.cday添加事件
  704. var $temp_cday = null;
  705. function cdayAddEvent() {
  706. $('.cday').bind('click', function () {
  707. if ($(this).attr('data-value') == "||") {
  708. return;
  709. }
  710. $('#mask').css('display', 'block');
  711. $('#mask').css('background', 'white');
  712. $('#mask').css('opacity', '0');
  713. if ($temp_cday != null) {
  714. $temp_cday.css('background', '');
  715. }
  716. if ($temp_bday != null) {
  717. $('#up_base_room').css('display', 'none');
  718. $temp_bday.css('background', '');
  719. }
  720. $('#up_base_room').css('display', 'none');
  721. // 得到鼠标的位置
  722. var mouseLeft = $(this).offset().left;
  723. var mouseTop = $(this).offset().top;
  724. var td_height = parseInt($(this).css('height').replace('px', ''));
  725. $(this).css('background', '#ddd');
  726. $('#up_child_room').css('top', mouseTop + td_height + 'px');
  727. $('#up_child_room').css('display', 'block');
  728. $('#up_child_room').attr('')
  729. var is_close = $(this).attr('data-close')
  730. $('input[name="status"][value="' + is_close + '"]').attr("checked", true);
  731. $('input[name="status"][value="' + is_close + '"]').prop("checked", true);
  732. var child_price = $(this).attr('data-value').split('|');
  733. ZZLog(child_price);
  734. //买断价
  735. $('#child_maiduan_price').val(child_price[0]);
  736. //保留价
  737. $('#child_baoliu_price').val(child_price[1]);
  738. //现询价
  739. $('#child_xianxun_price').val(child_price[2]);
  740. //已售数量
  741. $temp_cday = $(this);
  742. })
  743. }
  744. function CancelChildRoom(obj) {
  745. var info = '确认要删除对应的子房型吗?请谨慎操作';
  746. ZZConfirm(info, function () {
  747. var room_type = $(obj).closest('tr').attr('data-room-type');
  748. if (room_type == undefined) {
  749. alert('缺少room_type参数');
  750. return;
  751. }
  752. var urlapi = base_api;
  753. var param = {
  754. type: "room_child_CancelChildRoom",
  755. hotel_id: hotel_id,
  756. room_type: room_type
  757. }
  758. ZZLog(urlapi + JSON.stringify(param));
  759. loading();
  760. $.ajax({
  761. url: urlapi,
  762. type: "post",
  763. data: param,
  764. success: function (res_data) {
  765. res_data = JSON.parse(res_data);
  766. ZZLog(res_data);
  767. if (res_data['code'] == 0) {
  768. ZZAlertInfo('删除成功')
  769. } else {
  770. ZZAlertInfo(res_data['info'])
  771. }
  772. // 刷新数据
  773. getDataFromHttp();
  774. closeLoading();
  775. }
  776. });
  777. })
  778. }
  779. //上下线
  780. function onOffLineAddEvent() {
  781. $('.child_on_off_line').bind('click', function () {
  782. //1 shangxian
  783. //0 xiaxian
  784. var info = '';
  785. var is_onsale = $(this).attr('data-value');
  786. var room_type = $(this).closest('tr').attr('data-room-type');
  787. var parent_room_type = $(this).closest('tr').attr('data-parent-room-type');
  788. if (room_type == undefined) {
  789. alert('缺少room_type参数');
  790. return;
  791. }
  792. info = is_onsale == '0' ? "确定上线?" : "确定下线?";
  793. ZZConfirm(info, function () {
  794. var urlapi = base_api;
  795. var param = {};
  796. if (is_onsale == 1) {
  797. param = {
  798. type: "room_child_OffLineChildRoom",
  799. hotel_id: hotel_id,
  800. room_type: room_type,
  801. parent_room_type: parent_room_type
  802. }
  803. } else {
  804. param = {
  805. type: "room_child_OnLineChildRoom",
  806. hotel_id: hotel_id,
  807. room_type: room_type,
  808. parent_room_type: parent_room_type
  809. }
  810. }
  811. ZZLog(urlapi + JSON.stringify(param));
  812. loading();
  813. $.ajax({
  814. url: urlapi,
  815. type: "post",
  816. data: param,
  817. success: function (res_data) {
  818. ZZLog(res_data);
  819. // 刷新数据
  820. getDataFromHttp();
  821. closeLoading();
  822. }
  823. });
  824. })
  825. });
  826. }
  827. //销售规则
  828. function saleRule() {
  829. $('.child_sale_rule').bind('click', function () {
  830. localStorage.setItem('start_date', d1);
  831. localStorage.setItem('current', current);
  832. var _hotel_id = hotel_id;
  833. var _parent_room_type = $(this).closest('tr').attr('data-parent-room-type');
  834. var _room_type = $(this).closest('tr').attr('data-room-type');
  835. var _room_type_str = $(this).closest('tr').children().eq(1).text();
  836. var _start_date = $("#Wdate").val();
  837. 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;
  838. listURL = encodeURI(listURL);
  839. window.location.href = listURL;
  840. })
  841. }
  842. // 设置表格头部的td
  843. function setTbTopTd() {
  844. // 设置标题的日期和星期
  845. var today = getDateTime(0);
  846. // localStorage.setItem("start_date", null);
  847. if (d1 == "") {
  848. /*if (localStorage.getItem("start_date") != null) {
  849. localStorage.setItem("start_date", today);
  850. d1 = localStorage.getItem("start_date");
  851. } else {
  852. d1 = today;
  853. }*/
  854. d1 = today;
  855. }
  856. if (date_flag == 0) {
  857. var start_date = getPar('start_date');
  858. if (start_date != '')
  859. d1 = getDateTime(0, new Date(start_date));
  860. date_flag = 1;
  861. }
  862. $('#Wdate').val(d1);
  863. d2 = after(d1);
  864. d3 = after(d2);
  865. d4 = after(d3);
  866. d5 = after(d4);
  867. d6 = after(d5);
  868. d7 = after(d6);
  869. w1 = getWeekDay(d1);
  870. w2 = getWeekDay(d2);
  871. w3 = getWeekDay(d3);
  872. w4 = getWeekDay(d4);
  873. w5 = getWeekDay(d5);
  874. w6 = getWeekDay(d6);
  875. w7 = getWeekDay(d7);
  876. $('#f_date1').attr('f_date', d1);
  877. $('#f_date2').attr('f_date', d2);
  878. $('#f_date3').attr('f_date', d3);
  879. $('#f_date4').attr('f_date', d4);
  880. $('#f_date5').attr('f_date', d5);
  881. $('#f_date6').attr('f_date', d6);
  882. $('#f_date7').attr('f_date', d7);
  883. var td1 = d1.substring(5);
  884. var td2 = d2.substring(5);
  885. var td3 = d3.substring(5);
  886. var td4 = d4.substring(5);
  887. var td5 = d5.substring(5);
  888. var td6 = d6.substring(5);
  889. var td7 = d7.substring(5);
  890. $('#f_date1').html(td1 + "</br>" + w1);
  891. $('#f_date2').html(td2 + "</br>" + w2);
  892. $('#f_date3').html(td3 + "</br>" + w3);
  893. $('#f_date4').html(td4 + "</br>" + w4);
  894. $('#f_date5').html(td5 + "</br>" + w5);
  895. $('#f_date6').html(td6 + "</br>" + w6);
  896. $('#f_date7').html(td7 + "</br>" + w7);
  897. // 将日期为今天的星期设置为今天
  898. $('th[f_date=' + getDateTime(0) + ']').html(getDateTime(0).substring(5) + '</br>今天');
  899. }
  900. function setBaseHTML(tempHTML, tempDict) {
  901. var HTML = '';
  902. var cstr1 = '';
  903. var date1 = tempDict['date1'];
  904. var s1 = (date1['buyout_count'] == '' ? '0' : date1['buyout_count']) + '/' + (date1['reserve_count'] == '' ? '0' : date1['reserve_count']) + '/' + (date1['inquiry_count'] == '' ? '0' : date1['inquiry_count']);
  905. var cstr2 = '';
  906. var date2 = tempDict['date2'];
  907. var s2 = (date2['buyout_count'] == '' ? '0' : date2['buyout_count']) + '/' + (date2['reserve_count'] == '' ? '0' : date2['reserve_count']) + '/' + (date2['inquiry_count'] == '' ? '0' : date2['inquiry_count']);
  908. var cstr3 = '';
  909. var date3 = tempDict['date3'];
  910. var s3 = (date3['buyout_count'] == '' ? '0' : date3['buyout_count']) + '/' + (date3['reserve_count'] == '' ? '0' : date3['reserve_count']) + '/' + (date3['inquiry_count'] == '' ? '0' : date3['inquiry_count']);
  911. var cstr4 = '';
  912. var date4 = tempDict['date4'];
  913. var s4 = (date4['buyout_count'] == '' ? '0' : date4['buyout_count']) + '/' + (date4['reserve_count'] == '' ? '0' : date4['reserve_count']) + '/' + (date4['inquiry_count'] == '' ? '0' : date4['inquiry_count']);
  914. var cstr5 = '';
  915. var date5 = tempDict['date5'];
  916. var s5 = (date5['buyout_count'] == '' ? '0' : date5['buyout_count']) + '/' + (date5['reserve_count'] == '' ? '0' : date5['reserve_count']) + '/' + (date5['inquiry_count'] == '' ? '0' : date5['inquiry_count']);
  917. var cstr6 = '';
  918. var date6 = tempDict['date6'];
  919. var s6 = (date6['buyout_count'] == '' ? '0' : date6['buyout_count']) + '/' + (date6['reserve_count'] == '' ? '0' : date6['reserve_count']) + '/' + (date6['inquiry_count'] == '' ? '0' : date6['inquiry_count']);
  920. var cstr7 = '';
  921. var date7 = tempDict['date7'];
  922. var s7 = (date7['buyout_count'] == '' ? '0' : date7['buyout_count']) + '/' + (date7['reserve_count'] == '' ? '0' : date7['reserve_count']) + '/' + (date7['inquiry_count'] == '' ? '0' : date7['inquiry_count']);
  923. tempHTML = tempHTML.replace('[房型名称]', tempDict['room_name']);
  924. tempHTML = tempHTML.replace('[update-room-name]', tempDict['room_name']);
  925. tempHTML = tempHTML.replace('[tr-room-type]', tempDict['room_type']);
  926. tempHTML = tempHTML.replace('[room-type]', tempDict['room_type']);
  927. tempHTML = tempHTML.replace('[total-count1]', date1['remain_count']);
  928. tempHTML = tempHTML.replace('[total-count2]', date2['remain_count']);
  929. tempHTML = tempHTML.replace('[total-count3]', date3['remain_count']);
  930. tempHTML = tempHTML.replace('[total-count4]', date4['remain_count']);
  931. tempHTML = tempHTML.replace('[total-count5]', date5['remain_count']);
  932. tempHTML = tempHTML.replace('[total-count6]', date6['remain_count']);
  933. tempHTML = tempHTML.replace('[total-count7]', date7['remain_count']);
  934. tempHTML = tempHTML.replace('[base-bed-type]', tempDict['bed_type']);
  935. if (date1['inventory_type'] != "") {
  936. cstr1 =
  937. //'<img data-inventory-type=' + date1["inventory_type"] + ' style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + date1["inventory_type"] + '.png"/>'
  938. '<span>已售' + (date1['saled_count'] == '' ? '0' : date1['saled_count']) + '</span></br>'
  939. + '<span> </span></br>'
  940. + '<span>剩余' + s1 + '</span>';
  941. //+ '<span>采购:' + date1["base_price"] + '</span>';
  942. tempHTML = tempHTML.replace('[value1]', (date1['buyout_count'] == '' ? '0' : date1['buyout_count']) + '/' + (date1['reserve_count'] == '' ? '0' : date1['reserve_count']) + '/' + (date1['inquiry_count'] == '' ? '0' : date1['inquiry_count']));
  943. } else {
  944. tempHTML = tempHTML.replace('[value1]', "");
  945. }
  946. tempHTML = tempHTML.replace('[day1]', cstr1);
  947. if (date2['inventory_type'] != "") {
  948. cstr2 =
  949. //'<img data-inventory-type=' + date2["inventory_type"] + ' style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + date2['inventory_type'] + '.png"/>'
  950. '<span>已售' + (date2['saled_count'] == '' ? '0' : date2['saled_count']) + '</span></br>'
  951. + '<span> </span></br>'
  952. + '<span>剩余' + s2 + '</span>'
  953. //+ '<span>采购:' + date2['base_price'] + '</span>'
  954. ;
  955. tempHTML = tempHTML.replace('[value2]', (date2['buyout_count'] == '' ? '0' : date2['buyout_count']) + '/' + (date2['reserve_count'] == '' ? '0' : date2['reserve_count']) + '/' + (date2['inquiry_count'] == '' ? '0' : date2['inquiry_count']));
  956. } else {
  957. tempHTML = tempHTML.replace('[value2]', "");
  958. }
  959. tempHTML = tempHTML.replace('[day2]', cstr2);
  960. if (date3['inventory_type'] != "") {
  961. cstr3 =
  962. //'<img data-inventory-type=' + date3["inventory_type"] + ' style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + date3['inventory_type'] + '.png"/>'
  963. '<span>已售' + (date3['saled_count'] == '' ? '0' : date3['saled_count']) + '</span></br>'
  964. + '<span> </span></br>'
  965. + '<span>剩余' + s3 + '</span>'
  966. // + '<span>采购:' + date3['base_price'] + '</span>'
  967. ;
  968. tempHTML = tempHTML.replace('[value3]', (date3['buyout_count'] == '' ? '0' : date3['buyout_count']) + '/' + (date3['reserve_count'] == '' ? '0' : date3['reserve_count']) + '/' + (date3['inquiry_count'] == '' ? '0' : date3['inquiry_count']));
  969. } else {
  970. tempHTML = tempHTML.replace('[value3]', "");
  971. }
  972. tempHTML = tempHTML.replace('[day3]', cstr3);
  973. if (date4['inventory_type'] != "") {
  974. cstr4 =
  975. //'<img data-inventory-type=' + date4["inventory_type"] + ' style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + date4['inventory_type'] + '.png"/>'
  976. '<span>已售' + (date4['saled_count'] == '' ? '0' : date4['saled_count']) + '</span></br>'
  977. + '<span> </span></br>'
  978. + '<span>剩余' + s4 + '</span>';
  979. //+ '<span>采购:' + date4['base_price'] + '</span>'
  980. tempHTML = tempHTML.replace('[value4]', (date4['buyout_count'] == '' ? '0' : date4['buyout_count']) + '/' + (date4['reserve_count'] == '' ? '0' : date4['reserve_count']) + '/' + (date4['inquiry_count'] == '' ? '0' : date4['inquiry_count']));
  981. } else {
  982. tempHTML = tempHTML.replace('[value4]', "");
  983. }
  984. tempHTML = tempHTML.replace('[day4]', cstr4);
  985. if (date5['inventory_type'] != "") {
  986. cstr5 =
  987. //'<img data-inventory-type=' + date5["inventory_type"] + ' style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + date5['inventory_type'] + '.png"/>'
  988. '<span>已售' + (date5['saled_count'] == '' ? '0' : date5['saled_count']) + '</span></br>'
  989. + '<span> </span></br>'
  990. + '<span>剩余' + s5 + '</span>'
  991. // + '<span>采购:' + date5['base_price'] + '</span>'
  992. ;
  993. tempHTML = tempHTML.replace('[value5]', (date5['buyout_count'] == '' ? '0' : date5['buyout_count']) + '/' + (date5['reserve_count'] == '' ? '0' : date5['reserve_count']) + '/' + (date5['inquiry_count'] == '' ? '0' : date5['inquiry_count']));
  994. } else {
  995. tempHTML = tempHTML.replace('[value5]', "");
  996. }
  997. tempHTML = tempHTML.replace('[day5]', cstr5);
  998. if (date6['inventory_type'] != "") {
  999. cstr6 =
  1000. //'<img data-inventory-type=' + date6["inventory_type"] + ' style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + date6['inventory_type'] + '.png"/>'
  1001. '<span>已售' + (date6['saled_count'] == '' ? '0' : date6['saled_count']) + '</span></br>'
  1002. + '<span> </span></br>'
  1003. + '<span>剩余' + s6 + '</span>';
  1004. //+ '<span>采购:' + date6['base_price'] + '</span>';
  1005. tempHTML = tempHTML.replace('[value6]', (date6['buyout_count'] == '' ? '0' : date6['buyout_count']) + '/' + (date6['reserve_count'] == '' ? '0' : date6['reserve_count']) + '/' + (date6['inquiry_count'] == '' ? '0' : date6['inquiry_count']));
  1006. } else {
  1007. tempHTML = tempHTML.replace('[value6]', "");
  1008. }
  1009. tempHTML = tempHTML.replace('[day6]', cstr6);
  1010. if (date7['inventory_type'] != "") {
  1011. cstr7 =
  1012. //'<img data-inventory-type=' + date7["inventory_type"] + ' style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + date7['inventory_type'] + '.png"/>'
  1013. '<span>已售' + (date7['saled_count'] == '' ? '0' : date7['saled_count']) + '</span></br>'
  1014. + '<span> </span></br>'
  1015. + '<span>剩余' + s7 + '</span>'
  1016. // + '<span>采购:' + date7['base_price'] + '</span>'
  1017. ;
  1018. tempHTML = tempHTML.replace('[value7]', (date7['buyout_count'] == '' ? '0' : date7['buyout_count']) + '/' + (date7['reserve_count'] == '' ? '0' : date7['reserve_count']) + '/' + (date7['inquiry_count'] == '' ? '0' : date7['inquiry_count']));
  1019. } else {
  1020. tempHTML = tempHTML.replace('[value7]', "");
  1021. }
  1022. tempHTML = tempHTML.replace('[day7]', cstr7);
  1023. HTML += tempHTML;
  1024. return HTML;
  1025. }
  1026. function setChildHTML(tempHTML, tempDict) {
  1027. var HTML = '';
  1028. var cstr1 = '';
  1029. var date1 = tempDict['date1'];
  1030. var img1 = (date1['is_closed'] == "2" || date1['is_closed'] == "0") ? "man.png" : "";
  1031. var cstr2 = '';
  1032. var date2 = tempDict['date2'];
  1033. var img2 = (date2['is_closed'] == "2" || date2['is_closed'] == "0") ? "man.png" : "";
  1034. var cstr3 = '';
  1035. var date3 = tempDict['date3'];
  1036. var img3 = (date3['is_closed'] == "2" || date3['is_closed'] == "0") ? "man.png" : "";
  1037. var cstr4 = '';
  1038. var date4 = tempDict['date4'];
  1039. var img4 = (date4['is_closed'] == "2" || date4['is_closed'] == "0") ? "man.png" : "";
  1040. var cstr5 = '';
  1041. var date5 = tempDict['date5'];
  1042. var img5 = (date5['is_closed'] == "2" || date5['is_closed'] == "0") ? "man.png" : "";
  1043. var cstr6 = '';
  1044. var date6 = tempDict['date6'];
  1045. var img6 = (date6['is_closed'] == "2" || date6['is_closed'] == "0") ? "man.png" : "";
  1046. var cstr7 = '';
  1047. var date7 = tempDict['date7'];
  1048. var img7 = (date7['is_closed'] == "2" || date7['is_closed'] == "0") ? "man.png" : "";
  1049. var t_str1 = img1 != "" ? '<img style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + img1 + '"/>' : "";
  1050. var t_str2 = img2 != "" ? '<img style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + img2 + '"/>' : "";
  1051. var t_str3 = img3 != "" ? '<img style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + img3 + '"/>' : "";
  1052. var t_str4 = img4 != "" ? '<img style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + img4 + '"/>' : "";
  1053. var t_str5 = img5 != "" ? '<img style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + img5 + '"/>' : "";
  1054. var t_str6 = img6 != "" ? '<img style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + img6 + '"/>' : "";
  1055. var t_str7 = img7 != "" ? '<img style="float: right;margin-top: -8px;margin-right: -9px;" src="images/' + img7 + '"/>' : "";
  1056. //子房型已售数量
  1057. var saled1 = date1['saled_count'];
  1058. var saled2 = date2['saled_count'];
  1059. var saled3 = date3['saled_count'];
  1060. var saled4 = date4['saled_count'];
  1061. var saled5 = date5['saled_count'];
  1062. var saled6 = date6['saled_count'];
  1063. var saled7 = date7['saled_count'];
  1064. //买断采购价
  1065. var mdprice1 = date1['price_buyout'];
  1066. //保留采购价
  1067. var blprice1 = date1['price_reserve'];
  1068. //现询采购价
  1069. var xxprice1 = date1['price_inquiry'];
  1070. var mdprice2 = date2['price_buyout'];
  1071. var blprice2 = date2['price_reserve'];
  1072. var xxprice2 = date2['price_inquiry'];
  1073. var mdprice3 = date3['price_buyout'];
  1074. var blprice3 = date3['price_reserve'];
  1075. var xxprice3 = date3['price_inquiry'];
  1076. var mdprice4 = date4['price_buyout'];
  1077. var blprice4 = date4['price_reserve'];
  1078. var xxprice4 = date4['price_inquiry'];
  1079. var mdprice5 = date5['price_buyout'];
  1080. var blprice5 = date5['price_reserve'];
  1081. var xxprice5 = date5['price_inquiry'];
  1082. var mdprice6 = date6['price_buyout'];
  1083. var blprice6 = date6['price_reserve'];
  1084. var xxprice6 = date6['price_inquiry'];
  1085. var mdprice7 = date7['price_buyout'];
  1086. var blprice7 = date7['price_reserve'];
  1087. var xxprice7 = date7['price_inquiry'];
  1088. var rmb = '<span style="display:inline-block;font-family:;font-family: Microsoft YaHei,STXihei,MingLiu;" microsoftyahei",stxihei,mingliu;>¥</span>';
  1089. var showsaled1 = saled1 == '' ? '<span>已售:-</span></br>' : '<span>已售:' + saled1 + '</span></br>';
  1090. var showsaled2 = saled2 == '' ? '<span>已售:-</span></br>' : '<span>已售:' + saled2 + '</span></br>';
  1091. var showsaled3 = saled3 == '' ? '<span>已售:-</span></br>' : '<span>已售:' + saled3 + '</span></br>';
  1092. var showsaled4 = saled4 == '' ? '<span>已售:-</span></br>' : '<span>已售:' + saled4 + '</span></br>';
  1093. var showsaled5 = saled5 == '' ? '<span>已售:-</span></br>' : '<span>已售:' + saled5 + '</span></br>';
  1094. var showsaled6 = saled6 == '' ? '<span>已售:-</span></br>' : '<span>已售:' + saled6 + '</span></br>';
  1095. var showsaled7 = saled7 == '' ? '<span>已售:-</span></br>' : '<span>已售:' + saled7 + '</span></br>';
  1096. var showmdprice1 = mdprice1 == '' ? '<span>买断:' + '-' + '</span></br>' : '<span>买断:' + rmb + mdprice1 + '</span></br>';
  1097. var showmdprice2 = mdprice2 == '' ? '<span>买断:' + '-' + '</span></br>' : '<span>买断:' + rmb + mdprice2 + '</span></br>';
  1098. var showmdprice3 = mdprice3 == '' ? '<span>买断:' + '-' + '</span></br>' : '<span>买断:' + rmb + mdprice3 + '</span></br>';
  1099. var showmdprice4 = mdprice4 == '' ? '<span>买断:' + '-' + '</span></br>' : '<span>买断:' + rmb + mdprice4 + '</span></br>';
  1100. var showmdprice5 = mdprice5 == '' ? '<span>买断:' + '-' + '</span></br>' : '<span>买断:' + rmb + mdprice5 + '</span></br>';
  1101. var showmdprice6 = mdprice6 == '' ? '<span>买断:' + '-' + '</span></br>' : '<span>买断:' + rmb + mdprice6 + '</span></br>';
  1102. var showmdprice7 = mdprice7 == '' ? '<span>买断:' + '-' + '</span></br>' : '<span>买断:' + rmb + mdprice7 + '</span></br>';
  1103. var showblprice1 = blprice1 == '' ? '<span>保留:' + '-' + '</span></br>' : '<span>保留:' + rmb + blprice1 + '</span></br>';
  1104. var showblprice2 = blprice2 == '' ? '<span>保留:' + '-' + '</span></br>' : '<span>保留:' + rmb + blprice2 + '</span></br>';
  1105. var showblprice3 = blprice3 == '' ? '<span>保留:' + '-' + '</span></br>' : '<span>保留:' + rmb + blprice3 + '</span></br>';
  1106. var showblprice4 = blprice4 == '' ? '<span>保留:' + '-' + '</span></br>' : '<span>保留:' + rmb + blprice4 + '</span></br>';
  1107. var showblprice5 = blprice5 == '' ? '<span>保留:' + '-' + '</span></br>' : '<span>保留:' + rmb + blprice5 + '</span></br>';
  1108. var showblprice6 = blprice6 == '' ? '<span>保留:' + '-' + '</span></br>' : '<span>保留:' + rmb + blprice6 + '</span></br>';
  1109. var showblprice7 = blprice7 == '' ? '<span>保留:' + '-' + '</span></br>' : '<span>保留:' + rmb + blprice7 + '</span></br>';
  1110. var showxxprice1 = xxprice1 == '' ? '<span>现询:' + '-' + '</span></br>' : '<span>现询:' + rmb + xxprice1 + '</span></br>';
  1111. var showxxprice2 = xxprice2 == '' ? '<span>现询:' + '-' + '</span></br>' : '<span>现询:' + rmb + xxprice2 + '</span></br>';
  1112. var showxxprice3 = xxprice3 == '' ? '<span>现询:' + '-' + '</span></br>' : '<span>现询:' + rmb + xxprice3 + '</span></br>';
  1113. var showxxprice4 = xxprice4 == '' ? '<span>现询:' + '-' + '</span></br>' : '<span>现询:' + rmb + xxprice4 + '</span></br>';
  1114. var showxxprice5 = xxprice5 == '' ? '<span>现询:' + '-' + '</span></br>' : '<span>现询:' + rmb + xxprice5 + '</span></br>';
  1115. var showxxprice6 = xxprice6 == '' ? '<span>现询:' + '-' + '</span></br>' : '<span>现询:' + rmb + xxprice6 + '</span></br>';
  1116. var showxxprice7 = xxprice7 == '' ? '<span>现询:' + '-' + '</span></br>' : '<span>现询:' + rmb + xxprice7 + '</span></br>';
  1117. tempHTML = tempHTML.replace('[房型名称]', tempDict['inner_identify'] != null ? (" " + tempDict['room_name'] + '|' + tempDict['inner_identify']) : (" " + tempDict['room_name']));
  1118. tempHTML = tempHTML.replace('[tr-room-type]', tempDict['room_type']);
  1119. tempHTML = tempHTML.replace('[bed-type]', tempDict['bed_type']);
  1120. tempHTML = tempHTML.replace('[room-type]', tempDict['room_type']);
  1121. tempHTML = tempHTML.replace('[下线]', tempDict['is_onsale'] == 1 ? "下线" : "上线");
  1122. tempHTML = tempHTML.replace('[is_onsale]', tempDict['is_onsale']);
  1123. tempHTML = tempHTML.replace('child', "child" + tempDict['parent_room_type']);
  1124. tempHTML = tempHTML.replace('[parent-room-type]', tempDict['parent_room_type']);
  1125. tempHTML = tempHTML.replace('[data-room-modify-info]', tempDict['occupancy_limit'] + '|' + tempDict['breakfast_include'] + '|' + tempDict['lastest_book_time'] + '|' + tempDict['lastest_cancel_day']);
  1126. // tempHTML = tempHTML.replace('[total-count1]', date1['price_buyout']+'|'+date1['price_reserve']+'|'+date1['price_inquiry']);
  1127. // tempHTML = tempHTML.replace('[total-count2]', date1['price_buyout']+'|'+date1['price_reserve']+'|'+date1['price_inquiry']);
  1128. // tempHTML = tempHTML.replace('[total-count3]', date1['price_buyout']+'|'+date1['price_reserve']+'|'+date1['price_inquiry']);
  1129. // tempHTML = tempHTML.replace('[total-count4]', date1['price_buyout']+'|'+date1['price_reserve']+'|'+date1['price_inquiry']);
  1130. // tempHTML = tempHTML.replace('[total-count5]', date1['price_buyout']+'|'+date1['price_reserve']+'|'+date1['price_inquiry']);
  1131. // tempHTML = tempHTML.replace('[total-count6]', date1['price_buyout']+'|'+date1['price_reserve']+'|'+date1['price_inquiry']);
  1132. // tempHTML = tempHTML.replace('[total-count7]', date1['price_buyout']+'|'+date1['price_reserve']+'|'+date1['price_inquiry']);
  1133. tempHTML = tempHTML.replace('[close1]', date1['is_closed']);
  1134. tempHTML = tempHTML.replace('[close2]', date2['is_closed']);
  1135. tempHTML = tempHTML.replace('[close3]', date3['is_closed']);
  1136. tempHTML = tempHTML.replace('[close4]', date4['is_closed']);
  1137. tempHTML = tempHTML.replace('[close5]', date5['is_closed']);
  1138. tempHTML = tempHTML.replace('[close6]', date6['is_closed']);
  1139. tempHTML = tempHTML.replace('[close7]', date7['is_closed']);
  1140. //第一天
  1141. cstr1 = t_str1 + showsaled1
  1142. + showmdprice1 + showblprice1 + showxxprice1;
  1143. tempHTML = tempHTML.replace('[value1]', mdprice1 + '|' + blprice1 + '|' + xxprice1);
  1144. tempHTML = tempHTML.replace('[cday1]', cstr1);
  1145. //第二天
  1146. cstr2 = t_str2 + showsaled2
  1147. + showmdprice2 + showblprice2 + showxxprice2;
  1148. tempHTML = tempHTML.replace('[value2]', mdprice2 + '|' + blprice2 + '|' + xxprice2);
  1149. tempHTML = tempHTML.replace('[cday2]', cstr2);
  1150. //第三天
  1151. cstr3 = t_str3 + showsaled3
  1152. + showmdprice3 + showblprice3 + showxxprice3;
  1153. tempHTML = tempHTML.replace('[value3]', mdprice3 + '|' + blprice3 + '|' + xxprice3);
  1154. tempHTML = tempHTML.replace('[cday3]', cstr3);
  1155. //第四天
  1156. cstr4 = t_str4 + showsaled4
  1157. + showmdprice4 + showblprice4 + showxxprice4;
  1158. tempHTML = tempHTML.replace('[value4]', mdprice4 + '|' + blprice4 + '|' + xxprice4);
  1159. tempHTML = tempHTML.replace('[cday4]', cstr4);
  1160. //第五天
  1161. cstr5 = t_str5 + showsaled5
  1162. + showmdprice5 + showblprice5 + showxxprice5;
  1163. tempHTML = tempHTML.replace('[value5]', mdprice5 + '|' + blprice5 + '|' + xxprice5);
  1164. tempHTML = tempHTML.replace('[cday5]', cstr5);
  1165. //第六天
  1166. cstr6 = t_str6 + showsaled6
  1167. + showmdprice6 + showblprice6 + showxxprice6;
  1168. tempHTML = tempHTML.replace('[value6]', mdprice6 + '|' + blprice6 + '|' + xxprice6);
  1169. tempHTML = tempHTML.replace('[cday6]', cstr6);
  1170. //第七天
  1171. cstr7 = t_str7 + showsaled7
  1172. + showmdprice7 + showblprice7 + showxxprice7;
  1173. tempHTML = tempHTML.replace('[value7]', mdprice7 + '|' + blprice7 + '|' + xxprice7);
  1174. tempHTML = tempHTML.replace('[cday7]', cstr7);
  1175. if (tempDict['is_onsale'] == 0) {
  1176. tempHTML = tempHTML.replace(/cday/g, 'cday bg_ccc');
  1177. }
  1178. HTML += tempHTML;
  1179. return HTML;
  1180. }
  1181. function getRoomID() {
  1182. localStorage.setItem('start_date', d1);
  1183. localStorage.setItem('current', current);
  1184. var arrids = [];
  1185. $('.childace').each(function (index, domEle) {
  1186. if (domEle.checked) {
  1187. arrids.push($(this).attr('room-type'));
  1188. }
  1189. });
  1190. var ids = arrids.join(",");
  1191. if (ids == '') {
  1192. alert('请勾选子房型');
  1193. return
  1194. }
  1195. var start_date = $('#Wdate').val();
  1196. window.location.href = "batch_modify_hotel_price.html?hotel_id=" + hotel_id + "&ids=" + ids + "&start_date=" + start_date + "&hotel_name=" + hotel_name;
  1197. }
  1198. function getRoomStatus() {
  1199. var arrids = [];
  1200. $('.childace').each(function (index, domEle) {
  1201. if (domEle.checked) {
  1202. arrids.push($(this).attr('room-type'));
  1203. }
  1204. });
  1205. var ids = arrids.join(",");
  1206. if (ids == '') {
  1207. alert('请勾选子房型');
  1208. return
  1209. }
  1210. var start_date = $('#Wdate').val();
  1211. window.location.href = "batch_modify_hotel_status.html?hotel_id=" + hotel_id + "&ids=" + ids + "&start_date=" + start_date + "&hotel_name=" + hotel_name;
  1212. }
  1213. //修改子房型
  1214. var $tempModify = null;
  1215. var param = [];
  1216. var child_room_type = '';
  1217. var parent_room_type1 = '';
  1218. var parent_room_name = '';
  1219. function modifyChildRoom(obj) {
  1220. $showView = $(obj);
  1221. $tempModify = $showView;
  1222. $('#mask').css('background', 'black');
  1223. $('#mask').css('opacity', '0.5');
  1224. showCenterView('.modify_child_room');
  1225. var obj = $(obj);
  1226. var neibubs = '';
  1227. var child_room_name = obj.closest('tr').children().eq(1).text().split('|');
  1228. if (child_room_name.length >= 2) {
  1229. neibubs = child_room_name[1];
  1230. }
  1231. child_room_name = child_room_name[0];
  1232. child_room_type = obj.closest('tr').attr('data-room-type');
  1233. parent_room_type1 = obj.closest('tr').attr('data-parent-room-type');
  1234. obj.closest('tr').parent().children().find('.base').attr(parent_room_type1);
  1235. var modify_room_info = obj.closest('tr').attr('data-room-modify-info');
  1236. var base_bed_type = obj.closest('tr').attr('bed-type'); // 获取子房型床型
  1237. var bed_arr = new Array();
  1238. if(base_bed_type == 0)
  1239. {
  1240. // 获取基础房型的床型
  1241. bed_type = $('.base[data-room-type="'+parent_room_type1+'"]').attr('base-bed-type'); // 获取基础房型床型
  1242. bed_arr = bed_type.split(',');
  1243. }else {
  1244. bed_arr[0] =base_bed_type;
  1245. }
  1246. var room_bed_type = $('#modify_bed_type');
  1247. appendBed(room_bed_type, bed_arr);
  1248. var modify_room_info_arr = modify_room_info.split('|');
  1249. if (modify_room_info_arr[2] != 'null') {
  1250. if (modify_room_info_arr[2] == -1) {
  1251. var book_time = '-1,01:00'.split(',');
  1252. } else {
  1253. var book_time = modify_room_info_arr[2].split(',');
  1254. }
  1255. } else {
  1256. var book_time = '0,01:00'.split(',');
  1257. }
  1258. if (modify_room_info_arr[3] != 'null') {
  1259. if (modify_room_info_arr[3] == -1) {
  1260. var cancel_time = '-1,01:00'.split(',');
  1261. } else {
  1262. var cancel_time = modify_room_info_arr[3].split(',');
  1263. }
  1264. } else {
  1265. var cancel_time = '0,01:00'.split(',');
  1266. }
  1267. $('.base').each(function (index, domEle) {
  1268. var par = $(domEle).attr('data-room-type');
  1269. if (par == parent_room_type1) {
  1270. parent_room_name = $(this).children().eq(1).text().trim();
  1271. }
  1272. });
  1273. $('#checkin_people').val(modify_room_info_arr[0]);
  1274. $('#breakfast').val(modify_room_info_arr[1]);
  1275. $('#lastest_book_day').val(book_time[0]);
  1276. $('#lastest_book_date').val(book_time[1].split(':')[0]);
  1277. $('#lastest_book_time').val(book_time[1].split(':')[1]);
  1278. $('#lastest_cancel_day').val(cancel_time[0]);
  1279. $('#lastest_cancel_day1').val(cancel_time[1].split(':')[0]);
  1280. $('#lastest_cancel_day2').val(cancel_time[1].split(':')[1]);
  1281. $('.data-base-room-name').text(parent_room_name);
  1282. $('.data-child-room-name').val(child_room_name.trim());
  1283. $('#modify_neibu').val(neibubs);
  1284. $('#modify_bed_type').val(base_bed_type);
  1285. $('.data-base-room-name').attr('data-base-room-type', parent_room_type1);
  1286. }
  1287. //修改子房型提交
  1288. function commit() {
  1289. if ($('#lastest_book_day').val() == -1) {
  1290. var lastest_total = -1;
  1291. } else if ($('#lastest_book_day').val() == -2) {
  1292. var lastest_total = -2;
  1293. } else {
  1294. var lastest_total = $('#lastest_book_day').val() + ',' + $('#lastest_book_date').val() + ':' + $('#lastest_book_time').val();
  1295. }
  1296. if ($("#lastest_cancel_day").val() != -1) {
  1297. var lastest_cancel_day = $("#lastest_cancel_day").val() + ',' + $("#lastest_cancel_day1").val() + ':' + $("#lastest_cancel_day2").val()
  1298. } else {
  1299. var lastest_cancel_day = -1
  1300. }
  1301. var neibubs = $('#modify_neibu').val();
  1302. var modify_bed_type = $('#modify_bed_type').val();
  1303. var param = {
  1304. type: 'room_RoomList',
  1305. op: 'modifyRoom',
  1306. user_id: 1,
  1307. hotel_id: hotel_id,
  1308. room_type: child_room_type,
  1309. parent_room_type: parent_room_type1,
  1310. data_child_room_name: $('.data-child-room-name').val(),
  1311. checkin_people: $('#checkin_people').val(),
  1312. breakfast: $('#breakfast').val(),
  1313. lastest_book_time: lastest_total,
  1314. lastest_cancel_day: lastest_cancel_day,
  1315. neibubs: neibubs,
  1316. bed_type:modify_bed_type
  1317. };
  1318. ZZLog(param);
  1319. loading();
  1320. $.ajax({
  1321. url: base_api,
  1322. type: 'post',
  1323. dataType: 'json',
  1324. data: param,
  1325. success: function (res_data) {
  1326. ZZLog(res_data);
  1327. if (res_data['code'] != "0") {
  1328. alert(res_data['info']);
  1329. } else {
  1330. // 将弹出层隐藏
  1331. clickMask();
  1332. // 刷新数据
  1333. getDataFromHttp();
  1334. }
  1335. closeLoading();
  1336. },
  1337. error: function (error) {
  1338. alert('系统错误,请联系管理员');
  1339. ZZLog(error);
  1340. closeLoading();
  1341. }
  1342. })
  1343. }
  1344. // 修改选择入住人数
  1345. function mdchangePeople(selfOBJ) {
  1346. var $selfOBJ = $(selfOBJ);
  1347. var count = $selfOBJ.val();
  1348. if (count < 100) {
  1349. cstr1 = "(" + count + "人入住)";
  1350. } else {
  1351. cstr1 = '';
  1352. }
  1353. var tstr = cstr3 + parent_room_name + cstr1 + cstr2;
  1354. $('.data-child-room-name').val(tstr.trim());
  1355. }
  1356. //选择最晚预订时间
  1357. function mdChangeLastestBook(selfOBJ) {
  1358. var $selfOBJ = $(selfOBJ);
  1359. var fast = parseInt($selfOBJ.val());
  1360. switch (fast) {
  1361. case 0:
  1362. fast = "";
  1363. break;
  1364. case 1:
  1365. fast = "提前一天";
  1366. break;
  1367. case 2:
  1368. fast = "提前二天";
  1369. break;
  1370. case 3:
  1371. fast = "提前三天";
  1372. break;
  1373. case 4:
  1374. fast = "提前四天";
  1375. break;
  1376. case 5:
  1377. fast = "提前五天";
  1378. break;
  1379. case 6:
  1380. fast = "提前六天";
  1381. break;
  1382. case 7:
  1383. fast = "提前七天";
  1384. break;
  1385. }
  1386. if (fast != "") {
  1387. cstr3 = "[" + fast + "]";
  1388. } else {
  1389. cstr3 = "";
  1390. }
  1391. cstr2 = "[" + $("#breakfast").find("option:selected").text() + "]";
  1392. var tstr = cstr3 + parent_room_name + cstr1 + cstr2;
  1393. $('.data-child-room-name').val(tstr.trim());
  1394. }
  1395. // 选择早餐
  1396. function mdchangeBreakfast(selfOBJ) {
  1397. var $selfOBJ = $(selfOBJ);
  1398. var fast = parseInt($selfOBJ.val());
  1399. switch (fast) {
  1400. case 0:
  1401. fast = "无早";
  1402. break;
  1403. case 1:
  1404. fast = "单早";
  1405. break;
  1406. case 2:
  1407. fast = "双早";
  1408. break;
  1409. case 3:
  1410. fast = "三早";
  1411. break;
  1412. case 4:
  1413. fast = "四早";
  1414. break;
  1415. case 5:
  1416. fast = "五早";
  1417. break;
  1418. case 6:
  1419. fast = "六早";
  1420. break;
  1421. case 7:
  1422. fast = "七早";
  1423. break;
  1424. case 8:
  1425. fast = "八早";
  1426. break;
  1427. case 9:
  1428. fast = "九早";
  1429. break;
  1430. case 10 :
  1431. fast = "十早";
  1432. break;
  1433. }
  1434. cstr2 = "[" + fast + "]";
  1435. var tstr = cstr3 + parent_room_name + cstr1 + cstr2;
  1436. $('.data-child-room-name').val(tstr.trim());
  1437. }
  1438. //选择现询变999
  1439. function xianxun999() {
  1440. if ($('#base_stock_type').val() == 229) {
  1441. $('#base_count').val(999)
  1442. }
  1443. }
  1444. //查询
  1445. function search() {
  1446. base_room_type = $('#base_room_type').val();
  1447. room_sale_status = $('#sale_status').val();
  1448. d1 = $('.Wdate').val();
  1449. // 设置tb_top_td
  1450. setTbTopTd();
  1451. if (d1 != "") {
  1452. // http
  1453. current = 1;
  1454. getDataFromHttp();
  1455. }
  1456. }