parent
e7a389b484
commit
26aa47b004
@ -18,7 +18,7 @@
|
|||||||
"logLevel": "debug"
|
"logLevel": "debug"
|
||||||
},
|
},
|
||||||
"/static": {
|
"/static": {
|
||||||
"target": "https://sakura.lk.crm4retail.ru/static",
|
"target": "https://demo-stand.lk.crm4retail.ru/static",
|
||||||
"secure": false,
|
"secure": false,
|
||||||
"pathRewrite": {
|
"pathRewrite": {
|
||||||
"^/static": ""
|
"^/static": ""
|
||||||
|
|||||||
@ -26,7 +26,7 @@ import { lastValueFrom } from 'rxjs';
|
|||||||
})
|
})
|
||||||
export class UserDataOrderComponent implements OnInit {
|
export class UserDataOrderComponent implements OnInit {
|
||||||
|
|
||||||
@Output() orderSubmitted = new EventEmitter<void>();
|
@Output() orderSubmitted = new EventEmitter<number>();
|
||||||
readonly cities = environment.cities;
|
readonly cities = environment.cities;
|
||||||
public paymentMethods!: PaymentMethod[];
|
public paymentMethods!: PaymentMethod[];
|
||||||
public loading = false;
|
public loading = false;
|
||||||
@ -55,7 +55,8 @@ export class UserDataOrderComponent implements OnInit {
|
|||||||
deliveryType: null,
|
deliveryType: null,
|
||||||
paymentMethod: null,
|
paymentMethod: null,
|
||||||
comment: '',
|
comment: '',
|
||||||
persons: 1
|
persons: 1,
|
||||||
|
orderid: 0
|
||||||
};
|
};
|
||||||
public terminalList!: any;
|
public terminalList!: any;
|
||||||
public selectedTerminal!: any;
|
public selectedTerminal!: any;
|
||||||
@ -175,14 +176,16 @@ export class UserDataOrderComponent implements OnInit {
|
|||||||
this.loading = true;
|
this.loading = true;
|
||||||
const userData: UserData = this.mainFormGroup.controls['userDataForm'].getRawValue();
|
const userData: UserData = this.mainFormGroup.controls['userDataForm'].getRawValue();
|
||||||
userData.phone = this.userData.phone;
|
userData.phone = this.userData.phone;
|
||||||
|
const deliveryData = this.mainFormGroup.controls['deliveryDataForm'].getRawValue()
|
||||||
|
deliveryData.orderid = Math.floor(Math.random() * (10 ** 12))
|
||||||
this.orderService.setUserData(userData);
|
this.orderService.setUserData(userData);
|
||||||
this.orderService.setDeliveryData(this.mainFormGroup.controls['deliveryDataForm'].getRawValue());
|
this.orderService.setDeliveryData(deliveryData);
|
||||||
|
|
||||||
this.orderService.submit().subscribe({
|
this.orderService.submit().subscribe({
|
||||||
next: (_) => {
|
next: (_) => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.cartService.clearCart();
|
this.cartService.clearCart();
|
||||||
this.orderSubmitted.next();
|
this.orderSubmitted.next(deliveryData.orderid);
|
||||||
},
|
},
|
||||||
error: () => {
|
error: () => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
|||||||
@ -231,6 +231,7 @@ export interface DeliveryData {
|
|||||||
deliveryType: DeliveryType | null;
|
deliveryType: DeliveryType | null;
|
||||||
persons: number;
|
persons: number;
|
||||||
comment: string;
|
comment: string;
|
||||||
|
orderid: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PaymentMethod {
|
export interface PaymentMethod {
|
||||||
|
|||||||
@ -46,6 +46,7 @@ export class Order {
|
|||||||
persons: 1,
|
persons: 1,
|
||||||
name: "31",
|
name: "31",
|
||||||
payment: {
|
payment: {
|
||||||
|
orderid: this.deliveryData?.orderid,
|
||||||
delivery_price: 100,
|
delivery_price: 100,
|
||||||
products: this.products.map(product => {
|
products: this.products.map(product => {
|
||||||
return product.toJson();
|
return product.toJson();
|
||||||
@ -54,7 +55,7 @@ export class Order {
|
|||||||
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?.type,
|
||||||
delivery_address: this.deliveryData?.deliveryType?.type === "self_delivery" ? null : `${environment.cities[0]}, ул ${this.userData?.street}, ${this.userData?.house}`,
|
delivery_address: this.deliveryData?.deliveryType?.type === "self_delivery" ? '' : `${environment.cities[0]}, ул ${this.userData?.street}, ${this.userData?.house}`,
|
||||||
amount: this.price + 100,
|
amount: this.price + 100,
|
||||||
terminal_id: this.terminal_id
|
terminal_id: this.terminal_id
|
||||||
},
|
},
|
||||||
|
|||||||
@ -193,7 +193,7 @@
|
|||||||
|
|
||||||
<app-user-data-order
|
<app-user-data-order
|
||||||
*ngIf="orderConfirmed"
|
*ngIf="orderConfirmed"
|
||||||
(orderSubmitted)="orderSubmitted()"
|
(orderSubmitted)="orderSubmitted($event)"
|
||||||
></app-user-data-order>
|
></app-user-data-order>
|
||||||
|
|
||||||
<div #loadingEl *ngIf="loading && !orderConfirmed">
|
<div #loadingEl *ngIf="loading && !orderConfirmed">
|
||||||
|
|||||||
@ -84,9 +84,9 @@ export class CartComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
orderSubmitted() {
|
orderSubmitted(orderid: number) {
|
||||||
this.visibleSidebar = false
|
this.visibleSidebar = false
|
||||||
this.messageService.add({ severity: 'success', summary: 'Заказ оформлен!' });
|
this.messageService.add({ severity: 'success', summary: `Заказ оформлен! Номер заказа: ${orderid}` });
|
||||||
}
|
}
|
||||||
|
|
||||||
confirmClearCart() {
|
confirmClearCart() {
|
||||||
|
|||||||
@ -20,8 +20,8 @@ export const environment = {
|
|||||||
version: packageJson.version,
|
version: packageJson.version,
|
||||||
appleWalletEndpoint: 'https://apple-push-notifications.it-retail.tech/apns/api',
|
appleWalletEndpoint: 'https://apple-push-notifications.it-retail.tech/apns/api',
|
||||||
appleWalletSecret: 'Token F5mbzEERAznGKVbB6l',
|
appleWalletSecret: 'Token F5mbzEERAznGKVbB6l',
|
||||||
webhookItRetail: 'https://demo-stand.lk.crm4retail.ru/it-retail/handlers/tillda/1eb3fb56-3c4c-43b7-9a04-ce532ab7548f',
|
webhookItRetail: 'https://demo-stand.lk.crm4retail.ru/api/orders/handlers/tillda/115eaf95-bb44-4cfc-851a-fec5325b45ff',
|
||||||
icardProxy: 'https://p1.icard-proxy.crm4retail.ru/',
|
icardProxy: 'https://demo-stand.lk.crm4retail.ru/api/icard-proxy/',
|
||||||
clientName: 'demo-stand',
|
clientName: 'demo-stand',
|
||||||
cities: ['Менделеевск'],
|
cities: ['Менделеевск'],
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user