This commit is contained in:
Taric Xin
2021-12-08 20:59:28 +08:00
parent 429c212255
commit b074f72593
6 changed files with 105 additions and 54 deletions

View File

@ -34,19 +34,19 @@
</div>
<div nz-col [nzXl]="6" [nzLg]="24" [nzSm]="24" [nzXs]="24" class="text-right mt-sm">
<button [nzLoading]="service.http.loading" nz-button nzDanger nz-popconfirm [nzPopconfirmTitle]="enable"
(nzOnConfirm)="freezeOrResume(0)" nzPopconfirmPlacement="bottomRight" *ngIf="detailData?.stateLocked === 1">
(nzOnConfirm)="freezeOrResume(1)" nzPopconfirmPlacement="bottomRight" *ngIf="detailData?.stateLocked === 1">
启用
</button>
<button [nzLoading]="service.http.loading" nz-button nzDanger nz-popconfirm [nzPopconfirmTitle]="frozen"
(nzOnConfirm)="freezeOrResume(1)" nzPopconfirmPlacement="bottomRight" *ngIf="detailData?.stateLocked === 0">
(nzOnConfirm)="freezeOrResume(0)" nzPopconfirmPlacement="bottomRight" *ngIf="detailData?.stateLocked === 0">
冻结
</button>
<button [nzLoading]="service.http.loading" nz-button nzDanger nz-popconfirm [nzPopconfirmTitle]="Payfrozen"
(nzOnConfirm)="PayOrResume(0)" nzPopconfirmPlacement="bottomRight" *ngIf="detailData?.createPay === 0">
(nzOnConfirm)="PayOrResume(0)" nzPopconfirmPlacement="bottomRight" *ngIf="detailData?.createPay === 1">
开通支付权限
</button>
<button [nzLoading]="service.http.loading" nz-button nzDanger nz-popconfirm [nzPopconfirmTitle]="Payenable"
(nzOnConfirm)="PayOrResume(1)" nzPopconfirmPlacement="bottomRight" *ngIf="detailData?.createPay === 1">
(nzOnConfirm)="PayOrResume(1)" nzPopconfirmPlacement="bottomRight" *ngIf="detailData?.createPay === 0">
关闭支付权限
</button>
</div>

View File

@ -108,45 +108,41 @@ export class FreightComponentsListDetailComponent implements OnInit {
* 冻结
*/
freezeOrResume(type: number) {
console.log(type);
// this.service.http
// .post(this.service.$api_set_freezeOrResume, {
// tenantId: this.route.snapshot.params.id,
// // tenantId: this.route.snapshot.queryParams.tenantId,
// status: type,
// })
// .subscribe((res) => {
// if (res.data === true) {
// if (type === 0) {
// this.service.msgSrv.success(`启用成功!`);
// } else if (type === 1) {
// this.service.msgSrv.success(`冻结成功!`);
// }
// this.ngOnInit();
// } else {
// this.service.msgSrv.error(res.msg || '操作失败!');
// }
// });
this.service.http
.post(this.service.$api_lock_freight, {
id: this.route.snapshot.params.id,
statedLocked: !!type
})
.subscribe(res => {
if (res.data === true) {
if (type === 1) {
this.service.msgSrv.success(`启用成功!`);
} else {
this.service.msgSrv.success(`冻结成功!`);
}
this.initData();
} else {
this.service.msgSrv.error(res.msg || '操作失败!');
}
});
}
PayOrResume(type: number) {
console.log(type);
// this.service.http
// .post(this.service.$api_set_freezeOrResume, {
// tenantId: this.route.snapshot.params.id,
// // tenantId: this.route.snapshot.queryParams.tenantId,
// status: type,
// })
// .subscribe((res) => {
// if (res.data === true) {
// if (type === 0) {
// this.service.msgSrv.success(`启用成功!`);
// } else if (type === 1) {
// this.service.msgSrv.success(`冻结成功!`);
// }
// this.ngOnInit();
// } else {
// this.service.msgSrv.error(res.msg || '操作失败!');
// }
// });
this.service.http
.post(this.service.$api_lock_freight, {
id: this.route.snapshot.params.id,
statedLocked: !!type
})
.subscribe(res => {
if (res.data === true) {
if (type === 1) {
this.service.msgSrv.success(`开启成功!`);
} else {
this.service.msgSrv.success(`关闭成功!`);
}
this.initData();
} else {
this.service.msgSrv.error(res.msg || '操作失败!');
}
});
}
}

View File

@ -12,12 +12,12 @@
<!-- 搜索区 -->
<!-- 搜索表单 -->
<div nz-row nzGutter="8">
<div nz-col [nzXl]="_$expand ? 24 : 18" [nzLg]="24" [nzSm]="24" [nzXs]="24">
<div nz-col [nzXl]="_$expand ? 24 : 16" [nzLg]="24" [nzSm]="24" [nzXs]="24">
<sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
</div>
<div nz-col [nzXl]="_$expand ? 24 : 6" [nzLg]="24" [nzSm]="24" [nzXs]="24" class="text-right">
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="creat()"></button>
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="st?.load(1)">导出</button>
<div nz-col [nzXl]="_$expand ? 24 : 8" [nzLg]="24" [nzSm]="24" [nzXs]="24" class="text-right">
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="creat()">增企业</button>
<button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="exportList()">导出</button>
<button nz-button nzType="primary" [disabled]="!sf.valid" [nzLoading]="service.http.loading"
(click)="st?.load(1)">查询</button>
<button nz-button (click)="resetSF()">重置</button>
@ -46,11 +46,21 @@
</div>
</ng-template>
<ng-template st-row="promotersTelephone" let-item let-index="index">
<a (click)="daoyun(item)">{{ item.promotersTelephone }}</a>
<a (click)="addPromoter(item)">{{ item.promotersTelephone || '添加' }}</a>
</ng-template>
<ng-template st-row="stateCol" let-item let-index="index">
<nz-tag *ngIf="item.stateLocked" nzColor="error">冻结</nz-tag>
<nz-tag *elseBlock nzColor="success">正常</nz-tag>
</ng-template>
</st>
</nz-card>
</nz-card>
<ng-template #promoterModal>
<div nz-row nzGutter="8">
<div nz-col nzSpan="24" se-container [labelWidth]="80">
<se [col]="1" label="手机号">
<input nz-input [(ngModel)]="promotersTelephone" />
</se>
</div>
</div>
</ng-template>

View File

@ -16,7 +16,10 @@ export class FreightComponentsListComponent implements OnInit {
columns!: STColumn[];
@ViewChild('st', { static: false }) st!: STComponent;
@ViewChild('sf', { static: false }) sf!: SFComponent;
@ViewChild('promoterModal', { static: false })
promoterModal!: any;
promotersTelephone = '';
constructor(public service: UsermanageService, private modal: NzModalService, private router: Router, private ar: ActivatedRoute) {}
/**
@ -36,10 +39,6 @@ export class FreightComponentsListComponent implements OnInit {
return params;
}
get selectedRows() {
return this.st?.list.filter(item => item.checked) || [];
}
ngOnInit() {
this.initSF();
this.initST();
@ -189,6 +188,30 @@ export class FreightComponentsListComponent implements OnInit {
daoyun(item: any) {
this.router.navigate(['./view', item.tenantId], { relativeTo: this.ar });
}
addPromoter(item?: any) {
this.promotersTelephone = item?.promotersTelephone;
const modal = this.modal.create({
nzTitle: '推广业务员',
nzContent: this.promoterModal,
nzOnOk: () => {
if (!!!this.promotersTelephone) {
return false;
}
if (typeof this.promotersTelephone === 'string' && !/(^1\d{10}$)/.test(this.promotersTelephone)) {
return false;
}
this.service.request(this.service.$api_add_salesman, { ids: [item.id], salesmanMobile: this.promotersTelephone }).subscribe(res => {
if (res) {
this.service.msgSrv.success(item?.promotersTelephone ? '添加推广员成功' : '修改推广员成功');
}
this.st.load();
});
return;
}
});
}
expandToggle() {
this._$expand = !this._$expand;
this.sf?.setValue('/expand', this._$expand);
@ -196,11 +219,24 @@ export class FreightComponentsListComponent implements OnInit {
creat() {
this.router.navigate(['./new'], { relativeTo: this.ar });
}
exportList() {
const params = this.reqParams;
this.service
.request(this.service.$api_export_freight_list, { ...params, pageSize: this.st.ps, pageIndex: this.st.pi })
.subscribe(res => {
if (res) {
this.service.msgSrv.success('导出成功');
}
});
}
/**
* 重置表单
*/
resetSF() {
this.sf.reset();
this._$expand = false;
this.st.reload();
}
}

View File

@ -1,9 +1,9 @@
<page-header-wrapper [title]="'企业认证'"></page-header-wrapper>
<page-header-wrapper [title]="'新增企业'"></page-header-wrapper>
<nz-card>
<ng-container>
<sf #sf1 [compact]="true" [ui]="ui" [schema]="schema1" [button]="'none'" [formData]="infoData1">
<ng-template sf-template="title1" let-me let-ui="ui" let-schema="schema">
<div class="form-title">营业执照基本信息</div>
<div class="form-title">企业基本信息</div>
</ng-template>
<ng-template sf-template="title2" let-me let-ui="ui" let-schema="schema">
<div class="form-title" style="margin-top: 40px">营业执照法人信息</div>

View File

@ -19,9 +19,18 @@ export class UsermanageService extends BaseService {
// 查询企业列表
$api_get_freight_list = '/api/mdc/cuc/enterpriseInfo/operate/list/page';
// 导出企业列表
$api_export_freight_list = '/api/mdc/cuc/enterpriseInfo/operate/export';
// 查询企业详情
$api_get_freight_detail = '/api/mdc/cuc/enterpriseInfo/operate/detail';
// 添加企业业务员
$api_add_salesman = '/api/mdc/cuc/enterpriseInfo/operate/addSalesman';
// 冻结/启用企业业
$api_lock_freight = '/api/mdc/cuc/enterpriseInfo/operate/lock';
constructor(public injector: Injector) {
super(injector);
}