171 lines
5.1 KiB
TypeScript
171 lines
5.1 KiB
TypeScript
/*
|
|
* @Author: your name
|
|
* @Date: 2021-12-15 13:17:42
|
|
* @LastEditTime: 2021-12-21 09:34:52
|
|
* @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\modal\vehicle\confir-receipt\confir-receipt.component.ts
|
|
*/
|
|
|
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
|
import {
|
|
SFComponent,
|
|
SFCustomWidgetSchema,
|
|
SFNumberWidgetSchema,
|
|
SFRadioWidgetSchema,
|
|
SFSchema,
|
|
SFSelectWidgetSchema,
|
|
SFTextareaWidgetSchema,
|
|
SFUISchema
|
|
} from '@delon/form';
|
|
import { NzUploadChangeParam, NzUploadFile } from 'ng-zorro-antd/upload';
|
|
import { _HttpClient } from '@delon/theme';
|
|
import { NzMessageService } from 'ng-zorro-antd/message';
|
|
import { NzModalRef } from 'ng-zorro-antd/modal';
|
|
import { OrderManagementService } from '../../../services/order-management.service';
|
|
import { Observable, Observer } from 'rxjs';
|
|
import { STColumn } from '@delon/abc/st';
|
|
function getBase64(file: File): Promise<string | ArrayBuffer | null> {
|
|
return new Promise((resolve, reject) => {
|
|
const reader = new FileReader();
|
|
reader.readAsDataURL(file);
|
|
reader.onload = () => resolve(reader.result);
|
|
reader.onerror = error => reject(error);
|
|
});
|
|
}
|
|
@Component({
|
|
selector: 'app-order-management-vehicle-confir-receipt',
|
|
templateUrl: './confir-receipt.component.html',
|
|
styleUrls: ['./confir-receipt.component.less']
|
|
})
|
|
export class VehicleConfirReceiptComponent implements OnInit {
|
|
record: any = {};
|
|
i:any;
|
|
Status: any
|
|
columns!: STColumn[];
|
|
previewVisible1 = false;
|
|
dataInfo: any;
|
|
detailList: any
|
|
data: any = {};
|
|
previewImage1 = '';
|
|
listImagUrls: any[] = [];
|
|
constructor(private modal: NzModalRef, private msgSrv: NzMessageService, public http: _HttpClient,public service: OrderManagementService) {}
|
|
|
|
ngOnInit(): void {
|
|
this.initData()
|
|
}
|
|
|
|
save(): void {
|
|
this.service.request(this.service.$api_get_signWholeOrder, {id: this.i?.id}).subscribe((res: any) => {
|
|
console.log(res)
|
|
if(res) {
|
|
this.service.msgSrv.success('确认签收成功!')
|
|
} else {
|
|
this.service.msgSrv.error(res.msg)
|
|
}
|
|
})
|
|
}
|
|
handlePreview1 = async (file: NzUploadFile) => {
|
|
if (!file.url && !file.preview) {
|
|
file.preview = await getBase64(file.originFileObj!);
|
|
}
|
|
this.previewImage1 = file.url || file.preview;
|
|
this.previewVisible1 = true;
|
|
};
|
|
close(): void {
|
|
this.modal.destroy();
|
|
}
|
|
|
|
beforeUpload = (file: NzUploadFile, _fileList: NzUploadFile[]) => {
|
|
return new Observable((observer: Observer<boolean>) => {
|
|
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/gif' || file.type === 'image/bmp';
|
|
if (!isJpgOrPng) {
|
|
this.service.msgSrv.warning('只能上传图片!');
|
|
observer.complete();
|
|
return;
|
|
}
|
|
// tslint:disable-next-line: no-non-null-assertion
|
|
const isLt2M = file.size! / 1024 / 1024 < 3;
|
|
if (!isLt2M) {
|
|
this.service.msgSrv.warning('图片大小超过3兆!');
|
|
observer.complete();
|
|
return;
|
|
}
|
|
observer.next(isJpgOrPng && isLt2M);
|
|
observer.complete();
|
|
});
|
|
};
|
|
initData() {
|
|
// this.dataInfo = [
|
|
// {
|
|
// prePay: this.i?.mybidDetailInfo?.filter((data: any) => data.expenseCode === 'PRE')[0]?.price || 0,
|
|
// toPay: this.i?.mybidDetailInfo?.filter((data: any) => data.expenseCode === 'RECE')[0]?.price || 0,
|
|
// receiptPay: this.i?.mybidDetailInfo?.filter((data: any) => data.expenseCode === 'OIL')[0]?.price || 0,
|
|
// traiPrice: this.i?.mybidDetailInfo?.filter((data: any) => data.expenseName === '运输费')[0]?.price || 0
|
|
// }
|
|
// ];
|
|
// if (this.i?.receiptCertificate?.length > 0) {
|
|
// this.i?.receiptCertificate.forEach((element: any) => {
|
|
// const image = {
|
|
// url: element,
|
|
// status: 'done',
|
|
// uid: '-1'
|
|
// };
|
|
// this.listImagUrls.push(image);
|
|
// });
|
|
// }
|
|
// 大宗
|
|
this.service.request(this.service.$api_get_getWholeSignForDetail, {id: this.i?.id}).subscribe((res: any) => {
|
|
console.log(res)
|
|
this.dataInfo = res;
|
|
})
|
|
}
|
|
|
|
initST() {
|
|
this.columns = [
|
|
{
|
|
title: '预付',
|
|
index: 'prePay'
|
|
},
|
|
{
|
|
title: '到付',
|
|
index: 'toPay'
|
|
},
|
|
// {
|
|
// title: '油卡',
|
|
// index: 'name3'
|
|
// },
|
|
{
|
|
title: '回单付',
|
|
index: 'receiptPay'
|
|
},
|
|
{
|
|
title: '总运费',
|
|
index: 'traiPrice'
|
|
}
|
|
];
|
|
}
|
|
|
|
handleChange1(info: NzUploadChangeParam): void {
|
|
switch (info.file.status) {
|
|
case 'uploading':
|
|
break;
|
|
case 'done':
|
|
const resData = info.file.response.data;
|
|
const arr = [
|
|
{
|
|
url: resData.fullFilePath,
|
|
status: 'done',
|
|
uid: '-1'
|
|
}
|
|
];
|
|
this.listImagUrls = arr;
|
|
break;
|
|
case 'error':
|
|
this.service.msgSrv.error('网络错误');
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|