完成 团油代理商、业务员配置

pull/1/head
胡锐 3 years ago
parent 9e007fe787
commit c799096f1b
  1. 2
      src/app/admin/system/menu/menu.component.html
  2. 2
      src/app/admin/system/system-role-show/system-role-show.component.html
  3. 1
      src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.html
  4. 0
      src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.scss
  5. 25
      src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.spec.ts
  6. 15
      src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.ts
  7. 19
      src/app/admin/tuanyou-agent/tuanyou-agent-routing.module.ts
  8. 27
      src/app/admin/tuanyou-agent/tuanyou-agent.module.ts
  9. 58
      src/app/admin/tuanyou-agent/ty-agent/ty-agent-edit/ty-agent-edit.component.html
  10. 7
      src/app/admin/tuanyou-agent/ty-agent/ty-agent-edit/ty-agent-edit.component.scss
  11. 25
      src/app/admin/tuanyou-agent/ty-agent/ty-agent-edit/ty-agent-edit.component.spec.ts
  12. 110
      src/app/admin/tuanyou-agent/ty-agent/ty-agent-edit/ty-agent-edit.component.ts
  13. 99
      src/app/admin/tuanyou-agent/ty-agent/ty-agent-list/ty-agent-list.component.html
  14. 3
      src/app/admin/tuanyou-agent/ty-agent/ty-agent-list/ty-agent-list.component.scss
  15. 25
      src/app/admin/tuanyou-agent/ty-agent/ty-agent-list/ty-agent-list.component.spec.ts
  16. 130
      src/app/admin/tuanyou-agent/ty-agent/ty-agent-list/ty-agent-list.component.ts
  17. 40
      src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-edit/ty-salesman-edit.component.html
  18. 7
      src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-edit/ty-salesman-edit.component.scss
  19. 25
      src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-edit/ty-salesman-edit.component.spec.ts
  20. 108
      src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-edit/ty-salesman-edit.component.ts
  21. 79
      src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-list/ty-salesman-list.component.html
  22. 3
      src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-list/ty-salesman-list.component.scss
  23. 25
      src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-list/ty-salesman-list.component.spec.ts
  24. 148
      src/app/admin/tuanyou-agent/ty-salesman/ty-salesman-list/ty-salesman-list.component.ts
  25. 5
      src/app/app-routing.module.ts
  26. 82
      src/app/services/ty-agent.service.ts
  27. 83
      src/app/services/ty-salesman.service.ts
  28. 4
      src/environments/environment.ts

@ -1,4 +1,4 @@
<link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css">
<!--面包屑--> <!--面包屑-->
<nz-breadcrumb> <nz-breadcrumb>

@ -1,4 +1,4 @@
<link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css">
<!--面包屑 --> <!--面包屑 -->
<nz-breadcrumb> <nz-breadcrumb>
<nz-breadcrumb-item> <nz-breadcrumb-item>

@ -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<PetrolStationManageComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PetrolStationManageComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(PetrolStationManageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -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 {
}
}

@ -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 { }

@ -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 { }

@ -0,0 +1,58 @@
<!-- start 面包屑 -->
<nz-breadcrumb>
<nz-breadcrumb-item>
代理商
</nz-breadcrumb-item>
<nz-breadcrumb-item>
编辑
</nz-breadcrumb-item>
</nz-breadcrumb>
<!-- end 面包屑 -->
<div class="inner-content">
<div class="main">
<form nz-form [formGroup]="agentForm">
<div nz-row>
<div nz-col class="gutter-row" [nzSpan]="24">
<nz-form-item>
<nz-form-label [nzSpan]="8" nzRequired>代理商名称</nz-form-label>
<nz-form-control [nzSpan]="8">
<input nz-input type="text" formControlName="agentName" placeholder="请输入代理商名称" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col class="gutter-row" [nzSpan]="24">
<nz-form-item>
<nz-form-label [nzSpan]="8" nzRequired>联系人</nz-form-label>
<nz-form-control [nzSpan]="8">
<input nz-input type="text" formControlName="agentUser" placeholder="请输入联系人" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col class="gutter-row" [nzSpan]="24">
<nz-form-item>
<nz-form-label [nzSpan]="8" nzRequired>联系电话</nz-form-label>
<nz-form-control [nzSpan]="8">
<input nz-input type="text" formControlName="agentPhone" placeholder="请输入联系电话" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col class="gutter-row" [nzSpan]="24">
<nz-form-item>
<nz-form-label [nzSpan]="8">所在地址</nz-form-label>
<nz-form-control [nzSpan]="8">
<textarea nz-input rows="4" maxlength="100" formControlName="agentAddress" placeholder="代理商所在详细地址"></textarea>
</nz-form-control>
</nz-form-item>
</div>
</div>
<div class="btn-div">
<button class="btn-post" nz-button nzType="primary" (click)="submitFrom()" [nzLoading]="btnLoading" nzBlock>保存</button>
</div>
</form>
</div>
</div>

@ -0,0 +1,7 @@
.btn-div {
width: 100%;
text-align: center;
}
.btn-post {
width: 25%;
}

@ -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<TyAgentEditComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TyAgentEditComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TyAgentEditComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -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;
});
}
}
}

@ -0,0 +1,99 @@
<!-- start 面包屑 -->
<app-breadcrumb></app-breadcrumb>
<!-- end 面包屑 -->
<!--条件搜索-->
<div class="inner-content">
<form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)">
<div nz-row>
<div nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="8">代理商编号</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input formControlName="agentKey" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="8">代理商名称</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input formControlName="agentName" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="8">联系人</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input formControlName="agentUser" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="8">联系电话</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input formControlName="agentPhone" />
</nz-form-control>
</nz-form-item>
</div>
</div>
<div nz-row>
<div nz-col nzSpan="24" class="search-button">
<button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button>
<button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload" nzTheme="outline"></i>重置</button>
</div>
</div>
</form>
</div>
<div class="inner-content">
<span>共计 {{dataObject.total?dataObject.total:0}} 条数据</span>
<div class="operating-button">
<button nz-button nzType="primary" class="right-btn" [routerLink]="'/admin/tuanyou-agent/agent-edit'"><i nz-icon nzType="plus" nzTheme="outline"></i>添加</button>
</div>
<!--数组表格 -->
<nz-table #basicTable
[nzData]="dataObject.list"
[nzTotal]="dataObject.total"
[nzFrontPagination]="false"
[nzLoading]="tableLoading"
[nzPageIndex]="whereObject.pageNum"
(nzPageIndexChange)="requestData($event)"
[nzScroll]="{ x: '1150px'}">
<thead>
<tr>
<th nzWidth="100px">代理商编号</th>
<th nzWidth="150px">代理商名称</th>
<th nzWidth="100px">联系人</th>
<th nzWidth="100px">联系电话</th>
<th nzWidth="180px">代理商地址</th>
<th nzWidth="120px">创建时间</th>
<th nzWidth="100px" nzRight="0px">操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data;let i = index">
<td>{{data.agentKey}}</td>
<td>{{data.agentName}}</td>
<td>{{data.agentUser}}</td>
<td>{{data.agentPhone}}</td>
<td>{{data.agentAddress?data.agentAddress:'未填写'}}</td>
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
<td nzRight="0px" class="table-td-operation">
<a nz-dropdown [nzDropdownMenu]="menu"> 操作列表 <i nz-icon nzType="down"></i> </a>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable>
<li nz-menu-item><a [routerLink]="['/admin/tuanyou-agent/agent-edit']" [queryParams]="{agentKey: data.agentKey}">修改</a></li>
<li nz-menu-item><a (click)="showDeleteConfirm(data.agentKey)">删除</a></li>
<li nz-menu-item><a (click)="showPwdResetConfirm(data.agentKey)">重置密码</a></li>
</ul>
</nz-dropdown-menu>
</td>
</tr>
</tbody>
</nz-table>
</div>

@ -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<TyAgentListComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TyAgentListComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TyAgentListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -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']
});
}
});
}
}

@ -0,0 +1,40 @@
<!-- start 面包屑 -->
<nz-breadcrumb>
<nz-breadcrumb-item>
代理商
</nz-breadcrumb-item>
<nz-breadcrumb-item>
编辑
</nz-breadcrumb-item>
</nz-breadcrumb>
<!-- end 面包屑 -->
<div class="inner-content">
<div class="main">
<form nz-form [formGroup]="agentForm">
<div nz-row>
<div nz-col class="gutter-row" [nzSpan]="24">
<nz-form-item>
<nz-form-label [nzSpan]="8" nzRequired>业务员名称</nz-form-label>
<nz-form-control [nzSpan]="8">
<input nz-input type="text" formControlName="salesmanName" placeholder="请输入代理商名称" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col class="gutter-row" [nzSpan]="24">
<nz-form-item>
<nz-form-label [nzSpan]="8" nzRequired>联系电话</nz-form-label>
<nz-form-control [nzSpan]="8">
<input nz-input type="text" formControlName="salesmanPhone" placeholder="请输入联系电话" />
</nz-form-control>
</nz-form-item>
</div>
</div>
<div class="btn-div">
<button class="btn-post" nz-button nzType="primary" (click)="submitFrom()" [nzLoading]="btnLoading" nzBlock>保存</button>
</div>
</form>
</div>
</div>

@ -0,0 +1,7 @@
.btn-div {
width: 100%;
text-align: center;
}
.btn-post {
width: 25%;
}

@ -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<TySalesmanEditComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TySalesmanEditComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TySalesmanEditComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -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;
});
}
}
}

@ -0,0 +1,79 @@
<!-- start 面包屑 -->
<app-breadcrumb></app-breadcrumb>
<!-- end 面包屑 -->
<!--条件搜索-->
<div class="inner-content">
<form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)">
<div nz-row>
<div nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="8">业务员名称</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input formControlName="salesmanName" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="8">联系电话</nz-form-label>
<nz-form-control [nzSpan]="14">
<input nz-input formControlName="salesmanPhone" />
</nz-form-control>
</nz-form-item>
</div>
</div>
<div nz-row>
<div nz-col nzSpan="24" class="search-button">
<button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button>
<button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload" nzTheme="outline"></i>重置</button>
</div>
</div>
</form>
</div>
<div class="inner-content">
<span>共计 {{dataObject.total?dataObject.total:0}} 条数据</span>
<div class="operating-button">
<button nz-button nzType="primary" class="right-btn" [routerLink]="'/admin/tuanyou-agent/salesman-edit'"><i nz-icon nzType="plus" nzTheme="outline"></i>添加</button>
</div>
<!--数组表格 -->
<nz-table #basicTable
[nzData]="dataObject.list"
[nzTotal]="dataObject.total"
[nzFrontPagination]="false"
[nzLoading]="tableLoading"
[nzPageIndex]="whereObject.pageNum"
(nzPageIndexChange)="requestData($event)"
[nzScroll]="{ x: '1150px'}">
<thead>
<tr>
<th nzWidth="100px">业务员编号</th>
<th nzWidth="150px">业务员名称</th>
<th nzWidth="100px">联系电话</th>
<th nzWidth="120px">创建时间</th>
<th nzWidth="100px" nzRight="0px">操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data;let i = index">
<td>{{data.salesmanKey}}</td>
<td>{{data.salesmanName}}</td>
<td>{{data.salesmanPhone}}</td>
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
<td nzRight="0px" class="table-td-operation">
<a nz-dropdown [nzDropdownMenu]="menu"> 操作列表 <i nz-icon nzType="down"></i> </a>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable>
<li nz-menu-item><a [routerLink]="['/admin/tuanyou-agent/salesman-edit']" [queryParams]="{salesmanKey: data.salesmanKey}">修改</a></li>
<li nz-menu-item><a (click)="showDeleteConfirm(data.salesmanKey)">删除</a></li>
<li nz-menu-item><a (click)="showPwdResetConfirm(data.salesmanKey)">重置密码</a></li>
</ul>
</nz-dropdown-menu>
</td>
</tr>
</tbody>
</nz-table>
</div>

@ -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<TySalesmanListComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TySalesmanListComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TySalesmanListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -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']
});
}
});
}
}

@ -97,6 +97,11 @@ const routes: Routes = [
loadChildren: () => import('./admin/discount-package/discount-package.module').then(m => m.DiscountPackageModule), loadChildren: () => import('./admin/discount-package/discount-package.module').then(m => m.DiscountPackageModule),
canActivate: [InitGuardService] canActivate: [InitGuardService]
}, },
{
path: 'tuanyou-agent',
loadChildren: () => import('./admin/tuanyou-agent/tuanyou-agent.module').then(m => m.TuanyouAgentModule),
canActivate: [InitGuardService]
},
], ],
}, },
]; ];

@ -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);
});
}
}

@ -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);
});
}
}

@ -6,8 +6,8 @@ export const environment = {
production: false, production: false,
// baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址) // baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址)
// imageUrl: 'http://localhost:9302/filesystem/', // imageUrl: 'http://localhost:9302/filesystem/',
baseUrl: 'https://hsg.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址)
imageUrl: 'https://hsg.dctpay.com/filesystem/', imageUrl: 'https://hsgcs.dctpay.com/filesystem/',
key: 'https://hsgcs.dctpay.com/phone-recharge-H5/index.html?codeValue=', key: 'https://hsgcs.dctpay.com/phone-recharge-H5/index.html?codeValue=',
inviteUrl: 'https://hsgcs.dctpay.com/wx/?action=ic&id=', inviteUrl: 'https://hsgcs.dctpay.com/wx/?action=ic&id=',
}; };

Loading…
Cancel
Save