изменила логику кнопки отмены заказа для смены статуса при оплате за нал
This commit is contained in:
parent
0d5e196a67
commit
7e448a9273
@ -150,7 +150,8 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{sumRef}}</th>
|
<th>{{sumRef}}</th>
|
||||||
<th><button [disabled]="order[0].payment[0].summ == sumRef" (click)="confirm(order[0].external_id, order[0].payment[0].payload.id)">Возврат ДС</button></th>
|
<th><button [disabled]="dis == true || this.order[0].status == 'newOrder' || this.order[0].status == 'cancel' || this.order[0].status == 'paymentOverdue'" (click)="confirm(order[0].external_id, order[0].payment[0].type, order[0].id)">Отменить</button></th>
|
||||||
|
<!--<th><button [disabled]="order[0].payment[0].summ == sumRef || pay == false || this.order[0].payment == []" (click)="confirm(order[0].external_id, order[0].payment[0].payload.id)">Возврат ДС</button></th>-->
|
||||||
<!--<th><button disabled>Возврат ДС</button></th>-->
|
<!--<th><button disabled>Возврат ДС</button></th>-->
|
||||||
</tr>
|
</tr>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|||||||
@ -34,6 +34,7 @@ export class OrdersComponent implements OnInit {
|
|||||||
public sumRef1: any = 0;
|
public sumRef1: any = 0;
|
||||||
public sumRef2: any = 0;
|
public sumRef2: any = 0;
|
||||||
public matchModeOptions!: SelectItem[];
|
public matchModeOptions!: SelectItem[];
|
||||||
|
public dis: boolean = false;
|
||||||
|
|
||||||
|
|
||||||
public statuses = [
|
public statuses = [
|
||||||
@ -195,16 +196,15 @@ notif2() {
|
|||||||
|
|
||||||
|
|
||||||
async vievOrder(id: any) {
|
async vievOrder(id: any) {
|
||||||
|
this.dis = false;
|
||||||
await this.jsonRpcService.rpc2({
|
await this.jsonRpcService.rpc2({
|
||||||
method: 'getOrders',
|
method: 'getOrders',
|
||||||
params: { "client_id": this.choose, "order_id": id }
|
params: { "client_id": this.choose, "order_id": id }
|
||||||
}, RpcService.authService, false)
|
}, 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)
|
||||||
@ -260,15 +260,27 @@ notif2() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async doAdminRefund(id: any, qr_id: any) {
|
doAdminRefund(id: any, type: any, id_: any) {
|
||||||
|
this.dis = false;
|
||||||
await this.jsonRpcService.rpc2({
|
let qr_id: string;
|
||||||
|
this.jsonRpcService.rpc2({
|
||||||
|
method: 'getOrders',
|
||||||
|
params: { "client_id": this.choose, "order_id": id_ }
|
||||||
|
}, RpcService.authService, false)
|
||||||
|
.subscribe({
|
||||||
|
next: (result) => {
|
||||||
|
let data = result.result;
|
||||||
|
let dat: Order = data[0];
|
||||||
|
if (dat.payment[0].type == "QR") {
|
||||||
|
qr_id = dat.payment[0].payload.id;
|
||||||
|
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
|
||||||
|
this.dis = true;
|
||||||
},
|
},
|
||||||
error: (err) => {
|
error: (err) => {
|
||||||
console.log('ERROR: ', err)
|
console.log('ERROR: ', err)
|
||||||
@ -279,6 +291,54 @@ notif2() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
this.jsonRpcService.rpc2({
|
||||||
|
method: 'doAdminRefund',
|
||||||
|
params: { "external_id": id}
|
||||||
|
}, RpcService.authService, false)
|
||||||
|
.subscribe({
|
||||||
|
next: (result) => {
|
||||||
|
let data = result.result;
|
||||||
|
this.dis = true;
|
||||||
|
},
|
||||||
|
error: (err) => {
|
||||||
|
console.log('ERROR: ', err)
|
||||||
|
this.messageService.add({
|
||||||
|
severity: 'error',
|
||||||
|
summary: 'Произошла ошибка!',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: (err) => {
|
||||||
|
console.log('ERROR: ', err)
|
||||||
|
this.messageService.add({
|
||||||
|
severity: 'error',
|
||||||
|
summary: 'Произошла ошибка!',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
//await this.jsonRpcService.rpc2({
|
||||||
|
// method: 'doAdminRefund',
|
||||||
|
// params: { "external_id": id, "qr_id": qr_id }
|
||||||
|
//}, RpcService.authService, false)
|
||||||
|
// .subscribe({
|
||||||
|
// next: (result) => {
|
||||||
|
// let data = result.result
|
||||||
|
// },
|
||||||
|
// error: (err) => {
|
||||||
|
// console.log('ERROR: ', err)
|
||||||
|
// this.messageService.add({
|
||||||
|
// severity: 'error',
|
||||||
|
// summary: 'Произошла ошибка!',
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -316,12 +376,22 @@ notif2() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
confirm(id: any, qr_id: any) {
|
confirm(id: any, type: any, id_: any) {
|
||||||
|
if (type == "QR") {
|
||||||
this.confirmationService.confirm({
|
this.confirmationService.confirm({
|
||||||
message: 'Вы действительно хотите сделать возврат оплаты? Статус заказа при этом не изменится. В случае отмены оплаты необходимо обязательно предупредить кассира.',
|
message: 'Вы действительно хотите сделать возврат оплаты и отменить заказ?',
|
||||||
accept: () => {
|
accept: () => {
|
||||||
this.doAdminRefund(id, qr_id)
|
this.doAdminRefund(id, type, id_)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.confirmationService.confirm({
|
||||||
|
message: 'Вы действительно хотите отменить заказ?',
|
||||||
|
accept: () => {
|
||||||
|
this.doAdminRefund(id, type, id_)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user