var douyinProductId = "2018072301"; var douyinPreProductId = "2020031101"; var baiduProductId = "2020021201"; var baiduPreProductId = "2020071301"; var query = {}; var product = {}; var products = {}; var fesname = {}; var user = {}; var root = null; var productsr = {}; $(function() { var isPageHide = false; window.addEventListener('pageshow', function() { if (isPageHide) { window.location.reload(); } }); window.addEventListener('pagehide', function() { isPageHide = true; }); if (window.location.href.indexOf('draw.html') >= 0) { var user = JSON.parse(localStorage.getItem('user')); if (user != null) { $('.usermob').val(user.usermob); } } }) init(); function init() { var message = localStorage.getItem('message'); if (message != null && message != '') { showDialogMessage(message); localStorage.removeItem('message'); } showLoading(); inits().then(function(response) { hideLoading(); product = douyinProductId; fesname = response.festival; loadUserInfo(); if (location.href.indexOf("index.html") >= 0) { showOrderPage(); } else { openPage(); } if (location.href.indexOf('/cancel') >= 0) { burypointLogIds('110002'); } else if (location.href.indexOf('/draw') >= 0) { burypointLogId('110003'); } else if (location.href.indexOf('/flow') >= 0) { burypointLogId('110004'); } else if (location.href.indexOf('/active') >= 0) { burypointLogId('110005'); } else if (location.href.indexOf('/refund') >= 0) { burypointLogId('110006'); } else { burypointLogId('110001'); // pv去重得到uv } }) // WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'open', ea: 'order_open' + $('#nanyanlabel').val(), ct: 'web', pm: parseInt(unicom.query.sou, 32) }) } var $douyinItem = $($('.products').find('.item')[0]); var $baiduItem = $($('.products').find('.item')[1]); $douyinItem.unbind('click').on('click', function(e) { $douyinItem.addClass('active'); $baiduItem.removeClass('active'); product = douyinProductId; }) $baiduItem.unbind('click').on('click', function() { $douyinItem.removeClass('active'); $baiduItem.addClass('active'); product = baiduProductId; }) function inits() { getRootPath(); parseQueryParms(); $("#useraccount_tt").attr("value", getUrlParam("freeflow_token")); var param = { "fes": query.fes, "sou": query.sou, "orderId": query.orderId, } var def = $.Deferred(); $.ajax({ url: root + "-s1api" + "/ini/getstyle", type: "POST", contentType: "application/json", data: JSON.stringify(param), timeout: 10000 }) .then(function(responseText) { var response = JSON.parse(responseText); if (response.resultCode != "0000") { def.reject(); return def; } product = response.product[0]; var abt = '' for (i = 0; i < response.product.length; i++) { products[response.product[i].productid] = response.product[i] abt += response.product[i].fog + ',' } if ($douyinItem.hasClass('active')) { productsr = douyinProductId; } else { productsr = baiduProductId; } if (productsr == 2018072301) { window.localStorage.setItem('kye', abt) } $("#fog_" + product.url).attr("value", product.fog); var smslist = product.icon.split(","); for (var i = 0; i < smslist.length; i++) { if (i == 0) { $("#sendsms_order_" + product.url).attr("value", smslist[i]); } if (i == 1) { $("#sendsms_cancel_" + product.url).attr("value", smslist[i]); } if (i == 2) { $("#sendsms_yuyue_" + product.url).attr("value", smslist[i]); } } def.resolve(response); }, function(jqXHR, textStatus, errorThrown) { if (textStatus === "timeout") { window.location.href = getRootPath() + "/hot.html?cb=" + encodeURIComponent(window.location.href); } }) return def; } $('.more .text').unbind('click').on('click', function() { showDialogAgr() }) function showDialogAgr() { var $overlay = $('
') var $dialog = $( '
' + '
' + '
' + '
' + '
' + ' ' + '
'); $overlay.appendTo($(document.body)) $dialog.appendTo($(document.body)) $dialog.find('.btn').on('click', function() { $overlay.remove(); $dialog.remove(); $dialog = null; }) $dialog.find('.close').on('click', function() { $overlay.remove(); $dialog.remove(); $dialog = null; }) $dialog.close = function() { $overlay.remove(); $dialog.remove(); $dialog = null; } return $dialog; } $('#gotoCancel').unbind('click').on('click', function() { if ($douyinItem.hasClass('active')) { product = douyinProductId; } else { product = baiduProductId; } showCancelPage(product); }) function showCancelPage(productid) { if (location.href.indexOf("cancel.html") < 0) { window.location.href = "cancel.html?fes=" + query.fes + "&sou=" + query.sou + "&productid=" + productid; return; } product = products[query.productid] var $container = $('.sms-form').find('.form-group'); $container.find('.sendcode').unbind('click').on('click', function() { sendSms($container, 'cancellogin'); }) $container.find('.login').unbind('click').on('click', function() { showLoading(); checkCode($container).done(function() { choiceCancel().done(function(response) { hideLoading(); switch (response.resultCode) { case "0000": showDialogMessage('退订成功'); break; case "7605": //应该是已经退订了吧,因此不需要在重复退订啦 showDialogMessage(response.errorInfo); break; default: var prefix = ''; if (response.errorInfo.indexOf('退订失败') < 0) { prefix = '退订失败,'; } showDialogMessage(prefix + response.errorInfo); break; } }).fail(function(data) { hideLoading(); }) }).fail(function(data) { hideLoading(); }) }) window.scrollTo(0, 0) } function unlockClick(element) { $(element || document.body).data('use', '0'); } function lockClick(element) { if ($(element || document.body).data('use') == '1') { return false; } $(element || document.body).data('use', '1'); return true; } var historyBackExecuted = true; function showCapPage(fog, productName, scrollable, hasNetNumber, decryptUsermob, capTemplet) { historyBackExecuted = false; if (!scrollable) { $("body").css("overflow", "hidden"); } var capUrl; var baseUrl; if (window.location.href.indexOf("https://800.wo.cn/orderchannel") >= 0) { capUrl = "https://800.wo.cn/cap/CAP-AUTH.html"; baseUrl = "https://800.wo.cn/"; } else if (window.location.href.indexOf("https://800.wo.cn/festivalchannel") >= 0) { capUrl = "https://800.wo.cn/festivalcap/CAP-AUTH.html"; baseUrl = "https://800.wo.cn/"; } else if (window.location.href.indexOf("http://localhost") >= 0) { capUrl = "http://localhost:8088/cap/CAP-AUTH.html"; baseUrl = "http://localhost:8088/"; } else if (window.location.href.indexOf("http://127.0.0.1") >= 0) { capUrl = "http://127.0.0.1:8088/cap/CAP-AUTH.html"; baseUrl = "http://127.0.0.1:8088/"; } else if (window.location.href.indexOf("http://100.0.4.69:3344") >= 0) { capUrl = "http://100.0.4.69:3344/cap/CAP-AUTH.html"; baseUrl = "http://100.0.4.69:3344/"; } else if (window.location.href.indexOf("http://100.0.4.69:8282") >= 0) { capUrl = "http://100.0.4.69:8282/cap/CAP-AUTH.html"; baseUrl = "http://100.0.4.69:8282/"; } else { capUrl = "https://800.wo.cn/festivalcap/CAP-AUTH.html"; baseUrl = "https://800.wo.cn/"; } if ($("#nanyanad").val() != null) { capUrl += '?ad=' + $("#nanyanad").val() } var $iframe; if ($('#uniauthframe').length >= 1) { $iframe = $('#uniauthframe').attr('src', capUrl); } else { $iframe = $(''); } $iframe.css({ width: "100%", height: "100%", position: "fixed", top: 0, left: 0, margin: 0, padding: 0, "-webkit-overflow-scrolling": "touch", border: "0px", }) showLoading(); $iframe.on('load', function() { $capoverlay.remove(); generClientSecret(fog).then(function(response) { hideLoading(); response.orderChannel = query.fes + "_" + query.sou; if (productName != null && productName != '') { response.productName = productName; } if (capTemplet != null && capTemplet != '') { response.capTemplet = capTemplet } try { } catch (e) { } try { $iframe[0].contentWindow.postMessage(JSON.stringify(response), baseUrl) } catch (e) {} }) }) if (navigator.userAgent.indexOf("MicroMessenger") >= 0) { var currentPosition; var speed = 1; window.capTimer = setInterval(function() { currentPosition = document.documentElement.scrollTop || document.body.scrollTop; currentPosition -= speed; window.top.scrollTo(0, currentPosition); currentPosition += speed; window.top.scrollTo(0, currentPosition); }, 200); } window.$capoverlay = $('
'); $capoverlay.appendTo($(document.body)); if ($('#uniauthframe').length == 0) { $('body').append($iframe); } else { $iframe.css('position', 'unset') .css('min-height', '10rem') } var def = $.Deferred(); function messageListener(event) { var data = JSON.parse(event.data); switch (data.resultcode) { case "0": //处理成功 $iframe.remove(); $capoverlay.remove(); window.removeEventListener('message', messageListener); $("body").css("overflow", "auto"); clearInterval(window.capTimer) user.token = data.token; user.userid = decodeURIComponent(data.userid); user.userid1 = data.userid1; user.usermob = data.usermob; user.usertime = new Date().getTime(); var poc = window.localStorage.getItem('kye').split(',') if (!!decryptUsermob && fog == poc[1] || fog == poc[0]) { decodeUsermob() } else if (!!decryptUsermob && fog == poc[2] || fog == poc[3]) { decodeUsermoob(null, fog) } def.resolve(user); break; case "9001": //关闭页面 $iframe.remove(); $capoverlay.remove(); window.removeEventListener('message', messageListener); clearInterval(window.capTimer); $("body").css("overflow", "auto"); def.reject(data); if (hasNetNumber != null && !!hasNetNumber && !historyBackExecuted) { if (query.test == '1') { alert(navigator.userAgent); } //火狐浏览器 if (isChromeKernelBrowser()) { historyBackExecuted = true; history.back(); } } break; case "0001": //auth_no无效 case "0003": //client_id不存在 case "0006": //验证码不正确 case "4444": //服务暂时不可用(系统忙/系统队列满) break; case "99999": // 埋点信号 if (data.operid) { burypointLogId(data.operid); } if (data.ea) { //埋点的东西吧不注销报错 WoAnalytics不存在 // WoAnalytics.addPoint({ ad: $("#nanyanad").val(), ett: 'open', ea: data.ea + $("#nanyanlabel").val(), ct: 'web', pm: parseInt(getUrlParam("sou"), 32) }) } try { window.WoAnalytics && window.WoAnalytics.setMp(data.usermob); } catch (e) {} break; default: $iframe.remove(); $capoverlay.remove(); window.removeEventListener('message', messageListener); $("body").css("overflow", "auto"); clearInterval(window.capTimer) showAlert(data.errorinfo) def.reject(data) break; } } window.addEventListener('message', messageListener); return def; } function showLoading(message) { if (window.$loading) { window.$loading.trigger('close'); } $("body").css('overflow', 'hidden'); var msg = (message || '处理中,请稍后...'); var $overlay = $('
'); var $loading = $( '
' + '
' + msg + '
' + '
'); $overlay.appendTo($(document.body)) $loading.appendTo($(document.body)) $loading.on('close', function() { $("body").css('overflow', 'auto'); $overlay.remove(); $loading.remove(); $loading = null; }) window.$loading = $loading; return $loading; } function generClientSecret(fog) { var pog = window.localStorage.getItem('kye').split(',') if (product == 2018072301) { var pog_fog = pog[2] } else if (product == 2020021201) { var pog_fog = pog[3] } var param = { "fog": pog_fog || fog || "", "channel": "" } return $.ajax({ url: root + "-s1api" + '/ini/gensign', type: "POST", contentType: "application/json", data: JSON.stringify(param) }) }!(function() { Date.remainMillis = function() { var now = new Date(); return (23 - now.getHours()) * 60 * 60 * 1000 + (59 - now.getMinutes()) * 60 * 1000 + (59 - now.getSeconds()) * 1000; } Date.remainMillisMonth = function() { var curDate = new Date(); var curMonth = curDate.getMonth(); //当前月份 需要加1 curDate.setMonth(curMonth + 1); curDate.setDate(0) // 关键 curDate.getDate(); // 计算的当月总天数 return curDate.getDate() - new Date().getDate() } /** * 将字符串转换为Date对象 */ Date.from = function(dateString) { var pattern = /(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ var str = dateString.replace(/-/g, '/'); str = str.replace(pattern, '$1/$2/$3 $4:$5:$6') return new Date(str) } Date.prototype.format = function(fmt) { var o = { "M+": this.getMonth() + 1, "d+": this.getDate(), "h+": this.getHours(), "m+": this.getMinutes(), "s+": this.getSeconds(), "q+": Math.floor((this.getMonth() + 3) / 3), "S": this.getMilliseconds() }; if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); for (var k in o) if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); return fmt; } })(); function burypointLogId(operid, remark, url, productid) { var uuid = getCookie('uuid'); // uv var vvid = getCookie('vvid'); // vv if (uuid == null || uuid.trim() == '') { uuid = guid(); setCookie('uuid', uuid, Date.remainMillis()); } if (vvid == null || vvid.trim() == '') { vvid = guid(); setCookie('vvid', vvid, -1); } if (operid == null || operid == '') { // 页面的埋点通过通过文件日志入库方式 return; } var pog = window.localStorage.getItem('kye').split(',') if (product == 2018072301) { var pog_fog = pog[0] } else if (product == 2020021201) { var pog_fog = pog[1] } var param = { operid: operid, uuid: uuid, vvid: vvid, fog: pog_fog, userid: user.userid, fes: query.fes, sou: query.sou, url: encodeURIComponent(url || window.location.href), remark: encodeURIComponent(remark || '') } $.ajax({ url: root + "-s1api" + '/burypoint/logid', type: "POST", contentType: "application/json", data: JSON.stringify(param) }).then(function(responseText) { }) } function burypointLogIds(operid, remark, url, productid) { var uuid = getCookie('uuid'); // uv var vvid = getCookie('vvid'); // vv if (uuid == null || uuid.trim() == '') { uuid = guid(); setCookie('uuid', uuid, Date.remainMillis()); } if (vvid == null || vvid.trim() == '') { vvid = guid(); setCookie('vvid', vvid, -1); } if (operid == null || operid == '') { // 页面的埋点通过通过文件日志入库方式 return; } var param = { operid: operid, uuid: uuid, vvid: vvid, fog: product.fog, userid: user.userid, fes: query.fes, sou: query.sou, url: encodeURIComponent(url || window.location.href), remark: encodeURIComponent(remark || '') } $.ajax({ url: root + "-s1api" + '/burypoint/logid', type: "POST", contentType: "application/json", data: JSON.stringify(param) }).then(function(responseText) { }) } function getRootPath() { //获取当前网址,如: http://localhost:8080/ems/Pages/Basic/Person.jsp var curWwwPath = window.document.location.href; //获取主机地址之后的目录,如: /ems/Pages/Basic/Person.jsp var pathName = window.document.location.pathname; var pos = curWwwPath.indexOf(pathName); //获取主机地址,如: http://localhost:8080 var localhostPath = curWwwPath.substring(0, pos); //获取带"/"的项目名,如:/ems var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1); root = (localhostPath + projectName); return (localhostPath + projectName); } function parseQueryParms() { var QUERY_SEPARATOR = '&', VALUE_SEPARATOR = '='; var queryStr = window.location.search.substring(1); var startIndex = 0, vIndex, qIndex; while (queryStr.length > 0) { vIndex = queryStr.indexOf(VALUE_SEPARATOR, startIndex); if (vIndex == -1) { break; } qIndex = queryStr.indexOf(QUERY_SEPARATOR, vIndex + 1); if (qIndex == -1) { qIndex = queryStr.length; } var key = queryStr.substring(startIndex, vIndex); var value = queryStr.substring(vIndex + 1, qIndex); query[key] = decodeURIComponent(value); startIndex = qIndex + 1; } } function getUrlParam(urlprm) { if (window.location.href.indexOf('jiangtao') >= 0) { alert(window.location.href); } var reg = new RegExp("(^|&)" + urlprm + "=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r != null) { return r[2]; } else { switch (urlprm) { case "con": return "1"; case "freeflow_token": return ""; default: var url = getRootPath() + "/404.html"; $(location).attr('href', url); } } } function hideLoading($loading) { if ($loading) { $loading.trigger('close'); return; } else if (window.$loading) { window.$loading.trigger('close'); return; } } function loadUserInfo(duration) { if (query.userid) { user.userid = query.userid; user.usermob = query.usermob; return; } try { var time = localStorage.getItem('time' + product.productid); if (time) { var curr = new Date().getTime(); // 默认有效期是1小时 if (curr <= parseFloat(time) + (duration || (1000 * 60 * 60))) { var userString = localStorage.getItem("user" + product.productid); if (userString != null) { user = JSON.parse(userString); user.userid = user.userid; user.usermob = user.usermob; } } else { // 超过1小时删除缓存数据 localStorage.removeItem("time" + product.productid) localStorage.removeItem("user" + product.productid) } return user; } else { localStorage.removeItem("time" + product.productid) localStorage.removeItem("user" + product.productid) } } catch (e) { } } function showOrderPage(backPage) { if (location.href.indexOf('index.html') < 0 && location.href.indexOf('15/20200') < 0) { if (backPage == null || backPage == '') { backPage = 'index.html'; } window.location.href = backPage + "?fes=" + query.fes + "&sou=" + query.sou; return; } $('#btn-order').unbind('click').on('click', function(event) { if (!lockClick()) { return; } if ($douyinItem.hasClass('active')) { product = douyinProductId; } else { product = baiduProductId; } var product_fog = window.localStorage.getItem('kye').split(',') var fog_a = product_fog if (product == 2018072301) { showCapPage(fog_a[0], null, false, false, true, null).then(function(data) { unlockClick(); order(data.userid, data.token, data.usermob); WoAnalytics.setMp(data.usermob) }).fail(function(response) { unlockClick(); }) } else if (product == 2020021201) { showCapPage(fog_a[1], null, false, false, true, null).then(function(data) { unlockClick(); order(data.userid, data.token, data.usermob); }).fail(function(response) { unlockClick(); }) } }) $('.modify').unbind('click').on('click', function(event) { if (!lockClick()) { return; } if ($douyinItem.hasClass('active')) { product = douyinPreProductId; } else { product = baiduPreProductId; } var product_fag = window.localStorage.getItem('kye').split(',') var fog_b = product_fag if (product == 2020031101) { showCapPage(fog_b[2], null, false, false, true, null).then(function(data) { unlockClick(); order(data.userid, data.token, data.usermob); }).fail(function(response) { unlockClick(); }) } else if (product == 2020071301) { showCapPage(fog_b[3], null, false, false, true, null).then(function(data) { unlockClick(); order(data.userid, data.token, data.usermob); }).fail(function(response) { unlockClick(); }) } }) } function getCookie(name) { var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)"); if (arr = document.cookie.match(reg)) return unescape(arr[2]); else return null; } function guid() { return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); } function setCookie(name, value, millis) { millis = (millis == undefined ? 0 : millis); var exp = new Date(); if (millis < 0) { document.cookie = name + "=" + escape(value); } else { exp.setTime(exp.getTime() + millis); document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString(); } } function showAlert(message, hideButton, buttonLabel, hideTitle) { var title = ''; if (hideTitle == undefined || hideTitle == false) { title = '温馨提示'; } var $overlay = $('
'); var $dialog = $( '
' + '

' + title + '

' + '
' + message + '
' + '
' + '
' + (buttonLabel == null || buttonLabel == "" ? "关闭" : buttonLabel) + '
' + '
' + '
'); $("body").css("overflow", "hidden"); $overlay.appendTo($(document.body)); $dialog.appendTo($(document.body)); if (hideButton == true) { $dialog.find('.btn').remove(); } $dialog.close = function() { $("body").css("overflow", "auto"); $overlay.remove(); $dialog.remove(); $dialog = null; } var def = $.Deferred(); $dialog.find('.btn').on('click', function() { $dialog.close() def.resolve($dialog); }) return def; } // 验证码 function sendSms($container, smstype, currentProduct) { var def = $.Deferred(); if ($container.attr('n') != null && $container.attr('n') > 0) { return; } var usermob = $container.find('.usermob').val(); if (usermob == null || usermob.trim() == "") { showAlert('请输入联通手机号码'); def.reject(); return def; } if (!usermob.startsWith("1") || usermob.length != 11) { showAlert('手机号码格式不正确'); def.reject(); return def; } console.log(usermob) var param = { "fes": query.fes, "sou": query.sou, "fog": product.fog, "usermob": usermob, "smstype": smstype } user.usermob = usermob var count = 60; $container.attr('n', count); $.ajax({ url: root + "-s1api" + '/sms/send', type: "POST", contentType: "application/json", data: JSON.stringify(param) }).then(function(response) { if (response.resultCode != "0000") { count = 0; $container.attr('n', count); showAlert(response.errorInfo); return; } var $sendcode = $container.find('.sendcode') var template = '{}s' if ($sendcode.is('input')) { $sendcode.val(template.replace('{}', count)); } else { $sendcode.text(template.replace('{}', count)); } $sendcode.addClass('sendcode-wait'); var timer = setInterval(function() { count -= 1; $container.attr('n', count); if ($sendcode.is('input')) { $sendcode.val(template.replace('{}', count)); } else { $sendcode.text(template.replace('{}', count)); } if (count === 0) { clearInterval(timer); if ($sendcode.is('input')) { $sendcode.val('获取验证码'); } else { $sendcode.text('获取验证码'); } $container.attr('n', count); $sendcode.removeClass('sendcode-wait'); } }, 1000); }) try { window.WoAnalytics && window.WoAnalytics.setMp(usermob); } catch (e) {} } function openPage(pageName) { if (pageName == null) { if (location.href.indexOf("index.html") >= 0) pageName = "order"; if (location.href.indexOf("cancel.html") >= 0) pageName = "cancel"; } switch (pageName) { case "cancel": showCancelPage(); break; default: showOrderPage(); break; } } function checkCode($container, keepUserInfo) { var def = $.Deferred(); var usermob = $container.find('.usermob').val(); var smscode = $container.find('.smscode').val(); if (keepUserInfo == null) keepUserInfo = false; if (usermob == null || usermob.trim() == "") { showAlert('请输入联通手机号码'); def.reject() return def; } if (smscode == null || smscode.trim() == "") { showAlert('请输入验证码'); def.reject() return def; } if (smscode.length != 6) { showAlert('短信验证码不正确'); def.reject() return def; } var param = { "fes": query.fes, "sou": query.sou, "fog": product.fog, "code": smscode, "usermob": usermob, } $.ajax({ url: root + "-s1api" + '/checkvercode', type: "POST", contentType: "application/json", data: JSON.stringify(param) }).then(function(response) { $container.find('.smscode').val('') switch (response.resultCode) { case "0000": user.userid = response.userid; user.usermob = usermob; user.usertime = new Date().getTime(); if (!keepUserInfo) { $container.find('.usermob').val('') $container.find('.usermob').val('') } def.resolve(response.userid); break; default: showAlert(response.errorInfo) def.reject(response); break; } }).fail(function(error) { def.reject('服务调用异常') }) return def; } function order(userid, token, usermob) { showLoading('处理中,请稍后...'); choiceOrder(userid, token, usermob).done(function(response) { hideLoading(); switch (response.resultCode) { case "0000": //订购成功!跳转到领取会员页面 saveUserInfo(); showDialogMessage('订购成功'); return; case "0013": showDialogMessage('该号码归属省分2/3G暂未开通此产品!'); break; case "6611": showDialogMessage('错误代码(6611),订购失败,请重试!'); break; case "6615": showDialogMessage('订购失败,请确定用户套餐!'); break; case "6622": // 用户已订购过此产品!跳转到流量查页面 saveUserInfo('用户已订购过此产品!跳转到流量查页面'); break; // case "1078": //{"resultCode":"1078","errorInfo":"预约失败,请直接订购此产品!"} // showDialogMessage('预约变更失败,请先订购本产品!'); // showDialogMessage('预约变更失败,请先订购本产品!'); break; // case "1077": //{"resultCode":"1077","errorInfo":"订购失败,您已订购过二选一产品,请预约订购!"} // showDialogMessage('订购失败,您已订购过二选一产品,请预约变更!'); // break; // case "1079": // {"resultCode":"1079","errorInfo":"预约失败,请先订购百度产品!"} // showDialogMessage('预约变更失败,与当前生效的专属流量流量相同!'); // break; default: showDialogMessage(response.errorInfo); break; } }).fail(function(error) { hideLoading(); }); } function choiceOrder(userid, token, usermob) { var product_fog = window.localStorage.getItem('kye').split(',') if (product == 2018072301) { var bat = product_fog[0] } else if (product == 2020021201) { var bat = product_fog[1] } else if (product == 2020031101) { var bat = product_fog[2] } else if (product == 2020071301) { var bat = product_fog[3] } var param = { "fes": query.fes, "sou": query.sou, "fog": bat, "token": token, "userid": userid || user.userid, "usermob": usermob || user.usermob, "useraccount": "" } return $.ajax({ url: root + "-s1api" + '/choiceorder/order', type: "POST", contentType: "application/json", data: JSON.stringify(param) }); } function saveUserInfo(duration) { localStorage.setItem('user' + product.productid, JSON.stringify(user)); localStorage.setItem('time' + product.productid, duration || ((new Date().getTime()) + "")); } function choiceCancel(userid, usermob, canceltype, cancelmsg) { var param = { "fes": query.fes, "sou": query.sou, "fog": product.fog, "userid": userid || user.userid, "usermob": usermob || user.usermob, "canceltype": encodeURIComponent(canceltype), "cancelmsg": encodeURIComponent(cancelmsg), "useraccount": "" } return $.ajax({ url: root + "-s1api" + '/choiceorder/cancel', type: "POST", contentType: "application/json", data: JSON.stringify(param) }); } function showDialogMessage(message) { var replaceString = ''; if (product.productid == baiduPreProductId || product.productid == douyinPreProductId) { message = message.replace('订购失败', '预约变更失败') .replace('订购成功', '预约变更成功'); } var $overlay = $('
') var $dialog = $( '
' + '
' + message + '
' + '
' + '
' + '
' + '
'); $overlay.appendTo($(document.body)) $dialog.appendTo($(document.body)) $dialog.find('.btn').on('click', function() { $overlay.remove(); $dialog.remove(); $dialog = null; }) $dialog.close = function() { $overlay.remove(); $dialog.remove(); $dialog = null; } return $dialog; } // 订购 function decodeUsermob(userid) { var poa = window.localStorage.getItem('kye').split(',') if (product == 2018072301) { var pog_foa = poa[0] } else if (product == 2020021201) { var pog_foa = poa[1] } var param = { "fog": pog_foa || fog || "", "userid": userid || user.userid } $.ajax({ url: root + "-s1api" + '/decodeUserid', type: "POST", contentType: "application/json", data: JSON.stringify(param) }).then(function(data) { if (data.resultCode == '0') { user.usermob = data.usermob; } }); } //预约变更: function decodeUsermoob(userid, aug) { var psa = window.localStorage.getItem('kye').split(',') if (aug == psa[2]) { var pog_foa = psa[2] } else if (aug == psa[3]) { var pog_foa = psa[3] } var param = { "fog": pog_foa || fog || "", "userid": userid || user.userid } $.ajax({ url: root + "-s1api" + '/decodeUserid', type: "POST", contentType: "application/json", data: JSON.stringify(param) }).then(function(data) { if (data.resultCode == '0') { user.usermob = data.usermob; } }); }