Merge remote-tracking branch 'remotes/origin/coffee-like-test' into coffee-like
This commit is contained in:
commit
f4612ad996
@ -3,69 +3,82 @@
|
|||||||
<div class="guest-card">
|
<div class="guest-card">
|
||||||
<div class="top-info">
|
<div class="top-info">
|
||||||
<div class="top-info__level">
|
<div class="top-info__level">
|
||||||
<p id="level">Уровень {{ authService.error ? '--' : authService.userInfo?.current_level_and_cashback?.current_level }}</p>
|
<p id="level">
|
||||||
<p id="level-percent">Кэшбек {{ authService.error ? '--' : authService.currentLvlPeriod.percent }}%</p>
|
Уровень
|
||||||
|
{{
|
||||||
|
authService.error
|
||||||
|
? "--"
|
||||||
|
: authService.userInfo?.current_level_and_cashback?.current_level
|
||||||
|
}}
|
||||||
|
</p>
|
||||||
|
<p id="level-percent">
|
||||||
|
Кэшбек
|
||||||
|
{{ authService.error ? "--" : authService.currentLvlPeriod.percent }}%
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<ng-container *ngIf="!authService.error && authService.userInfo!.walletBalances < 0">
|
<ng-container
|
||||||
<p class="top-info__bonus">
|
*ngIf="!authService.error && authService.userInfo!.walletBalances < 0"
|
||||||
Отрицательный баланс бонусов, свяжитесь с техподдержкой
|
>
|
||||||
</p>
|
<p class="top-info__bonus">
|
||||||
|
Отрицательный баланс бонусов, свяжитесь с техподдержкой
|
||||||
|
</p>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngIf="authService.error || authService.userInfo!.walletBalances >= 0">
|
<ng-container
|
||||||
<p class="top-info__bonus">
|
*ngIf="authService.error || authService.userInfo!.walletBalances >= 0"
|
||||||
{{ authService.error ? '--' : Math.floor(authService.userInfo!.walletBalances) }}
|
>
|
||||||
|
<p class="top-info__bonus">
|
||||||
|
{{
|
||||||
|
authService.error
|
||||||
|
? "--"
|
||||||
|
: Math.floor(authService.userInfo!.walletBalances)
|
||||||
|
}}
|
||||||
бонусов
|
бонусов
|
||||||
</p>
|
</p>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
<div class="guest-card__qr" (click)="qrCodeClick()">
|
<div class="guest-card__qr" (click)="qrCodeClick()">
|
||||||
<div class="qr-code-wrapper">
|
<div class="qr-code-wrapper">
|
||||||
<qr-code
|
<qr-code
|
||||||
[value]="phone || 'Данные не найдены'"
|
[value]="phone || 'Данные не найдены'"
|
||||||
[margin]="0"
|
[margin]="0"
|
||||||
[size]="qrCodeSize"
|
[size]="qrCodeSize"
|
||||||
errorCorrectionLevel="H"
|
errorCorrectionLevel="H"
|
||||||
></qr-code>
|
></qr-code>
|
||||||
<span class="material-icons zoom">
|
<span class="material-icons zoom"> zoom_in </span>
|
||||||
zoom_in
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
<span>Покажи бариста</span>
|
<span>Покажи бариста</span>
|
||||||
</div>
|
</div>
|
||||||
<ng-container *ngIf="!authService.error">
|
<ng-container *ngIf="!authService.error">
|
||||||
<div class="guest-card__user-description">
|
<div class="guest-card__user-description">
|
||||||
<p [innerHtml]="getLevelDescription() | safeHtml"></p>
|
<p [innerHtml]="getLevelDescription() | safeHtml"></p>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngIf="!authService.error">
|
<ng-container *ngIf="!authService.error">
|
||||||
<span id="bonuses-condition"></span>
|
<span id="bonuses-condition"></span>
|
||||||
<app-last-order
|
<app-last-order
|
||||||
[lastOrder]="authService.userInfo?.last_purchase"
|
[lastOrder]="authService.userInfo?.last_purchase"
|
||||||
[loading]="authService.loading"
|
[loading]="authService.loading"
|
||||||
></app-last-order>
|
></app-last-order>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngIf="authService.error">
|
<ng-container *ngIf="authService.error">
|
||||||
<div class="broken">
|
<div class="broken">
|
||||||
|
<img src="./assets/broken.jpg" alt="" />
|
||||||
<img src="./assets/broken.jpg" alt="" />
|
<p>
|
||||||
<p>
|
Упс, что-то пошло не так.. Мы уже работаем над этой проблемой.
|
||||||
Упс, что-то пошло не так..
|
Попробуйте обновить страницу или зайти попозже. Приносим извинения за
|
||||||
Мы уже работаем над этой проблемой.
|
неудобства.
|
||||||
Попробуйте обновить страницу или зайти попозже.
|
</p>
|
||||||
Приносим извинения за неудобства.
|
</div>
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<app-footer></app-footer>
|
<app-footer></app-footer>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container *ngIf="authService.loading">
|
<ng-container *ngIf="authService.loading">
|
||||||
<ng-container
|
<ng-container
|
||||||
*ngTemplateOutlet="spinner; context: { $implicit: 85 }"
|
*ngTemplateOutlet="spinner; context: { $implicit: 85 }"
|
||||||
></ng-container>
|
></ng-container>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
|
||||||
<ng-template #spinner let-diameter>
|
<ng-template #spinner let-diameter>
|
||||||
<div class="center wrapper">
|
<div class="center wrapper">
|
||||||
<mat-spinner [strokeWidth]="3" [diameter]="diameter"></mat-spinner>
|
<mat-spinner [strokeWidth]="3" [diameter]="diameter"></mat-spinner>
|
||||||
|
|||||||
@ -54,13 +54,21 @@ export class GuestCardComponent implements OnInit {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.phone =
|
this.getUserPhone()
|
||||||
this.cookiesService.getItem('phone-number') ||
|
|
||||||
this.authService.userInfo?.phone;
|
|
||||||
|
|
||||||
this.requestPermission();
|
this.requestPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getUserPhone() {
|
||||||
|
if (this.cookiesService.getItem('phone-number')) {
|
||||||
|
this.phone = this.cookiesService.getItem('phone-number');
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.authService.getUserPhone()?.subscribe((phone) => {
|
||||||
|
this.phone = this.cookiesService.getItem('phone-number') || phone;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
requestPermission() {
|
requestPermission() {
|
||||||
const userAgent = window.navigator.userAgent.toLowerCase();
|
const userAgent = window.navigator.userAgent.toLowerCase();
|
||||||
const ios = /iphone|ipod|ipad/.test(userAgent);
|
const ios = /iphone|ipod|ipad/.test(userAgent);
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import {
|
|||||||
import { lvlPeriods } from 'src/app/app.constants';
|
import { lvlPeriods } from 'src/app/app.constants';
|
||||||
import moment from 'moment-timezone';
|
import moment from 'moment-timezone';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
import { Observable, map } from 'rxjs';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
@ -51,6 +52,24 @@ export class AuthService {
|
|||||||
return !!this.token;
|
return !!this.token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getUserPhone() {
|
||||||
|
const token = this.cookiesService.getItem('token');
|
||||||
|
|
||||||
|
if (!token) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.wpJsonService.getCustomerInfo(
|
||||||
|
environment.systemId,
|
||||||
|
token,
|
||||||
|
environment.icardProxy
|
||||||
|
).pipe(
|
||||||
|
map((value) => {
|
||||||
|
return value.customer_info.phone;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
getUserInfo() {
|
getUserInfo() {
|
||||||
const token = this.cookiesService.getItem('token');
|
const token = this.cookiesService.getItem('token');
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user