diff --git a/src/app/routes/partner/partner-list/components/add-etp-partner/add-etp-partner.component.ts b/src/app/routes/partner/partner-list/components/add-etp-partner/add-etp-partner.component.ts
index 580f9f3d..00540e31 100644
--- a/src/app/routes/partner/partner-list/components/add-etp-partner/add-etp-partner.component.ts
+++ b/src/app/routes/partner/partner-list/components/add-etp-partner/add-etp-partner.component.ts
@@ -9,7 +9,8 @@ import {
SFCascaderWidgetSchema,
SFTextareaWidgetSchema,
SFDateWidgetSchema,
- SFCheckboxWidgetSchema
+ SFCheckboxWidgetSchema,
+ SFTreeSelectWidgetSchema
} from '@delon/form';
import { NzUploadFile } from 'ng-zorro-antd/upload';
import { of } from 'rxjs';
@@ -45,10 +46,7 @@ const DATECONFIG = {
export class AddEtpPartnerComponent implements OnInit {
@ViewChild('sf', { static: false })
sf!: SFComponent;
- @ViewChild('sf1', { static: false })
- sf1!: SFComponent;
- schema: SFSchema = this.initOthersSF();
- schema1: SFSchema = this.initBasicInfoSF();
+ schema: SFSchema = this.initBasicInfoSF();
ui: SFUISchema = {
'*': {
spanLabelFixed: 180,
@@ -57,19 +55,9 @@ export class AddEtpPartnerComponent implements OnInit {
$_basicInfoTitle: {
spanLabelFixed: 0
},
- $title99: {
- spanLabelFixed: 0
- },
$_legalPersontitle: {
spanLabelFixed: 0
},
- $registrationCapital: {
- spanLabelFixed: 180,
- grid: { xxl: 13, xl: 18, lg: 22, md: 22 }
- },
- $unit: {
- grid: { xxl: 6, xl: 6, lg: 2, md: 2 }
- },
$_isLoingDate: {
spanLabelFixed: 100,
grid: { xxl: 6, xl: 6, lg: 4, md: 6 }
@@ -77,32 +65,30 @@ export class AddEtpPartnerComponent implements OnInit {
};
constructor(private router: Router, public service: PartnerListService) {}
- ngOnInit() {
- }
+ ngOnInit() {}
submitForm() {
- if (!this.sf1.valid || !this.sf.valid) {
+ if (!this.sf.valid ) {
this.sf.validator({ emitError: true });
- this.sf1.validator({ emitError: true });
this.service.msgSrv.warning('请修改填写错误信息');
return;
}
- const enterpriseRegistrationTime = new Date(this.sf1.value.enterpriseRegistrationTime);
- const operatingStartTime = new Date(this.sf1.value.operatingStartTime);
+ const enterpriseRegistrationTime = new Date(this.sf.value.enterpriseRegistrationTime);
+ const operatingStartTime = new Date(this.sf.value.operatingStartTime);
if (enterpriseRegistrationTime.getTime() > operatingStartTime.getTime()) {
this.service.msgSrv.warning('营业期限不能小于成立日期');
return;
}
- if (this.sf1.value.operatingEndTime) {
- const operatingEndTime = new Date(this.sf1.value.operatingEndTime);
+ if (this.sf.value.operatingEndTime) {
+ const operatingEndTime = new Date(this.sf.value.operatingEndTime);
if (operatingStartTime.getTime() > operatingEndTime.getTime()) {
this.service.msgSrv.warning('营业期限不能小于期限开始日期');
return;
}
}
- const validStartTime = new Date(this.sf1.value.legalPersonIdentityDTO.validStartTime);
- if (this.sf1.value.legalPersonIdentityDTO.validEndTime) {
- const validEndTime = new Date(this.sf1.value.legalPersonIdentityDTO.validEndTime);
+ const validStartTime = new Date(this.sf.value.legalPersonIdentityDTO.validStartTime);
+ if (this.sf.value.legalPersonIdentityDTO.validEndTime) {
+ const validEndTime = new Date(this.sf.value.legalPersonIdentityDTO.validEndTime);
if (validStartTime.getTime() > validEndTime.getTime()) {
this.service.msgSrv.warning('法人证件有效截止日期小于开始日期');
return;
@@ -112,10 +98,9 @@ export class AddEtpPartnerComponent implements OnInit {
const params = {};
Object.assign(
params,
- { ...this.sf1.value },
{ ...this.sf.value },
{
- enterpriseAddressCode: this.sf1.value.enterpriseAddressCode[2],
+ enterpriseAddressCode: this.sf.value.enterpriseAddressCode[2],
oftenUsedServices: sfVlaue.oftenUsedServices,
registerAddress: sfVlaue.registerAddress,
registerPhone: sfVlaue.registerPhone,
@@ -161,23 +146,23 @@ export class AddEtpPartnerComponent implements OnInit {
if (isFront === 'front') {
// 正面
if (res.name) {
- this.sf1.setValue('/legalPersonIdentityDTO/name', res.name);
+ this.sf.setValue('/legalPersonIdentityDTO/name', res.name);
}
if (res.number) {
- this.sf1.setValue('/legalPersonIdentityDTO/certificateType', 0);
- this.sf1.setValue('/legalPersonIdentityDTO/certificateNumber', res.number);
+ this.sf.setValue('/legalPersonIdentityDTO/certificateType', 0);
+ this.sf.setValue('/legalPersonIdentityDTO/certificateNumber', res.number);
}
}
if (isFront === 'back') {
// 背面
if (res.validFrom) {
- this.sf1.setValue('/legalPersonIdentityDTO/validStartTime', res.validFrom);
+ this.sf.setValue('/legalPersonIdentityDTO/validStartTime', res.validFrom);
}
if (res.validTo) {
- this.sf1.setValue('/legalPersonIdentityDTO/validEndTime', res.validTo);
- this.sf1.setValue('/legalPersonIdentityDTO/_isLoingDate', false);
+ this.sf.setValue('/legalPersonIdentityDTO/validEndTime', res.validTo);
+ this.sf.setValue('/legalPersonIdentityDTO/_isLoingDate', false);
} else {
- this.sf1.setValue('/legalPersonIdentityDTO/_isLoingDate', true);
+ this.sf.setValue('/legalPersonIdentityDTO/_isLoingDate', true);
}
}
}
@@ -202,36 +187,33 @@ export class AddEtpPartnerComponent implements OnInit {
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);
+ this.sf.setValue('/unifiedSocialCreditCode', res.registrationNumber);
}
if (res.name) {
- this.sf1.setValue('/enterpriseName', res.name);
+ this.sf.setValue('/enterpriseName', res.name);
}
if (res.type) {
- this.sf1.setValue('/enterpriseType', res.type);
+ this.sf.setValue('/enterpriseType', res.type);
}
if (res.addressRegionCodes) {
- this.sf1.setValue('/enterpriseAddressCode', res.addressRegionCodes);
+ this.sf.setValue('/enterpriseAddressCode', res.addressRegionCodes);
}
if (res.address) {
- this.sf1.setValue('/enterpriseAddress', res.address);
- }
- if (res.registeredCapital) {
- this.sf1.setValue('/registrationCapital', res.registeredCapital);
+ this.sf.setValue('/enterpriseAddress', res.address);
}
if (res.foundDate) {
- this.sf1.setValue('/enterpriseRegistrationTime', res.foundDate);
+ this.sf.setValue('/enterpriseRegistrationTime', res.foundDate);
}
if (res.businessTermStartDate) {
- this.sf1.setValue('/operatingStartTime', res.businessTermStartDate);
+ this.sf.setValue('/operatingStartTime', res.businessTermStartDate);
}
if (res.businessTermEndDate) {
- this.sf1.setValue('/operatingEndTime', res.businessTermEndDate);
+ this.sf.setValue('/operatingEndTime', res.businessTermEndDate);
} else {
- this.sf1.setValue('/_isLoingDate', true);
+ this.sf.setValue('/_isLoingDate', true);
}
if (res.businessScope) {
- this.sf1.setValue('/businessScope', res.businessScope);
+ this.sf.setValue('/businessScope', res.businessScope);
}
}
});
@@ -244,8 +226,9 @@ export class AddEtpPartnerComponent implements OnInit {
private initBasicInfoSF(): SFSchema {
return {
properties: {
+ // 企业基本信息
_basicInfoTitle: { title: '', type: 'string', ui: { widget: 'custom' } },
- _licenseTips: { title: '营业执照', type: 'string', ui: { widget: 'custom' } },
+ _licenseTips: { title: '营业执照', type: 'string', ui: { widget: 'custom' }, default: true },
licensePhoto: { title: '', type: 'string', ui: { hidden: true } },
licensePhotoWatermark: {
type: 'string',
@@ -255,7 +238,7 @@ export class AddEtpPartnerComponent implements OnInit {
descriptionI18n: '图片支持jpg、jpeg、png、gif格式,大小不超过5M',
change: args => {
if (args.type === 'success') {
- this.sf1.setValue('/licensePhoto', args.fileList[0].response.data.fullFilePath);
+ this.sf.setValue('/licensePhoto', args.fileList[0].response.data.fullFilePath);
this.checkBusinessLicense(args.fileList[0].response.data.fullFilePath);
}
}
@@ -310,7 +293,7 @@ export class AddEtpPartnerComponent implements OnInit {
required: '请选择截止日期'
},
change: i => {
- this.sf1?.setValue('/_isLoingDate', false);
+ this.sf?.setValue('/_isLoingDate', false);
}
} as SFDateWidgetSchema
},
@@ -320,15 +303,16 @@ export class AddEtpPartnerComponent implements OnInit {
ui: {
class: 'input-back',
widget: 'checkbox',
- change: i => this.sf1?.setValue('/operatingEndTime', null)
+ change: i => this.sf?.setValue('/operatingEndTime', null)
} as SFCheckboxWidgetSchema
},
+ // 法人信息
legalPersonIdentityDTO: {
type: 'object',
properties: {
_legalPersontitle: { title: '', type: 'string', ui: { widget: 'custom' } },
- _certificatePhototips: { title: '法定代表人证件照', type: 'string', ui: { widget: 'custom' } },
+ _certificatePhototips: { title: '法定代表人证件照', type: 'string', ui: { widget: 'custom' }, default: true },
_certificatePhotoExmplateA: { title: '', type: 'string', ui: { widget: 'custom', offsetControl: 6 } },
certificatePhotoFrontWatermark: {
type: 'string',
@@ -338,7 +322,7 @@ export class AddEtpPartnerComponent implements OnInit {
descriptionI18n: '图片支持jpg、jpeg、png、gif格式,大小不超过5M',
change: args => {
if (args.type === 'success') {
- this.sf1.setValue('/legalPersonIdentityDTO/certificatePhotoFront', args.fileList[0].response.data.fullFilePath);
+ this.sf.setValue('/legalPersonIdentityDTO/certificatePhotoFront', args.fileList[0].response.data.fullFilePath);
this.checkIdCard(args.fileList[0].response.data.fullFilePath, 'front', 1);
}
}
@@ -355,7 +339,7 @@ export class AddEtpPartnerComponent implements OnInit {
descriptionI18n: '图片支持jpg、jpeg、png、gif格式,大小不超过5M',
change: args => {
if (args.type === 'success') {
- this.sf1.setValue('/legalPersonIdentityDTO/certificatePhotoBack', args.fileList[0].response.data.fullFilePath);
+ this.sf.setValue('/legalPersonIdentityDTO/certificatePhotoBack', args.fileList[0].response.data.fullFilePath);
this.checkIdCard(args.fileList[0].response.data.fullFilePath, 'back', 1);
}
}
@@ -420,7 +404,7 @@ export class AddEtpPartnerComponent implements OnInit {
required: '请选择截止日期'
},
change: i => {
- this.sf1?.setValue('/legalPersonIdentityDTO/_isLoingDate', false);
+ this.sf?.setValue('/legalPersonIdentityDTO/_isLoingDate', false);
}
} as SFDateWidgetSchema
},
@@ -432,124 +416,177 @@ export class AddEtpPartnerComponent implements OnInit {
grid: { span: 6 },
class: 'input-back',
widget: 'checkbox',
- change: i => this.sf1?.setValue('/legalPersonIdentityDTO/validEndTime', null)
+ change: i => this.sf?.setValue('/legalPersonIdentityDTO/validEndTime', null)
} as SFCheckboxWidgetSchema
}
},
- required: ['certificatePhotoFront', 'certificatePhotoBack', 'name', 'certificateType', 'certificateNumber', 'validStartTime']
- }
- },
- required: [
- 'licensePhotoWatermark',
- 'unifiedSocialCreditCode',
- 'enterpriseName',
- 'enterpriseType',
- 'enterpriseAddressCode',
- 'enterpriseAddress',
- 'registrationCapital',
- 'enterpriseRegistrationTime',
- 'operatingStartTime',
- 'businessScope'
- ]
- };
- }
-
- private initOthersSF(): SFSchema {
- return {
- properties: {
- title99: { title: '', type: 'string', ui: { widget: 'custom' } },
- adminMobile: {
- title: ' 企业管理员手机号',
- type: 'string',
- minLength: 1,
- format: 'mobile',
- maxLength: 11,
- ui: {
- grid: { xxl: 13, xl: 18, lg: 24, md: 24 },
- placeholder: '请输入企业管理员手机号',
- errors: { required: '请输入企业管理员手机号', format: '手机号格式错误' }
- }
+ required: [
+ '_certificatePhototips',
+ 'certificatePhotoFront',
+ 'certificatePhotoBack',
+ 'name',
+ 'certificateType',
+ 'certificateNumber',
+ 'validStartTime'
+ ]
},
- tipsA: {
- title: '企业管理员证件照',
- type: 'string',
- ui: {
- widget: 'custom'
- }
- },
- certificatePhotoFront: { title: '', type: 'string', ui: { hidden: true } },
- certificatePhotoBack: { title: '', type: 'string', ui: { hidden: true } },
- certificatePhotoFrontWatermark: {
- type: 'string',
- title: '',
- ui: {
- ...IMAGECONFIG,
- descriptionI18n: '图片支持jpg、jpeg、png、gif格式,大小不超过5M',
- change: args => {
- if (args.type === 'success') {
- this.sf.setValue('/certificatePhotoFront', args.fileList[0].response.data.fullFilePath);
- this.checkIdCard(args.fileList[0].response.data.fullFilePath, 'front', 0);
+ // 企业管理员信息
+ adminUserInfo: {
+ type: 'object',
+ properties: {
+ _adminTitle: { title: '', type: 'string', ui: { widget: 'custom' } },
+ adminMobile: {
+ title: ' 企业管理员手机号',
+ type: 'string',
+ minLength: 1,
+ format: 'mobile',
+ maxLength: 11,
+ ui: {
+ grid: { xxl: 13, xl: 18, lg: 24, md: 24 },
+ placeholder: '请输入企业管理员手机号',
+ errors: { required: '请输入企业管理员手机号', format: '手机号格式错误' }
}
- }
- } as SFUploadWidgetSchema
- },
- tipsB: {
- title: '',
- type: 'string',
- ui: {
- widget: 'custom',
- offsetControl: 6
- }
- },
- certificatePhotoBackWatermark: {
- type: 'string',
- title: '',
- ui: {
- ...IMAGECONFIG,
- descriptionI18n: '图片支持jpg、jpeg、png、gif格式,大小不超过5M',
- change: args => {
- if (args.type === 'success') {
- this.sf.setValue('/certificatePhotoBack', args.fileList[0].response.data.fullFilePath);
+ },
+ _adminCertificatePhotoTipsA: {
+ title: '企业管理员证件照',
+ type: 'string',
+ ui: {
+ widget: 'custom'
+ },
+ default: true
+ },
+ certificatePhotoFront: { title: '', type: 'string', ui: { hidden: true } },
+ certificatePhotoBack: { title: '', type: 'string', ui: { hidden: true } },
+ certificatePhotoFrontWatermark: {
+ type: 'string',
+ title: '',
+ ui: {
+ ...IMAGECONFIG,
+ descriptionI18n: '图片支持jpg、jpeg、png、gif格式,大小不超过5M',
+ change: args => {
+ if (args.type === 'success') {
+ this.sf.setValue('/certificatePhotoFront', args.fileList[0].response.data.fullFilePath);
+ this.checkIdCard(args.fileList[0].response.data.fullFilePath, 'front', 0);
+ }
+ }
+ } as SFUploadWidgetSchema
+ },
+ _adminCertificatePhotoTipsB: {
+ title: '',
+ type: 'string',
+ ui: {
+ widget: 'custom',
+ offsetControl: 6
}
+ },
+ certificatePhotoBackWatermark: {
+ type: 'string',
+ title: '',
+ ui: {
+ ...IMAGECONFIG,
+ descriptionI18n: '图片支持jpg、jpeg、png、gif格式,大小不超过5M',
+ change: args => {
+ if (args.type === 'success') {
+ this.sf.setValue('/certificatePhotoBack', args.fileList[0].response.data.fullFilePath);
+ }
+ }
+ } as SFUploadWidgetSchema
+ },
+ name: {
+ title: '企业管理员姓名',
+ type: 'string',
+ maxLength: 8,
+ ui: {
+ grid: { xxl: 13, xl: 18, lg: 24, md: 24 },
+ placeholder: '请输入企业管理员姓名'
+ }
+ },
+ certificateNumber: {
+ title: '企业管理员身份证号',
+ type: 'string',
+ format: 'id-card',
+ minLength: 1,
+ maxLength: 18,
+ ui: {
+ grid: { xxl: 13, xl: 18, lg: 24, md: 24 },
+ placeholder: '请输入企业管理员身份证号'
+ }
+ },
+ operatingStartTime: {
+ title: '身份证有效开始日期',
+ type: 'string',
+ ui: {
+ ...DATECONFIG,
+ grid: { xxl: 13, xl: 18, lg: 24, md: 24 },
+ errors: {
+ required: '请选择开始日期'
+ }
+ } as SFDateWidgetSchema
+ },
+ operatingEndTime: {
+ title: '身份证有效截止日期',
+ type: 'string',
+ ui: {
+ ...DATECONFIG,
+ grid: { xxl: 13, xl: 18, lg: 20, md: 18 },
+ errors: {
+ required: '请选择截止日期'
+ },
+ change: i => {
+ this.sf?.setValue('/adminUserInfo/_isLoingDate', false);
+ }
+ } as SFDateWidgetSchema
+ },
+ _isLoingDate: {
+ title: '长期',
+ type: 'boolean',
+ ui: {
+ spanLabelFixed: 100,
+ grid: { span: 6 },
+ class: 'input-back',
+ widget: 'checkbox',
+ change: i => this.sf?.setValue('/adminUserInfo/operatingEndTime', null)
+ } as SFCheckboxWidgetSchema
}
- } as SFUploadWidgetSchema
+ },
+ required: ['_adminCertificatePhotoTipsA', 'adminMobile', 'name', 'certificateNumber','operatingStartTime']
},
- name: {
- title: '企业管理员姓名',
+ // 所属城市
+ _addressTitle: { title: '', type: 'string', ui: { widget: 'custom' } },
+ status3: {
type: 'string',
- maxLength: 8,
- ui: {
- grid: { xxl: 13, xl: 18, lg: 24, md: 24 },
- placeholder: '请输入企业管理员姓名'
- }
- },
- certificateNumber: {
- title: '企业管理员身份证号',
- type: 'string',
- format: 'id-card',
- minLength: 1,
- maxLength: 18,
- ui: {
- grid: { xxl: 13, xl: 18, lg: 24, md: 24 },
- placeholder: '请输入企业管理员身份证号'
- }
- },
-
- title1: { title: '', type: 'string', ui: { widget: 'custom' } },
- createBank: {
title: '所属城市',
- type: 'string',
- ui: { grid: { xxl: 13, xl: 18, lg: 24, md: 24 }, placeholder: '请输入银行账号' }
+ default: ['WAIT_BUYER_PAY', 'TRADE_FINISHED'],
+ ui: {
+ widget: 'tree-select',
+ grid: { xxl: 13, xl: 18, lg: 24, md: 24 },
+ placeholder: '请选择城市(最多3个)',
+ checkable: true,
+ asyncData: () =>
+ of([
+ { title: '待支付', key: 'WAIT_BUYER_PAY' },
+ { title: '已支付', key: 'TRADE_SUCCESS' },
+ { title: '交易完成', key: 'TRADE_FINISHED' }
+ ])
+ } as SFTreeSelectWidgetSchema,
},
-
- title3: { title: '', type: 'string', ui: { widget: 'custom' } },
- bankAccount: {
+ // 渠道销售
+ _channelTitle: { title: '', type: 'string', ui: { widget: 'custom' } },
+ channel: {
title: '渠道销售邀请码',
type: 'string',
- ui: { grid: { xxl: 13, xl: 18, lg: 24, md: 24 }, placeholder: '请输入银行账号' }
+ minLength: 1,
+ maxLength: 100,
+ ui: {
+ grid: { xxl: 13, xl: 18, lg: 24, md: 24 },
+ placeholder: '请输入渠道销售邀请码',
+ errors: {
+ required: '请输入渠道销售邀请码'
+ }
+ }
}
},
- required: ['createBank', 'bankAccount', 'adminMobile', 'name', 'certificateNumber', 'tipsD', 'creditPhoto']
+ required: ['_licenseTips', 'licensePhotoWatermark', 'unifiedSocialCreditCode', 'enterpriseName', 'operatingStartTime', 'status3','channel']
};
}
}
diff --git a/src/app/routes/partner/partner-list/components/add-personal-partner/add-personal-partner.component.html b/src/app/routes/partner/partner-list/components/add-personal-partner/add-personal-partner.component.html
index 8245d202..e476071d 100644
--- a/src/app/routes/partner/partner-list/components/add-personal-partner/add-personal-partner.component.html
+++ b/src/app/routes/partner/partner-list/components/add-personal-partner/add-personal-partner.component.html
@@ -1 +1,44 @@
-
add-personal-partner works!
+
+
+
+
+
+ 合伙人信息
+
+
+
+
+
+
+
+
+
+
+ 所属城市
+
+
+
+
+ 渠道销售
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/app/routes/partner/partner-list/components/add-personal-partner/add-personal-partner.component.less b/src/app/routes/partner/partner-list/components/add-personal-partner/add-personal-partner.component.less
index e69de29b..6b70e074 100644
--- a/src/app/routes/partner/partner-list/components/add-personal-partner/add-personal-partner.component.less
+++ b/src/app/routes/partner/partner-list/components/add-personal-partner/add-personal-partner.component.less
@@ -0,0 +1,68 @@
+:host {
+ ::ng-deep {
+ nz-card {
+
+ .pr {
+ position: relative;
+ }
+
+ .pa {
+ position: absolute;
+ top : 50px;
+ left : 150px;
+ }
+
+ .tips {
+ display : flex;
+ margin-bottom: 0;
+ color : #333;
+
+ dt {
+ width: 150px;
+ }
+
+ dd {
+ width : 190px;
+ margin-bottom: 0;
+ text-align : center;
+ }
+ }
+
+ .form-title {
+ margin-bottom: 10px;
+ padding-left : 8px;
+ color : #333;
+ font-weight : 700;
+ font-size : 18px;
+ line-height : 20px;
+ border-left : solid 3px #1890ff;
+ }
+
+ }
+
+ .ant-form-item {
+ margin-left: 180px;
+ }
+
+ nz-date-picker,
+ nz-input-number {
+ width: 100% !important;
+ }
+
+ .input-back {
+ nz-form-item {
+ margin-left: 0px;
+
+ .ant-form-item-label {
+ flex: 0 !important;
+ }
+
+ .ant-form-item-control {
+ max-width : 100% !important;
+ margin-left: 20px !important;
+ }
+ }
+ }
+
+ }
+ }
\ No newline at end of file
diff --git a/src/app/routes/partner/partner-list/components/add-personal-partner/add-personal-partner.component.ts b/src/app/routes/partner/partner-list/components/add-personal-partner/add-personal-partner.component.ts
index 6d31529c..ed2eac4f 100644
--- a/src/app/routes/partner/partner-list/components/add-personal-partner/add-personal-partner.component.ts
+++ b/src/app/routes/partner/partner-list/components/add-personal-partner/add-personal-partner.component.ts
@@ -1,4 +1,32 @@
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, ViewChild } from '@angular/core';
+import { Router } from '@angular/router';
+import { apiConf } from '@conf/api.conf';
+import { SFUploadWidgetSchema, SFComponent, SFSchema, SFUISchema, SFDateWidgetSchema, SFCheckboxWidgetSchema, SFTreeSelectWidgetSchema } from '@delon/form';
+import { NzUploadFile } from 'ng-zorro-antd/upload';
+import { of } from 'rxjs';
+import { PartnerListService } from '../../services/partner-list.service';
+
+const IMAGECONFIG = {
+ previewFile: (file: NzUploadFile) => of(file.url),
+ action: apiConf.waterFileUpload,
+ fileType: 'image/png,image/jpeg,image/jpg,image/gif',
+ fileSize: 5120,
+ limit: 1,
+ limitFileCount: 1,
+ resReName: 'data.fullFileWatermarkPath',
+ urlReName: 'data.fullFileWatermarkPath',
+ widget: 'upload',
+ name: 'multipartFile',
+ multiple: false,
+ listType: 'picture-card'
+} as SFUploadWidgetSchema;
+
+const DATECONFIG = {
+ grid: { xxl: 13, xl: 18, lg: 24, md: 24 },
+ widget: 'date',
+ format: 'yyyy-MM-dd',
+ placeholder: '请选择'
+};
@Component({
selector: 'app-add-personal-partner',
@@ -6,10 +34,311 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./add-personal-partner.component.less']
})
export class AddPersonalPartnerComponent implements OnInit {
+ @ViewChild('sf', { static: false })
+ sf!: SFComponent;
+ schema: SFSchema = this.initBasicInfoSF();
+ ui: SFUISchema = {
+ '*': {
+ spanLabelFixed: 180,
+ grid: { span: 24 }
+ },
+ $_basicInfoTitle: {
+ spanLabelFixed: 0
+ },
+ $_legalPersontitle: {
+ spanLabelFixed: 0
+ },
+ $_isLoingDate: {
+ spanLabelFixed: 100,
+ grid: { xxl: 6, xl: 6, lg: 4, md: 6 }
+ }
+ };
- constructor() { }
+ constructor(private router: Router, public service: PartnerListService) {}
+ ngOnInit() {}
- ngOnInit(): void {
+ submitForm() {
+ if (!this.sf.valid) {
+ this.sf.validator({ emitError: true });
+ this.service.msgSrv.warning('请修改填写错误信息');
+ return;
+ }
+ const enterpriseRegistrationTime = new Date(this.sf.value.enterpriseRegistrationTime);
+ const operatingStartTime = new Date(this.sf.value.operatingStartTime);
+ if (enterpriseRegistrationTime.getTime() > operatingStartTime.getTime()) {
+ this.service.msgSrv.warning('营业期限不能小于成立日期');
+ return;
+ }
+ if (this.sf.value.operatingEndTime) {
+ const operatingEndTime = new Date(this.sf.value.operatingEndTime);
+ if (operatingStartTime.getTime() > operatingEndTime.getTime()) {
+ this.service.msgSrv.warning('营业期限不能小于期限开始日期');
+ return;
+ }
+ }
+ const validStartTime = new Date(this.sf.value.legalPersonIdentityDTO.validStartTime);
+ if (this.sf.value.legalPersonIdentityDTO.validEndTime) {
+ const validEndTime = new Date(this.sf.value.legalPersonIdentityDTO.validEndTime);
+ if (validStartTime.getTime() > validEndTime.getTime()) {
+ this.service.msgSrv.warning('法人证件有效截止日期小于开始日期');
+ return;
+ }
+ }
+ const sfVlaue = this.sf.value;
+ const params = {};
+ Object.assign(
+ params,
+ { ...this.sf.value },
+ {
+ enterpriseAddressCode: this.sf.value.enterpriseAddressCode[2],
+ oftenUsedServices: sfVlaue.oftenUsedServices,
+ registerAddress: sfVlaue.registerAddress,
+ registerPhone: sfVlaue.registerPhone,
+ creditPhoto: sfVlaue.creditPhoto,
+ creditPhotoWatermark: sfVlaue.creditPhotoWatermark,
+ promotersTelephone: sfVlaue.promotersTelephone,
+ networkTransporter: sfVlaue.networkTransporter,
+ adminUserInfo: {
+ certificateNumber: sfVlaue.certificateNumber,
+ certificatePhotoBack: sfVlaue.certificatePhotoBack,
+ certificatePhotoBackWatermark: sfVlaue.certificatePhotoBackWatermark,
+ certificatePhotoFront: sfVlaue.certificatePhotoFront,
+ certificatePhotoFrontWatermark: sfVlaue.certificatePhotoFrontWatermark,
+ name: sfVlaue.name
+ }
+ }
+ );
+ // this.service.request(this.service.$api_save_enterprise_admin, params).subscribe(res => {
+ // if (res) {
+ // this.service.msgSrv.success('企业新增成功');
+ // this.goBack();
+ // }
+ // });
}
+ /*
+ * 根据地区code查询地区列表
+ */
+ getRegionDetailByCode(regionCode: any) {
+ return this.service.request(this.service.$api_get_region_by_code, { regionCode });
+ }
+
+ // 识别身份证 参数isFront:front-正面、back-背面;type:0-申请人身份证,1-法定代表人身份证
+ checkIdCard(imgurl: any, isFront: string, type: number) {
+ const params = {
+ idCardUrl: imgurl,
+ side: isFront
+ };
+ 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.sf.setValue('/legalPersonIdentityDTO/name', res.name);
+ }
+ if (res.number) {
+ this.sf.setValue('/legalPersonIdentityDTO/certificateType', 0);
+ this.sf.setValue('/legalPersonIdentityDTO/certificateNumber', res.number);
+ }
+ }
+ if (isFront === 'back') {
+ // 背面
+ if (res.validFrom) {
+ this.sf.setValue('/legalPersonIdentityDTO/validStartTime', res.validFrom);
+ }
+ if (res.validTo) {
+ this.sf.setValue('/legalPersonIdentityDTO/validEndTime', res.validTo);
+ this.sf.setValue('/legalPersonIdentityDTO/_isLoingDate', false);
+ } else {
+ this.sf.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);
+ }
+ }
+ }
+ }
+ });
+ }
+
+ goBack() {
+ window.history.go(-1);
+ }
+
+ private initBasicInfoSF(): SFSchema {
+ return {
+ properties: {
+ // 合伙人信息
+ adminUserInfo: {
+ type: 'object',
+ properties: {
+ _adminTitle: { title: '', type: 'string', ui: { widget: 'custom' } },
+ adminMobile: {
+ title: ' 手机号',
+ type: 'string',
+ minLength: 1,
+ format: 'mobile',
+ maxLength: 11,
+ ui: {
+ grid: { xxl: 13, xl: 18, lg: 24, md: 24 },
+ placeholder: '请输入手机号',
+ errors: { required: '请输入手机号', format: '手机号格式错误' }
+ }
+ },
+ _adminCertificatePhotoTipsA: {
+ title: '证件照',
+ type: 'string',
+ ui: {
+ widget: 'custom'
+ },
+ default: true
+ },
+ certificatePhotoFront: { title: '', type: 'string', ui: { hidden: true } },
+ certificatePhotoBack: { title: '', type: 'string', ui: { hidden: true } },
+ certificatePhotoFrontWatermark: {
+ type: 'string',
+ title: '',
+ ui: {
+ ...IMAGECONFIG,
+ descriptionI18n: '图片支持jpg、jpeg、png、gif格式,大小不超过5M',
+ change: args => {
+ if (args.type === 'success') {
+ this.sf.setValue('/certificatePhotoFront', args.fileList[0].response.data.fullFilePath);
+ this.checkIdCard(args.fileList[0].response.data.fullFilePath, 'front', 0);
+ }
+ }
+ } as SFUploadWidgetSchema
+ },
+ _adminCertificatePhotoTipsB: {
+ title: '',
+ type: 'string',
+ ui: {
+ widget: 'custom',
+ offsetControl: 6
+ }
+ },
+ certificatePhotoBackWatermark: {
+ type: 'string',
+ title: '',
+ ui: {
+ ...IMAGECONFIG,
+ descriptionI18n: '图片支持jpg、jpeg、png、gif格式,大小不超过5M',
+ change: args => {
+ if (args.type === 'success') {
+ this.sf.setValue('/certificatePhotoBack', args.fileList[0].response.data.fullFilePath);
+ }
+ }
+ } as SFUploadWidgetSchema
+ },
+ name: {
+ title: '姓名',
+ type: 'string',
+ maxLength: 8,
+ ui: {
+ grid: { xxl: 13, xl: 18, lg: 24, md: 24 },
+ placeholder: '请输入姓名'
+ }
+ },
+ certificateNumber: {
+ title: '身份证号',
+ type: 'string',
+ format: 'id-card',
+ minLength: 1,
+ maxLength: 18,
+ ui: {
+ grid: { xxl: 13, xl: 18, lg: 24, md: 24 },
+ placeholder: '请输入身份证号'
+ }
+ },
+ operatingStartTime: {
+ title: '身份证有效开始日期',
+ type: 'string',
+ ui: {
+ ...DATECONFIG,
+ grid: { xxl: 13, xl: 18, lg: 24, md: 24 },
+ errors: {
+ required: '请选择开始日期'
+ }
+ } as SFDateWidgetSchema
+ },
+ operatingEndTime: {
+ title: '身份证有效截止日期',
+ type: 'string',
+ ui: {
+ ...DATECONFIG,
+ grid: { xxl: 13, xl: 18, lg: 20, md: 18 },
+ errors: {
+ required: '请选择截止日期'
+ },
+ change: i => {
+ this.sf?.setValue('/adminUserInfo/_isLoingDate', false);
+ }
+ } as SFDateWidgetSchema
+ },
+ _isLoingDate: {
+ title: '长期',
+ type: 'boolean',
+ ui: {
+ spanLabelFixed: 100,
+ grid: { span: 6 },
+ class: 'input-back',
+ widget: 'checkbox',
+ change: i => this.sf?.setValue('/adminUserInfo/operatingEndTime', null)
+ } as SFCheckboxWidgetSchema
+ }
+ },
+ required: ['_adminCertificatePhotoTipsA', 'adminMobile', 'name', 'certificateNumber', 'operatingStartTime']
+ },
+ // 所属城市
+ _addressTitle: { title: '', type: 'string', ui: { widget: 'custom' } },
+ status3: {
+ type: 'string',
+ title: '所属城市',
+ default: ['WAIT_BUYER_PAY', 'TRADE_FINISHED'],
+ ui: {
+ widget: 'tree-select',
+ grid: { xxl: 13, xl: 18, lg: 24, md: 24 },
+ placeholder: '请选择城市(最多3个)',
+ checkable: true,
+ asyncData: () =>
+ of([
+ { title: '待支付', key: 'WAIT_BUYER_PAY' },
+ { title: '已支付', key: 'TRADE_SUCCESS' },
+ { title: '交易完成', key: 'TRADE_FINISHED' }
+ ])
+ } as SFTreeSelectWidgetSchema
+ },
+ // 渠道销售
+ _channelTitle: { title: '', type: 'string', ui: { widget: 'custom' } },
+ channel: {
+ title: '渠道销售邀请码',
+ type: 'string',
+ minLength: 1,
+ maxLength: 100,
+ ui: {
+ grid: { xxl: 13, xl: 18, lg: 24, md: 24 },
+ placeholder: '请输入渠道销售邀请码',
+ errors: {
+ required: '请输入渠道销售邀请码'
+ }
+ }
+ }
+ },
+ required: [
+ 'status3',
+ 'channel'
+ ]
+ };
+ }
}