delivery
This commit is contained in:
@@ -615,6 +615,47 @@ const MOCK_ITEMS: any[] = [
|
|||||||
],
|
],
|
||||||
questions: []
|
questions: []
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'bolset-cream',
|
||||||
|
categoryID: 2010,
|
||||||
|
itemID: 496218563,
|
||||||
|
name: 'Женские кеды BOLSET (кремовый)',
|
||||||
|
description: 'Сезон: Весна - лето (SS)\nМатериал : телячья кожа\nПроизводство: Турция\n\nРазмерный ряд: 36 - 40 (EU)',
|
||||||
|
discount: 0,
|
||||||
|
rating: 0,
|
||||||
|
visible: true,
|
||||||
|
priority: 0,
|
||||||
|
tags: null,
|
||||||
|
badges: null,
|
||||||
|
basecurrency: '',
|
||||||
|
itemDetails: [
|
||||||
|
{ color: '0xFFFDD0', size: '37', price: 6899.94, currency: 'RUB', remaining: 100 },
|
||||||
|
{ color: '0xFFFDD0', size: '38', price: 6900, currency: 'RUB', remaining: 100 },
|
||||||
|
{ color: '0xFFFDD0', size: '39', price: 6900, currency: 'RUB', remaining: 100 },
|
||||||
|
{ color: '0xFFFDD0', size: '40', price: 6900, currency: 'RUB', remaining: 100 },
|
||||||
|
{ color: '0xFFFDD0', size: '41', price: 6900, currency: 'RUB', remaining: 100 },
|
||||||
|
{ color: '0xFFFDD0', size: '37', price: 94.09, currency: 'USD', remaining: 100 },
|
||||||
|
{ color: '0xFFFDD0', size: '37', price: 82.04, currency: 'EUR', remaining: 100 },
|
||||||
|
{ color: '0xFFFDD0', size: '37', price: 34900.47, currency: 'AMD', remaining: 100 }
|
||||||
|
],
|
||||||
|
names: [
|
||||||
|
{ language: 'ru', valuue: '' }
|
||||||
|
],
|
||||||
|
descriptions: [
|
||||||
|
{ language: 'ru', value: 'Сезон: Весна - лето (SS)\nМатериал : телячья кожа\nПроизводство: Турция\n\nРазмерный ряд: 36 - 40 (EU)' }
|
||||||
|
],
|
||||||
|
attributes: [],
|
||||||
|
photos: [
|
||||||
|
{ type: 'photo', url: './images/496218563.webp' }
|
||||||
|
],
|
||||||
|
questions: [],
|
||||||
|
visits: 0,
|
||||||
|
callbacks: [],
|
||||||
|
partnerID: '',
|
||||||
|
delivery: [
|
||||||
|
{ deliveryPrice: 0, deliveryPlace: 'по всему миру', deliveryTime: '30 минут' }
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: 'lamp-smart',
|
id: 'lamp-smart',
|
||||||
itemID: 301,
|
itemID: 301,
|
||||||
|
|||||||
@@ -144,6 +144,32 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@if (hasDeliveryInfo()) {
|
||||||
|
<div class="novo-delivery">
|
||||||
|
<h3 class="novo-delivery-title">{{ 'cart.deliveryLabel' | translate }}</h3>
|
||||||
|
|
||||||
|
@if (isDigitalDelivery()) {
|
||||||
|
<div class="novo-delivery-chip">{{ 'cart.digitalDelivery' | translate }}</div>
|
||||||
|
} @else {
|
||||||
|
<div class="novo-delivery-list">
|
||||||
|
@for (option of deliveryOptions(); track trackByDeliveryOption($index, option)) {
|
||||||
|
<div class="novo-delivery-option">
|
||||||
|
<div class="novo-delivery-option-main">
|
||||||
|
@if (option.deliveryPlace) {
|
||||||
|
<span>{{ 'cart.deliveryPlace' | translate }}: {{ option.deliveryPlace }}</span>
|
||||||
|
}
|
||||||
|
@if (option.deliveryTime) {
|
||||||
|
<span>{{ 'cart.deliveryTime' | translate }}: {{ option.deliveryTime }}</span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<span class="novo-delivery-price">{{ option.deliveryPrice | number:'1.2-2' }} {{ getDeliveryCurrency() }}</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
<button class="novo-add-cart" (click)="addToCart()">
|
<button class="novo-add-cart" (click)="addToCart()">
|
||||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||||
<circle cx="9" cy="21" r="1"></circle>
|
<circle cx="9" cy="21" r="1"></circle>
|
||||||
@@ -423,6 +449,32 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@if (hasDeliveryInfo()) {
|
||||||
|
<div class="dx-delivery">
|
||||||
|
<h3 class="dx-delivery-title">{{ 'cart.deliveryLabel' | translate }}</h3>
|
||||||
|
|
||||||
|
@if (isDigitalDelivery()) {
|
||||||
|
<div class="dx-delivery-chip">{{ 'cart.digitalDelivery' | translate }}</div>
|
||||||
|
} @else {
|
||||||
|
<div class="dx-delivery-list">
|
||||||
|
@for (option of deliveryOptions(); track trackByDeliveryOption($index, option)) {
|
||||||
|
<div class="dx-delivery-option">
|
||||||
|
<div class="dx-delivery-option-main">
|
||||||
|
@if (option.deliveryPlace) {
|
||||||
|
<span>{{ 'cart.deliveryPlace' | translate }}: {{ option.deliveryPlace }}</span>
|
||||||
|
}
|
||||||
|
@if (option.deliveryTime) {
|
||||||
|
<span>{{ 'cart.deliveryTime' | translate }}: {{ option.deliveryTime }}</span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<span class="dx-delivery-price">{{ option.deliveryPrice | number:'1.2-2' }} {{ getDeliveryCurrency() }}</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
<button class="dx-add-cart" (click)="addToCart()">
|
<button class="dx-add-cart" (click)="addToCart()">
|
||||||
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||||
<circle cx="9" cy="21" r="1"></circle>
|
<circle cx="9" cy="21" r="1"></circle>
|
||||||
|
|||||||
@@ -383,6 +383,65 @@ $dx-card-bg: #f5f3f9;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dx-delivery, .novo-delivery {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 14px 16px;
|
||||||
|
border: 1px solid $dx-border;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: #f8fafa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dx-delivery-title, .novo-delivery-title {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: $dx-dark;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dx-delivery-list, .novo-delivery-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dx-delivery-option, .novo-delivery-option {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 10px 12px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dx-delivery-option-main, .novo-delivery-option-main {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 4px;
|
||||||
|
color: $dx-muted;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dx-delivery-price, .novo-delivery-price {
|
||||||
|
flex-shrink: 0;
|
||||||
|
font-weight: 700;
|
||||||
|
color: $dx-primary;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dx-delivery-chip, .novo-delivery-chip {
|
||||||
|
display: inline-flex;
|
||||||
|
align-self: flex-start;
|
||||||
|
padding: 6px 12px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: rgba(73, 118, 113, 0.12);
|
||||||
|
color: $dx-primary;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
.dx-description {
|
.dx-description {
|
||||||
padding-top: 8px;
|
padding-top: 8px;
|
||||||
border-top: 1px solid $dx-border;
|
border-top: 1px solid $dx-border;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { FormsModule } from '@angular/forms';
|
|||||||
import { ActivatedRoute, RouterLink } from '@angular/router';
|
import { ActivatedRoute, RouterLink } from '@angular/router';
|
||||||
import { ApiService, CartService, TelegramService, LanguageService, SeoService } from '../../services';
|
import { ApiService, CartService, TelegramService, LanguageService, SeoService } from '../../services';
|
||||||
import { AuthService } from '../../services/auth.service';
|
import { AuthService } from '../../services/auth.service';
|
||||||
import { Item, ItemDetail, DescriptionField } from '../../models';
|
import { Item, ItemDetail, DescriptionField, DeliveryOption } from '../../models';
|
||||||
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
import { environment } from '../../../environments/environment';
|
import { environment } from '../../../environments/environment';
|
||||||
@@ -77,6 +77,13 @@ export class ItemDetailComponent implements OnInit, OnDestroy {
|
|||||||
return detail?.remaining ?? this.item()?.quantity ?? null;
|
return detail?.remaining ?? this.item()?.quantity ?? null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
deliveryOptions = computed(() => this.item()?.deliveryOptions ?? []);
|
||||||
|
|
||||||
|
hasDeliveryInfo = computed(() => {
|
||||||
|
const currentItem = this.item();
|
||||||
|
return currentItem?.deliveryMode === 'digital' || this.deliveryOptions().length > 0;
|
||||||
|
});
|
||||||
|
|
||||||
newReview = {
|
newReview = {
|
||||||
rating: 0,
|
rating: 0,
|
||||||
comment: '',
|
comment: '',
|
||||||
@@ -187,6 +194,18 @@ export class ItemDetailComponent implements OnInit, OnDestroy {
|
|||||||
return discount > 0 ? price * (1 - discount / 100) : price;
|
return discount > 0 ? price * (1 - discount / 100) : price;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isDigitalDelivery(): boolean {
|
||||||
|
return this.item()?.deliveryMode === 'digital';
|
||||||
|
}
|
||||||
|
|
||||||
|
getDeliveryCurrency(): string {
|
||||||
|
return this.effectiveCurrency() || this.item()?.currency || 'RUB';
|
||||||
|
}
|
||||||
|
|
||||||
|
trackByDeliveryOption(index: number, option: DeliveryOption): string {
|
||||||
|
return `${index}-${option.deliveryPlace}-${option.deliveryTime}-${option.deliveryPrice}`;
|
||||||
|
}
|
||||||
|
|
||||||
// BackOffice integration helpers
|
// BackOffice integration helpers
|
||||||
|
|
||||||
getItemName(): string {
|
getItemName(): string {
|
||||||
|
|||||||
Reference in New Issue
Block a user