import { Component, OnInit } from '@angular/core';
import { ActivatedRoute,Router } from "@angular/router";
import { MyService } from '../my.service';

@Component({
  selector: 'ydlife-salary-first-year',
  templateUrl: './salary-first-year.component.html',
  styleUrls: ['./salary-first-year.component.scss']
})
export class SalaryFirstYearComponent implements OnInit {
  status:boolean;
  //判断跳转页用的
  type:any;
  //佣奖名称
  salaryName:any;
  //佣奖类型-》用来判断拿保单接口中的哪个数据
  salaryType:any;
  month:any;
  years:any;
  agent_id:any;
  constructor(private activatedRoute: ActivatedRoute,private myService:MyService) { }

  ngOnInit() {
    this.type = this.activatedRoute.snapshot.queryParams.type?this.activatedRoute.snapshot.queryParams.type:null;
    this.salaryName = this.activatedRoute.snapshot.queryParams.salaryName?this.activatedRoute.snapshot.queryParams.salaryName:null;
    this.salaryType = this.activatedRoute.snapshot.paramMap.get('id');
    this.years = this.activatedRoute.snapshot.queryParams.years?this.activatedRoute.snapshot.queryParams.years:null;
    this.month = this.activatedRoute.snapshot.queryParams.month?this.activatedRoute.snapshot.queryParams.month:null;
    this.agent_id = this.activatedRoute.snapshot.queryParams.agent_id?this.activatedRoute.snapshot.queryParams.agent_id:null;
    this.searchStaffSalaryDetails();
  }

  goBack(){
    history.go(-1);
  }

  
  searchStaffSalaryDetails(){
    const param = {
      years:this.years,
      month:this.month,
      agent_id:this.agent_id
    }
    this.myService.searchStaffSalaryDetails(param).subscribe((res)=>{
      console.log(res)
    })
  }
}
