import * as compnt from "../../../public/js/compnt.js"; import * as unicom from "../../../public/js/unicom.js"; import "../scss/womusic.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); bindCancel(); unicom.queryStock(unicom.query.code).then(function(response) { compnt.hideLoading(); switch (response.resultCode) { case "0000": bindOrder() bindSend() break; default: //bindOrder() //bindSend() var errorInfo = response.errorInfo + "
" + response.result_msg; errorInfo = errorInfo.replace('商品', '链接'); compnt.showAlert(errorInfo, true); break; } }); 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 if (location.href.indexOf('/refund') >= 0) { unicom.burypointLogId('110006');// 退款 } else { // location.href.indexOf('/index') >= 0 // location.href.indexOf('/order') >= 0 unicom.burypointLogId('110001');// 订购页面pv, pv去重得到uv } }) } function bindSend() { // @ts-ignore let $container = $('.section-login').find('.form-group'); $container.find('.sendcode').unbind('click').on('click', function () { unicom.sendSms($container, 'login'); }) } function bindOrder() { // @ts-ignore let $container = $('.section-login').find('.form-group'); $container.find('.login').unbind('click').on('click', function () { compnt.showLoading(); unicom.checkCode($container).then(function() { unicom.orderBack(unicom.query.code).then(function(response) { compnt.hideLoading(); switch (response.resultCode) { case "0000": compnt.showAlert('领取成功,该链接已经失效').then(function() { window.location.reload(); }); break; case "1018": // 手机号领取过 compnt.showAlert('领取失败,每个号码每月限领1次'); break; case "1029": // 包含1、链接不存在;2、已经领取过;3、链接已经退费、4、已经失效 compnt.showAlert('领取失败,请联系客服。该链接已失效。'); break; default: let prefix = ''; if (response.errorInfo.indexOf('订购失败') < 0) { prefix = '领取失败,'; } // 温馨提示,您已领取成功,该链接已失效。 response.errorInfo = response.errorInfo.replace('操作失败,', ''); response.errorInfo = response.errorInfo.replace('订购', '领取'); compnt.showAlert(prefix + response.errorInfo); break; } }).catch(function(data) { compnt.hideLoading(); }) }).catch(function(data) { compnt.hideLoading(); }) }) } function bindCancel() { // @ts-ignore $("#btn-refund").attr('href', 'refund.html?fes=' + unicom.query.fes + '&sou=' + unicom.query.sou + '&code=' + unicom.query.code); }