Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

3 anni fa
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786
  1. var base_api = "http://temp.zhizhuchuxing.com/zz-jd/st-ht/HTcontrol.php";
  2. base_api = "../st-ht/HTcontrol.php";
  3. base_api = "/zz-jd/st-ht/HTcontrol.php";
  4. //base_api = "http://192.168.6.134/zz-jd/st-ht/HTcontrol.php";
  5. //错误码
  6. //code FX-100001 未登录
  7. //提示信息归整
  8. const infoApiError = "服务器开小差了,请联系技术部相关人员";
  9. const infoNotLogin = "您还没有登录,点击确定前往登录页面";
  10. //延迟函数 需要将延迟处理的函数放在delay的回调中
  11. //$('#id').keyup(function() {
  12. // delay(function() {
  13. // console.log('test');
  14. // }, 1000);
  15. // });
  16. var delay = (function() {
  17. var timer = 0;
  18. return function(callback, time) {
  19. clearTimeout(timer);
  20. timer = setTimeout(callback, time);
  21. };
  22. })();
  23. //得到随机的字符串
  24. function getRdStr(len) {
  25. //2-36封顶
  26. var rdmString = "";
  27. for(; rdmString.length < len; rdmString += Math.random().toString(36).substr(2));
  28. return rdmString.substr(0, len);
  29. }
  30. // 打印日志
  31. function ZZLog(...type) {
  32. var isLog = true; //是否打印
  33. if(isLog) {
  34. type.forEach(v => {
  35. if(typeof(v) == 'object') {
  36. console.log(v);
  37. } else {
  38. console.log('%c' + v, 'color:#666699');
  39. }
  40. })
  41. }
  42. }
  43. function setCookie(name, value, time) {
  44. var strsec = getsec(time);
  45. var exp = new Date();
  46. exp.setTime(exp.getTime() + strsec * 1);
  47. document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
  48. function getsec(str) {
  49. var str1 = str.substring(1, str.length) * 1;
  50. var str2 = str.substring(0, 1);
  51. if(str2 == "s") {
  52. return str1 * 1000;
  53. } else if(str2 == "h") {
  54. return str1 * 60 * 60 * 1000;
  55. } else if(str2 == "d") {
  56. return str1 * 24 * 60 * 60 * 1000;
  57. }
  58. }
  59. }
  60. function delCookie(name) {
  61. var exp = new Date();
  62. exp.setTime(exp.getTime() - 1);
  63. var cval = getCookie(name);
  64. if(cval != null)
  65. document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
  66. }
  67. function getCookie(name) {
  68. var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
  69. if(arr = document.cookie.match(reg))
  70. return unescape(arr[2]);
  71. else
  72. return null;
  73. }
  74. //设置字符串类型的本地缓存
  75. function setStorage(objName, objValue) {
  76. var sto = window.localStorage;
  77. if(sto)
  78. sto.setItem(objName, objValue);
  79. }
  80. //读取字符串类型的本地缓存
  81. function getStorage(objName) {
  82. var ret = '';
  83. var sto = window.localStorage;
  84. if(sto)
  85. ret = sto.getItem(objName);
  86. return ret;
  87. }
  88. //清除本地缓存,如没指定名称则为清空所有缓存
  89. function clearStorage(objName) {
  90. var sto = window.localStorage;
  91. if(sto) {
  92. if(objName)
  93. sto.removeItem(objName);
  94. else
  95. sto.clear();
  96. }
  97. }
  98. //设置Json类型的本地缓存
  99. function setStorJson(objName, json) {
  100. if(json)
  101. setStorage(objName, JSON.stringify(json));
  102. }
  103. //读取Json类型的本地缓存
  104. function getStorJson(objName) {
  105. var ret = null;
  106. var str = getStorage(objName);
  107. if(str)
  108. ret = JSON.parse(str);
  109. return ret;
  110. }
  111. //js判断一个日期是星期几 传入 年/月/日
  112. function getWeekDay(day) {
  113. var a = new Array("日", "一", "二", "三", "四", "五", "六");
  114. var week = new Date(day).getDay();
  115. var str = "星期" + a[week];
  116. return str;
  117. }
  118. //获取前一天日期 传入指定时间
  119. function before(d) {
  120. d = new Date(d);
  121. d = +d - 10006060 / 3 * 24;
  122. d = new Date(d);
  123. //格式化
  124. var year = ";" + d.getFullYear() + ";";
  125. var month = ";" + (d.getMonth() + 0 + 1) + ";";
  126. var day = ";" + d.getDate() + ";";
  127. if(year.length < 4) {
  128. year = "0" + year;
  129. }
  130. if(month.length < 4) {
  131. month = "0" + month;
  132. }
  133. if(day.length < 4) {
  134. day = "0" + day;
  135. }
  136. var datestr = year + "-" + month + "-" + day;
  137. datestr = datestr.replace(/;/g, "");
  138. return datestr;
  139. }
  140. // 获取指定日期的前后几天
  141. function getDateByDay(addDayCount, curDate) {
  142. var d = new Date(curDate);
  143. d.setDate(d.getDate() + addDayCount); //获取AddDayCount天后的日期
  144. //格式化
  145. var year = ";" + d.getFullYear() + ";";
  146. var month = ";" + (d.getMonth() + 0 + 1) + ";";
  147. var day = ";" + d.getDate() + ";";
  148. if(year.length < 4) {
  149. year = "0" + year;
  150. }
  151. if(month.length < 4) {
  152. month = "0" + month;
  153. }
  154. if(day.length < 4) {
  155. day = "0" + day;
  156. }
  157. var datestr = year + "-" + month + "-" + day;
  158. datestr = datestr.replace(/;/g, "");
  159. return datestr;
  160. }
  161. //获取后一天日期 传入指定时间
  162. function after(d) {
  163. d = new Date(d);
  164. d = +d + 10006060 / 3 * 24;
  165. d = new Date(d);
  166. //格式化
  167. var year = ";" + d.getFullYear() + ";";
  168. var month = ";" + (d.getMonth() + 0 + 1) + ";";
  169. var day = ";" + d.getDate() + ";";
  170. if(year.length < 4) {
  171. year = "0" + year;
  172. }
  173. if(month.length < 4) {
  174. month = "0" + month;
  175. }
  176. if(day.length < 4) {
  177. day = "0" + day;
  178. }
  179. var datestr = year + "-" + month + "-" + day;
  180. datestr = datestr.replace(/;/g, "");
  181. return datestr;
  182. }
  183. // 从URL上获得参数
  184. function getPar(par) {
  185. //获取当前URL
  186. var local_url = document.location.href;
  187. local_url = decodeURI(local_url);
  188. //获取要取得的get参数位置
  189. var get = local_url.indexOf(par + "=");
  190. if(get == -1) {
  191. return "";
  192. }
  193. //截取字符串
  194. var get_par = local_url.slice(par.length + get + 1);
  195. //判断截取后的字符串是否还有其他get参数
  196. var nextPar = get_par.indexOf("&");
  197. if(nextPar != -1) {
  198. get_par = get_par.slice(0, nextPar);
  199. }
  200. return get_par;
  201. }
  202. //得到时间组合
  203. function getDateTime(nTypeFlag) {
  204. var tNowTime = new Date();
  205. var myYear = ';' + tNowTime.getFullYear() + ';';
  206. var myMonth = ';' + (tNowTime.getMonth() + 1 - 0) + ';';
  207. var myDay = ';' + tNowTime.getDate() + ';';
  208. var myHour = ';' + tNowTime.getHours() + ';';
  209. var myMinu = ';' + tNowTime.getMinutes() + ';';
  210. var mySecond = ';' + tNowTime.getSeconds() + ';';
  211. if(myMonth.length < 4) myMonth = '0' + myMonth;
  212. if(myDay.length < 4) myDay = '0' + myDay;
  213. if(myHour.length < 4) myHour = '0' + myHour;
  214. if(myMinu.length < 4) myMinu = '0' + myMinu;
  215. if(mySecond.length < 4) mySecond = '0' + mySecond;
  216. var cNewTimeStr;
  217. //alert(tNowTime);
  218. switch(nTypeFlag + 1 - 1) {
  219. case 0:
  220. cNewTimeStr = myYear + '-' + myMonth + '-' + myDay;
  221. break;
  222. case 1:
  223. cNewTimeStr = myYear + myMonth + myDay;
  224. break;
  225. case 2:
  226. cNewTimeStr = myHour + ':' + myMinu + ':' + mySecond;
  227. break;
  228. case 3:
  229. cNewTimeStr = myHour + myMinu + mySecond;
  230. break;
  231. case 4:
  232. cNewTimeStr = myYear + myMonth + myDay + myHour + myMinu + mySecond;
  233. break;
  234. case 5:
  235. cNewTimeStr = myYear + '年' + myMonth + '月' + myDay + '日';
  236. break;
  237. case 6:
  238. cNewTimeStr = myYear;
  239. break;
  240. case 7:
  241. cNewTimeStr = myYear + '-' + myMonth;
  242. break;
  243. case 8: //得到上一个月的今天
  244. var date = getDateTime(0);
  245. var arr = date.split('-');
  246. var year = arr[0]; //获取当前日期的年份
  247. var month = arr[1]; //获取当前日期的月份
  248. var day = arr[2]; //获取当前日期的日
  249. var days = new Date(year, month, 0);
  250. days = days.getDate(); //获取当前日期中月的天数
  251. var year2 = year;
  252. var month2 = parseInt(month) - 1;
  253. if(month2 == 0) {
  254. year2 = parseInt(year2) - 1;
  255. month2 = 12;
  256. }
  257. var day2 = day;
  258. var days2 = new Date(year2, month2, 0);
  259. days2 = days2.getDate();
  260. if(day2 > days2) {
  261. day2 = days2;
  262. }
  263. if(month2 < 10) {
  264. month2 = '0' + month2;
  265. }
  266. cNewTimeStr = year2 + '-' + month2 + '-' + day2;
  267. break;
  268. case 9: //得到下一个月的今天
  269. var date = getDateTime(0);
  270. var arr = date.split('-');
  271. var year = arr[0]; //获取当前日期的年份
  272. var month = arr[1]; //获取当前日期的月份
  273. var day = arr[2]; //获取当前日期的日
  274. var days = new Date(year, month, 0);
  275. days = days.getDate(); //获取当前日期中的月的天数
  276. var year2 = year;
  277. var month2 = parseInt(month) + 1;
  278. if(month2 == 13) {
  279. year2 = parseInt(year2) + 1;
  280. month2 = 1;
  281. }
  282. var day2 = day;
  283. var days2 = new Date(year2, month2, 0);
  284. days2 = days2.getDate();
  285. if(day2 > days2) {
  286. day2 = days2;
  287. }
  288. if(month2 < 10) {
  289. month2 = '0' + month2;
  290. }
  291. var t2 = year2 + '-' + month2 + '-' + day2;
  292. return t2;
  293. break;
  294. case 10: //昨日日期
  295. //获取前一天日期
  296. return before(getDateTime(0));
  297. function before(d) {
  298. d = new Date(d);
  299. d = +d - 10006060 / 3 * 24;
  300. d = new Date(d);
  301. //return d;
  302. //格式化
  303. var year = ";" + d.getFullYear() + ";";
  304. var month = ";" + (d.getMonth() + 0 + 1) + ";";
  305. var day = ";" + d.getDate() + ";";
  306. if(year.length < 4) {
  307. year = "0" + year;
  308. }
  309. if(month.length < 4) {
  310. month = "0" + month;
  311. }
  312. if(day.length < 4) {
  313. day = "0" + day;
  314. }
  315. var datestr = year + "-" + month + "-" + day;
  316. datestr = datestr.replace(/;/g, "");
  317. return datestr;
  318. // return d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
  319. }
  320. break;
  321. case 11: //明日日期
  322. //获取后一天日期
  323. return after(getDateTime(0));
  324. function after(d) {
  325. d = new Date(d);
  326. d = +d + 10006060 / 3 * 24;
  327. d = new Date(d);
  328. //return d;
  329. //格式化
  330. var year = ";" + d.getFullYear() + ";";
  331. var month = ";" + (d.getMonth() + 0 + 1) + ";";
  332. var day = ";" + d.getDate() + ";";
  333. if(year.length < 4) {
  334. year = "0" + year;
  335. }
  336. if(month.length < 4) {
  337. month = "0" + month;
  338. }
  339. if(day.length < 4) {
  340. day = "0" + day;
  341. }
  342. var datestr = year + "-" + month + "-" + day;
  343. datestr = datestr.replace(/;/g, "");
  344. return datestr;
  345. // return d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
  346. }
  347. break;
  348. case 12: //本周起始日期
  349. return getWeekStartDate()
  350. function getWeekStartDate() {
  351. var now = new Date(); //当前日期
  352. var nowDayOfWeek = now.getDay(); //今天本周的第几天
  353. var nowDay = now.getDate(); //当前日
  354. var nowMonth = now.getMonth(); //当前月
  355. var nowYear = now.getYear(); //当前年
  356. nowYear += (nowYear < 2000) ? 1900 : 0; //
  357. var lastMonthDate = new Date(); //上月日期
  358. lastMonthDate.setDate(1);
  359. lastMonthDate.setMonth(lastMonthDate.getMonth() - 1);
  360. var lastYear = lastMonthDate.getYear();
  361. var lastMonth = lastMonthDate.getMonth();
  362. var weekStartDate = new Date(nowYear, nowMonth, nowDay - nowDayOfWeek);
  363. return formatDate(weekStartDate);
  364. }
  365. break;
  366. case 13: //本周结束日期
  367. return getWeekEndDate()
  368. function getWeekEndDate() {
  369. var now = new Date(); //当前日期
  370. var nowDayOfWeek = now.getDay(); //今天本周的第几天
  371. var nowDay = now.getDate(); //当前日
  372. var nowMonth = now.getMonth(); //当前月
  373. var nowYear = now.getYear(); //当前年
  374. nowYear += (nowYear < 2000) ? 1900 : 0; //
  375. var lastMonthDate = new Date(); //上月日期
  376. lastMonthDate.setDate(1);
  377. lastMonthDate.setMonth(lastMonthDate.getMonth() - 1);
  378. var lastYear = lastMonthDate.getYear();
  379. var lastMonth = lastMonthDate.getMonth();
  380. var weekEndDate = new Date(nowYear, nowMonth, nowDay + (6 - nowDayOfWeek));
  381. return formatDate(weekEndDate);
  382. }
  383. break;
  384. case 14: //本月开始日期
  385. return getMonthStartDate()
  386. function getMonthStartDate() {
  387. var now = new Date(); //当前日期
  388. var nowDayOfWeek = now.getDay(); //今天本周的第几天
  389. var nowDay = now.getDate(); //当前日
  390. var nowMonth = now.getMonth(); //当前月
  391. var nowYear = now.getYear(); //当前年
  392. nowYear += (nowYear < 2000) ? 1900 : 0; //
  393. var lastMonthDate = new Date(); //上月日期
  394. lastMonthDate.setDate(1);
  395. lastMonthDate.setMonth(lastMonthDate.getMonth() - 1);
  396. var lastYear = lastMonthDate.getYear();
  397. var lastMonth = lastMonthDate.getMonth();
  398. var monthStartDate = new Date(nowYear, nowMonth, 1);
  399. return formatDate(monthStartDate);
  400. }
  401. break;
  402. case 15: //本月结束日期
  403. return getMonthEndDate();
  404. function getMonthEndDate() {
  405. var now = new Date(); //当前日期
  406. var nowDayOfWeek = now.getDay(); //今天本周的第几天
  407. var nowDay = now.getDate(); //当前日
  408. var nowMonth = now.getMonth(); //当前月
  409. var nowYear = now.getYear(); //当前年
  410. nowYear += (nowYear < 2000) ? 1900 : 0; //
  411. var lastMonthDate = new Date(); //上月日期
  412. lastMonthDate.setDate(1);
  413. lastMonthDate.setMonth(lastMonthDate.getMonth() - 1);
  414. var lastYear = lastMonthDate.getYear();
  415. var lastMonth = lastMonthDate.getMonth();
  416. //获得某月的天数
  417. function getMonthDays(myMonth) {
  418. var monthStartDate = new Date(nowYear, myMonth, 1);
  419. var monthEndDate = new Date(nowYear, myMonth + 1, 1);
  420. var days = (monthEndDate - monthStartDate) / (1000 * 60 * 60 * 24);
  421. return days;
  422. }
  423. var monthEndDate = new Date(nowYear, nowMonth, getMonthDays(nowMonth));
  424. return formatDate(monthEndDate);
  425. }
  426. break;
  427. default:
  428. cNewTimeStr = myYear + '-' + myMonth + '-' + myDay + ' ' + myHour + ':' + myMinu + ':' + mySecond;
  429. break;
  430. }
  431. cNewTimeStr = cNewTimeStr.replace(/;/g, "");
  432. return cNewTimeStr;
  433. }
  434. //case 12,13的规整函数
  435. function formatDate(date) {
  436. var myyear = date.getFullYear();
  437. var mymonth = date.getMonth() + 1;
  438. var myweekday = date.getDate();
  439. if(mymonth < 10) {
  440. mymonth = "0" + mymonth;
  441. }
  442. if(myweekday < 10) {
  443. myweekday = "0" + myweekday;
  444. }
  445. return(myyear + "-" + mymonth + "-" + myweekday);
  446. }
  447. //html存入json
  448. function setJsonHtml(data) {
  449. if(typeof(data) == "object") {
  450. var jsonArrayFinal = JSON.stringify(data);
  451. jsonArrayFinal = jsonArrayFinal.replace(/ /g, '');
  452. // jsonArrayFinal = jsonArrayFinal.replace(/"/g, '&quot;');
  453. return jsonArrayFinal;
  454. }
  455. }
  456. //取出html存入的json
  457. function getJsonHtml(data) {
  458. if(data) {
  459. var data_info = JSON.parse(data);
  460. return data_info;
  461. }
  462. }
  463. //解决冒泡
  464. function solveBubbing() {
  465. var e = getEvent();
  466. if(window.event) {
  467. e.cancelBubble = true; //阻止冒泡
  468. } else if(e.preventDefault) {
  469. e.stopPropagation(); //阻止冒泡
  470. }
  471. }
  472. //得到事件
  473. function getEvent() {
  474. if(window.event) {
  475. return window.event;
  476. }
  477. func = getEvent.caller;
  478. while(func != null) {
  479. var arg0 = func.arguments[0];
  480. if(arg0) {
  481. if((arg0.constructor == Event || arg0.constructor == MouseEvent ||
  482. arg0.constructor == KeyboardEvent) ||
  483. (typeof(arg0) == "object" && arg0.preventDefault &&
  484. arg0.stopPropagation)) {
  485. return arg0;
  486. }
  487. }
  488. func = func.caller;
  489. }
  490. return null;
  491. }
  492. //得到浏览器
  493. function myBrowser() {
  494. var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
  495. var isOpera = userAgent.indexOf("Opera") > -1;
  496. //判断是否Opera浏览器
  497. if(isOpera) {
  498. return "Opera"
  499. };
  500. //判断是否Firefox浏览器
  501. if(userAgent.indexOf("Firefox") > -1) {
  502. return "Firefox";
  503. }
  504. //判断是否Chrome浏览器
  505. if(userAgent.indexOf("Chrome") > -1) {
  506. return "Chrome";
  507. }
  508. //判断是否Safari浏览器
  509. if(userAgent.indexOf("Safari") > -1) {
  510. return "Safari";
  511. }
  512. if(userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera) {
  513. return "IE";
  514. }; //判断是否IE浏览器
  515. }
  516. //需要成功回调的弹出框
  517. function ZZAlertInfo(info, callok) {
  518. window.wxc.xcConfirm(info, window.wxc.xcConfirm.typeEnum.info, {
  519. onOk: function() {
  520. if(callok) {
  521. callok();
  522. }
  523. }
  524. });
  525. }
  526. //确认框(提示信息,成功回调,取消回调,关闭回调)
  527. function ZZConfirm(info, callok, callcancel, callclose) {
  528. window.wxc.xcConfirm(info, window.wxc.xcConfirm.typeEnum.confirm, {
  529. onOk: function() {
  530. if(callok) {
  531. callok();
  532. }
  533. },
  534. onCancel: function() {
  535. if(callcancel) {
  536. callcancel();
  537. }
  538. },
  539. onClose: function() {
  540. if(callclose) {
  541. callclose();
  542. }
  543. }
  544. })
  545. }
  546. //输入框(输入的信息,成功回调,关闭的回调)
  547. function ZZInput(info, callok, callclose) {
  548. window.wxc.xcConfirm(info, window.wxc.xcConfirm.typeEnum.input, {
  549. onOk: function(ok) {
  550. if(callok) {
  551. callok(ok);
  552. }
  553. },
  554. onClose: function(close) {
  555. if(callclose) {
  556. callclose(close);
  557. }
  558. }
  559. });
  560. }
  561. //原htComoon.js中的
  562. //修改订单需要记录修改详细内容,保存好原数据
  563. function initOldData(order_data) {
  564. // var _old_data = {
  565. // order_id: '',
  566. // org_id: '',
  567. // org_num: '',
  568. // room_list: '',
  569. // cus_list: '',
  570. // checkin_time: '',
  571. // if_cancel: '',
  572. // benefit: '',
  573. // total_commission: ''
  574. // };
  575. var order_p = order_data.hotel_order_detail[0],
  576. order_c = order_data.hotel_child_order_detail;
  577. var amount = 0;
  578. // var cus_list = "{" + order_p.customer_name + "," + order_p.customer_mobile + "," + order_p.customer_memo + "}";
  579. _old_data['contact'] = order_p.customer_name;
  580. _old_data['mobile'] = order_p.customer_mobile;
  581. _old_data['memo'] = order_p.customer_memo;
  582. _old_data['org_id'] = org_id;
  583. _old_data['org_num'] = order_p.outside_order_no;
  584. // _old_data['org_name'] = $("#org_id option[value='"+ org_id.toString()+ "']").html()
  585. _old_data['start_date'] = order_p.start_date;
  586. // _old_data['end_date'] = order_p.end_date;
  587. //间夜数
  588. var count = 0;
  589. $.each(order_c, function (key, order) {
  590. count += parseInt(order.total);
  591. amount += order['order_price'] * order['total'];
  592. })
  593. _old_data['total'] = count;
  594. _old_data['amount'] = amount;
  595. }
  596. //对比数据,返回需要记录的字段
  597. function compareOldData(new_order_data) {
  598. var list = [];
  599. $.each(_old_data, function (key, item) {
  600. if ( key != 'amount' && item != new_order_data[key]) { //备注去除
  601. if (key == 'org_id') {// 修改渠道商
  602. var b = $("#org_id option[value='" + new_order_data[key] + "']").html()
  603. var a = $("#org_id option[value='" + item + "']").html();
  604. list.push({'name': key, 'old_val': a, 'new_val': b});
  605. } else
  606. list.push({'name': key, 'old_val': item, 'new_val': new_order_data[key]});
  607. }
  608. })
  609. return list;
  610. }
  611. function removeNote(obj, flag) {
  612. if(flag){
  613. ZZConfirm('确认要删除备注?', function () {
  614. $(obj).closest('.note').remove();
  615. })
  616. }else{
  617. $(obj).closest('.note').remove();
  618. }
  619. }
  620. //日期获取上周
  621. function getLastWeek(){
  622. var today = new Date();
  623. var lastWeek = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 7);
  624. return lastWeek ;
  625. }
  626. var _principal = [1, 33, 35, 160];
  627. //权限控制
  628. function playPermission(){
  629. var urlapi = base_api;
  630. var _hotel_id = getPar('hotel_id'),
  631. user_id = getCookie('user_id');
  632. var param = {
  633. type: "hotel_HotelList",
  634. hotel_id: _hotel_id,
  635. op: "getDetail"
  636. };
  637. ZZLog(urlapi + JSON.stringify(param));
  638. $.ajax({
  639. url: urlapi,
  640. data: param,
  641. type: "post",
  642. dataType: "json",
  643. success: function (res_data) {
  644. ZZLog(res_data);
  645. if (res_data['code'] != "0") {
  646. alert(res_data['info']);
  647. } else {
  648. var tmp = [],
  649. temp;
  650. temp = res_data['rowset'][0]['PRINCIPAL'];
  651. if(typeof temp == 'string')
  652. tmp = temp.split(',');
  653. var principal = $.merge(_principal, tmp);
  654. if($.inArray(user_id, principal.toString().split(',')) < 0){
  655. // $(".permission-display").hide();
  656. // $(".permission td.bday").unbind('click');
  657. // $(".permission td.cday").unbind('click');
  658. // $(".permission td.change").unbind('click');
  659. // $(".permission td.change").attr('onclick','');
  660. // $(".permission td img").attr('onclick','');
  661. }
  662. }
  663. },
  664. error: function (error) {
  665. alert('system ajax http error');
  666. ZZLog(error);
  667. }
  668. })
  669. }
  670. function all_sum() {
  671. all_yongj = 0;
  672. all_jiesuan = 0;
  673. all_profit = 0;
  674. var all_yongj1= 0;
  675. var all_jiesuan1 = 0;
  676. var all_profit1 = 0;
  677. $('.yongj_sum').each(function () {
  678. all_yongj += parseFloat($(this).text())
  679. });
  680. if (isNaN(all_yongj)) {
  681. all_yongj = 0
  682. }
  683. $('.jiesuan_sum').each(function () {
  684. all_jiesuan += parseFloat($(this).text())
  685. });
  686. if (isNaN(all_jiesuan)) {
  687. all_jiesuan = 0
  688. }
  689. $('.benefit_sum').each(function () {
  690. all_profit += parseFloat($(this).text())
  691. });
  692. if (isNaN(all_profit)) {
  693. all_profit = 0
  694. }
  695. all_yongj1 = all_yongj.toFixed(2);
  696. all_jiesuan1 = all_jiesuan.toFixed(2);
  697. all_profit1 = all_profit.toFixed(2);
  698. $('#all_yongj').text(all_yongj1 + '元');
  699. $('#all_jiesuan').text(all_jiesuan1 + '元');
  700. $('#all_profit').text(all_profit1 + '元');
  701. }
  702. /**
  703. * 加载时尽量考虑什么时候关闭,否则15秒后自动关闭
  704. */
  705. function loading(time) {
  706. var newDiv = '<div id="screen-cover" class="loader-inner ball-beat" style="width: 100%; height: 100%; position: absolute; top: 0; left: 0; background-color: rgba(0,0,0,0.5); text-align: center; z-index: 9999;' +
  707. '"><div class="on" style="border-radius: 100%!important;"></div><div class="off" style="border-radius: 100%!important;"></div><div class="on" style="border-radius: 100%!important;"></div>' +
  708. '</div>';
  709. if(typeof $("#screen-cover") != 'undefined')
  710. $("#screen-cover").remove();
  711. $("<link>")
  712. .attr({ rel: "stylesheet",
  713. type: "text/css",
  714. href: "../css/loader.css"
  715. })
  716. .appendTo("head");
  717. $("html").append(newDiv);
  718. $("#screen-cover").css('padding-top', $(window).height() / 2 - 55);
  719. // if(typeof time == 'undefined')
  720. // time = 15000;
  721. // setTimeout('closeLoading()',time);
  722. }
  723. function closeLoading() {
  724. if($("#screen-cover").length > 0)
  725. $("#screen-cover").remove();
  726. }