var id = S.one("#btn-buy").attr("pid"); KISSY.ready(function (a) { var b = a.all("#j_books li"); b.each(function (c) { c.on("mouseover", function () { b.removeClass("selected"); a.one(this).addClass("selected") }) }); var c = a.all("#j_books1 li"); c.each(function (b) { b.on("mouseover", function () { c.removeClass("selected"); a.one(this).addClass("selected") }) }); 6 === a.UA.ie && (a.all(".property").on("mouseenter", function () { a.one(this).addClass("propertyhover") }), a.all(".property").on("mouseleave", function () { a.one(this).removeClass("propertyhover") })); KISSY.use("node,overlay", function (a, b, c) { window.popup = new c.Popup(b.one(".coin-popup"), { trigger: "#tjtag", triggerType: "mouse", align: { node: "#tjtag", points: ["bc", "tc"], offset: [130, 5] } }) }); a.io({ type: "GET", url: "/yunfei.aspx", data: { action: "GetFreeSellCount", pid: id }, success: function (b) { a.one("#sellnum").html(b) }, error: function () { a.one("#yunfei").html("0") } }); var d = null; a.io({ type: "GET", dataType: "json", cache: !1, url: "/yunfei.aspx", data: { action: "GetDefault2" }, success: function (b) { a.one("#province").html(b.province); a.one("#yunfei").html(b.yunfei); a.one("#selected_area").on("mouseenter", function () { a.use("overlay", function (a, b) { d == null && (d = new b.Dialog({ srcNode: "#address", width: 312, closable: true, align: { node: "#selected_area", points: ["bl", "tl"], offset: [0, 0] }, effect: { effect: "slide", duration: 0.2 } })); d.show() }) }); a.one("#selected_area").on("mouseleave", function () { d != null && d.hide() }) }, error: function () { a.one("#yunfei").html("\u8bf7\u6c42\u8d85\u65f6\uff0c\u8bf7\u5237\u65b0") } }); a.all("#address_list a").each(function () { var b = a.one(this), c = b.attr("id"); b.on("click", function () { a.Cookie.remove("SelectProvince"); if (c == "710000" || c == "810000" || c == "820000") { return; } a.Cookie.set("SelectProvince", c, new Date(2099, 1, 1), "", "/"); a.io({ type: "GET", dataType: "json", url: "/yunfei.aspx", data: { action: "GetYunfei2", rid: c }, success: function (b) { a.one("#province").html(b.province); a.one("#yunfei").html(b.yunfei); d != null && d.hide() } }) }) }); var e = a.one("#btn-buy").attr("zt"), g = a.one("#btn-buy").attr("dj"), f = a.one("#btn-buy").attr("tsj"), h = a.one("#btn-buy").attr("tzk"), l = a.one("#btn-buy").attr("zsj"), o = a.one("#btn-buy").attr("zzk"); a.one("#btn-buy").attr("sm"); a.one("#btn-buy").attr("tp"); var m = 0, m = 1 == e ? l : f; if (void 0 != a.one("#buy_num")) a.one("#buy_num").on("keyup", function () { checkBuyNum(a.one(this)) }); var j = a.all(".group_input"); 0 < j.length && j.each(function (b) { b.on("click", function () { a.one("#package_error").hide(); var b = a.one(this), c = b.val(); pobj = a.one("#pr" + c); b.attr("checked") ? pobj.addClass("pic_choice") : pobj.removeAttr("class"); for (var e = 1, d = parseFloat(m), f = parseFloat(g), h = j.length, k = 0; k < h; k++) if (j.item(k) && j.item(k).attr("checked")) { d = d + parseFloat(j.item(k).attr("sj")); f = f + parseFloat(j.item(k).attr("dj")); e++ } if (e <= 1) { a.one("#package_error").show(); b.attr("checked", true); a.one("#pr" + c).addClass("pic_choice") } else { a.one("#packCount").html(e); a.one("#sumopriceDiv").html("\uffe5" + f.toFixed(2)); a.one("#sumpriceDiv").html("\uffe5" + d.toFixed(2)) } }) }) }); function checkBuyNum(a) { var b = KISSY, c = b.one("#btn-buy").attr("sl"), c = parseInt(c); if (isNaN(c) || 0 >= c) return b.one("#px_wrap").removeAttr("class"), b.one("#px_wrap").addClass("px_wrap_error"), b.one("#itemmessage").html('\u8bf7\u5148\u9009\u62e9\uff1a\u56fe\u4e66\u54c1\u7c7b'), !1; var a = parseInt(a.val(), 10), d = parseInt(b.one("#buy_num_text").attr("buy_num")), e = 1; 1 == c ? e = parseInt(b.one("#btn-buy").attr("zkc")) : 2 == c && (e = parseInt(b.one("#btn-buy").attr("tkc"))); if (isNaN(a) || 0 >= a) return b.one("#buy_num_text").html("\u8bf7\u8f93\u5165\u8d2d\u4e70\u6570\u91cf"), b.one("#buy_num_text").show(), !1; if (a < d) return b.one("#buy_num_text").html("\u6b64\u56fe\u4e66" + d + "\u4ef6\u8d77\u8d2d"), b.one("#buy_num_text").show(), !1; if (a > e) b.one("#buy_num_text").html("\u6b64\u54c1\u7c7b\u56fe\u4e66\u6700\u5927\u5e93\u5b58\u4e3a" + e), b.one("#buy_num_text").show(); else return b.one("#buy_num_text").hide(), !0 } function addToCart() { var a = KISSY, b = a.one("#buy_num"); if (checkBuyNum(b)) { var b = parseInt(b.val()), c = a.one("#btn-buy").attr("sl"), c = parseInt(c); KISSY.io.get("/cart.aspx", { productid: id, istejia: c, quantity: b,isfree:1 }, function (b) { a.use("overlay", function (a, c) { var f = new c({ content: b, align: { node: "#productbtn", points: ["tl", "tl"], offset: [-7, 0] }, draggable: !1, closable: !0, closeAction: "destroy" }); f.show(); if (void 0 != a.one(".ts-cart-info") && (void 0 != a.one("#cartnum") && a.one(".mc-count").html(a.one("#cartnum").html()), void 0 != a.one("#goon"))) a.one("#goon").on("click", function () { f.destroy() }) }) }) } } function addGroupToCart() { var a = KISSY, b = id + ","; a.all(".group_input").each(function () { void 0 != a.one(this).attr("checked") && (b += a.one(this).val() + ",") }); var c = b.substring(0, b.length - 1); KISSY.io.get("/groupcart.aspx", { pids: c }, function (b) { a.use("overlay", function (a, c) { var f = new c({ content: b, align: { node: "#buy_package", points: ["tl", "tl"], offset: [-188, 0] }, draggable: !1, closable: !0, closeAction: "destroy" }); f.show(); if (void 0 != a.one(".ts-cart-info") && (void 0 != a.one("#cartnum") && a.one(".mc-count").html(a.one("#cartnum").html()), void 0 != a.one("#goon"))) a.one("#goon").on("click", function () { f.destroy() }) }) }) } function addToFavotite() { CloseDialog(); S.io.get("/favorite.aspx", { productid: id }, function (a) { "0" == a ? CreateDialog("fav", 0) : S.use("overlay", function (b, c) { (new c({ content: a, align: { node: "#productbtn", points: ["tl", "tl"], offset: [-7, 0] }, draggable: !1, closable: !0, closeAction: "destroy" })).show() }) }) } function change_tab(a) { var b = ["tab_detail", "tab_comm", "tab_question"]; for (i = 0; i < b.length; i++) { var c = "current", d = S.one("#" + b[i]), e = d.html(), d = d.parent(), g = b[i]; a == g ? (0 == i && (c = "current2"), d.addClass(c), d.html('' + e + "")) : (d.removeAttr("class"), d.html('" + e + "")) } switch (a) { case "tab_detail": S.one("#detail_all").parent().show(); S.one("#comm_all").show(); S.one("#question_all").show(); S.one("#comm_title").show(); S.one("#question_title").show(); break; case "tab_comm": S.one("#detail_all").parent().hide(); S.one("#comm_title").hide(); S.one("#question_all").hide(); S.one("#comm_all").show(); break; case "tab_question": S.one("#detail_all").parent().hide(), S.one("#question_all").show(), S.one("#comm_all").hide(), S.one("#question_title").hide() } return !1 } function clearHistory() { KISSY.use("anim,node", function (a) { a.io.get("/clearhistory.aspx", function (b) { "OK" == b && (a.one("#history").fadeOut(), a.one("#historytitle").fadeOut()) }) }) } function ShowPic(a) { KISSY.use("ua,event,node,overlay,button", function (b, c, d, e, g) { function f() { b.log("ie center"); h.get("visible") && h.center() } var h = new g.Dialog({ elCls: "my", elStyle: { position: 6 == c.ie ? "absolute" : "fixed" }, bodyContent: '', mask: !0, draggable: !0, align: { points: ["cc", "cc"] }, closeAction: "destroy" }); h.on("destroy", function () { d.detach(window, "scroll", f) }); h.show(); if (6 == c.ie) d.on(window, "scroll", f) }) } function Quehuo() { CloseDialog(); KISSY.use("ua,event,overlay", function (a, b, c, d) { function e() { dialog.get("visible") && dialog.center() } dialog = new d.Dialog({ width: 326, headerContent: "\u7f3a\u8d27\u767b\u8bb0", bodyContent: '', mask: !0, align: { points: ["cc", "cc"] }, draggable: !1, aria: !0, closeAction: "destroy", elStyle: { position: 6 == b.ie ? "absolute" : "fixed" } }); dialog.on("destroy", function () { c.detach(window, "scroll", e) }); if (6 == b.ie) c.on(window, "scroll", e); dialog.show() }) } function ConfirmOrder(a) { var b = KISSY; KISSY.io.get("/mytaoshu.aspx", { action: "ConfirmOrder", oid: a }, function (c) { "OK" == c ? window.location = "/user/myorders.aspx" : b.all(".myorder_popup_main").html('