From c799096f1bc2aedd6a0b8b6b128a0f6c735dfa98 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Thu, 31 Mar 2022 09:21:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E5=9B=A2=E6=B2=B9?= =?UTF-8?q?=E4=BB=A3=E7=90=86=E5=95=86=E3=80=81=E4=B8=9A=E5=8A=A1=E5=91=98?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/admin/system/menu/menu.component.html | 2 +- .../system-role-show.component.html | 2 +- .../petrol-station-manage.component.html | 1 + .../petrol-station-manage.component.scss | 0 .../petrol-station-manage.component.spec.ts | 25 +++ .../petrol-station-manage.component.ts | 15 ++ .../tuanyou-agent-routing.module.ts | 19 +++ .../tuanyou-agent/tuanyou-agent.module.ts | 27 ++++ .../ty-agent-edit.component.html | 58 +++++++ .../ty-agent-edit.component.scss | 7 + .../ty-agent-edit.component.spec.ts | 25 +++ .../ty-agent-edit/ty-agent-edit.component.ts | 110 +++++++++++++ .../ty-agent-list.component.html | 99 ++++++++++++ .../ty-agent-list.component.scss | 3 + .../ty-agent-list.component.spec.ts | 25 +++ .../ty-agent-list/ty-agent-list.component.ts | 130 +++++++++++++++ .../ty-salesman-edit.component.html | 40 +++++ .../ty-salesman-edit.component.scss | 7 + .../ty-salesman-edit.component.spec.ts | 25 +++ .../ty-salesman-edit.component.ts | 108 +++++++++++++ .../ty-salesman-list.component.html | 79 ++++++++++ .../ty-salesman-list.component.scss | 3 + .../ty-salesman-list.component.spec.ts | 25 +++ .../ty-salesman-list.component.ts | 148 ++++++++++++++++++ src/app/app-routing.module.ts | 5 + src/app/services/ty-agent.service.ts | 82 ++++++++++ src/app/services/ty-salesman.service.ts | 83 ++++++++++ src/environments/environment.ts | 4 +- 28 files changed, 1153 insertions(+), 4 deletions(-) create mode 100644 src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.html create mode 100644 src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.scss create mode 100644 src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.spec.ts create mode 100644 src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.ts create mode 100644 src/app/admin/tuanyou-agent/tuanyou-agent-routing.module.ts create mode 100644 src/app/admin/tuanyou-agent/tuanyou-agent.module.ts create mode 100644 src/app/admin/tuanyou-agent/ty-agent/ty-agent-edit/ty-agent-edit.component.html create mode 100644 src/app/admin/tuanyou-agent/ty-agent/ty-agent-edit/ty-agent-edit.component.scss create mode 100644 src/app/admin/tuanyou-agent/ty-agent/ty-agent-edit/ty-agent-edit.component.spec.ts create mode 100644 src/app/admin/tuanyou-agent/ty-agent/ty-agent-edit/ty-agent-edit.component.ts create mode 100644 src/app/admin/tuanyou-agent/ty-agent/ty-agent-list/ty-agent-list.component.html create mode 100644 src/app/admin/tuanyou-agent/ty-agent/ty-agent-list/ty-agent-list.component.scss create mode 100644 src/app/admin/tuanyou-agent/ty-agent/ty-agent-list/ty-agent-list.component.spec.ts create mode 100644 src/app/admin/tuanyou-agent/ty-agent/ty-agent-list/ty-agent-list.component.ts create mode 100644 src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-edit/ty-salesman-edit.component.html create mode 100644 src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-edit/ty-salesman-edit.component.scss create mode 100644 src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-edit/ty-salesman-edit.component.spec.ts create mode 100644 src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-edit/ty-salesman-edit.component.ts create mode 100644 src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-list/ty-salesman-list.component.html create mode 100644 src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-list/ty-salesman-list.component.scss create mode 100644 src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-list/ty-salesman-list.component.spec.ts create mode 100644 src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-list/ty-salesman-list.component.ts create mode 100644 src/app/services/ty-agent.service.ts create mode 100644 src/app/services/ty-salesman.service.ts diff --git a/src/app/admin/system/menu/menu.component.html b/src/app/admin/system/menu/menu.component.html index 828d89a..56259bf 100644 --- a/src/app/admin/system/menu/menu.component.html +++ b/src/app/admin/system/menu/menu.component.html @@ -1,4 +1,4 @@ - + diff --git a/src/app/admin/system/system-role-show/system-role-show.component.html b/src/app/admin/system/system-role-show/system-role-show.component.html index 5f4e315..6b10dbd 100644 --- a/src/app/admin/system/system-role-show/system-role-show.component.html +++ b/src/app/admin/system/system-role-show/system-role-show.component.html @@ -1,4 +1,4 @@ - + diff --git a/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.html b/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.html new file mode 100644 index 0000000..138496a --- /dev/null +++ b/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.html @@ -0,0 +1 @@ +

petrol-station-manage works!

diff --git a/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.scss b/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.spec.ts b/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.spec.ts new file mode 100644 index 0000000..527d49a --- /dev/null +++ b/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PetrolStationManageComponent } from './petrol-station-manage.component'; + +describe('PetrolStationManageComponent', () => { + let component: PetrolStationManageComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ PetrolStationManageComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PetrolStationManageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.ts b/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.ts new file mode 100644 index 0000000..aa3af4b --- /dev/null +++ b/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-petrol-station-manage', + templateUrl: './petrol-station-manage.component.html', + styleUrls: ['./petrol-station-manage.component.scss'] +}) +export class PetrolStationManageComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/admin/tuanyou-agent/tuanyou-agent-routing.module.ts b/src/app/admin/tuanyou-agent/tuanyou-agent-routing.module.ts new file mode 100644 index 0000000..3fb190c --- /dev/null +++ b/src/app/admin/tuanyou-agent/tuanyou-agent-routing.module.ts @@ -0,0 +1,19 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import {TyAgentListComponent} from './ty-agent/ty-agent-list/ty-agent-list.component'; +import {TyAgentEditComponent} from './ty-agent/ty-agent-edit/ty-agent-edit.component'; +import {TySalesmanListComponent} from './ty-salesman/ty-salesman-list/ty-salesman-list.component'; +import {TySalesmanEditComponent} from './ty-salesman/ty-salesman-edit/ty-salesman-edit.component'; + +const routes: Routes = [ + { path: 'agent-edit', component: TyAgentEditComponent }, + { path: 'agent-list', component: TyAgentListComponent }, + { path: 'salesman-list', component: TySalesmanListComponent }, + { path: 'salesman-edit', component: TySalesmanEditComponent }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class TuanyouAgentRoutingModule { } diff --git a/src/app/admin/tuanyou-agent/tuanyou-agent.module.ts b/src/app/admin/tuanyou-agent/tuanyou-agent.module.ts new file mode 100644 index 0000000..e31d124 --- /dev/null +++ b/src/app/admin/tuanyou-agent/tuanyou-agent.module.ts @@ -0,0 +1,27 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { TuanyouAgentRoutingModule } from './tuanyou-agent-routing.module'; +import { PetrolStationManageComponent } from './petrol-station-manage/petrol-station-manage.component'; +import {NgZorroAntdModule} from 'ng-zorro-antd'; +import {FormsModule, ReactiveFormsModule} from '@angular/forms'; +import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; +import { TyAgentEditComponent } from './ty-agent/ty-agent-edit/ty-agent-edit.component'; +import {TyAgentListComponent} from './ty-agent/ty-agent-list/ty-agent-list.component'; +import {AppCommonModule} from '../../app-common.module'; +import { TySalesmanListComponent } from './ty-salesman/ty-salesman-list/ty-salesman-list.component'; +import { TySalesmanEditComponent } from './ty-salesman/ty-salesman-edit/ty-salesman-edit.component'; + +@NgModule({ + declarations: [PetrolStationManageComponent, TyAgentListComponent, TyAgentEditComponent, TySalesmanListComponent, TySalesmanEditComponent], + imports: [ + CommonModule, + TuanyouAgentRoutingModule, + NgZorroAntdModule, + ReactiveFormsModule, + FormsModule, + BreadcrumbModule, + AppCommonModule, + ] +}) +export class TuanyouAgentModule { } diff --git a/src/app/admin/tuanyou-agent/ty-agent/ty-agent-edit/ty-agent-edit.component.html b/src/app/admin/tuanyou-agent/ty-agent/ty-agent-edit/ty-agent-edit.component.html new file mode 100644 index 0000000..a035ae9 --- /dev/null +++ b/src/app/admin/tuanyou-agent/ty-agent/ty-agent-edit/ty-agent-edit.component.html @@ -0,0 +1,58 @@ + + + + 代理商 + + + 编辑 + + + +
+
+
+
+
+ + 代理商名称 + + + + +
+ +
+ + 联系人 + + + + +
+ +
+ + 联系电话 + + + + +
+ +
+ + 所在地址 + + + + +
+ +
+ +
+ +
+
+
+
diff --git a/src/app/admin/tuanyou-agent/ty-agent/ty-agent-edit/ty-agent-edit.component.scss b/src/app/admin/tuanyou-agent/ty-agent/ty-agent-edit/ty-agent-edit.component.scss new file mode 100644 index 0000000..1be0cf8 --- /dev/null +++ b/src/app/admin/tuanyou-agent/ty-agent/ty-agent-edit/ty-agent-edit.component.scss @@ -0,0 +1,7 @@ +.btn-div { + width: 100%; + text-align: center; +} +.btn-post { + width: 25%; +} diff --git a/src/app/admin/tuanyou-agent/ty-agent/ty-agent-edit/ty-agent-edit.component.spec.ts b/src/app/admin/tuanyou-agent/ty-agent/ty-agent-edit/ty-agent-edit.component.spec.ts new file mode 100644 index 0000000..19d7929 --- /dev/null +++ b/src/app/admin/tuanyou-agent/ty-agent/ty-agent-edit/ty-agent-edit.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TyAgentEditComponent } from './ty-agent-edit.component'; + +describe('TyAgentEditComponent', () => { + let component: TyAgentEditComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ TyAgentEditComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TyAgentEditComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/tuanyou-agent/ty-agent/ty-agent-edit/ty-agent-edit.component.ts b/src/app/admin/tuanyou-agent/ty-agent/ty-agent-edit/ty-agent-edit.component.ts new file mode 100644 index 0000000..c4596d3 --- /dev/null +++ b/src/app/admin/tuanyou-agent/ty-agent/ty-agent-edit/ty-agent-edit.component.ts @@ -0,0 +1,110 @@ +import { Component, OnInit } from '@angular/core'; +import {FormBuilder, FormGroup, Validators} from '@angular/forms'; +import {NzModalService} from 'ng-zorro-antd'; +import {AgentService} from '../../../../services/agent.service'; +import {ActivatedRoute, Router} from '@angular/router'; +import {ValidatorsService} from '../../../../services/validators.service'; +import {TyAgentService} from "../../../../services/ty-agent.service"; + +@Component({ + selector: 'app-ty-agent-edit', + templateUrl: './ty-agent-edit.component.html', + styleUrls: ['./ty-agent-edit.component.scss'] +}) +export class TyAgentEditComponent implements OnInit { + + agentForm: FormGroup; + btnLoading = false; + + constructor(private form: FormBuilder, + private modal: NzModalService, + private tyAgentService: TyAgentService, + private activatedRoute: ActivatedRoute, + private router: Router) { } + + ngOnInit(): void { + this.activatedRoute.queryParams.subscribe(queryParams => { + if (queryParams['agentKey'] != null) { + this.getDetail(queryParams['agentKey']); + } + }); + this.agentForm = this.form.group({ + id: [null], + agentName: [null, [Validators.required]], + agentUser: [null, [Validators.required]], + agentPhone: [null, [Validators.required]], + agentAddress: [null], + }); + } + + /** + * 查询详情 + * @param agentKey 代理商编号 + */ + getDetail(agentKey: string) { + this.tyAgentService.getDetailByKey(agentKey, data => { + if (data['return_code'] === '000000') { + this.agentForm.patchValue(data['return_data']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + }); + } + + /** + * 提交 + */ + submitFrom() { + this.btnLoading = true; + for (const i in this.agentForm.controls) { + this.agentForm.controls[i].markAsDirty(); + this.agentForm.controls[i].updateValueAndValidity(); + } + if (this.agentForm.status == null || this.agentForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请规范填写所有的必填项信息', + }); + return; + } + + if (this.agentForm.value.id == null) { + this.tyAgentService.addAgent(this.agentForm.value, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '添加成功', + nzOnOk: () => this.router.navigateByUrl('admin/tuanyou-agent/agent-list') + }); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + this.btnLoading = false; + }); + } else { + this.tyAgentService.updateAgent(this.agentForm.value, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '修改成功', + nzOnOk: () => this.router.navigateByUrl('admin/tuanyou-agent/agent-list') + }); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + this.btnLoading = false; + }); + } + + + } +} diff --git a/src/app/admin/tuanyou-agent/ty-agent/ty-agent-list/ty-agent-list.component.html b/src/app/admin/tuanyou-agent/ty-agent/ty-agent-list/ty-agent-list.component.html new file mode 100644 index 0000000..b5e0eca --- /dev/null +++ b/src/app/admin/tuanyou-agent/ty-agent/ty-agent-list/ty-agent-list.component.html @@ -0,0 +1,99 @@ + + + + + +
+
+
+
+ + 代理商编号 + + + + +
+
+ + 代理商名称 + + + + +
+
+ + 联系人 + + + + +
+
+ + 联系电话 + + + + +
+
+ +
+
+ + +
+
+
+
+ +
+ 共计 {{dataObject.total?dataObject.total:0}} 条数据 +
+ +
+ + + + + + 代理商编号 + 代理商名称 + 联系人 + 联系电话 + 代理商地址 + 创建时间 + 操作 + + + + + {{data.agentKey}} + {{data.agentName}} + {{data.agentUser}} + {{data.agentPhone}} + {{data.agentAddress?data.agentAddress:'未填写'}} + {{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} + + 操作列表 + + + + + + + +
diff --git a/src/app/admin/tuanyou-agent/ty-agent/ty-agent-list/ty-agent-list.component.scss b/src/app/admin/tuanyou-agent/ty-agent/ty-agent-list/ty-agent-list.component.scss new file mode 100644 index 0000000..690993b --- /dev/null +++ b/src/app/admin/tuanyou-agent/ty-agent/ty-agent-list/ty-agent-list.component.scss @@ -0,0 +1,3 @@ +.table-td-operation a { + padding: 0px 5px; +} diff --git a/src/app/admin/tuanyou-agent/ty-agent/ty-agent-list/ty-agent-list.component.spec.ts b/src/app/admin/tuanyou-agent/ty-agent/ty-agent-list/ty-agent-list.component.spec.ts new file mode 100644 index 0000000..4df5e76 --- /dev/null +++ b/src/app/admin/tuanyou-agent/ty-agent/ty-agent-list/ty-agent-list.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TyAgentListComponent } from './ty-agent-list.component'; + +describe('TyAgentListComponent', () => { + let component: TyAgentListComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ TyAgentListComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TyAgentListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/tuanyou-agent/ty-agent/ty-agent-list/ty-agent-list.component.ts b/src/app/admin/tuanyou-agent/ty-agent/ty-agent-list/ty-agent-list.component.ts new file mode 100644 index 0000000..507bd3c --- /dev/null +++ b/src/app/admin/tuanyou-agent/ty-agent/ty-agent-list/ty-agent-list.component.ts @@ -0,0 +1,130 @@ +import { Component, OnInit } from '@angular/core'; +import {FormBuilder, FormGroup} from '_@angular_forms@9.0.7@@angular/forms'; +import {NzMessageService, NzModalService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; +import {TyAgentService} from '../../../../services/ty-agent.service'; + +@Component({ + selector: 'app-ty-agent-list', + templateUrl: './ty-agent-list.component.html', + styleUrls: ['./ty-agent-list.component.scss'] +}) +export class TyAgentListComponent implements OnInit { + + dataObject: any = {}; + tableLoading = true; + searchForm: FormGroup; + pageNum: number; + whereObject: any = {}; + + constructor(private modal: NzModalService, + private message: NzMessageService, + private tyAgentService: TyAgentService, + private form: FormBuilder) { } + + ngOnInit(): void { + this.searchForm = this.form.group({ + agentKey: [null], + agentName: [null], + agentUser: [null], + agentPhone: [null], + }); + this.requestData(1); + } + + /** + * 请求数据 + */ + requestData(pageNum) { + this.tableLoading = true; + this.whereObject['pageNum'] = pageNum; + this.whereObject['pageSize'] = 10; + this.tyAgentService.getAgentList(this.whereObject, data => { + if (data['return_code'] === '000000') { + this.dataObject = data['return_data']; + } else { + this.modal.error(data['return_msg']); + } + this.tableLoading = false; + }); + } + + /** + * 搜索 + * @param whereObject 条件 + */ + search(whereObject: object) { + this.whereObject = whereObject; + this.requestData(1); + } + + /** + * 重置 + */ + resetForm(): void { + this.searchForm.reset(); + } + /** + * 弹出密码重置对话框 + */ + showPwdResetConfirm(key: string): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否重置代理商密码!', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'danger', + nzOnOk: () => this.pwdReset(key) + }); + } + + /** + * 密码重置 + * + */ + pwdReset(key: string) { + this.tyAgentService.agentPwdReset({ agentKey : key}, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '重置成功!密码为:123456' + }); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'] + }); + } + }); + } + + /** + * 弹出删除对话框 + */ + showDeleteConfirm(key: string): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否删除该代理商', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'danger', + nzOnOk: () => this.deleteData(key) + }); + } + + /** + * 删除数据 + * + */ + deleteData(key: string) { + this.tyAgentService.delAgent({ agentKey: key}, data => { + if (data['return_code'] === '000000') { + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'] + }); + } + }); + } +} diff --git a/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-edit/ty-salesman-edit.component.html b/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-edit/ty-salesman-edit.component.html new file mode 100644 index 0000000..eff8683 --- /dev/null +++ b/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-edit/ty-salesman-edit.component.html @@ -0,0 +1,40 @@ + + + + 代理商 + + + 编辑 + + + +
+
+
+
+
+ + 业务员名称 + + + + +
+ +
+ + 联系电话 + + + + +
+ +
+ +
+ +
+
+
+
diff --git a/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-edit/ty-salesman-edit.component.scss b/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-edit/ty-salesman-edit.component.scss new file mode 100644 index 0000000..1be0cf8 --- /dev/null +++ b/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-edit/ty-salesman-edit.component.scss @@ -0,0 +1,7 @@ +.btn-div { + width: 100%; + text-align: center; +} +.btn-post { + width: 25%; +} diff --git a/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-edit/ty-salesman-edit.component.spec.ts b/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-edit/ty-salesman-edit.component.spec.ts new file mode 100644 index 0000000..453da4b --- /dev/null +++ b/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-edit/ty-salesman-edit.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TySalesmanEditComponent } from './ty-salesman-edit.component'; + +describe('TySalesmanEditComponent', () => { + let component: TySalesmanEditComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ TySalesmanEditComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TySalesmanEditComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-edit/ty-salesman-edit.component.ts b/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-edit/ty-salesman-edit.component.ts new file mode 100644 index 0000000..86e99fe --- /dev/null +++ b/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-edit/ty-salesman-edit.component.ts @@ -0,0 +1,108 @@ +import { Component, OnInit } from '@angular/core'; +import {FormBuilder, FormGroup, Validators} from '_@angular_forms@9.0.7@@angular/forms'; +import {NzModalService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; +import {ActivatedRoute, Router} from '_@angular_router@9.0.7@@angular/router'; +import {TySalesmanService} from '../../../../services/ty-salesman.service'; + +@Component({ + selector: 'app-ty-salesman-edit', + templateUrl: './ty-salesman-edit.component.html', + styleUrls: ['./ty-salesman-edit.component.scss'] +}) +export class TySalesmanEditComponent implements OnInit { + + agentForm: FormGroup; + btnLoading = false; + + constructor(private form: FormBuilder, + private modal: NzModalService, + private tySalesmanService: TySalesmanService, + private activatedRoute: ActivatedRoute, + private router: Router) { } + + ngOnInit(): void { + this.agentForm = this.form.group({ + id: [null], + salesmanName: [null, [Validators.required]], + salesmanPhone: [null, [Validators.required]], + }); + this.activatedRoute.queryParams.subscribe(queryParams => { + if (queryParams['salesmanKey'] != null) { + this.getDetail(queryParams['salesmanKey']); + } + if (queryParams['tyAgentId'] != null) { + this.agentForm.patchValue({tyAgentId : queryParams['tyAgentId']}); + } + }); + } + + /** + * 查询详情 + * @param agentKey 代理商编号 + */ + getDetail(agentKey: string) { + this.tySalesmanService.getDetailByKey(agentKey, data => { + if (data['return_code'] === '000000') { + this.agentForm.patchValue(data['return_data']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + }); + } + + /** + * 提交 + */ + submitFrom() { + this.btnLoading = true; + for (const i in this.agentForm.controls) { + this.agentForm.controls[i].markAsDirty(); + this.agentForm.controls[i].updateValueAndValidity(); + } + if (this.agentForm.status == null || this.agentForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请规范填写所有的必填项信息', + }); + this.btnLoading = false; + return; + } + + if (this.agentForm.value.id == null) { + this.tySalesmanService.addSalesman(this.agentForm.value, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '添加成功', + nzOnOk: () => this.router.navigateByUrl('admin/tuanyou-agent/salesman-list') + }); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + this.btnLoading = false; + }); + } else { + this.tySalesmanService.updateSalesman(this.agentForm.value, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '修改成功', + nzOnOk: () => this.router.navigateByUrl('admin/tuanyou-agent/salesman-list') + }); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + this.btnLoading = false; + }); + } + } +} diff --git a/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-list/ty-salesman-list.component.html b/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-list/ty-salesman-list.component.html new file mode 100644 index 0000000..0396b85 --- /dev/null +++ b/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-list/ty-salesman-list.component.html @@ -0,0 +1,79 @@ + + + + + +
+
+
+
+ + 业务员名称 + + + + +
+
+ + 联系电话 + + + + +
+
+ +
+
+ + +
+
+
+
+ +
+ 共计 {{dataObject.total?dataObject.total:0}} 条数据 +
+ +
+ + + + + + 业务员编号 + 业务员名称 + 联系电话 + 创建时间 + 操作 + + + + + {{data.salesmanKey}} + {{data.salesmanName}} + {{data.salesmanPhone}} + {{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} + + 操作列表 + + + + + + + +
diff --git a/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-list/ty-salesman-list.component.scss b/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-list/ty-salesman-list.component.scss new file mode 100644 index 0000000..690993b --- /dev/null +++ b/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-list/ty-salesman-list.component.scss @@ -0,0 +1,3 @@ +.table-td-operation a { + padding: 0px 5px; +} diff --git a/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-list/ty-salesman-list.component.spec.ts b/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-list/ty-salesman-list.component.spec.ts new file mode 100644 index 0000000..56d9392 --- /dev/null +++ b/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-list/ty-salesman-list.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TySalesmanListComponent } from './ty-salesman-list.component'; + +describe('TySalesmanListComponent', () => { + let component: TySalesmanListComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ TySalesmanListComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TySalesmanListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-list/ty-salesman-list.component.ts b/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-list/ty-salesman-list.component.ts new file mode 100644 index 0000000..33f34a6 --- /dev/null +++ b/src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-list/ty-salesman-list.component.ts @@ -0,0 +1,148 @@ +import { Component, OnInit } from '@angular/core'; +import {FormBuilder, FormGroup} from '_@angular_forms@9.0.7@@angular/forms'; +import {NzMessageService, NzModalService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; +import {TySalesmanService} from '../../../../services/ty-salesman.service'; +import {ADMIN_INFO_OBJECT} from "../../../../services/local-storage.namespace"; +import {LocalStorageService} from "../../../../services/local-storage.service"; +import {ActivatedRoute} from "_@angular_router@9.0.7@@angular/router"; + +@Component({ + selector: 'app-ty-salesman-list', + templateUrl: './ty-salesman-list.component.html', + styleUrls: ['./ty-salesman-list.component.scss'] +}) +export class TySalesmanListComponent implements OnInit { + + dataObject: any = {}; + tableLoading = true; + searchForm: FormGroup; + pageNum: number; + whereObject: any = {}; + + tyAgentId: number; + + constructor(private modal: NzModalService, + private message: NzMessageService, + private tySalesmanService: TySalesmanService, + private store: LocalStorageService, // 数据请求 + private activatedRoute: ActivatedRoute, + private form: FormBuilder) { + } + + ngOnInit(): void { + this.searchForm = this.form.group({ + salesmanName: [null], + salesmanPhone: [null], + }); + + this.activatedRoute.queryParams.subscribe(queryParams => { + if (queryParams['tyAgentId'] != null) { + this.tyAgentId = queryParams['tyAgentId']; + } + }); + + if (this.store.get(ADMIN_INFO_OBJECT)['highTyAgent']['id'] != null) { + this.tyAgentId = this.store.get(ADMIN_INFO_OBJECT)['highTyAgent']['id']; + } + + this.requestData(1); + } + + /** + * 请求数据 + */ + requestData(pageNum) { + this.tableLoading = true; + this.whereObject['tyAgentId'] = this.tyAgentId; + this.whereObject['pageNum'] = pageNum; + this.whereObject['pageSize'] = 10; + this.tySalesmanService.getSalesmanList(this.whereObject, data => { + if (data['return_code'] === '000000') { + this.dataObject = data['return_data']; + } else { + this.modal.error(data['return_msg']); + } + this.tableLoading = false; + }); + } + + /** + * 搜索 + * @param whereObject 条件 + */ + search(whereObject: object) { + this.whereObject = whereObject; + this.requestData(1); + } + + /** + * 重置 + */ + resetForm(): void { + this.searchForm.reset(); + } + /** + * 弹出密码重置对话框 + */ + showPwdResetConfirm(key: string): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否重置业务员密码!', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'danger', + nzOnOk: () => this.pwdReset(key) + }); + } + + /** + * 密码重置 + * + */ + pwdReset(key: string) { + this.tySalesmanService.salesmanPwdReset({ salesmanKey : key}, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '重置成功!密码为:123456' + }); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'] + }); + } + }); + } + + /** + * 弹出删除对话框 + */ + showDeleteConfirm(key: string): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否删除该业务员', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'danger', + nzOnOk: () => this.deleteData(key) + }); + } + + /** + * 删除数据 + * + */ + deleteData(key: string) { + this.tySalesmanService.delSalesman({ salesmanKey: key}, data => { + if (data['return_code'] === '000000') { + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'] + }); + } + }); + } +} diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 7a67b41..4d44c15 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -97,6 +97,11 @@ const routes: Routes = [ loadChildren: () => import('./admin/discount-package/discount-package.module').then(m => m.DiscountPackageModule), canActivate: [InitGuardService] }, + { + path: 'tuanyou-agent', + loadChildren: () => import('./admin/tuanyou-agent/tuanyou-agent.module').then(m => m.TuanyouAgentModule), + canActivate: [InitGuardService] + }, ], }, ]; diff --git a/src/app/services/ty-agent.service.ts b/src/app/services/ty-agent.service.ts new file mode 100644 index 0000000..7616022 --- /dev/null +++ b/src/app/services/ty-agent.service.ts @@ -0,0 +1,82 @@ +import { Injectable } from '@angular/core'; +import {HttpClient} from '_@angular_common@9.0.7@@angular/common/http'; +import {CommonsService} from './commons.service'; +import {environment} from '../../environments/environment'; + +@Injectable({ + providedIn: 'root' +}) +export class TyAgentService { + + constructor( + private http: HttpClient, + private common: CommonsService + ) { } + + /** + * 增加代理商 + * @param paramObject 参数 + * @param callBack + */ + addAgent(paramObject: object, callBack) { + this.http.post(environment.baseUrl + 'tyAgent/addAgent', paramObject).subscribe(data => { + callBack(data); + }); + } + + /** + * 修改代理商 + * @param paramObject 参数 + * @param callBack + */ + updateAgent(paramObject: object, callBack) { + this.http.post(environment.baseUrl + 'tyAgent/updateAgent', paramObject).subscribe(data => { + callBack(data); + }); + } + + /** + * 代理商密码重置 + * @param paramObject 参数 + * @param callBack + */ + agentPwdReset(paramObject: object, callBack) { + this.http.post(environment.baseUrl + 'tyAgent/agentPwdReset', paramObject).subscribe(data => { + callBack(data); + }); + } + + /** + * 代理商密码重置 + * @param paramObject 参数 + * @param callBack + */ + delAgent(paramObject: object, callBack) { + this.http.post(environment.baseUrl + 'tyAgent/delAgent', paramObject).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询代理商详情 + * @param paramObject 参数 + * @param callBack + */ + getDetailByKey(agentKey: string, callBack) { + this.http.get(environment.baseUrl + 'tyAgent/getDetailByKey?key=' + agentKey).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询代理商列表 + * @param paramObject 参数 + * @param callBack + */ + getAgentList(paramObject: object, callBack) { + this.http.get(environment.baseUrl + 'tyAgent/getAgentList?' + this.common.getWhereCondition(paramObject)).subscribe(data => { + callBack(data); + }); + } + +} diff --git a/src/app/services/ty-salesman.service.ts b/src/app/services/ty-salesman.service.ts new file mode 100644 index 0000000..c35cadc --- /dev/null +++ b/src/app/services/ty-salesman.service.ts @@ -0,0 +1,83 @@ +import { Injectable } from '@angular/core'; +import {HttpClient} from '_@angular_common@9.0.7@@angular/common/http'; +import {CommonsService} from './commons.service'; +import {environment} from '../../environments/environment'; + +@Injectable({ + providedIn: 'root' +}) +export class TySalesmanService { + + constructor( + private http: HttpClient, + private common: CommonsService + ) { } + + /** + * 增加业务员 + * @param paramObject 参数 + * @param callBack + */ + addSalesman(paramObject: object, callBack) { + this.http.post(environment.baseUrl + 'tySalesman/addSalesman', paramObject).subscribe(data => { + callBack(data); + }); + } + + /** + * 修改业务员 + * @param paramObject 参数 + * @param callBack + */ + updateSalesman(paramObject: object, callBack) { + this.http.post(environment.baseUrl + 'tySalesman/updateSalesman', paramObject).subscribe(data => { + callBack(data); + }); + } + + /** + * 业务员密码重置 + * @param paramObject 参数 + * @param callBack + */ + salesmanPwdReset(paramObject: object, callBack) { + this.http.post(environment.baseUrl + 'tySalesman/salesmanPwdReset', paramObject).subscribe(data => { + callBack(data); + }); + } + + /** + * 删除业务员 + * @param paramObject 参数 + * @param callBack + */ + delSalesman(paramObject: object, callBack) { + this.http.post(environment.baseUrl + 'tySalesman/delSalesman', paramObject).subscribe(data => { + callBack(data); + }); + } + + /** + * 修改业务员 + * @param paramObject 参数 + * @param callBack + */ + getDetailByKey(key: string, callBack) { + this.http.get(environment.baseUrl + 'tySalesman/getDetailByKey?key=' + key).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询业务员列表 + * @param paramObject 参数 + * @param callBack + */ + getSalesmanList(param: object, callBack) { + this.http.get(environment.baseUrl + 'tySalesman/getSalesmanList?' + this.common.getWhereCondition(param)).subscribe(data => { + callBack(data); + }); + } + + +} diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 5a795b3..ffa77b2 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -6,8 +6,8 @@ export const environment = { production: false, // baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址) // imageUrl: 'http://localhost:9302/filesystem/', - baseUrl: 'https://hsg.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) - imageUrl: 'https://hsg.dctpay.com/filesystem/', + baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址) + imageUrl: 'https://hsgcs.dctpay.com/filesystem/', key: 'https://hsgcs.dctpay.com/phone-recharge-H5/index.html?codeValue=', inviteUrl: 'https://hsgcs.dctpay.com/wx/?action=ic&id=', };