diff --git a/angular/proxy.confi.json b/angular/proxy.confi.json index f69607a..49e155e 100644 --- a/angular/proxy.confi.json +++ b/angular/proxy.confi.json @@ -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": "" diff --git a/angular/src/app/components/user-data-order/user-data-order.component.ts b/angular/src/app/components/user-data-order/user-data-order.component.ts index 5aac8f7..9a0ee39 100644 --- a/angular/src/app/components/user-data-order/user-data-order.component.ts +++ b/angular/src/app/components/user-data-order/user-data-order.component.ts @@ -26,7 +26,7 @@ import { lastValueFrom } from 'rxjs'; }) export class UserDataOrderComponent implements OnInit { - @Output() orderSubmitted = new EventEmitter(); + @Output() orderSubmitted = new EventEmitter(); readonly cities = environment.cities; public paymentMethods!: PaymentMethod[]; public loading = false; @@ -55,7 +55,8 @@ export class UserDataOrderComponent implements OnInit { deliveryType: null, paymentMethod: null, comment: '', - persons: 1 + persons: 1, + orderid: 0 }; public terminalList!: any; public selectedTerminal!: any; @@ -175,14 +176,16 @@ export class UserDataOrderComponent implements OnInit { 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; diff --git a/angular/src/app/interface/data.ts b/angular/src/app/interface/data.ts index 93731f2..4744aa7 100644 --- a/angular/src/app/interface/data.ts +++ b/angular/src/app/interface/data.ts @@ -231,6 +231,7 @@ export interface DeliveryData { deliveryType: DeliveryType | null; persons: number; comment: string; + orderid: number; } export interface PaymentMethod { diff --git a/angular/src/app/models/order.ts b/angular/src/app/models/order.ts index da6b789..7e05b6a 100644 --- a/angular/src/app/models/order.ts +++ b/angular/src/app/models/order.ts @@ -46,6 +46,7 @@ export class Order { persons: 1, name: "31", payment: { + orderid: this.deliveryData?.orderid, delivery_price: 100, products: this.products.map(product => { return product.toJson(); @@ -54,7 +55,7 @@ export class Order { subtotal: this.price, delivery_comment: this.deliveryData?.comment, 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, terminal_id: this.terminal_id }, diff --git a/angular/src/app/pages/cart/cart.component.html b/angular/src/app/pages/cart/cart.component.html index 49a16e7..ad38e03 100644 --- a/angular/src/app/pages/cart/cart.component.html +++ b/angular/src/app/pages/cart/cart.component.html @@ -193,7 +193,7 @@
diff --git a/angular/src/app/pages/cart/cart.component.ts b/angular/src/app/pages/cart/cart.component.ts index c5268bb..1cfadbc 100644 --- a/angular/src/app/pages/cart/cart.component.ts +++ b/angular/src/app/pages/cart/cart.component.ts @@ -84,9 +84,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() { diff --git a/angular/src/environments/environment.prod.ts b/angular/src/environments/environment.prod.ts index a393848..7f4d400 100644 --- a/angular/src/environments/environment.prod.ts +++ b/angular/src/environments/environment.prod.ts @@ -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: ['Менделеевск'], }