import { Router } from '@angular/router';
/*
 * @Author: your name
 * @Date: 2021-12-03 15:31:52
 * @LastEditTime: 2021-12-24 17:40:51
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \tms-obc-web\src\app\routes\order-management\components\vehicle-detail\vehicle-detail.component.ts
 */
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { STColumn } from '@delon/abc/st';
import { _HttpClient } from '@delon/theme';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NzModalService } from 'ng-zorro-antd/modal';
import { OrderManagementService } from '../../services/order-management.service';
@Component({
  selector: 'app-supply-management-bulk-detail',
  templateUrl: './bulk-detail.component.html',
  styleUrls: ['./bulk-detail.component.less']
})
export class OrderManagementBulkeDetailComponent implements OnInit {

 
  id = this.route.snapshot.params.id;
  i: any;
  imges: any;
  isVisible = false;
  logColumns: STColumn[] = [
    { title: '款项', index: 'expenseName' },
    { title: '运输费（元）', index: 'price' },
    { title: '附加费（元）', index: 'surcharge' },
    { title: '支付时间', index: ' paymentTime' },
    {
      title: '支付状态',
      className: 'text-center',
      index: 'paymentStatus',
      type: 'badge',
      width: '120px',
      badge: {
        '1': { text: '待申请', color: 'warning' },
        '2': { text: '已支付', color: 'success' },
        '3': { text: '已拒绝', color: 'warning' },
        '4': { text: '申请中', color: 'warning' },
      },
    },
  ];

  constructor(
    private route: ActivatedRoute,
    private msgSrv: NzMessageService,
    private service: OrderManagementService,
    private router: Router,
  ) {

  }

  ngOnInit(): void {
    console.log(this.id)
    console.log('123')
    this.initData()
  }

  initData() {
    this.service.request(this.service.$api_getBulkBillDetail, {id: this.id}).subscribe(res => {
      console.log(res)
      if (res) {
        this.i =res;
      }
    })
  }


  goBack() {
    window.history.go(-1);
  }
    // 修改订单
  changeOrder() {
      console.log(this.id)
      this.router.navigate(['order-management/bulk-detailChange', this.id])
  }
  agreement(value: any) {
    if(value === '1') {
      this.imges = this.i?.supplementAgreement
    } else if (value === '2') {
      this.imges = this.i?.supplementAgreement
     }
    this.isVisible = true;
  }
  handleCancel() {
    this.isVisible = false
  }
  handleOK() {
  this.isVisible = false
  }
}
