ediot
This commit is contained in:
		| @ -7,12 +7,10 @@ import { | ||||
|   SFComponent, | ||||
|   SFDateWidgetSchema, | ||||
|   SFSchema, | ||||
|   SFSchemaEnum, | ||||
|   SFTextareaWidgetSchema, | ||||
|   SFUISchema, | ||||
|   SFUploadWidgetSchema | ||||
| } from '@delon/form'; | ||||
| import { NzMessageService } from 'ng-zorro-antd/message'; | ||||
| import { UsermanageService } from 'src/app/routes/usercenter/services/usercenter.service'; | ||||
|  | ||||
| const IMAGECONFIG = { | ||||
| @ -79,6 +77,13 @@ export class FreightComponentsListNewComponent implements OnInit { | ||||
|   ngOnInit() {} | ||||
|  | ||||
|   submitForm() { | ||||
|     if (!this.sf1.valid || !this.sf.valid) { | ||||
|       this.sf.validator({ emitError: true }); | ||||
|       this.sf1.validator({ emitError: true }); | ||||
|       this.service.msgSrv.warning('请修改填写错误信息'); | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|     const sfVlaue = this.sf.value; | ||||
|     const params = {}; | ||||
|     Object.assign( | ||||
| @ -113,114 +118,99 @@ export class FreightComponentsListNewComponent implements OnInit { | ||||
|   } | ||||
|  | ||||
|   /* | ||||
|    * 根据地区code查询地区详情 | ||||
|    * code:请求参数 | ||||
|    * type:参数 name:获取省市区名称,fullcode:获取省市区code | ||||
|    * num:参数 1:第一个地区选择,2:第二个地区选择 | ||||
|    * 根据地区code查询地区列表 | ||||
|    */ | ||||
|   getRegionDetailByCode(regionCode: any) { | ||||
|     // 根据地区code查询地区详情 | ||||
|     return this.service.request(this.service.$api_get_region_by_code, { regionCode }); | ||||
|   } | ||||
|  | ||||
|   checkIdCard(imgurl: any, isFront: number, type: number) { | ||||
|     // 识别身份证 参数isFront:0-正面、1-背面;type:0-申请人身份证,1-法定代表人身份证 | ||||
|   // 识别身份证 参数isFront:front-正面、back-背面;type:0-申请人身份证,1-法定代表人身份证 | ||||
|   checkIdCard(imgurl: any, isFront: string, type: number) { | ||||
|     const params = { | ||||
|       idCardImagePath: imgurl, | ||||
|       isFront | ||||
|       idCardUrl: imgurl, | ||||
|       side: isFront | ||||
|     }; | ||||
|     // this.service.request(this.service.$api_checkIdCard, params).subscribe((res) => { | ||||
|     //   if (res) { | ||||
|     //     if (type === 0) { | ||||
|     //       // 申请人身份证 | ||||
|     //       if (isFront === 0) { | ||||
|     //         // 正面 | ||||
|     //         if (res.name) { | ||||
|     //           this.sf.setValue('/name', res.name); | ||||
|     //         } | ||||
|     //         if (res.idCardNumber) { | ||||
|     //           this.sf.setValue('/certificateNumber', res.idCardNumber); | ||||
|     //         } | ||||
|     //       } | ||||
|     //       if (isFront === 1) { | ||||
|     //         // 背面 | ||||
|     //         if (res.validFrom) { | ||||
|     //           this.sf.setValue('/validStartTime', res.validFrom); | ||||
|     //         } | ||||
|     //         if (res.validTo) { | ||||
|     //           this.sf.setValue('/validEndTime', res.validTo); | ||||
|     //         } | ||||
|     //       } | ||||
|     //     } | ||||
|     //     if (type === 1) { | ||||
|     //       // 法定代表人身份证 | ||||
|     //       if (isFront === 0) { | ||||
|     //         // 正面 | ||||
|     //         if (res.name) { | ||||
|     //           this.sf1.setValue('/name', res.name); | ||||
|     //         } | ||||
|     //         if (res.idCardNumber) { | ||||
|     //           this.sf1.setValue('/certificateNumber', res.idCardNumber); | ||||
|     //         } | ||||
|     //       } | ||||
|     //       if (isFront === 1) { | ||||
|     //         // 背面 | ||||
|     //         if (res.validFrom) { | ||||
|     //           this.sf1.setValue('/validStartTime', res.validFrom); | ||||
|     //         } | ||||
|     //         if (res.validTo) { | ||||
|     //           this.sf1.setValue('/validEndTime', res.validTo); | ||||
|     //         } | ||||
|     //       } | ||||
|     //     } | ||||
|     //   } | ||||
|     // }); | ||||
|     this.service.request(this.service.$api_ocr_recognize_id_card, params).subscribe(res => { | ||||
|       if (res) { | ||||
|         if (type === 1) { | ||||
|           // 法定代表人证件照 | ||||
|           if (isFront === 'front') { | ||||
|             // 正面 | ||||
|             if (res.name) { | ||||
|               this.sf1.setValue('/legalPersonIdentityDTO/name', res.name); | ||||
|             } | ||||
|             if (res.number) { | ||||
|               this.sf1.setValue('/legalPersonIdentityDTO/certificateType', 0); | ||||
|               this.sf1.setValue('/legalPersonIdentityDTO/certificateNumber', res.number); | ||||
|             } | ||||
|           } | ||||
|           if (isFront === 'back') { | ||||
|             // 背面 | ||||
|             if (res.validFrom) { | ||||
|               this.sf1.setValue('/legalPersonIdentityDTO/validStartTime', res.validFrom); | ||||
|             } | ||||
|             if (res.validTo) { | ||||
|               this.sf1.setValue('/legalPersonIdentityDTO/validEndTime', res.validTo); | ||||
|               this.sf1.setValue('/legalPersonIdentityDTO/isLoingDate', false); | ||||
|             } else { | ||||
|               this.sf1.setValue('/legalPersonIdentityDTO/isLoingDate', true); | ||||
|             } | ||||
|           } | ||||
|         } | ||||
|         // 企业管理员证件照 | ||||
|         if (type === 0) { | ||||
|           if (isFront === 'front') { | ||||
|             // 正面 | ||||
|             if (res.name) { | ||||
|               this.sf.setValue('/name', res.name); | ||||
|             } | ||||
|             if (res.number) { | ||||
|               this.sf.setValue('/certificateNumber', res.number); | ||||
|             } | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|     }); | ||||
|   } | ||||
|  | ||||
|   // 识别营业执照 | ||||
|   checkBusinessLicense(imgurl: any) { | ||||
|     // 识别营业执照 | ||||
|     const params = { | ||||
|       licenseImagePath: imgurl | ||||
|     }; | ||||
|     // this.service.request(this.service.$api_checkBusinessLicense, params).subscribe((res) => { | ||||
|     //   if (res) { | ||||
|     //     if (res.unifiedSocialCreditCode) { | ||||
|     //       this.sf1.setValue('/unifiedSocialCreditCode', res.unifiedSocialCreditCode); | ||||
|     //     } | ||||
|     //     if (res.enterpriseName) { | ||||
|     //       this.sf1.setValue('/enterpriseName', res.enterpriseName); | ||||
|     //     } | ||||
|     //     if (res.enterpriseType) { | ||||
|     //       this.sf1.setValue('/enterpriseType', res.enterpriseType); | ||||
|     //     } | ||||
|     //     if (res.addressRegionCodes) { | ||||
|     //       this.sf1.setValue('/region', res.addressRegionCodes); | ||||
|     //     } | ||||
|     //     if (res.address) { | ||||
|     //       this.sf1.setValue('/enterpriseAddress', res.address); | ||||
|     //     } | ||||
|     //     if (res.foundDate) { | ||||
|     //       this.sf1.setValue('/enterpriseRegistrationTime', res.foundDate); | ||||
|     //     } | ||||
|     //     if (res.registeredCapital) { | ||||
|     //       this.sf1.setValue('/registrationCapital', res.registeredCapital); | ||||
|     //     } | ||||
|     //     if (res.businessTermStartDate) { | ||||
|     //       this.sf1.setValue('/operatingStartTime', res.businessTermStartDate); | ||||
|     //     } | ||||
|     //     if (res.businessTermEndDate) { | ||||
|     //       this.sf1.setValue('/operatingEndTime', res.businessTermEndDate); | ||||
|     //     } | ||||
|     //     if (res.businessScope) { | ||||
|     //       this.sf1.setValue('/businessScope', res.businessScope); | ||||
|     //     } | ||||
|     //     const len = res.addressRegionCodes.length - 1; | ||||
|     //     this.enterpriseAddressCode = res.addressRegionCodes[len]; | ||||
|     //     this.enterpriseAddressCodeStr = res.addressRegionNames; | ||||
|     //     if (!res.businessTermEndDate) { | ||||
|     //       this.sf1.setValue('/dateType', true); | ||||
|     //     } | ||||
|     //   } | ||||
|     // }); | ||||
|     this.service.request(this.service.$api_ocr_recognize_business_license, { businessLicenseUrl: imgurl }).subscribe(res => { | ||||
|       if (res) { | ||||
|         if (res.registrationNumber) { | ||||
|           this.sf1.setValue('/unifiedSocialCreditCode', res.registrationNumber); | ||||
|         } | ||||
|         if (res.name) { | ||||
|           this.sf1.setValue('/enterpriseName', res.name); | ||||
|         } | ||||
|         if (res.type) { | ||||
|           this.sf1.setValue('/enterpriseType', res.type); | ||||
|         } | ||||
|         if (res.addressRegionCodes) { | ||||
|           this.sf1.setValue('/enterpriseAddressCode', res.addressRegionCodes); | ||||
|         } | ||||
|         if (res.address) { | ||||
|           this.sf1.setValue('/enterpriseAddress', res.address); | ||||
|         } | ||||
|         if (res.registeredCapital) { | ||||
|           this.sf1.setValue('/registrationCapital', res.registeredCapital); | ||||
|         } | ||||
|         if (res.foundDate) { | ||||
|           this.sf1.setValue('/enterpriseRegistrationTime', res.foundDate); | ||||
|         } | ||||
|         if (res.businessTermStartDate) { | ||||
|           this.sf1.setValue('/operatingStartTime', res.businessTermStartDate); | ||||
|         } | ||||
|         if (res.businessTermEndDate) { | ||||
|           this.sf1.setValue('/operatingEndTime', res.businessTermEndDate); | ||||
|         } else { | ||||
|           this.sf1.setValue('/isLoingDate', true); | ||||
|         } | ||||
|         if (res.businessScope) { | ||||
|           this.sf1.setValue('/businessScope', res.businessScope); | ||||
|         } | ||||
|       } | ||||
|     }); | ||||
|   } | ||||
|  | ||||
|   goBack() { | ||||
| @ -438,7 +428,7 @@ export class FreightComponentsListNewComponent implements OnInit { | ||||
|                 change: args => { | ||||
|                   if (args.type === 'success') { | ||||
|                     this.sf1.setValue('/legalPersonIdentityDTO/certificatePhotoFront', args.fileList[0].response.data.fullFilePath); | ||||
|                     this.checkIdCard(args.fileList[0].response.data.fullFileWatermarkPath, 0, 1); | ||||
|                     this.checkIdCard(args.fileList[0].response.data.fullFilePath, 'front', 1); | ||||
|                   } | ||||
|                 } | ||||
|               } as SFUploadWidgetSchema | ||||
| @ -455,7 +445,7 @@ export class FreightComponentsListNewComponent implements OnInit { | ||||
|                 change: args => { | ||||
|                   if (args.type === 'success') { | ||||
|                     this.sf1.setValue('/legalPersonIdentityDTO/certificatePhotoBack', args.fileList[0].response.data.fullFilePath); | ||||
|                     this.checkIdCard(args.fileList[0].response.data.fullFileWatermarkPath, 0, 1); | ||||
|                     this.checkIdCard(args.fileList[0].response.data.fullFilePath, 'back', 1); | ||||
|                   } | ||||
|                 } | ||||
|               } as SFUploadWidgetSchema | ||||
| @ -531,19 +521,11 @@ export class FreightComponentsListNewComponent implements OnInit { | ||||
|                 grid: { span: 6 }, | ||||
|                 class: 'input-back', | ||||
|                 widget: 'checkbox', | ||||
|                 change: i=> this.sf1?.setValue('/legalPersonIdentityDTO/validEndTime', null), | ||||
|                 change: i => this.sf1?.setValue('/legalPersonIdentityDTO/validEndTime', null) | ||||
|               } as SFCheckboxWidgetSchema | ||||
|             } | ||||
|           }, | ||||
|           required: [ | ||||
|             'tipsC', | ||||
|             'certificatePhotoFront', | ||||
|             'certificatePhotoBack', | ||||
|             'name', | ||||
|             'certificateType', | ||||
|             'certificateNumber', | ||||
|             'validStartTime', | ||||
|           ] | ||||
|           required: ['certificatePhotoFront', 'certificatePhotoBack', 'name', 'certificateType', 'certificateNumber', 'validStartTime'] | ||||
|         } | ||||
|       }, | ||||
|       required: [ | ||||
| @ -610,7 +592,7 @@ export class FreightComponentsListNewComponent implements OnInit { | ||||
|             change: args => { | ||||
|               if (args.type === 'success') { | ||||
|                 this.sf.setValue('/certificatePhotoFront', args.fileList[0].response.data.fullFilePath); | ||||
|                 this.checkIdCard(args.fileList[0].response.data.fullFileWatermarkPath, 0, 1); | ||||
|                 this.checkIdCard(args.fileList[0].response.data.fullFilePath, 'front', 0); | ||||
|               } | ||||
|             } | ||||
|           } as SFUploadWidgetSchema | ||||
| @ -632,7 +614,6 @@ export class FreightComponentsListNewComponent implements OnInit { | ||||
|             change: args => { | ||||
|               if (args.type === 'success') { | ||||
|                 this.sf.setValue('/certificatePhotoBack', args.fileList[0].response.data.fullFilePath); | ||||
|                 this.checkIdCard(args.fileList[0].response.data.fullFileWatermarkPath, 0, 1); | ||||
|               } | ||||
|             } | ||||
|           } as SFUploadWidgetSchema | ||||
| @ -668,7 +649,6 @@ export class FreightComponentsListNewComponent implements OnInit { | ||||
|             change: args => { | ||||
|               if (args.type === 'success') { | ||||
|                 this.sf.setValue('/creditPhoto', args.fileList[0].response.data.fullFilePath); | ||||
|                 this.checkIdCard(args.fileList[0].response.data.fullFileWatermarkPath, 0, 1); | ||||
|               } | ||||
|             } | ||||
|           } as SFUploadWidgetSchema | ||||
| @ -705,21 +685,17 @@ export class FreightComponentsListNewComponent implements OnInit { | ||||
|         networkTransporter: { | ||||
|           type: 'string', | ||||
|           title: '网络货运人', | ||||
|           enum: [ | ||||
|             { label: '全部', value: 0 }, | ||||
|             { label: '大宗发货', value: 20 } | ||||
|           ], | ||||
|           default: 0, | ||||
|           ui: { | ||||
|             grid: { xxl: 13, xl: 18, lg: 24, md: 24 }, | ||||
|             widget: 'select', | ||||
|             visibleIf: { | ||||
|               expand: (value: boolean) => value | ||||
|             } | ||||
|           } | ||||
|             placeholder: '请选择', | ||||
|             allowClear: true, | ||||
|             asyncData: () => this.service.getNetworkFreightForwarder() | ||||
|           }, | ||||
|           default: '' | ||||
|         } | ||||
|       }, | ||||
|       required: ['createBank', '银行账号', 'adminMobile', 'name', 'certificateNumber', 'tipsD', 'creditPhoto'] | ||||
|       required: ['createBank', 'bankAccount', 'adminMobile', 'name', 'certificateNumber', 'tipsD', 'creditPhoto'] | ||||
|     }; | ||||
|   } | ||||
| } | ||||
|  | ||||
| @ -8,16 +8,14 @@ | ||||
|  */ | ||||
| import { Injectable, Injector } from '@angular/core'; | ||||
| import { _HttpClient } from '@delon/theme'; | ||||
| import { NzMessageService } from 'ng-zorro-antd/message'; | ||||
| import { ShipperBaseService } from '@shared'; | ||||
| import { NzModalService } from 'ng-zorro-antd/modal'; | ||||
| import { ImageViewComponent } from 'src/app/shared/components/imagelist'; | ||||
| import { BaseService } from 'src/app/shared/services/core/base.service'; | ||||
| import { EAFileUtil } from 'src/app/shared/utils/file.util'; | ||||
|  | ||||
| @Injectable({ | ||||
|   providedIn: 'root' | ||||
| }) | ||||
| export class UsermanageService extends BaseService { | ||||
| export class UsermanageService extends ShipperBaseService { | ||||
|   // 查询企业列表 | ||||
|   $api_get_freight_list = '/api/mdc/cuc/enterpriseInfo/operate/list/page'; | ||||
|  | ||||
| @ -93,6 +91,8 @@ export class UsermanageService extends BaseService { | ||||
|  | ||||
|   // 根据地区code查询列表 | ||||
|   $api_get_region_by_code = '/api/mdc/pbc/region/getRegionByCode'; | ||||
|   // 根据地区code查询地区详情 | ||||
|   $api_get_region_detail_by_code = '/api/mdc/pbc/region/getRegionDetailByCode'; | ||||
|  | ||||
|   // 导出企业 | ||||
|   $api_export_enterprise = '/api/mdc/cuc/enterpriseInfo/operate/export'; | ||||
| @ -101,6 +101,11 @@ export class UsermanageService extends BaseService { | ||||
|   // 车队长导出-运营后台 | ||||
|   $api_export_driver_cap = '/api/mdc/userDriverExpand/export'; | ||||
|  | ||||
|   // 营业执照识别 | ||||
|   $api_ocr_recognize_business_license = '/api/mdc/pbc/hwc/ocr/recognizeBusinessLicense'; | ||||
|   // 身份证识别 | ||||
|   $api_ocr_recognize_id_card = '/api/mdc/pbc/hwc/ocr/recognizeIdCard'; | ||||
|  | ||||
|   constructor(public injector: Injector, private nzModalService: NzModalService) { | ||||
|     super(injector); | ||||
|   } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user