tuil.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697
  1. /**
  2. * 初始化加载
  3. */
  4. $(function() {
  5. postini();
  6. ncode = false;
  7. fes = getUrlParam("fes");
  8. sou = getUrlParam("sou");
  9. $("#useraccount_tt").attr("value", getUrlParam("freeflow_token"));
  10. });
  11. /**
  12. * 跳转至404页面
  13. */
  14. function goto404() {
  15. if (window.location.href == "https://800.wo.cn/orderchannel/hd/Dy/order202005.html?fes=jh7") {
  16. window.location.href = "https://800.wo.cn/orderchannel/hd/Dy/order.html?fes=9on&sou=12";
  17. return;
  18. }
  19. if (window.location.href.indexOf('jiangtao') >= 0) {
  20. alert(window.location.href)
  21. }
  22. var url = getRootPath() + "/404.html";
  23. $(location).attr('href', url);
  24. }
  25. //选中
  26. $('.circular').click(function() {
  27. $('.circular').toggleClass("active")
  28. });
  29. //边框
  30. $('.iphone').focus(function() {
  31. $(this).css('border', '1px solid #FF14CB');
  32. $(this).css('opacity', '1');
  33. })
  34. $('.iphone').blur(function() {
  35. $(this).css('border', '1px solid #fff');
  36. if ($(this).val() == '') {
  37. $(this).css('opacity', '0.49');
  38. } else {
  39. $(this).css('opacity', '1');
  40. }
  41. })
  42. $('.yanzhenma').focus(function() {
  43. $(this).css('border', '1px solid #FF14CB');
  44. $(this).css('opacity', '1');
  45. })
  46. $('.yanzhenma').blur(function() {
  47. $(this).css('border', '1px solid #fff')
  48. if ($(this).val() == '') {
  49. $(this).css('opacity', '0.49');
  50. } else {
  51. $(this).css('opacity', '1');
  52. }
  53. })
  54. $('.btn').mousedown(function() {
  55. $(this).css('opacity', '0.8')
  56. });
  57. $('.btn').mouseup(function() {
  58. $(this).css('opacity', '1')
  59. })
  60. //弹窗
  61. $('.yuyue').click(function() {
  62. $('.maskArea').show();
  63. $('.tc').show();
  64. $('.close').show();
  65. })
  66. $('.close').click(function() {
  67. $('.maskArea').hide();
  68. $('.tc').hide();
  69. $('.close').hide();
  70. })
  71. /**
  72. * 百度统计组件
  73. */
  74. // var _hmt = _hmt || [];
  75. // (function () {
  76. // var hm = document.createElement("script");
  77. // hm.src = "https://hm.baidu.com/hm.js?0ece85510b3306c074204023de4e49dc";
  78. // var s = document.getElementsByTagName("script")[0];
  79. // s.parentNode.insertBefore(hm, s);
  80. // })();
  81. /**
  82. * 页面统一工具
  83. */
  84. var derice = "";
  85. var pattern = /^1[345678]\d{9}$/; //判断联通号码正则表达式
  86. var ncode = false; //用于页面判断验证码超时
  87. //验证码倒计时
  88. var countdown = 60;
  89. function settime(mode) {
  90. if (countdown == 0) {
  91. $("#yzm").attr("onclick", "sendSms('tt','" + mode + "')");
  92. $(".yanzhenma_btn").css('background-color', '#FF14CB')
  93. $(".yanzhenma_btn").attr("disabled", false);
  94. $(".yanzhenma_btn").text("获取验证码");
  95. countdown = 60;
  96. } else {
  97. $(".yanzhenma_btn").attr("disabled", true);
  98. $(".yanzhenma_btn").text(countdown + 's');
  99. countdown--;
  100. setTimeout(function() {
  101. settime(mode)
  102. }, 1000)
  103. }
  104. }
  105. /**
  106. * 页面弹框提示
  107. */
  108. function pro_bounced(headmg, textmg, buttonmg, state) {
  109. if (state) {
  110. $('.maskArea').show();
  111. $('.tc').show();
  112. $("#ts").attr('src', 'img/wancheng.png');
  113. $("#co").text(textmg);
  114. } else {
  115. $('.maskArea').show();
  116. $('.tc').show();
  117. $('.close').show();
  118. $("#ts").attr('src', 'img/wan.png');
  119. $("#co").text(textmg);
  120. }
  121. }
  122. function closeSe() {
  123. $(".maskArea").attr("style", "display:none;"); //关闭提示框
  124. }
  125. function emptyM() {
  126. $(".coupon").empty();
  127. }
  128. /**
  129. * 获取对应标签中value
  130. * @param memoid
  131. * @param type
  132. * @returns
  133. */
  134. function getMemoValbyId(product, type) {
  135. var val = "";
  136. switch (type) {
  137. case "phone":
  138. val = $("#input_100_" + product).val();
  139. break;
  140. case "code":
  141. val = $("#input_50_" + product).val();
  142. break;
  143. case "fog":
  144. val = $("#fog_" + product).val();
  145. break;
  146. case "useraccount":
  147. val = $("#useraccount_" + product).val();
  148. break;
  149. case "sendsmsorder":
  150. val = $("#sendsms_order_" + product).val();
  151. break;
  152. case "sendsmscancel":
  153. val = $("#sendsms_cancel_" + product).val();
  154. break;
  155. case "sendsmsyuyue":
  156. val = $("#sendsms_yuyue_" + product).val();
  157. break;
  158. case "sendsmsacti":
  159. val = $("#sendsms_acti_" + product).val();
  160. break;
  161. }
  162. if (val == null) {
  163. return "";
  164. } else {
  165. return val;
  166. }
  167. }
  168. /**
  169. * 获取项目根目录
  170. * @returns
  171. */
  172. function getRootPath() {
  173. //获取当前网址,如: http://localhost:8080/ems/Pages/Basic/Person.jsp
  174. var curWwwPath = window.document.location.href;
  175. //获取主机地址之后的目录,如: /ems/Pages/Basic/Person.jsp
  176. var pathName = window.document.location.pathname;
  177. var pos = curWwwPath.indexOf(pathName);
  178. //获取主机地址,如: http://localhost:8080
  179. var localhostPath = curWwwPath.substring(0, pos);
  180. //获取带"/"的项目名,如:/ems
  181. var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
  182. return (localhostPath + projectName);
  183. }
  184. /**
  185. * 获取项目页面前
  186. * @returns
  187. */
  188. function getHref() {
  189. //获取当前网址,如: http://localhost:8080/ems/Pages/Basic/Person.jsp
  190. var curWwwPath = window.document.location.href;
  191. //获取主机地址之后的目录,如: /ems/Pages/Basic/Person.jsp
  192. var pathName = window.document.location.pathname;
  193. var pos = curWwwPath.indexOf(pathName);
  194. //获取主机地址,如: http://localhost:8080
  195. var localhostPath = curWwwPath.substring(0, pos);
  196. //获取带"/"的项目名,如:/ems
  197. var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
  198. return (localhostPath + pathName);
  199. }
  200. /**
  201. * 短信发送信息包装.
  202. */
  203. function sendSmsDate(product, mode) {
  204. var data = {
  205. "fog": getMemoValbyId(product, "fog"),
  206. "usermob": getMemoValbyId(product, "phone"),
  207. "smstype": getMemoValbyId(product, "sendsms" + mode),
  208. "sou": getUrlParam("sou"),
  209. };
  210. return data;
  211. }
  212. /**
  213. * 获取当前url中参数信息
  214. * @param urlprm url中参数名称
  215. * @returns
  216. */
  217. function getUrlParam(urlprm) {
  218. var reg = new RegExp("(^|&)" + urlprm + "=([^&]*)(&|$)");
  219. var r = window.location.search.substr(1).match(reg);
  220. if (r != null) {
  221. return r[2];
  222. } else {
  223. switch (urlprm) {
  224. case "con":
  225. return "1";
  226. break;
  227. case "freeflow_token":
  228. return "";
  229. break;
  230. default:
  231. //var url = getRootPath() + "/404.html";
  232. //$(location).attr('href', url);
  233. goto404();
  234. break;
  235. }
  236. }
  237. }
  238. /**
  239. * 根据页面加载函数初始化页面图标,页面主题
  240. * 页面中必须有对应标签ID
  241. * @param iniJson 后台获取到的页面加载函数
  242. */
  243. function theme(title, icon) {
  244. //加载页面主题文字
  245. $("title").text(title);
  246. var sou = getUrlParam("sou");
  247. var fes = getUrlParam("fes");
  248. if (fes == "9om" && sou == "2e") {
  249. $("title").text("免流量看皮皮虾");
  250. }
  251. if (fes == "jh3" || sou == "jh4") {
  252. $("title").text("抗击疫情,温暖同行");
  253. }
  254. //加载页面图标
  255. //$("#icon").attr("href", icon+".ico");
  256. }
  257. /**
  258. * 消息发送获取Josn数据
  259. * @param method 方法名称
  260. * @param data 发送数据
  261. * @returns 返回的json数据
  262. * 此方法需加载页面头信息与页面显示图标:
  263. * 页面必须有 title 标签
  264. * id = "icon" 链接地址
  265. * <link id="icon" rel="shortcut icon" type="image/x-icon" href=""/>
  266. * 加载页面基本信息:
  267. * XX 为活动对应产品表中配置标示
  268. * <input type="hidden" id="fog_XX"/>
  269. */
  270. function postini() {
  271. $.ajax({
  272. url: getRootPath() + "-s1api" + '/ini/getstyle',
  273. type: "POST", // 用POST方式传输
  274. contentType: "application/json; charset=utf-8",
  275. dataType: "Json",
  276. data: JSON.stringify(postiniDate()),
  277. success: function(msg) {
  278. var resCode = msg["resultCode"];
  279. if (resCode == "0000") {
  280. var festival = msg["festival"];
  281. theme(festival["title"], festival["icon"]); //加载页面信息头,图标
  282. var productlist = msg["product"];
  283. for (var i = 0, l = productlist.length; i < l; i++) {
  284. $("#fog_" + productlist[i].url).attr("value", productlist[i].fog);
  285. var smslist = productlist[i].icon.split(",");
  286. for (var int = 0; int < smslist.length; int++) {
  287. if (int == 0) {
  288. $("#sendsms_order_" + productlist[i].url).attr("value", smslist[int]);
  289. }
  290. if (int == 1) {
  291. $("#sendsms_cancel_" + productlist[i].url).attr("value", smslist[int]);
  292. }
  293. if (int == 2) {
  294. $("#sendsms_yuyue_" + productlist[i].url).attr("value", smslist[int]);
  295. }
  296. }
  297. }
  298. if (location.href.indexOf('order_imme.html') >= 0) {
  299. $('#major').trigger('click');
  300. }
  301. } else { //未取出对应渠道与活动组数据
  302. goto404();
  303. }
  304. if (location.href.indexOf('/cancel') >= 0) {
  305. burypointLogId('110002'); // 退订页面pv, pv去重得到uv
  306. } else if (location.href.indexOf('/draw') >= 0) {
  307. burypointLogId('110003'); // 领取页面pv, pv去重得到uv
  308. } else if (location.href.indexOf('/flow') >= 0) {
  309. burypointLogId('110004'); // 流量查询pv, pv去重得到uv
  310. } else if (location.href.indexOf('/active') >= 0) {
  311. burypointLogId('110005'); // 激活页面pv, pv去重得到uv
  312. } else {
  313. // location.href.indexOf('/index') >= 0
  314. // location.href.indexOf('/order') >= 0
  315. burypointLogId('110001'); // 订购页面pv, pv去重得到uv
  316. }
  317. },
  318. error: function(XMLHttpRequest, textStatus, errorThrown) { //加载请求失败
  319. goto404();
  320. },
  321. });
  322. }
  323. function gotorder() {
  324. var url = getRootPath() + "/Tou/Dy/order.html" +
  325. "?fes=" + getUrlParam("fes") + "&sou=" + getUrlParam("sou") +
  326. "&con=0";
  327. $(location).attr('href', url);
  328. }
  329. /**
  330. * 去往成功页面
  331. */
  332. function gotosucc() {
  333. var url = getRootPath() + "/Tou/Dy/orderSucc.html" +
  334. "?fes=" + getUrlParam("fes") + "&sou=" + getUrlParam("sou") +
  335. "&phone=" + getMemoValbyId('tt', 'phone') + "&fog=" + getMemoValbyId('tt', 'fog') + "&fog=" + getMemoValbyId('tt', 'fog') + "&use=" + getMemoValbyId('tt', 'useraccount');
  336. $(location).attr('href', url);
  337. }
  338. /**
  339. * 验证码发送
  340. * @param product
  341. */
  342. function sendSms(product, mode) {
  343. $("#yzm").removeAttr("onclick");
  344. if (getMemoValbyId("tt", "phone") != "") { //判断号码是否输入
  345. if (pattern.test(getMemoValbyId("tt", "phone"))) { //判断号码格式
  346. $.ajax({
  347. type: "POST",
  348. contentType: "application/json; charset=utf-8",
  349. dataType: "Json",
  350. url: getRootPath() + "-s1api" + '/smsc', //目标地址
  351. data: JSON.stringify(sendSmsDate(product, mode)),
  352. success: function(msg) {
  353. var resCode = eval(msg["resultCode"]);
  354. if (resCode == "0000") {
  355. ncode = true;
  356. settime(mode);
  357. } else {
  358. sleep(mode);
  359. pro_bounced("温馨提示", msg["errorInfo"], "", false);
  360. }
  361. },
  362. error: function(XMLHttpRequest, textStatus, errorThrown) {
  363. sleep(mode);
  364. pro_bounced("温馨提示", "短信验证码发送失败", "", false);
  365. },
  366. });
  367. } else {
  368. $("#yzm").attr("onclick", "sendSms('tt','" + mode + "')");
  369. pro_bounced("温馨提示", "请输入正确的中国联通手机号码", "", false);
  370. }
  371. } else {
  372. $("#yzm").attr("onclick", "sendSms('tt','" + mode + "')");
  373. pro_bounced("温馨提示", "手机号码未输入", "", false);
  374. }
  375. if ('acti' == mode) {
  376. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'active_click_send_sms_code_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(getUrlParam("sou"), 32) })
  377. } else {
  378. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_click_send_sms_code_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(getUrlParam("sou"), 32) })
  379. }
  380. try {
  381. window.HtmlPageVisitor && window.HtmlPageVisitor.setMp(getMemoValbyId("tt", "phone"));
  382. } catch (e) {}
  383. }
  384. function sleep(mode) {
  385. var start = new Date().getTime();
  386. // console.log('休眠前:' + start);
  387. while (true) {
  388. if (new Date().getTime() - start > 10000) {
  389. $("#yzm").attr("onclick", "sendSms('tt','" + mode + "')");
  390. break;
  391. }
  392. }
  393. }
  394. /**
  395. * 跳转至对应页面
  396. */
  397. function gotoUrl(html) {
  398. var url = getRootPath() + "/" + html + ".html?fes=" + getUrlParam("fes") + "&sou=" + getUrlParam("sou") + "&use=" + getMemoValbyId('tt', 'useraccount');
  399. $(location).attr('href', url);
  400. }
  401. /**
  402. * 跳转至对应页面
  403. */
  404. function gotoUrlC(html) {
  405. var url = getRootPath().replace(/https/ig, "http") + "/" + html + ".html?fes=" + getUrlParam("fes") + "&sou=" + getUrlParam("sou") + "&use=" + getMemoValbyId('tt', 'useraccount');
  406. $(location).attr('href', url);
  407. }
  408. /**
  409. * 数据加载发送信息包装.
  410. */
  411. function postiniDate() {
  412. var data = {
  413. fes: getUrlParam("fes"),
  414. sou: getUrlParam("sou"),
  415. };
  416. return data;
  417. }
  418. /**
  419. * 获取流量
  420. */
  421. function GetFlowJsonData(product) {
  422. var data = {
  423. "fog": fog,
  424. "usermob": phone,
  425. };
  426. return data;
  427. }
  428. /**
  429. * 订购发送信息包装
  430. * @param product
  431. * @returns {___anonymous5356_5582}
  432. */
  433. function GetMasData(product, canceltype, cancelmsg) {
  434. var data = {
  435. "code": getMemoValbyId(product, "code"),
  436. "fog": getMemoValbyId(product, "fog"),
  437. "usermob": getMemoValbyId(product, "phone"),
  438. "useraccount": getMemoValbyId(product, "useraccount"),
  439. "canceltype": canceltype,
  440. "cancelmsg": cancelmsg,
  441. "fes": getUrlParam("fes"),
  442. "sou": getUrlParam("sou"),
  443. };
  444. try {
  445. window.WoAnalytics && window.WoAnalytics.setMp($(getMemoValbyId(product, "phone")).val());
  446. } catch (e) {}
  447. return data;
  448. }
  449. var se = 0;
  450. function seuid() {
  451. se = se + 1;
  452. if (se == 5) {
  453. se = 0;
  454. alert("sou:" + sou);
  455. }
  456. }
  457. (function() {
  458. Date.prototype.from = function(dateString) {
  459. var pattern2 = /(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/
  460. var str = dateString.replace(/-/g, '/');
  461. str = str.replace(pattern2, '$1/$2/$3 $4:$5:$6')
  462. return new Date(str)
  463. }
  464. // 对Date的扩展,将 Date 转化为指定格式的String
  465. // 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
  466. // 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
  467. // 例子:
  468. // (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
  469. // (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
  470. Date.prototype.format = function(fmt) { //author: meizz
  471. var o = {
  472. "M+": this.getMonth() + 1, //月份
  473. "d+": this.getDate(), //日
  474. "h+": this.getHours(), //小时
  475. "m+": this.getMinutes(), //分
  476. "s+": this.getSeconds(), //秒
  477. "q+": Math.floor((this.getMonth() + 3) / 3), //季度
  478. "S": this.getMilliseconds() //毫秒
  479. };
  480. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  481. for (var k in o)
  482. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  483. return fmt;
  484. }
  485. })();
  486. function getTodaySurplusMillis() {
  487. var time1 = new Date();
  488. var time2 = time1.from(time1.getFullYear() + '-' + (time1.getMonth() + 1) + '-' + time1.getDate() + ' 23:59:59');
  489. console.log(time2.getTime() - time1)
  490. return time2.getTime() - time1.getTime();
  491. }
  492. function burypointLogId(operid, remark, url) {
  493. var uuid = getCookie('uuid'); // uv
  494. var vvid = getCookie('vvid'); // vv
  495. if (uuid == null || uuid.trim() == '') {
  496. uuid = guid();
  497. setCookie('uuid', uuid, getTodaySurplusMillis());
  498. }
  499. if (vvid == null || vvid.trim() == '') {
  500. vvid = guid();
  501. setCookie('vvid', vvid, -1);
  502. }
  503. if (operid == null || operid == '') {
  504. // 页面的埋点不通过/burypoint/logid接口实现,通过文件日志入库方式
  505. return;
  506. }
  507. var param = {
  508. operid: operid,
  509. uuid: uuid,
  510. vvid: vvid,
  511. fog: getMemoValbyId('tt', 'fog'),
  512. userid: '',
  513. fes: getUrlParam("fes"),
  514. sou: getUrlParam("sou"),
  515. url: encodeURIComponent(url || window.location.href),
  516. remark: encodeURIComponent(remark || '')
  517. }
  518. $.ajax({
  519. type: "POST",
  520. contentType: "application/json; charset=utf-8",
  521. dataType: "Json",
  522. url: getRootPath() + "-s1api" + '/burypoint/logid', //目标地址
  523. data: JSON.stringify(param),
  524. success: function() {},
  525. error: function() {},
  526. });
  527. }
  528. function getCookie(name) {
  529. var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
  530. if (arr = document.cookie.match(reg))
  531. return unescape(arr[2]);
  532. else
  533. return null;
  534. }
  535. /**
  536. * 如果没有设置时间
  537. */
  538. function setCookie(name, value, millis) {
  539. millis = (millis == undefined ? 0 : millis);
  540. var exp = new Date();
  541. if (millis < 0) {
  542. document.cookie = name + "=" + escape(value);
  543. } else {
  544. exp.setTime(exp.getTime() + millis);
  545. document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
  546. }
  547. }
  548. function guid() {
  549. return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
  550. var r = Math.random() * 16 | 0,
  551. v = c == 'x' ? r : (r & 0x3 | 0x8);
  552. return v.toString(16);
  553. });
  554. }
  555. $('#tiu').unbind('click').on('click', function() {
  556. showCancelReasonPage().done(function(cancelReason) {
  557. doShowCancelPage(cancelReason)
  558. })
  559. })
  560. function showCancelReasonPage() {
  561. var reasonUrl;
  562. var baseUrl;
  563. if (window.location.href.indexOf("https://800.wo.cn/orderchannel") >= 0) {
  564. reasonUrl = "https://800.wo.cn/orderchannel/public/libs/cancelreason/index.html";
  565. baseUrl = "https://800.wo.cn/";
  566. } else if (window.location.href.indexOf("https://800.wo.cn/festivalchannel") >= 0) {
  567. reasonUrl = "https://800.wo.cn/festivalchannel/public/libs/cancelreason/index.html";
  568. baseUrl = "https://800.wo.cn/";
  569. } else if (window.location.href.indexOf("http://localhost") >= 0) {
  570. reasonUrl = "http://localhost:8088/orderchannel/public/libs/cancelreason/index.html";
  571. baseUrl = "http://localhost:8088/";
  572. } else if (window.location.href.indexOf("http://127.0.0.1") >= 0) {
  573. reasonUrl = "http://127.0.0.1:8088/orderchannel/public/libs/cancelreason/index.html";
  574. baseUrl = "http://127.0.0.1:8088/";
  575. } else if (window.location.href.indexOf("http://100.0.4.69:3344") >= 0) {
  576. reasonUrl = "http://100.0.4.69:3344/orderchannel/public/libs/cancelreason/index.html";
  577. baseUrl = "http://100.0.4.69:3344/";
  578. } else if (window.location.href.indexOf("http://100.0.4.69:8282") >= 0) {
  579. reasonUrl = "http://100.0.4.69:8282/orderchannel/public/libs/cancelreason/index.html";
  580. baseUrl = "http://100.0.4.69:8282/";
  581. } else {
  582. reasonUrl = "https://operation1.bol.wo.cn/orderchannel/public/libs/cancelreason/index.html";
  583. baseUrl = "https://operation1.bol.wo.cn/";
  584. }
  585. window.$capoverlay = $('<div class="overlay" style="z-index: 0; background-color: rgba(0,0,0,0.4);"></div>');
  586. $capoverlay.appendTo($(document.body));
  587. $("body").css("overflow", "hidden");
  588. var $iframe;
  589. if ($('#reasonIframe').length >= 1) {
  590. $iframe = $('#reasonIframe').attr('src', reasonUrl);
  591. } else {
  592. $iframe = $('<iframe id="reasonIframe" src="' + reasonUrl + '"></iframe>');
  593. $('body').append($iframe);
  594. }
  595. $iframe.css({
  596. width: "100%",
  597. height: "100%",
  598. position: "fixed",
  599. top: 0,
  600. left: 0,
  601. margin: 0,
  602. padding: 0,
  603. "-webkit-overflow-scrolling": "touch",
  604. border: "0px",
  605. "z-index": 111,
  606. });
  607. var def = $.Deferred();
  608. function messageListener(event) {
  609. var data = JSON.parse(event.data);
  610. $iframe.remove();
  611. $capoverlay.remove();
  612. $("body").css("overflow", "auto");
  613. window.removeEventListener('message', messageListener);
  614. if (data.eventtype != 'close') {
  615. def.resolve(data)
  616. } else {
  617. def.reject(data)
  618. }
  619. }
  620. window.addEventListener('message', messageListener);
  621. return def;
  622. }
  623. function doShowCancelPage(cancelReason) {
  624. var k = JSON.stringify(cancelReason)
  625. window.localStorage.setItem('kye', k)
  626. gotoUrl('Tou/Dy/cancel')
  627. }