123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- 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 + "<br>" + 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);
- }
|