123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="pragma" content="no-cache">
- <meta http-equiv="cache-control" content="no-cache">
- <meta http-equiv="expires" content="0">
- <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black">
- <meta name="format-detection" content="telphone=no, email=no" />
- <title>Aiberle爱贝源</title>
- <link rel="stylesheet" type="text/css" href="css/mui.min.css" />
- <link rel="stylesheet" type="text/css" href="css/iconfont.css" />
- <link rel="stylesheet" type="text/css" href="css/main.css" />
- <style>
- .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;}
- .year-dalog.active{-webkit-transform: translateY(0%);transform: translateY(0%);}
- .year-dalog img{width: 100%;}
- div{color: #000000;}
- /* .header { padding: 10px 0 7px 0; height: 65px; box-shadow: 0 0 0 #fff; background: #fff; }
- .header h6 { text-indent: 12px; color: #999; letter-spacing: 2px; }
- .go-index { width: 30%; margin-right: 1%; float: none; }
- .go-index img { width: 80%; padding-top: 5px; margin-left: 12px; max-width: 100px; }
- .swiper-container-horizontal>.swiper-pagination-bullets { bottom: 0; }
- .swiper-pagination-bullet-active { background: #63ccde; }
- .index-title { padding: 7px 12px 7px 12px; display: block; position: relative; }
- .index-title strong { font-size: 17px; }
- .index-title .mui-pull-right { color: #333; }
- .index-title font { display: inline-block; -webkit-transform: translateY(-1px); transform: translateY(-1px); }
- .pro-list .mui-media-object { background: #f2f2f2; border-radius: 5px; display: block; }
- .pro-list:before,.pro-list:after {display: none;} */
- /* .pro-list.mui-table-view.mui-grid-view>li:nth-child(odd) {padding: 10px 8px 0 14px;} */
- /* .pro-list.mui-table-view.mui-grid-view>li:nth-child(even) {padding: 10px 0 0 22px;} */
- .pro-list.mui-table-view.mui-grid-view>li:nth-child(odd){padding: 0px;}
- .pro-list.mui-table-view.mui-grid-view>li:nth-child(even){padding: 0px;}
- .mui-table-view.mui-grid-view {padding: 0px;}
- .mui-table-view{}
- .pro-list h6 {margin: 7px 0;color: #bbb;}
- .pro-list .pro-price {font-size: 14px;margin-top: 8px;}
- .pro-list .pro-price span {color: #db3f53;}
- .pro-list .pro-price s {color: #bbb;margin-left: 15px;}
- body{padding: 0px;margin: 0px;background-color: #FFFFFF;}
- .coupon_class{padding-top:12px ;}
- .ul_class>ul>li{float: left;display: block;}
- .ul_class>ul>li>img{display: block;width: 100%;}
- .ul_class{display: block;width: 100%;}
-
- html,body{background: #FFFFFF;}
- .mui-content {
- background: #f2f2f2;
- }
-
- .center-header {
- position: relative;
- background: #9fa0a0;
- height: 160px;
- }
-
- .center-header .wecat-head {
- position: absolute;
- left: 0;
- top: 0;
- width: 100%;
- text-align: center;
- color: #fff;
- }
-
- .center-header .bottom-vip {
- font-size: 12px;
- background: #2f2d3a;
- position: absolute;
- left: 14px;
- right: 14px;
- bottom: 0;
- height: 40px;
- border-radius: 15px 15px 0 0;
- color: #fff;
- padding: 10px 0;
- }
-
- .center-header .bottom-vip .mui-table-cell:first-child {
- width: 13em;
- padding-left: 12px;
- }
-
- .center-header .vip-l {
- /* margin: 0 14px; */
- vertical-align: middle;
- }
-
- .center-header .vip-icon {
- display: inline-block;
- vertical-align: middle;
- margin-right: 2px;
- width: 15px;
- }
-
- .center-header .vip-title {
- vertical-align: middle;
- }
-
- .center-header .vip-arrow {
- display: inline-block;
- vertical-align: middle;
- margin-left: 5px;
- margin-right: 12px;
- width: 7px;
- padding-bottom: 3px;
- }
-
- .center-header .sign-in {
- position: absolute;
- right: 4px;
- top: 5px;
- color: #fff;
- padding: 5px 10px;
- height: 28px;
- }
-
- .center-header .sign-in>img {
- width: 19px;
- }
-
- .center-header .sign-in>span {
- vertical-align: top;
- font-size: 12px;
- }
-
- .center-header #userNickname {
- font-size: 14px;
- }
-
- #menu-nav .mui-control-item {
- line-height: 1.2;
- padding: 6px 0 12px 0;
- color: #666;
- font-size: 12px;
- }
- p{color: #999;font-size: 12px;}
- .center-content{background: #f2f2f2;padding:10px 14px 14px 14px;}
- .center-content .my-count{padding: 12px 0;background: #fff;border-radius: 8px;margin-bottom: 8px;}
- .center-content .mui-navigate-right:after{font-size: 20px;color: #999;top: 48%;}
- .center-content .mui-table-view:after{left: 15px;right: 15px; background: #e5e5e5;}
- .my-center-no .mui-table-view-cell .mui-icon{color: #999;font-size: 18px;}
- .order-box{padding:0;background: #fff;margin-bottom: 8px;border-radius: 8px;overflow: hidden;}
- .order-box .mui-badge{background: transparent;color: #bbb;font-size: 12px;}
- strong{font-size: 16px;}
- .order-box strong{font-size: 14px;}
- .my-center-no{border-radius: 8px;overflow: hidden;font-size: 12px;}
- .dalog {
- position: fixed;
- left: 0;
- top: 0;
- bottom: 0;
- right: 0;
- background: rgba(0, 0, 0, .7);
- display: none;
- z-index: 99;
- }
-
- .dalog>div {
- position: absolute;
- width: 270px;
- height: 290px;
- left: 50%;
- margin-left: -135px;
- top: 50%;
- margin-top: -150px;
- text-align: center;
- }
-
- .dalog .tp-box {
- background: #fff;
- padding: 10px 12px;
- border-radius: 8px;
- margin-bottom: 8px;
- }
- .dalog ul{
- padding-top: 12px;
- }
- .dalog ol{
- width: 185px;
- display: block;
- margin: 0 auto;
- text-align: left;
- padding-bottom: 4px;
- }
- .dalog ol>li{
- font-size: 12px;
- margin:0;
- white-space: nowrap;
- }
- .dalog ul>li {
- margin:0 0 16px 0;
- color: #727171;
- }
- .dalog ul>li:last-child{
- margin-bottom: 10px;
- }
- .dalog ul li p {
- color: #666;
- }
-
- .dalog .btn-see-integral {
- border-radius: 25px;
- background: #727171;
- color: #fff;
- padding: 5px 22px;
- border: 0;
- font-size: 14px;
- }
-
- .dalog .icon-guanbicha {
- color: #fff;
- font-size: 26px;
- }
-
- .dalog strong {
- font-size: 22px;
- letter-spacing: 4px;
- }
-
- .dalog .icon-A-zhucewancheng {
- font-size: 40px;
- }
- </style>
- </head>
- <script>
- var start = new Date(2019,12-1,6,00,00,00);
- var end = new Date(2019,12-1,14,23,59,59);
- var d = new Date().getTime(); //当前时间戳
- if (!(d > start && d <= end)) {
- location.href = "index.html";
- }
- </script>
- <body>
- <footer class="mui-bar mui-bar-tab" id="footer-bar-tab">
- <a class="mui-tab-item mui-active">
- <span class="iconfont icon-shouye"></span>
- <span class="mui-tab-label">首页</span>
- </a>
- <a class="mui-tab-item">
- <span class="iconfont icon-gouwuche"></span>
- <span class="mui-tab-label">购物车</span>
- </a>
- <a class="mui-tab-item">
- <span class="iconfont icon-dingdan"></span>
- <span class="mui-tab-label">订单</span>
- </a>
- <a class="mui-tab-item">
- <span class="iconfont icon-wode"></span>
- <span class="mui-tab-label">我的</span>
- </a>
- </footer>
-
- <div class="" style="">
- <img width="100%" src="images/20191212/banner.jpg" />
- </div>
-
- <div class="" style="color: #d7543b;">
- <img width="100%" src="images/20191212/zhucehuiyuan-aiberle.png" />
- </div>
-
- <div class="coupon_class ul_class" style="padding-bottom: 3px;background-color:#f8f8f8 ;width: 96%;margin-left: 2%;border-radius: 7px;overflow:hidden">
- <div style="padding-bottom: 10px;">
- <img src="images/20191212/maiyisonger.png" style="display: block;margin: auto; width: 70px;padding-top: 0px;">
- </div>
-
- <ul>
- <li style="width: 47%;margin-left: 2%;border-radius: 7px;padding-bottom: 5px;" class="watero_lv"><img src="images/20191212/watero-lv.jpg" /></li>
- <li style="width: 47%;margin-left: 2%;border-radius: 7px;padding-bottom: 5px;" class="aiberle_lv"><img src="images/20191212/aiberle-lv.jpg" /></li>
- </ul>
- </div>
-
- <div class="slogan_class ul_class" style="padding-top:15px;overflow:hidden; background: #fff;">
- <ul style="width: 98%;">
- <li style="margin: 0px;width: 48%;margin-left: 2%;" class="to_new_slt"><img style="" src="images/20191212/index_1.jpg" /></li>
- <li style="margin: 0px;width: 48%;margin-left: 2%;" class="go_pro_list" type="aiberle"><img style="" src="images/20191212/index_2.jpg" /></li>
- </ul>
- <ul style="width: 98%;">
- <li style="margin: 0px;width: 48%;margin-left: 2%;margin-top: 10px;" class="erweima"><img style="" src="images/20191212/index_3.jpg" /></li>
- <li style="margin: 0px;width: 48%;margin-left: 2%;margin-top: 10px;" class="go_cent"><img style="" src="images/20191212/index_4.jpg" /></li>
- </ul>
- </div>
-
- <div class="mui-content" style="background: #fff;padding-top:15px ;">
- <!--list结束-->
- <div class="index-title go_web_shop" style="margin-top: 0px;">
- <strong>Aiberle</strong><span class="mui-pull-right go_pro_list" type="aiberle"><font>更多</font><span class="mui-icon mui-icon-arrowright"></span></span>
- </div>
-
- <div class="chanpin-box" style="padding-bottom: 5px;">
- <ul class="mui-table-view mui-grid-view my-view-no to_goods" style="width: 98%;" >
- <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding-left: 2%;padding-top: 0px;">
- <a proid="36" class="go_chanpin_details" style="margin: 0px;">
- <img class="mui-media-object" src="images/20191212/lv_tz.jpg">
- </a>
- </li>
- <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding-left: 2%;padding-top: 0px;" >
- <a proid="33" class="go_chanpin_details" style="margin: 0px;">
- <img class="mui-media-object" src="images/20191212/wb_1_sj.jpg">
- </a>
- </li>
- <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding-left: 2%;padding-top: 0px;">
- <a proid="39" class="go_chanpin_details" style="margin: 0px;">
- <img class="mui-media-object" src="images/20191212/lv_sj.jpg">
- </a>
- </li>
- </ul>
- <ul class="mui-table-view mui-grid-view my-view-no to_goods" style="width: 98%;" >
- <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding-left: 2%;padding-top: 0px;">
- <a proid="46" class="go_chanpin_details" style="margin: 0px;">
- <img class="mui-media-object" src="images/20191212/fg_sj.jpg">
- </a>
- </li>
- <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding-left: 2%;padding-top: 0px;" >
- <a proid="58" class="go_chanpin_details" style="margin: 0px;">
- <img class="mui-media-object" src="images/20191212/new_s3.jpg">
- </a>
- </li>
- <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding-left: 2%;padding-top: 0px;">
- <a proid="54" class="go_chanpin_details" style="margin: 0px;">
- <img class="mui-media-object" src="images/20191212/rsj.jpg">
- </a>
- </li>
-
- </ul>
- <ul class="mui-table-view mui-grid-view my-view-no to_goods" style="width: 98%;" >
- <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding-left: 2%;padding-top: 0px;">
- <a proid="52" class="go_chanpin_details" style="margin: 0px;">
- <img class="mui-media-object" src="images/20191212/new_hs.jpg">
- </a>
- </li>
- <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding-left: 2%;padding-top: 0px;" >
- <a proid="41" class="go_chanpin_details" style="margin: 0px;">
- <img class="mui-media-object" src="images/20191212/old_hs.jpg">
- </a>
- </li>
- <!-- <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding-left: 2%;padding-top: 0px;">
- <a proid="40" class="go_chanpin_details" style="margin: 0px;">
- <img class="mui-media-object" src="images/20191212/longtou_new.jpg">
- </a>
- </li> -->
-
- </ul>
- </div>
-
- <div class="index-title go_web_shop2" style="">
- <strong>WaterO</strong><span class="mui-pull-right go_pro_list" type="watero"><font>更多</font><span class="mui-icon mui-icon-arrowright"></span></span>
- </div>
-
- <div class="chanpin-box">
- <ul class="mui-table-view mui-grid-view my-view-no to_goods" id="index-pro-list2" style="width: 98%;" >
- <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding-left: 2%;padding-top: 0px;">
- <a proid="60" class="go_chanpin_details" style="margin: 0px;">
- <img class="mui-media-object" src="images/20191212/watero_tz.jpg">
- </a>
- </li>
- <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding-left: 2%;padding-top: 0px;" >
- <a proid="47" class="go_chanpin_details" style="margin: 0px;">
- <img class="mui-media-object" src="images/20191212/zqj.jpg">
- </a>
- </li>
- <li class="mui-table-view-cell mui-media mui-col-xs-4" style="margin: 0px;padding-left: 2%;padding-top: 0px;">
- <a proid="48" class="go_chanpin_details" style="margin: 0px;">
- <img class="mui-media-object" src="images/20191212/hei_sj.jpg">
- </a>
- </li>
- </ul>
- </div>
-
- <div class="mui-content-padded my-content-padded" id="advs_banner" style="display: block;">
- <!--<a><img src="images/fuqing-1.png"></a>-->
- </div>
- <!--商城首页end-->
- </div>
-
- <div class="dalog">
- <div>
- <div class="tp-box">
- <img src="images/20191212/erweima.jpg" style="width: 100%;">
- </div>
- <br />
- <div class="mui-text-center">
- <i class="iconfont icon-guanbi"></i>
- </div>
- </div>
- </div>
-
- <div class="year-dalog"></div>
- <script src="js/mui.min.js"></script>
- <script src="js/jquery-2.1.1.min.js"></script>
- <script src="js/jquery.autocompleter.js"></script>
- <script src="js/main.js"></script>
- <script src="js/wechat-utils-1.0.js"></script>
- </body>
- <script>
- // 读取值
- var colors = [];
- var histoty = JSON.parse(localStorage.getItem('search_histoty'));
- var clickdate = JSON.parse(localStorage.getItem('clickdate'));
- //console.log(histoty)
- if (histoty != null) {
- var str = histoty.text;
- for (i = 0; i < str.length; i++) {
- var childTypeId = ''
- if (typeof(str[i].childTypeId) != "undefined") {
- childTypeId = 'childTypeid=' + str[i].childTypeId;
- }
- $("#history").append('<button type="button" class="mui-btn" name="' + str[i].id + '" typeid="' + str[i].typeId +
- '" ' + childTypeId + '>' + str[i].label + '</button>');
- }
- }
-
- mui.ready(function() {
- calculatingTime();
-
- $.ajax(base_path + '/wechat/indexData?dates=' + new Date().getTime(), {
- data: {},
- dataType: 'json',
- xhrFields: {
- withCredentials: true
- },
- crossDomain: true,
- type: 'post',
- timeout: 15000,
- success: function(dt) {
- //判断一下
- if (dt.isRedirect) {
- location.href = dt.redirectURL;
- }
- },
- error: function(xhr, type, errorThrown) {
- console.log(xhr);
- mui.alert("获取数据失败!网络错误");
- }
- });
-
- //搜索框焦点事件
- $('#search').on('focus', function(e) {
- window.scrollTo(0, 0, 500);
- $(".icon-caidan").hide();
- $('.my-btn-cancel').show();
- if ($(this).val().length > 0) {
- $('#search-hot').hide(500);
- $(".autocompleter-list").css("height", $(document).height())
- } else {
- $("#search-hot").css("height", $(document.body).height()).show();
- $("body").css("overflow", "hidden");
- }
- });
- //搜索框失去焦点事件
- $('#search').on('blur', function(e) {
- setTimeout(function() {
- $('#search-hot,.my-btn-cancel').hide();
- $("body").css("overflow", "auto");
- $(".icon-caidan").show();
- }, 700);
-
- });
- //点击后把text赋值到搜索框
- $(document).on('tap', '#history button', function() {
- $('#search').val($(this).text());
- console.log($(this).text())
- $('#search-hot').hide();
- $("body").css("overflow", "auto");
- var parameter = {};
- parameter["id"] = $(this).attr("name");
- parameter["label"] = $(this).text();
- parameter["typeId"] = $(this).attr("typeid");
- if (typeof($(this).attr("childtypeId")) != "undefined") {
- parameter["childTypeId"] = $(this).attr("childtypeid");
- }
- search(parameter);
- });
- //搜索框本地缓存
- function search(selected) {
- if (!window.localStorage) {
- mui.alert("您的浏览器不支持localStorage");
- } else {
- //自定义json数据
- var obj = {},
- searchobj = {};
- if (histoty != null) {
- var str = histoty.text;
- if (str.length > 2) {
- str.splice(2, 1)
- }
- str.splice(0, 0, selected)
- obj = {
- text: str
- }
- } else {
- obj = {
- text: [selected]
- };
- }
- searchobj = {
- text: [selected]
- }
- //json格式化插入
- localStorage.setItem('search_histoty', JSON.stringify(obj));
- sessionStorage.setItem('search_data', JSON.stringify(searchobj));
- mui.openWindow({
- url: 'pro-list.html?productId=' + selected.typeId
- });
- }
- }
- //监听搜索框值改变事件
- $('#search').on('input', function(e) {
- if ($(this).val().length > 0) {
- $('#search-hot').hide();
- $(".autocompleter-list").css("height", $(document).height());
- } else {
- $('#search-hot').show();
- $("body").css("overflow", "hidden");
- $(".autocompleter-list").css("height", "auto");
- }
- });
- $(".loading").hide().css("opacity", "0");
- });
-
- //取消搜索
- $(document).on('tap', '.my-btn-cancel', function() {
- $(this).hide();
- $('#search-hot').hide();
- $("body").css("overflow", "auto");
- $('#search').autocompleter("close");
- $(".autocompleter-list").empty().css("height", "auto");
- $('.autocompleter-hint').removeClass('autocompleter-hint-show').empty();
- $(".icon-caidan").show();
- $('#search').blur();
- });
- //打开菜单
- $(document).on('tap', '.icon-caidan', function() {
- $("#menu").css("height", $(window).height());
- $("#menu>li").addClass("active");
- });
- //关闭菜单
- $(document).on('tap', '.icon-guanbi', function() {
- $("#menu>li").removeClass("active");
- $("#menu").css("height", "0px");
- });
- //精选产品详情
- $(document).on('tap', '#index-pro-list .mui-table-view-cell>a', function() {
- location.href = 'pro-details.html?productId=' + $(this).attr("name")
- });
- //精选产品详情2
- $(document).on('tap', '.to_goods>li>a', function() {
- location.href = 'pro-details.html?productId=' + $(this).attr("proid")
- });
- mui('body').on('tap', '.to_new_slt', function() {
- location.href = 'pro-details.html?productId=59'
- });
- mui('body').on('tap', '.to_new_xs', function() {
- location.href = "pro-list.html?productId=13";
- });
- //产品详情-配件
- $(document).on('tap', '#index-pro-items>.mui-control-item', function() {
- location.href = 'pro-list.html?productId=' + $(this).attr("name") + '&childTypeId=' + $(this).attr("item");
- });
- //more更多产品
- $(document).on('tap', '.go_pro_list', function() {
- if ($(this).attr("type") == "aiberle") {
- location.href = "pro-list.html?productId=13";
- } else {
- location.href = "pro-list.html?productId=14";
- }
- });
- //菜单跳转
- $(document).on('tap', '#menu>.line>a', function() {
- location.href = 'pro-list.html?productId=' + $(this).attr("name") + '&childTypeId=' + $(this).attr("item");
- });
- mui('body').on('tap', '.erweima', function() {
- $('.dalog').show();
- });
- // 关闭弹窗
- $(document).on('tap', '.icon-guanbi', function() {
- $('.dalog').hide();
- });
- mui('body').on('tap', '.go_cent', function() {
- mui.openWindow({
- url: 'vip-equity.html'
- })
- });
-
-
- // $(document).on('tap', '.coupon_class>ul>li', function() {
- // var couponId = this.getAttribute("couponId");
- // $.ajax(base_path + '/wechat/coupon/receive_coupon_end?dates=' + new Date().getTime(), {
- // data: {
- // "couponId": couponId
- // },
- // dataType: 'json',
- // xhrFields: {
- // withCredentials: true
- // },
- // crossDomain: true,
- // type: 'post',
- // timeout: 15000,
- // success: function(dt) {
- // if(dt.isRedirect) {
- // location.href = dt.redirectURL;
- // } else {
- // if(dt.status) {
- // mui.toast(dt.message);
- // } else {
- // mui.toast(dt.message);
- // }
- // }
- // },
- // error: function(xhr, type, errorThrown) {
- // console.log(xhr);
- // mui.alert("领取失败!网络出小差了", function() {
-
- // });
- // }
- // });
- // });
-
- /**
- *
- */
- var msStartDate = new Date(2019,10,10,00,00,00); //秒杀
- var msEndDate = new Date(2019,10,11,00,00,00); //秒杀结束
- var limitPurchaseDate = new Date(2019,10,11,11,00,00); //限时购
- var limitPurchaseEndDate = new Date(2019,10,11,12,00,00); //限时购-结束
- // var msStartDate = new Date(2019,10,01,15,42,00); //秒杀开始
- // var msEndDate = new Date(2019,10,01,15,43,00); //秒杀结束
- // var limitPurchaseDate = new Date(2019,10,01,15,43,00); //限时购
- function calculatingTime(){
- var jetLag = getJetLag(msStartDate);
- if(jetLag.dateDiff > 0){ //未开始
- $("#sj_01").show();
- $("#ms_01").show();
- $("#sj_01").text(jetLag.allHours+":"+jetLag.minutes+":"+jetLag.seconds)
- }else{
- //已开始
- $("#ms_01").hide();
- $("#sj_01").hide();
-
- var msEndJetLeg = getJetLag(msEndDate);
- if(msEndJetLeg.dateDiff >= 0){ //已开始
- $("#ms_02").show();
- $("#sj_02").show();
- $("#sj_02").text(msEndJetLeg.allHours+":"+msEndJetLeg.minutes+":"+msEndJetLeg.seconds)
- }else{ //一结束
- $("#ms_02").hide();
- $("#ms_03").show();
- $("#sj_02").hide();
- }
- }
-
- var limitPurchaseEndDateJetlag = getJetLag(limitPurchaseEndDate);
- if(limitPurchaseEndDateJetlag.dateDiff < 0){
- $("#xs_01").hide();
- $("#xs_02").hide();
- $("#xs_03").show();
- }else{
- var lPDjetLag = getJetLag(limitPurchaseDate);
- if(lPDjetLag.dateDiff > 0){
- $("#xs_01").show();
- $("#xs_02").hide();
- }else{
- $("#xs_01").hide();
- $("#xs_02").show();
- }
- }
- }
- // $(document).ready(function() {
- // //一秒刷新一次显示时间
- // setInterval(function(){
- // calculatingTime();
- // },1000)
- // })
-
- function getJetLag(scfDate){
- var newdate = new Date();//获取当前时间
- var dateDiff = scfDate.getTime() - newdate;//时间差的毫秒数
- var dayDiff = Math.floor(dateDiff / (24 * 3600 * 1000));//计算出相差天数
- var leave1=dateDiff%(24*3600*1000) //计算天数后剩余的毫秒数
- var hours=Math.floor(leave1/(3600*1000))//计算出小时数
- var allHours = hours + dayDiff*24; //计算总小时数
- //计算相差分钟数
- var leave2=leave1%(3600*1000) //计算小时数后剩余的毫秒数
- var minutes=Math.floor(leave2/(60*1000))//计算相差分钟数
- //计算相差秒数
- var leave3=leave2%(60*1000) //计算分钟数后剩余的毫秒数
- var seconds=Math.round(leave3/1000)
- //console.log("总小时:"+ allHours +";相差天数:"+dayDiff+";小时:"+hours+";分钟"+minutes+";秒数"+seconds);
-
- if(hours < 10){
- hours = "0"+hours;
- }
- if(allHours < 10){
- allHours = "0"+allHours;
- }
- if(minutes < 10){
- minutes = "0"+minutes;
- }
- if(seconds < 10){
- seconds = "0"+seconds;
- }
-
- var jetLag = new Object();
- jetLag.dateDiff = dateDiff;
- jetLag.dayDiff = dayDiff;
- jetLag.hours = hours;
- jetLag.allHours = allHours;
- jetLag.minutes = minutes;
- jetLag.seconds = seconds;
- return jetLag;
- }
- </script>
- </html>
|