Исправил ошибки у новых пользователей
This commit is contained in:
gofnnp 2023-03-30 12:43:42 +04:00
parent 7bb05324a9
commit 7a9f9fc872
5 changed files with 78 additions and 70 deletions

View File

@ -17,12 +17,9 @@
<div class="info"> <div class="info">
<div *ngIf="accountData" class="row"> <div *ngIf="accountData" class="row">
<span class="key">Имя</span> <span class="key">Имя</span>
<span class="value" *ngIf="userName.length">{{ <span class="value">{{
userName userName && userName.length ? userName : 'Не задано'
}}</span> }}</span>
<span class="value" *ngIf="!userName.length"
>Не задано</span
>
</div> </div>
<div *ngIf="accountData" class="row"> <div *ngIf="accountData" class="row">
<span class="key">Баланс карты</span> <span class="key">Баланс карты</span>

View File

@ -92,9 +92,9 @@ export class BonusProgramComponent implements OnInit {
); );
this.accountData = getAccount && getAccount['Cards'][0]; this.accountData = getAccount && getAccount['Cards'][0];
this.bonuses = this.accountData.BonusProgramAccounts.reduce((previous, {Bonuses}) => { this.bonuses = this.accountData.BonusProgramAccounts?.reduce((previous, {Bonuses}) => {
return previous + Bonuses return previous + Bonuses
}, 0) }, 0) || this.accountData.Bonuses
this.loadingBonuses = false; this.loadingBonuses = false;
if (this.accountData) { if (this.accountData) {
barcode('#barcode') barcode('#barcode')

View File

@ -81,6 +81,7 @@
></p-progressSpinner> ></p-progressSpinner>
<p <p
*ngIf="purchases?.length === 0 && !ordersLoadingStatus" *ngIf="purchases?.length === 0 && !ordersLoadingStatus"
class="no-orders"
style="width: 100%; text-align: center" style="width: 100%; text-align: center"
> >
Нет заказов Нет заказов

View File

@ -1,70 +1,76 @@
.show-more-orders { .show-more-orders {
text-align: center; text-align: center;
cursor: pointer; cursor: pointer;
color: #09467f; color: #09467f;
margin-top: 16px; margin-top: 16px;
} }
.woocommerce-MyAccount-content { .woocommerce-MyAccount-content {
max-width: 400px; max-width: 400px;
margin-left: calc(50vw - 200px); margin-left: calc(50vw - 200px);
} }
.woocommerce-orders-table { .woocommerce-orders-table {
border: 2px solid #dee2e6; border: 2px solid #dee2e6;
border-bottom: 0; border-bottom: 0;
border-radius: 0.25rem; border-radius: 0.25rem;
border-collapse: separate; border-collapse: separate;
text-align: left; text-align: left;
margin-top: 8px; margin-top: 8px;
width: 100%;
max-width: 400px;
margin-left: auto;
margin-right: auto;
thead {
display: none;
}
.woocommerce-orders-table {
&__cell {
padding: 0.7rem 1.5rem;
border-bottom: 2px solid #dee2e6;
text-align: right !important;
display: block;
&::before {
content: attr(data-title) ": ";
font-weight: 700;
float: left;
}
}
&__row {
display: block;
&:nth-child(even) {
background: #ebebeb;
}
}
// &__cell-order-actions::before {
// display: none;
// }
&__cell-order-actions {
&.red-color {
color: #ed0000;
}
&.green-color {
color: #00a700;
}
}
&__cell-order-number a {
text-decoration: none;
color: #009688;
}
}
.woocommerce-button {
display: inline-block;
color: #ffffff;
background-color: #009688;
padding: 13px;
border-radius: 4px;
text-decoration: none;
width: 100%; width: 100%;
max-width: 400px; text-align: center;
margin-left: auto; }
margin-right: auto; }
thead {
display: none; .no-orders {
} width: 100%;
.woocommerce-orders-table { text-align: center;
&__cell { margin-top: 16px;
padding: 0.7rem 1.5rem;
border-bottom: 2px solid #dee2e6;
text-align: right!important;
display: block;
&::before {
content: attr(data-title) ": ";
font-weight: 700;
float: left;
}
}
&__row {
display: block;
&:nth-child(even) {
background: #ebebeb;
}
}
// &__cell-order-actions::before {
// display: none;
// }
&__cell-order-actions {
&.red-color {
color: #ed0000;
}
&.green-color {
color: #00a700
}
}
&__cell-order-number a {
text-decoration: none;
color: #009688;
}
}
.woocommerce-button {
display: inline-block;
color: #ffffff;
background-color: #009688;
padding: 13px;
border-radius: 4px;
text-decoration: none;
width: 100%;
text-align: center;
}
} }

View File

@ -34,6 +34,10 @@ export class UserDataComponent implements OnInit {
params: [] params: []
}, RpcService.authService, true).subscribe({ }, RpcService.authService, true).subscribe({
next: (res) => { next: (res) => {
if (res.code === 45) {
this.messageService.add({severity:'warn', summary:'Данные не найдены, заполните их на этой странице'});
return
}
if (!res.data) { if (!res.data) {
this.messageService.add({severity:'error', summary:'Произошла ошибка, попробуйте позже'}); this.messageService.add({severity:'error', summary:'Произошла ошибка, попробуйте позже'});
return return