206 lines
6.4 KiB
TypeScript
206 lines
6.4 KiB
TypeScript
/*
|
|
* @Description :
|
|
* @Version : 1.0
|
|
* @Author : Shiming
|
|
* @Date : 2021-12-06 20:20:26
|
|
* @LastEditors : Shiming
|
|
* @LastEditTime : 2022-03-09 14:31:47
|
|
* @FilePath : \\tms-obc-web\\src\\app\\routes\\order-management\\components\\bulk-detail\\bulk-detail.component.ts
|
|
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
|
*/
|
|
import { Router } from '@angular/router';
|
|
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';
|
|
import { NzCardComponent } from 'ng-zorro-antd/card';
|
|
import format from 'date-fns/format';
|
|
|
|
@Component({
|
|
selector: 'app-supply-management-bulk-detail',
|
|
templateUrl: './bulk-detail.component.html',
|
|
styleUrls: ['./bulk-detail.component.less']
|
|
})
|
|
export class OrderManagementBulkeDetailComponent implements OnInit {
|
|
MapList: any[]=[];
|
|
id = this.route.snapshot.params.id;
|
|
billExpenses: any[] = []; //运费信息表格信息
|
|
pois: any[] = [];
|
|
i: any;
|
|
imges: any;
|
|
totalObj: any;
|
|
attObj: any;
|
|
isVisible = false;
|
|
logColumns2: STColumn[] = [
|
|
{ title: '时间', index: 'vinOutTime' },
|
|
{ title: '地点', index: 'cityName' },
|
|
];
|
|
logColumns: STColumn[] = [
|
|
{ title: '款项', index: 'expenseCodeLabel' },
|
|
{ title: '小计(元)', render: 'price' },
|
|
{ title: '运输费(元)', render: 'price' },
|
|
{ title: '附加费(元)', render: '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' }
|
|
}
|
|
}
|
|
];
|
|
trajectory = 'car';
|
|
mapList:any[] = []; //地图点位数据组
|
|
addressItems:any[] = []; //打点地址数据组
|
|
constructor(
|
|
private route: ActivatedRoute,
|
|
private msgSrv: NzMessageService,
|
|
private service: OrderManagementService,
|
|
private router: Router,
|
|
private modal: NzModalService
|
|
) {}
|
|
|
|
ngOnInit(): void {
|
|
this.initData();
|
|
this.getTrajectory();
|
|
}
|
|
|
|
initData() {
|
|
this.service.request(this.service.$api_getBulkBillDetail, { id: this.id }).subscribe(res => {
|
|
if (res) {
|
|
this.i = res;
|
|
this.billExpenses = this.i?.billExpenseDetailVOList?.filter((data: any) => data.expenseCode === 'TRA');
|
|
this.i.scheduleVOList = this.i?.scheduleVOList?.filter((data:any)=>data.displayStatus !=="HIDE");
|
|
this.pois = [
|
|
{
|
|
markerLabel: '起',
|
|
color: 'blue',
|
|
position: [res.startingPoint.longitude, res.startingPoint.latitude],
|
|
title: res.startingPoint.detailedAddress
|
|
},
|
|
{
|
|
markerLabel: '卸',
|
|
color: 'red',
|
|
position: [res.endPoint.longitude, res.endPoint.latitude],
|
|
title: res.endPoint.detailedAddress
|
|
}
|
|
];
|
|
}
|
|
});
|
|
this.service.request(this.service.$api_get_getRiskDetail, { id: this.id }).subscribe(res => {
|
|
if (res) {
|
|
console.log('风险详情')
|
|
console.log(res)
|
|
}
|
|
});
|
|
}
|
|
|
|
goBack() {
|
|
window.history.go(-1);
|
|
}
|
|
// 修改订单
|
|
changeOrder() {
|
|
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;
|
|
}
|
|
goDistance(elf: NzCardComponent) {
|
|
if (elf) {
|
|
elf['elementRef'].nativeElement.scrollIntoView({ behavior: 'smooth', block: 'start', inline: 'start' });
|
|
}
|
|
}
|
|
// 取消订单
|
|
cancellation() {
|
|
// api_get_cancelAnOrder
|
|
this.modal.confirm({
|
|
nzTitle: '<b>确定取消该订单吗?</b>',
|
|
nzContent: `<b>取消后无法恢复,请确认</b>`,
|
|
nzOnOk: () =>
|
|
this.service.request(this.service.$api_get_cancelAnOrder, { id: this.id }).subscribe(res => {
|
|
if (res === true) {
|
|
this.service.msgSrv.success('操作成功!');
|
|
this.initData();
|
|
}
|
|
})
|
|
});
|
|
}
|
|
|
|
// 获取车辆轨迹
|
|
getTrajectory(){
|
|
this.service.request(this.service.$api_get_getTrajectory, { id: this.id }).subscribe(res => {
|
|
if (res) {
|
|
const points = res.trackArray;
|
|
let list :any[] = [];
|
|
points?.forEach((item: any) => {
|
|
list.push({
|
|
name: item.hgt,
|
|
lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))]
|
|
});
|
|
});
|
|
this.mapList = list;
|
|
this.addressItems = res.cityArray;
|
|
if(this.addressItems && this.addressItems.length > 0){
|
|
this.addressItems.forEach(item => {
|
|
item.vinOutTime = this.getLocalTime(item.vinOutTime);
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
// 获取司机轨迹
|
|
getDriverTrajectory(){
|
|
this.service.request(this.service.$api_get_getAppDriverPosition, { id: this.id }).subscribe(res => {
|
|
if (res) {
|
|
const points = res.tracks;
|
|
let list :any[] = [];
|
|
points?.forEach((item: any) => {
|
|
list.push({
|
|
name: item.hgt,
|
|
lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))]
|
|
});
|
|
});
|
|
this.mapList = list;
|
|
this.addressItems = [...res.enclosureDataAppTrack];
|
|
if(this.addressItems && this.addressItems.length > 0){
|
|
this.addressItems.forEach(item => {
|
|
item.vinOutTime = this.getLocalTime(item.gtm);
|
|
item.cityName = item.appAdress;
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
trajectoryChange(event:any){
|
|
if(event ==='car'){
|
|
this.getTrajectory()
|
|
}else if(event ==='driver'){
|
|
this.getDriverTrajectory();
|
|
}
|
|
}
|
|
getLocalTime(time: any) {
|
|
return format(new Date(parseInt(time)), 'yyyy-MM-dd HH:mm:ss');
|
|
}
|
|
}
|