remotes/origin/hotfix/LIL-691
gzbender 7 years ago
parent 9b8a406468
commit 3813c74251
  1. 11
      apps/user/templates/user/bonus-history.html
  2. 4
      project/templates/blocks/lil_store_js.html
  3. 15
      project/templates/blocks/popup_auth.html
  4. 8
      project/views.py
  5. 2
      web/src/js/modules/auth.js
  6. 23
      web/src/js/modules/common.js

@ -10,8 +10,15 @@
<div class="title title_sm">Бонусы</div>
<div class="text">У вас {{ request.user.bonus|rupluralize:"бонус,бонуса,бонусов" }}</div>
<div>
Вы можете пригласить своих друзей в наш сервис, за это вы получите {{ config.REFERRER_BONUS }}% от суммы
их первой покупки и они получат {{ config.REFERRAL_BONUS }}% от суммы первой покупки на свой бонусный счет <br>
Вы можете пригласить своих друзей в наш сервис, за это
{% if config.REFERRER_BONUS == config.REFERRAL_BONUS %}
вы и они получите по {{ config.REFERRER_BONUS }}%
{% else %}
вы получите {{ config.REFERRER_BONUS }}%, а они {{ config.REFERRAL_BONUS }}%
{% endif %}
от суммы их первой покупки на бонусный счет. Приглашайте друзей, накапливайте бонусные баллы, тратьте бонусы
на приобретения доступа к школе и курсам. Оплата услуг возможна только, если вы накопили баллов на стоимость услуги.
<br>
Просто отправьте им эту ссылку, по которой они смогут зарегистрироваться:
</div>
<div class="form__field field" style="margin-bottom: 0;">

@ -8,7 +8,9 @@
id: '{{ request.user.id|default:'' }}',
},
flags: {
isReferralRegistration: {{ is_referral_registration|yesno:"true,false" }},
referrer: '{{ referrer.id|default:'' }}',
referrerName: '{% if referrer %}{{ referrer.get_full_name }}{% endif %}',
isReferralUrl: {{ is_referral_url|yesno:"true,false" }},
}
};
</script>

@ -1,5 +1,5 @@
{% load static %}
<div class="popup js-popup-auth {% if is_referral_registration %}open visible{% endif %}">
<div class="popup js-popup-auth">
<div class="popup__wrap js-popup-wrap">
<button class="popup__close js-popup-close">
<svg class="icon icon-close">
@ -10,13 +10,13 @@
<div class="auth js-auth">
<div class="auth__login js-auth-login">
<div class="auth__nav">
<a class="auth__type js-auth-type {% if not is_referral_registration %}active{% endif %}" href="#">Войти</a>
<a class="auth__type js-auth-type {% if is_referral_registration %}active{% endif %}" href="#">РЕГИСТРАЦИЯ</a>
<a class="auth__type js-auth-type_login js-auth-type" href="#">Войти</a>
<a class="auth__type js-auth-type_registration js-auth-type" href="#">РЕГИСТРАЦИЯ</a>
</div>
<div class="auth__body">
<form id="learner-auth-form" method="post" action="{% url 'lilcity:login' %}">
{% csrf_token %}
<div class="auth__tab js-auth-tab" {% if not is_referral_registration %}style="display: block;"{% endif %}>
<div class="auth__tab js-auth-tab js-auth-tab_login">
<div class="auth__enter js-auth-enter">
<div id="learner-auth-field__username" class="auth__field field learner-auth-form__field">
<div class="field__label">ПОЧТА</div>
@ -63,9 +63,14 @@
</form>
<form id="learner-registration-form" method="post" action="{% url 'lilcity:registration-learner' %}">
{% csrf_token %}
<div class="auth__tab js-auth-tab" {% if is_referral_registration %}style="display: block;"{% endif %}>
<div class="auth__tab js-auth-tab js-auth-tab_registration">
{% if referrer %}
<input type="hidden" name="referrer" value="{{ referrer.id }}">
<div class="auth__text">
Спасибо за&nbsp;то, что&nbsp;вы&nbsp;с&nbsp;нами! Вас&nbsp;пригласил ваш&nbsp;друг {{ referrer.get_full_name }}.
При&nbsp;первой покупке {{ config.REFERRAL_BONUS }}% от&nbsp;суммы услуги будут зачислены на&nbsp;ваш бонусный счет.
Приятного обучения!
</div>
{% endif %}
<div class="auth__fieldset">
<div id="learner-registration-field__first-name" class="auth__field field learner-registration-form__field">

@ -23,6 +23,7 @@ class IndexView(TemplateView):
def get_context_data(self):
referrer = self.request.GET.get('referrer')
is_referral_url = bool(referrer)
context = super().get_context_data()
now_time = now()
@ -69,15 +70,16 @@ class IndexView(TemplateView):
if referrer and not self.request.user.is_authenticated:
try:
referrer = short_url.decode_url(referrer)
referrer = User.objects.get(pk=referrer).id
referrer = User.objects.get(pk=referrer)
except:
referrer = None
self.request.session['referrer'] = referrer
self.request.session['referrer'] = referrer and referrer.id
else:
referrer = None
context.update({
'is_referral_registration': bool(referrer),
'referrer': referrer,
'is_referral_url': is_referral_url,
'online': online,
'online_coming_soon': online_coming_soon,
'school_schedule': school_schedule,

@ -246,7 +246,7 @@ $(document).ready(function () {
window.location.href = nextUrl;
}
else{
window.location.reload();
window.location = '/';
}
} else {
registrationButton.removeClass('loading');

@ -1,13 +1,17 @@
import $ from 'jquery';
import {showNotification} from "./notification"
import Inputmask from "inputmask";
import SmoothScroll from 'smooth-scroll/dist/js/smooth-scroll';
import baguetteBox from 'baguettebox.js'
import createHistory from 'history/createBrowserHistory'
window.$ = window.jQuery = jQuery = $;
window.Inputmask = Inputmask;
window.baguetteBox = baguetteBox;
$(document).ready(function () {
const $popupAuth = $('.js-popup-auth');
let authPopupActiveTab = 'login'
baguetteBox.run('.gallery');
// Добавляем заголовок X-CSRFToken для всех AJAX запросов JQuery.
$.ajaxSetup({
@ -41,11 +45,22 @@ $(document).ready(function () {
})
});
if(window.LIL_STORE.flags.isReferralRegistration && ! window.LIL_STORE.user.id){
setTimeout(() => {
$('.js-header-enter').click();
});
if(window.LIL_STORE.flags.isReferralUrl){
if(window.LIL_STORE.user.id){
showNotification('error', 'Извините, вы уже зарегестрировались на нашем сервисе, получить бонусные баллы возможно только для новых пользователей');
// Создаем объект history API
const history = createHistory();
history.replace('/');
}
else if(window.LIL_STORE.flags.referrer){
authPopupActiveTab = 'registration';
setTimeout(() => {
$('.js-header-enter').click();
});
}
}
$popupAuth.find(authPopupActiveTab == 'login' ? '.js-auth-type_login' : '.js-auth-type_registration').addClass('active');
$popupAuth.find(authPopupActiveTab == 'login' ? '.js-auth-tab_login' : '.js-auth-tab_registration').show();
});
function updateHeader() {

Loading…
Cancel
Save