///
///
///
//
//
var userID = '';
//
//
var userLevel = '';
//
//
var access_control = $.parseJSON('{"verification_login":"0","vcode_reg_graph":"0","vcode_color1":"#D2D7FF","verification_manual":"0","vcode_color0":"#ffffff","vcode_email_graph":"0","verification_ip_reg_limit":"0","vcode_reg_sms":"0","vcode_font":"Verdana","vcode_login_graph":"0","vcode_resetps_sms":"0","vcode_sms_graph":"0","vcode_resetps_email":"1","vcode_color2":"#0060ca","verification_order":"0","vcode_reg_email":"0","vcode_color3":"#d22000","vcode_fontsize":"12","vcode_length":"5"}');
//
var swin = $("#swin"), suwin = $("#suwin");
if (userID != '') {
//
$(".login").html(',欢迎您!|' +
'用户中心|' +
'产品服务管理|' +
'财务管理|' +
'售后服务中心|' +
'联系我们|' +
'退出登录' +
'');
//
}
function userLogin(action, rurl) {
if (action == 0) {
var str='';
swin.html(str);
swin.dialog({ title: "四博主站帐号快捷登录", autoOpen: false, resizable: false, width: 368, modal: true, buttons: { "关 闭": function () { $(this).dialog("close"); } } }).dialog("open");
swin.find("#quicklogin").click(function () {
swin.dialog("option", "buttons", { "确认登录成功": function () { cloudOrder(1);}, "关 闭": function () { $(this).dialog("close"); } });
});
} else {
window.open("http://www.4bo.cn/userself/cloud_bind.asp?act=login");
return false;
}
}
function userLogout(rurl) {
if (rurl == '') rurl = top.location.toString();
if (rurl.length > 3 && rurl.substring(0, 3) == '?c=') rurl = 'process.aspx?c=go&url=' + escape(rurl);
swin.html('您确定要退出登录吗?');
swin.dialog({ title: "安全退出", autoOpen: false, resizable: false, width: 368, modal: true, buttons: { "确 定": function () { top.location = 'process.aspx?c=logout&rurl=' + escape(rurl) }, "取 消": function () { $(this).dialog("close"); } } }).dialog("open");
}
function userReg(action, rurl) {
window.open("http://www.4bo.cn/UserSelf/newuserreg.asp");
}
function payOnline(action,amount) {
if (action == 0) {
suwin.dialog({ title: "在线充值", autoOpen: false, resizable: false, width: 500, height: 308, modal: true, buttons: { "充 值": function () { payOnline(1, amount); }, "取 消": function () { $(this).dialog("destroy"); } } }).dialog("open");
suwin.html(ajaxLoading());
$.getJSON("process.aspx?c=payment&at=select&" + new Date(), function (rdata) {
if (rdata == null) suwin.html("在线充值已禁用!");
else {
var str = '请选择充值接口:
充值金额: 元
';
suwin.html(str);
suwin.find("label").css("cursor", "pointer");
suwin.find("input:radio").click(function () { suwin.find(".pptext").html(htmlDecode($(this).attr("title"))); });
suwin.find("input:radio:first").click();
}
});
}
else if (action == 1) {
amount = suwin.find("input[name='amount']").val();
if (isNaN(amount) || parseFloat(amount) < 0.01) alert("充值金额必须为大于0.01的数字");
else {
var pmid = suwin.find("input[name='pmid']:checked").val();
amount = parseFloat(amount).toFixed(2);
suwin.find(".pptext").text("正在处理,请稍候...");
$.get("process.aspx?c=payment&&at=url&pmid=" + pmid + "&amount=" + amount + "&" + new Date(), function (rdata) {
var rmsg = rdata.split('|');
if (rmsg[0] == '0') {
suwin.html('充值金额:' + amount + ' 元
' +
'充值方式:' + suwin.find("label[for='pm" + pmid + "']").text() + '
' +
'' +
'');
suwin.dialog({ title: "在线充值确认", autoOpen: false, resizable: false, width: 398, height: 268, modal: true, buttons: { "取 消": function () { $(this).dialog("close"); } } }).dialog("open");
suwin.find("img").click(function () {
suwin.dialog("option", "buttons", { "确认已完成充值": function () { payOnline(2, amount); }, "关 闭": function () { $(this).dialog("destroy"); } });
});
} else {
switch (rmsg[1]) {
case 'Invalid payment method': rdata = '无效的付款方式!'; break;
case 'Invalid amount': rdata = '充值金额必须为大于0的数字!'; break;
case 'Invalid sign': rdata = '接口[' + rmsg[2] + ']验证错误,请与客服联系!'; break;
case 'Amount can not exceed reseller balance': rdata = '充值金额大于允许限制,请与客服联系!'; break;
}
suwin.find(".pptext").text(rdata);
}
});
}
}
else if (action == 2) {
processing("正在获取充值结果,请稍候...");
var pid = suwin.find("input:first").val();
if (pid.indexOf('_') > 0) pid = pid.substring(pid.lastIndexOf('_') + 1);
var delay = 0;
var cmd = '';
$.get("process.aspx?c=payment&at=verifypay&pid=" + pid + "&" + new Date(), function (rdata) {
if (rdata == "-1") {
rdata = "您的充值操作还没有完成,请点击“马上充值”";
}
else {
delay = 1000;
rdata = '充值成功!您现在可以继续购买操作了...';
cmd = 'close';
}
showResults(rdata, delay, cmd);
});
}
}
function checkout(productID, billingCycle) {
processing('正在发送购买请求,请稍候...');
var cmd = '';
delay = 0;
var cform = $('#OrderConfig');
var couponcode = $('#couponcode').val();
$.post('/idcSystem.aspx?c=order&at=checkout&pid=' + productID + '&cycle=' + billingCycle + '&couponcode=' + couponcode + '&userid=' + new Date(), cform.serialize(), function (rdata) {
var rmsg = rdata.split('|');
if (rmsg[0] == '0') {
rdata = "购买成功!
系统将会尽快为您开通服务,感谢您的购买!";
delay = 1;
cmd = 'close';
swin.dialog("close");
swin.html('您已经成功购买,系统将会为您尽快完成服务开通和设置,请选择:');
swin.dialog({ title: "购买成功", autoOpen: false, resizable: false, modal: true, buttons: { "查看和管理我的服务": function () { top.location = 'process.aspx?c=go&url=' + escape('?c=myservice'); }, "继续购买": function () { $(this).dialog("close"); } } }).dialog("open");
}
else {
switch (rmsg[1]) {
case "Outstock": rdata = '此产品已经销售完毕,请选择其它产品!'; break;
case "You only get to apply once": rdata = '每位客户只能申请一次试用!'; break;
case "Payment is incorrect": rdata = '您选择的付款方式或付款周期有误!'; break;
case "Invalid coupon code": rdata = '您输入的优惠码无效!'; break;
case "Lack of balance": rdata = '您的余额不足于购买当前产品!'; break;
case "Price configuration error": rdata = '产品价格配置错误!'; break;
case "Module price error": rdata = '计费模块错误!'; break;
case "Pending verification": rdata = '您的帐户需要验证后才能购买,请先到个人资料页面进行验证!'; break;
case "无效的节点服务器!": rdata = "服务器资源不足!"; break;
default: rdata = rmsg[1]; break;
}
delay = 0;
}
showResults(rdata, delay, cmd);
});
}
function placeOrder(action, url) {
if (action == 0) {
if (userID == '') userLogin(0, 'cmd:placeOrder(1,"' + url + '");');
else placeOrder(1, url);
}
else if (action == 1) {
if (url.length > 3 && url.substring(0, 3) == '?c=') url = 'process.aspx?c=go&url=' + escape(url);
top.location = url;
}
}