parent
dc87f5cb78
commit
fc74424674
@ -55,7 +55,7 @@ export interface Order {
|
|||||||
delivery_address: Delivery_address;
|
delivery_address: Delivery_address;
|
||||||
due_datetime: string;
|
due_datetime: string;
|
||||||
external_id: string;
|
external_id: string;
|
||||||
id: string;
|
id: number;
|
||||||
payment: Payment[];
|
payment: Payment[];
|
||||||
phone: string;
|
phone: string;
|
||||||
products: Products[];
|
products: Products[];
|
||||||
|
|||||||
@ -85,24 +85,16 @@
|
|||||||
<td><input textarea disabled type="datetime-local" value="{{ord.date_created}}"></td>
|
<td><input textarea disabled type="datetime-local" value="{{ord.date_created}}"></td>
|
||||||
<td><input textarea disabled type="text" value="{{ord.address.id}}"></td>
|
<td><input textarea disabled type="text" value="{{ord.address.id}}"></td>
|
||||||
<td>
|
<td>
|
||||||
<select>
|
<select [(ngModel)]="selectedStatus">
|
||||||
<option selected>{{ord.status_h}}</option>
|
<option selected>{{ord.status_h}}</option>
|
||||||
<option>К готовке</option>
|
<option>К готовке</option>
|
||||||
<option>Готовится</option>
|
<option>Готовится</option>
|
||||||
<option>Готово</option>
|
<option>Готово</option>
|
||||||
<option>Отменен</option>
|
|
||||||
<option>Можно забирать</option>
|
|
||||||
<option>У курьера</option>
|
|
||||||
<option>Доставлен</option>
|
|
||||||
<option>Не подтвержден</option>
|
|
||||||
<option>Требует согласия</option>
|
|
||||||
<option>Требуется оплата</option>
|
|
||||||
<option>Оплата просрочена</option>
|
|
||||||
<option>Новый</option>
|
<option>Новый</option>
|
||||||
<option>Выдан</option>
|
<option>Выдан</option>
|
||||||
<option>Нужен возврат</option>
|
|
||||||
<option>Напечатан</option>
|
<option>Напечатан</option>
|
||||||
</select>
|
</select>
|
||||||
|
<button (click)="saveStatus(order[0].id)" [disabled]="!selectedStatus.length">Сохранить</button>
|
||||||
</td>
|
</td>
|
||||||
<td>{{orderTypes[leadToTypeOrderType(ord.type)]}}</td>
|
<td>{{orderTypes[leadToTypeOrderType(ord.type)]}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@ -1,27 +1,38 @@
|
|||||||
import { Component, OnInit, Renderer2, ElementRef, Input } from "@angular/core";
|
import { Component, OnInit, Renderer2, ElementRef, Input } from '@angular/core';
|
||||||
import { TableModule } from 'primeng/table';
|
import { TableModule } from 'primeng/table';
|
||||||
import { JsonrpcService, RpcService } from "src/app/services/jsonrpc.service";
|
import { JsonrpcService, RpcService } from 'src/app/services/jsonrpc.service';
|
||||||
import { MessageService } from "primeng/api";
|
import { MessageService } from 'primeng/api';
|
||||||
import { Order, Products, Delivery_address, Notification, Refund } from "src/app/interface/data";
|
import {
|
||||||
import { ClientsComponent } from "../clients/clients.component";
|
Order,
|
||||||
|
Products,
|
||||||
|
Delivery_address,
|
||||||
|
Notification,
|
||||||
|
Refund,
|
||||||
|
} from 'src/app/interface/data';
|
||||||
|
import { ClientsComponent } from '../clients/clients.component';
|
||||||
import { ToastModule } from 'primeng/toast';
|
import { ToastModule } from 'primeng/toast';
|
||||||
import { ConfirmationService, FilterService, FilterMatchMode, SelectItem } from 'primeng/api';
|
import {
|
||||||
import { OrderTypes } from "src/app/data/data";
|
ConfirmationService,
|
||||||
|
FilterService,
|
||||||
|
FilterMatchMode,
|
||||||
|
SelectItem,
|
||||||
|
} from 'primeng/api';
|
||||||
|
import { OrderTypes } from 'src/app/data/data';
|
||||||
|
import { catchError, map } from 'rxjs';
|
||||||
/*import { SwPush, NewsletterService } from '@angular/service-worker*/
|
/*import { SwPush, NewsletterService } from '@angular/service-worker*/
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-orders',
|
selector: 'app-orders',
|
||||||
templateUrl: './orders.component.html',
|
templateUrl: './orders.component.html',
|
||||||
styleUrls: ['./orders.component.scss'],
|
styleUrls: ['./orders.component.scss'],
|
||||||
providers: [ClientsComponent]
|
providers: [ClientsComponent],
|
||||||
})
|
})
|
||||||
export class OrdersComponent implements OnInit {
|
export class OrdersComponent implements OnInit {
|
||||||
public orders: Array<Order> = [];
|
public orders: Array<Order> = [];
|
||||||
public order: Array<Order> = [];
|
public order: Array<Order> = [];
|
||||||
public view: boolean = true;
|
public view: boolean = true;
|
||||||
public chooseName!: string;
|
public chooseName!: string;
|
||||||
public lastOrderUpdateTime: string = "";
|
public lastOrderUpdateTime: string = '';
|
||||||
public choose = this.jsonRpcService.ClientChoose;
|
public choose = this.jsonRpcService.ClientChoose;
|
||||||
public notification: Array<Notification> = [];
|
public notification: Array<Notification> = [];
|
||||||
public map_new = new Map();
|
public map_new = new Map();
|
||||||
@ -37,318 +48,374 @@ export class OrdersComponent implements OnInit {
|
|||||||
public sumRef3: any = 0;
|
public sumRef3: any = 0;
|
||||||
public matchModeOptions!: SelectItem[];
|
public matchModeOptions!: SelectItem[];
|
||||||
public dis: boolean = false;
|
public dis: boolean = false;
|
||||||
public readonly orderTypes = OrderTypes
|
public readonly orderTypes = OrderTypes;
|
||||||
|
public selectedStatus: string = '';
|
||||||
|
|
||||||
public statuses = [
|
public statuses = [
|
||||||
"К готовке",
|
'К готовке',
|
||||||
"Готовится",
|
'Готовится',
|
||||||
"Готово",
|
'Готово',
|
||||||
"Отменен",
|
'Отменен',
|
||||||
"Можно забирать",
|
'Можно забирать',
|
||||||
"У курьера",
|
'У курьера',
|
||||||
"Доставлен",
|
'Доставлен',
|
||||||
"Не подтвержден",
|
'Не подтвержден',
|
||||||
"Требует согласия",
|
'Требует согласия',
|
||||||
"Требуется оплата",
|
'Требуется оплата',
|
||||||
"Оплата просрочена",
|
'Оплата просрочена',
|
||||||
"Новый",
|
'Новый',
|
||||||
"Выдан",
|
'Выдан',
|
||||||
"Нужен возврат",
|
'Нужен возврат',
|
||||||
"Чек напечатан"
|
'Чек напечатан',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private jsonRpcService: JsonrpcService,
|
||||||
constructor(
|
private messageService: MessageService,
|
||||||
private jsonRpcService: JsonrpcService,
|
private clientsComponent: ClientsComponent,
|
||||||
private messageService: MessageService,
|
private confirmationService: ConfirmationService,
|
||||||
private clientsComponent: ClientsComponent,
|
private filterService: FilterService
|
||||||
private confirmationService: ConfirmationService,
|
) {}
|
||||||
private filterService: FilterService
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
|
|
||||||
if (this.choose) {
|
if (this.choose) {
|
||||||
this.getOrders();
|
this.getOrders();
|
||||||
setTimeout(() => this.notif(), 700);
|
setTimeout(() => this.notif(), 700);
|
||||||
|
|
||||||
setInterval(() => this.getOrders(), 60000);
|
setInterval(() => this.getOrders(), 60000);
|
||||||
this.chooseName = this.jsonRpcService.ClientChooseName;
|
this.chooseName = this.jsonRpcService.ClientChooseName;
|
||||||
}
|
}
|
||||||
const customFilterName = "custom-contains";
|
const customFilterName = 'custom-contains';
|
||||||
this.filterService.register(customFilterName, (value: any, filter: any): boolean => {
|
this.filterService.register(
|
||||||
if (filter === undefined || filter === null || filter.trim() === '') {
|
customFilterName,
|
||||||
return true;
|
(value: any, filter: any): boolean => {
|
||||||
}
|
if (filter === undefined || filter === null || filter.trim() === '') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
let det = value.toString();
|
||||||
|
let det2 = det.toLowerCase();
|
||||||
|
return (
|
||||||
|
det2.includes(filter.toString()) || det.includes(filter.toString())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
let det = value.toString()
|
);
|
||||||
let det2 = det.toLowerCase()
|
|
||||||
return det2.includes(filter.toString()) || det.includes(filter.toString());
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
this.matchModeOptions = [
|
this.matchModeOptions = [
|
||||||
{ label: 'Содержит', value: customFilterName },
|
{ label: 'Содержит', value: customFilterName },
|
||||||
{ label: 'Равно', value: FilterMatchMode.EQUALS },
|
{ label: 'Равно', value: FilterMatchMode.EQUALS },
|
||||||
{ label: 'Начинается с', value: FilterMatchMode.STARTS_WITH },
|
{ label: 'Начинается с', value: FilterMatchMode.STARTS_WITH },
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
keysFromObject(object: any) {
|
keysFromObject(object: any) {
|
||||||
return Object.keys(object)
|
return Object.keys(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
notif() {
|
notif() {
|
||||||
for (let i = 0; i < this.orders.length; i++) {
|
for (let i = 0; i < this.orders.length; i++) {
|
||||||
this.map_new.set(this.orders[i].id, true)
|
this.map_new.set(this.orders[i].id, true);
|
||||||
this.map_new_fin.set(this.orders[i].id, true)
|
this.map_new_fin.set(this.orders[i].id, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getOrders() {
|
async getOrders() {
|
||||||
this.myAudioP.src = "../../../assets/myAudio12.mp3";
|
this.myAudioP.src = '../../../assets/myAudio12.mp3';
|
||||||
this.myAudioA.src = "../../../assets/myAudio23.mp3";
|
this.myAudioA.src = '../../../assets/myAudio23.mp3';
|
||||||
if (this.view == true) {
|
if (this.view == true) {
|
||||||
await this.jsonRpcService.rpc2({
|
await this.jsonRpcService
|
||||||
method: 'getOrders',
|
.rpc2(
|
||||||
params: {
|
{
|
||||||
"client_id": this.choose, "order_status": [
|
method: 'getOrders',
|
||||||
"readyToStart",
|
params: {
|
||||||
"inProgress",
|
client_id: this.choose,
|
||||||
"complete",
|
order_status: [
|
||||||
"cancel",
|
'readyToStart',
|
||||||
"readyToPickup",
|
'inProgress',
|
||||||
"onWay",
|
'complete',
|
||||||
"delivered",
|
'cancel',
|
||||||
"unconfirmed",
|
'readyToPickup',
|
||||||
"requiresConsent",
|
'onWay',
|
||||||
"requiresPayment",
|
'delivered',
|
||||||
"paymentOverdue",
|
'unconfirmed',
|
||||||
"newOrder",
|
'requiresConsent',
|
||||||
"issued",
|
'requiresPayment',
|
||||||
"needReturnPayment",
|
'paymentOverdue',
|
||||||
"printedCheck",
|
'newOrder',
|
||||||
]
|
'issued',
|
||||||
}
|
'needReturnPayment',
|
||||||
}, RpcService.authService, false)
|
'printedCheck',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
RpcService.authService,
|
||||||
|
false
|
||||||
|
)
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: (result) => {
|
next: (result) => {
|
||||||
let data = result.result;
|
let data = result.result;
|
||||||
this.color(data);
|
this.color(data);
|
||||||
this.orders = data;
|
this.orders = data;
|
||||||
|
|
||||||
|
|
||||||
this.lastOrderUpdateTime = Date().toString();
|
this.lastOrderUpdateTime = Date().toString();
|
||||||
|
|
||||||
document.getElementsByTagName('thead')[0].style.display = 'table';
|
document.getElementsByTagName('thead')[0].style.display = 'table';
|
||||||
document.getElementsByTagName('thead')[0].style.width = '100%';
|
document.getElementsByTagName('thead')[0].style.width = '100%';
|
||||||
document.getElementsByTagName('thead')[0].style.tableLayout = 'fixed';
|
document.getElementsByTagName('thead')[0].style.tableLayout =
|
||||||
|
'fixed';
|
||||||
document.getElementsByTagName('tbody')[0].style.display = 'block';
|
document.getElementsByTagName('tbody')[0].style.display = 'block';
|
||||||
document.getElementsByTagName('tbody')[0].style.maxHeight = 'calc(100vh - 385px)';
|
document.getElementsByTagName('tbody')[0].style.maxHeight =
|
||||||
document.getElementsByTagName('tbody')[0].style.overflowY = 'scroll';
|
'calc(100vh - 385px)';
|
||||||
|
document.getElementsByTagName('tbody')[0].style.overflowY =
|
||||||
|
'scroll';
|
||||||
},
|
},
|
||||||
error: (err) => {
|
error: (err) => {
|
||||||
console.log('ERROR: ', err)
|
console.log('ERROR: ', err);
|
||||||
this.messageService.add({
|
this.messageService.add({
|
||||||
severity: 'error',
|
severity: 'error',
|
||||||
summary: 'Произошла ошибка!',
|
summary: 'Произошла ошибка!',
|
||||||
})
|
});
|
||||||
}
|
},
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
setTimeout(() => this.notif2(), 700);
|
||||||
|
}
|
||||||
|
|
||||||
|
saveStatus(orderId: number) {
|
||||||
|
this.jsonRpcService
|
||||||
|
.rpc(
|
||||||
|
{
|
||||||
|
method: 'changeOrderStatusForOperator',
|
||||||
|
params: [this.choose, orderId, this.selectedStatus],
|
||||||
|
},
|
||||||
|
RpcService.authService,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
.pipe(
|
||||||
|
map((value) => {
|
||||||
|
console.log('####: value ', value);
|
||||||
|
this.messageService.add({
|
||||||
|
severity: 'success',
|
||||||
|
summary: 'Статус изменен!',
|
||||||
|
});
|
||||||
|
return value;
|
||||||
|
}),
|
||||||
|
catchError((err) => {
|
||||||
|
console.error(err);
|
||||||
|
this.messageService.add({
|
||||||
|
severity: 'error',
|
||||||
|
summary: 'Произошла ошибка!',
|
||||||
|
});
|
||||||
|
return err;
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
setTimeout(() => this.notif2(), 700)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
notif2() {
|
||||||
|
for (let i = 0; i < this.orders.length; i++) {
|
||||||
notif2() {
|
if (this.map_new.has(this.orders[i].id) == false) {
|
||||||
for (let i = 0; i < this.orders.length; i++) {
|
this.map_new.set(this.orders[i].id, true);
|
||||||
if (this.map_new.has(this.orders[i].id) == false) {
|
}
|
||||||
this.map_new.set(this.orders[i].id, true);
|
if (
|
||||||
}
|
this.map_new_fin.has(this.orders[i].id) == false &&
|
||||||
if (this.map_new_fin.has(this.orders[i].id) == false && this.map_new.has(this.orders[i].id) == true) {
|
this.map_new.has(this.orders[i].id) == true
|
||||||
this.myAudioP.load();
|
) {
|
||||||
this.myAudioP.play();
|
this.myAudioP.load();
|
||||||
this.map_new_fin.set(this.orders[i].id, true);
|
this.myAudioP.play();
|
||||||
this.messageService.add({
|
this.map_new_fin.set(this.orders[i].id, true);
|
||||||
severity: 'info',
|
this.messageService.add({
|
||||||
detail: 'Пришел новый заказ №' + this.orders[i].external_id,
|
severity: 'info',
|
||||||
summary: 'Новый заказ!',
|
detail: 'Пришел новый заказ №' + this.orders[i].external_id,
|
||||||
key: 'br', sticky: true
|
summary: 'Новый заказ!',
|
||||||
})
|
key: 'br',
|
||||||
}
|
sticky: true,
|
||||||
var date1 = new Date();
|
});
|
||||||
var date2 = new Date(this.orders[i].due_datetime);
|
}
|
||||||
if ((date2.getTime() - date1.getTime() < 1000 * 3600) && (this.orders[i].status_h == 'К готовке') && (this.map_due.has(this.orders[i].id) == false) && (date2.getTime() - date1.getTime() > 1000 * 3000)) {
|
var date1 = new Date();
|
||||||
this.myAudioA.load();
|
var date2 = new Date(this.orders[i].due_datetime);
|
||||||
this.myAudioA.play();
|
if (
|
||||||
this.map_due.set(this.orders[i].id, true);
|
date2.getTime() - date1.getTime() < 1000 * 3600 &&
|
||||||
this.messageService.add({
|
this.orders[i].status_h == 'К готовке' &&
|
||||||
severity: 'warn',
|
this.map_due.has(this.orders[i].id) == false &&
|
||||||
detail: 'По заказу ' + this.orders[i].external_id + ' до прихода покупателя остался 1 час!',
|
date2.getTime() - date1.getTime() > 1000 * 3000
|
||||||
summary: 'Не взят в работу!',
|
) {
|
||||||
key: 'br', sticky: true
|
this.myAudioA.load();
|
||||||
})
|
this.myAudioA.play();
|
||||||
|
this.map_due.set(this.orders[i].id, true);
|
||||||
|
this.messageService.add({
|
||||||
|
severity: 'warn',
|
||||||
|
detail:
|
||||||
|
'По заказу ' +
|
||||||
|
this.orders[i].external_id +
|
||||||
|
' до прихода покупателя остался 1 час!',
|
||||||
|
summary: 'Не взят в работу!',
|
||||||
|
key: 'br',
|
||||||
|
sticky: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
async vievOrder(id: any) {
|
async vievOrder(id: any) {
|
||||||
this.dis = false;
|
this.dis = false;
|
||||||
await this.jsonRpcService.rpc2({
|
await this.jsonRpcService
|
||||||
method: 'getOrders',
|
.rpc2(
|
||||||
params: { "client_id": this.choose, "order_id": id }
|
{
|
||||||
}, RpcService.authService, false)
|
method: 'getOrders',
|
||||||
|
params: { client_id: this.choose, order_id: id },
|
||||||
|
},
|
||||||
|
RpcService.authService,
|
||||||
|
false
|
||||||
|
)
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: (result) => {
|
next: (result) => {
|
||||||
let data = result.result;
|
let data = result.result;
|
||||||
this.order = data;
|
this.order = data;
|
||||||
},
|
},
|
||||||
error: (err) => {
|
error: (err) => {
|
||||||
console.log('ERROR: ', err)
|
console.log('ERROR: ', err);
|
||||||
this.messageService.add({
|
this.messageService.add({
|
||||||
severity: 'error',
|
severity: 'error',
|
||||||
summary: 'Произошла ошибка!',
|
summary: 'Произошла ошибка!',
|
||||||
})
|
});
|
||||||
}
|
},
|
||||||
}
|
});
|
||||||
);
|
|
||||||
this.view = false;
|
this.view = false;
|
||||||
setTimeout(() => this.getOrderRefunds(this.order[0].external_id), 400);
|
setTimeout(() => this.getOrderRefunds(this.order[0].external_id), 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async getOrderRefunds(id: any) {
|
async getOrderRefunds(id: any) {
|
||||||
|
await this.jsonRpcService
|
||||||
await this.jsonRpcService.rpc2({
|
.rpc2(
|
||||||
method: 'getOrderRefunds',
|
{
|
||||||
params: { "external_id": id }
|
method: 'getOrderRefunds',
|
||||||
}, RpcService.authService, false)
|
params: { external_id: id },
|
||||||
|
},
|
||||||
|
RpcService.authService,
|
||||||
|
false
|
||||||
|
)
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: (result) => {
|
next: (result) => {
|
||||||
let data = result.result
|
let data = result.result;
|
||||||
this.refund =data
|
this.refund = data;
|
||||||
|
|
||||||
if (this.refund.admin_return.status == 'COMPLETED') {
|
if (this.refund.admin_return.status == 'COMPLETED') {
|
||||||
this.sumRef0 = this.refund.admin_return.amount
|
this.sumRef0 = this.refund.admin_return.amount;
|
||||||
} else this.sumRef0 = 0;
|
} else this.sumRef0 = 0;
|
||||||
if (this.refund.difference_return.status == 'COMPLETED') {
|
if (this.refund.difference_return.status == 'COMPLETED') {
|
||||||
this.sumRef1 = this.refund.difference_return.amount
|
this.sumRef1 = this.refund.difference_return.amount;
|
||||||
} else this.sumRef1 = 0;
|
} else this.sumRef1 = 0;
|
||||||
if (this.refund.full_return.status == 'COMPLETED') {
|
if (this.refund.full_return.status == 'COMPLETED') {
|
||||||
this.sumRef2 = this.refund.full_return.amount
|
this.sumRef2 = this.refund.full_return.amount;
|
||||||
} else this.sumRef2 = 0;
|
} else this.sumRef2 = 0;
|
||||||
this.sumRef3 = this.sumRef0 + this.sumRef1 + this.sumRef2
|
this.sumRef3 = this.sumRef0 + this.sumRef1 + this.sumRef2;
|
||||||
this.sumRef = parseFloat(this.sumRef3.toFixed(2))
|
this.sumRef = parseFloat(this.sumRef3.toFixed(2));
|
||||||
|
|
||||||
},
|
},
|
||||||
error: (err) => {
|
error: (err) => {
|
||||||
console.log('ERROR: ', err)
|
console.log('ERROR: ', err);
|
||||||
this.messageService.add({
|
this.messageService.add({
|
||||||
severity: 'error',
|
severity: 'error',
|
||||||
summary: 'Произошла ошибка!',
|
summary: 'Произошла ошибка!',
|
||||||
})
|
});
|
||||||
}
|
},
|
||||||
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
doAdminRefund(id: any, type: any, id_: any) {
|
doAdminRefund(id: any, type: any, id_: any) {
|
||||||
this.dis = false;
|
this.dis = false;
|
||||||
let qr_id: string;
|
let qr_id: string;
|
||||||
this.jsonRpcService.rpc2({
|
this.jsonRpcService
|
||||||
method: 'getOrders',
|
.rpc2(
|
||||||
params: { "client_id": this.choose, "order_id": id_ }
|
{
|
||||||
}, RpcService.authService, false)
|
method: 'getOrders',
|
||||||
|
params: { client_id: this.choose, order_id: id_ },
|
||||||
|
},
|
||||||
|
RpcService.authService,
|
||||||
|
false
|
||||||
|
)
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: (result) => {
|
next: (result) => {
|
||||||
let data = result.result;
|
let data = result.result;
|
||||||
let dat: Order = data[0];
|
let dat: Order = data[0];
|
||||||
if (dat.payment[0].type == "QR") {
|
if (dat.payment[0].type == 'QR') {
|
||||||
qr_id = dat.payment[0].payload.id;
|
qr_id = dat.payment[0].payload.id;
|
||||||
this.jsonRpcService.rpc2({
|
this.jsonRpcService
|
||||||
method: 'doAdminRefund',
|
.rpc2(
|
||||||
params: { "order_id": id_, "qr_id": qr_id }
|
{
|
||||||
}, RpcService.authService, false)
|
method: 'doAdminRefund',
|
||||||
.subscribe({
|
params: { order_id: id_, qr_id: qr_id },
|
||||||
next: (result) => {
|
|
||||||
let data = result.result
|
|
||||||
this.dis = true;
|
|
||||||
},
|
},
|
||||||
error: (err) => {
|
RpcService.authService,
|
||||||
console.log('ERROR: ', err)
|
false
|
||||||
this.messageService.add({
|
)
|
||||||
severity: 'error',
|
|
||||||
summary: `Произошла ошибка! ${err.error.error.message}`,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
this.jsonRpcService.rpc2({
|
|
||||||
method: 'doAdminRefund',
|
|
||||||
params: { "order_id": id_}
|
|
||||||
}, RpcService.authService, false)
|
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next: (result) => {
|
next: (result) => {
|
||||||
let data = result.result;
|
let data = result.result;
|
||||||
this.dis = true;
|
this.dis = true;
|
||||||
},
|
},
|
||||||
error: (err) => {
|
error: (err) => {
|
||||||
console.log('ERROR: ', err)
|
console.log('ERROR: ', err);
|
||||||
|
this.messageService.add({
|
||||||
|
severity: 'error',
|
||||||
|
summary: `Произошла ошибка! ${err.error.error.message}`,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.jsonRpcService
|
||||||
|
.rpc2(
|
||||||
|
{
|
||||||
|
method: 'doAdminRefund',
|
||||||
|
params: { order_id: id_ },
|
||||||
|
},
|
||||||
|
RpcService.authService,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
.subscribe({
|
||||||
|
next: (result) => {
|
||||||
|
let data = result.result;
|
||||||
|
this.dis = true;
|
||||||
|
},
|
||||||
|
error: (err) => {
|
||||||
|
console.log('ERROR: ', err);
|
||||||
this.messageService.add({
|
this.messageService.add({
|
||||||
severity: 'error',
|
severity: 'error',
|
||||||
summary: 'Произошла ошибка!',
|
summary: 'Произошла ошибка!',
|
||||||
})
|
});
|
||||||
}
|
},
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: (err) => {
|
error: (err) => {
|
||||||
console.log('ERROR: ', err)
|
console.log('ERROR: ', err);
|
||||||
this.messageService.add({
|
this.messageService.add({
|
||||||
severity: 'error',
|
severity: 'error',
|
||||||
summary: 'Произошла ошибка!',
|
summary: 'Произошла ошибка!',
|
||||||
})
|
});
|
||||||
}
|
},
|
||||||
}
|
});
|
||||||
);
|
//await this.jsonRpcService.rpc2({
|
||||||
//await this.jsonRpcService.rpc2({
|
// method: 'doAdminRefund',
|
||||||
// method: 'doAdminRefund',
|
// params: { "external_id": id, "qr_id": qr_id }
|
||||||
// params: { "external_id": id, "qr_id": qr_id }
|
//}, RpcService.authService, false)
|
||||||
//}, RpcService.authService, false)
|
// .subscribe({
|
||||||
// .subscribe({
|
// next: (result) => {
|
||||||
// next: (result) => {
|
// let data = result.result
|
||||||
// let data = result.result
|
// },
|
||||||
// },
|
// error: (err) => {
|
||||||
// error: (err) => {
|
// console.log('ERROR: ', err)
|
||||||
// console.log('ERROR: ', err)
|
// this.messageService.add({
|
||||||
// this.messageService.add({
|
// severity: 'error',
|
||||||
// severity: 'error',
|
// summary: 'Произошла ошибка!',
|
||||||
// summary: 'Произошла ошибка!',
|
// })
|
||||||
// })
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// );
|
||||||
// );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
listOrders() {
|
listOrders() {
|
||||||
this.view = true;
|
this.view = true;
|
||||||
this.getOrders();
|
this.getOrders();
|
||||||
@ -359,53 +426,63 @@ notif2() {
|
|||||||
var item = targetData[i];
|
var item = targetData[i];
|
||||||
var date1 = new Date();
|
var date1 = new Date();
|
||||||
var date2 = new Date(item.due_datetime);
|
var date2 = new Date(item.due_datetime);
|
||||||
if ((date2.getTime() - date1.getTime() < 1000 * 3600) && (item.status_h == 'К готовке') && (date2.getTime() - date1.getTime() >= 0)) {
|
if (
|
||||||
item.item_style = 'orange'
|
date2.getTime() - date1.getTime() < 1000 * 3600 &&
|
||||||
};
|
item.status_h == 'К готовке' &&
|
||||||
if ((item.status_h == 'К готовке') && (date2.getTime() - date1.getTime() < 0)) {
|
date2.getTime() - date1.getTime() >= 0
|
||||||
item.item_style = 'red'
|
) {
|
||||||
};
|
item.item_style = 'orange';
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
item.status_h == 'К готовке' &&
|
||||||
|
date2.getTime() - date1.getTime() < 0
|
||||||
|
) {
|
||||||
|
item.item_style = 'red';
|
||||||
|
}
|
||||||
if (item.status_h == 'Готово') {
|
if (item.status_h == 'Готово') {
|
||||||
item.item_style = 'green'
|
item.item_style = 'green';
|
||||||
};
|
}
|
||||||
if ((item.status_h == 'Отменен') || (item.status_h == 'Оплата просрочена')) {
|
if (item.status_h == 'Отменен' || item.status_h == 'Оплата просрочена') {
|
||||||
item.item_style = 'grey'
|
item.item_style = 'grey';
|
||||||
};
|
}
|
||||||
if ((date2.getTime() - date1.getTime() >= 1000 * 3600) && (item.status_h == 'К готовке')) {
|
if (
|
||||||
item.item_style = 'yellow'
|
date2.getTime() - date1.getTime() >= 1000 * 3600 &&
|
||||||
};
|
item.status_h == 'К готовке'
|
||||||
|
) {
|
||||||
|
item.item_style = 'yellow';
|
||||||
|
}
|
||||||
if (item.status_h == 'Готовится') {
|
if (item.status_h == 'Готовится') {
|
||||||
item.item_style = 'blue'
|
item.item_style = 'blue';
|
||||||
};
|
}
|
||||||
if (item.status_h == 'Выдан') {
|
if (item.status_h == 'Выдан') {
|
||||||
item.item_style = 'lilac'
|
item.item_style = 'lilac';
|
||||||
};
|
}
|
||||||
if (item.status_h == 'Напечатан') {
|
if (item.status_h == 'Напечатан') {
|
||||||
item.item_style = 'pink'
|
item.item_style = 'pink';
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
confirm(id: any, type: any, id_: any) {
|
confirm(id: any, type: any, id_: any) {
|
||||||
if (type == "QR") {
|
if (type == 'QR') {
|
||||||
this.confirmationService.confirm({
|
this.confirmationService.confirm({
|
||||||
message: 'Вы действительно хотите сделать возврат оплаты и отменить заказ?',
|
message:
|
||||||
|
'Вы действительно хотите сделать возврат оплаты и отменить заказ?',
|
||||||
accept: () => {
|
accept: () => {
|
||||||
this.doAdminRefund(id, type, id_)
|
this.doAdminRefund(id, type, id_);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.confirmationService.confirm({
|
this.confirmationService.confirm({
|
||||||
message: 'Вы действительно хотите отменить заказ?',
|
message: 'Вы действительно хотите отменить заказ?',
|
||||||
accept: () => {
|
accept: () => {
|
||||||
this.doAdminRefund(id, type, id_)
|
this.doAdminRefund(id, type, id_);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
leadToTypeOrderType(str: any) {
|
leadToTypeOrderType(str: any) {
|
||||||
return str as keyof typeof this.orderTypes
|
return str as keyof typeof this.orderTypes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user