edit
This commit is contained in:
		| @ -1,5 +1,5 @@ | ||||
| import { Component, OnInit, ViewChild } from '@angular/core'; | ||||
| import { FormBuilder, FormGroup,Validators,FormControl } from '@angular/forms'; | ||||
| import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms'; | ||||
| import { ActivatedRoute, Router } from '@angular/router'; | ||||
| import { | ||||
|   SFComponent, | ||||
| @ -11,7 +11,7 @@ import { | ||||
|   SFUISchema | ||||
| } from '@delon/form'; | ||||
| import { _HttpClient } from '@delon/theme'; | ||||
| import { AmapPoiPickerComponent,AmapService, ShipperBaseService } from '@shared'; | ||||
| import { AmapPoiPickerComponent, AmapService, ShipperBaseService } from '@shared'; | ||||
| import { NzModalService } from 'ng-zorro-antd/modal'; | ||||
| import { PublishGoodsChooseFamifiarComponent } from '../choose-famifiar/choose-famifiar.component'; | ||||
| import { SupplyManagementService } from '../../services/supply-management.service'; | ||||
| @ -25,7 +25,7 @@ import { of } from 'rxjs'; | ||||
|   templateUrl: './onecar-publish.component.html', | ||||
|   styleUrls: ['./onecar-publish.component.less'] | ||||
| }) | ||||
| export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
| export class SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|   validateForm1: FormGroup; | ||||
|   newTempchecked = false; //是否存入新模板 | ||||
|   sf1data: any; // 货源单设置回显 | ||||
| @ -40,9 +40,9 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|   totalFees: any; // 总数信息 | ||||
|   totalDistance = 0.0; //总里程 | ||||
|   totalTime = 0.0; //路程总时间 | ||||
|   currentRate = 0 //实时计算的费率 | ||||
|   currentRate = 0; //实时计算的费率 | ||||
|  | ||||
|   npp =false | ||||
|   npp = false; | ||||
|   id = this.route.snapshot.params.id; | ||||
|   // // 单位 | ||||
|   unit1 = '吨'; | ||||
| @ -53,18 +53,18 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|   PageStatus = ''; | ||||
|   dataList: any; | ||||
|   constructor( | ||||
|     private http: _HttpClient,  | ||||
|     fb: FormBuilder,  | ||||
|     private router: Router,  | ||||
|     private route: ActivatedRoute,  | ||||
|     private modalService: NzModalService,  | ||||
|     public service: SupplyManagementService,   | ||||
|     private http: _HttpClient, | ||||
|     fb: FormBuilder, | ||||
|     private router: Router, | ||||
|     private route: ActivatedRoute, | ||||
|     private modalService: NzModalService, | ||||
|     public service: SupplyManagementService, | ||||
|     private amapService: AmapService, | ||||
|     public shipperSrv: ShipperBaseService | ||||
|     ) { | ||||
|   ) { | ||||
|     this.validateForm1 = fb.group({ | ||||
|       loadingTime: [null, []], | ||||
|       unloadingTime: [null, []], | ||||
|       unloadingTime: [null, []] | ||||
|     }); | ||||
|   } | ||||
|   @ViewChild('sf1', { static: false }) sf1!: SFComponent; | ||||
| @ -95,16 +95,16 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|   schema7: SFSchema = {}; | ||||
|   ui7!: SFUISchema; | ||||
|   ngOnInit(): void { | ||||
|     if(this.route.snapshot?.queryParams?.sta === '1') { | ||||
|       console.log('修改') | ||||
|     if (this.route.snapshot?.queryParams?.sta === '1') { | ||||
|       console.log('修改'); | ||||
|       this.PageStatus = '整车修改'; | ||||
|     } else if(this.route.snapshot?.queryParams?.sta === '2')  { | ||||
|     } else if (this.route.snapshot?.queryParams?.sta === '2') { | ||||
|       this.PageStatus = '整车下一单'; | ||||
|     } else if(this.route.snapshot?.queryParams?.sta === '3')  { | ||||
|     } else if (this.route.snapshot?.queryParams?.sta === '3') { | ||||
|       this.PageStatus = '大宗修改'; | ||||
|     } else if(this.route.snapshot?.queryParams?.sta === '4')  { | ||||
|     } else if (this.route.snapshot?.queryParams?.sta === '4') { | ||||
|       this.PageStatus = '大宗下一单'; | ||||
|     }  | ||||
|     } | ||||
|     this.initSF1(); | ||||
|     // this.initSF2(); | ||||
|     this.initSF3(); | ||||
| @ -130,28 +130,28 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|             onSearch: (q: any) => { | ||||
|               if (!!q) { | ||||
|                 return this.service | ||||
|                   .request(this.service.$api_enterpriceList, { enterpriseName: q}) | ||||
|                   .pipe(map((res) => (res as any[]).map((i) => ({ label: i.enterpriseName, value: i.id } as SFSchemaEnum)))) | ||||
|                   .request(this.service.$api_enterpriceList, { enterpriseName: q }) | ||||
|                   .pipe(map(res => (res as any[]).map(i => ({ label: i.enterpriseName, value: i.id } as SFSchemaEnum)))) | ||||
|                   .toPromise(); | ||||
|               } else { | ||||
|                 return of([]); | ||||
|               } | ||||
|             }, | ||||
|             change: (q: any) => { | ||||
|               this.getRegionCode(q) | ||||
|               this.getRegionCode(q); | ||||
|             }, | ||||
|             visibleIf: { | ||||
|               _$expand: (value: boolean) => value, | ||||
|             }, | ||||
|           } as SFSelectWidgetSchema, | ||||
|         },  | ||||
|               _$expand: (value: boolean) => value | ||||
|             } | ||||
|           } as SFSelectWidgetSchema | ||||
|         }, | ||||
|         enterpriseProjectId: { | ||||
|           type: 'string', | ||||
|           title: '项目', | ||||
|           ui: { | ||||
|             widget: 'select', | ||||
|             placeholder: '请选择', | ||||
|             allowClear: true, | ||||
|             allowClear: true | ||||
|           } as SFSelectWidgetSchema | ||||
|         }, | ||||
|         enterpriseInfoName: { | ||||
| @ -159,7 +159,7 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|           title: '网络货运人', | ||||
|           ui: { | ||||
|             widget: 'text' | ||||
|           }, | ||||
|           } | ||||
|         }, | ||||
|         externalResourceCode: { | ||||
|           type: 'string', | ||||
| @ -243,7 +243,7 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|           } | ||||
|         } | ||||
|       }, | ||||
|       required: ['goodsName', ] | ||||
|       required: ['goodsName'] | ||||
|     }; | ||||
|     this.ui3 = { | ||||
|       '*': { | ||||
| @ -335,18 +335,18 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|   } | ||||
|   // 获取城市列表 | ||||
|   getRegionCode(regionCode: any) { | ||||
|     console.log(regionCode) | ||||
|     console.log(regionCode); | ||||
|     return this.service | ||||
|       .request(this.service.$api_get_enterprise_project, { id: regionCode }) | ||||
|       .pipe( | ||||
|         map((res) => | ||||
|         map(res => | ||||
|           res.map((item: any) => ({ | ||||
|             label: item.projectName, | ||||
|             value: item.id, | ||||
|           })), | ||||
|         ), | ||||
|             value: item.id | ||||
|           })) | ||||
|         ) | ||||
|       ) | ||||
|       .subscribe((res) => { | ||||
|       .subscribe(res => { | ||||
|         this.sf1.getProperty('/enterpriseProjectId')!.schema.enum = res; | ||||
|         this.sf1.getProperty('/enterpriseProjectId')!.widget.reset(res); | ||||
|       }); | ||||
| @ -393,7 +393,7 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|           ui: { | ||||
|             widget: 'dict-select', | ||||
|             params: { dictKey: 'receipt:type' }, | ||||
|             containsAllLable:false, | ||||
|             containsAllLable: false, | ||||
|             placeholder: '请选择', | ||||
|             errors: { required: '请选择' }, | ||||
|             visibleIf: { | ||||
| @ -465,7 +465,7 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|           } as SFTextareaWidgetSchema | ||||
|         } | ||||
|       }, | ||||
|       required: ['stateReceipt', 'receiptType','receiptAddressId'] | ||||
|       required: ['stateReceipt', 'receiptType', 'receiptAddressId'] | ||||
|     }; | ||||
|     this.ui6 = { | ||||
|       '*': { | ||||
| @ -475,8 +475,13 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|     }; | ||||
|   } | ||||
|   changeValue() { | ||||
|     this.totalFees = Number(this.sf7?.value?.appendFee) + Number(this.sf7?.value?.oilCardPay) + Number(this.sf7?.value?.prePay) + Number(this.sf7?.value?.receiptPay) + Number(this.sf7?.value?.toPay) | ||||
|     console.log(this.totalFees) | ||||
|     this.totalFees = | ||||
|       Number(this.sf7?.value?.appendFee) + | ||||
|       Number(this.sf7?.value?.oilCardPay) + | ||||
|       Number(this.sf7?.value?.prePay) + | ||||
|       Number(this.sf7?.value?.receiptPay) + | ||||
|       Number(this.sf7?.value?.toPay); | ||||
|     console.log(this.totalFees); | ||||
|   } | ||||
|   initSF7() { | ||||
|     this.schema7 = { | ||||
| @ -508,9 +513,9 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|           default: 0, | ||||
|           ui: { prefix: '¥', change: args => this.payChange() } as SFNumberWidgetSchema | ||||
|         }, | ||||
|         subtotal: { type: 'number', title: '小计',default: 0, ui: {widget: 'custom' } as SFNumberWidgetSchema }, | ||||
|         appendFee: { type: 'number', title: '附加费', default: 0, ui: {widget: 'custom' } as SFNumberWidgetSchema }, | ||||
|         total: { type: 'number', title: '总费用',  default: 0, ui: { widget: 'custom' } as SFNumberWidgetSchema }, | ||||
|         subtotal: { type: 'number', title: '小计', default: 0, ui: { widget: 'custom' } as SFNumberWidgetSchema }, | ||||
|         appendFee: { type: 'number', title: '附加费', default: 0, ui: { widget: 'custom' } as SFNumberWidgetSchema }, | ||||
|         total: { type: 'number', title: '总费用', default: 0, ui: { widget: 'custom' } as SFNumberWidgetSchema }, | ||||
|         paymentDays: { | ||||
|           type: 'string', | ||||
|           title: '到货后', | ||||
| @ -531,28 +536,30 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|     }; | ||||
|   } | ||||
|   payChange() { | ||||
|     const subtotal = (this.sf7.value.prePay + this.sf7.value.toPay + this.sf7.value.oilCardPay + this.sf7.value.receiptPay) || 0; | ||||
|     const subtotal = this.sf7.value.prePay + this.sf7.value.toPay + this.sf7.value.oilCardPay + this.sf7.value.receiptPay || 0; | ||||
|     const oilCardPay = this.sf7.value.oilCardPay || 0; | ||||
|     this.service.request(this.service.$api_getCalculatedSurcharge+`?totalFreight=${subtotal}&fuelCardAmount=${oilCardPay}`).subscribe(res => { | ||||
|       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_getcalculatedServiceRate+`?invoiceAmount=${subtotal+res.surcharge}&totalFreight=${subtotal}`).subscribe(res => { | ||||
|           if (res) { | ||||
|            this.currentRate = res.rate; | ||||
|           } else { | ||||
|             this.service.msgSrv.error(res.msg); | ||||
|           } | ||||
|         }); | ||||
|       } else { | ||||
|         this.service.msgSrv.error(res.msg); | ||||
|       } | ||||
|     }); | ||||
|      | ||||
|     this.service | ||||
|       .request(this.service.$api_getCalculatedSurcharge + `?totalFreight=${subtotal}&fuelCardAmount=${oilCardPay}`) | ||||
|       .subscribe(res => { | ||||
|         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_getcalculatedServiceRate + `?invoiceAmount=${subtotal + res.surcharge}&totalFreight=${subtotal}`) | ||||
|             .subscribe(res => { | ||||
|               if (res) { | ||||
|                 this.currentRate = res.rate; | ||||
|               } else { | ||||
|                 this.service.msgSrv.error(res.msg); | ||||
|               } | ||||
|             }); | ||||
|         } else { | ||||
|           this.service.msgSrv.error(res.msg); | ||||
|         } | ||||
|       }); | ||||
|   } | ||||
|  | ||||
|  | ||||
|   addStartInfo(event: any) { | ||||
|     if (this.startInfo.length < 5) { | ||||
|       const controlId = this.startInfo.length; | ||||
| @ -572,12 +579,12 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|       this.validateForm1.addControl(`loadPhone${controlId}`, new FormControl(null, Validators.required)); | ||||
|     } | ||||
|   } | ||||
|   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, id?: any) { | ||||
|     console.log(event, index, id); | ||||
|     if (id) { | ||||
|       this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe(res => { | ||||
|         console.log(res); | ||||
|       }); | ||||
|     } | ||||
|     this.startInfo.splice(index, 1); | ||||
|     this.validateForm1.removeControl(`loadAddress${index}`); | ||||
| @ -604,15 +611,15 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|       this.validateForm1.addControl(`unloadPhone${controlId}`, new FormControl(null, Validators.required)); | ||||
|     } | ||||
|   } | ||||
|   subEndInfo(event: any, index: number, id?:any) { | ||||
|     if(id) { | ||||
|       this.service.request(this.service.$api_delete_Wholedeletebatch,  [id]).subscribe((res) => { | ||||
|         console.log(res) | ||||
|       }) | ||||
|   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) | ||||
|     console.log(event, index, id); | ||||
|     this.endInfo.splice(index, 1); | ||||
|         this.validateForm1.removeControl(`unloadAddress${index}`); | ||||
|     this.validateForm1.removeControl(`unloadAddress${index}`); | ||||
|     this.validateForm1.removeControl(`unloadName${index}`); | ||||
|     this.validateForm1.removeControl(`unloadPhone${index}`); | ||||
|   } | ||||
| @ -626,8 +633,8 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|     }); | ||||
|   } | ||||
|   submit(): void { | ||||
|     console.log('进来了') | ||||
|     console.log(this.startInfo) | ||||
|     console.log('进来了'); | ||||
|     console.log(this.startInfo); | ||||
|     // Object.keys(this.validateForm1.controls).forEach(key => { | ||||
|     //   this.validateForm1.controls[key].markAsDirty(); | ||||
|     //   this.validateForm1.controls[key].updateValueAndValidity(); | ||||
| @ -639,14 +646,36 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|     // if (this.validateForm1.invalid || !this.sf1.valid || !this.sf3.valid || !this.sf4.valid || !this.sf6.valid) { | ||||
|     //   return; | ||||
|     // } | ||||
|     console.log(this.validateForm1.value) | ||||
|     if(typeof(this.validateForm1.value.unloadingTime) !== 'string' ) { | ||||
|       var c = new Date(this.validateForm1.value.unloadingTime);   | ||||
|       this.validateForm1.value.unloadingTime = c.getFullYear() + '-' + this.addPreZero(c.getMonth() + 1) + '-' + this.addPreZero(c.getDate()) + ' ' + this.addPreZero(c.getHours()) + ':' + this.addPreZero(c.getMinutes()) + ':' + this.addPreZero(c.getSeconds()) | ||||
|     console.log(this.validateForm1.value); | ||||
|     if (typeof this.validateForm1.value.unloadingTime !== 'string') { | ||||
|       var c = new Date(this.validateForm1.value.unloadingTime); | ||||
|       this.validateForm1.value.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.validateForm1.value.loadingTime) !== 'string' ) { | ||||
|       var c = new Date(this.validateForm1.value.loadingTime);   | ||||
|       this.validateForm1.value.loadingTime = 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.validateForm1.value.loadingTime !== 'string') { | ||||
|       var c = new Date(this.validateForm1.value.loadingTime); | ||||
|       this.validateForm1.value.loadingTime = | ||||
|         c.getFullYear() + | ||||
|         '-' + | ||||
|         this.addPreZero(c.getMonth() + 1) + | ||||
|         '-' + | ||||
|         this.addPreZero(c.getDate()) + | ||||
|         ' ' + | ||||
|         this.addPreZero(c.getHours()) + | ||||
|         ':' + | ||||
|         this.addPreZero(c.getMinutes()) + | ||||
|         ':' + | ||||
|         this.addPreZero(c.getSeconds()); | ||||
|     } | ||||
|     // if (this.validateForm1.invalid) { | ||||
|     //   return; | ||||
| @ -658,7 +687,7 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|       paymentDays: this.sf7.value.paymentDays, | ||||
|       loadingTime: this.validateForm1?.value?.loadingTime, | ||||
|       unloadingTime: this.validateForm1?.value?.unloadingTime, | ||||
|       unLoadingPlaceDTOList: [...this.startInfo, ...this.endInfo,],  | ||||
|       unLoadingPlaceDTOList: [...this.startInfo, ...this.endInfo], | ||||
|       goodsInfoDTOList: [ | ||||
|         { | ||||
|           ...this.sf4.value, | ||||
| @ -667,25 +696,25 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|           maxCube: this.sf4.value.maxCube.join(',') | ||||
|         } | ||||
|       ] | ||||
|     } | ||||
|       params.shippingInformationDTO = { | ||||
|         ...this.sf7.value, | ||||
|         totalFees: this.totalFees | ||||
|       } | ||||
|     console.log(params) | ||||
|     if(this.PageStatus === '整车修改') { | ||||
|     }; | ||||
|     params.shippingInformationDTO = { | ||||
|       ...this.sf7.value, | ||||
|       totalFees: this.totalFees | ||||
|     }; | ||||
|     console.log(params); | ||||
|     if (this.PageStatus === '整车修改') { | ||||
|       this.requests(this.service.$api_set_WholeModify, params); | ||||
|     }  else if(this.PageStatus === '整车下一单') { | ||||
|     } else if (this.PageStatus === '整车下一单') { | ||||
|       this.requests(this.service.$api_set_saveAnotherWholeOrder, params); | ||||
|     } | ||||
|   } | ||||
|    addPreZero(num: any){ | ||||
|     if(num<10){ | ||||
|      return '0'+num; | ||||
|   addPreZero(num: any) { | ||||
|     if (num < 10) { | ||||
|       return '0' + num; | ||||
|     } else { | ||||
|      return num; | ||||
|       return num; | ||||
|     } | ||||
|    } | ||||
|   } | ||||
|   requests(url: any, params: any) { | ||||
|     this.service.request(url, params).subscribe((res: any) => { | ||||
|       if (res) { | ||||
| @ -699,92 +728,92 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|       } else { | ||||
|         this.service.msgSrv.error(res.msg); | ||||
|       } | ||||
|     }) | ||||
|     }); | ||||
|   } | ||||
|  // 打开地图 | ||||
|  openMap(type: string, index: number) { | ||||
|   const modalRef = this.modalService.create({ | ||||
|     nzTitle: '', | ||||
|     nzContent: AmapPoiPickerComponent, | ||||
|     nzWidth: 900, | ||||
|     nzOnOk: item => { | ||||
|       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; | ||||
|           this.startInfo[index].address = poi.formattedAddress; | ||||
|           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; | ||||
|           this.endInfo[index].address = poi.formattedAddress; | ||||
|           break; | ||||
|         default: | ||||
|           break; | ||||
|       } | ||||
|   // 打开地图 | ||||
|   openMap(type: string, index: number) { | ||||
|     const modalRef = this.modalService.create({ | ||||
|       nzTitle: '', | ||||
|       nzContent: AmapPoiPickerComponent, | ||||
|       nzWidth: 900, | ||||
|       nzOnOk: item => { | ||||
|         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; | ||||
|             this.startInfo[index].address = poi.formattedAddress; | ||||
|             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; | ||||
|             this.endInfo[index].address = poi.formattedAddress; | ||||
|             break; | ||||
|           default: | ||||
|             break; | ||||
|         } | ||||
|  | ||||
|       if (this.startInfo[0]?.area && this.endInfo[0]?.area) { | ||||
|         this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe((res: any) => { | ||||
|           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: any) => { | ||||
|             this.totalDistance = res.distance; | ||||
|             this.totalTime = res.time; | ||||
|           }); | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   }); | ||||
| } | ||||
|     }); | ||||
|   } | ||||
|   goBack() { | ||||
|     window.history.go(-1); | ||||
|   } | ||||
|   // 初始化信息 | ||||
|   initdata() { | ||||
|     this.service.request(`${this.service.$api_get_getCompleteVehicleDetail}`, {id:this.id}).subscribe((res) => { | ||||
|     this.service.request(`${this.service.$api_get_getCompleteVehicleDetail}`, { id: this.id }).subscribe(res => { | ||||
|       this.dataR(res); | ||||
|     }) | ||||
|     }); | ||||
|   } | ||||
|   asds(i: any) { | ||||
|     console.log(i) | ||||
|     console.log(i); | ||||
|   } | ||||
|   // 初始化信息 | ||||
|   dataR (res: any) { | ||||
|   dataR(res: any) { | ||||
|     // this.dataList = res; | ||||
|       if(res?.shipperAppUserName) { | ||||
|         const List: any = [] | ||||
|         this.service.request(this.service.$api_enterpriceList, { enterpriseName: res?.shipperAppUserName}).subscribe((res) => { | ||||
|           console.log(res) | ||||
|           res?.forEach((element: any) => { | ||||
|             List.push({ label: element.enterpriseName, value: element.id } ) | ||||
|           }); | ||||
|         console.log(List) | ||||
|     if (res?.shipperAppUserName) { | ||||
|       const List: any = []; | ||||
|       this.service.request(this.service.$api_enterpriceList, { enterpriseName: res?.shipperAppUserName }).subscribe(rs => { | ||||
|         rs?.forEach((element: any) => { | ||||
|           List.push({ label: element.enterpriseName, value: element.id }); | ||||
|         }); | ||||
|         this.sf1.getProperty('/shipperAppUserId')!.schema.enum = List; | ||||
|         this.sf1.getProperty('/shipperAppUserId')!.widget.reset(List); | ||||
|         }) | ||||
|       } | ||||
|       if(res?.shipperAppUserId) { | ||||
|         this.getRegionCode(res?.shipperAppUserId) | ||||
|       } | ||||
|         if (res?.shipperAppUserId) { | ||||
|           this.sf1.setValue('/shipperAppUserId', res?.shipperAppUserId); | ||||
|           this.getRegionCode(res?.shipperAppUserId); | ||||
|         } | ||||
|       }); | ||||
|     } | ||||
|     | ||||
|     this.sf1data = { | ||||
|       // enterpriseProjectId: res?.enterpriseProjectId, | ||||
|       enterpriseInfoName: res?.enterpriseInfoName, | ||||
|       externalResourceCode: res?.externalResourceCode, | ||||
|       dispatchId: res?.dispatchId  , | ||||
|     } | ||||
|     if(this.PageStatus === '整车修改') { | ||||
|       dispatchId: res?.dispatchId | ||||
|     }; | ||||
|     if (this.PageStatus === '整车修改') { | ||||
|       this.sf1data.id = res?.id; | ||||
|     } | ||||
|     res?.unLoadingPlaceVOList.forEach((element: any) => { | ||||
|       if(element.type === 1 || element.type === '1') { | ||||
|       if (element.type === 1 || element.type === '1') { | ||||
|         const controlId = this.startInfo.length; | ||||
|         if(this.PageStatus === '整车修改') { | ||||
|         if (this.PageStatus === '整车修改') { | ||||
|           this.startInfo.push({ | ||||
|             detailedAddress: element.detailedAddress, | ||||
|             appUserName: element.appUserName, | ||||
| @ -796,7 +825,7 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|             area: element.area, | ||||
|             type: element.type, | ||||
|             id: element.id | ||||
|           }) | ||||
|           }); | ||||
|         } else { | ||||
|           this.startInfo.push({ | ||||
|             detailedAddress: element.detailedAddress, | ||||
| @ -807,16 +836,16 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|             province: element.province, | ||||
|             city: element.city, | ||||
|             area: element.area, | ||||
|             type: element.type, | ||||
|           }) | ||||
|             type: element.type | ||||
|           }); | ||||
|         } | ||||
|         | ||||
|  | ||||
|         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)); | ||||
|       } else if(element.type === 2 || element.type === '2') { | ||||
|       } else if (element.type === 2 || element.type === '2') { | ||||
|         const controlId = this.endInfo.length; | ||||
|         if(this.PageStatus === '整车修改') {  | ||||
|         if (this.PageStatus === '整车修改') { | ||||
|           this.endInfo.push({ | ||||
|             detailedAddress: element?.detailedAddress, | ||||
|             appUserName: element?.appUserName, | ||||
| @ -828,7 +857,7 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|             area: element.area, | ||||
|             type: element.type, | ||||
|             id: element.id | ||||
|           }) | ||||
|           }); | ||||
|         } else { | ||||
|           this.endInfo.push({ | ||||
|             detailedAddress: element?.detailedAddress, | ||||
| @ -840,7 +869,7 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|             city: element.city, | ||||
|             area: element.area, | ||||
|             type: element.type | ||||
|           }) | ||||
|           }); | ||||
|         } | ||||
|         this.validateForm1.addControl(`unloadAddress${controlId}`, new FormControl(null, Validators.required)); | ||||
|         this.validateForm1.addControl(`unloadName${controlId}`, new FormControl(null, Validators.required)); | ||||
| @ -849,50 +878,50 @@ export class  SupplyManagementOnecarPublishComponent implements OnInit { | ||||
|     }); | ||||
|  | ||||
|     this.sf3data = { | ||||
|       goodsName: res?.goodsInfoVOList[0]?.goodsName , | ||||
|     } | ||||
|       goodsName: res?.goodsInfoVOList[0]?.goodsName | ||||
|     }; | ||||
|     this.sf4data = { | ||||
|       weight:  res?.goodsInfoVOList[0]?.weight   , | ||||
|       volume:  res?.goodsInfoVOList[0]?.volume   , | ||||
|       vehicleDemand:  res?.goodsInfoVOList[0]?.vehicleDemand   , | ||||
|       maxCube: res?.goodsInfoVOList[0]?.maxCube?.split(',') , | ||||
|       weight: res?.goodsInfoVOList[0]?.weight, | ||||
|       volume: res?.goodsInfoVOList[0]?.volume, | ||||
|       vehicleDemand: res?.goodsInfoVOList[0]?.vehicleDemand, | ||||
|       maxCube: res?.goodsInfoVOList[0]?.maxCube?.split(','), | ||||
|       maxWeight: res?.goodsInfoVOList[0]?.maxWeight?.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) { | ||||
|       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) { | ||||
|     if (res?.unloadingTime) { | ||||
|       this.unloadingTime = res?.unloadingTime; | ||||
|     } | ||||
|     if(this.PageStatus === '整车修改' ) {  | ||||
|     if (this.PageStatus === '整车修改') { | ||||
|       this.sf4data.id = res?.goodsInfoVOList[0]?.id; | ||||
|      } | ||||
|     } | ||||
|     this.totalFees = res?.shippingInformationVO?.totalFee || '0'; | ||||
|     this.sf5data = { | ||||
|       goodsValue: res?.goodsValue , | ||||
|     } | ||||
|     console.log(res?.stateReceipt) | ||||
|       goodsValue: res?.goodsValue | ||||
|     }; | ||||
|     console.log(res?.stateReceipt); | ||||
|     this.sf6data = { | ||||
|       stateReceipt: res?.stateReceipt, | ||||
|       receiptType: res?.receiptType , | ||||
|       receiptUserId: res?.receiptUserId , | ||||
|       remarks: res?.remarks  | ||||
|     } | ||||
|       receiptType: res?.receiptType, | ||||
|       receiptUserId: res?.receiptUserId, | ||||
|       remarks: res?.remarks | ||||
|     }; | ||||
|     this.sf7data = { | ||||
|       prePay: res?.shippingInformationVO?.prePay , | ||||
|       toPay: res?.shippingInformationVO?.toPay , | ||||
|       oilCardPay: res?.shippingInformationVO?.oilCardPay , | ||||
|       receiptPay: res?.shippingInformationVO?.receiptPay , | ||||
|       prePay: res?.shippingInformationVO?.prePay, | ||||
|       toPay: res?.shippingInformationVO?.toPay, | ||||
|       oilCardPay: res?.shippingInformationVO?.oilCardPay, | ||||
|       receiptPay: res?.shippingInformationVO?.receiptPay, | ||||
|       // subtotal: res?.shippingInformationVO?.oilCardPay , | ||||
|       appendFee: res?.shippingInformationVO?.appendFee , | ||||
|       paymentDays: res?.paymentDays , | ||||
|     } | ||||
|       appendFee: res?.shippingInformationVO?.appendFee, | ||||
|       paymentDays: res?.paymentDays | ||||
|     }; | ||||
|   } | ||||
|   backBillChange() { | ||||
|     const modalRef = this.modalService.create({ | ||||
|  | ||||
		Reference in New Issue
	
	Block a user