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