Merge branch 'demo-stand' of https://git.hlcompany.ru/git/usersite into demo-stand

This commit is contained in:
gofnnp 2023-02-06 00:48:25 +04:00
commit 5b0516f37e
7 changed files with 15 additions and 10 deletions

View File

@ -18,7 +18,7 @@
"logLevel": "debug"
},
"/static": {
"target": "https://sakura.lk.crm4retail.ru/static",
"target": "https://demo-stand.lk.crm4retail.ru/static",
"secure": false,
"pathRewrite": {
"^/static": ""

View File

@ -26,7 +26,7 @@ import { lastValueFrom } from 'rxjs';
})
export class UserDataOrderComponent implements OnInit, OnDestroy {
@Output() orderSubmitted = new EventEmitter<void>();
@Output() orderSubmitted = new EventEmitter<number>();
readonly cities = environment.cities;
public paymentMethods!: PaymentMethod[];
public loading = false;
@ -56,7 +56,8 @@ export class UserDataOrderComponent implements OnInit, OnDestroy {
deliveryType: null,
paymentMethod: null,
comment: '',
persons: 1
persons: 1,
orderid: 0
};
public terminalList!: any;
public selectedTerminal!: any;
@ -182,14 +183,16 @@ export class UserDataOrderComponent implements OnInit, OnDestroy {
this.loading = true;
const userData: UserData = this.mainFormGroup.controls['userDataForm'].getRawValue();
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.setDeliveryData(this.mainFormGroup.controls['deliveryDataForm'].getRawValue());
this.orderService.setDeliveryData(deliveryData);
this.orderService.submit().subscribe({
next: (_) => {
this.loading = false;
this.cartService.clearCart();
this.orderSubmitted.next();
this.orderSubmitted.next(deliveryData.orderid);
},
error: () => {
this.loading = false;

View File

@ -231,6 +231,7 @@ export interface DeliveryData {
deliveryType: DeliveryType | null;
persons: number;
comment: string;
orderid: number;
}
export interface PaymentMethod {

View File

@ -46,6 +46,7 @@ export class Order {
persons: 1,
name: this.userData?.first_name,
payment: {
orderid: this.deliveryData?.orderid,
delivery_price: 100,
products: this.products.map(product => {
return product.toJson();

View File

@ -194,7 +194,7 @@
<app-user-data-order
*ngIf="orderConfirmed"
(orderSubmitted)="orderSubmitted()"
(orderSubmitted)="orderSubmitted($event)"
></app-user-data-order>
<div #loadingEl *ngIf="loading && !orderConfirmed">

View File

@ -88,9 +88,9 @@ export class CartComponent implements OnInit {
}
}
orderSubmitted() {
orderSubmitted(orderid: number) {
this.visibleSidebar = false
this.messageService.add({ severity: 'success', summary: 'Заказ оформлен!' });
this.messageService.add({ severity: 'success', summary: `Заказ оформлен! Номер заказа: ${orderid}` });
}
confirmClearCart() {

View File

@ -20,8 +20,8 @@ export const environment = {
version: packageJson.version,
appleWalletEndpoint: 'https://apple-push-notifications.it-retail.tech/apns/api',
appleWalletSecret: 'Token F5mbzEERAznGKVbB6l',
webhookItRetail: 'https://demo-stand.lk.crm4retail.ru/it-retail/handlers/tillda/1eb3fb56-3c4c-43b7-9a04-ce532ab7548f',
icardProxy: 'https://p1.icard-proxy.crm4retail.ru/',
webhookItRetail: 'https://demo-stand.lk.crm4retail.ru/api/orders/handlers/tillda/115eaf95-bb44-4cfc-851a-fec5325b45ff',
icardProxy: 'https://demo-stand.lk.crm4retail.ru/api/icard-proxy/',
clientName: 'demo-stand',
cities: ['Менделеевск'],
}