import * as compnt from "../../../public/js/compnt.js"; import * as unicom from "../../../public/js/unicom.js"; import "../scss/seasonpkg.scss"; import "../../../public/scss/unicom.scss"; init(); function init() { compnt.showLoading(); unicom.init().then(function(response) { compnt.hideLoading(); unicom.setProduct(response.product[0]); unicom.setFesname(response.festival); // alert(JSON.stringify(unicom.query)) if (!!unicom.query.tradeno) { showPayQueryDialog(); } bindSend(); bindOrder(); if (location.href.indexOf('/cancel') >= 0) { unicom.burypointLogId('110002');// 退订页面pv, pv去重得到uv } else if (location.href.indexOf('/draw') >= 0) { unicom.burypointLogId('110003');// 领取页面pv, pv去重得到uv } else if (location.href.indexOf('/flow') >= 0) { unicom.burypointLogId('110004');// 流量查询pv, pv去重得到uv } else if (location.href.indexOf('/active') >= 0) { unicom.burypointLogId('110005');// 激活页面pv, pv去重得到uv } else { // location.href.indexOf('/index') >= 0 // location.href.indexOf('/order') >= 0 unicom.burypointLogId('110001');// 订购页面pv, pv去重得到uv } }) bindShowAgr(); } function bindSend() { // @ts-ignore var $container = $('.section-login').find('.form-group'); $container.find('.sendcode').unbind('click').on('click', function () { unicom.sendSms($container, 'orderlogin'); }) } function bindOrder() { // @ts-ignore var $container = $('.section-login').find('.form-group'); $container.find('.login').unbind('click').on('click', function () { compnt.showLoading(); unicom.checkCode($container).then(function() { unicom.orderBack().then(function(response) { // console.log(response) compnt.hideLoading(); var data = response; switch (data.resultCode) { case "0000": // compnt.showAlert('领取成功'); // window.location.reload(); // alert(data.web_url + '&redirect_url=' + encodeURIComponent(window.location.href + '&tradeno=' + data.out_trade_no)); data.tradedate = unicom.getNowFormatDate(); data.userid = unicom.user.userid; pay(data); break; default: compnt.showAlert(response.errorInfo); break; } }).catch(data => { compnt.hideLoading(); }) }).catch(data => { compnt.hideLoading(); }) }) } function bindShowAgr() { $('#btn-showagr').on('click', function() { showAgr(); }) } function showAgr() { var $overlay = $('
'); var $dialog = $( '
' + '
' + ' ' + '
' + '
' + ' ' + '
' + '
' + '
    ' + '
  • 01
    ' + '

    符合订购约定的中国联通手机(除冰激凌套餐、懂我卡)4G套餐用户均可订购“今日头条定向流量10GB季包(后向)”。其中,4G套餐中的全国共享组合套餐、4G全国套餐主副卡用户和智慧沃家共享套餐中手机用户等共享类套餐用户的手机号码不共享后向定向流量包。手机套餐中流量资费、流量使用规则另有约定的,按照手机套餐执行。

    ' + '
  • ' + '
  • 02
    ' + '

    今日头条定向流量包购买后立即生效,连续三个月每月可享受10GB免流服务,订购当月立即到账,次月起每月1日到账,月底自动清零,无法结转。

    ' + '
  • ' + '
  • 03
    ' + '

    因该产品为流量包充值,一旦季包订购成功后不可退订。

    ' + '
  • ' + '
  • 04
    ' + '

    “今日头条定向流量月包(前向)”和“今日头条定向流量季包(后向)”两者可以叠加订购;叠加订购时,先消耗“今日头条定向流量月包(前向)”中的定向流量,再消耗“今日头条定向流量季包(后向)”中的定向流量,都超出后按照用户所选套餐资费或标准资费及联通公司已审批备案公示的资费标准收取。

    ' + '
  • ' + '
  • 05
    ' + '

    用户须处于正常可用状态下才可订购,处于紧急停机(挂失)、欠费停机、停机保号等状态的后付费用户及处于未激活器、充值期、锁定期的预付费用户不可办理。

    ' + '
  • ' + '
  • 06
    ' + '

    UNINET、3GNET 、WONET接入点访问能使用该定向流量,其他接入点不能免流使用。

    ' + '
  • ' + '
  • 07
    ' + '

    国内指中国内地,不包含港、澳、台地区。

    ' + '
  • ' + '
  • 08
    ' + '

    用户成功订购该头条系流量包后,如果遇到页面提示不免流,敬请忽略,正常使用。

    ' + '
  • ' + '
  • 09
    ' + '

    用户在该季包生效期间变更套餐、升级5G套餐、或处于紧急停机(挂失)、欠费停机、停机保号等状态可能会发生次月开通失败,开通失败后系统将发起退费请注意查收短信。

    ' + '
  • ' + '
' + '
' + '
' ) $overlay.appendTo($(document.body)) $dialog.appendTo($(document.body)) $dialog.find('img[name="closeBtn"]').on('click', function() { $dialog.close(); }) $dialog.close = function () { $overlay.remove(); $dialog.remove(); $dialog = null; } } function showPayQueryDialog() { var $overlay = $('
'); var $dialog = $( '
' + '
' + ' 请确认微信支付是否已完成' + '
' + '
' + ' 已完成支付' + '
' + '
' + ' 支付遇到问题,重新支付' + '
' + '
'); $overlay.appendTo($(document.body)) $dialog.appendTo($(document.body)) $dialog.find('span[name="finishspan"]').on('click', function() { queryWxPay(decodeURIComponent(unicom.query.userid)); }) $dialog.find('span[name="repayspan"]').on('click', function() { var data = { userid: decodeURIComponent(unicom.query.userid), web_url: decodeURIComponent(unicom.query.payurl), out_trade_no: unicom.query.tradeno, tradedate: unicom.query.tradedate } // alert(JSON.stringify(data)) pay(data); }) } function pay(data) { var href = window.location.href; if (href.indexOf("&tradeno") > 0) { href = href.substring(0, href.indexOf("&tradeno")); } window.location.href = data.web_url + '&redirect_url=' + encodeURIComponent(href + '&tradeno=' + data.out_trade_no + '&tradedate=' + data.tradedate + '&userid=' + encodeURIComponent(encodeURIComponent(data.userid)) + '&payurl=' + encodeURIComponent(encodeURIComponent(data.web_url))); } function queryWxPay(userid) { unicom.queryWxPay(unicom.query.tradeno, unicom.query.tradedate, userid).then(function(response) { var result = response; if (result.resultCode == "0000" && result.trade_state == "SUCCESS") { compnt.showAlert('支付成功,请注意接收通知短信。').then(response=>{ window.location.href = window.location.href.replace("tradeno", "tno"); }); return; } $('.dialog-pay').css('display', 'none'); switch(result.trade_state) { case "REFUND": compnt.showAlert('转入退款').then(function() { $('.dialog-pay').css('display', 'block'); window.location.href = unicom.root + "-s1api" + '/back/seasonpkg/index.html?' }); break; case "NOTPAY": compnt.showAlert('未支付').then(function() { $('.dialog-pay').css('display', 'block'); }); break; case "CLOSED": compnt.showAlert('已关闭').then(function() { $('.dialog-pay').css('display', 'block'); }); break; case "REVOKED": compnt.showAlert('已撤销(付款码支付)').then(function() { $('.dialog-pay').css('display', 'block'); }); break; case "USERPAYING": compnt.showAlert('用户支付中(付款码支付)').then(function() { $('.dialog-pay').css('display', 'block'); }); break; case "PAYERROR": compnt.showAlert('支付失败(其他原因,如银行返回失败)').then(function() { $('.dialog-pay').css('display', 'block'); }); break; default: compnt.showAlert('支付失败,' + (result.trade_state||result.return_msg)).then(function() { $('.dialog-pay').css('display', 'block'); }); break; } }); return; }