This commit is contained in:
wangshiming
2022-03-23 19:57:38 +08:00
parent 488b4f6dab
commit 3fcafcbbc4

View File

@ -4,7 +4,7 @@
* @Author : Shiming * @Author : Shiming
* @Date : 2022-02-24 20:19:51 * @Date : 2022-02-24 20:19:51
* @LastEditors : Shiming * @LastEditors : Shiming
* @LastEditTime : 2022-03-10 10:27:21 * @LastEditTime : 2022-03-23 19:57:34
* @FilePath : \\tms-obc-web\\src\\app\\routes\\supply-management\\components\\tran-agreement\\tran-agreement.component.ts * @FilePath : \\tms-obc-web\\src\\app\\routes\\supply-management\\components\\tran-agreement\\tran-agreement.component.ts
* Copyright (C) 2022 huzhenhong. All rights reserved. * Copyright (C) 2022 huzhenhong. All rights reserved.
*/ */
@ -34,27 +34,22 @@ export class TranAgreementComponent {
agreement: any; agreement: any;
envCache: any; envCache: any;
shipperName: any; shipperName: any;
constructor(private modal: NzModalRef,public service: SupplyManagementService,) { constructor(private modal: NzModalRef, public service: SupplyManagementService) {}
}
ngOnInit() { ngOnInit() {
console.log(this.object) console.log(this.object);
// 获取托运人承运人信息 // 获取托运人承运人信息
this.service.request(this.service.$api_getContractAtr, { id: this.object?.shipperAppUserId }).subscribe(res => { this.service.request(this.service.$api_getContractAtr, { id: this.object?.shipperAppUserId }).subscribe(res => {
if (res) { if (res) {
this.enterpriseInfo = res this.enterpriseInfo = res;
this.getContent(); this.getContent();
} }
}); });
} }
getContent() { getContent() {
let params: any; let params: any;
if (this.type === 'onecar') { if (this.type === 'onecar') {
params = { params = {
contractType: '1', contractType: '1',
resourceType: '1', resourceType: '1',
@ -66,15 +61,21 @@ export class TranAgreementComponent {
carrierLegalPersonName: this.enterpriseInfo.netLegalPersonName || '', //承运法定代表人 carrierLegalPersonName: this.enterpriseInfo.netLegalPersonName || '', //承运法定代表人
shipperName: this?.shipperName || '', //托运人 shipperName: this?.shipperName || '', //托运人
carrierName: this.object?.enterpriseInfoName || '', //承运人 carrierName: this.object?.enterpriseInfoName || '', //承运人
consignorInfo: `${this.object?.unLoadingPlaceDTOList[0]?.appUserName || ''} ${this.object?.unLoadingPlaceDTOList[0]?.contractTelephone || ''}`, // 发货信息 consignorInfo: `${this.object?.unLoadingPlaceDTOList[0]?.appUserName || ''} ${
this.object?.unLoadingPlaceDTOList[0]?.contractTelephone || ''
}`, // 发货信息
consignorAddress: this.object?.unLoadingPlaceDTOList[0].detailedAddress || '', // 发货地址 consignorAddress: this.object?.unLoadingPlaceDTOList[0].detailedAddress || '', // 发货地址
consignorDate: this.object?.loadingTime || '', // 发货时间 consignorDate: this.object?.loadingTime || '', // 发货时间
consigneeInfo: `${this.object?.unLoadingPlaceDTOList[this.object?.unLoadingPlaceDTOList.length-1].appUserName} ${this.object?.unLoadingPlaceDTOList[this.object?.unLoadingPlaceDTOList.length-1].contractTelephone}`, // 收货信息 consigneeInfo: `${this.object?.unLoadingPlaceDTOList[this.object?.unLoadingPlaceDTOList.length - 1].appUserName} ${
this.object?.unLoadingPlaceDTOList[this.object?.unLoadingPlaceDTOList.length - 1].contractTelephone
}`, // 收货信息
consigneeDate: this.object?.unloadingTime || '', // 收货时间 consigneeDate: this.object?.unloadingTime || '', // 收货时间
consigneeAddress: this.object?.unLoadingPlaceDTOList[this.object?.unLoadingPlaceDTOList.length - 1].detailedAddress || '', // 收货地址 consigneeAddress: this.object?.unLoadingPlaceDTOList[this.object?.unLoadingPlaceDTOList.length - 1].detailedAddress || '', // 收货地址
goodsName: this.object?.goodsInfoDTOList[0].goodsName || '', // 货物名称 goodsName: this.object?.goodsInfoDTOList[0].goodsName || '', // 货物名称
shippingType: '整车运输', shippingType: '整车运输',
consignmentVolume:`${this.object?.goodsInfoDTOList[0]?.weight || '-'}吨/${this.object?.goodsInfoDTOList[0]?.volume || '-'}方/${this.object?.goodsInfoDTOList[0]?.number || '-'}`, //托运量 consignmentVolume: `${this.object?.goodsInfoDTOList[0]?.weight || '-'}吨/${this.object?.goodsInfoDTOList[0]?.volume || '-'}方/${
this.object?.goodsInfoDTOList[0]?.number || '-'
}`, //托运量
transporterInfo: '', //运输方信息 transporterInfo: '', //运输方信息
freightAmount: this.object?.total || '', // 订单运费金额(元) freightAmount: this.object?.total || '', // 订单运费金额(元)
pre: this.object?.expenseDTOList?.filter((item: any) => item.expenseCode === 'PRE')[0].price || '', //预付 pre: this.object?.expenseDTOList?.filter((item: any) => item.expenseCode === 'PRE')[0].price || '', //预付
@ -85,9 +86,9 @@ export class TranAgreementComponent {
paymentTime: `到货后${this.object?.paymentDays || ''}`, // 承诺支付运费时间 paymentTime: `到货后${this.object?.paymentDays || ''}`, // 承诺支付运费时间
year: new Date().getFullYear() || '', // 签约年份 year: new Date().getFullYear() || '', // 签约年份
month: new Date().getMonth() + 1 || '', // 签约月份 month: new Date().getMonth() + 1 || '', // 签约月份
day:new Date().getDate() || '', // 签约日期 day: new Date().getDate() || '' // 签约日期
}
} }
};
} else if (this.type === 'bulk') { } else if (this.type === 'bulk') {
params = { params = {
contractType: '1', contractType: '1',
@ -100,15 +101,21 @@ export class TranAgreementComponent {
carrierName: this.object?.enterpriseInfoName || '', //承运人 carrierName: this.object?.enterpriseInfoName || '', //承运人
shipperLegalPersonName: this.enterpriseInfo.legalPersonName || '', //托运法定代表人 shipperLegalPersonName: this.enterpriseInfo.legalPersonName || '', //托运法定代表人
carrierLegalPersonName: this.enterpriseInfo.netLegalPersonName || '', //承运法定代表人 carrierLegalPersonName: this.enterpriseInfo.netLegalPersonName || '', //承运法定代表人
consignorInfo: `${this.object.unLoadingPlaceDTOList[0]?.appUserName || ''} ${this.object.unLoadingPlaceDTOList[0]?.contractTelephone || ''}`, // 发货信息 consignorInfo: `${this.object.unLoadingPlaceDTOList[0]?.appUserName || ''} ${
this.object.unLoadingPlaceDTOList[0]?.contractTelephone || ''
}`, // 发货信息
consignorAddress: this.object.unLoadingPlaceDTOList[0].detailedAddress, // 发货地址 consignorAddress: this.object.unLoadingPlaceDTOList[0].detailedAddress, // 发货地址
consignorDate: '', // 发货时间 consignorDate: '', // 发货时间
consigneeInfo: `${this.object.unLoadingPlaceDTOList[this.object.unLoadingPlaceDTOList.length-1]?.appUserName || ''} ${this.object.unLoadingPlaceDTOList[this.object.unLoadingPlaceDTOList.length-1]?.contractTelephone || ''}`, // 收货信息 consigneeInfo: `${this.object.unLoadingPlaceDTOList[this.object.unLoadingPlaceDTOList.length - 1]?.appUserName || ''} ${
this.object.unLoadingPlaceDTOList[this.object.unLoadingPlaceDTOList.length - 1]?.contractTelephone || ''
}`, // 收货信息
consigneeDate: '', // 收货时间 consigneeDate: '', // 收货时间
consigneeAddress: this.object.unLoadingPlaceDTOList[this.object.unLoadingPlaceDTOList.length - 1]?.detailedAddress || '', // 收货地址 consigneeAddress: this.object.unLoadingPlaceDTOList[this.object.unLoadingPlaceDTOList.length - 1]?.detailedAddress || '', // 收货地址
goodsName: this.object.goodsInfoDTOList[0]?.goodsName || '', // 货物名称 goodsName: this.object.goodsInfoDTOList[0]?.goodsName || '', // 货物名称
shippingType: '大宗运输', shippingType: '大宗运输',
consignmentVolume:`${this.object?.goodsInfoDTOList?.[0]?.weight|| '-'}吨/${this.object?.goodsInfoDTOList?.[0]?.volume || '-'}/${this.object.goodsInfoDTOList?.[0]?.number || '-'}`, //托运量 consignmentVolume: `${this.object?.goodsInfoDTOList?.[0]?.weight || '-'}/${
this.object?.goodsInfoDTOList?.[0]?.volume || '-'
}方/${this.object.goodsInfoDTOList?.[0]?.number || '-'}`, //托运量
transporterInfo: '', //运输方信息 transporterInfo: '', //运输方信息
freightAmount: '', // 订单运费金额(元) freightAmount: '', // 订单运费金额(元)
pre: '', //预付 pre: '', //预付
@ -119,20 +126,38 @@ export class TranAgreementComponent {
paymentTime: `到货后${this.object?.paymentDays || ''}`, // 承诺支付运费时间 paymentTime: `到货后${this.object?.paymentDays || ''}`, // 承诺支付运费时间
year: new Date().getFullYear() || '', // 签约年份 year: new Date().getFullYear() || '', // 签约年份
month: new Date().getMonth() + 1 || '', // 签约月份 month: new Date().getMonth() + 1 || '', // 签约月份
day:new Date().getDate() || '', // 签约日期 day: new Date().getDate() || '' // 签约日期
},
} }
};
} }
console.log(params) if (params.parametersDTO.freightAmount) {
this.service.request(this.service.$api_getContractContent,params).subscribe((res) => { params.parametersDTO.freightAmount = this.toThousands(params.parametersDTO.freightAmount);
}
if (params.parametersDTO.pre) {
params.parametersDTO.pre = this.toThousands(params.parametersDTO.pre);
}
if (params.parametersDTO.rece) {
params.parametersDTO.rece = this.toThousands(params.parametersDTO.rece);
}
if (params.parametersDTO.back) {
params.parametersDTO.back = this.toThousands(params.parametersDTO.back);
}
if (params.parametersDTO.total) {
params.parametersDTO.total = this.toThousands(params.parametersDTO.total);
}
console.log(params);
this.service.request(this.service.$api_getContractContent, params).subscribe(res => {
if (res) { if (res) {
this.agreement = res.contractContent; this.agreement = res.contractContent;
} }
}); });
} }
toThousands(num: any) {
let str = num.toString();
return '¥' + str.replace(/(\d)(?=(?:\d{3})+$)/g, '$1,');
}
handleOk() { handleOk() {
this.modal.close(true); this.modal.close(true);
} }
} }