This commit is contained in:
wangshiming
2022-03-10 14:31:12 +08:00
parent a6c357e77a
commit c3afc62cb1
5 changed files with 133 additions and 106 deletions

View File

@ -208,10 +208,10 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
type: 'string',
title: '调度员手机号',
maxLength: 30,
ui: {
ui: {
placeholder: '请输入'
}
},
}
},
required: ['shipperAppUserId', 'enterpriseProjectId', 'enterpriseInfoName']
};
@ -329,7 +329,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
title: '',
ui: {
widget: 'custom',
placeholder: '请输入',
placeholder: '请输入'
}
},
number: {
@ -337,7 +337,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
title: '',
ui: {
widget: 'custom',
placeholder: '请输入',
placeholder: '请输入'
}
},
carModel: {
@ -390,7 +390,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
params: { dictKey: 'insure:packaged:goods' },
containsAllLabel: false,
validator: val => {
if (this.sf5?.value?.insuranceType && this.sf5?.value?.insuranceType !=='3' && this.isEmpty(val)) {
if (this.sf5?.value?.insuranceType && this.sf5?.value?.insuranceType !== '3' && this.isEmpty(val)) {
return [{ keyword: 'required', message: '必填项' }];
} else {
return [];
@ -404,14 +404,14 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
ui: {
widget: 'custom',
validator: val => {
if (this.sf5?.value?.insuranceType && this.sf5?.value?.insuranceType !=='3' && this.isEmpty(val)) {
if (this.sf5?.value?.insuranceType && this.sf5?.value?.insuranceType !== '3' && this.isEmpty(val)) {
return [{ keyword: 'required', message: '必填项' }];
} else {
return [];
}
}
}
},
}
},
required: ['weight', 'carModel', 'carLength']
};
@ -436,14 +436,14 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
map((res: any) => {
return [...res];
})
)
);
},
change: (tag: any, org: any) => {
if(tag === '3'){
if (tag === '3') {
this.sf5.setValue('/insurancePremium', null);
this.sf5.setValue('/insuranceRate', null);
}else {
console.log(tag)
} else {
console.log(tag);
this.getInsurersPrice(tag);
}
}
@ -475,7 +475,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
insurancePremium: {
type: 'string',
title: '服务包费用',
readOnly:true,
readOnly: true,
ui: {
visibleIf: { insuranceType: (value: string) => value !== '3' }
}
@ -502,11 +502,9 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
widget: 'custom',
visibleIf: { insuranceType: (value: string) => value === '1' }
}
},
}
},
required: [ 'insurancePremium']
required: ['insurancePremium']
};
this.ui5 = {
'*': {
@ -528,7 +526,6 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
};
}
initSF6() {
this.schema6 = {
properties: {
@ -769,8 +766,8 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
addStartInfo() {
console.log(this.startInfo.length);
console.log(this.limitValues.maxTimes);
if (this.startInfo.length < this.limitValues.maxTimes) {
if (this.startInfo.length < this.limitValues.maxTimes) {
const controlId = this.startInfo.length;
this.startInfo.push({
detailedAddress: '',
@ -857,12 +854,24 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
this.sf5.validator({ emitError: true });
this.sf6.validator({ emitError: true });
this.sf7.validator({ emitError: true });
console.log(!this.sf1.valid)
console.log(this.sf1.value)
if (this.validateForm1.invalid || !this.sf3.valid || !this.sf1.valid || !this.sf4.valid || !this.sf5.valid || !this.sf6.valid || !this.sf7.valid) {
console.log(!this.sf1.valid);
console.log(this.sf1.value);
if (
this.validateForm1.invalid ||
!this.sf3.valid ||
!this.sf1.valid ||
!this.sf4.valid ||
!this.sf5.valid ||
!this.sf6.valid ||
!this.sf7.valid
) {
this.service.msgSrv.warning('请完善必填项!');
return;
}
if (this.totalDistance <= 0) {
this.service.msgSrv.warning('起终点相同,请重新选择装卸货地址!');
return;
}
if (this.validateForm1.value.loadingTime < new Date()) {
this.service.msgSrv.warning('装货时间必须大于当前时间!');
return;
@ -955,8 +964,8 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
paymentDays: this.sf7.value.paymentDays,
estimatedKilometers: this.totalDistance,
estimatedTravelTime: this.totalTime,
insurancePackagedGoods:this.sf4.value.insurancePackagedGoods,
goodsValue:this.sf4.value.goodsValue,
insurancePackagedGoods: this.sf4.value.insurancePackagedGoods,
goodsValue: this.sf4.value.goodsValue
};
console.log(params);
const modalRef = this.modalService.create({
@ -964,11 +973,11 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
nzContent: TranAgreementComponent,
nzWidth: 900,
nzFooter: null,
nzComponentParams: { object: params ,shipperName: this.shipperName,type:'onecar'}
nzComponentParams: { object: params, shipperName: this.shipperName, type: 'onecar' }
});
modalRef.afterClose.subscribe(result => {
if (result) {
this.submit(submitType, params, );
this.submit(submitType, params);
}
});
}
@ -1088,14 +1097,14 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
default:
break;
}
// 计算里程,时间
if (this.startInfo[0]?.detailedAddress && this.endInfo[0]?.detailedAddress) {
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
this.totalDistance = res.distance;
this.totalTime = res.time;
this.getInsurersPrice(); //计算保费金额
});
}
// 计算里程,时间
if (this.startInfo[0]?.detailedAddress && this.endInfo[0]?.detailedAddress) {
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
this.totalDistance = res.distance;
this.totalTime = res.time;
this.getInsurersPrice(); //计算保费金额
});
}
}
});
}
@ -1170,20 +1179,20 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
this.validateForm1.addControl(`unloadName${index}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`unloadPhone${index}`, new FormControl(null, [Validators.required, Validators.pattern('^[0-9]*$')]));
});
// 计算里程,时间
if (this.startInfo[0]?.detailedAddress && this.endInfo[0]?.detailedAddress) {
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
this.totalDistance = res.distance;
this.totalTime = res.time;
this.getInsurersPrice(); //计算保费金额
});
}
// 计算里程,时间
if (this.startInfo[0]?.detailedAddress && this.endInfo[0]?.detailedAddress) {
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
this.totalDistance = res.distance;
this.totalTime = res.time;
this.getInsurersPrice(); //计算保费金额
});
}
}
// 计算保价费金额
getInsurersPrice(insuranceType = this.sf5.value?.insuranceType) {
console.log(insuranceType)
console.log(this.totalDistance)
if ( insuranceType !=='3' && this.sf4.value?.goodsValue >= 50000 && this.totalDistance > 0 ) {
console.log(insuranceType);
console.log(this.totalDistance);
if (insuranceType !== '3' && this.sf4.value?.goodsValue >= 50000 && this.totalDistance > 0) {
const params = {
insuranceType,
goodsValue: this.sf4.value.goodsValue,
@ -1193,7 +1202,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
if (res) {
this.sf5.setValue('/insurancePremium', res.insurancePremium);
this.sf5.setValue('/insuranceRate', res.insuranceRate);
}else{
} else {
this.sf5.setValue('/insurancePremium', null);
this.sf5.setValue('/insuranceRate', null);
}