login.js 1.13 KB
var $ = require('jquery');

require('../common.js');
require('../plugin/wx-share')();
$('.notice').click(function() {
    $('.code').show();
    $('.mark').show();
});
$('.close').click(function() {
    $('.code').hide();
    $('.mark').hide();
});

function get() {
    $.ajax({
        type: 'get',
        url: '/index/life/sendCoupon',
        dataType: 'json',
        success: function(data) {
            $('.statu').html(data.message);
            $('.statu-mark').show();
            $('.statu-box').show();
            if (data.code === 200) {
                window.setCookie('lifeCoupon', data.data);
                location.href = '/life/coupon';
            } else if (data.code === 401) {
                $('.successed').css('display', 'block');
                $('.sure').click(function() {
                    location.href = '/life/coupon';
                });
            } else if (data.code === 403) {
                $('.late').css('display', 'block');
            } else {
                $('.faill').css('display', 'block');
            }
        }
    });
}

$('.coupon-btn').click(function() {
    get();
    $('.mark').show();
});