This commit is contained in:
Taric Xin
2022-04-12 16:58:00 +08:00
parent 7178081da8
commit 82217dfc7b

View File

@ -436,13 +436,13 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
map((res: any) => { map((res: any) => {
return [...res]; return [...res];
}) })
) );
}, },
change: (tag: any, org: any) => { change: (tag: any, org: any) => {
if(tag === '3'){ if (tag === '3') {
this.sf5.setValue('/insurancePremium', null); this.sf5.setValue('/insurancePremium', null);
this.sf5.setValue('/insuranceRate', null); this.sf5.setValue('/insuranceRate', null);
}else { } else {
this.getInsurersPrice(tag); this.getInsurersPrice(tag);
} }
} }
@ -455,7 +455,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
ui: { ui: {
widget: 'custom', widget: 'custom',
visibleIf: { insuranceType: (value: string) => value === '0' } visibleIf: { insuranceType: (value: string) => value === '0' }
} , }
}, },
type2: { type2: {
type: 'string', type: 'string',
@ -468,7 +468,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
insurancePremium: { insurancePremium: {
type: 'string', type: 'string',
title: '服务包费用', title: '服务包费用',
readOnly:true, readOnly: true,
ui: { ui: {
visibleIf: { insuranceType: (value: string) => value !== '3' } visibleIf: { insuranceType: (value: string) => value !== '3' }
} }
@ -495,9 +495,9 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
widget: 'custom', widget: 'custom',
visibleIf: { insuranceType: (value: string) => value === '1' } visibleIf: { insuranceType: (value: string) => value === '1' }
} }
}, }
}, },
required: [ 'insurancePremium'] required: ['insurancePremium']
}; };
this.ui5 = { this.ui5 = {
'*': { '*': {
@ -562,8 +562,12 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
receiptUserPhone: { receiptUserPhone: {
type: 'string', type: 'string',
title: '联系电话', title: '联系电话',
format: 'mobile',
maxLength: 11, maxLength: 11,
ui: { ui: {
errors: {
format: '请输入正确联系电话格式'
},
visibleIf: { visibleIf: {
receiptType: value => value === '2' receiptType: value => value === '2'
} }
@ -955,8 +959,8 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
...this.sf6.value, ...this.sf6.value,
expenseDTOList: expenseList, expenseDTOList: expenseList,
paymentDays: this.sf7.value.paymentDays, paymentDays: this.sf7.value.paymentDays,
subtotal :this.sf7.value.subtotal, subtotal: this.sf7.value.subtotal,
total:this.sf7.value.total, total: this.sf7.value.total,
estimatedKilometers: this.totalDistance, estimatedKilometers: this.totalDistance,
estimatedTravelTime: this.totalTime, estimatedTravelTime: this.totalTime,
insurancePackagedGoods: this.sf4.value.insurancePackagedGoods, insurancePackagedGoods: this.sf4.value.insurancePackagedGoods,
@ -999,42 +1003,42 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
nzContent: AmapPoiPickerComponent, nzContent: AmapPoiPickerComponent,
nzWidth: 900, nzWidth: 900,
nzOnOk: item => { nzOnOk: item => {
if(item?.poi) { if (item?.poi) {
const poi = item.poi; const poi = item.poi;
const locList = poi.pois; const locList = poi.pois;
switch (type) { switch (type) {
case 'start': case 'start':
this.startInfo[index].detailedAddress = poi.formattedAddress; this.startInfo[index].detailedAddress = poi.formattedAddress;
this.startInfo[index].longitude = locList[0]; this.startInfo[index].longitude = locList[0];
this.startInfo[index].latitude = locList[1]; this.startInfo[index].latitude = locList[1];
this.startInfo[index].province = poi.addressComponent.province; this.startInfo[index].province = poi.addressComponent.province;
this.startInfo[index].city = poi.addressComponent.city; this.startInfo[index].city = poi.addressComponent.city;
this.startInfo[index].area = poi.addressComponent.district; this.startInfo[index].area = poi.addressComponent.district;
break; break;
case 'end': case 'end':
this.endInfo[index].detailedAddress = poi.formattedAddress; this.endInfo[index].detailedAddress = poi.formattedAddress;
this.endInfo[index].longitude = locList[0]; this.endInfo[index].longitude = locList[0];
this.endInfo[index].latitude = locList[1]; this.endInfo[index].latitude = locList[1];
this.endInfo[index].province = poi.addressComponent.province; this.endInfo[index].province = poi.addressComponent.province;
this.endInfo[index].city = poi.addressComponent.city; this.endInfo[index].city = poi.addressComponent.city;
this.endInfo[index].area = poi.addressComponent.district; this.endInfo[index].area = poi.addressComponent.district;
break; break;
default: default:
break; 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(); // 计算保费金额
});
}
return true;
} else {
this.service.msgSrv.warning('请重新手动选择地址!');
return false;
} }
// 计算里程,时间
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(); // 计算保费金额
});
}
return true
} else {
this.service.msgSrv.warning('请重新手动选择地址!')
return false
}
} }
}); });
} }
@ -1193,7 +1197,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
getInsurersPrice(insuranceType = this.sf5.value?.insuranceType) { getInsurersPrice(insuranceType = this.sf5.value?.insuranceType) {
console.log(insuranceType); console.log(insuranceType);
console.log(this.totalDistance); console.log(this.totalDistance);
if (insuranceType !== '3' && this.totalDistance > 0) { if (insuranceType !== '3' && this.totalDistance > 0) {
const params = { const params = {
insuranceType, insuranceType,
goodsValue: this.sf4.value.goodsValue, goodsValue: this.sf4.value.goodsValue,
@ -1210,14 +1214,14 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
}); });
} }
} }
// 运费信息价格变更 // 运费信息价格变更
priceChange(event:any, i:any){ priceChange(event: any, i: any) {
i.setValue(event); i.setValue(event);
if(event>=99999){ if (event >= 99999) {
this.modalService.warning({ this.modalService.warning({
nzTitle: '可输入的最大金额为99999元', nzTitle: '可输入的最大金额为99999元'
}); });
} }
this.payChange() this.payChange();
} }
} }