/* 未能缩小。正在返回未缩小的内容。 (709,34-35): run-time error JS1003: Expected ':': , (709,45-46): run-time error JS1003: Expected ':': , (709,54-55): run-time error JS1003: Expected ':': , (709,61-62): run-time error JS1003: Expected ':': , (709,71-72): run-time error JS1003: Expected ':': , (709,83-84): run-time error JS1003: Expected ':': , (709,93-94): run-time error JS1003: Expected ':': , (709,100-101): run-time error JS1003: Expected ':': , (709,105-106): run-time error JS1003: Expected ':': , (709,112-113): run-time error JS1003: Expected ':': } (818,26-27): run-time error JS1003: Expected ':': , (818,37-38): run-time error JS1003: Expected ':': , (818,46-47): run-time error JS1003: Expected ':': , (818,53-54): run-time error JS1003: Expected ':': , (818,65-66): run-time error JS1003: Expected ':': , (818,75-76): run-time error JS1003: Expected ':': , (818,82-83): run-time error JS1003: Expected ':': , (818,87-88): run-time error JS1003: Expected ':': , (818,94-95): run-time error JS1003: Expected ':': } (838,26-27): run-time error JS1003: Expected ':': , (838,37-38): run-time error JS1003: Expected ':': , (838,46-47): run-time error JS1003: Expected ':': , (838,53-54): run-time error JS1003: Expected ':': , (838,65-66): run-time error JS1003: Expected ':': , (838,75-76): run-time error JS1003: Expected ':': , (838,82-83): run-time error JS1003: Expected ':': , (838,87-88): run-time error JS1003: Expected ':': , (838,94-95): run-time error JS1003: Expected ':': } (860,26-27): run-time error JS1003: Expected ':': , (860,37-38): run-time error JS1003: Expected ':': , (860,46-47): run-time error JS1003: Expected ':': , (860,53-54): run-time error JS1003: Expected ':': , (860,63-64): run-time error JS1003: Expected ':': , (860,75-76): run-time error JS1003: Expected ':': , (860,85-86): run-time error JS1003: Expected ':': , (860,92-93): run-time error JS1003: Expected ':': , (860,97-98): run-time error JS1003: Expected ':': , (860,104-105): run-time error JS1003: Expected ':': } */ var WeiXinScripPartial_pagejs = function () { var init = function () { if (isWXvisited()) { $.getScript("https://res.wx.qq.com/open/js/jweixin-1.4.0.js", function () { var title = $('#js-value-Model_Title').val(); var desc = $('#js-value-Model_Description').val(); var link = location.href.split('#')[0]; var url = $('#js-value-Model_ImgUrl').val(); var CdnUrl = $('#js-value-GlobalData_CdnUrl').val(); var imgUrl = ''; if (url != '') { if (url.indexOf(CdnUrl) > -1) { imgUrl = "https:" + url; } else { imgUrl = "https:" + CdnUrl + url; } } else { imgUrl = 'https:' + CdnUrl + '/common/images/default/nopic.png")'; } $.post("/Common/WeiXinShare", { link: link }, function (data) { SetShareScript(data.appid, data.t, data.randomStr, data.sign, title, desc, link, imgUrl); }); }); } //判断是否是微信内访问 function isWXvisited() { var ua = window.navigator.userAgent.toLowerCase(); if (ua.match(/MicroMessenger/i) == 'micromessenger') { return true; } else { return false; } } function SetShareScript(APPID, WxJSAPI_Timestamp, WxJSAPI_Noncestr, WxJSAPI_Signature, title, desc, link, imgUrl) { wx.config({ debug: false, appId: APPID, timestamp: WxJSAPI_Timestamp, nonceStr: WxJSAPI_Noncestr, signature: WxJSAPI_Signature, jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData', 'onMenuShareWeibo'] }); wx.ready(function () { wx.updateAppMessageShareData({ title: title, desc: desc, link: link, imgUrl: imgUrl, success: function () { } }); wx.updateTimelineShareData({ title: title, link: link, imgUrl: imgUrl, success: function () { } }); wx.onMenuShareWeibo({ title: title, desc: desc, link: link, imgUrl: imgUrl, success: function () { }, cancel: function () { } }); }); wx.error(function (res) { }); } } return { init: function () { init(); } }; }(); var zhichi_pagejs = function () { var init = function () { //初始化智齿咨询组件实例 var zhiManager = (getzhiSDKInstance()); //再调用load方法 zhiManager.on("load", function () { zhiManager.initBtnDOM(); }); zhiManager.set('customBtn', 'true'); zhiManager.set('color', '0cb95f'); $(".zhiCustomBtn").click(function () { $.getJSON("/common/GetAccountInfo", function (data) { if (data.code < 0) { window.location.href = "/login.html?referer=https://m" + global_conf.domain+"/chat.html"; } }); }) } return { init: function () { init(); } }; }(); var index_pagejs = function () { var init = function () { $(".js-home-prods").click(function () { $(this).siblings().removeClass("checked"); $(this).addClass("checked"); $(".js-home-prods-detail").hide(); $(".js-home-prods-detail[par='" + $(this).attr("par") + "']").show(); }) var swiper = new Swiper('.home-prods', { slidesPerView: 3.5, paginationClickable: true, spaceBetween: 0, }); //判断是否是微信内访问 function isWXvisited() { var ua = window.navigator.userAgent.toLowerCase(); if (ua.match(/MicroMessenger/i) == 'micromessenger') { return true; } else { return false; } } var a = new Swiper('.home-lecture .swiper-container', { mode: 'vertical', autoplay: true, loop: true, speed: 3000, }); var t = $('#js-t-value').val(); if (t == "cart-1") { var u = navigator.userAgent; var isAndroid = u.toLocaleLowerCase().indexOf('android') > -1 || u.toLocaleLowerCase().indexOf('adr') > -1; //android终端 var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 if (isAndroid) { location.href = "yfw://reactnative.yfw?type=get_shopping_car"; } if (isiOS) { location.href = "yaofangwang://?type=get_shopping_car"; } } //var pageindex = 0; //var isLoading = false; //var isFinished = false; //function Bind_RecomGoods() { // getRecomGoods(); //} //function getRecomGoods() { // if (isFinished) { // return; // } // var h = $("#footer").offset().top - $(window).scrollTop() - $(window).height(); // if (!isLoading && h <= 300) { // isLoading = true; // pageindex++; // $.ajax({ // url: "/common/GetPagerEliteLabelMedicine", // type: "get", // data: { pageindex: pageindex, limit: 10, t: new Date().getTime() }, // success: function (data) { // if (data.code > 0 && data.result.length > 0) { // var temp = ""; // jQuery.each(data.result, function (i, n) { // price = parseFloat(n.price).toFixed(2); // if (!n.intro_image) { // n.intro_image = '/common/images/default/yao_middle.gif'; // } // var name = n.namecn; // if (n.aliascn) { // name = "【" + n.aliascn + '】' + name; // } // temp += ''; // temp += '
'; // temp += '' + name + ''; // temp += '
'; // temp += '
' + name + '
' + n.standard + '
' + price + '
';; // }); // $('#recmmd-wrap').append(temp); // ResizeImg(); // } else { // isFinished = true; // } // }, // complete: function () { // isLoading = false; // } // }); // } // setTimeout(getRecomGoods, 1000); //} //$(function () { // var u = navigator.userAgent; // var isAndroid = u.toLocaleLowerCase().indexOf('android') > -1 || u.toLocaleLowerCase().indexOf('adr') > -1; //android终端 // var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 // if (isAndroid) { // location.href = "yfw://reactnative.yfw"; // } // if (isiOS) { // location.href = "yaofangwang://"; // } //}) } return { init: function () { init(); } }; }(); var FrontLayout_pagejs = function () { var init = function () { var u = navigator.userAgent; var isAndroid = u.toLocaleLowerCase().indexOf('android') > -1 || u.toLocaleLowerCase().indexOf('adr') > -1; //android终端 var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端 //var isVIVOBrowser = u.toLocaleLowerCase().indexOf('vivo') > -1; var isWeiXin = $('#js-isWeiXin').val(); if (isWeiXin == "true") { //$(".bxprive").attr("href", "http://a.app.qq.com/o/simple.jsp?pkgname=com.yaofangwang.mall&ckey=CK1395311302647"); //$(".bxprive").attr("href", "https://m" + $('#jsDomain').val() + "/app/download.html"); //$("#jsappdownurl").val("https://m"+$('#js-isWeiXin').val()+"/app/download.html"); if (isiOS) { $(".bxprive").attr("href", "https://m" + $('#jsDomain').val() + "/app/download.html"); } if (isAndroid) { $(".bxprive").attr("href", "http://a.app.qq.com/o/simple.jsp?pkgname=com.yaofangwang.mall&ckey=CK1395311302647"); } } else { if (isiOS) { //$(".bxprive").attr("datehref", "https://at.umtrack.com/onelink/4HPHXv"); $("#jsappdownurl").val("https://at.umtrack.com/onelink/4HPHXv"); } if (isAndroid) { // $(".bxprive").attr("datehref", "https://at.umtrack.com/onelink/4HPHXv"); $("#jsappdownurl").val("https://at.umtrack.com/onelink/4HPHXv"); } //if (isVIVOBrowser) { // $(".bxprive").attr("href", "market://details?id=com.yaofangwang.mall&th_name=com.yaofangwang.mall"); //} // h5支付页面app下载链接(百度统计监测使用,后面恢复去掉即可) var rawurl = $('#js-requestraw').val(); if (rawurl.indexOf('pay') > 0) { // $(".bxprive").attr("datehref", "https://at.umtrack.com/onelink/D4jSvi"); $("#jsappdownurl").val("https://at.umtrack.com/onelink/D4jSvi"); } if (rawurl.indexOf('detail-') > 0 || rawurl.search('medicine/([0-9]+)/([0-9]+)')>0) { // $(".nowDown .bxprive").attr("datehref", "https://at.umtrack.com/onelink/ma0PTD"); $("#jsappdownurl").val("https://at.umtrack.com/onelink/ma0PTD"); } else if (rawurl.indexOf('medicine-') > 0 || rawurl.search('medicine/([0-9]+)/') > 0) { // $(".nowDown .bxprive").attr("datehref", "https://at.umtrack.com/onelink/eSfK9n"); $("#jsappdownurl").val("https://at.umtrack.com/onelink/eSfK9n"); } else if (rawurl.indexOf('list') > 0) { // $(".nowDown .bxprive").attr("datehref", "https://at.umtrack.com/onelink/Gfieeq"); $("#jsappdownurl").val("https://at.umtrack.com/onelink/Gfieeq"); } else if (rawurl.indexOf('bk') > 0) { // $(".nowDown .bxprive").attr("datehref", "https://at.umtrack.com/onelink/y0fCma"); $("#jsappdownurl").val("https://at.umtrack.com/onelink/y0fCma"); } // h5支付页面app下载链接(百度统计监测使用,后面恢复去掉即可) $(".bxprive").on("click", function () { window.location.href = $("#jsappdownurl").val(); }); } $('.new_quit').on('click', function () { $('#newgift').hide(); $.cookie("newgift", "1", { expires: 1, path: "/", domain: $("#domain").val() }); }) } return { init: function () { init(); } }; }(); var FrontLayout_Askpagejs = function () { var init = function () { //$('a[rel=111]').foxibox();//点击病历图片弹出大图 $(".answer-cont").on("click", function (e) { if (e.target === e.currentTarget) { $(this).fadeOut(); } }) //追问显示框 $(".zw").on("click", function () { var id = $(this).parent().next().val(); $("#hfAskid").val(id); $(".answer-cont").show(); }); //追问内容长度判断 $(".js-ask").on("click", function () { var replyid = $("#hfAskid").val(); var url = $("#hfAskAppendtext").val(); var content = $(this).parent().prev().val(); if ($.trim(content) != "") { if ($.trim(content).length <= 500) { //$("#hfAskContent").val(content); $.post(url, { replyid: replyid, content: content }, function (data) { if (data.code > 0) { window.location.reload(); return; } openInfo(data.msg); }); } else { openInfo("追问内容不能超过500个字符"); } } else { openInfo("请输入追问内容"); } }); //追问输入字符长度提示 $(".strAsk").on("keyup", function () { var length = $(this).val().length; $(this).parent().find("span").text(length + "/500"); }); //采纳 $(".cl").on("click", function () { //$("#hfAskid").val($(this).parent().next().val()); var replyid = $(this).data('replyid'); var url = $("#hfAskAccepttext").val(); $.post(url, { replyid: replyid }, function (data) { if (data.code > 0) { window.location.reload(); return; } alert("操作失败"); }); }); } return { init: function () { init(); } }; }(); var FrontLayout_Yaodianpagejs = function () { var init = function () { $(".pagination").hide(); ResizeImg(); var swiper = new Swiper('.swiper-container', { pagination: '.pagination', slidesPerView: 2.5, paginationClickable: true, spaceBetween: 0, }); $("#shopFavorite").click(function () { var type = ""; var IsFavorit = $("#shopFavorite").attr("para"); var id = $("#js-value-shop_id").val(); $.post("/yaodian/FavoriteStore", { storeid: id, isfavorite: IsFavorit }, function (data) { if (data.code < 0) { openInfo(data.msg); // yb.error(data.msg); } else if (data.code == 1) { $("#shopFavorite").html("取消收藏"); $("#shopFavorite").addClass("select"); msg.success(data.msg); $("#favDiv").addClass("big"); $("#shopFavorite").attr("para", "1"); } else if (data.code == 2) { $("#shopFavorite").html("收藏"); $("#shopFavorite").removeClass("select"); msg.success(data.msg); $("#favDiv").removeClass("big"); $("#shopFavorite").attr("para", "0"); } }) }); $(".CouponBtn").click(function () { var id = $(this).attr("para"); var accountid = $("#js-value-accountid").val(); var Domain = $("#js-value-Domain").val(); if (accountid < 0) { location.href = "//m" + Domain + "/Login.html?Referer=" + encodeURIComponent(location.href); return false; } else { $.post("/common/acceptCoupon", { id: id }, function (data) { if (data.code <= 0) { openInfo(data.msg); return; } else if (data.code > 0) { msg.success("领取成功"); } }) } }) $(".listtitle").hide(); isFavorite(); function isFavorite() { var id = $("#js-value-shop_id").val(); $.post("/yaodian/IsFavorite", { storeid: id }, function (data) { if (data.code > 0) { //已收藏 $("#shopFavorite").html("取消收藏"); $("#shopFavorite").addClass("select"); $("#favDiv").addClass("big"); $("#shopFavorite").attr("para", "1"); } else { $("#shopFavorite").html("收藏"); $("#shopFavorite").removeClass("select"); $("#favDiv").removeClass("big"); $("#shopFavorite").attr("para", "0"); } }) } } return { init: function () { init(); } }; }(); var FrontLayout_Searchpagejs = function () { var init = function () { //js刷新价格的函数,现在不使用 //GetCurrentPriceByMids(); $(".js-need-clickhref").click(function () { var e = e || window.event e.preventDefault() var href = $(this).attr("href"); window.location.href = href; }) $("#catalog h5").click(function () { if ($(this).parent().hasClass("hover")) { $(this).parent().removeClass("hover"); } else { $(this).parent().addClass("hover"); } }) $(".ckdiv .ra").click(function () { window.location.href = $(this).next().attr("href"); }) $(".sitems .plus").toggle(function () { $(this).removeClass("plus").addClass("sub"); $(this).next().removeClass("more"); $(this).find("label").text("收起"); }, function () { $(this).removeClass("sub").addClass("plus"); $(this).next().addClass("more"); $(this).find("label").text("展开"); }); $(".js-more").click(function () { $(this).closest('p').hide(); $(this).closest('p').next().show(); }); function GetCurrentPriceByMids() { var medicineIds = ""; jQuery.each($(".medicineInfo"), function (i, n) { if ($(n).attr("rel") != null && $(n).attr("rel") != "") { medicineIds += $(n).attr("rel") + ","; } }); medicineIds = medicineIds.substring(0, medicineIds.length - 1); if (medicineIds != "") { $.post("/category/getcurrentprice", { medicineIds: medicineIds }, function (data) { if (data.code > 0) { jQuery.each(data.JSON, function (i, n) { var str = "
" + n.price_desc + "
"; if (n.price_desc == "" || n.price_desc == null) { str = ""; } if (n.price_min > 0 && n.price_min != null) { $(".medicineInfo[rel='" + n.id + "'] .money").html("¥" + parseFloat(n.price_min).toFixed(2) + " 起" + str); } else { $(".medicineInfo[rel='" + n.id + "'] .money").html("暂无报价"); } $(".medicineInfo[rel='" + n.id + "'] .js-salesCount").html(n.shop_num); }) return; } //yb.error(data.msg); }); } } $('.js-filter .bg').on('click', function (e) { $('.js-filter').hide(); }) // 重置 $(".js-filter .reset").on('click', function () { $('.js-filter').find('.checked').removeClass('checked') }) function getUrlParams(param) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); if (pair[0] == param) { return pair[1]; } } return (false); } $(".js-filter .confirm").on('click', function () { var alica = [] var mill = [] var standard = [] var list = $('.js-filter .js-allSort').find('a.checked') //console.log(list) if (list.length == 0) { list = $('.js-filter .js-simpSort .list').find('a.checked') } list.each(function (i, e) { if ($(e).attr('utype') === 'shop1') { alica.push($(e).attr('uid')) } else if ($(e).attr('utype') === 'shop3') { standard.push($(e).attr('uid')) } else { mill.push($(e).attr('uid')) } }) var urlstr = location.href; var keyword = $("#js-value-Request-keyword").val(); /* var wz = getUrlParams("wz"); wz = wz == undefined ? "" : wz; var asFlg = getUrlParams("as"); asFlg = asFlg == undefined ? "" : asFlg; var sort = getUrlParams("sort"); wz = wz == undefined ? "" : wz; var sorttype = getUrlParams("sorttype"); wz = wz == undefined ? "" : wz;*/ urlstr = location.origin + "/search.html?keyword=" + keyword + "&aliascn=" + alica.toString() + "&title=" + mill.toString() + "&standard=" + standard.toString(); //+ "&wz=" + wz + "&asflg=" + asFlg + "&sort=" + sort + "&sorttype=" + sorttype; //if (urlstr.indexOf("?") < 0) { // urlstr = location.origin + location.pathname+ "?rewrite=1" + "&aliascn=" + alica.toString() + "&millid=" + mill.toString(); //} else { // urlstr = location.origin + location.pathname + "&" + "aliascn=" + alica.toString() + "&millid=" + mill.toString(); //} window.location.href = urlstr; }) // 确定 // 双向绑定 $(".js-filter .js-simpSort").on('click', 'a', function () { if (!$(this).hasClass('all')) { $(this).toggleClass('checked') } var classname = $(this).hasClass('checked') var utype = $(this).attr('utype') var uid = $(this).attr('uid') var tarA = null if (!utype || !uid) { //console.log('qwe') return } tarA = $(".js-filter .js-allSort").find('a[utype=' + utype + '][uid=\"' + uid + '\"]') classname ? tarA.addClass('checked') : tarA.removeClass('checked') }) // 双向绑定 $(".js-filter .js-allSort").on('click', 'a', function () { $(this).toggleClass('checked') var classname = $(this).hasClass('checked') var utype = $(this).attr('utype') var uid = $(this).attr('uid') var tarA = null if (!utype || !uid) { //console.log('qwe') return } tarA = $(".js-filter .js-simpSort").find('a[utype=' + utype + '][uid=\"' + uid + '\"]') classname ? tarA.addClass('checked') : tarA.removeClass('checked') }) // 后退 $(".js-filter .h2 .back").on('click', function () { $(this).parents('.js-allSort').hide() $('.js-simpSort').show() }) // 切换 $('.js-filter .all').on('click', function () { var utype = $(this).attr('utype'); var keyword = $("#js-value-keyword").val(); var keywordid = $("#js-value-keywordid").val(); var aliascn = $("#js-value-AliasCNCode").val(); var title = $("#js-value-MillCode").val(); var standard = $("#js-value-StandardCode").val(); var trochetype = $("#js-value-TrocheTypeCode").val(); var sorttype = $("#js-value-SortTypeCode").val(); var price = $("#js-value-PriceCode").val(); if ($(this).hasClass("search")) { if (utype === "shop1") { var uidattr = $('a.checked[utype="shop1"]:eq(0)'); if (uidattr !== '' && uidattr !== undefined) { var uid = uidattr.attr("uid"); if (uid !== '') { $('.js-allSort[utype="shop1"] a[uid=\"' + uid + '\"]').addClass("checked"); } } } else if (utype === "shop3") { var uid3attr = $('a.checked[utype="shop3"]:eq(0)'); if (uid3attr !== '' && uid3attr !== undefined) { var uid3 = uid3attr.attr("uid"); if (uid3 !== '') { $('.js-allSort[utype="shop2"] a[uid=\"' + uid3 + '\"]').addClass("checked"); } } } else { var uid2attr = $('a.checked[utype="shop2"]:eq(0)'); if (uid2attr !== '' && uid2attr !== undefined) { var uid2 = uid2attr.attr("uid"); if (uid2 !== '') { $('.js-allSort[utype="shop2"] a[uid=\"' + uid2 + '\"]').addClass("checked"); } } } clickname(); $(this).parents('.js-simpSort').hide(); $('.js-allSort').hide(); $('.js-allSort[utype=' + utype + ']').show(); return; } var top = "60"; var type = "new"; //加载第二层的数据 var postname = ""; if (utype == "shop1") { postname = "getSearchAliascn"; } else if ((utype == "shop3")) { postname = "getSearchStandard"; } else { postname = "getSearchTitleAbb"; } var listh3 = null; if (utype == "shop3") { listh3 = $('.js-allSort[utype=' + utype + '] .list2 .list3'); } else { listh3 = $('.js-allSort[utype=' + utype + '] .list2 .h3'); } if (listh3.length > 0) { } else { $.post("/medicine/" + postname + "", { keyword, keywordid, aliascn, title, standard, trochetype, sorttype, price, top, type }, function (data) { if (data.code < 0) { } else { var list = data.result; for (var i in list) { if (utype == "shop3") { if ($('.js-allSort[utype=' + utype + '] .list2').find('.list3').length == 0) { $('.js-allSort[utype=' + utype + '] .list2').append("
"); } } else { $('.js-allSort[utype=' + utype + '] .list2').append("
" + i + "" + i + "
"); } var nlist = list[i]; if (utype == "shop1") { for (let n of nlist) { var old = $(".js-filter .js-simpSort").find('a[utype=' + utype + '][uid=' + n + ']').hasClass('checked'); $('.h3[data-key=' + i + '][utype=' + utype + ']').next('.list3').append("" + n + "") } } else if (utype == "shop3") { var old = $(".js-filter .js-simpSort").find('a[utype=' + utype + '][uid=\"' + nlist + '\"]').hasClass('checked'); $('.js-allSort[utype=' + utype + '] .list2 .list3').append("" + nlist + ""); //for (var n of nlist) { //var old = $(".js-filter .js-simpSort").find('a[utype=' + utype + '][uid=' + n + ']').hasClass('checked'); //$('.h3[data-key=' + i + '][utype=' + utype + ']').next('.list3').append("" + n + "") //} } else { for (let n of nlist) { var old = $(".js-filter .js-simpSort").find('a[utype=' + utype + '][uid=' + n + ']').hasClass('checked'); $('.h3[data-key=' + i + '][utype=' + utype + ']').next('.list3').append("" + n + "") } } if (utype != "shop3") { $('.js-allSort[utype=' + utype + '] .num-sort').append("" + i + ""); } } } clickname(); }); } $(this).parents('.js-simpSort').hide(); $('.js-allSort').hide(); $('.js-allSort[utype=' + utype + ']').show(); }) // 跳转 $('.js-filter .num-sort').on('click', 'span', function () { var tar = $(this).text() var utype = $(this).attr('utype') var h2 = $('.js-filter .h2') var h3 = $('.js-filter .list2').find('.h3') var top = $('.js-filter .list2').scrollTop() var header = h2.height() h3.each(function (i, e) { if (tar === $(e).attr('data-key') && utype === $(e).attr('utype')) { $('.js-filter .list2').animate({ scrollTop: top + $(e).position().top - header }) } }) }) $('.js-filter .list2').on('scroll', function () { scrollHeader() }) function scrollHeader() { var h2 = $('.js-filter .h2') var header = h2.height() var h3 = $('.js-filter .list2').find('.h3') h3.each(function (i, e) { if (h3.eq(i).position().top < header + h3.eq(i).height() / 2) { h3.eq(i).find('span').show() .css({ top: header }) } else { h3.eq(i).find('span').hide() } }) } $('#openfilterbtn').click(function () { if ($(this).hasClass("search")) { clickname(); $('.js-filter').show(); return; } openfilter(); }); function openfilter() { // 打开第一层筛选 // 填充第一层的数据 var keyword = $("#js-value-keyword").val(); var keywordid = $("#js-value-keywordid").val(); var aliascn = $("#js-value-AliasCNCode").val(); var title = $("#js-value-MillCode").val(); var standard = $("#js-value-StandardCode").val(); var trochetype = $("#js-value-TrocheTypeCode").val(); var sorttype = $("#js-value-SortTypeCode").val(); var price = $("#js-value-PriceCode").val(); var top = 8; var type = "old"; $.post("/medicine/getSearchAliascn", { keyword, keywordid, aliascn, title, trochetype, sorttype, price, top, type }, function (data) { if (data.code < 0) { } else { var list = data.result; for (let i of list) { var old = $('.all[utype="shop1"]').prevAll('[uid=' + i + ']'); if (old.length == 0) { $('.all[utype="shop1"]').before( "" + (i.length > 4 ? i.substring(0, 4) + "..." : i) + ""); } } clickname(); } }); $.post("/medicine/getSearchTitleAbb", { keyword, keywordid, aliascn, title, trochetype, sorttype, price, top, type }, function (data) { if (data.code < 0) { } else { var list = data.result; for (let i of list) { var old = $('.all[utype="shop2"]').prevAll('[uid=' + i + ']'); if (old.length == 0) { $('.all[utype="shop2"]').before( "" + (i.length > 4 ? i.substring(0, 4) + "..." : i) + ""); } } clickname(); } }); $.post("/medicine/getSearchStandard", { keyword, keywordid, aliascn, title, standard, trochetype, sorttype, price, top, type }, function (data) { if (data.code < 0) { } else { var list = data.result; for (let i of list) { var old = $('.all[utype="shop3"]').prevAll('[uid=\"' + i + '\"]'); if (old.length == 0) { $('.all[utype="shop3"]').before( "" + (i.length > 12 ? i.substring(0, 12) + "..." : i) + ""); } } clickname(); } }); $('.js-filter').show() } clickname(); function clickname() { var aliascn = $("#js-value-Aliases_click").val(); var mill = $("#js-value-Mills_click").val(); var standard = $("#js-value-Standards_click").val(); if (aliascn != "") { var aliascnstr = aliascn.split(",") for (var str in aliascnstr) { tarA = $(".js-filter .js-simpSort").find('a[utype=' + 'shop1' + '][uid=' + aliascnstr[str].toString() + ']') tarA.addClass('checked') tarB = $(".js-filter .js-allSort").find('a[utype=' + 'shop1' + '][uid=' + aliascnstr[str].toString() + ']') tarB.addClass('checked') } } if (mill != "") { var mill = mill.split(",") for (var str in mill) { //tarA = $(".js-filter .js-simpSort").find('a[utype=' + 'shop2' + '][uid=' + mill[str].toString() + ']') //tarA.addClass('checked') //tarB = $(".js-filter .js-allSort").find('a[utype=' + 'shop2' + '][uid=' + mill[str].toString() + ']') //tarB.addClass('checked') $('.js-simpSort a[utype="shop2"][uid=\"' + mill[str].toString() + '\"]').addClass("checked"); $('.js-allSort[utype="shop2"] a[uid=\"' + mill[str].toString() + '\"]').addClass("checked"); } } if (standard != "") { var standardstr = standard.split(",") for (var str in standardstr) { tarA = $(".js-filter .js-simpSort").find('a[utype=' + 'shop3' + '][uid=\"' + standardstr[str].toString() + '\"]') tarA.addClass('checked') tarB = $(".js-filter .js-allSort").find('a[utype=' + 'shop3' + '][uid=\"' + standardstr[str].toString() + '\"]') tarB.addClass('checked') } } } $(function () { $.fn.remove = function (obj, item) { $(".stand_list").addClass("stand_none"); $(obj).removeClass("special_green").addClass("special_end") $(obj).children(".arrow_gc").removeClass("arrow_green").addClass("arrow_end"); $(".stand_full").addClass("stand_none"); $(window).scrollTop(top); $('body').removeClass("addFixed") } $(".nav_special").on('click', function () { if ($(".stand_list").hasClass("stand_none")) { $(this).addClass("special_green").removeClass("special_end"); $(this).children(".arrow_gc").removeClass("arrow_hei").removeClass("arrow_end").addClass("arrow_green"); $(".stand_list").removeClass("stand_none"); $(".stand_full").removeClass("stand_none"); top = $(window).scrollTop(); $('body').css('top', -top + "px"); $('body').addClass("addFixed") } else { $(".nav_special").remove(".nav_special", "arrow_hei"); } }); $(".base_sure").click(function () { $(".nav_special").remove(".nav_special", "arrow_end"); $(".nav_special").addClass("special_end"); }); }) $(function () { $(".stand_pro li").on('click', function () { var values = []; var checked = $(".stand_pro input:checked").length; var selData = $(".stand_pro").find("input"); for (var i = 0; i < selData.length; i++) { if (selData[i].checked) { values.push(selData[i].value); $(this).addClass('gg_pitch').siblings().removeClass('gg_pitch') } } if (checked == 0) { $(".special_text").text("选择规格") } else { $(".special_text").text(values.join(",")) } }) }) $(function () { $(".base_reset").click(function () { var stand_check = $(".stand_pro input"); stand_check.prop("checked", false); $(".stand_pro li").removeClass("gg_pitch"); $(".special_text").text("选择规格") }) }) $(function () { $(".inq_small").on("click", function () { $(this).addClass("inq_none"); $(".qd_cf").removeClass("inq_none") }); $(".qd_cf").on("click", function () { $(this).addClass("inq_none"); $(".inq_small").removeClass("inq_none") }) }) $(function () { $('.js_add_inquirycart').on("click", function () { event.preventDefault(); var mid = $(this).data("medicineid"); AddInquiryCart(mid, 1, ""); }) }) InquiryCartCount(); } return { init: function () { init(); } }; }(); var FrontLayout_CategoryListpagejs = function () { var init = function () { GetCurrentPriceByMids(); ResizeImg(); $("#expAll").click(function () { if ($(this).text().indexOf("展开") >= 0) { $(".catouter .cat").css("height", "auto"); $(this).html("收起分类 ↑"); } else { $(".catouter .cat").css("height", ""); $(this).html("展开全部分类 ↓"); } }); $("#showtype").blur(function () { //if ($.cookie("showtype") == "null" || $.cookie("showtype") == null || $.cookie("showtype") == "list") { // showtype = "grid"; //} var showtype = $('showtype').attr('param'); //$.cookie("showtype", showtype, { expires: 30, path: "/", domain: "@(GlobalData.FormsCookieDomain)" }); var urlstr = location.href; if (urlstr.indexOf("rewrite=1") < 0) { if (urlstr.indexOf("?") < 0) { location.href = location.href + "?show_type=" + showtype; } else { if (urlstr.indexOf("show_type") < 0) { location.href = location.href + "&show_type=" + showtype; } else { location.href = location.href.replace("show_type=list", "show_type=" + showtype) location.href = location.href.replace("show_type=grid", "show_type=" + showtype) } } } else { location.href = location.href.replace("?rewrite=1", "?") if (urlstr.indexOf("show_type") < 0) { location.href = location.href + "&show_type=" + showtype; } else { location.href = location.href.replace("show_type=list", "show_type=" + showtype) location.href = location.href.replace("show_type=grid", "show_type=" + showtype) } } location.reload(); }); function GetCurrentPriceByMids() { var medicineIds = ""; jQuery.each($(".medicineInfo"), function (i, n) { if ($(n).attr("rel") != null && $(n).attr("rel") != "") { medicineIds += $(n).attr("rel") + ","; } }); medicineIds = medicineIds.substring(0, medicineIds.length - 1); if (medicineIds != "") { $.post("/category/getcurrentprice", { medicineIds: medicineIds }, function (data) { if (data.code > 0) { jQuery.each(data.JSON, function (i, n) { var str = "
" + n.price_desc + "
"; if (n.price_desc == "" || n.price_desc == null) { str = ""; } if (n.price_min > 0 && n.price_min != null) { $(".medicineInfo[rel='" + n.id + "'] .money") .html("¥" + parseFloat(n.price_min).toFixed(2) + " 起" + str); } else { $(".medicineInfo[rel='" + n.id + "'] .money") .html("暂无报价"); } $(".medicineInfo[rel='" + n.id + "'] .js-salesCount").html(n.shop_num); }) return; } //yb.error(data.msg); }); } } $('.js-filter .bg').on('click', function (e) { $('.js-filter').hide(); }) // 重置 $(".js-filter .reset").on('click', function () { $('.js-filter').find('.checked').removeClass('checked') }) $(".js-filter .confirm").on('click', function () { var alica = [] var mill = [] var list = $('.js-filter .js-allSort').find('a.checked') //console.log(list) if (list.length == 0) { list = $('.js-filter .js-simpSort .list').find('a.checked') } list.each(function (i, e) { if ($(e).attr('utype') === 'shop1') { alica.push(+$(e).attr('uid')) } else { mill.push(+$(e).attr('uid')) } }) var urlstr = location.href; urlstr = location.origin + location.pathname + "?rewrite=1" + "&aliascn=" + alica.toString() + "&millid=" + mill.toString(); //if (urlstr.indexOf("?") < 0) { // urlstr = location.origin + location.pathname+ "?rewrite=1" + "&aliascn=" + alica.toString() + "&millid=" + mill.toString(); //} else { // urlstr = location.origin + location.pathname + "&" + "aliascn=" + alica.toString() + "&millid=" + mill.toString(); //} window.location.href = urlstr; }) // 确定 // 双向绑定 $(".js-filter .js-simpSort").on('click', 'a', function () { //if (!$(this).hasClass('all')) { // $(this).toggleClass('checked') //} $(this).addClass('checked').siblings().removeClass('checked') var classname = $(this).hasClass('checked') var utype = $(this).attr('utype') var uid = $(this).attr('uid') var tarA = null if (!utype || !uid) { //console.log('找不到绑定数据') return } tarA = $(".js-filter .js-allSort").find('a[utype=' + utype + '][uid=' + uid + ']') classname ? tarA.addClass('checked').siblings().removeClass('checked') : tarA.removeClass('checked') }) // 双向绑定 $(".js-filter .js-allSort").on('click', 'a', function () { //$(this).toggleClass('checked'); $(".js-filter .js-allSort a").removeClass('checked') $(this).addClass('checked') var classname = $(this).hasClass('checked') var utype = $(this).attr('utype') var uid = $(this).attr('uid') var tarA = null if (!utype || !uid) { //console.log('找不到绑定数据') return } tarA = $(".js-filter .js-simpSort").find('a[utype=' + utype + '][uid=' + uid + ']') classname ? tarA.addClass('checked').siblings().removeClass('checked') : tarA.removeClass('checked') }) // 后退 $(".js-filter .h2 .back").on('click', function () { $(this).parents('.js-allSort').hide() $('.js-simpSort').show() }) // 切换 $('.js-filter .all').on('click', function () { var utype = $(this).attr('utype') var id = $('#txt_id').val(); var postname = ""; if (utype == "shop1") { postname = "getTopAliasCNforh5"; } else { postname = "getTopMillsforh5"; } //加载第二层的数据 var listh3 = $('.js-allSort[utype=' + utype + '] .list2 .h3'); if (listh3.length > 0) { } else { $.post("/category/" + postname + "", { id: id }, function (data) { if (data.code < 0) { } else { var list = data.result; for (var i in list) { $('.js-allSort[utype=' + utype + '] .list2').append("
" + i + "" + i + "
"); var nlist = list[i]; if (utype == "shop1") { for (let n of nlist) { var old = $(".js-filter .js-simpSort").find('a[utype=' + utype + '][uid=' + n.id + ']').hasClass('checked'); $('.h3[data-key=' + i + '][utype=' + utype + ']').next('.list3').append("" + n.aliascn + "") } } else { for (let n of nlist) { var old = $(".js-filter .js-simpSort").find('a[utype=' + utype + '][uid=' + n.id + ']').hasClass('checked'); $('.h3[data-key=' + i + '][utype=' + utype + ']').next('.list3').append("" + n.title + "") } } $('.js-allSort[utype=' + utype + '] .num-sort').append("" + i + ""); } } clickname(); }); } $(this).parents('.js-simpSort').hide() $('.js-allSort').hide() $('.js-allSort[utype=' + utype + ']').show() }) // 跳转 $('.js-filter .num-sort').on('click', 'span', function () { var tar = $(this).text() var utype = $(this).attr('utype') var h2 = $('.js-filter .h2') var h3 = $('.js-filter .list2').find('.h3') var top = $('.js-filter .list2').scrollTop() var header = h2.height() h3.each(function (i, e) { if (tar === $(e).attr('data-key') && utype === $(e).attr('utype')) { $('.js-filter .list2').animate({ scrollTop: top + $(e).position().top - header }) } }) }) $('.js-filter .list2').on('scroll', function () { scrollHeader() }) function scrollHeader() { var h2 = $('.js-filter .h2') var header = h2.height() var h3 = $('.js-filter .list2').find('.h3') h3.each(function (i, e) { if (h3.eq(i).position().top < header + h3.eq(i).height() / 2) { h3.eq(i).find('span').show() .css({ top: header }) } else { h3.eq(i).find('span').hide() } }) } $('#openfilterbtn').click(function () { if ($(this).hasClass("search")) { clickname(); $('.js-filter').show(); return; } openfilter(); }); function openfilter() { // 打开第一层筛选 // 填充第一层的数据 var id = $('#txt_id').val(); $.post("/category/getTopAliasCN", { id: id }, function (data) { if (data.code < 0) { } else { var list = data.result; for (let i of list) { var aliascn = i.aliascn; var id = i.id; var old = $('.all[utype="shop1"]').prevAll('[uid=' + id + ']'); if (old.length == 0) { $('.all[utype="shop1"]').before( "" + (aliascn.length > 4 ? aliascn.substring(0, 4) + "..." : aliascn) + ""); } } clickname(); } }); $.post("/category/getTopMills", { id: id }, function (data) { if (data.code < 0) { } else { var list = data.result; for (let i of list) { var aliascn = i.title; var id = i.id; var old = $('.all[utype="shop2"]').prevAll('[uid=' + id + ']'); if (old.length == 0) { $('.all[utype="shop2"]').before( "" + (aliascn.length > 4 ? aliascn.substring(0, 4) + "..." : aliascn) + ""); } } } clickname(); }); $('.js-filter').show() } clickname(); function clickname() { var aliascn = $("#js-value-Aliases_click").val(); var mill = $("#js-value-Mills_click").val(); if (aliascn != "") { var aliascnstr = aliascn.split(",") for (var str in aliascnstr) { tarA = $(".js-filter .js-simpSort") .find('a[utype=' + 'shop1' + '][uid=' + aliascnstr[str].toString() + ']') tarA.addClass('checked') tarB = $(".js-filter .js-allSort") .find('a[utype=' + 'shop1' + '][uid=' + aliascnstr[str].toString() + ']') tarB.addClass('checked') } } if (mill != "") { var mill = mill.split(",") for (var str in mill) { tarA = $(".js-filter .js-simpSort") .find('a[utype=' + 'shop2' + '][uid=' + mill[str].toString() + ']') tarA.addClass('checked') tarB = $(".js-filter .js-allSort") .find('a[utype=' + 'shop2' + '][uid=' + mill[str].toString() + ']') tarB.addClass('checked') } } } $(function () { $(".inq_small").on("click", function () { $(this).addClass("inq_none"); $(".qd_cf").removeClass("inq_none") }); $(".qd_cf").on("click", function () { $(this).addClass("inq_none"); $(".inq_small").removeClass("inq_none") }) }) $(function () { $('.js_add_inquirycart').on("click", function () { event.preventDefault(); var mid = $(this).data("medicineid"); AddInquiryCart(mid, 1, ""); }) }) InquiryCartCount(); } return { init: function () { init(); } }; }(); var FrontLayout_InquiryDetailpagejs = function () { var init = function () { $("#addCart").click(function () { var buy = $("#js-value-button_show").val().toLocaleLowerCase(); if (buy == "false") { openTip("暂不销售", data.msg, ""); return false; } var obj = $(".js-buy-medicine-id.checked"); var mid = obj.attr("mid"); //var packageid = obj.attr("packageid"); var par = $(this).attr("par"); var qty = $("#quantity").val(); AddInquiryCart(mid, qty, par); }) var reduceNumInterval = 0; //$(document).ready(function () { // $("#addFav").click(function () { // var mid = $('#js-value-Model_medicine_info_id').val(); // var shopid = $('#js-value-shopInfo_shop_id').val(); // if ($(this).hasClass("cur")) { // Favorite(mid, shopid, 0, 1); // } else { // Favorite(mid, shopid, 0, 0); // } // }); //}); } return { init: function () { init(); } }; }(); var FrontLayout_Detailpagejs = function () { var init = function () { //点击立即购买按钮 //$("#addCart_before").click(function () { // var period = $("#js-value-period-show").val().toLocaleLowerCase(); // if (period == "2") { // $("#near_period_add").show(); // } else { // //$("#addCart").click(); // } //}) $("#addCart").click(function () { $.post("/manage/account/isCertification", function (d) { if (d.code == -999) { redirctLogin(); return; } else if (d.code == -1) { $("#certification").show(); } else { var par = $("#addCart").attr("par"); var obj = $(".js-buy-medicine-id.active"); var smid = obj.attr("smid"); var packageid = obj.attr("packageid"); var qty = $("#quantity").val(); var isneed_rx = $("#isneed_rx").val(); /*if (par == 1) { location.href = "/settle/confirm?top_referrer=/medicine/623059/&store_medicineid=" + smid; 后期在修改 } else {*/ var buy = $("#js-value-button_show").val().toLocaleLowerCase(); if (buy == "false") { openTip("暂不销售", data.msg, ""); return false; } if (isneed_rx != null && isneed_rx != undefined && isneed_rx == 1) AddCart3(smid, qty, '', '', isneed_rx); else AddCart(smid, qty, par, packageid); } /* }*/ }); //----------------原代码 //var buy = $("#js-value-button_show").val().toLocaleLowerCase(); //if (buy == "false") { // openTip("暂不销售", data.msg, ""); // return false; //} //var obj = $(".js-buy-medicine-id.checked"); //var smid = obj.attr("smid"); //var packageid = obj.attr("packageid"); //var par = $(this).attr("par"); //var qty = $("#quantity").val(); //AddCart(smid, qty, par, packageid); }) var reduceNumInterval = 0; $(document).ready(function () { $("#addFav").click(function () { var mid = $('#js-value-Model_medicine_info_id').val(); var shopid = $('#js-value-shopInfo_shop_id').val(); if ($(this).hasClass("cur")) { Favorite(mid, shopid, 0, 1); } else { Favorite(mid, shopid, 0, 0); } }); }); // 返场倒计时 $(function () { var promotion_type = $('#promotion_type').val(); var promotion_prom_cd = $('#promotion_prom_cd').val(); if (promotion_type == "2" || promotion_type == "3") { if (promotion_prom_cd > 0) { TimeDown("prom_cd", promotion_prom_cd); } } }); function TimeDown(id, value) { var totalSeconds = parseInt(value / 1000); var modulo = totalSeconds; var hours = Math.floor(modulo / (60 * 60)); modulo = modulo % (60 * 60); var minutes = Math.floor(modulo / 60); var seconds = modulo % 60; hours = hours.toString().length == 1 ? '0' + hours : hours; minutes = minutes.toString().length == 1 ? '0' + minutes : minutes; seconds = seconds.toString().length == 1 ? '0' + seconds : seconds; document.getElementById(id).innerHTML = hours + ":" + minutes + ":" + seconds; if (hours == "00" && minutes == "00" && parseInt(seconds) - 1 < 0) { } else { setTimeout(function () { TimeDown(id, value - 1000); }, 1000) } } } return { init: function () { init(); } }; }(); var FrontLayout_Categoryspagejs = function () { var init = function () { ResizeImg(".prod img"); var myScroll = new IScroll('#optlist .left', { mouseWheel: true, click: false }); var myScroll2 = new IScroll('#optlist2 .left', { mouseWheel: true, click: false }); var myScroll3 = new IScroll('#optlist3 .left', { mouseWheel: true, click: false }); $(".bg-opcDDDD").on("click", function () { $(".js-opt .item a").each(function () { var tg = $(this).data("target"); $(tg).addClass("noshow"); $(".bg-opcDDDD").addClass("noshow"); $(this).removeClass("checked"); }); }) $(".js-opt .item a").on("click", function () { var tg = $(this).data("target"); if ($(this).hasClass("checked")) { $(tg).addClass("noshow"); $(".bg-opcDDDD").addClass("noshow"); $(this).removeClass("checked"); return; } $(this).addClass("checked"); $(".bg-opcDDDD").removeClass("noshow"); $(tg).removeClass("noshow"); $(this).parent().siblings().find("a").removeClass("checked").each(function () { $($(this).data("target")).addClass("noshow"); }) }); } return { init: function () { init(); } }; }(); var FrontLayout_AvgPricepagejs = function () { var init = function () { var time1 = $("#js-value-time1").val().replace(/'/g, "").split(','); var time2 = $("#js-value-time2").val().replace(/'/g, "").split(','); var time3 = $("#js-value-time3").val().replace(/'/g, "").split(','); var price1 = $("#js-value-price1").val().replace(/'/g, "").split(','); var price2 = $("#js-value-price2").val().replace(/'/g, "").split(','); var price3 = $("#js-value-price3").val().replace(/'/g, "").split(','); // 基于准备好的dom,初始化echarts实例 var myChart = echarts.init(document.getElementById('pircetrend')); // 指定图表的配置项和数据 var option = { 1: { grid: { top: '10%', left: '10%', right: '10%', bottom: '10%' }, tooltip: { trigger: 'axis', }, xAxis: { axisTick: { show: false }, axisLabel: { textStyle: { fontSize: '10' }, interval: 0 }, // 两边贴合 boundaryGap: false, type: 'category', data: time1 }, yAxis: { axisTick: { show: false }, type: 'value', boundaryGap: ['20%', '20%'], scale: true }, series: [{ name: '平均成交价格', data: price1, type: 'line', itemStyle: { normal: { color: '#1fdb9b' } } }] }, 2: { grid: { top: '10%', left: '10%', right: '10%', bottom: '10%' }, tooltip: { trigger: 'axis', }, xAxis: { axisTick: { show: false }, axisLabel: { textStyle: { fontSize: '10' }, interval: 0 }, // 两边贴合 boundaryGap: false, type: 'category', data: time2 }, yAxis: { axisTick: { show: false }, type: 'value', boundaryGap: ['20%', '20%'], scale: true }, series: [{ name: '平均成交价格', data: price2, type: 'line', itemStyle: { normal: { color: '#1fdb9b' } } }] }, 3: { grid: { top: '10%', left: '10%', right: '10%', bottom: '10%' }, tooltip: { trigger: 'axis', }, xAxis: { axisTick: { show: false }, axisLabel: { textStyle: { fontSize: '10' }, interval: 0 }, // 两边贴合 boundaryGap: false, type: 'category', data: time3 }, yAxis: { axisTick: { show: false }, type: 'value', boundaryGap: ['20%', '20%'], scale: true }, series: [{ name: '平均成交价格', data: price3, type: 'line', itemStyle: { normal: { color: '#1fdb9b' } } }] }, } // 使用刚指定的配置项和数据显示图表。 myChart.setOption(option[1]); $('.pircetrend-card .interval .btn').on('click', function () { if ($(this).hasClass('on')) return; var index = +$(this).attr('data-index'); $(this).addClass('on').siblings().removeClass('on'); myChart.setOption(option[index]) }) } return { init: function () { init(); } }; }(); var FrontLayout_JiBingpagejs = function () { var init = function () { $("#expAll").click(function () { if ($(this).text().indexOf("展开") >= 0) { $(".catouter .cat").css("height", "auto"); $(this).html("收起分类 ↑"); } else { $(".catouter .cat").css("height", ""); $(this).html("展开全部分类 ↓"); } }); } return { init: function () { init(); } }; }(); var FrontLayout_Pricepagejs = function () { var init = function () { $('.drugs__nav .open').on('click', function () { var $parents = $(this).parents('.drugs__nav') var $that = $(this) if ($parents.hasClass('on')) { $parents.removeClass('on') $that.text('展开') } else { $parents.addClass('on') $that.text('收起') } }) } return { init: function () { init(); } }; }();;