?// ec.product = { api: new ec.api("product"), init: function () { ke.ui.render(); //$(".history .list").each(function () { // var el = $(this); // el.css({ width: 244 * el.children().length }); //}); this.getProductPage(); if ($(".product .tab").length > 0) this.tabScroll(); $(".base-model .title").click(function () { var el = $(this); el.toggleClass("ch1"); el.next().slideToggle(); el.find(".ico-add").toggleClass("ico-minus"); }) }, tabScroll: function () { var tabTop = $(".product .tab").offset().top + 64; $(".product .tab li").click(function () { $('html,body').animate({ scrollTop: $('#' + $(this).attr("value")).offset().top - 64 }, 300); }); $(window).scroll(function () { var scrollTop = $(document).scrollTop() + 66; $(".product .tab").toggleClass("flex-top", scrollTop > tabTop); $(".detail").eq(0).css({ "margin-top": scrollTop > tabTop ? "120px" : "56px" }); var item = $(".detail"); var li = $(".product .tab li"); var id; item.each(function () { var m = $(this); var itemsTop = m.offset().top; var preTop = 0; if (id) preTop = $("#" + id).offset().top; if (scrollTop > itemsTop && preTop < itemsTop) { id = m.attr("id"); } }) li.each(function () { var m = $(this); if (m.attr("value") == id) { li.removeClass("fb3 ch1 line4"); m.addClass("fb3 ch1 line4"); } }) }); }, shareUrl: function () { var url = window.location.href; var input = $(".favorite .share"); input.val(url); input.select(); try { if (document.execCommand('copy', false, null)) { document.execCommand("copy"); ec.notify(L.G("已经复制到剪切板")); } else { ec.notify(L.G("复制p|Q您的浏览器不支持,h动复?), "error"); } } catch (err) { ec.notify(L.G("复制p|Q您的浏览器不支持,h动复?), "error"); } }, getProductPage: function () { var isBar = $(".rightbar").length > 0; $(".history .list").each(function () { var el = $(this); var productCount = el.find(".item").length; if (productCount > 0) { var count = 0; if (isBar) count = Math.ceil(productCount / 2); else count = Math.ceil(productCount / 5); var html = ""; for (var i = 0; i < count; i++) { html += ""; } el.parent().next().html(html); if (isBar) el.css({ height: (214 * el.children().length) + (16 * el.children().length) }); else el.css({ width: 244 * el.children().length }); } }); }, pageTurned: function (el) { var index = $(el).index(); $(el).siblings().find(".ico").removeClass("ico-diamond2-hover"); $(el).find(".ico").addClass("ico-diamond2-hover"); var isBar = $(".rightbar").length > 0; if (isBar) $(el).parent().prev().find(".list").stop().animate({ top: -460 * index }, 600); else $(el).parent().prev().find(".list").stop().animate({ left: -1220 * index }, 600); }, coa: function (isTop, num) { var num = isTop ? num : ItemNumber.get(); var lot = isTop ? CoaDown.get() : LotNumber.get(); var msg = ""; if (!num) msg = L.G("误入品编?); else if (!lot) msg = L.G("误入品批?); if (!msg) ec.search.coaDownload(num, lot); else ec.notify(msg, "question", 3000); }, sds: function () { ec.notify(L.G("暂不开?), "question", 3000); //ke.openWindow(L.G("下蝲MSDS"), $("#sdsUrl").val(), 400, 400); }, alter: function (el, mins) { input = $(el).parents(".price .amount").find("input"); var amount = parseInt(input.val()); amount += (mins || 0); amount = (amount >= 0 ? amount : 0); input.val(amount); }, addCart: function (el) { var r = ""; var info = []; var items = $(".price tbody tr"); if (el) items = $(el).parents(".price-box").find("tbody tr"); if (items.find(".nodata").length > 0) { ec.notify(L.G("当前产品没有牌h无法下单Q徏议发送询?), "question", 3000); return; } items.each(function () { var proItem = {}; var num = parseInt($(this).find("input").val()); if (num > 0 && num <= 1000) { proItem.ProductPriceRid = $(this).attr("data-id"); proItem.Amount = num; info.push(proItem); }; }); var callbck = function (r) { ec.product.addCartSuc(r, el); }; if (info.length <= 0) ec.notify(L.G("误?-1000之间的品数?), "question", 3000); else { ec.disable((el ? el : "#btn_cart"), L.G("d?..")); ec.cart.add(info, callbck); } }, addCartSuc: function (r, el) { var amount = 0; var rid = parseInt($("#proRid").attr("value")); var tip = $(".product .info .tip"); var pic = $(".product .info img").attr("src"); var btn = $("#btn_cart"); if (el) { rid = $(el).parents(".price-box").attr("data-rid"); tip = $(el).siblings(".tip"); pic = $(el).parents(".price-box").prev().find(".pic img").attr("src"); btn = $(el); } r.forEach(function (d) { if (rid == d.ProductRID) amount += d.Amount; }); ec.enable((el ? el : "#btn_cart"), L.G("加入购物?)); tip.toggle(amount > 0); ec.notify(L.G("成功d臌物R?)); var offset = $('#toolbar_cart').offset(), flyer = $(''); flyer.fly({ start: { left: btn.offset().left + 62, top: btn.offset().top - $(window).scrollTop() - 36, }, end: { left: offset.left, top: offset.top - $(window).scrollTop(), width: 20, height: 20 } }); }, } ec.productList = { api: new ec.api("product"), classId: "", init: function () { ke.ui.render(); ke.ui.findControls("filter", "input").forEach(function (con) { con.change(function () { ec.productList.filter.getData(1); }); }); var type = ke.parm("filter"); ke.ui.findControls("product_tags", "input").forEach(function (con) { if (con.skin.id == type) { con.click(); ec.productList.filter.getData(1); } }); }, price: { getData: function (el, productNum) { var isShow = $(el).parents("tr").hasClass("active"); if (!isShow) { ec.utilities.loading(); ec.productList.api.get("getPrice?productNum=" + productNum, function (r) { ec.productList.price.render(el, r); }); } else { ec.productList.price.render(el); } }, render: function (el, r) { var item = $(el).parents("tr"); item.toggleClass("active"); var price = item.next(); price.toggleClass("active1").toggle(); item.prev().prev().toggleClass("active2"); $(el).find("span").html(item.hasClass("active") ? L.G("收回") : L.G("h库存")); if (r) { var html = ke.template.get("price_table").render(r); item.next().find(".price").html(html); ec.utilities.unLoading(); } } }, filter: { pn: 1, getData: function (pn, mode) { if (pn) this.pn = pn; ec.utilities.loading(); var url = "/getListData"; if (ec.productList.classId) url += "?classId=" + ec.productList.classId + "&pn=" + pn; else url += "?pn=" + this.pn; if (mode >= 0) url += "&mode=" + mode; var info = ke.createObject("filter"); info.Tags = []; $("#product_tags .input").each(function () { var el = $(this); if (el.hasClass("checkbox-selected")) info.Tags.push(el.attr("id")); }) ec.productList.api.post(url, info, function (r) { ec.productList.filter.render(r); }); }, render: function (r) { ec.utilities.unLoading(); $(".product-data").html(r.dataHtml); $(".ico-array1").toggleClass("ico-array1-hover", r.mode != 2); $(".ico-array2").toggleClass("ico-array2-hover", r.mode == 2); $("#search_total").html(r.Pager.Total); $(".paging a").removeClass("active").eq(r.Pager.PageIndex).addClass("active"); $(".nodata").toggle(r.Pager.Total == 0); $(".paging").toggle(r.Pager.Total > 0); $(".product-data").toggle(r.Pager.Total > 0); this.paging(r.Pager); window.scrollTo(0, 0); }, paging: function (data) { var html = ""; html += ""; for (var i = data.Start; i <= data.End; i++) { html += "" + i + ""; } html += ""; $(".paging").html(html); } }, navToggle: function (el) { $(el).find(".ico10").toggleClass("ico-up10"); $(el).parent().nextAll().slideToggle(); } } $(window.document).ready(function () { _api_error = ec.api.error; ec.api.error = function (req, textStatus) { ec.enable("#btn_cart", L.G("加入购物?)); ec.enable(".action .btn1", L.G("加入购物?)); _api_error(req, textStatus); } }); 精品国产午夜理论片不卡_亚洲欧美人高清精品a∨_丰满人妻一区二区三区视频_奇米影视7777久久