parent
c282a6e521
commit
c24e94c255
@ -8,7 +8,7 @@
|
|||||||
<p сlass="form-row form-row-wide">
|
<p сlass="form-row form-row-wide">
|
||||||
<input formControlName="first_name" id="first_name" pInputText placeholder="Ваше имя" type="text">
|
<input formControlName="first_name" id="first_name" pInputText placeholder="Ваше имя" type="text">
|
||||||
</p>
|
</p>
|
||||||
<div *ngIf="deliverData.deliveryType?.title === 'Доставка'">
|
<div *ngIf="deliverData.deliveryType?.name === 'Доставка'">
|
||||||
<p сlass="form-row form-row-last">
|
<p сlass="form-row form-row-last">
|
||||||
<input formControlName="flat" id="flat" pInputText placeholder="Квартира" type="number" min="1">
|
<input formControlName="flat" id="flat" pInputText placeholder="Квартира" type="number" min="1">
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@ -134,15 +134,15 @@ export class UserDataOrderComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
changeDeliveryType(event: any) {
|
changeDeliveryType(event: any) {
|
||||||
this.deliverData.deliveryType = event.value;
|
this.deliverData.deliveryType = event.value;
|
||||||
if (this.deliverData.deliveryType?.title) {
|
if (this.deliverData.deliveryType?.name) {
|
||||||
this.changeValidators(this.deliverData.deliveryType.title)
|
this.changeValidators(this.deliverData.deliveryType.name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
changeValidators(title: string) {
|
changeValidators(name: string) {
|
||||||
const comment = this.mainFormGroup.controls['deliveryDataForm'].value.comment;
|
const comment = this.mainFormGroup.controls['deliveryDataForm'].value.comment;
|
||||||
const streetValidators = title === 'Доставка' ? [Validators.required, Validators.minLength(2), Validators.maxLength(255),] : []
|
const streetValidators = name === 'Доставка' ? [Validators.required, Validators.minLength(2), Validators.maxLength(255),] : []
|
||||||
const houseValidators = title === 'Доставка' ? [Validators.required, Validators.maxLength(10),] : []
|
const houseValidators = name === 'Доставка' ? [Validators.required, Validators.maxLength(10),] : []
|
||||||
const userDataForm = this.fb.group({
|
const userDataForm = this.fb.group({
|
||||||
phone: [this.userData.phone],
|
phone: [this.userData.phone],
|
||||||
first_name: [this.userData.first_name, [Validators.required, Validators.minLength(2), Validators.maxLength(255),]],
|
first_name: [this.userData.first_name, [Validators.required, Validators.minLength(2), Validators.maxLength(255),]],
|
||||||
@ -233,7 +233,7 @@ export class UserDataOrderComponent implements OnInit, OnDestroy {
|
|||||||
this.userData.city = this.cities[0];
|
this.userData.city = this.cities[0];
|
||||||
this.userData.phone = this.order.phone;
|
this.userData.phone = this.order.phone;
|
||||||
// await this.autoCompleteService.setCity(this.userData.city);
|
// await this.autoCompleteService.setCity(this.userData.city);
|
||||||
const isSelfDelivery = this.deliverData.deliveryType?.type === "self_delivery"
|
const isSelfDelivery = this.deliverData.deliveryType?.name === "Самовывоз"
|
||||||
return this.fb.group({
|
return this.fb.group({
|
||||||
phone: [this.userData.phone],
|
phone: [this.userData.phone],
|
||||||
first_name: [this.userData.first_name, [Validators.required, Validators.minLength(2), Validators.maxLength(255),]],
|
first_name: [this.userData.first_name, [Validators.required, Validators.minLength(2), Validators.maxLength(255),]],
|
||||||
|
|||||||
@ -1,189 +1,191 @@
|
|||||||
import { CartProduct } from "../models/cart-product";
|
import { CartProduct } from '../models/cart-product';
|
||||||
|
|
||||||
|
|
||||||
export enum PageCode {
|
export enum PageCode {
|
||||||
// Auth,
|
// Auth,
|
||||||
BonusProgram,
|
BonusProgram,
|
||||||
Orders,
|
Orders,
|
||||||
RefSystem,
|
RefSystem,
|
||||||
UserData
|
UserData,
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum MainPageCode {
|
export enum MainPageCode {
|
||||||
Account,
|
Account,
|
||||||
Products,
|
Products,
|
||||||
Cart,
|
Cart,
|
||||||
Info
|
Info,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Page {
|
export interface Page {
|
||||||
code: PageCode | MainPageCode;
|
code: PageCode | MainPageCode;
|
||||||
component?: any;
|
component?: any;
|
||||||
name: string;
|
name: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
getMethod?: string;
|
getMethod?: string;
|
||||||
resName?: string;
|
resName?: string;
|
||||||
onSideBar: boolean
|
onSideBar: boolean;
|
||||||
icon?: string;
|
icon?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UserDataForm {
|
export interface UserDataForm {
|
||||||
first_name: string;
|
first_name: string;
|
||||||
birthdate: string;
|
birthdate: string;
|
||||||
gender: string;
|
gender: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BonusProgramAccount {
|
export interface BonusProgramAccount {
|
||||||
// BonusProgramName: string;
|
// BonusProgramName: string;
|
||||||
// BonusProgramTypeID: string;
|
// BonusProgramTypeID: string;
|
||||||
CardNumber: number;
|
CardNumber: number;
|
||||||
Bonuses: number;
|
Bonuses: number;
|
||||||
// HoldedBonuses: number;
|
// HoldedBonuses: number;
|
||||||
// BonusProgramAccounts: BonusProgramAccount[];
|
// BonusProgramAccounts: BonusProgramAccount[];
|
||||||
// DateBonusBurn: string;
|
// DateBonusBurn: string;
|
||||||
// _links: any[];
|
// _links: any[];
|
||||||
// _embedded: any;
|
// _embedded: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Purchase {
|
export interface Purchase {
|
||||||
// PurchaseId?: string;
|
// PurchaseId?: string;
|
||||||
// CustomerId?: string;
|
// CustomerId?: string;
|
||||||
// PurchaseDate: string;
|
// PurchaseDate: string;
|
||||||
// PurchaseState?: number;
|
// PurchaseState?: number;
|
||||||
// CardNumber?: number;
|
// CardNumber?: number;
|
||||||
// Address?: string
|
// Address?: string
|
||||||
// CheckSummary?: number
|
// CheckSummary?: number
|
||||||
// BonusSummary?: number
|
// BonusSummary?: number
|
||||||
// ID: string;
|
// ID: string;
|
||||||
// Transactions: Transaction[];
|
// Transactions: Transaction[];
|
||||||
// IsSingleTransaction?: boolean;
|
// IsSingleTransaction?: boolean;
|
||||||
transactionCreateDate: string;
|
transactionCreateDate: string;
|
||||||
orderSum: number;
|
orderSum: number;
|
||||||
transactionSum: number;
|
transactionSum: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Transaction {
|
export interface Transaction {
|
||||||
User: string;
|
User: string;
|
||||||
Purchase: string;
|
Purchase: string;
|
||||||
Date: string;
|
Date: string;
|
||||||
Value: number;
|
Value: number;
|
||||||
TransactionType: number;
|
TransactionType: number;
|
||||||
UserBonusesSnapshot: number;
|
UserBonusesSnapshot: number;
|
||||||
BonusPercent: number;
|
BonusPercent: number;
|
||||||
DateActiveBonus: string;
|
DateActiveBonus: string;
|
||||||
AccountBonus: string;
|
AccountBonus: string;
|
||||||
Bonus: string;
|
Bonus: string;
|
||||||
ID: string;
|
ID: string;
|
||||||
HasPurchase?: boolean;
|
HasPurchase?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OrderStatus {
|
export interface OrderStatus {
|
||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeliveryType {
|
export interface DeliveryType {
|
||||||
cost: number;
|
// cost: number;
|
||||||
title: string;
|
// title: string;
|
||||||
id: number;
|
// id: number;
|
||||||
type: string;
|
// type: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
iikoId: string;
|
||||||
|
iikoName: string;
|
||||||
|
isPickUp: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AcceptedOrder {
|
export interface AcceptedOrder {
|
||||||
id: number;
|
id: number;
|
||||||
status: string;
|
status: string;
|
||||||
currency_symbol: string;
|
currency_symbol: string;
|
||||||
|
total: number;
|
||||||
|
address: {
|
||||||
|
city: string;
|
||||||
|
street: string;
|
||||||
|
house: number;
|
||||||
|
flat: number;
|
||||||
|
};
|
||||||
|
payment_method: string;
|
||||||
|
shipping: {
|
||||||
|
name: string;
|
||||||
total: number;
|
total: number;
|
||||||
address: {
|
};
|
||||||
city: string;
|
date_created: string;
|
||||||
street: string;
|
items: OrderProduct[];
|
||||||
house: number;
|
|
||||||
flat: number;
|
|
||||||
};
|
|
||||||
payment_method: string;
|
|
||||||
shipping: {
|
|
||||||
name: string;
|
|
||||||
total: number;
|
|
||||||
};
|
|
||||||
date_created: string;
|
|
||||||
items: OrderProduct[]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Product {
|
export interface Product {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
price: number;
|
price: number;
|
||||||
image: string;
|
image: string;
|
||||||
image_gallery: string[];
|
image_gallery: string[];
|
||||||
category_id: number;
|
category_id: number;
|
||||||
description: string;
|
description: string;
|
||||||
stock_status: string;
|
stock_status: string;
|
||||||
currency_symbol: string;
|
currency_symbol: string;
|
||||||
modifier_data: CartModifier[];
|
modifier_data: CartModifier[];
|
||||||
short_description: string;
|
short_description: string;
|
||||||
guid: string;
|
guid: string;
|
||||||
groupId: string;
|
groupId: string;
|
||||||
modifiers_group: string[];
|
modifiers_group: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AllData {
|
export interface AllData {
|
||||||
datetime: string;
|
datetime: string;
|
||||||
groups: Group[];
|
groups: Group[];
|
||||||
products: Product[];
|
products: Product[];
|
||||||
modifiers_groups: ModifiersGroup[];
|
modifiers_groups: ModifiersGroup[];
|
||||||
modifiers: Modifier[];
|
modifiers: Modifier[];
|
||||||
categories: any[]
|
categories: any[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Group {
|
export interface Group {
|
||||||
id: string;
|
id: string;
|
||||||
label: string;
|
label: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ModifiersGroup {
|
export interface ModifiersGroup {
|
||||||
name: string,
|
name: string;
|
||||||
id: string,
|
id: string;
|
||||||
restrictions: {
|
restrictions: {
|
||||||
minQuantity: number,
|
minQuantity: number;
|
||||||
maxQuantity: number,
|
maxQuantity: number;
|
||||||
freeQuantity: number,
|
freeQuantity: number;
|
||||||
byDefault: number
|
byDefault: number;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Modifier {
|
export interface Modifier {
|
||||||
id: string,
|
id: string;
|
||||||
idLocal: string,
|
idLocal: string;
|
||||||
name: string,
|
name: string;
|
||||||
groupId: string,
|
groupId: string;
|
||||||
price?: number,
|
price?: number;
|
||||||
quantity?: number,
|
quantity?: number;
|
||||||
image?: string;
|
image?: string;
|
||||||
restrictions: {
|
restrictions: {
|
||||||
minQuantity: number,
|
minQuantity: number;
|
||||||
maxQuantity: number,
|
maxQuantity: number;
|
||||||
freeQuantity: number,
|
freeQuantity: number;
|
||||||
byDefault: number
|
byDefault: number;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CartModifier {
|
export interface CartModifier {
|
||||||
lastChangeOption?: string;
|
lastChangeOption?: string;
|
||||||
id: string;
|
id: string;
|
||||||
idLocal: string;
|
idLocal: string;
|
||||||
name: string;
|
name: string;
|
||||||
options: Modifier[];
|
options: Modifier[];
|
||||||
allQuantity: number;
|
allQuantity: number;
|
||||||
restrictions: {
|
restrictions: {
|
||||||
minQuantity: number,
|
minQuantity: number;
|
||||||
maxQuantity: number,
|
maxQuantity: number;
|
||||||
freeQuantity: number,
|
freeQuantity: number;
|
||||||
byDefault: number
|
byDefault: number;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Cart {
|
export interface Cart {
|
||||||
products: CartProduct[];
|
products: CartProduct[];
|
||||||
}
|
}
|
||||||
|
|
||||||
// export interface Modifier {
|
// export interface Modifier {
|
||||||
@ -199,53 +201,53 @@ export interface Cart {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
export interface Option {
|
export interface Option {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
groupId: string;
|
groupId: string;
|
||||||
restrictions: {
|
restrictions: {
|
||||||
minQuantity: number,
|
minQuantity: number;
|
||||||
maxQuantity: number,
|
maxQuantity: number;
|
||||||
freeQuantity: number,
|
freeQuantity: number;
|
||||||
byDefault: number
|
byDefault: number;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OrderProduct {
|
export interface OrderProduct {
|
||||||
id: number;
|
id: number;
|
||||||
amount: number;
|
amount: number;
|
||||||
name: string;
|
name: string;
|
||||||
price: number;
|
price: number;
|
||||||
modifiers: {
|
modifiers: {
|
||||||
[name: string]: OrderModifier[]
|
[name: string]: OrderModifier[];
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OrderModifier {
|
export interface OrderModifier {
|
||||||
name: string;
|
name: string;
|
||||||
id: number;
|
id: number;
|
||||||
price: number;
|
price: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeliveryData {
|
export interface DeliveryData {
|
||||||
paymentMethod: PaymentMethod | null;
|
paymentMethod: PaymentMethod | null;
|
||||||
deliveryDate: Date | null;
|
deliveryDate: Date | null;
|
||||||
deliveryType: DeliveryType | null;
|
deliveryType: DeliveryType | null;
|
||||||
persons: number;
|
persons: number;
|
||||||
comment: string;
|
comment: string;
|
||||||
orderid: number;
|
orderid: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PaymentMethod {
|
export interface PaymentMethod {
|
||||||
type: string;
|
type: string;
|
||||||
label: string;
|
label: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UserData {
|
export interface UserData {
|
||||||
first_name: string | null;
|
first_name: string | null;
|
||||||
last_name: string | null;
|
last_name: string | null;
|
||||||
street: string | null;
|
street: string | null;
|
||||||
house: string | null;
|
house: string | null;
|
||||||
flat: string | null;
|
flat: string | null;
|
||||||
city: string;
|
city: string;
|
||||||
phone: string | null;
|
phone: string | null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,8 +54,13 @@ export class Order {
|
|||||||
delivery_fio: this.userData?.first_name,
|
delivery_fio: this.userData?.first_name,
|
||||||
subtotal: this.price,
|
subtotal: this.price,
|
||||||
delivery_comment: this.deliveryData?.comment,
|
delivery_comment: this.deliveryData?.comment,
|
||||||
delivery: this.deliveryData?.deliveryType?.type,
|
delivery: this.deliveryData?.deliveryType?.name,
|
||||||
delivery_address: this.deliveryData?.deliveryType?.type === "self_delivery" ? '' : `${environment.cities[0]}, ул ${this.userData?.street}, ${this.userData?.house}`,
|
delivery_address: {
|
||||||
|
street: this.userData?.street || '',
|
||||||
|
house: this.userData?.house || '',
|
||||||
|
flat: '',
|
||||||
|
city: ''
|
||||||
|
},
|
||||||
amount: this.price + 100,
|
amount: this.price + 100,
|
||||||
terminal_id: this.terminal_id
|
terminal_id: this.terminal_id
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user