This commit is contained in:
wangshiming
2022-02-28 16:24:04 +08:00
parent 756bed1e72
commit 545b867fc1
3 changed files with 262 additions and 357 deletions

View File

@ -1,6 +1,6 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { debounceTime } from 'rxjs/operators';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import differenceInCalendarDays from 'date-fns/differenceInCalendarDays';
import format from 'date-fns/format';
import { Subject } from 'rxjs';
import { ActivatedRoute, Router } from '@angular/router';
@ -17,7 +17,6 @@ import {
import { _HttpClient } from '@delon/theme';
import { AmapPoiPickerComponent, AmapService, EACacheService, ShipperBaseService } from '@shared';
import { NzModalService } from 'ng-zorro-antd/modal';
import { type } from 'os';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';
import { SupplyManagementService } from '../../services/supply-management.service';
@ -39,8 +38,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
limitValues = {
maxWeight: 99999,
maxVolume: 99999,
maxPiece: 99999,
}
maxPiece: 99999
};
sf1data: any; // 货源单设置回显
sf3data: any; // 货源单设置回显
sf4data: any; // 货源单设置回显
@ -72,8 +71,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
public service: SupplyManagementService,
private amapService: AmapService,
public shipperSrv: ShipperBaseService,
private eaCacheSrv: EACacheService,
private eaCacheSrv: EACacheService
) {
this.validateForm1 = fb.group({
loadingTime: [null, [Validators.required]],
@ -112,15 +110,14 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
@ViewChild('sf7', { static: false }) sf7!: SFComponent;
schema7: SFSchema = {};
ui7!: SFUISchema;
formatterRmb = (value: number): string =>{
if(value){
let value2 = Number(value).toLocaleString(undefined,{'minimumFractionDigits':2,'maximumFractionDigits':2});
formatterRmb = (value: number): string => {
if (value) {
let value2 = Number(value).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
return `${value2}`;
}
return `¥ 0.00`
} ;
parserRmb = (value: string): string => value.replace('¥ ', '').replace(',','');
return `¥ 0.00`;
};
parserRmb = (value: string): string => value.replace('¥ ', '').replace(',', '');
// 页面初始化
ngOnInit(): void {
if (this.route.snapshot?.queryParams?.sta === '1') {
@ -343,13 +340,13 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
ui: {
widget: 'select',
mode: 'multiple',
maxMultipleCount:3,
maxMultipleCount: 3,
placeholder: '请选择车型',
errors: { required: '请选择车型' },
asyncData: () => this.service.getDictOptions({ dictKey: 'car:model' }),
change:(tag:any , org:any)=>{
if(tag.includes("999")){
this.sf4.setValue('/carModel',["999"]);
change: (tag: any, org: any) => {
if (tag.includes('999')) {
this.sf4.setValue('/carModel', ['999']);
}
}
}
@ -360,17 +357,17 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
ui: {
widget: 'select',
mode: 'multiple',
maxMultipleCount:3,
maxMultipleCount: 3,
placeholder: '请选择车长',
errors: { required: '请选择车长' },
asyncData: () => this.service.getDictOptions({ dictKey: 'car:length' }),
change:(tag:any , org:any)=>{
if(tag.includes("999")){
this.sf4.setValue('/carModel',["999"]);
change: (tag: any, org: any) => {
if (tag.includes('999')) {
this.sf4.setValue('/carModel', ['999']);
}
}
}
},
}
},
required: ['weight', 'carModel', 'carLength']
};
@ -410,7 +407,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
map((res: any) => {
return [...res];
})
)
);
},
change: (tag: any, org: any) => {
this.getInsurersPrice(tag);
@ -514,7 +511,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
* 自定义校验数据
* @param val
*/
customValidator(val: number) {
customValidator(val: number) {
if (this.isEmpty(val)) {
return [{ keyword: 'required', message: '不能为空' }];
} else {
@ -715,14 +712,17 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
resourcetype: '1'
};
this.service.request(this.service.$api_getCalculatedSurcharge, params).subscribe(res => {
console.log('999')
console.log(this.envCache)
console.log('999');
console.log(this.envCache);
if (res) {
this.sf7.setValue('/appendFee', res.surcharge);
this.sf7.setValue('/subtotal', subtotal);
this.sf7.setValue('/total', subtotal + res.surcharge);
this.service
.request(this.service.$api_getAdditionalRate + `?shipperId=${this.envCache?.enterpriseId}&enterpriseInfoId=${this?.enterpriseProjectIds}&resourcetype='1'`)
.request(
this.service.$api_getAdditionalRate +
`?shipperId=${this.envCache?.enterpriseId}&enterpriseInfoId=${this?.enterpriseProjectIds}&resourcetype='1'`
)
.subscribe(res => {
if (res) {
this.currentRate = res.rate * 100;
@ -733,8 +733,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
});
}
// 添加 删除发货卸货地址
addStartInfo(_event: any) {
addStartInfo() {
if (this.startInfo.length < 5) {
const controlId = this.startInfo.length;
this.startInfo.push({
@ -746,23 +745,19 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
province: '',
city: '',
area: '',
type: 1
type: '1'
});
this.validateForm1.addControl(`loadAddress${controlId}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`loadName${controlId}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`loadPhone${controlId}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`loadPhone${controlId}`, new FormControl(null, [Validators.required, Validators.pattern('^[0-9]*$')]));
}
}
getLimitvalue() {
// 货物核载信息最大值
// 货物运输费(小计)最大值
const getlimitvaluesParms = [
this.service.limitKeys.weight,
this.service.limitKeys.volume,
this.service.limitKeys.piece,
];
this.service.request(this.service.$api_findItemValueByItemKeys, getlimitvaluesParms).subscribe((res) => {
const getlimitvaluesParms = [this.service.limitKeys.weight, this.service.limitKeys.volume, this.service.limitKeys.piece];
this.service.request(this.service.$api_findItemValueByItemKeys, getlimitvaluesParms).subscribe(res => {
const maxWeight = res.filter((item: any) => item.itemKey === this.service.limitKeys.weight)[0].itemValue;
const maxVolume = res.filter((item: any) => item.itemKey === this.service.limitKeys.volume)[0].itemValue;
const maxPiece = res.filter((item: any) => item.itemKey === this.service.limitKeys.piece)[0].itemValue;
@ -770,25 +765,17 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
maxWeight: Number(maxWeight),
maxVolume: Number(maxVolume),
maxPiece: Number(maxPiece)
}
})
};
});
}
// 添加 删除发货卸货地址
subStartInfo(event: any, index: number, id?: any) {
console.log(event, index, id);
if (id) {
this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe(res => {
console.log(res);
});
}
subStartInfo(event: any, index: number) {
this.startInfo.splice(index, 1);
this.validateForm1.removeControl(`loadAddress${index}`);
this.validateForm1.removeControl(`loadName${index}`);
this.validateForm1.removeControl(`loadPhone${index}`);
}
// 添加 删除发货卸货地址
addEndInfo(_event: any) {
if (this.addEndInfo.length < 5) {
addEndInfo() {
if (this.endInfo.length < 5) {
const controlId = this.endInfo.length;
this.endInfo.push({
detailedAddress: '',
@ -799,21 +786,17 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
province: '',
city: '',
area: '',
type: 2
type: '2'
});
this.validateForm1.addControl(`unloadAddress${controlId}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`unloadName${controlId}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`unloadPhone${controlId}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(
`unloadPhone${controlId}`,
new FormControl(null, [Validators.required, Validators.pattern('^[0-9]*$')])
);
}
}
// 添加 删除发货卸货地址
subEndInfo(event: any, index: number, id?: any) {
if (id) {
this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe(res => {
console.log(res);
});
}
console.log(event, index, id);
subEndInfo(event: any, index: number) {
this.endInfo.splice(index, 1);
this.validateForm1.removeControl(`unloadAddress${index}`);
this.validateForm1.removeControl(`unloadName${index}`);
@ -878,88 +861,71 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
nzComponentParams: { type: 'onecar', resourceObj, change: change }
});
}
// // 提交前确认,委托运输协议弹窗
// submitConfirm(submitType?: any) {
// Object.keys(this.validateForm1.controls).forEach(key => {
// this.validateForm1.controls[key].markAsDirty();
// this.validateForm1.controls[key].updateValueAndValidity();
// });
// this.sf1.validator({ emitError: true });
// this.sf3.validator({ emitError: true });
// this.sf4.validator({ emitError: true });
// this.sf6.validator({ emitError: true });
// this.sf7.validator({ emitError: true });
// console.log(this.sf1.valid);
// if (this.validateForm1.invalid || !this.sf3.valid || !this.sf1.valid || !this.sf4.valid || !this.sf6.valid || !this.sf7.valid) {
// return;
// }
// const modalRef = this.modalService.create({
// nzTitle: '运输协议',
// nzContent: TranAgreementComponent,
// nzWidth: 900,
// nzFooter: null,
// });
// modalRef.afterClose.subscribe(result => {
// if (result) {
// this.submit(submitType);
// }
// });
// }
// 提交前确认,委托运输协议弹窗
submitConfirm(submitType?: string) {
Object.keys(this.validateForm1.controls).forEach(key => {
this.validateForm1.controls[key].markAsDirty();
this.validateForm1.controls[key].updateValueAndValidity();
});
this.sf3.validator({ emitError: true });
this.sf4.validator({ emitError: true });
this.sf5.validator({ emitError: true });
this.sf6.validator({ emitError: true });
this.sf7.validator({ emitError: true });
if (this.validateForm1.invalid || !this.sf3.valid || !this.sf4.valid || !this.sf5.valid || !this.sf6.valid || !this.sf7.valid) {
this.service.msgSrv.warning('请完善必填项!');
return;
}
if (this.validateForm1.value.loadingTime < new Date()) {
this.service.msgSrv.warning('装货时间必须大于当前时间!');
return;
}
if (this.validateForm1.value.loadingTime > this.validateForm1.value.unloadingTime) {
this.service.msgSrv.warning('装货时间不能大于卸货时间!');
return;
}
if (this.sf7.value.total <= 0) {
this.service.msgSrv.warning('总费用不能为0');
return;
}
if (this.sf4.value.weight > this.limitValues.maxWeight || this.sf4.value.volume > this.limitValues.maxVolume || this.sf4.value.number > this.limitValues.maxPiece) {
this.service.msgSrv.error(`当前货物核载信息已超出限定值【${this.limitValues.maxWeight}吨、${this.limitValues.maxVolume}方、${this.limitValues.maxPiece}件】`);
return;
}
const getFreightParms = { carLengthKeys: this.sf4.value.carLength, km: this.totalDistance };
this.service.request(this.service.$api_getFreight, getFreightParms).subscribe((res) => {
if (this.sf7.value.subtotal > res.maxPrice) {
this.service.msgSrv.error(`运费过高,请调整录入`);
return;
} else if (this.sf7.value.subtotal > res.ewPrice) {
this.modalService.confirm({
nzTitle: '',
nzContent: `您的录入的运费过高,可能会影响支付,请仔细确认`,
nzOkText: '继续',
nzCancelText: '取消',
nzOnOk: () => {
this.agreementConfirm(submitType);
},
});
} else {
this.agreementConfirm(submitType);
}
})
// 提交前确认,委托运输协议弹窗
submitConfirm(submitType?: string) {
Object.keys(this.validateForm1.controls).forEach(key => {
this.validateForm1.controls[key].markAsDirty();
this.validateForm1.controls[key].updateValueAndValidity();
});
this.sf3.validator({ emitError: true });
this.sf4.validator({ emitError: true });
this.sf5.validator({ emitError: true });
this.sf6.validator({ emitError: true });
this.sf7.validator({ emitError: true });
console.log(this.validateForm1.invalid)
console.log(this.sf4.valid)
console.log(this.sf5.valid)
console.log(this.sf6.valid)
console.log(this.sf7.valid)
if (this.validateForm1.invalid || !this.sf3.valid || !this.sf4.valid || !this.sf5.valid || !this.sf6.valid || !this.sf7.valid) {
this.service.msgSrv.warning('请完善必填项!');
return;
}
// 提交前协议弹窗
if (this.validateForm1.value.loadingTime < new Date()) {
this.service.msgSrv.warning('装货时间必须大于当前时间!');
return;
}
if (this.validateForm1.value.loadingTime > this.validateForm1.value.unloadingTime) {
this.service.msgSrv.warning('装货时间不能大于卸货时间!');
return;
}
if (this.sf7.value.total <= 0) {
this.service.msgSrv.warning('总费用不能为0');
return;
}
if (
this.sf4.value.weight > this.limitValues.maxWeight ||
this.sf4.value.volume > this.limitValues.maxVolume ||
this.sf4.value.number > this.limitValues.maxPiece
) {
this.service.msgSrv.error(
`当前货物核载信息已超出限定值【${this.limitValues.maxWeight}吨、${this.limitValues.maxVolume}方、${this.limitValues.maxPiece}件】`
);
return;
}
const getFreightParms = { carLengthKeys: this.sf4.value.carLength, km: this.totalDistance };
this.service.request(this.service.$api_getFreight, getFreightParms).subscribe(res => {
if (this.sf7.value.subtotal > res.maxPrice) {
this.service.msgSrv.error(`运费过高,请调整录入`);
return;
} else if (this.sf7.value.subtotal > res.ewPrice) {
this.modalService.confirm({
nzTitle: '',
nzContent: `您的录入的运费过高,可能会影响支付,请仔细确认`,
nzOkText: '继续',
nzCancelText: '取消',
nzOnOk: () => {
this.agreementConfirm(submitType);
}
});
} else {
this.agreementConfirm(submitType);
}
});
}
// 提交前协议弹窗
agreementConfirm(submitType?: string) {
const modalRef = this.modalService.create({
nzTitle: '运输协议',
@ -975,92 +941,60 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
// 提交
submit(submitType?: string): void {
//装卸货信息
const LoadingList = this.startInfo.concat(this.endInfo);
//装卸货信息
const LoadingList = this.startInfo.concat(this.endInfo);
// 货物信息
const sf3Values = { ...this.sf3.value };
if (sf3Values.goodsTypeName === '其它') {
sf3Values.goodsName = sf3Values.goodsName1;
delete sf3Values.goodsName1;
}
if (this.sf4.value.carModel.includes('999')) {
this.sf4.value.carModel = ['999'];
}
if (this.sf4.value.carLength.includes('999')) {
this.sf4.value.carLength = ['999'];
}
const goodsInfoList = [
{
...sf3Values,
...this.sf4.value,
carModel: this.sf4.value.carModel.join(','),
carLength: this.sf4.value.carLength.join(',')
// 货物信息
const sf3Values = { ...this.sf3.value };
if (sf3Values.goodsTypeName === '其它') {
sf3Values.goodsName = sf3Values.goodsName1;
delete sf3Values.goodsName1;
}
];
// 运费信息
const expenseList = [
{ expenseCode: 'PRE', expenseName: '预付', price: this.sf7.value.prePay || 0, id: this.sf7data?.prePayId || '' },
{ expenseCode: 'RECE', expenseName: '到付', price: this.sf7.value.toPay || 0, id: this.sf7data?.toPayId || '' },
{ expenseCode: 'BACK', expenseName: '回单付', price: this.sf7.value.receiptPay || 0, id: this.sf7data?.receiptPayId || '' }
];
if (this.sf4.value.carModel.includes('999')) {
this.sf4.value.carModel = ['999'];
}
if (this.sf4.value.carLength.includes('999')) {
this.sf4.value.carLength = ['999'];
}
const goodsInfoVOList = [
{
...sf3Values,
...this.sf4.value,
carModel: this.sf4.value.carModel.join(','),
carLength: this.sf4.value.carLength.join(',')
}
];
// 运费信息
const expenseList = [
{ expenseCode: 'PRE', expenseName: '预付', price: this.sf7.value.prePay || 0, id: this.sf7data?.prePayId || '' },
{ expenseCode: 'RECE', expenseName: '到付', price: this.sf7.value.toPay || 0, id: this.sf7data?.toPayId || '' },
{ expenseCode: 'BACK', expenseName: '回单付', price: this.sf7.value.receiptPay || 0, id: this.sf7data?.receiptPayId || '' }
];
// 从“再下一单”过来将所有的子参数内的id都删除
if (this.PageStatus = '整车下一单') {
LoadingList.forEach((ele: any) => {
delete ele.id;
});
goodsInfoList.forEach((ele: any) => {
delete ele.id;
});
expenseList.forEach((ele: any) => {
delete ele.id;
});
}
// if (typeof this.unloadingTime !== 'string') {
// var c = new Date(this.unloadingTime);
// this.unloadingTime =
// c.getFullYear() +
// '-' +
// this.addPreZero(c.getMonth() + 1) +
// '-' +
// this.addPreZero(c.getDate()) +
// ' ' +
// this.addPreZero(c.getHours()) +
// ':' +
// this.addPreZero(c.getMinutes()) +
// ':' +
// this.addPreZero(c.getSeconds());
// }
// if (typeof this.loadingTime !== 'string') {
// var c = new Date(this.loadingTime);
// this.loadingTime =
// c.getFullYear() +
// '-' +
// this.addPreZero(c.getMonth() + 1) +
// '-' +
// this.addPreZero(c.getDate()) +
// ' ' +
// this.addPreZero(c.getHours()) +
// ':' +
// this.addPreZero(c.getMinutes()) +
// ':' +
// this.addPreZero(c.getSeconds());
// }
const params = {
id: '',
...this.sf1.value,
unLoadingPlaceList: LoadingList,
unloadingTime: format(this.validateForm1.value.unloadingTime, 'yyyy-MM-dd HH:mm:ss'),
loadingTime: format(this.validateForm1.value.loadingTime, 'yyyy-MM-dd HH:mm:ss'),
goodsInfoList: goodsInfoList,
...this.sf5.value,
...this.sf6.value,
expenseDTOList: expenseList,
paymentDays: this.sf7.value.paymentDays,
};
// 从“再下一单”过来将所有的子参数内的id都删除
if ((this.PageStatus = '整车下一单')) {
LoadingList.forEach((ele: any) => {
delete ele.id;
});
goodsInfoVOList.forEach((ele: any) => {
delete ele.id;
});
expenseList.forEach((ele: any) => {
delete ele.id;
});
}
const params = {
id: '',
...this.sf1.value,
unLoadingPlaceDTOList: LoadingList,
unloadingTime: format(this.validateForm1.value.unloadingTime, 'yyyy-MM-dd HH:mm:ss'),
loadingTime: format(this.validateForm1.value.loadingTime, 'yyyy-MM-dd HH:mm:ss'),
goodsInfoDTOList: goodsInfoVOList,
...this.sf5.value,
...this.sf6.value,
expenseDTOList: expenseList,
paymentDays: this.sf7.value.paymentDays
};
// const params: any = {
// ...this.sf1.value,
// ...this.sf5.value,
@ -1259,14 +1193,14 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.validateForm1.addControl(`unloadName${controlId}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`unloadPhone${controlId}`, new FormControl(null, Validators.required));
}
// 计算里程,时间
if (this.startInfo?.[0]?.area && this.endInfo?.[0]?.area) {
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
this.totalDistance = res.distance;
this.totalTime = res.time;
});
}
// 计算里程,时间
if (this.startInfo?.[0]?.area && this.endInfo?.[0]?.area) {
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
this.totalDistance = res.distance;
this.totalTime = res.time;
});
}
});
this.sf3data = {
@ -1279,26 +1213,27 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.sf3data.goodsName1 = res?.goodsInfoVOList[0]?.goodsName || '';
}
this.changeGoodsType(this.sf3data.goodsTypeId, { label: this.sf3data.goodsTypeName, value: this.sf3data.goodsTypeId });
this.sf4data = {
weight: res?.goodsInfoVOList[0]?.weight,
volume: res?.goodsInfoVOList[0]?.volume,
vehicleDemand: res?.goodsInfoVOList[0]?.vehicleDemand,
carLength: res?.goodsInfoVOList[0]?.carLength?.split(','),
carModel: res?.goodsInfoVOList[0]?.carModel?.split(',') || '',
number: res?.goodsInfoVOList[0]?.number,
goodsTypeName: res?.goodsInfoVOList[0]?.goodsTypeName,
modifyUserId: res?.goodsInfoVOList[0]?.modifyUserId,
resourceId: res?.goodsInfoVOList[0]?.resourceId,
rule: res?.goodsInfoVOList[0]?.rule,
settlementBasis: res?.goodsInfoVOList[0]?.settlementBasis
};
if (res?.loadingTime) {
this.loadingTime = res?.loadingTime;
}
if (res?.unloadingTime) {
this.unloadingTime = res?.unloadingTime;
}
this.validateForm1.patchValue(
{
loadingTime: new Date(Date.parse(res.loadingTime.replace(/-/g, '/'))),
unloadingTime: new Date(Date.parse(res.unloadingTime.replace(/-/g, '/')))
},
{ onlySelf: true }
);
this.sf4data = {
weight: res?.goodsInfoVOList[0]?.weight || '',
volume: res?.goodsInfoVOList[0]?.volume || '',
number: res?.goodsInfoVOList[0]?.number || '',
carModel: res?.goodsInfoVOList[0]?.carModel?.split(',') || [],
carLength: res?.goodsInfoVOList[0]?.carLength?.split(',') || []
};
if (this.PageStatus === '整车修改') {
this.sf4data.id = res?.goodsInfoVOList[0]?.id;
}
@ -1374,56 +1309,29 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
default:
break;
}
// 计算里程,时间
if (this.startInfo[0]?.area && this.endInfo[0]?.area) {
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
this.totalDistance = res.distance;
this.totalTime = res.time;
this.getInsurersPrice(); //计算保费金额
});
}
// 计算里程,时间
if (this.startInfo[0]?.area && this.endInfo[0]?.area) {
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
this.totalDistance = res.distance;
this.totalTime = res.time;
this.getInsurersPrice(); //计算保费金额
});
}
}
});
}
changeUn(event: Date) {
console.log(event)
this.unloadingTime = event;
if(typeof this.loadingTime === 'string') {
var a = new Date(this.loadingTime)
if ( a > this.unloadingTime?.getTime() ) {
this.service.msgSrv.error('卸货时间不能小于装货时间!');
this.unloadingTime = '';
}
} else {
if ( this.loadingTime?.getTime() > this.unloadingTime?.getTime() ) {
this.service.msgSrv.error('卸货时间不能小于装货时间!');
this.unloadingTime = '';
}
}
}
changeLO(event: Date) {
this.loadingTime = event;
if(typeof this.unloadingTime === 'string') {
var a = new Date(this.unloadingTime)
if ( a.getTime()< this.loadingTime?.getTime()) {
this.service.msgSrv.error('装货时间不能大于卸货时间!');
this.loadingTime = '';
}
} else {
if ( this.unloadingTime?.getTime()< this.loadingTime?.getTime()) {
this.service.msgSrv.error('装货时间不能大于卸货时间!');
this.loadingTime = '';
}
}
}
// 不可选择的时间
disabledDateStart = (current: Date): boolean => {
return differenceInCalendarDays(new Date(), current) > 0;
};
// 装卸货地址互换
swapAddress(){
this.startInfo.forEach((element:any, index:any) => {
swapAddress() {
this.startInfo.forEach((element: any, index: any) => {
this.validateForm1.removeControl(`loadAddress${index}`);
this.validateForm1.removeControl(`loadName${index}`);
this.validateForm1.removeControl(`loadPhone${index}`);
});
this.endInfo.forEach((element:any, index:any) => {
this.endInfo.forEach((element: any, index: any) => {
this.validateForm1.removeControl(`unloadAddress${index}`);
this.validateForm1.removeControl(`unloadName${index}`);
this.validateForm1.removeControl(`unloadPhone${index}`);
@ -1433,13 +1341,13 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.startInfo = this.endInfo;
this.endInfo = item;
this.startInfo.forEach((element:any,index:any) => {
this.startInfo.forEach((element: any, index: any) => {
element.type = '1';
this.validateForm1.addControl(`loadAddress${index}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`loadName${index}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`loadPhone${index}`, new FormControl(null, [Validators.required, Validators.pattern('^[0-9]*$')]));
});
this.endInfo.forEach((element:any,index:any) => {
this.endInfo.forEach((element: any, index: any) => {
element.type = '2';
this.validateForm1.addControl(`unloadAddress${index}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`unloadName${index}`, new FormControl(null, Validators.required));
@ -1457,7 +1365,6 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
// 计算保价费金额
getInsurersPrice(insuranceType = this.sf5.value.insuranceType) {
if (this.sf5.value.goodsValue >= 50000 && this.totalDistance > 0) {
const params = {
insuranceType,
goodsValue: this.sf5.value.goodsValue,
@ -1474,5 +1381,4 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
});
}
}
}