import * as compnt from "../../../public/js/compnt";
import * as unicom from "../../../public/js/unicom.js";
import * as weibo from "./weibo.js";
import "../scss/main.scss";
weibo.checkClientEnvironment();
compnt.showLoading();
var message = localStorage.getItem('message');
if (message != null && message != '') {
compnt.showAlert(message);
localStorage.removeItem('message');
}
$('#btn-cancel').unbind('click').on('click', function() {
showCancelReasonPage().done(function(cancelReason) {
var k = JSON.stringify(cancelReason)
window.localStorage.setItem('kye', k)
showCancelPage()
})
})
$('#btn-draw').unbind('click').on('click', function() {
if (!checkEquip('draw')) return;
showDrawPage();
})
$('#btn-active').unbind('click').on('click', function() {
if (!checkEquip('active')) return;
showActivePage();
})
if (weibo.app.weibo) {
function bridgeReady() {
if (weibo.checkWeiboVersion()) {
weibo.getUserInfo().then(function() {
init();
}).fail(function(data) {
init();
});
} else {
weibo.getUserInfo();
init();
}
}
if (window.WeiboJSBridge) {
bridgeReady();
} else {
document.addEventListener('WeiboJSBridgeReady', function() {
bridgeReady();
});
}
} else {
// 不的app中
// 1、如果没有fes和sou参数
// 2、code
init();
}
function showCancelReasonPage() {
var reasonUrl;
var baseUrl;
if (window.location.href.indexOf("https://800.wo.cn/orderchannel") >= 0) {
reasonUrl = "https://800.wo.cn/orderchannel/public/libs/cancelreason/index.html";
baseUrl = "https://800.wo.cn/";
} else if (window.location.href.indexOf("https://800.wo.cn/festivalchannel") >= 0) {
reasonUrl = "https://800.wo.cn/festivalchannel/public/libs/cancelreason/index.html";
baseUrl = "https://800.wo.cn/";
} else if (window.location.href.indexOf("http://localhost") >= 0) {
reasonUrl = "http://localhost:8088/orderchannel/public/libs/cancelreason/index.html";
baseUrl = "http://localhost:8088/";
} else if (window.location.href.indexOf("http://127.0.0.1") >= 0) {
reasonUrl = "http://127.0.0.1:8088/orderchannel/public/libs/cancelreason/index.html";
baseUrl = "http://127.0.0.1:8088/";
} else if (window.location.href.indexOf("http://100.0.4.69:3344") >= 0) {
reasonUrl = "http://100.0.4.69:3344/orderchannel/public/libs/cancelreason/index.html";
baseUrl = "http://100.0.4.69:3344/";
} else if (window.location.href.indexOf("http://100.0.4.69:8282") >= 0) {
reasonUrl = "http://100.0.4.69:8282/orderchannel/public/libs/cancelreason/index.html";
baseUrl = "http://100.0.4.69:8282/";
} else {
reasonUrl = "https://operation1.bol.wo.cn/orderchannel/public/libs/cancelreason/index.html";
baseUrl = "https://operation1.bol.wo.cn/";
}
window.$capoverlay = $('
');
$capoverlay.appendTo($(document.body));
$("body").css("overflow", "hidden");
var $iframe;
if ($('#reasonIframe').length >= 1) {
$iframe = $('#reasonIframe').attr('src', reasonUrl);
} else {
$iframe = $('');
$('body').append($iframe);
}
$iframe.css({
width: "100%",
height: "100%",
position: "fixed",
top: 0,
left: 0,
margin: 0,
padding: 0,
"-webkit-overflow-scrolling": "touch",
border: "0px",
"z-index": 111,
});
var def = $.Deferred();
function messageListener(event) {
var data = JSON.parse(event.data);
$iframe.remove();
$capoverlay.remove();
$("body").css("overflow", "auto");
window.removeEventListener('message', messageListener);
if (data.eventtype != 'close') {
def.resolve(data)
} else {
def.reject(data)
}
}
window.addEventListener('message', messageListener);
return def;
}
function init() {
unicom.init().then(function(response) {
unicom.product = response.product[0];
unicom.fesname = response.festival;
loadUserInfo();
// compnt.showAlert(JSON.stringify(unicom.user))
// compnt.showAlert(weibo.uid)
// weibo.uid = "2245755811"; // 未订购
// weibo.uid = "5345323620"; // 已经订购
if (location.href.indexOf("index.html") >= 0) {
if (unicom.user.userid) {
openPage("flow");
} else if (weibo.uid) {
unicom.queryMember(null, null, weibo.uid).then(function(response) {
if (response.resultCode == "0000") {
unicom.user.userid = response.userid;
// 已经领取微博会员的手机号码
unicom.user.usermob = response.usermob;
unicom.user.usertime = new Date().getTime();
showFlowPage(response);
compnt.hideLoading();
}
}).fail(function() {
// compnt.showAlert("asdasd");
});
}
compnt.hideLoading();
showOrderPage();
} else {
openPage(unicom.query.page);
compnt.hideLoading();
}
/*unicom.user.userid = "18674842761";
unicom.user.usermob = '17610768237'
showFlowPage();*/
if (location.href.indexOf('/cancel') >= 0) {
unicom.burypointLogId('110002'); // 退订页面pv, pv去重得到uv
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'open', ea: 'cancel_open' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
} else if (location.href.indexOf('/draw') >= 0 ||
location.href.indexOf('/weibo1') >= 0) {
unicom.burypointLogId('110003'); // 领取页面pv, pv去重得到uv
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'open', ea: 'draw_open' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
} else if (location.href.indexOf('/flow') >= 0) {
unicom.burypointLogId('110004'); // 流量查询pv, pv去重得到uv
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'open', ea: 'flow_open' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
} else if (location.href.indexOf('/active') >= 0) {
unicom.burypointLogId('110005'); // 激活页面pv, pv去重得到uv
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'open', ea: 'active_open' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
} else if (location.href.indexOf('/refund') >= 0) {
unicom.burypointLogId('110006'); // 退款
} else {
unicom.burypointLogId('110001'); // 订购页面pv, pv去重得到uv
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'open', ea: 'order_open' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
}
}).fail(function() {
compnt.hideLoading();
})
}
function openPage(pageName) {
switch (pageName) {
case "active":
showActivePage();
break;
case "cancel":
showCancelPage();
break;
case "draw":
weibo.getUserInfo().then(function() {
document.getElementById('name').innerHTML = weibo.screen_name
})
showDrawPage();
break;
case "flow":
showFlowPage();
break;
default:
showOrderPage();
break;
}
}
function loadUserInfo() {
if (unicom.query.userid) {
unicom.user.userid = unicom.query.userid;
unicom.user.usermob = unicom.query.usermob;
return;
}
try {
var time = localStorage.getItem('time');
if (time) {
var curr = new Date().getTime();
if (curr <= parseFloat(time) + (1000 * 60 * 60)) {
var userString = localStorage.getItem("user");
var user = JSON.parse(userString);
unicom.user.userid = user.userid;
unicom.user.usermob = user.usermob;
if (unicom.user.usermob == "18674842761") {
setTimeout(function() {
alert(time + (1000 * 60 * 60))
}, 100);
}
} else {
localStorage.removeItem("time")
localStorage.removeItem("user")
}
}
} catch (e) {
}
}
/**
* 显示流量查询页面
*/
function showFlowPage() {
if (location.href.indexOf("flow.html") < 0) {
window.location.href = "flow.html?fes=" +
unicom.query.fes + "&sou=" + unicom.query.sou + "&F=" + unicom.query.F +
"&userid=" + unicom.user.userid + "&usermob=" + unicom.user.usermob +
"&usertime=" + (unicom.user.usertime || (new Date().getTime())) + "&page=flow";
return;
}
if (localStorage.getItem('action') == 'draw') {
if (!checkEquip('draw')) return;
unicom.can(weibo.uid).then(function(response) {
if (response.resultCode == "0000") {
draw();
}
});
localStorage.removeItem('action');
}
var $container = $('#section-flow');
$container.find('.phone').html('流量专属号码:' + unicom.user.usermob);
queryFlow();
$container.find('.btn').unbind('click').on('click', function(event) {
if (!compnt.lockClick()) {
return;
}
queryFlow().then(function(message) {
compnt.unlockClick()
if (message != null && message != "") {
compnt.showAlert(message);
}
});
})
$container.find('.member a').unbind('click').on('click', function() {
if (!checkEquip('draw')) return;
// alert(weibo.screen_name)
// 如果有用户号码,直接打开领取会员二次确认的提示
unicom.can(weibo.uid).then(function(response) {
switch (response.resultCode) {
case "0000":
if (unicom.user.userid) {
draw();
} else {
showDrawPage();
}
break;
case "1003":
compnt.showAlert('当前微博账号已开通了新浪微博包月会员,请切换领取会员的账号~');
break;
default:
compnt.showAlert(response.resultInfo);
break;
}
});
})
if (weibo.app.weibo && weibo.checkWeiboVersion() && (weibo.uid == null || weibo.uid == '')) {
weibo.getUserInfo().then(function() {
unicom.queryMember().then(function(response) {
showMemberInfo(response)
});
})
} else {
unicom.queryMember().then(function(response) {
showMemberInfo(response)
});
}
function showMemberInfo(response) {
switch (response.resultCode) {
case "0000":
switch (response.sync_code) {
case "0": // 订购关系退订同步成功
case "2": // 订购关系订购同步成功
if (response.screen_name) {
$container.find('.member').html('微博账号:' + decodeURIComponent(response.screen_name));
} else {
$container.find('.member').html('微博会员:已领取');
}
$container.find('.vflag').css({ "display": "block" });
$container.find('.member a').unbind('click');
weibo.active(); // 静默激活
break;
default:
$container.find('.member a').html('请点此领取微博会员');
// 隐藏微博会员图标
$container.find('.vflag').css({ "display": "none" })
break;
}
break;
case "1015": //{"resultCode":"1015","errorInfo":"用户未订购此产品!"}
compnt.showAlert("未订购此产品!").then(function(message) {
localStorage.removeItem('time');
localStorage.removeItem('user')
showOrderPage();
$container.find('.phone').html('用户未订购此产品!');
});
break;
default:
break;
}
}
}
/**
* 查询用户剩余流量
*/
function queryFlow() {
var $container = $('#section-flow');
var def = $.Deferred();
unicom.queryFlow().then(function(response) {
switch (response.resultCode) {
case "0000":
var surplus = compnt.returnFloat(JSON.parse(response.data).surplusFlow / 1024 / 1024);
$container.find('.suplus').html('本月剩余
' + surplus + 'GB');
var usedFlowKb = parseInt(JSON.parse(response.data).usedFlow);
if (usedFlowKb > 0 && usedFlowKb < 1024) {
def.resolve("剩余流量更新成功,为您免流了" + usedFlowKb + "KB~");
} else if (usedFlowKb > 1024) {
var useedFlow = compnt.returnFloat(usedFlowKb / 1024);
def.resolve("剩余流量更新成功,为您免流了" + useedFlow + "MB~");
} else {
def.resolve("剩余流量更新成功~");
}
break;
case "9201": //{"resultCode":"9201","errorInfo":"查询失败,请检查是否有订购关系!"}
def.resolve("您未订购新浪微博畅想会员畅想包~")
$container.find('.phone').html('用户未订购此产品!');
break;
case "9203": //{"resultCode":"9203","errorInfo":"流量查询失败,没有获取到用户所使用流量信息!"}
//compnt.showAlert("没有获取到用户所使用流量信息!");
def.resolve("剩余流量更新成功~")
$container.find('.suplus').html('本月剩余
10.00GB');
break;
default:
break;
}
})
return def;
}
/**
* 打开退订页面
*/
function showCancelPage() {
var cancelReason = JSON.parse(window.localStorage.getItem('kye'))
if (location.href.indexOf("cancel.html") < 0) {
window.location.href = "cancel.html?fes=" + unicom.query.fes + "&sou=" +
unicom.query.sou + "&F=" + unicom.query.F + '&page=cancel';
return;
}
var $container = $('#section-cancel').find('.form-group');
$container.find('.sendcode').unbind('click').on('click', function() {
unicom.sendSms($container, 'cancellogin');
//unicom.sendSms($container, '212');
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_click_send_sms_code_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
})
$container.find('.login').unbind('click').on('click', function() {
compnt.showLoading();
unicom.checkCode($container).then(function() {
unicom.cancel(null, null, cancelReason.canceltype, cancelReason.cancelmsg).then(function(response) {
compnt.hideLoading();
switch (response.resultCode) {
case "0000":
compnt.showAlert('退订成功').then(function(message) {
window.localStorage.clear()
showFlowPage();
});
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_success' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
break;
case "7605": //应该是已经退订了吧,因此不需要在重复退订啦
compnt.showAlert(response.errorInfo).then(function(message) {
showFlowPage();
});
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
break;
default:
var prefix = '';
if (response.errorInfo.indexOf('退订失败') < 0) {
prefix = '退订失败,';
}
compnt.showAlert(prefix + response.errorInfo);
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
break;
}
}).fail(function(data) {
compnt.hideLoading();
})
}).fail(function(data) {
compnt.hideLoading();
})
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_click_confirm_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
})
window.scrollTo(0, 0)
}
/**
* 打开领取会员的页面
* 在客户端中才能领取会员
*/
function showDrawPage() {
if (location.href.indexOf("draw.html") < 0 &&
location.href.indexOf("weibo1.html") < 0) {
window.location.href = "draw.html?fes=" + unicom.query.fes + "&sou=" +
unicom.query.sou + "&F=" + unicom.query.F + '&page=draw';
return;
}
var $container = $('#section-draw').find('.form-group');
compnt.showLoading();
unicom.queryMember(null, null, weibo.uid).then(function(response) {
if (response.resultCode == "0000") {
switch (response.sync_code) {
case "0": // 订购关系退订同步成功
case "2": // 订购关系订购同步成功
localStorage.setItem("message", "当前微博账号已经领取了会员~");
unicom.user.userid = response.userid;
unicom.user.usermob = response.usermob;
unicom.user.usertime = new Date().getTime();
showFlowPage();
break;
}
} else {
unicom.can(weibo.uid).then(function(response) {
compnt.hideLoading();
var hasMonthVip = false;
switch (response.resultCode) {
case "0000":
hasMonthVip = false;
break;
case "1003":
compnt.showAlert('当前微博账号已开通了新浪微博包月会员,请切换领取会员的账号~');
hasMonthVip = true;
break;
default:
compnt.showAlert(response.resultInfo);
break;
}
$container.find('.sendcode').unbind('click').on('click', function() {
if (!checkEquip()) return;
if (hasMonthVip) {
compnt.showAlert('当前微博账号已开通了新浪微博包月会员,请切换领取会员的账号~');
return;
}
unicom.sendSms($container, 'drawlogin');
// unicom.sendSms($container, '210');
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'draw_click_send_sms_code_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
})
$container.find('.login').unbind('click').on('click', function() {
if (hasMonthVip) {
compnt.showAlert('当前微博账号已开通了新浪微博包月会员,请切换领取会员的账号~');
return;
}
unicom.checkCode($container).then(function() {
draw()
})
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'draw_click_confirm_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
})
}).fail(function(error) {
// alert(JSON.stringify(error))
})
}
})
}
function draw() {
var $dialog = showConfirmDialog();
$dialog.find('.btn-no').on('click', function() {
compnt.showAlert('请切换登录的微博账号后,再领取会员')
})
$dialog.find('.btn-ok').on('click', function(event) {
if (!compnt.lockClick()) return;
unicom.drawMember(weibo.uid, weibo.screen_name).then(function(response) {
compnt.unlockClick();
switch (response.resultCode) {
case "0000":
weibo.active(); // 领取成功,静默激活
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'draw_success' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
compnt.showAlert('微博会员领取成功!').then(function() {
showFlowPage();
});
break;
case "1020":
// 已经领取,领取的账号与当前微博账号一致,静默激活
unicom.queryMember().then(function(response) {
if (response.resultCode == "0000") {
if (response.uid == weibo.uid) {
weibo.active();
compnt.showAlert('已领取过会员~').then(function(message) {
showFlowPage();
});
} else { // 领取到了其他微博账号
compnt.showAlert('该手机号已将会员领取到其他微博账号~')
}
} else { // 查询失败
compnt.showAlert('已领取过会员~');
}
}).fail(function() {
// 查询失败
compnt.showAlert('已领取过会员~');
})
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'draw_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
break;
default:
compnt.showAlert('领取失败,' + response.errorInfo);
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'draw_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
break;
}
}).fail(function() {
compnt.unlockClick();
});
})
}
/**
* 打开激活免流的页面
* 客户端中才能激活
*/
function showActivePage() {
if (location.href.indexOf("active.html") < 0) {
window.location.href = "active.html?fes=" + unicom.query.fes + "&sou=" +
unicom.query.sou + "&F=" + unicom.query.F + "&page=active";
return;
}
var $container = $('#section-active').find('.form-group');
$container.find('.sendcode').unbind('click').on('click', function() {
if (!checkEquip('active')) return;
unicom.sendSms($container, 'activelogin');
//unicom.sendSms($container, '209');
})
$container.find('.login').unbind('click').on('click', function(event) {
if (!checkEquip('active')) return;
if (!compnt.lockClick()) {
return;
}
unicom.checkCode($container).then(function() {
compnt.unlockClick()
active()
}).fail(function() {
compnt.unlockClick();
});
})
window.scrollTo(0, 0)
}
function checkEquip(action) {
if (action == 'active') {
if (!weibo.app.weibo) {
compnt.showAlert('请到新浪微博客户端中激活免流~')
return false;
}
if (!weibo.checkWeiboVersion()) {
compnt.showAlert('请到升级到最新版新浪微博客户端后激活免流~')
return false;
}
} else {
if (!weibo.app.weibo && !unicom.query.code) {
compnt.showAlert('请到新浪微博客户端中领取会员激活免流~')
return false;
}
if (!weibo.checkWeiboVersion() && !unicom.query.code) {
compnt.showAlert('请到升级到最新版新浪微博客户端后领取会员激活免流~')
return false;
}
}
return true;
}
function active() {
unicom.queryMember().then(function(response) {
switch (response.resultCode) {
case "0000":
break;
case "0002":
compnt.showAlert('激活失败,未领取新浪微博会员~');
return;
default:
compnt.showAlert('激活失败,未领取新浪微博会员~');
return;
}
if (weibo.uid != response.uid) {
compnt.showAlert('激活失败,激活免流的微博账号与领取会员的微博账号不一致~');
return;
}
switch (response.sync_code) {
case "0": // 订购关系退订同步成功
case "2": // 订购关系订购同步成功
weibo.active().then(function() {
//checkActiveResult();
compnt.showAlert('激活成功').then(function() {
localStorage.setItem('user', JSON.stringify(unicom.user));
localStorage.setItem('time', new Date().getTime());
showFlowPage();
});
})
break;
case "1": // 订购关系退订同步失败
case "3": // 订购关系订购同步失败
compnt.showAlert("请领取会员以后再进行激活操作~");
break;
}
});
}
/**
* 打开订购页面
*/
function showOrderPage() {
$('.section-banner').removeClass('section-banner-small');
$('#btn-order').unbind('click').on('click', function(event) {
if (!compnt.lockClick()) {
//alert(1)
return;
}
unicom.showCapPage().then(function(data) {
compnt.unlockClick();
order(data.userid, data.token, data.usermob);
}).fail(function(response) {
compnt.unlockClick();
})
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_click_order_btn' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) })
})
}
/**
* 订购
*/
function order(userid, token, usermob) {
compnt.showLoading();
unicom.order(userid, token, usermob).then(function(response) {
// console.log(response)
compnt.hideLoading();
switch (response.resultCode) {
case "0000": //订购成功!跳转到领取会员页面
// compnt.showAlert('unicom.user.userid:' + unicom.user.userid)
// var versionFulfil = weibo.checkWeiboVersion();
// alert('checkWeiboVersion()' + versionFulfil);
localStorage.setItem('user', JSON.stringify(unicom.user));
localStorage.setItem('time', new Date().getTime());
// 客户端中进入领取页面,非客户端中,提示用户到客户端中去领取
if (weibo.app.weibo && weibo.checkWeiboVersion()) {
// 如果有用户号码,直接打开领取会员二次确认的提示
compnt.showAlert('订购成功~').then(function(message) {
localStorage.setItem('action', 'draw');
showFlowPage();
});
} else {
compnt.showAlert('订购成功,请到新浪微博客户端中领取会员开启免流~').then(function() {
showFlowPage();
})
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_success' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) });
return;
}
break;
case "0013":
showOrderDialog('该号码归属省分2/3G暂未开通此产品!');
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) });
break;
case "6611":
showOrderDialog('错误代码(6611),' + '订购失败,请重试!');
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) });
break;
case "6615":
showOrderDialog('订购失败,请确定用户套餐!');
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) });
break;
case "6622": // 用户已订购过此产品!跳转到流量查页面
localStorage.setItem('message', '您已经订购了本产品~');
localStorage.setItem('user', JSON.stringify(unicom.user));
localStorage.setItem('time', new Date().getTime());
showFlowPage();
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) });
break;
case "6634": // 用户已订购过此产品!跳转到流量查页面
localStorage.setItem('message', '您已经订购了本产品~');
localStorage.setItem('user', JSON.stringify(unicom.user));
localStorage.setItem('time', new Date().getTime());
showFlowPage();
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) });
break;
default:
showOrderDialog(response.errorInfo);
WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'order_failure' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) });
break;
}
}).fail(function(error) {});
}
function showOrderDialog(message) {
var $overlay = $('');
var $dialog = $(
'' +
'
' +
'
![](images/face-sad.png)
' +
'
' +
'
对不起,订购失败!
' +
'
' + message + '
' +
'
我知道了
' +
'
');
$overlay.appendTo($(document.body))
$dialog.appendTo($(document.body))
$dialog.find('.btn').unbind('click').on('click', function() {
$dialog.close()
})
$dialog.close = function() {
$overlay.remove();
$dialog.remove();
$dialog = null;
}
return $dialog;
}
function showConfirmDialog() {
var message = '确认将新浪微博会员领取到您当前登录的账号中吗?';
if (weibo.screen_name) {
message = '请确认将新浪微博会员领取到账号:' + weibo.screen_name
}
var $overlay = $('');
var $dialog = $(
'' +
'
领取会员
' +
'
' + message + '
' +
'
' +
'
');
$overlay.appendTo($(document.body))
$dialog.appendTo($(document.body))
$dialog.find('.btn').on('click', function() {
$dialog.close()
})
$dialog.close = function() {
$overlay.remove();
$dialog.remove();
$dialog = null;
}
return $dialog;
}