diff --git a/src/app/routes/supply-management/components/release-publish/release-publish.component.ts b/src/app/routes/supply-management/components/release-publish/release-publish.component.ts index 4b8b2798..5a261ff0 100644 --- a/src/app/routes/supply-management/components/release-publish/release-publish.component.ts +++ b/src/app/routes/supply-management/components/release-publish/release-publish.component.ts @@ -436,13 +436,13 @@ 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 { + } else { this.getInsurersPrice(tag); } } @@ -455,7 +455,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit { ui: { widget: 'custom', visibleIf: { insuranceType: (value: string) => value === '0' } - } , + } }, type2: { type: 'string', @@ -468,7 +468,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit { insurancePremium: { type: 'string', title: '服务包费用', - readOnly:true, + readOnly: true, ui: { visibleIf: { insuranceType: (value: string) => value !== '3' } } @@ -495,9 +495,9 @@ export class SupplyManagementReleasePublishComponent implements OnInit { widget: 'custom', visibleIf: { insuranceType: (value: string) => value === '1' } } - }, + } }, - required: [ 'insurancePremium'] + required: ['insurancePremium'] }; this.ui5 = { '*': { @@ -562,8 +562,12 @@ export class SupplyManagementReleasePublishComponent implements OnInit { receiptUserPhone: { type: 'string', title: '联系电话', + format: 'mobile', maxLength: 11, ui: { + errors: { + format: '请输入正确联系电话格式' + }, visibleIf: { receiptType: value => value === '2' } @@ -955,8 +959,8 @@ export class SupplyManagementReleasePublishComponent implements OnInit { ...this.sf6.value, expenseDTOList: expenseList, paymentDays: this.sf7.value.paymentDays, - subtotal :this.sf7.value.subtotal, - total:this.sf7.value.total, + subtotal: this.sf7.value.subtotal, + total: this.sf7.value.total, estimatedKilometers: this.totalDistance, estimatedTravelTime: this.totalTime, insurancePackagedGoods: this.sf4.value.insurancePackagedGoods, @@ -999,42 +1003,42 @@ export class SupplyManagementReleasePublishComponent implements OnInit { nzContent: AmapPoiPickerComponent, nzWidth: 900, nzOnOk: item => { - if(item?.poi) { - const poi = item.poi; - const locList = poi.pois; - switch (type) { - case 'start': - this.startInfo[index].detailedAddress = poi.formattedAddress; - this.startInfo[index].longitude = locList[0]; - this.startInfo[index].latitude = locList[1]; - this.startInfo[index].province = poi.addressComponent.province; - this.startInfo[index].city = poi.addressComponent.city; - this.startInfo[index].area = poi.addressComponent.district; - break; - case 'end': - this.endInfo[index].detailedAddress = poi.formattedAddress; - this.endInfo[index].longitude = locList[0]; - this.endInfo[index].latitude = locList[1]; - this.endInfo[index].province = poi.addressComponent.province; - this.endInfo[index].city = poi.addressComponent.city; - this.endInfo[index].area = poi.addressComponent.district; - break; - default: - break; + if (item?.poi) { + const poi = item.poi; + const locList = poi.pois; + switch (type) { + case 'start': + this.startInfo[index].detailedAddress = poi.formattedAddress; + this.startInfo[index].longitude = locList[0]; + this.startInfo[index].latitude = locList[1]; + this.startInfo[index].province = poi.addressComponent.province; + this.startInfo[index].city = poi.addressComponent.city; + this.startInfo[index].area = poi.addressComponent.district; + break; + case 'end': + this.endInfo[index].detailedAddress = poi.formattedAddress; + this.endInfo[index].longitude = locList[0]; + this.endInfo[index].latitude = locList[1]; + this.endInfo[index].province = poi.addressComponent.province; + this.endInfo[index].city = poi.addressComponent.city; + this.endInfo[index].area = poi.addressComponent.district; + break; + 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(); // 计算保费金额 + }); + } + 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) { console.log(insuranceType); console.log(this.totalDistance); - if (insuranceType !== '3' && this.totalDistance > 0) { + if (insuranceType !== '3' && this.totalDistance > 0) { const params = { insuranceType, goodsValue: this.sf4.value.goodsValue, @@ -1210,14 +1214,14 @@ export class SupplyManagementReleasePublishComponent implements OnInit { }); } } - // 运费信息价格变更 - priceChange(event:any, i:any){ - i.setValue(event); - if(event>=99999){ - this.modalService.warning({ - nzTitle: '可输入的最大金额为99999元', - }); - } - this.payChange() - } + // 运费信息价格变更 + priceChange(event: any, i: any) { + i.setValue(event); + if (event >= 99999) { + this.modalService.warning({ + nzTitle: '可输入的最大金额为99999元' + }); + } + this.payChange(); + } }