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" "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": ""

View File

@ -26,7 +26,7 @@ import { lastValueFrom } from 'rxjs';
}) })
export class UserDataOrderComponent implements OnInit, OnDestroy { export class UserDataOrderComponent implements OnInit, OnDestroy {
@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;
@ -56,7 +56,8 @@ export class UserDataOrderComponent implements OnInit, OnDestroy {
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;
@ -182,14 +183,16 @@ export class UserDataOrderComponent implements OnInit, OnDestroy {
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;

View File

@ -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 {

View File

@ -46,6 +46,7 @@ export class Order {
persons: 1, persons: 1,
name: this.userData?.first_name, name: this.userData?.first_name,
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();

View File

@ -194,7 +194,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">

View File

@ -88,9 +88,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() {

View File

@ -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: ['Менделеевск'],
} }