20191023.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="pragma" content="no-cache">
  6. <meta http-equiv="cache-control" content="no-cache">
  7. <meta http-equiv="expires" content="0">
  8. <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
  9. <meta name="apple-mobile-web-app-capable" content="yes">
  10. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  11. <meta name="format-detection" content="telphone=no, email=no" />
  12. <title>Aiberle爱贝源</title>
  13. <link rel="stylesheet" type="text/css" href="css/mui.min.css" />
  14. <link rel="stylesheet" type="text/css" href="css/iconfont.css" />
  15. <link rel="stylesheet" type="text/css" href="css/main.css" />
  16. <style>
  17. .year-dalog{background:url(images/year-dalog.png) center center no-repeat rgba(0,0,0,.7);background-size: 80% auto; position: fixed;left: 0;top: 0;right: 0;bottom: 0;width: 100%; height: 100%;z-index: 99;display: none;-webkit-transform: translateY(-100%);transform: translateY(-100%); -webkit-transition: .5s;transition: .5s;}
  18. .year-dalog.active{-webkit-transform: translateY(0%);transform: translateY(0%);}
  19. .year-dalog img{width: 100%;}
  20. div{color: #000000;}
  21. /* .header { padding: 10px 0 7px 0; height: 65px; box-shadow: 0 0 0 #fff; background: #fff; }
  22. .header h6 { text-indent: 12px; color: #999; letter-spacing: 2px; }
  23. .go-index { width: 30%; margin-right: 1%; float: none; }
  24. .go-index img { width: 80%; padding-top: 5px; margin-left: 12px; max-width: 100px; }
  25. .swiper-container-horizontal>.swiper-pagination-bullets { bottom: 0; }
  26. .swiper-pagination-bullet-active { background: #63ccde; }
  27. .index-title { padding: 7px 12px 7px 12px; display: block; position: relative; }
  28. .index-title strong { font-size: 17px; }
  29. .index-title .mui-pull-right { color: #333; }
  30. .index-title font { display: inline-block; -webkit-transform: translateY(-1px); transform: translateY(-1px); }
  31. .pro-list .mui-media-object { background: #f2f2f2; border-radius: 5px; display: block; }
  32. .pro-list:before,.pro-list:after {display: none;} */
  33. /* .pro-list.mui-table-view.mui-grid-view>li:nth-child(odd) {padding: 10px 8px 0 14px;} */
  34. /* .pro-list.mui-table-view.mui-grid-view>li:nth-child(even) {padding: 10px 0 0 22px;} */
  35. .pro-list.mui-table-view.mui-grid-view>li:nth-child(odd){padding: 0px;}
  36. .pro-list.mui-table-view.mui-grid-view>li:nth-child(even){padding: 0px;}
  37. .mui-table-view.mui-grid-view {padding: 0px;}
  38. .mui-table-view{}
  39. .pro-list h6 {margin: 7px 0;color: #bbb;}
  40. .pro-list .pro-price {font-size: 14px;margin-top: 8px;}
  41. .pro-list .pro-price span {color: #db3f53;}
  42. .pro-list .pro-price s {color: #bbb;margin-left: 15px;}
  43. body{padding: 0px;margin: 0px;background-color: #FFFFFF;}
  44. .coupon_class{padding-top:12px ;}
  45. .ul_class>ul>li{float: left;display: block;}
  46. .ul_class>ul>li>img{display: block;width: 100%;}
  47. .ul_class{display: block;width: 100%;}
  48. </style>
  49. </head>
  50. <script>
  51. var start = new Date(2019,9,24,8,00,00);
  52. var end = new Date(2019,10,11,23,59,59);
  53. var d = new Date().getTime(); //当前时间戳
  54. if (!(d > start && d <= end)) {
  55. location.href = "index.html";
  56. }
  57. </script>
  58. <body>
  59. <footer class="mui-bar mui-bar-tab" id="footer-bar-tab">
  60. <a class="mui-tab-item mui-active">
  61. <span class="iconfont icon-shouye"></span>
  62. <span class="mui-tab-label">首页</span>
  63. </a>
  64. <a class="mui-tab-item">
  65. <span class="iconfont icon-gouwuche"></span>
  66. <span class="mui-tab-label">购物车</span>
  67. </a>
  68. <a class="mui-tab-item">
  69. <span class="iconfont icon-dingdan"></span>
  70. <span class="mui-tab-label">订单</span>
  71. </a>
  72. <a class="mui-tab-item">
  73. <span class="iconfont icon-wode"></span>
  74. <span class="mui-tab-label">我的</span>
  75. </a>
  76. </footer>
  77. <div class="" style="background-color: #fff2f3;">
  78. <img width="100%" src="images/20191024/banner.jpg" />
  79. </div>
  80. <div class="coupon_class ul_class" style="height: 90px;background-color:#fff2f3 ;">
  81. <ul>
  82. <li style="width: 28%;margin-left: 5%;" couponId="31000"><img src="images/20191024/q_10.png" /></li>
  83. <li style="width: 28%;margin-left: 3%;" couponId="31001"><img src="images/20191024/q_20.png" /></li>
  84. <li style="width: 28%;margin-left: 3%;" couponId="31002"><img src="images/20191024/q_50.png" /></li>
  85. </ul>
  86. </div>
  87. <div class="slogan_class ul_class" style="height: 65px;padding-top:15px ;">
  88. <ul>
  89. <li style="width: 48%;"><img style="margin-left: 3%;" src="images/20191024/box_ms.jpg" /></li>
  90. <li style="width: 48%;"><img style="margin-left: 5%" src="images/20191024/box_xsg.jpg" /></li>
  91. </ul>
  92. </div>
  93. <div class="ms_class ul_class" style="height: 210px;padding-top:5px ;">
  94. <ul>
  95. <li style="width: 48%;margin-left: 1%;">
  96. <img id="ms_01" style="display: none;height: 205px;" src="images/20191024/ms_before.jpg" />
  97. <img id="ms_02" style="display: none;height: 205px;" class="mui-media-object to_new_slt" src="images/20191024/ms_after_02.jpg">
  98. <img id="ms_03" style="display: none;height: 205px;" class="mui-media-object" src="images/20191024/ms_after_03.jpg">
  99. </li>
  100. <li style="width: 48%;margin-left: 1%;">
  101. <img id="xs_01" style="display: none;height: 205px;" src="images/20191024/ms_before_zp.jpg" />
  102. <img id="xs_02" style="display: none;height: 205px;" class="mui-media-object to_new_xs" src="images/20191024/ms_after_zp.jpg">
  103. <img id="xs_03" style="display: none;height: 205px;" src="images/20191024/ms_end_zp.jpg" />
  104. </li>
  105. </ul>
  106. <div style="position: relative; top: -104px; left: 20%; font-weight: bold; color: #FF666B;width: 80px; height: 20px; float: left;">
  107. <div id="sj_01" style="display: none;color: #FF666B;" >23:59:59</div>
  108. <div id="sj_02" style="display: none;color: #FF666B;" >23:59:59</div>
  109. </div>
  110. </div>
  111. <div class="slogan_class ul_class" style="height: 53px;padding-top:0px ;margin-top: 10px;">
  112. <ul>
  113. <li style="width: 97%;"><img style="margin-left: 1.5%;" src="images/20191024/box_zj.jpg" /></li>
  114. </ul>
  115. </div>
  116. <div class="mui-content" style="background: #fff;padding-top:15px ;">
  117. <!--list结束-->
  118. <div class="index-title go_web_shop" style="margin-top: 0px;">
  119. <strong>Aiberle</strong><span class="mui-pull-right go_pro_list" type="aiberle"><font>更多</font><span class="mui-icon mui-icon-arrowright"></span></span>
  120. </div>
  121. <div class="chanpin-box" style="padding-bottom: 5px;">
  122. <ul class="mui-table-view mui-grid-view my-view-no to_goods" >
  123. <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding: 0px;" >
  124. <a proid="33" class="go_chanpin_details" style="width: 96%;padding-left: 3%;padding-right: 1%;margin: 0px;">
  125. <img class="mui-media-object" src="images/20191024/wb_1_sj.jpg">
  126. </a>
  127. </li>
  128. <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding: 0px;">
  129. <a proid="39" class="go_chanpin_details" style="width: 96%;padding-left: 2%;padding-right: 2%;margin: 0px;">
  130. <img class="mui-media-object" src="images/20191024/lv_sj.jpg">
  131. </a>
  132. </li>
  133. <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding: 0px;">
  134. <a proid="46" class="go_chanpin_details" style="width: 96%;padding-left: 1%;padding-right: 3%;margin: 0px;">
  135. <img class="mui-media-object" src="images/20191024/fg_sj.jpg">
  136. </a>
  137. </li>
  138. </ul>
  139. <ul class="mui-table-view mui-grid-view my-view-no to_goods" style="margin-top: 3px;">
  140. <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding: 0px;" >
  141. <a proid="58" class="go_chanpin_details" style="width: 96%;padding-left: 3%;padding-right: 1%;margin: 0px;">
  142. <img class="mui-media-object" src="images/20191024/new_s3.jpg">
  143. </a>
  144. </li>
  145. <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding: 0px;">
  146. <a proid="54" class="go_chanpin_details" style="width: 96%;padding-left: 2%;padding-right: 2%;margin: 0px;">
  147. <img class="mui-media-object" src="images/20191024/rsj.jpg">
  148. </a>
  149. </li>
  150. <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding: 0px;">
  151. <a proid="52" class="go_chanpin_details" style="width: 96%;padding-left: 1%;padding-right: 3%;margin: 0px;">
  152. <img class="mui-media-object" src="images/20191024/new_hs.jpg">
  153. </a>
  154. </li>
  155. </ul>
  156. <ul class="mui-table-view mui-grid-view my-view-no to_goods" style="margin-top: 3px;">
  157. <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding: 0px;" >
  158. <a proid="41" class="go_chanpin_details" style="width: 96%;padding-left: 3%;padding-right: 1%;margin: 0px;">
  159. <img class="mui-media-object" src="images/20191024/old_hs.jpg">
  160. </a>
  161. </li>
  162. <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding: 0px;">
  163. <a proid="40" class="go_chanpin_details" style="width: 96%;padding-left: 2%;padding-right: 2%;margin: 0px;">
  164. <img class="mui-media-object" src="images/20191024/longtou_new.jpg">
  165. </a>
  166. </li>
  167. <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding: 0px;">
  168. <a proid="36" class="go_chanpin_details" style="width: 96%;padding-left: 1%;padding-right: 3%;margin: 0px;">
  169. <img class="mui-media-object" src="images/20191024/lv_tz.jpg">
  170. </a>
  171. </li>
  172. </ul>
  173. </div>
  174. <div class="index-title go_web_shop2" style="">
  175. <strong>WaterO</strong><span class="mui-pull-right go_pro_list" type="watero"><font>更多</font><span class="mui-icon mui-icon-arrowright"></span></span>
  176. </div>
  177. <div class="chanpin-box">
  178. <ul class="mui-table-view mui-grid-view my-view-no to_goods" id="index-pro-list2" style="padding-bottom: 0;">
  179. <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding: 0px;" >
  180. <a proid="47" class="go_chanpin_details" style="width: 96%;padding-left: 3%;padding-right: 1%;margin: 0px;">
  181. <img class="mui-media-object" src="images/20191024/zqj.jpg">
  182. </a>
  183. </li>
  184. <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding: 0px;">
  185. <a proid="48" class="go_chanpin_details" style="width: 96%;padding-left: 2%;padding-right: 2%;margin: 0px;">
  186. <img class="mui-media-object" src="images/20191024/hei_sj.jpg">
  187. </a>
  188. </li>
  189. <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding: 0px;">
  190. <a proid="60" class="go_chanpin_details" style="width: 96%;padding-left: 1%;padding-right: 3%;margin: 0px;">
  191. <img class="mui-media-object" src="images/20191024/watero_tz.jpg">
  192. </a>
  193. </li>
  194. </ul>
  195. </div>
  196. <div class="mui-content-padded my-content-padded" id="advs_banner" style="display: block;">
  197. <!--<a><img src="images/fuqing-1.png"></a>-->
  198. </div>
  199. <!--商城首页end-->
  200. </div>
  201. <!--春节放假通知-->
  202. <div class="year-dalog"></div>
  203. <script src="js/mui.min.js"></script>
  204. <script src="js/jquery-2.1.1.min.js"></script>
  205. <script src="js/jquery.autocompleter.js"></script>
  206. <script src="js/main.js"></script>
  207. <script src="js/wechat-utils-1.0.js"></script>
  208. </body>
  209. <script>
  210. // 读取值
  211. var colors = [];
  212. var histoty = JSON.parse(localStorage.getItem('search_histoty'));
  213. var clickdate = JSON.parse(localStorage.getItem('clickdate'));
  214. //console.log(histoty)
  215. if (histoty != null) {
  216. var str = histoty.text;
  217. for (i = 0; i < str.length; i++) {
  218. var childTypeId = ''
  219. if (typeof(str[i].childTypeId) != "undefined") {
  220. childTypeId = 'childTypeid=' + str[i].childTypeId;
  221. }
  222. $("#history").append('<button type="button" class="mui-btn" name="' + str[i].id + '" typeid="' + str[i].typeId +
  223. '" ' + childTypeId + '>' + str[i].label + '</button>');
  224. }
  225. }
  226. mui.ready(function() {
  227. calculatingTime();
  228. $.ajax(base_path + '/wechat/indexData?dates=' + new Date().getTime(), {
  229. data: {},
  230. dataType: 'json',
  231. xhrFields: {
  232. withCredentials: true
  233. },
  234. crossDomain: true,
  235. type: 'post',
  236. timeout: 15000,
  237. success: function(dt) {
  238. //判断一下
  239. if (dt.isRedirect) {
  240. location.href = dt.redirectURL;
  241. }
  242. },
  243. error: function(xhr, type, errorThrown) {
  244. console.log(xhr);
  245. mui.alert("获取数据失败!网络错误");
  246. }
  247. });
  248. //搜索框焦点事件
  249. $('#search').on('focus', function(e) {
  250. window.scrollTo(0, 0, 500);
  251. $(".icon-caidan").hide();
  252. $('.my-btn-cancel').show();
  253. if ($(this).val().length > 0) {
  254. $('#search-hot').hide(500);
  255. $(".autocompleter-list").css("height", $(document).height())
  256. } else {
  257. $("#search-hot").css("height", $(document.body).height()).show();
  258. $("body").css("overflow", "hidden");
  259. }
  260. });
  261. //搜索框失去焦点事件
  262. $('#search').on('blur', function(e) {
  263. setTimeout(function() {
  264. $('#search-hot,.my-btn-cancel').hide();
  265. $("body").css("overflow", "auto");
  266. $(".icon-caidan").show();
  267. }, 700);
  268. });
  269. //点击后把text赋值到搜索框
  270. $(document).on('tap', '#history button', function() {
  271. $('#search').val($(this).text());
  272. console.log($(this).text())
  273. $('#search-hot').hide();
  274. $("body").css("overflow", "auto");
  275. var parameter = {};
  276. parameter["id"] = $(this).attr("name");
  277. parameter["label"] = $(this).text();
  278. parameter["typeId"] = $(this).attr("typeid");
  279. if (typeof($(this).attr("childtypeId")) != "undefined") {
  280. parameter["childTypeId"] = $(this).attr("childtypeid");
  281. }
  282. search(parameter);
  283. });
  284. //搜索框本地缓存
  285. function search(selected) {
  286. if (!window.localStorage) {
  287. mui.alert("您的浏览器不支持localStorage");
  288. } else {
  289. //自定义json数据
  290. var obj = {},
  291. searchobj = {};
  292. if (histoty != null) {
  293. var str = histoty.text;
  294. if (str.length > 2) {
  295. str.splice(2, 1)
  296. }
  297. str.splice(0, 0, selected)
  298. obj = {
  299. text: str
  300. }
  301. } else {
  302. obj = {
  303. text: [selected]
  304. };
  305. }
  306. searchobj = {
  307. text: [selected]
  308. }
  309. //json格式化插入
  310. localStorage.setItem('search_histoty', JSON.stringify(obj));
  311. sessionStorage.setItem('search_data', JSON.stringify(searchobj));
  312. mui.openWindow({
  313. url: 'pro-list.html?productId=' + selected.typeId
  314. });
  315. }
  316. }
  317. //监听搜索框值改变事件
  318. $('#search').on('input', function(e) {
  319. if ($(this).val().length > 0) {
  320. $('#search-hot').hide();
  321. $(".autocompleter-list").css("height", $(document).height());
  322. } else {
  323. $('#search-hot').show();
  324. $("body").css("overflow", "hidden");
  325. $(".autocompleter-list").css("height", "auto");
  326. }
  327. });
  328. $(".loading").hide().css("opacity", "0");
  329. });
  330. //取消搜索
  331. $(document).on('tap', '.my-btn-cancel', function() {
  332. $(this).hide();
  333. $('#search-hot').hide();
  334. $("body").css("overflow", "auto");
  335. $('#search').autocompleter("close");
  336. $(".autocompleter-list").empty().css("height", "auto");
  337. $('.autocompleter-hint').removeClass('autocompleter-hint-show').empty();
  338. $(".icon-caidan").show();
  339. $('#search').blur();
  340. });
  341. //打开菜单
  342. $(document).on('tap', '.icon-caidan', function() {
  343. $("#menu").css("height", $(window).height());
  344. $("#menu>li").addClass("active");
  345. });
  346. //关闭菜单
  347. $(document).on('tap', '.icon-guanbi', function() {
  348. $("#menu>li").removeClass("active");
  349. $("#menu").css("height", "0px");
  350. });
  351. //精选产品详情
  352. $(document).on('tap', '#index-pro-list .mui-table-view-cell>a', function() {
  353. location.href = 'pro-details.html?productId=' + $(this).attr("name")
  354. });
  355. //精选产品详情2
  356. $(document).on('tap', '.to_goods>li>a', function() {
  357. location.href = 'pro-details.html?productId=' + $(this).attr("proid")
  358. });
  359. mui('body').on('tap', '.to_new_slt', function() {
  360. location.href = 'pro-details.html?productId=59'
  361. });
  362. mui('body').on('tap', '.to_new_xs', function() {
  363. location.href = "pro-list.html?productId=13";
  364. });
  365. //产品详情-配件
  366. $(document).on('tap', '#index-pro-items>.mui-control-item', function() {
  367. location.href = 'pro-list.html?productId=' + $(this).attr("name") + '&childTypeId=' + $(this).attr("item");
  368. });
  369. //more更多产品
  370. $(document).on('tap', '.go_pro_list', function() {
  371. if ($(this).attr("type") == "aiberle") {
  372. location.href = "pro-list.html?productId=13";
  373. } else {
  374. location.href = "pro-list.html?productId=14";
  375. }
  376. });
  377. //菜单跳转
  378. $(document).on('tap', '#menu>.line>a', function() {
  379. location.href = 'pro-list.html?productId=' + $(this).attr("name") + '&childTypeId=' + $(this).attr("item");
  380. });
  381. $(document).on('tap', '.coupon_class>ul>li', function() {
  382. var couponId = this.getAttribute("couponId");
  383. $.ajax(base_path + '/wechat/coupon/receive_coupon_end?dates=' + new Date().getTime(), {
  384. data: {
  385. "couponId": couponId
  386. },
  387. dataType: 'json',
  388. xhrFields: {
  389. withCredentials: true
  390. },
  391. crossDomain: true,
  392. type: 'post',
  393. timeout: 15000,
  394. success: function(dt) {
  395. if(dt.isRedirect) {
  396. location.href = dt.redirectURL;
  397. } else {
  398. if(dt.status) {
  399. mui.toast(dt.message);
  400. } else {
  401. mui.toast(dt.message);
  402. }
  403. }
  404. },
  405. error: function(xhr, type, errorThrown) {
  406. console.log(xhr);
  407. mui.alert("领取失败!网络出小差了", function() {
  408. });
  409. }
  410. });
  411. });
  412. /**
  413. *
  414. */
  415. var msStartDate = new Date(2019,10,10,00,00,00); //秒杀
  416. var msEndDate = new Date(2019,10,11,00,00,00); //秒杀结束
  417. var limitPurchaseDate = new Date(2019,10,11,11,00,00); //限时购
  418. var limitPurchaseEndDate = new Date(2019,10,11,12,00,00); //限时购-结束
  419. // var msStartDate = new Date(2019,10,01,15,42,00); //秒杀开始
  420. // var msEndDate = new Date(2019,10,01,15,43,00); //秒杀结束
  421. // var limitPurchaseDate = new Date(2019,10,01,15,43,00); //限时购
  422. function calculatingTime(){
  423. var jetLag = getJetLag(msStartDate);
  424. if(jetLag.dateDiff > 0){ //未开始
  425. $("#sj_01").show();
  426. $("#ms_01").show();
  427. $("#sj_01").text(jetLag.allHours+":"+jetLag.minutes+":"+jetLag.seconds)
  428. }else{
  429. //已开始
  430. $("#ms_01").hide();
  431. $("#sj_01").hide();
  432. var msEndJetLeg = getJetLag(msEndDate);
  433. if(msEndJetLeg.dateDiff >= 0){ //已开始
  434. $("#ms_02").show();
  435. $("#sj_02").show();
  436. $("#sj_02").text(msEndJetLeg.allHours+":"+msEndJetLeg.minutes+":"+msEndJetLeg.seconds)
  437. }else{ //一结束
  438. $("#ms_02").hide();
  439. $("#ms_03").show();
  440. $("#sj_02").hide();
  441. }
  442. }
  443. var limitPurchaseEndDateJetlag = getJetLag(limitPurchaseEndDate);
  444. if(limitPurchaseEndDateJetlag.dateDiff < 0){
  445. $("#xs_01").hide();
  446. $("#xs_02").hide();
  447. $("#xs_03").show();
  448. }else{
  449. var lPDjetLag = getJetLag(limitPurchaseDate);
  450. if(lPDjetLag.dateDiff > 0){
  451. $("#xs_01").show();
  452. $("#xs_02").hide();
  453. }else{
  454. $("#xs_01").hide();
  455. $("#xs_02").show();
  456. }
  457. }
  458. }
  459. $(document).ready(function() {
  460. //一秒刷新一次显示时间
  461. setInterval(function(){
  462. calculatingTime();
  463. },1000)
  464. })
  465. function getJetLag(scfDate){
  466. var newdate = new Date();//获取当前时间
  467. var dateDiff = scfDate.getTime() - newdate;//时间差的毫秒数
  468. var dayDiff = Math.floor(dateDiff / (24 * 3600 * 1000));//计算出相差天数
  469. var leave1=dateDiff%(24*3600*1000) //计算天数后剩余的毫秒数
  470. var hours=Math.floor(leave1/(3600*1000))//计算出小时数
  471. var allHours = hours + dayDiff*24; //计算总小时数
  472. //计算相差分钟数
  473. var leave2=leave1%(3600*1000) //计算小时数后剩余的毫秒数
  474. var minutes=Math.floor(leave2/(60*1000))//计算相差分钟数
  475. //计算相差秒数
  476. var leave3=leave2%(60*1000) //计算分钟数后剩余的毫秒数
  477. var seconds=Math.round(leave3/1000)
  478. //console.log("总小时:"+ allHours +";相差天数:"+dayDiff+";小时:"+hours+";分钟"+minutes+";秒数"+seconds);
  479. if(hours < 10){
  480. hours = "0"+hours;
  481. }
  482. if(allHours < 10){
  483. allHours = "0"+allHours;
  484. }
  485. if(minutes < 10){
  486. minutes = "0"+minutes;
  487. }
  488. if(seconds < 10){
  489. seconds = "0"+seconds;
  490. }
  491. var jetLag = new Object();
  492. jetLag.dateDiff = dateDiff;
  493. jetLag.dayDiff = dayDiff;
  494. jetLag.hours = hours;
  495. jetLag.allHours = allHours;
  496. jetLag.minutes = minutes;
  497. jetLag.seconds = seconds;
  498. return jetLag;
  499. }
  500. </script>
  501. </html>