Files
g.hnyhua.cn/Mtxfw.VipSite/Scripts/common.js
2026-02-07 15:48:27 +08:00

1512 lines
54 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
var seclectall = function (a) {
var p_table = document.getElementById('p_table');
var checka = p_table.getElementsByTagName('input');
for (var i = 0; i < checka.length; i++) {
if (checka[i].type == "checkbox") {
if (a == 0) {
checka[i].checked = true;
} else {
checka[i].checked = false;
}
}
}
};
function onshowdata(id) {
if ($("#data" + id).is(':hidden')) {
$("#data" + id).show();
$(".data_table_box ul li#datalist" + id + " span span.ico").addClass("shang");
} else {
$("#data" + id).hide();
$(".data_table_box ul li#datalist" + id + " span span.ico").removeClass("shang");
}
}
function cminimage(uploadimages) {
var src = uploadimages;
if (uploadimages.indexOf("https://vip.ksd2023.com") != -1) {
src = "https://vip.ksd2023.com/GetFiles.ashx?image=" + uploadimages.replace("https://vip.ksd2023.com", "").replace("Files/Image/", "") + "&itsize=100x100&itmode=cut";
}
else if (uploadimages.indexOf("https://www.pmhapp.cn") != -1) {
src = "https://www.pmhapp.cn/GetFiles.ashx?image=" + uploadimages.replace("https://www.pmhapp.cn", "").replace("Files/Image/", "") + "&itsize=100x100&itmode=cut";
}
else if (uploadimages.indexOf("http://fv.fuanmei.cn") != -1) {
src = src + "?imageView2/2/w/100/h/100/q/75";
}
else {
if (uploadimages.indexOf("https://") == -1 && uploadimages.indexOf("http://") == -1) {
src = "/GetFiles.ashx?image=" + uploadimages.replace("Files/Image/", "") + "&itsize=100x100&itmode=cut";
}
}
return src;
}
function cmaximage(uploadimages) {
var src = uploadimages;
if (uploadimages.indexOf("https://vip.ksd2023.com") != -1) {
src = "https://vip.ksd2023.com/GetFiles.ashx?image=" + uploadimages.replace("https://vip.ksd2023.com", "").replace("Files/Image/", "") + "&itsize=1000x1000&itmode=cut";
}
else if (uploadimages.indexOf("https://www.pmhapp.cn") != -1) {
src = "https://www.pmhapp.cn/GetFiles.ashx?image=" + uploadimages.replace("https://www.pmhapp.cn", "").replace("Files/Image/", "") + "&itsize=1000x1000&itmode=cut";
}
else if (uploadimages.indexOf("http://fv.fuanmei.cn") != -1) {
src = src + "?imageView2/2/w/1000/h/1000/q/75";
}
else {
if (uploadimages.indexOf("https://") == -1 && uploadimages.indexOf("http://") == -1) {
src = "/GetFiles.ashx?image=" + uploadimages.replace("Files/Image/", "") + "&itsize=1000x1000&itmode=cut";
}
}
return src;
}
function fTrim(str) {
return str.replace(/(^\s*)|(\s*$)/g, "");
}
function isNumberOr_Letter(s) {//判断是否是数字或字母
var regu = "^[0-9a-zA-Z\_]+$";
var re = new RegExp(regu);
if (re.test(s)) {
return true;
} else {
b = false;
}
}
function isNumber(s) {//判断是否是数字
var regu = "^[0-9]+$";
var re = new RegExp(regu);
if (re.test(s)) {
return true;
} else {
b = false;
}
}
function changeTwoDecimal_f(x) {
var f_x = parseFloat(x);
if (isNaN(f_x)) {
alert('function:changeTwoDecimal->parameter error');
return false;
}
var f_x = Math.round(x * 100) / 100;
var s_x = f_x.toString();
var pos_decimal = s_x.indexOf('.');
if (pos_decimal < 0) {
pos_decimal = s_x.length;
s_x += '.';
}
while (s_x.length <= pos_decimal + 2) {
s_x += '0';
}
return s_x;
}
function SetRemainTime3() {
var times = $(".showtime");
if (times.length > 0) {
for (var i = 0; i < times.length; i++) {
setRemainTimeSite3($(times[i]), parseInt($(times[i]).attr("time")));
}
}
}
function setRemainTimeSite3(theid, SysSecond) {
if (SysSecond > 0) {
SysSecond = SysSecond - 1;
theid.attr("time", SysSecond);
//alert(SysSecond / 3600);
var second = Math.floor(SysSecond % 60).toString();
var minite = Math.floor((SysSecond / 60) % 60).toString();
var hour = Math.floor((SysSecond / 3600) % 24).toString();
var day = Math.floor((SysSecond / (3600*24))).toString();
theid.html("" + day + "&nbsp;天&nbsp;" + hour + "&nbsp;时&nbsp;" + minite + "&nbsp;分&nbsp;" + second + "&nbsp;秒");
} else {
return;
}
}
function setCookie(name, value) //cookies设置
{
var argv = setCookie.arguments;
var argc = setCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
if (expires != null) {
var LargeExpDate = new Date();
LargeExpDate.setTime(LargeExpDate.getTime() + (expires * 1000 * 3600 * 24));
}
document.cookie = name + "=" + escape(value) + ((expires == null) ? "" : ("; expires=" + LargeExpDate.toGMTString()));
}
function getCookie(Name) //cookies读取
{
var search = Name + "="
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset)
if (end == -1) end = document.cookie.length
return unescape(document.cookie.substring(offset, end))
}
else return ""
}
}
var SysSecond = 120;
function SetRemainTime() {
setRemainTimeSite();
}
var settimeout;
function setRemainTimeSite() {
if (SysSecond > 0) {
SysSecond = SysSecond - 1;
var second = SysSecond.toString();
if ($("#sendyzm").length > 0) {
$("#sendyzm").val("还剩" + second + "秒");
} else {
$("#sendyzm2").val("还剩" + second + "秒");
}
} else {
if ($("#sendyzm").length > 0) {
$("#sendyzm").val("重新发送");
$("#sendyzm").removeAttr("disabled");
} else {
$("#sendyzm2").val("重新发送");
$("#sendyzm2").removeAttr("disabled");
}
}
}
function onclicksendyzm() {
$("#sendyzm").attr("disabled", true);
if ($("#txt_userid").val() != "" && $("#txt_password").val() != "") {
$.post("/Ajax.ashx", { action: 'SendAdminYZM', Name: escape($("#txt_userid").val()), Pwd: escape($("#txt_password").val()) }, function (data) {
switch (data) {
case "0":
alert("发送成功!");
SysSecond = 120;
window.setInterval(SetRemainTime, 1000);
$("#sendyzm").attr("disabled", true);
break;
default: alert(data);
$("#sendyzm").removeAttr("disabled");
}
});
} else {
alert("用户名和密码不能为空");
$("#sendyzm").removeAttr("disabled");
}
}
function onclickSendUserYZM() {
$("#sendyzm").val("发送中...");
$("#sendyzm").attr("disabled", true);
$.post("/Ajax.ashx", { action: 'SendUserYZM' }, function (data) {
switch (data) {
case "0":
alert("发送成功!");
SysSecond = 120;
window.setInterval(SetRemainTime, 1000);
$("#sendyzm").attr("disabled", true);
break;
default: alert(data); $("#sendyzm").attr("disabled", true); $("#sendyzm").val("发送验证码");
}
});
}
function onclicksendyzm3() {
$("#sendyzm").attr("disabled", true);
$.post("/Ajax.ashx", { action: 'SendUserYZM0', UserName: escape($('#Text_UserName').val()), Phone: escape($('#Text_Phone').val()) }, function (data) {
switch (data) {
case "0":
alert("发送成功!");
SysSecond = 120;
window.setInterval(SetRemainTime, 1000);
$("#sendyzm").attr("disabled", true);
break;
default: alert(data); $("#sendyzm").attr("disabled", true); $("#sendyzm").val("发送验证码");
}
});
}
function UpdateUser_OnLine() {
$.post("/Ajax.ashx", { action: 'UpdateUser_OnLine' }, function (data) {
switch (data) {
case "1":
//top.location = "/";
break;
case "2":
alert("您的账户在别处登录,您被迫退出!");
top.location = "/Logout.aspx";
break;
case "3":
alert("您的账户因超时被迫退出!");
top.location = "/Logout.aspx";
break;
case "4":
top.location = "/CloseMsg.aspx";
break;
}
});
}
function showcart(e, t) {
clearInterval(settimeout);
if ($(".ShoppCartbox").is(":hidden")) {
$('.ShoppCartbox').show("300");
var stru = '<p class="loading"><img src="/images/ajaxLoader.gif"/></p>';
$(".ShoppCartbox").html(stru);
$.getJSON("/Ajax.ashx?t=" + Math.random(),
{ action: "GetCartNum" },
function (data) {
if (data.success) {
if (data.TotalNum > 0) {
stru = '<div class="count clearfix"><span class="total">共计 <em>' + data.TotalNum + "</em> 件商品<strong>合计:<em>" + data.TotalMoney + '元</em></strong></span><a href="/Sell/myShoppingCart.aspx" class="btn btn-primary">去购物车结算</a></div>';
} else {
stru = '<p class="loading" style=" line-height:95px;">购物车中还没有商品,赶紧选购吧!</p>';
}
} else {
stru = '<p class="loading" style=" line-height:95px;">读取数据出错...</p>';
}
$(".ShoppCartbox").html(stru);
});
}
}
function hidecart(e, t) {
var s;
if (e.toElement) {
s = e.toElement;
} else if (e.fromElement) {
s = e.fromElement;
} else if (e.relatedTarget) {
s = e.relatedTarget;
}
if (!t.contains(s)) {
clearInterval(settimeout);
settimeout = setInterval(function () {
$(".ShoppCartbox").hide("300");
}, 300);
}
}
function onnewsmenu(t) {
$(".newsbox h3 a.hover").removeClass("hover");
$(".newsbox h3 a#newsmenu" + t).addClass("hover");
$(".newsbox ul").hide();
$(".newsbox ul#newsbox" + t).show();
}
function showcategory() {
clearInterval(settimeout);
if (isCategory == 0) {
if ($(".nav-category-section").is(":hidden")) {
$(".nav-category-section").show("300");
$(".nav-category-abnt .iconfont").html("&#xe606;");
}
}
}
function hidecategory(e, t) {
if (isCategory == 0) {
var s;
if (e.toElement) {
s = e.toElement;
} else if (e.fromElement) {
s = e.fromElement;
} else if (e.relatedTarget) {
s = e.relatedTarget;
}
if (!t.contains(s)) {
if ($(".nav-category-section").is(":visible")) {
clearInterval(settimeout);
settimeout = setInterval(function () {
$(".nav-category-section").hide("300");
$(".nav-category-abnt .iconfont").html("&#xe608;");
}, 100);
}
}
}
}
function showcategory2(id) {
$(".nav-category-list li div").hide();
$(".nav-category-list li div#classbox" + id).show();
$(".nav-category-list li span.hover").removeClass("hover");
$(".nav-category-list li span#classtitle" + id).addClass("hover");
}
function hidecategory2(e, t, id) {
var s;
if (e.toElement) {
s = e.toElement;
} else if (e.fromElement) {
s = e.fromElement;
} else if (e.relatedTarget) {
s = e.relatedTarget;
}
if (!t.contains(s)) {
$(".nav-category-list li div#classbox" + id).hide();
$(".nav-category-list li span#classtitle" + id).removeClass("hover");
}
}
function hideselectprovince(e, t) {
var s;
if (e.toElement) {
s = e.toElement;
} else if (e.fromElement) {
s = e.fromElement;
} else if (e.relatedTarget) {
s = e.relatedTarget;
}
if (!t.contains(s)) {
$("#provincebox").hide("300");
}
}
function onprovince(ProvinceID, ProvinceName, YFmoney) {
$("#cityselbox").show();
$("#provinceselbox").hide();
$("#countyselbox").hide();
$("#provincebox dl dt.selected").removeClass("selected");
$("#provincebox dl dt#citytitle").addClass("selected");
$("#provincebox dl dt#provincetitle span").html(ProvinceName);
$("#hidprovince").val(ProvinceID);
setCookie("province", ProvinceID + "|" + ProvinceName + "|" + YFmoney);
if (showcoke == 0) {
setCookie("city", "0");
setCookie("county", "0");
}
$("#hidprovincetit").val(ProvinceName);
$("#selecttoptitle").html(ProvinceName);
$("#hidcity").val("0");
$("#hidcounty").val("0");
$("#zyunfei").html(YFmoney);
var cid = $("#hidcity").val();
$.post("/Ajax.ashx", { action: 'GetCity2', ProvinceID: ProvinceID, cityIDs: cid }, function (data) {
if (data != 'false') {
$('#cityselbox').html(data);
}
});
}
function oncity(CityID, CityName) {
$("#countyselbox").show();
$("#provinceselbox").hide();
$("#cityselbox").hide();
$("#provincebox dl dt.selected").removeClass("selected");
$("#provincebox dl dt#countytitle").addClass("selected");
$("#provincebox dl dt#citytitle span").html(CityName.substring(0, 4));
$("#hidcity").val(CityID);
$("#hidcitytit").val(CityName);
$("#hidcounty").val("0");
setCookie("city", CityID + "|" + CityName);
if (showcoke == 0) {
setCookie("county", "0");
}
var ss = $("#hidprovincetit").val();
$("#selecttoptitle").html(ss + (CityName == "市辖区" || CityName == "县" ? "" : CityName));
var qid = $("#hidcounty").val();
$.post("/Ajax.ashx", { action: 'GetCounty2', CityID: CityID, countyIDs: qid }, function (data) {
if (data != 'false') {
$('#countyselbox').html(data);
}
});
}
function oncounty(CountyID, CountyName) {
$("#provincebox").hide(300);
$("#provincebox dl dt#countytitle span").html(CountyName.substring(0, 4));
$("#hidcounty").val(CountyID);
$("#hidcountytit").val(CountyName);
setCookie("county", CountyID + "|" + CountyName);
var ss = $("#hidprovincetit").val();
var sss = $("#hidcitytit").val();
sss = (sss == "市辖区" || sss == "县" ? "" : sss)
$("#selecttoptitle").html(ss + sss + CountyName);
}
function showviewprovince(p) {
$("#provincebox dl dt.selected").removeClass("selected");
$("#provincebox dl dt#" + p + "title").addClass("selected");
$("#provincebox ul").hide();
$("#provincebox ul#" + p + "selbox").show();
}
function onshowqg(a, b, c) {
var al = $("#" + a + " li");
if (a == "board-list2") {
$("#board-list li div").hide();
$(".scrollsidebar").css("top", "-200px");
} else {
$(".scrollsidebar").css("top", "0px");
}
for (var j = 0; j < al.length; j++) {
if (j == c) {
$(al[j]).find(" div").fadeIn("300");
$(al[j]).find("span .iconfont").html("&#xe608;");
$(al[j]).find("span").addClass("hover");
} else {
$(al[j]).find(" div").hide();
$(al[j]).find("span .iconfont").html("&#xe606;");
$(al[j]).find("span").removeClass("hover");
}
}
}
function showmenus(k) {
clearInterval(settimeout);
$(".menus li.select em").empty();
$(".menus li").removeClass("select");
$(".menus li .menusbox").hide();
if ($("#soumenus" + k).is(":hidden")) {
if ($(".menus li#menussp" + k).length > 0) {
$(".menus li#menussp" + k).addClass("select");
$(".menus li#menussp" + k).append("<em></em>");
}
var menusbox = $("#soumenus" + k);
menusbox.fadeIn("300");
}
}
function hidemenus(k, e, t) {
var s;
if (e.toElement) {
s = e.toElement;
} else if (e.fromElement) {
s = e.fromElement;
} else if (e.relatedTarget) {
s = e.relatedTarget;
}
if (!t.contains(s)) {
clearInterval(settimeout);
settimeout = setInterval(function () {
$("#soumenus" + k).hide();
if ($(".menus li#menussp" + k).length > 0) {
$(".menus li#menussp" + k).removeClass("select");
$(".menus li#menussp" + k + " em").empty();
}
}, 100);
}
}
function showmodulemenus(k) {
clearInterval(settimeout);
var menusbox = $(".mobilemenus ul li div");
for (var i = 0; i < menusbox.length; i++) {
if ($(menusbox[i]).length > 0) {
if (i == k) {
$(menusbox[i]).fadeIn("300");
} else {
$(menusbox[i]).hide();
}
}
}
}
function hidemodulemenus(k, e, t) {
var s;
if (e.toElement) {
s = e.toElement;
} else if (e.fromElement) {
s = e.fromElement;
} else if (e.relatedTarget) {
s = e.relatedTarget;
}
if (!t.contains(s)) {
clearInterval(settimeout);
settimeout = setInterval(function () {
$("#modulemenus" + k + " div").hide("300");
}, 300);
}
}
function showemenus(k) {
clearInterval(settimeout);
var width = parseInt($(document).width());
if (width > 620) {
$(".emenusbox").hide()
$("#souemenus" + k).fadeIn("300");
}
}
function hideemenus(k, e, t) {
var s;
if (e.toElement) {
s = e.toElement;
} else if (e.fromElement) {
s = e.fromElement;
} else if (e.relatedTarget) {
s = e.relatedTarget;
}
if (!t.contains(s)) {
clearInterval(settimeout);
settimeout = setInterval(function () {
$("#souemenus" + k).hide("300");
}, 300);
}
}
function showhyjiage() {
clearInterval(settimeout);
if ($(".hyjiagebox").css("display") == "none") {
$(".hyjiagebox").fadeIn("300");
}
}
function hidehyjiage(e, t) {
var s;
if (e.toElement) {
s = e.toElement;
} else if (e.fromElement) {
s = e.fromElement;
} else if (e.relatedTarget) {
s = e.relatedTarget;
}
if (!t.contains(s)) {
settimeout = setInterval(function () {
$(".hyjiagebox").hide("300");
}, 300);
}
}
function taocaocheck(id) {
if (typeof ($("#taocao_check_" + id + " .checked input").attr("checked")) != "undefined") {
alert("选择成功");
} else {
alert("取消成功");
}
}
function showtaocao(id) {
$(".taocaobox ul li a").removeClass("hover");
$(".taocaobox ul li a#taocaoa" + id).addClass("hover");
$(".taocaobox dl").hide();
$(".taocaobox dl#taocao_check_" + id).show();
}
function addcart(id) {
var bb = true;
var selcolor = "";
if ($("#IFSelColor").length > 0) {
if ($("#IFSelColor").val() == "") {
bb = false;
alert("请选择颜色");
} else {
selcolor = $("#IFSelColor").val();
}
}
var selguige = "";
if ($("#IFSelguige").length > 0) {
if ($("#IFSelguige").val() == "") {
bb = false;
alert("请选择规格");
} else {
selguige = $("#IFSelguige").val();
}
}
if (bb) {
if ($("#hidprovince").val() == "" || $("#hidprovince").val() == "0") {
bb = false;
$("#provincebox").show();
alert("请选择省份");
}
}
if (bb) {
$.getJSON("/Ajax.ashx?t=" + Math.random(),
{ action: "addcart", id: id, selcolor: (selcolor == "" ? "" : escape(selcolor)), selguige: (selguige == "" ? "" : escape(selguige)), Num: $("#product_amount").val() },
function (data) {
if (data.success) {
alert(data.msg);
$(".input_shopjs").show();
} else {
alert(data.msg);
}
});
}
}
function addcart2(id) {
location.href = "/Sell/myShoppingCart.aspx";
}
function addcart3(id) {
var bb = true;
var selcolor = "";
if ($("#IFSelColor").length > 0) {
if ($("#IFSelColor").val() == "") {
bb = false;
alert("请选择颜色");
} else {
selcolor = $("#IFSelColor").val();
}
}
var selguige = "";
if ($("#IFSelguige").length > 0) {
if ($("#IFSelguige").val() == "") {
bb = false;
alert("请选择规格");
} else {
selguige = $("#IFSelguige").val();
}
}
if (bb) {
$.getJSON("/Ajax.ashx?t=" + Math.random(),
{ action: "addcart2", id: id, selcolor: (selcolor == "" ? "" : escape(selcolor)), selguige: (selguige == "" ? "" : escape(selguige)) },
function (data) {
if (data.success) {
alert("兑换成功");
location.href = "/Member_Orders_List.aspx";
} else {
alert(data.msg);
}
});
}
}
function addcart4(id) {
var bb = true;
if (bb) {
location.href = "/Sell/UserQRGM.aspx?id=" + id;
}
}
function addtaocaocart(id) {
$.getJSON("/Ajax.ashx?t=" + Math.random(),
{ action: "addcart", id: id, selcolor: "" },
function (data) {
if (data.success) {
location.href = "/Sell/myShoppingCart.aspx";
} else {
alert(data.msg);
}
});
}
function addfavorite(id) {
$.getJSON("/Ajax.ashx?t=" + Math.random(),
{ action: "addfavorite", id: id },
function (data) {
if (data.success) {
if ($("#showfavorite_" + id).length > 0) {
$("#showfavorite_" + id).html((parseInt($("#showfavorite_" + id).html()) + 1));
}
alert(data.msg);
} else {
alert(data.msg);
}
});
}
function addguangzhu(id) {
$.getJSON("/Ajax.ashx?t=" + Math.random(),
{ action: "addfavorite", id: id },
function (data) {
if (data.success) {
if ($("#guangzhu" + id).length > 0) {
$("#guangzhu" + id).html((parseInt($("#guangzhu" + id).html()) + 1));
}
alert(data.msg);
} else {
alert(data.msg);
}
});
}
function addxihuan(id) {
$.getJSON("/Ajax.ashx?t=" + Math.random(),
{ action: "addxihuan", id: id },
function (data) {
if (data.success) {
if ($("#xihuan" + id).length > 0) {
$("#xihuan" + id).html((parseInt($("#xihuan" + id).html()) + 1));
}
alert(data.msg);
} else {
alert(data.msg);
}
});
}
function search() {
if ($("#keyword").val() == "") {
return false;
$("#keyword").focus();
} else {
return true;
}
}
var $list, $btnPrev, $btnNext, itemWidth, itemHeight, itemPerSlide, countPage, curIndex = 0, timeoutAuto = null;
function slideList(targetPage) {
var offsetX = "-" + (targetPage * itemWidth * itemPerSlide) + "px";
$list.animate({
"margin-left": offsetX
}, 500);
//alert(targetPage + "|" + itemWidth + "|" + itemPerSlide);
if (targetPage > 0) {
if ((countPage - 1) > targetPage) {
$btnPrev.removeClass("page-btn-prev-disabled");
$btnNext.removeClass("page-btn-next-disabled");
}
else if (targetPage == countPage - 1) {
$btnPrev.removeClass("page-btn-prev-disabled");
$btnNext.addClass("page-btn-next-disabled");
}
} else {
$btnPrev.addClass("page-btn-prev-disabled");
$btnNext.removeClass("page-btn-next-disabled");
}
}
function autoPlay() {
clearInterval(timeoutAuto);
timeoutAuto = setInterval(function () {
curIndex += 1,
curIndex > countPage - 1 && (curIndex = 0),
slideList(curIndex)
}, 10000);
}
function btnPrev() {
if (0 < curIndex) {
curIndex -= 1;
clearInterval(timeoutAuto);
slideList(curIndex);
}
}
function btnNext() {
if (curIndex < countPage - 1) {
curIndex += 1;
clearInterval(timeoutAuto);
slideList(curIndex);
}
}
var imgPerSlide = 4, listnum = 0, imgpages = 0, curimgpage = 0;
function checkimgpage() {
listnum = $(".img_list ul li").length;
var rslt = listnum / imgPerSlide; //除
imgpages = Math.ceil(rslt); //返回值为大于等于其数字参数的最小整数。
if (imgpages == 1) {
$(".a_down").addClass("a_down_disable");
$(".a_up").addClass("a_up_disable");
} else {
var imgleft = curimgpage * (91 * 4 + 48);
$(".img_list ul").animate({ left: -imgleft + "px" }, 1000);
if (curimgpage == imgpages - 1) {
$(".a_down").addClass("a_down_disable");
} else {
$(".a_down").removeClass("a_down_disable");
}
if (curimgpage <= 0) {
$(".a_up").addClass("a_up_disable");
} else {
$(".a_up").removeClass("a_up_disable");
}
var curshowimg = (curimgpage * 4 + 1);
selimg(curshowimg);
}
}
function selimg(j) {
var img_list = $(".img_list ul li");
for (var i = 0; i < img_list.length; i++) {
if (i == (j - 1)) {
$("#productImg").attr("src", $(img_list[i]).find("img").attr("simg"));
$("#productImgA").attr("href", $(img_list[i]).find("img").attr("ssimg"));
$(".img_list ul li.select em").empty();
$(".img_list ul li.select").removeClass("select");
$(img_list[i]).append("<em></em>");
$(img_list[i]).addClass("select");
}
}
}
function selcolor(c, j) {
//$("#productImg").attr("src", "/images/ajaxLoader.gif");
$("#IFSelColor").val(c);
$(".colorbox.selected em").empty();
$(".colorbox.selected").removeClass("selected");
$(".colorbox#colorbox" + j).append("<em></em>");
$(".colorbox#colorbox" + j).addClass("selected");
var aimgs = strlistimages.split("|");
var listimgs = "";
var k = 0;
for (var i = 0; i < aimgs.length; i++) {
var simg = aimgs[i].split(",");
if (simg.length == 4) {
if (simg[3] == c) {
listimgs += "<li onmouseover='showmaxpic(this)'" + (k == 0 ? " class='select'" : "") + ">" + (k == 0 ? "<em></em>" : "") + "<img src='" + simg[0] + "' simg='" + simg[1] + "' ssimg='" + simg[2] + "'/></li>";
if (k == 0) {
$("#productImg").attr("src", simg[1]);
$("#productImgA").attr("href", simg[2]);
}
k += 1;
}
}
}
$(".img_list ul").html(listimgs);
$(".img_list ul").css("left", "0px");
curimgpage = 0;
checkimgpage();
}
function selguige(je, id) {
$("#IFSelguige").val(id);
$(".guigebox.selected em").empty();
$(".guigebox.selected").removeClass("selected");
$(".guigebox#guigebox" + id).append("<em></em>");
$(".guigebox#guigebox" + id).addClass("selected");
$("#nonMemberPrice").html(changeTwoDecimal_f(je));
}
function showmaxpic(id) {
//$("#productImg").attr("src", "/images/ajaxLoader.gif");
var max428pic = $(id).find("img").attr("simg");
var maxpic = $(id).find("img").attr("ssimg");
$(".img_list ul li.select em").empty();
$(".img_list ul li.select").removeClass("select");
$(id).append("<em></em>");
$(id).addClass("select");
$("#productImg").attr("src", max428pic);
$("#productImgA").attr("href", maxpic);
}
function showscrollhover(a, h) {
if (a == "loga") {
$("#scroll .serverhover").hide();
}
if (a == "servera") {
$("#scroll .loghover").hide();
}
h.show();
}
function hidescrollhover(e, t, a, h) {
var s;
if (e.toElement) {
s = e.toElement;
} else if (e.fromElement) {
s = e.fromElement;
} else if (e.relatedTarget) {
s = e.relatedTarget;
}
if (!t.contains(s)) {
h.hide();
}
}
function showScroll() {
var w = parseInt($(this).width());
$(window).scroll(function () {
var scrollValue = $(window).scrollTop();
var scrollBottom = $(document).height() - $(window).height() - $(window).scrollTop();
if (scrollValue > 200) {
$(".addbtn").addClass("scrolladdbtn");
$(".scroll .cartbox").show();
} else {
$(".addbtn").removeClass("scrolladdbtn");
$(".scroll .cartbox").hide();
}
if (scrollValue > 900) {
if (w > 1260) {
if ($(".tit_tab_box").length > 0) {
$(".tit_tab_box").addClass("scrolltabbox");
$(".addcardbox").show();
$(".product_leftmenu").addClass("scrollmenu");
}
}
} else {
if (w > 1260) {
if ($(".tit_tab_box").length > 0) {
$(".tit_tab_box").removeClass("scrolltabbox");
$(".addcardbox").hide();
$(".product_leftmenu").removeClass("scrollmenu");
}
}
}
if (w > 800) {
if (scrollValue > 1100 && scrollBottom > 200) {
$("#sidebarbox").addClass("scrollsidebar");
} else {
$("#sidebarbox").removeClass("scrollsidebar");
}
/*if (scrollValue > 300 && scrollBottom > 100) {
$("#left-board-section").addClass("scrollsidebar");
} else {
$("#left-board-section").removeClass("scrollsidebar");
}*/
}
});
$("#topbox .topa").click(function () {
$("html,body").animate({ scrollTop: 0 }, 1000);
});
}
function picfocus() {
var sWidth = $("#picfocus").width(); //获取焦点图的宽度(显示面积)
var len = $("#picfocus ul li").length; //获取焦点图个数
var index = 0;
var picTimer;
//以下代码添加数字按钮和按钮后的半透明条,还有上一页、下一页两个按钮
var btn = ""; //<div class='focusBg'></div><div class='focusbtn'>
/*for (var i = 0; i < len; i++) {
btn += "<span></span>";
}*/
btn += "<div class='preNext pre'></div><div class='preNext next'></div>"; //</div>
$("#picfocus").append(btn);
//为小按钮添加鼠标滑入事件,以显示相应的内容
/*$("#picfocus .focusbtn span").css("opacity", 0.4).mouseover(function () {
index = $("#picfocus .focusbtn span").index(this);
showPics(index);
}).eq(0).trigger("mouseover");*/
//上一页、下一页按钮透明度处理
$("#picfocus .preNext").css("opacity", 0.2).hover(function () {
$(this).stop(true, false).animate({ "opacity": "0.5" }, 300);
}, function () {
$(this).stop(true, false).animate({ "opacity": "0.2" }, 300);
});
//上一页按钮
$("#picfocus .pre").click(function () {
index -= 1;
if (index == -1) { index = len - 1; }
showPics(index);
});
//下一页按钮
$("#picfocus .next").click(function () {
index += 1;
if (index == len) { index = 0; }
showPics(index);
});
//本例为左右滚动即所有li元素都是在同一排向左浮动所以这里需要计算出外围ul元素的宽度
$("#picfocus ul").css("width", sWidth * (len));
//鼠标滑上焦点图时停止自动播放,滑出时开始自动播放
$("#picfocus").hover(function () {
clearInterval(picTimer);
}, function () {
picTimer = setInterval(function () {
showPics(index);
index++;
if (index == len) { index = 0; }
}, 4000); //此4000代表自动播放的间隔单位毫秒
}).trigger("mouseleave");
//显示图片函数根据接收的index值显示相应的内容
function showPics(index) { //普通切换
$(window).resize(function () {
sWidth = $("#picfocus").width();
});
var nowLeft = -index * sWidth; //根据index值计算ul元素的left值
$("#picfocus ul").stop(true, false).animate({ "left": nowLeft }, 300); //通过animate()调整ul元素滚动到计算出的position
//$("#picfocus .btn span").removeClass("on").eq(index).addClass("on"); //为当前的按钮切换到选中的效果
//$("#picfocus .focusbtn span").stop(true, false).animate({ "opacity": "0.4" }, 300).eq(index).stop(true, false).animate({ "opacity": "1" }, 300); //为当前的按钮切换到选中的效果
}
}
$(document).ready(function () {
if ($(".img_list ul li").length > 0) {
checkimgpage();
$(".a_down").click(function () {
if (curimgpage < imgpages) {
curimgpage += 1;
}
checkimgpage();
});
$(".a_up").click(function () {
if (curimgpage > 0) {
curimgpage -= 1;
}
checkimgpage();
});
$(".a_down").mouseover(function () { $(this).addClass("a_down_hover"); });
$(".a_down").mouseout(function () { $(this).removeClass("a_down_hover"); });
$(".a_up").mouseover(function () { $(this).addClass("a_up_hover"); });
$(".a_up").mouseout(function () { $(this).removeClass("a_up_hover"); });
}
showScroll();
if ($(".nav-category-section").length > 0) {
if (isCategory == 0) {
$(".nav-category-section").hide();
$(".nav-category-abnt .iconfont").html("&#xe608;");
}
}
if ($("#selectprovince").length > 0) {
showcoke = 1;
var province = getCookie("province");
if (province != "") {
var aprovince = province.split("|");
onprovince(aprovince[0], aprovince[1], aprovince[2]);
}
var city = getCookie("city");
if (city != "" && city != "0") {
var acity = city.split("|");
oncity(acity[0], acity[1]);
}
var county = getCookie("county");
if (county != "" && county != "0") {
var acounty = county.split("|");
oncounty(acounty[0], acounty[1]);
}
showcoke = 0;
}
if ($("#addBookmark").length > 0) {
$("#addBookmark").click(function () {
var title = $(this).attr("title");
var url = $(this).attr("url");
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf("msie 8") > -1) {
external.AddToFavoritesBar(url, title, ''); //IE8
} else {
try {
window.external.addFavorite(url, title);
} catch (e) {
try {
window.sidebar.addPanel(title, url, ""); //firefox
} catch (e) {
alert("加入收藏失败请使用Ctrl+D进行添加");
}
}
}
});
}
$list = $(".J_carouselList");
$btnPrev = $(".J_carouselPrev");
$btnNext = $(".J_carouselNext");
itemWidth = 310;
countPage = 2;
itemPerSlide = 3;
var width = parseInt($(this).width());
if (width <= 620) {
itemPerSlide = 2;
countPage = 3;
}
if (width <= 720) {
var showa = $(".menus ul li .showmenus");
if (showa.length > 0) {
for (var i = 0; i < showa.length; i++) {
$(showa[i]).removeAttr("onmouseover");
}
}
}
autoPlay();
$(window).resize(function () {
var items = $("#picfocus ul li img");
var width = parseInt($(this).width());
/*itemPerSlide = 2;
countPage = 2;
if (width <= 620) {
itemPerSlide = 1;
countPage = 4;
}
autoPlay();*/
/*if (width <= 630 && width > 560) {
$(document.body).css("-webkit-transform", "scale(-0.5)");
}*/
});
$('#login').click(function () {
if ($('#txt_userid').val() != '' && $('#txt_password').val() != '') {
if ($('#txt_Code').val() != '') {
$("#login").val("登录中,请稍候...");
$.post("/Ajax.ashx", { action: 'GetLogin', name: escape($('#txt_userid').val()), pwd: escape($('#txt_password').val()), code: escape($('#txt_Code').val()) }, function (data) {
if (data.indexOf("0|returnurl=") != -1) {
location.replace(data.replace("0|returnurl=", ""));
} else {
switch (data) {
case "0":
//$("#login").val("登录成功,正在跳转...");
//$('#Login_before').css('display', 'none');
//$('#Login_after').fadeIn('fact');
//$('#username').html($('#txt_userid').val());
//$('#txt_userid,#txt_password,#txt_Code').val('');
location.replace("/Member.aspx");
break;
case "1": alert('用户名或密码错误,或用户名未审核!'); break;
case "2": alert('请输入用户名或密码!'); break;
case "3": alert('请输入验证码!'); break;
case "4": alert('验证码错误!'); break;
case "5": alert('晚上11点后暂时不能登录早上7点准时开放'); break;
case "6": alert('您的账户不能登录!'); break;
case "7": if (confirm("尊敬的会员,您已经达到复投条件,需要现在去复投吗!")) {
location.replace("/Member_Recast.aspx");
} else {
location.replace("/Member.aspx");
}
break;
case "77":
alert("尊敬的会员,您的保健积分已分完,将永不再享受保健积分权益!");
location.replace("/Member.aspx");
break;
case "777": if (confirm("尊敬的会员,您的保健积分已分完并已达到复投条件,需要现在去复投吗!")) {
location.replace("/Member_Recast.aspx");
} else {
location.replace("/Member.aspx");
}
break;
case "8": location.replace("/CloseMsg.aspx"); break;
case "12":
location.replace("/Member.aspx");
break;
default: alert(data); break;
}
}
$("#login").val("登录");
});
}
else alert('请输入验证码!');
}
else alert('请输入用户名或密码!');
});
$('#login2').click(function () {
if ($('#txt_userid').val() != '' && $('#txt_password').val() != '') {
if ($('#txt_Code').val() != '') {
$("#login2").val("登录中,请稍候...");
$.post("/Ajax.ashx", { action: 'GetLogin2', name: escape($('#txt_userid').val()), pwd: escape($('#txt_password').val()), code: escape($('#txt_Code').val()) }, function (data) {
switch (data) {
case "0":
$("#login").val("登录成功,正在跳转...");
$('#Login_before').css('display', 'none');
$('#Login_after').fadeIn('fact');
$('#username').html($('#txt_userid').val());
$('#txt_userid,#txt_password,#txt_Code').val('');
location.replace("/index.aspx?g=0");
break;
case "1": layer.msg('用户名或密码错误,或用户名未审核!', {icon: 5}); break;
case "2": layer.msg('请输入用户名或密码!', {icon: 5}); break;
case "3": layer.msg('请输入验证码!', {icon: 5}); break;
case "4": layer.msg('验证码错误!', {icon: 5});break;
case "5": layer.msg('暂时不能登录!', {icon: 5}); break;
case "6": layer.msg('您的账户不能登录!', {icon: 5}); break;
case "7": layer.msg('已封号!', {icon: 5}); break
case "8": location.replace("/CloseMsg.aspx"); break;
default: layer.msg(data); break;
}
$("#login2").val("登录");
});
}
else layer.msg('请输入验证码', {icon: 5});
}
else alert('请输入用户名或密码!');
});
$('#sjlogin').click(function () {
if ($('#txt_userid').val() != '' && $('#txt_password').val() != '') {
if ($('#txt_Code').val() != '') {
$("#sjlogin").val("登录中,请稍候...");
$.post("/Ajax.ashx", { action: 'GetLogin1', name: escape($('#txt_userid').val()), pwd: escape($('#txt_password').val()), code: escape($('#txt_Code').val()) }, function (data) {
switch (data) {
case "0":
$("#sjlogin").val("登录成功,正在跳转...");
$('#Login_before').css('display', 'none');
$('#Login_after').fadeIn('fact');
$('#username').html($('#txt_userid').val());
$('#txt_userid,#txt_password,#txt_Code').val('');
location.replace("/index.aspx?g=1");
break;
case "1": alert('用户名或密码错误,或用户名未审核!'); break;
case "2": alert('请输入用户名或密码!'); break;
case "3": alert('请输入验证码!'); break;
case "4": alert('验证码错误!'); break;
case "5": alert('暂时不能登录!'); break;
case "6": alert('您的账户不能登录!'); break;
case "7": alert('不是商家不能登录!'); break
case "8": location.replace("/CloseMsg.aspx"); break;
default: alert(data); break;
}
$("#sjlogin").val("登录");
});
}
else alert('请输入验证码!');
}
else alert('请输入用户名或密码!');
});
$('#quit').click(function () {
$.post("/Ajax.ashx", { action: 'Quit' }, function (data) {
if (data != 'false') {
$('#Login_before').fadeIn('fact'); $('#Login_after').css('display', 'none');
open("/gl.aspx", "_top");
}
else {
$('#Login_before').css('display', 'none'); $('#Login_after').fadeIn('fact');
}
});
});
$('body').each(function () {
$.post("/Ajax.ashx", { action: 'IsLogin' }, function (data) {
if (data != 'false') {
$('#Login_before').css('display', 'none'); $('#Login_after').css('display', 'block'); $('#username').html(data);
}
else {
$('#Login_before').css('display', 'block'); $('#Login_after').css('display', 'none');
}
});
});
$('#txtUserName').blur(function () {
if ($(this).val() != '') {
$.post("/Ajax.ashx", { action: 'GetUserName', name: escape($(this).val()) }, function (data) {
if (data == 'true') {
$('#msg1').html('<font color="red">用户名已经存在,请换一个。</font>');
$(this).val('');
$('#hidden_UserName').val('1');
} else {
$('#msg1').html('<font color="green">用户名可以使用。</font>');
$('#hidden_UserName').val('0');
}
});
}
});
$('#txtEmail').blur(function () {
/*if ($(this).val() != '') {
var EmailCount = $(this).val().split(";")
var EmailA = $(this).val().split("@");
var EmailB = $(this).val().split(".");
if (EmailA.length != EmailCount.length + 1) {
$('#msg2').html('<font color="red">Email格式不对,请换一个。</font>');
$(this).val('');
$('#hidden_Email').val('1');
} else {
if (EmailB.length < EmailCount.length + 1) {
$('#msg2').html('<font color="red">Email格式不对,请换一个。</font>');
$(this).val('');
$('#hidden_Email').val('1');
} else {
$.post("/Ajax.ashx", { action: 'GetUserEmail', Email: escape($(this).val()), utype: '0' }, function (data) {
if (data == 'true') {
$('#msg2').html('<font color="red">Email已经存在,请换一个。</font>');
$(this).val('');
$('#hidden_Email').val('1');
} else {
$('#msg2').html('<font color="green">Email可以使用。</font>');
$('#hidden_Email').val('0');
}
});
}
}
}*/
});
$('#txt_password').keydown(function () {
var keycode = (event.keyCode ? event.keyCode : event.which);
if (keycode == '13') { $('#login').focus(); }
});
});
function tjguests() {
if ($("#Text_NCName").val() == "" || $("#Text_NCName").val() == "必须填写") {
alert('您的昵称不能为空');
} else if ($("#Text_LXFX").val() == "" || $("#Text_LXFX").val() == "必须填写") {
alert('您的联系方式不能为空');
} else if ($("#Text_Body").val() == "" || $("#Text_Body").val() == "尊敬的客户:说几句吧") {
alert('留言内容不能为空');
} else {
$.post("/Ajax.ashx", {
action: "AddGuest",
GuestName: escape($("#Text_NCName").val()),
GuestContact: escape($("#Text_LXFX").val()),
Message: escape($("#Text_Body").val())
}, function (data) {
if (data == 'true') {
alert('发表留言成功,谢谢!');
location.href = location.href.toString();
} else alert(data);
});
}
}
function tjpinglun() {
var addstarbox = $("#addstarbox input");
var star = 1;
for (var i = 0; i < addstarbox.length; i++) {
if ($(addstarbox[i]).attr("checked") == true) {
star = $(addstarbox[i]).val();
}
}
if ($("#pinglunname").val() == "" || $("#pinglunname").val() == "必须填写") {
alert('您的昵称不能为空');
} else if ($("#pinglunbody").val() == "" || $("#pinglunbody").val() == "尊敬的客户:说几句吧") {
alert('您的评论不能为空');
} else {
$.post("/Ajax.ashx", {
action: "Addpinglun",
GuestName: escape($("#pinglunname").val()),
Message: escape($("#pinglunbody").val()),
star: star,
BusinessID: $('#hidd_id').val()
}, function (data) {
if (data == 'true') {
alert('发表评论成功,请等待管理员审核');
} else alert(data);
});
}
}
function tjwenda() {
if ($("#wdid").val() == "") {
if ($("#wendaname").val() == "" || $("#wendaname").val() == "必须填写") {
alert('您的昵称不能为空');
} else if ($("#wendabody").val() == "" || $("#wendabody").val() == "尊敬的客户:说几句吧") {
alert('您的评论不能为空');
} else {
$.post("/Ajax.ashx", {
action: "Addwenda",
GuestName: escape($("#wendaname").val()),
Message: escape($("#wendabody").val()),
BusinessID: $('#hidd_id').val()
}, function (data) {
if (data == 'true') {
alert('提交问题成功,请等待管理员审核');
} else alert(data);
});
}
} else {
if ($("#wendaname").val() == "" || $("#wendaname").val() == "必须填写") {
alert('您的昵称不能为空');
} else if ($("#wendabody").val() == "" || $("#wendabody").val() == "尊敬的客户:说几句吧") {
alert('您的评论不能为空');
} else {
$.post("/Ajax.ashx", {
action: "savewenda",
GuestName: escape($("#wendaname").val()),
Message: escape($("#wendabody").val()),
wdid: $("#wdid").val()
}, function (data) {
if (data == 'true') {
alert('保存成功,请等待管理员审核');
} else alert(data);
});
}
}
}
function zanpinglun(id) {
if ($("#zan" + id).attr("class") == "zan") {
$.post("/Ajax.ashx", {
action: "zanpinglun",
id: id
}, function (data) {
if (data == 'true') {
$("#zan" + id).attr("class", "zan2");
var zannum = $("#zan" + id + " label");
zannum.html(parseInt(zannum.html()) + 1);
$("#showzannum").show();
$("#showzannum").css({ left: $("#zan" + id).offset().left + "px", top: ($("#zan" + id).offset().top - 20) + "px" });
$("#showzannum").hide(500);
} else alert(data);
});
} else {
alert("您已经赞过了");
}
}
function GetPages(ttype, intPage, ID) {
$("#detail_pinglun_box_" + ttype).html("<div align=\"center\"><img src=\"/images/ajaxLoader.gif\"/></div>");
$.getJSON("/Ajax.ashx?t=" + Math.random(),
{ action: "GetPages", ttype: ttype, intPage: intPage, ID: ID },
function (data) {
if (data.success) {
var pingcontent = data.content;
var pingpages = data.pages;
$("#detail_pinglun_box_" + ttype).html(pingcontent);
$("#detail_pinglun_pages_" + ttype).html(pingpages);
} else {
alert(data.msg);
}
});
}
function wyhd(id, title) {
$("#wendabody").text(title);
$("#wdid").val(id);
$("#wdbutton").focus();
$("#wdtitle").html("您的回答:");
$("#wdbutton").attr("class", "tjld");
}
function CheckSuperiorsID(){
if ($("#txtSuperiorsID").val() != "") {
$.post("/Ajax.ashx", { action: 'GetUserName2', name: escape($("#txtSuperiorsID").val()), t: 2, uLevel5: $('#uLevel5').val() }, function (data) {
if (data.indexOf('成功|') != -1) {
$('#txtSuperiorsID_notice').html('<font color="green">接点会员账号可以使用,接点人姓名为:' + data.replace('成功|', '') + '。</font>');
$('#hidden_SuperiorsID').val('0');
} else if (data == '0') {
$('#txtSuperiorsID_notice').html('<font color="red">接点会员账号不存在或未审核,请换一个。</font>');
$(this).val('');
$('#hidden_SuperiorsID').val('1');
} else if (data == '1') {
$('#txtSuperiorsID_notice').html('<font color="red">接点会员账号已满4人,请换一个。</font>');
$(this).val('');
$('#hidden_SuperiorsID').val('1');
} else if (data == '2') {
$('#txtSuperiorsID_notice').html('<font color="red">接点会员账号A区已有人,请换一个。</font>');
$(this).val('');
$('#hidden_SuperiorsID').val('1');
} else if (data == '3') {
$('#txtSuperiorsID_notice').html('<font color="red">必须先开通A区才能注册B区或者A区会员未审核,请换一个。</font>');
$(this).val('');
$('#hidden_SuperiorsID').val('1');
} else if (data == '4') {
$('#txtSuperiorsID_notice').html('<font color="red">B区已有人,请换一个。</font>');
$(this).val('');
$('#hidden_SuperiorsID').val('1');
} else if (data == '5') {
$('#txtSuperiorsID_notice').html('<font color="red">暂时还不能注册C区。</font>');
$(this).val('');
$('#hidden_SuperiorsID').val('1');
} else if (data == '6') {
$('#txtSuperiorsID_notice').html('<font color="red">必须先开通B区才能注册C区。</font>');
$(this).val('');
$('#hidden_SuperiorsID').val('1');
} else if (data == '7') {
$('#txtSuperiorsID_notice').html('<font color="red">C区已有人,请换一个。</font>');
$(this).val('');
$('#hidden_SuperiorsID').val('1');
} else if (data == '8') {
$('#txtSuperiorsID_notice').html('<font color="red">必须先开通C区才能注册D区。</font>');
$(this).val('');
$('#hidden_SuperiorsID').val('1');
} else if (data == '9') {
$('#txtSuperiorsID_notice').html('<font color="red">D区已有人,请换一个。</font>');
$(this).val('');
$('#hidden_SuperiorsID').val('1');
} else if (data == '10') {
$('#txtSuperiorsID_notice').html('<font color="red">条件不足不能开通C区</font>');
$(this).val('');
$('#hidden_SuperiorsID').val('1');
}
});
} else {
$('#txtSuperiorsID_notice').html('<font color="red">接点人不能为空!</font>');
$('#hidden_SuperiorsID').val('1');
}
}