forma-pago.component.ts
1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { Component, OnInit } from "@angular/core";
import { ArticuloService } from "src/app/services/articulo/articulo.service";
import { Router } from "@angular/router";
@Component({
selector: "app-forma-pago",
templateUrl: "./forma-pago.component.html",
styleUrls: ["./forma-pago.component.scss"]
})
export class FormaPagoComponent implements OnInit {
constructor(
private articuloService: ArticuloService,
private router: Router
) {}
ngOnInit() {
if (!this.articuloService.carrito.length) {
this.router.navigate([""]);
return;
}
this.mediaPantalla();
}
medioPago(medioPago: number) {
this.articuloService.medioPago = medioPago;
switch (medioPago) {
case 4:
this.router.navigate(["pago-tarjeta"]);
break;
case 9:
this.router.navigate(["pago-electronico"]);
break;
}
}
mediaPantalla() {
if ($('body').hasClass('media-pantalla')) {
$('.reduce-card-1,.reduce-card-2').addClass('media-pantalla');
}
}
}