From 24ed2cfc1f400c0a3f22e1599e5135d3ccae8e02 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 9 Jan 2023 10:00:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agent-list/agent-list.component.html | 12 + .../agent/agent-list/agent-list.component.ts | 31 ++- .../company-add/company-add.component.html | 82 ++++++ .../company-add/company-add.component.scss | 46 ++++ .../company-add/company-add.component.spec.ts | 25 ++ .../company-add/company-add.component.ts | 73 +++++ .../company-list/company-list.component.html | 69 +++++ .../company-list/company-list.component.scss | 0 .../company-list.component.spec.ts | 25 ++ .../company-list/company-list.component.ts | 64 +++++ .../admin/company/company-routing.module.ts | 18 ++ .../company-update.component.html | 72 +++++ .../company-update.component.scss | 46 ++++ .../company-update.component.spec.ts | 25 ++ .../company-update.component.ts | 87 ++++++ src/app/admin/company/company.module.ts | 26 ++ .../device-list/device-list.component.html | 146 +++++++--- .../device-list/device-list.component.scss | 4 + .../device-list/device-list.component.ts | 258 ++++++++++++++++-- .../device-order-list.component.html | 183 +++++++++++++ .../device-order-list.component.scss | 7 + .../device-order-list.component.spec.ts | 25 ++ .../device-order-list.component.ts | 127 +++++++++ src/app/admin/device/device-routing.module.ts | 4 +- src/app/admin/device/device.module.ts | 3 +- .../pay-qr-code-list.component.html | 55 +++- .../pay-qr-code-list.component.ts | 90 +++++- .../salesman-list.component.html | 24 ++ .../salesman-list/salesman-list.component.ts | 50 +++- ...tore-discount-activity-edit.component.html | 70 +++++ ...tore-discount-activity-edit.component.scss | 6 + ...e-discount-activity-edit.component.spec.ts | 25 ++ .../store-discount-activity-edit.component.ts | 85 ++++++ ...tore-discount-activity-list.component.html | 112 ++++++++ ...tore-discount-activity-list.component.scss | 0 ...e-discount-activity-list.component.spec.ts | 25 ++ .../store-discount-activity-list.component.ts | 172 ++++++++++++ .../store-discount-activity-routing.module.ts | 16 ++ .../store-discount-activity.module.ts | 25 ++ .../store-list/store-list.component.html | 6 +- .../store/store-list/store-list.component.ts | 4 +- src/app/app-common.module.ts | 8 +- src/app/app-routing.module.ts | 10 + .../device/device-order-pay-type.pipe.ts | 17 ++ .../pipes/device/device-order-status.pipe.ts | 22 ++ .../pipes/device/device-order-type.pipe.ts | 19 ++ src/app/pipes/device/device-type.pipe.ts | 17 ++ src/app/pipes/index.ts | 5 + src/app/services/commons.service.ts | 10 + src/app/services/company.service.ts | 60 ++++ src/app/services/device-order.service.ts | 48 ++++ src/app/services/device.service.ts | 47 +++- src/app/services/pay-qr-code.service.ts | 10 + src/app/services/salesman.service.ts | 4 +- .../store-discount-activity.service.ts | 81 ++++++ src/app/services/store.service.ts | 11 + src/environments/environment.ts | 1 + 57 files changed, 2503 insertions(+), 90 deletions(-) create mode 100644 src/app/admin/company/company-add/company-add.component.html create mode 100644 src/app/admin/company/company-add/company-add.component.scss create mode 100644 src/app/admin/company/company-add/company-add.component.spec.ts create mode 100644 src/app/admin/company/company-add/company-add.component.ts create mode 100644 src/app/admin/company/company-list/company-list.component.html create mode 100644 src/app/admin/company/company-list/company-list.component.scss create mode 100644 src/app/admin/company/company-list/company-list.component.spec.ts create mode 100644 src/app/admin/company/company-list/company-list.component.ts create mode 100644 src/app/admin/company/company-routing.module.ts create mode 100644 src/app/admin/company/company-update/company-update.component.html create mode 100644 src/app/admin/company/company-update/company-update.component.scss create mode 100644 src/app/admin/company/company-update/company-update.component.spec.ts create mode 100644 src/app/admin/company/company-update/company-update.component.ts create mode 100644 src/app/admin/company/company.module.ts create mode 100644 src/app/admin/device/device-order-list/device-order-list.component.html create mode 100644 src/app/admin/device/device-order-list/device-order-list.component.scss create mode 100644 src/app/admin/device/device-order-list/device-order-list.component.spec.ts create mode 100644 src/app/admin/device/device-order-list/device-order-list.component.ts create mode 100644 src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.html create mode 100644 src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.scss create mode 100644 src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.spec.ts create mode 100644 src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.ts create mode 100644 src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.html create mode 100644 src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.scss create mode 100644 src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.spec.ts create mode 100644 src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.ts create mode 100644 src/app/admin/store-discount-activity/store-discount-activity-routing.module.ts create mode 100644 src/app/admin/store-discount-activity/store-discount-activity.module.ts create mode 100644 src/app/pipes/device/device-order-pay-type.pipe.ts create mode 100644 src/app/pipes/device/device-order-status.pipe.ts create mode 100644 src/app/pipes/device/device-order-type.pipe.ts create mode 100644 src/app/pipes/device/device-type.pipe.ts create mode 100644 src/app/services/company.service.ts create mode 100644 src/app/services/device-order.service.ts create mode 100644 src/app/services/store-discount-activity.service.ts diff --git a/src/app/admin/agent/agent-list/agent-list.component.html b/src/app/admin/agent/agent-list/agent-list.component.html index e6e6704..06232c8 100644 --- a/src/app/admin/agent/agent-list/agent-list.component.html +++ b/src/app/admin/agent/agent-list/agent-list.component.html @@ -6,6 +6,16 @@
+
+ + 分公司 + + + + + + +
代理商名称 @@ -70,6 +80,7 @@ 序号 + 分公司 代理商名称 联系人 联系电话 @@ -82,6 +93,7 @@ {{i + 1}} + {{data.companyName}} {{data.name}} {{data.contactPerson}} {{data.contactPersonPhone}} diff --git a/src/app/admin/agent/agent-list/agent-list.component.ts b/src/app/admin/agent/agent-list/agent-list.component.ts index 7fe2c10..c3fe22a 100644 --- a/src/app/admin/agent/agent-list/agent-list.component.ts +++ b/src/app/admin/agent/agent-list/agent-list.component.ts @@ -2,6 +2,9 @@ import { Component, OnInit } from '@angular/core'; import {NzMessageService, NzModalService} from 'ng-zorro-antd'; import {AgentService} from '../../../services/agent.service'; import {FormBuilder, FormGroup} from '@angular/forms'; +import {CompanyService} from '../../../services/company.service'; +import {LocalStorageService} from '../../../services/local-storage.service'; +import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; @Component({ selector: 'app-agent-list', @@ -16,13 +19,26 @@ export class AgentListComponent implements OnInit { pageNum: number; whereObject: any = {}; + userObjectType: number; + companyArray = []; + constructor(private modal: NzModalService, private message: NzMessageService, private agentService: AgentService, - private form: FormBuilder) { } + private companyService: CompanyService, + private localStorageService: LocalStorageService, + private form: FormBuilder) { + this.userObjectType = Number(this.localStorageService.get(ADMIN_INFO_OBJECT)['secUser']['objectType']); + } + ngOnInit(): void { + if (this.userObjectType != null && this.userObjectType === 0) { + this.getCompanyList(); + } + this.searchForm = this.form.group({ + companyId: [null], name: [null], contactPerson: [null], contactPersonPhone: [null], @@ -31,6 +47,19 @@ export class AgentListComponent implements OnInit { this.requestData(1); } + /** + * 获取公司列表 + */ + getCompanyList() { + this.companyService.selectCompanyList({pageNum: 1, pageSize: 99 }, data => { + if (data['return_code'] === '000000') { + this.companyArray = data['return_data']['list']; + } else { + this.modal.error(data['return_msg']); + } + }); + } + /** * 请求数据 */ diff --git a/src/app/admin/company/company-add/company-add.component.html b/src/app/admin/company/company-add/company-add.component.html new file mode 100644 index 0000000..10da572 --- /dev/null +++ b/src/app/admin/company/company-add/company-add.component.html @@ -0,0 +1,82 @@ + + + + 代理商 + + + 添加代理商 + + + +
+
+ +
账户信息
+
+
+ + 账户名称 + + + + +
+ +
+ + 账户密码 + + + + +
+ +
+ +
公司信息
+
+
+ + 地区 + + + + + + +
+ +
+ + 公司名称 + + + + +
+ +
+ + 联系电话 + + + + +
+ +
+ + 所在地址 + + + + +
+
+ +
+ +
+ +
+
diff --git a/src/app/admin/company/company-add/company-add.component.scss b/src/app/admin/company/company-add/company-add.component.scss new file mode 100644 index 0000000..ab2a774 --- /dev/null +++ b/src/app/admin/company/company-add/company-add.component.scss @@ -0,0 +1,46 @@ +.main { + width: 90%; + margin-left: 5%; + .title { + width: 100%; + height: 46px; + line-height: 46px; + font-size: 16px; + text-align: center; + color: #1890ff; + background-color: #f3f9ff; + margin-bottom: 20px; + } + .idCard { + img { + width: 100px; + } + .userImg { + width: 90px; + } + } + .post_p_l { + //margin-left: 5% ; + } + .main_post_p { + font-size: 12px; + color: #999999; + margin-top: -10px; + } + .btn { + margin-top: 20px; + } + .bottom_solid { + border-bottom: 1px solid #e4e4e4; + } + .btn-div { + width: 100%; + text-align: center; + } + .btn-post { + width: 25%; + } + nz-date-picker { + width: 100%; + } +} diff --git a/src/app/admin/company/company-add/company-add.component.spec.ts b/src/app/admin/company/company-add/company-add.component.spec.ts new file mode 100644 index 0000000..b300a61 --- /dev/null +++ b/src/app/admin/company/company-add/company-add.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CompanyAddComponent } from './company-add.component'; + +describe('CompanyAddComponent', () => { + let component: CompanyAddComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ CompanyAddComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CompanyAddComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/company/company-add/company-add.component.ts b/src/app/admin/company/company-add/company-add.component.ts new file mode 100644 index 0000000..2ba25e2 --- /dev/null +++ b/src/app/admin/company/company-add/company-add.component.ts @@ -0,0 +1,73 @@ +import { Component, OnInit } from '@angular/core'; +import {FormBuilder, FormGroup, Validators} from '@angular/forms'; +import {NzModalService} from 'ng-zorro-antd'; +import {ActivatedRoute, Router} from '@angular/router'; +import {ValidatorsService} from '../../../services/validators.service'; +import {CompanyService} from '../../../services/company.service'; +import {CommonsService} from '../../../services/commons.service'; + +@Component({ + selector: 'app-company-add', + templateUrl: './company-add.component.html', + styleUrls: ['./company-add.component.scss'] +}) +export class CompanyAddComponent implements OnInit { + + companyForm: FormGroup; + btnLoading = false; + provinceArray = []; + + constructor(private form: FormBuilder, + private modal: NzModalService, + private companyService: CompanyService, + private commonsService: CommonsService, + private activatedRoute: ActivatedRoute, + private router: Router) { } + + ngOnInit(): void { + this.commonsService.getProvinceList(data => { + this.provinceArray = data['return_data']; + }); + + this.companyForm = this.form.group({ + regionId: [null, [Validators.required]], + name: [null, [Validators.required]], + loginName: [null, [Validators.required, ValidatorsService.minLength(6), ValidatorsService.maxLength(20)]], + password: [null, [Validators.required, ValidatorsService.minLength(6), ValidatorsService.maxLength(20)]], + address: [null], + phone: [null], + }); + } + + submitFrom() { + this.btnLoading = true; + for (const i in this.companyForm.controls) { + this.companyForm.controls[i].markAsDirty(); + this.companyForm.controls[i].updateValueAndValidity(); + } + if (this.companyForm.status == null || this.companyForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请规范填写所有的必填项信息', + }); + this.btnLoading = false; + return; + } + + this.companyService.insertCompany(this.companyForm.value, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '添加成功', + nzOnOk: () => this.router.navigateByUrl('admin/company/list') + }); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + this.btnLoading = false; + }); + } +} diff --git a/src/app/admin/company/company-list/company-list.component.html b/src/app/admin/company/company-list/company-list.component.html new file mode 100644 index 0000000..1a5ddc9 --- /dev/null +++ b/src/app/admin/company/company-list/company-list.component.html @@ -0,0 +1,69 @@ + + + + + +
+
+
+
+ + 公司名称 + + + + +
+
+ +
+
+ + +
+
+
+
+ +
+ 共计 {{dataObject.total?dataObject.total:0}} 条数据 +
+ +
+ + + + + + 序号 + 公司地区 + 公司名称 + 联系电话 + 详细地址 + 创建时间 + 操作 + + + + + {{i + 1}} + {{data.regionName}} + {{data.name}} + {{data.phone?data.phone:'未填写'}} + {{data.address?data.address:'未填写'}} + {{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} + + + 修改 + + + + +
diff --git a/src/app/admin/company/company-list/company-list.component.scss b/src/app/admin/company/company-list/company-list.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/company/company-list/company-list.component.spec.ts b/src/app/admin/company/company-list/company-list.component.spec.ts new file mode 100644 index 0000000..f9d0a52 --- /dev/null +++ b/src/app/admin/company/company-list/company-list.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CompanyListComponent } from './company-list.component'; + +describe('CompanyListComponent', () => { + let component: CompanyListComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ CompanyListComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CompanyListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/company/company-list/company-list.component.ts b/src/app/admin/company/company-list/company-list.component.ts new file mode 100644 index 0000000..27671d6 --- /dev/null +++ b/src/app/admin/company/company-list/company-list.component.ts @@ -0,0 +1,64 @@ +import { Component, OnInit } from '@angular/core'; +import {FormBuilder, FormGroup} from '@angular/forms'; +import {NzMessageService, NzModalService} from 'ng-zorro-antd'; +import {CompanyService} from '../../../services/company.service'; + +@Component({ + selector: 'app-company-list', + templateUrl: './company-list.component.html', + styleUrls: ['./company-list.component.scss'] +}) +export class CompanyListComponent implements OnInit { + + dataObject: any = {}; + tableLoading = true; + searchForm: FormGroup; + pageNum: number; + whereObject: any = {}; + + constructor(private modal: NzModalService, + private message: NzMessageService, + private companyService: CompanyService, + private form: FormBuilder) { } + + ngOnInit(): void { + this.searchForm = this.form.group({ + name: [null], + }); + this.requestData(1); + } + + /** + * 请求数据 + */ + requestData(pageNum) { + this.tableLoading = true; + this.whereObject['pageNum'] = pageNum; + this.whereObject['pageSize'] = 10; + this.companyService.selectCompanyList(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(); + } + +} diff --git a/src/app/admin/company/company-routing.module.ts b/src/app/admin/company/company-routing.module.ts new file mode 100644 index 0000000..5e45943 --- /dev/null +++ b/src/app/admin/company/company-routing.module.ts @@ -0,0 +1,18 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import {CompanyListComponent} from './company-list/company-list.component'; +import {CompanyAddComponent} from './company-add/company-add.component'; +import {CompanyUpdateComponent} from './company-update/company-update.component'; + + +const routes: Routes = [ + { path: 'list', component: CompanyListComponent }, + { path: 'add', component: CompanyAddComponent }, + { path: 'update', component: CompanyUpdateComponent }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class CompanyRoutingModule { } diff --git a/src/app/admin/company/company-update/company-update.component.html b/src/app/admin/company/company-update/company-update.component.html new file mode 100644 index 0000000..bffa65c --- /dev/null +++ b/src/app/admin/company/company-update/company-update.component.html @@ -0,0 +1,72 @@ + + + + 代理商 + + + 添加代理商 + + + +
+
+
+
账户信息
+
+
+ + 账户名称 + + + + +
+
+ +
公司信息
+
+
+ + 地区 + + + + + + +
+ +
+ + 公司名称 + + + + +
+ +
+ + 联系电话 + + + + +
+ +
+ + 所在地址 + + + + +
+
+ +
+ +
+
+
+
diff --git a/src/app/admin/company/company-update/company-update.component.scss b/src/app/admin/company/company-update/company-update.component.scss new file mode 100644 index 0000000..ab2a774 --- /dev/null +++ b/src/app/admin/company/company-update/company-update.component.scss @@ -0,0 +1,46 @@ +.main { + width: 90%; + margin-left: 5%; + .title { + width: 100%; + height: 46px; + line-height: 46px; + font-size: 16px; + text-align: center; + color: #1890ff; + background-color: #f3f9ff; + margin-bottom: 20px; + } + .idCard { + img { + width: 100px; + } + .userImg { + width: 90px; + } + } + .post_p_l { + //margin-left: 5% ; + } + .main_post_p { + font-size: 12px; + color: #999999; + margin-top: -10px; + } + .btn { + margin-top: 20px; + } + .bottom_solid { + border-bottom: 1px solid #e4e4e4; + } + .btn-div { + width: 100%; + text-align: center; + } + .btn-post { + width: 25%; + } + nz-date-picker { + width: 100%; + } +} diff --git a/src/app/admin/company/company-update/company-update.component.spec.ts b/src/app/admin/company/company-update/company-update.component.spec.ts new file mode 100644 index 0000000..a2f020f --- /dev/null +++ b/src/app/admin/company/company-update/company-update.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CompanyUpdateComponent } from './company-update.component'; + +describe('CompanyUpdateComponent', () => { + let component: CompanyUpdateComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ CompanyUpdateComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CompanyUpdateComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/company/company-update/company-update.component.ts b/src/app/admin/company/company-update/company-update.component.ts new file mode 100644 index 0000000..63e5d91 --- /dev/null +++ b/src/app/admin/company/company-update/company-update.component.ts @@ -0,0 +1,87 @@ +import { Component, OnInit } from '@angular/core'; +import {FormBuilder, FormGroup, Validators} from '@angular/forms'; +import {NzModalService} from 'ng-zorro-antd'; +import {CompanyService} from '../../../services/company.service'; +import {CommonsService} from '../../../services/commons.service'; +import {ActivatedRoute, Params, Router} from '@angular/router'; + +@Component({ + selector: 'app-company-update', + templateUrl: './company-update.component.html', + styleUrls: ['./company-update.component.scss'] +}) +export class CompanyUpdateComponent implements OnInit { + + companyForm: FormGroup; + btnLoading = false; + provinceArray = []; + + dataObject: any = {}; + + + constructor(private form: FormBuilder, + private modal: NzModalService, + private companyService: CompanyService, + private commonsService: CommonsService, + private activatedRoute: ActivatedRoute, + private router: Router) { } + + ngOnInit(): void { + this.commonsService.getProvinceList(data => { + this.provinceArray = data['return_data']; + }); + + this.activatedRoute.queryParams.subscribe((queryParams: Params) => { + if (queryParams['companyId'] != null && queryParams['companyId'].length > 0) { + this.companyService.companyView(queryParams['companyId'], data => { + if (data['return_code'] === '000000') { + this.dataObject = data['return_data']['company']; + this.dataObject['loginName'] = data['return_data']['user']['loginName']; + this.dataObject['password'] = data['return_data']['user']['password']; + this.companyForm.patchValue(this.dataObject); + } + }); + } + }); + this.companyForm = this.form.group({ + regionId: [null, [Validators.required]], + name: [null, [Validators.required]], + loginName: [{ value: null, disabled: true}], + address: [null], + phone: [null], + }); + } + + submitFrom() { + this.btnLoading = true; + for (const i in this.companyForm.controls) { + this.companyForm.controls[i].markAsDirty(); + this.companyForm.controls[i].updateValueAndValidity(); + } + if (this.companyForm.status == null || this.companyForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请规范填写所有的必填项信息', + }); + this.btnLoading = false; + return; + } + this.companyForm.value['companyId'] = this.dataObject['id']; + this.companyService.updateCompany(this.companyForm.value, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '修改成功', + nzOnOk: () => this.router.navigateByUrl('admin/company/list') + }); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + this.btnLoading = false; + }); + } + +} diff --git a/src/app/admin/company/company.module.ts b/src/app/admin/company/company.module.ts new file mode 100644 index 0000000..8fb7c22 --- /dev/null +++ b/src/app/admin/company/company.module.ts @@ -0,0 +1,26 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { CompanyRoutingModule } from './company-routing.module'; +import { CompanyAddComponent } from './company-add/company-add.component'; +import { CompanyListComponent } from './company-list/company-list.component'; +import { CompanyUpdateComponent } from './company-update/company-update.component'; +import {NgZorroAntdModule} from 'ng-zorro-antd'; +import {FormsModule, ReactiveFormsModule} from '@angular/forms'; +import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; +import {AppCommonModule} from '../../app-common.module'; + + +@NgModule({ + declarations: [CompanyAddComponent, CompanyListComponent, CompanyUpdateComponent], + imports: [ + CommonModule, + CompanyRoutingModule, + NgZorroAntdModule, + ReactiveFormsModule, + FormsModule, + BreadcrumbModule, + AppCommonModule, + ] +}) +export class CompanyModule { } diff --git a/src/app/admin/device/device-list/device-list.component.html b/src/app/admin/device/device-list/device-list.component.html index 255584a..cf1e3a1 100644 --- a/src/app/admin/device/device-list/device-list.component.html +++ b/src/app/admin/device/device-list/device-list.component.html @@ -7,7 +7,46 @@
+
+ + 设备类型 + + + + + + +
+
+ + 设备编号 + + + + +
+
+ + 设备状态 + + + + + + + +
+
+
+ + 公司 + + + + +
+
代理商 @@ -15,7 +54,7 @@
-
+
业务员 @@ -23,7 +62,7 @@
-
+
商户 @@ -31,7 +70,7 @@
-
+
门店 @@ -39,20 +78,15 @@
-
- - 设备SN号 - - - - -
+ 更多条件 + +
@@ -61,20 +95,11 @@
共计 {{dataObject.total?dataObject.total:0}} 条数据
+ - - - +
@@ -89,13 +114,14 @@ - 设备SN号 + 设备类型 + 设备编号 + 公司 代理商 业务员 商户 门店 - 绑定门店时间 - 状态 + 设备状态 创建时间 创建人 操作 @@ -108,17 +134,13 @@ [nzChecked]="data.checked" (nzCheckedChange)="checkedChange(data, $event)" > - {{data.deviceSn}} + {{data.deviceType | deviceType}} + {{data.deviceNo}} + {{data.companyName?data.companyName:'未分配'}} {{data.agentName?data.agentName:'未分配'}} {{data.salesmanName?data.salesmanName:'未分配'}} - {{data.merName?data.merName:'未绑定'}} - {{data.storeName?data.storeName:'未绑定'}} - - - {{data.storeBindTime | date : 'yyyy-MM-dd HH:mm:ss'}} - - 未绑定 - + {{data.merName?data.merName:'未分配'}} + {{data.storeName?data.storeName:'未分配'}} {{data.status | deviceStatus}} {{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} {{data.opUserName}} @@ -126,8 +148,10 @@ 操作列表
    -
  • 门店绑定
  • -
  • 门店解绑
  • +
  • 门店解绑
  • +
  • 停用
  • +
  • 启用
  • +
  • 删除
@@ -142,20 +166,66 @@ 序号 - 设备SN号 + 设备编号 原因 {{ i + 1}} - {{data.deviceSn}} + {{data.deviceNo}} {{data.errorMessage}} + +
+ + 设备类型 + + + + + + + + 文件 + + + + + + +
+ +
+
+
+ + +
+ + 公司 + + + + + + +
+ +
+
+
+
diff --git a/src/app/admin/device/device-list/device-list.component.scss b/src/app/admin/device/device-list/device-list.component.scss index 690993b..4ca382c 100644 --- a/src/app/admin/device/device-list/device-list.component.scss +++ b/src/app/admin/device/device-list/device-list.component.scss @@ -1,3 +1,7 @@ .table-td-operation a { padding: 0px 5px; } +.collapse { + margin-left: 8px; + font-size: 12px; +} diff --git a/src/app/admin/device/device-list/device-list.component.ts b/src/app/admin/device/device-list/device-list.component.ts index 22a6ceb..10c58ec 100644 --- a/src/app/admin/device/device-list/device-list.component.ts +++ b/src/app/admin/device/device-list/device-list.component.ts @@ -7,6 +7,8 @@ import {AgentService} from '../../../services/agent.service'; import {SalesmanService} from '../../../services/salesman.service'; import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import {NzMessageService, NzModalService} from 'ng-zorro-antd'; +import {CompanyService} from '../../../services/company.service'; +import {CommonsService} from '../../../services/commons.service'; @Component({ selector: 'app-device-list', @@ -32,6 +34,10 @@ export class DeviceListComponent implements OnInit { checkedData = []; + companyDataArray = []; + allocationCompanyModal = false; + allocationCompanyForm: FormGroup; + agentDataArray = []; allocationAgentModal = false; allocationAgentForm: FormGroup; @@ -43,15 +49,25 @@ export class DeviceListComponent implements OnInit { importDeviceErrorModal = false; importDeviceErrorData = []; + importDeviceModal = false; + importDeviceForm: FormGroup; + deviceTypeArray = []; + BTN_IMPORT_DEVICE = false; BTN_DOWN_DEVICE = false; + BTN_COMPANY_ALLOCATION; BTN_AGENT_ALLOCATION; BTN_SALESMAN_ALLOCATION; - BTN_STORE_BIND; BTN_STORE_UNBIND; + BTN_DEVICE_ENABLE; + BTN_DEVICE_DISABLE; + BTN_DEVICE_DEL; + isCollapse = false; constructor(private modal: NzModalService, private message: NzMessageService, + private companyService: CompanyService, + private commonsService: CommonsService, private salesmanService: SalesmanService, private agentService: AgentService, private deviceService: DeviceService, @@ -61,19 +77,45 @@ export class DeviceListComponent implements OnInit { } ngOnInit(): void { - this.BTN_IMPORT_DEVICE = this.store.isBtnCompetence('BTN_import_device'); // 导入设备 按钮权限 - this.BTN_DOWN_DEVICE = this.store.isBtnCompetence('BTN_down_device'); // 下载设备 按钮权限 - this.BTN_AGENT_ALLOCATION = this.store.isBtnCompetence('BTN_agent_allocation'); // 分配代理商 按钮权限 + this.BTN_IMPORT_DEVICE = this.store.isBtnCompetence('BTN_import_device'); // 导入设备 按钮权限 + this.BTN_DOWN_DEVICE = this.store.isBtnCompetence('BTN_down_device'); // 下载设备 按钮权限 + this.BTN_COMPANY_ALLOCATION = this.store.isBtnCompetence('BTN_company_allocation'); // 分配代理商 按钮权限 + this.BTN_AGENT_ALLOCATION = this.store.isBtnCompetence('BTN_agent_allocation'); // 分配代理商 按钮权限 this.BTN_SALESMAN_ALLOCATION = this.store.isBtnCompetence('BTN_salesman_allocation'); // 分配业务员 按钮权限 - this.BTN_STORE_BIND = this.store.isBtnCompetence('BTN_store_bind'); // 门店绑定 按钮权限 - this.BTN_STORE_UNBIND = this.store.isBtnCompetence('BTN_store_unbind'); // 门店解绑 按钮权限 + this.BTN_DEVICE_ENABLE = this.store.isBtnCompetence('BTN_device_enable'); // 启用 按钮权限 + this.BTN_DEVICE_DISABLE = this.store.isBtnCompetence('BTN_device_disable'); // 禁用 按钮权限 + this.BTN_DEVICE_DEL = this.store.isBtnCompetence('BTN_device_del'); // 删除 按钮权限 + this.BTN_STORE_UNBIND = this.store.isBtnCompetence('BTN_store_unbind'); // 门店解绑 按钮权限 this.searchForm = this.form.group({ + companyName: [null], agentName: [null], salesmanName: [null], merName: [null], storeName: [null], - deviceSn: [null], + deviceType: [null], + deviceNo: [null], + status: [null], + }); + + + this.commonsService.getDictionary('DEVICE_TYPE', data => { + this.deviceTypeArray = data['return_data']; + }); + + this.importDeviceForm = this.form.group({ + deviceType: ['1', [Validators.required]], + file: [null], + }); + + + this.allocationCompanyForm = this.form.group({ + companyId: [null, [Validators.required]], + }); + this.companyService.selectCompanyList({ pageNum: 1, pageSize: 999 }, data => { + if (data['return_code'] === '000000') { + this.companyDataArray = data['return_data']['list']; + } }); this.allocationAgentForm = this.form.group({ @@ -136,7 +178,7 @@ export class DeviceListComponent implements OnInit { showDeleteConfirm(data: object): void { this.modal.confirm({ nzTitle: '警告', - nzContent: '是否删除该设备', + nzContent: '是否删除该设备?', nzOkText: '是', nzCancelText: '否', nzOkType: 'danger', @@ -165,7 +207,14 @@ export class DeviceListComponent implements OnInit { * 下载导入设备模板 */ downloadDeviceTemplate() { - window.location.href = environment.imageUrl + '/设备导入模板.xlsx'; + window.location.href = environment.imageUrl + 'template/设备导入模板.xlsx'; + } + + /** + * 打开导入设备模态框 + */ + showImportDevice() { + this.importDeviceModal = true; } /** @@ -173,32 +222,22 @@ export class DeviceListComponent implements OnInit { * @param fileInfo */ importDeviceChange(fileInfo) { - this.loadingObject.spinning = true; - this.loadingObject.msg = '设备导入中...'; if (fileInfo.file.status !== 'uploading') { } if (fileInfo.file.status === 'done') { + this.loadingObject.spinning = false; if (fileInfo.file.response.return_code === '000000') { - this.loadingObject.spinning = false; if (fileInfo.file.response.return_data == null || fileInfo.file.response.return_data.length === 0) { - this.modal.success({ + this.modal.error({ nzTitle: '提示', - nzContent: '成功', - nzOnOk: () => this.requestData(1) + nzContent: '文件上传失败', }); } else { - console.log(fileInfo.file.response.return_data); - this.modal.warning({ - nzTitle: '提示', - nzOkText: '导入失败数据', - nzContent: '只有部分数据导入成功', - nzOnOk: () => this.showDeviceErrorModal(fileInfo.file.response.return_data) - }); + this.importDeviceForm.controls['file'].setValue(fileInfo.file.response.return_data[0]); } } else { - this.loadingObject.spinning = false; this.modal.error({ nzTitle: '提示', nzContent: fileInfo.file.response.return_msg, @@ -213,6 +252,59 @@ export class DeviceListComponent implements OnInit { } } + /** + * 提交导入设备 + */ + submitImportDevice() { + this.loadingObject.spinning = true; + this.loadingObject.msg = '导入中...'; + for (const i in this.importDeviceForm.controls) { + this.importDeviceForm.controls[i].markAsDirty(); + this.importDeviceForm.controls[i].updateValueAndValidity(); + } + if (this.importDeviceForm.value.file == null) { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请上传文件', + }); + this.loadingObject.spinning = false; + return; + } + + if (this.importDeviceForm.status == null || this.importDeviceForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请填写所有的必填项', + }); + this.loadingObject.spinning = false; + return; + } + + this.deviceService.importDevice(this.importDeviceForm.value, data => { + this.loadingObject.spinning = false; + if (data['return_code'] === '000000') { + if (data['return_data'].length === 0) { + this.modal.success({ + nzTitle: '提示', + nzContent: '成功', + nzOnOk: () => this.requestData(1) + }); + } else { + this.modal.warning({ + nzTitle: '提示', + nzOkText: '导入失败数据', + nzContent: '只有部分数据导入成功', + nzOnOk: () => this.showDeviceErrorModal(data['return_data']) + }); + } + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + }); + } /** * 打开模态框 */ @@ -229,6 +321,66 @@ export class DeviceListComponent implements OnInit { this.importDeviceErrorModal = false; } + /** + * 弹出分配代理商模态框 + */ + showDisable(deviceId: number): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否停用该设备?设备停用后无法使用!', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'danger', + nzOnOk: () => this.disable(deviceId) + }); + } + disable(id: number) { + this.deviceService.disableDevice({ deviceId: id}, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '操作成功', + }); + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + }); + } + + /** + * 弹出分配代理商模态框 + */ + showEnable(deviceId: number): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否启用该设备?', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'danger', + nzOnOk: () => this.enable(deviceId) + }); + } + enable(id: number) { + this.deviceService.enableDevice({ deviceId: id}, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '操作成功', + }); + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + }); + } + /** * 弹出分配代理商模态框 */ @@ -263,6 +415,62 @@ export class DeviceListComponent implements OnInit { }); } + /** + * 弹出分配公司模态框 + */ + showAllocationCompanyModal() { + this.allocationCompanyModal = true; + } + + /** + * 关闭分配公司模态框 + */ + closeAllocationCompanyModal() { + this.allocationCompanyModal = false; + } + + /** + * 提交代理商 + */ + submitAllocationCompany() { + for (const i in this.allocationCompanyForm.controls) { + this.allocationCompanyForm.controls[i].markAsDirty(); + this.allocationCompanyForm.controls[i].updateValueAndValidity(); + } + if (this.allocationCompanyForm.status == null || this.allocationCompanyForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请选择公司', + }); + return; + } + if (this.checkedData.length === 0) { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请选择需要分配的设备', + }); + return; + } + this.allocationCompanyForm.value['deviceArray'] = this.checkedData; + this.deviceService.assignCompany(this.allocationCompanyForm.value, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '分配成功', + }); + this.checkedData = []; + this.requestData(this.whereObject['pageNum']); + this.closeAllocationCompanyModal(); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + }); + + } + /** * 弹出分配代理商模态框 */ @@ -391,4 +599,8 @@ export class DeviceListComponent implements OnInit { } } + toggleCollapse(): void { + this.isCollapse = !this.isCollapse; + } + } diff --git a/src/app/admin/device/device-order-list/device-order-list.component.html b/src/app/admin/device/device-order-list/device-order-list.component.html new file mode 100644 index 0000000..6ea1550 --- /dev/null +++ b/src/app/admin/device/device-order-list/device-order-list.component.html @@ -0,0 +1,183 @@ + + + + + + +
+ +
+
+ + 订单号 + + + + +
+
+ + 订单类型 + + + + + + +
+
+ + 设备类型 + + + + + + +
+
+
+
+ + 订单状态 + + + + + + +
+
+ + 公司 + + + + +
+
+ + 代理商 + + + + +
+
+ + 业务员 + + + + +
+
+ + 商户 + + + + +
+
+ + 门店 + + + + +
+
+ +
+
+ + + 更多条件 + + +
+
+ +
+ +
+ 共计 {{dataObject.total?dataObject.total:0}} 条数据 +
+
+ + + + + + 商户 + 门店 + 订单编号 + 订单类型 + 设备类型 + 需求数量 + 支付金额 + 支付方式 + 创建时间 + 支付时间 + 订单状态 + 操作 + + + + + {{data.merName}} + {{data.storeName}} + {{data.orderNo}} + {{data.orderType | deviceOrderType}} + {{data.deviceType | deviceType}} + {{data.deviceNum}} + {{data.payPrice}} + {{data.payType | deviceOrderPayType}} + {{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} + {{data.payTime | date : 'yyyy-MM-dd HH:mm:ss'}} + {{data.status |deviceOrderStatus}} + + 操作列表 + +
    +
  • 设备列表
  • +
+
+ + + +
+
+
+ + + + + 订单类型 + 设备类型 + 设备编号 + 状态 + + + + + {{data.orderType | deviceOrderType}} + {{data.deviceType | deviceType}} + {{data.deviceNo}} + + 使用中 + 退款中 + 已退款 + + + + + diff --git a/src/app/admin/device/device-order-list/device-order-list.component.scss b/src/app/admin/device/device-order-list/device-order-list.component.scss new file mode 100644 index 0000000..4ca382c --- /dev/null +++ b/src/app/admin/device/device-order-list/device-order-list.component.scss @@ -0,0 +1,7 @@ +.table-td-operation a { + padding: 0px 5px; +} +.collapse { + margin-left: 8px; + font-size: 12px; +} diff --git a/src/app/admin/device/device-order-list/device-order-list.component.spec.ts b/src/app/admin/device/device-order-list/device-order-list.component.spec.ts new file mode 100644 index 0000000..6615d93 --- /dev/null +++ b/src/app/admin/device/device-order-list/device-order-list.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DeviceOrderListComponent } from './device-order-list.component'; + +describe('DeviceOrderListComponent', () => { + let component: DeviceOrderListComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ DeviceOrderListComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(DeviceOrderListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/device/device-order-list/device-order-list.component.ts b/src/app/admin/device/device-order-list/device-order-list.component.ts new file mode 100644 index 0000000..57af351 --- /dev/null +++ b/src/app/admin/device/device-order-list/device-order-list.component.ts @@ -0,0 +1,127 @@ +import { Component, OnInit } from '@angular/core'; +import {NzMessageService, NzModalService} from 'ng-zorro-antd'; +import {CommonsService} from '../../../services/commons.service'; +import {LocalStorageService} from '../../../services/local-storage.service'; +import {FormBuilder, FormGroup} from '@angular/forms'; +import {DeviceOrderService} from '../../../services/device-order.service'; +import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; +import {environment} from '../../../../environments/environment'; + +@Component({ + selector: 'app-device-order-list', + templateUrl: './device-order-list.component.html', + styleUrls: ['./device-order-list.component.scss'] +}) +export class DeviceOrderListComponent implements OnInit { +// 角色类型 0:超级管理员 1:公司 2:代理商 3:业务员 4:商户 5:门店 + roleType: number; + + baseUrl = environment.baseUrl; + + loadingObject = { + spinning: false, + msg: '加载中' + }; + + dataObject: any = {}; + tableLoading = true; + searchForm: FormGroup; + pageNum: number; + whereObject: any = {}; + isCollapse = false; + deviceOrderStatusArray = []; + deviceOrderTypeArray = []; + deviceTypeArray = []; + deviceListModal = false; + orderAssignList = []; + + constructor(private modal: NzModalService, + private message: NzMessageService, + private commonsService: CommonsService, + private deviceOrderService: DeviceOrderService, + private store: LocalStorageService, + private form: FormBuilder) { } + + ngOnInit(): void { + this.roleType = this.store.get(ADMIN_INFO_OBJECT)['secRole'].roleType; + + this.searchForm = this.form.group({ + companyName: [null], + agentName: [null], + salesmanName: [null], + merName: [null], + storeName: [null], + orderNo: [null], + orderType: [null], + deviceType: [null], + status: [null], + }); + + this.commonsService.getDictionary('DEVICE_ORDER_TYPE', data => { + this.deviceOrderTypeArray = data['return_data']; + }); + + this.commonsService.getDictionary('DEVICE_ORDER_STATUS', data => { + this.deviceOrderStatusArray = data['return_data']; + }); + + this.commonsService.getDictionary('DEVICE_TYPE', data => { + this.deviceTypeArray = data['return_data']; + }); + + this.requestData(1); + } + + toggleCollapse(): void { + this.isCollapse = !this.isCollapse; + } + + /** + * 请求数据 + */ + requestData(pageNum) { + this.tableLoading = true; + this.whereObject['pageNum'] = pageNum; + this.whereObject['pageSize'] = 10; + this.deviceOrderService.getOrderList(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(); + } + + /** + * 展示设备列表模态框 + */ + showDeviceListModal(dataList: []) { + this.orderAssignList = dataList; + this.deviceListModal = true; + } + + /** + * 关闭设备列表模态框 + */ + closeDeviceListModal() { + this.orderAssignList = []; + this.deviceListModal = false; + } +} diff --git a/src/app/admin/device/device-routing.module.ts b/src/app/admin/device/device-routing.module.ts index f340373..16a22b5 100644 --- a/src/app/admin/device/device-routing.module.ts +++ b/src/app/admin/device/device-routing.module.ts @@ -1,10 +1,12 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import {DeviceListComponent} from './device-list/device-list.component'; +import {DeviceOrderListComponent} from './device-order-list/device-order-list.component'; const routes: Routes = [ - { path: 'list', component: DeviceListComponent} + { path: 'list', component: DeviceListComponent }, + { path: 'order-list', component: DeviceOrderListComponent } ]; @NgModule({ diff --git a/src/app/admin/device/device.module.ts b/src/app/admin/device/device.module.ts index a4e8b4d..d177f39 100644 --- a/src/app/admin/device/device.module.ts +++ b/src/app/admin/device/device.module.ts @@ -7,10 +7,11 @@ import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; import {AppCommonModule} from '../../app-common.module'; import {NgZorroAntdModule} from 'ng-zorro-antd'; import {FormsModule, ReactiveFormsModule} from '@angular/forms'; +import { DeviceOrderListComponent } from './device-order-list/device-order-list.component'; @NgModule({ - declarations: [DeviceListComponent], + declarations: [DeviceListComponent, DeviceOrderListComponent], imports: [ CommonModule, DeviceRoutingModule, diff --git a/src/app/admin/pay-qr-code/pay-qr-code-list/pay-qr-code-list.component.html b/src/app/admin/pay-qr-code/pay-qr-code-list/pay-qr-code-list.component.html index 116eed0..e706aea 100644 --- a/src/app/admin/pay-qr-code/pay-qr-code-list/pay-qr-code-list.component.html +++ b/src/app/admin/pay-qr-code/pay-qr-code-list/pay-qr-code-list.component.html @@ -7,7 +7,17 @@
-
+
+ + 公司 + + + + + + +
+
代理商 @@ -17,7 +27,7 @@
-
+
业务员 @@ -27,7 +37,7 @@
-
+
商户 @@ -35,7 +45,7 @@
-
+
门店 @@ -52,7 +62,19 @@
-
+
+ + 是否分配公司 + + + + + + + +
+ +
是否分配代理商 @@ -64,7 +86,7 @@
-
+
是否分配业务员 @@ -76,7 +98,7 @@
-
+
是否分配门店 @@ -102,6 +124,7 @@ 共计 {{dataObject.total?dataObject.total:0}} 条数据
+
@@ -120,6 +143,7 @@ 序列号 二维码 + 公司 代理商 业务员 商户 @@ -142,6 +166,7 @@ + {{data.companyName?data.companyName:'未分配'}} {{data.agentName?data.agentName:'未分配'}} {{data.salesmanName?data.salesmanName:'未分配'}} {{data.merName?data.merName:'未绑定'}} @@ -187,6 +212,22 @@ + +
+ + 公司 + + + + + + +
+ +
+
+
+
diff --git a/src/app/admin/pay-qr-code/pay-qr-code-list/pay-qr-code-list.component.ts b/src/app/admin/pay-qr-code/pay-qr-code-list/pay-qr-code-list.component.ts index 3528599..d7d2e6e 100644 --- a/src/app/admin/pay-qr-code/pay-qr-code-list/pay-qr-code-list.component.ts +++ b/src/app/admin/pay-qr-code/pay-qr-code-list/pay-qr-code-list.component.ts @@ -7,6 +7,7 @@ import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; import {PayQrCodeService} from '../../../services/pay-qr-code.service'; import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import {NzMessageService, NzModalService} from 'ng-zorro-antd'; +import {CompanyService} from '../../../services/company.service'; @Component({ selector: 'app-pay-qr-code-list', @@ -14,8 +15,8 @@ import {NzMessageService, NzModalService} from 'ng-zorro-antd'; styleUrls: ['./pay-qr-code-list.component.scss'] }) export class PayQrCodeListComponent implements OnInit { - // 角色类型 0:超级管理员 1:公司 2:代理商 3:业务员 4:商户 5:门店 - roleType: number; + // 用户类型 0:超级管理员 1:公司 2:代理商 3:业务员 4:商户 5:门店 + userType: number; baseUrl = environment.baseUrl; @@ -36,6 +37,10 @@ export class PayQrCodeListComponent implements OnInit { generatePayQrCodeModal = false; generatePayQrCodeForm: FormGroup; + companyDataArray = []; + allocationCompanyModal = false; + allocationCompanyForm: FormGroup; + agentDataArray = []; allocationAgentModal = false; allocationAgentForm: FormGroup; @@ -45,6 +50,7 @@ export class PayQrCodeListComponent implements OnInit { allocationSalesmanForm: FormGroup; BTN_QRCODE_GENERATE = false; + BTN_QRCODE_COMPANY = false; BTN_QRCODE_AGENT = false; BTN_QRCODE_SALESMAN = false; BTN_QRCODE_DISABLED = false; @@ -53,16 +59,18 @@ export class PayQrCodeListComponent implements OnInit { constructor(private modal: NzModalService, private message: NzMessageService, - private salesmanService: SalesmanService, + private companyService: CompanyService, private agentService: AgentService, + private salesmanService: SalesmanService, private payQrCodeService: PayQrCodeService, private store: LocalStorageService, private form: FormBuilder) { - this.roleType = Number(this.store.get(ADMIN_INFO_OBJECT)['secRole'].roleType); + this.userType = Number(this.store.get(ADMIN_INFO_OBJECT)['secUser']['objectType']); } ngOnInit(): void { this.BTN_QRCODE_GENERATE = this.store.isBtnCompetence('BTN_QRCODE_GENERATE'); // 生成二维码 按钮权限 + this.BTN_QRCODE_COMPANY = this.store.isBtnCompetence('BTN_QRCODE_COMPANY'); // 分配代理商 按钮权限 this.BTN_QRCODE_AGENT = this.store.isBtnCompetence('BTN_QRCODE_AGENT'); // 分配代理商 按钮权限 this.BTN_QRCODE_SALESMAN = this.store.isBtnCompetence('BTN_QRCODE_SALESMAN'); // 分配业务员 按钮权限 this.BTN_QRCODE_DISABLED = this.store.isBtnCompetence('BTN_QRCODE_DISABLED'); // 二维码禁用 按钮权限 @@ -70,11 +78,13 @@ export class PayQrCodeListComponent implements OnInit { this.BTN_QRCODE_STORE_UNBIND = this.store.isBtnCompetence('BTN_QRCODE_STORE_UNBIND'); // 二维码门店解绑 按钮权限 this.searchForm = this.form.group({ + companyId: [null], agentId: [null], salesmanId: [null], merName: [null], storeName: [null], serialNumber: [null], + isAssignCompany: [null], isAssignAgent: [null], isAssignSalesman: [null], isAssignStore: [null], @@ -84,6 +94,10 @@ export class PayQrCodeListComponent implements OnInit { generateNum: [50, [Validators.required]], }); + this.allocationCompanyForm = this.form.group({ + companyId: [null, [Validators.required]], + }); + this.allocationAgentForm = this.form.group({ agentId: [null, [Validators.required]], }); @@ -97,7 +111,13 @@ export class PayQrCodeListComponent implements OnInit { salesmanId: [null, [Validators.required]], }); - if (this.roleType === 2) { + if (this.userType === 0) { + this.companyService.selectCompanyList({pageNum: 1, pageSize: 999 }, data => { + if (data['return_code'] === '000000') { + this.companyDataArray = data['return_data']['list']; + } + }); + } else if (this.userType === 2) { this.salesmanService.querySalesmanListByAgent({ status: 1, pageNum: 1, pageSize: 999 }, data => { if (data['return_code'] === '000000') { this.salesmanDataArray = data['return_data']['list']; @@ -121,7 +141,7 @@ export class PayQrCodeListComponent implements OnInit { let checkoutNum = 0; for (const dataObject of this.dataObject['list']) { - dataObject['disabled'] = ((this.roleType === 1 && dataObject.agentId != null) || (this.roleType === 2 && dataObject.salesmanId != null)); + dataObject['disabled'] = ((this.userType === 1 && dataObject.agentId != null) || (this.userType === 2 && dataObject.salesmanId != null)); if (this.checkedData.find(o => Number(o['id']) === Number(dataObject['id'])) != null) { checkoutNum++; dataObject['checked'] = true; @@ -303,6 +323,62 @@ export class PayQrCodeListComponent implements OnInit { }); } + /** + * 弹出分配代理商模态框 + */ + showAllocationCompanyModal() { + this.allocationCompanyModal = true; + } + + /** + * 关闭分配代理商模态框 + */ + closeAllocationCompanyModal() { + this.allocationCompanyModal = false; + } + + /** + * 提交代理商 + */ + submitAllocationCompany() { + for (const i in this.allocationCompanyForm.controls) { + this.allocationCompanyForm.controls[i].markAsDirty(); + this.allocationCompanyForm.controls[i].updateValueAndValidity(); + } + if (this.allocationCompanyForm.status == null || this.allocationCompanyForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请选择公司', + }); + return; + } + if (this.checkedData.length === 0) { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请选择需要分配的二维码', + }); + return; + } + this.allocationCompanyForm.value['qrCodeArray'] = this.checkedData; + this.payQrCodeService.assignCompany(this.allocationCompanyForm.value, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '分配成功', + }); + this.checkedData = []; + this.requestData(this.whereObject['pageNum']); + this.closeAllocationCompanyModal(); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + }); + + } + /** * 弹出分配代理商模态框 */ @@ -462,7 +538,7 @@ export class PayQrCodeListComponent implements OnInit { */ agentChange(agentId: number) { if (agentId != null) { - this.salesmanService.getSalesmanList({ agentId, pageNum: 1, pageSize: 9999}, data => { + this.salesmanService.querySalesmanList({ agentId, pageNum: 1, pageSize: 9999}, data => { this.salesmanDataArray = data['return_data']['list']; }); } else { diff --git a/src/app/admin/salesman/salesman-list/salesman-list.component.html b/src/app/admin/salesman/salesman-list/salesman-list.component.html index 32a8621..34e5a55 100644 --- a/src/app/admin/salesman/salesman-list/salesman-list.component.html +++ b/src/app/admin/salesman/salesman-list/salesman-list.component.html @@ -6,6 +6,26 @@
+
+ + 分公司 + + + + + + +
+
+ + 代理商 + + + + + + +
姓名 @@ -62,6 +82,8 @@ 序号 + 分公司 + 代理商名称 姓名 联系电话 状态 @@ -72,6 +94,8 @@ {{i + 1}} + {{data.companyName}} + {{data.agentName}} {{data.name}} {{data.phone}} {{data.status | salesmanStatus}} diff --git a/src/app/admin/salesman/salesman-list/salesman-list.component.ts b/src/app/admin/salesman/salesman-list/salesman-list.component.ts index 4640abe..21168c0 100644 --- a/src/app/admin/salesman/salesman-list/salesman-list.component.ts +++ b/src/app/admin/salesman/salesman-list/salesman-list.component.ts @@ -2,6 +2,10 @@ import { Component, OnInit } from '@angular/core'; import {SalesmanService} from '../../../services/salesman.service'; import {FormBuilder, FormGroup} from '@angular/forms'; import {NzMessageService, NzModalService} from 'ng-zorro-antd'; +import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; +import {LocalStorageService} from '../../../services/local-storage.service'; +import {CompanyService} from '../../../services/company.service'; +import {AgentService} from '../../../services/agent.service'; @Component({ selector: 'app-salesman-list', @@ -16,13 +20,29 @@ export class SalesmanListComponent implements OnInit { pageNum: number; whereObject: any = {}; + userObjectType: number; + companyArray = []; + agentArray = []; + constructor(private modal: NzModalService, private message: NzMessageService, private salesmanService: SalesmanService, - private form: FormBuilder) { } + private agentService: AgentService, + private companyService: CompanyService, + private localStorageService: LocalStorageService, + private form: FormBuilder) { + this.userObjectType = Number(this.localStorageService.get(ADMIN_INFO_OBJECT)['secUser']['objectType']); + } ngOnInit(): void { + if (this.userObjectType != null && this.userObjectType === 0) { + this.getCompanyList(); + } else if (this.userObjectType != null && this.userObjectType === 1) { + this.getAgentList(this.localStorageService.get(ADMIN_INFO_OBJECT)['bsCompany']['id']); + } this.searchForm = this.form.group({ + companyId: [null], + agentId: [null], name: [null], phone: [null], status: [null], @@ -30,6 +50,32 @@ export class SalesmanListComponent implements OnInit { this.requestData(1); } + /** + * 获取公司列表 + */ + getCompanyList() { + this.companyService.selectCompanyList({pageNum: 1, pageSize: 99 }, data => { + if (data['return_code'] === '000000') { + this.companyArray = data['return_data']['list']; + } else { + this.modal.error(data['return_msg']); + } + }); + } + + /** + * 获取代理商列表 + */ + getAgentList(companyId: number) { + this.agentService.queryAgentList({ companyId: companyId, pageNum: 1, pageSize: 99 }, data => { + if (data['return_code'] === '000000') { + this.agentArray = data['return_data']['list']; + } else { + this.modal.error(data['return_msg']); + } + }); + } + /** * 请求数据 */ @@ -37,7 +83,7 @@ export class SalesmanListComponent implements OnInit { this.tableLoading = true; this.whereObject['pageNum'] = pageNum; this.whereObject['pageSize'] = 10; - this.salesmanService.querySalesmanListByAgent(this.whereObject, data => { + this.salesmanService.querySalesmanList(this.whereObject, data => { if (data['return_code'] === '000000') { this.dataObject = data['return_data']; } else { diff --git a/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.html b/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.html new file mode 100644 index 0000000..76bcf4d --- /dev/null +++ b/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.html @@ -0,0 +1,70 @@ + + + + 优惠活动 + + + 配置活动 + + + + + + + + + 门店 + + + + + + + + + 优惠活动名称 + + + + + + + 优惠券类型 + + + + + + + + + + + 满减条件金额 + + + + + + + {{dataForm.value.discountType === '3' ? '优惠折扣' : '优惠金额'}} + + + + + + + 活动结束时间 + + + + + + + + + + + + + diff --git a/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.scss b/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.scss new file mode 100644 index 0000000..d3d16c1 --- /dev/null +++ b/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.scss @@ -0,0 +1,6 @@ +nz-date-picker { + width: 100%; +} +.register-are { + margin-bottom: 8px; +} diff --git a/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.spec.ts b/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.spec.ts new file mode 100644 index 0000000..812d39f --- /dev/null +++ b/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { StoreDiscountActivityEditComponent } from './store-discount-activity-edit.component'; + +describe('StoreDiscountActivityEditComponent', () => { + let component: StoreDiscountActivityEditComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ StoreDiscountActivityEditComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(StoreDiscountActivityEditComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.ts b/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.ts new file mode 100644 index 0000000..88e1c01 --- /dev/null +++ b/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.ts @@ -0,0 +1,85 @@ +import { Component, OnInit } from '@angular/core'; +import {FormBuilder, FormGroup, Validators} from '@angular/forms'; +import {NzModalService} from 'ng-zorro-antd'; +import {ActivatedRoute, Router} from '@angular/router'; +import {ValidatorsService} from '../../../services/validators.service'; +import {StoreDiscountActivityService} from '../../../services/store-discount-activity.service'; +import {StoreService} from '../../../services/store.service'; +import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; + +@Component({ + selector: 'app-store-discount-activity-edit', + templateUrl: './store-discount-activity-edit.component.html', + styleUrls: ['./store-discount-activity-edit.component.scss'] +}) +export class StoreDiscountActivityEditComponent implements OnInit { + + dataForm: FormGroup; + btnLoading = false; + + storeArray = []; + + constructor(private form: FormBuilder, + private modal: NzModalService, + private storeDiscountActivityService: StoreDiscountActivityService, + private storeService: StoreService, + private activatedRoute: ActivatedRoute, + private router: Router) { } + + ngOnInit(): void { + this.dataForm = this.form.group({ + id: [null], + storeId: [null, [Validators.required]], + name: [null, [Validators.required]], + discountType: [1, [Validators.required]], + discountCondition: [0, [Validators.required]], + discountPrice: [0, [Validators.required]], + endTime: [null, [Validators.required]], + }); + + this.activatedRoute.queryParams.subscribe(queryParams => { + if (queryParams['id'] != null) { + this.storeDiscountActivityService.getActivityDetail(queryParams['id'], data => { + data['return_data']['storeId'] = String(data['return_data']['storeId']); + data['return_data']['discountType'] = String(data['return_data']['discountType']); + this.dataForm.patchValue(data['return_data']); + }); + } + }); + + this.storeService.getStoreList({pageNum: 1, pageSize: 99999}, data => { + this.storeArray = data['return_data']['list']; + }); + } + + submitFrom() { + this.btnLoading = true; + for (const i in this.dataForm.controls) { + this.dataForm.controls[i].markAsDirty(); + this.dataForm.controls[i].updateValueAndValidity(); + } + if (this.dataForm.status == null || this.dataForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请规范填写所有的必填项信息', + }); + return; + } + this.storeDiscountActivityService.configActivity(this.dataForm.value, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '提交成功', + nzOnOk: () => this.router.navigateByUrl('admin/store-discount-activity/list') + }); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + this.btnLoading = false; + }); + } + +} diff --git a/src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.html b/src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.html new file mode 100644 index 0000000..da350f3 --- /dev/null +++ b/src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.html @@ -0,0 +1,112 @@ + + + + + +
+
+
+
+ + 活动名称 + + + + +
+
+ + 参与门店 + + + + +
+
+ + 状态 + + + + + + + + +
+
+
+
+ + +
+
+
+
+ +
+ 共计 {{dataObject.total?dataObject.total:0}} 条数据 +
+ +
+ + + + + + 序号 + 参与门店 + 优惠名称 + 优惠类型 + 参与优惠条件 + 优惠金额 + 结束时间 + 优惠状态 + 创建时间 + 操作 + + + + + {{i + 1}} + {{data.storeName}} + {{data.name}} + + 满减 + 立减 + 折扣 + + ¥ {{data.discountCondition}} + ¥ {{data.discountPrice}} + {{data.endTime | date : 'yyyy-MM-dd HH:mm:ss'}} + + 编辑中 + 进行中 + 已结束 + + {{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} + + 操作列表 + + + + + + + +
+ diff --git a/src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.scss b/src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.spec.ts b/src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.spec.ts new file mode 100644 index 0000000..ff78526 --- /dev/null +++ b/src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { StoreDiscountActivityListComponent } from './store-discount-activity-list.component'; + +describe('StoreDiscountActivityListComponent', () => { + let component: StoreDiscountActivityListComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ StoreDiscountActivityListComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(StoreDiscountActivityListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.ts b/src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.ts new file mode 100644 index 0000000..214df99 --- /dev/null +++ b/src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.ts @@ -0,0 +1,172 @@ +import { Component, OnInit } from '@angular/core'; +import {FormBuilder, FormGroup, Validators} from '@angular/forms'; +import {ActivatedRoute} from '@angular/router'; +import {LocalStorageService} from '../../../services/local-storage.service'; +import {NzMessageService, NzModalService} from 'ng-zorro-antd'; +import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; +import {StoreDiscountActivityService} from '../../../services/store-discount-activity.service'; + +@Component({ + selector: 'app-store-discount-activity-list', + templateUrl: './store-discount-activity-list.component.html', + styleUrls: ['./store-discount-activity-list.component.scss'] +}) +export class StoreDiscountActivityListComponent implements OnInit { + dataObject: any = {}; + storeId: number; + tableLoading = true; + searchForm: FormGroup; + pageNum: number; + whereObject: any = {}; + + BTN_STORE_DISCOUNT_ACTIVITY_ADD = false; + BTN_STORE_DISCOUNT_ACTIVITY_UPDATE = false; + BTN_STORE_DISCOUNT_ACTIVITY_DEL = false; + + constructor(private activatedRoute: ActivatedRoute, + private store: LocalStorageService, // 数据请求 + private modal: NzModalService, + private message: NzMessageService, + private storeDiscountActivityService: StoreDiscountActivityService, + private form: FormBuilder) { } + + ngOnInit(): void { + this.BTN_STORE_DISCOUNT_ACTIVITY_ADD = this.store.isBtnCompetence('BTN_STORE_DISCOUNT_ACTIVITY_ADD'); // 增加按钮权限 + this.BTN_STORE_DISCOUNT_ACTIVITY_UPDATE = this.store.isBtnCompetence('BTN_STORE_DISCOUNT_ACTIVITY_UPDATE'); // 修改按钮权限 + this.BTN_STORE_DISCOUNT_ACTIVITY_DEL = this.store.isBtnCompetence('BTN_STORE_DISCOUNT_ACTIVITY_DEL'); // 删除按钮权限 + + + this.searchForm = this.form.group({ + name: [null], + status: [null], + }); + this.requestData(1); + } + + /** + * 请求数据 + */ + requestData(pageNum) { + this.tableLoading = true; + this.whereObject['storeId'] = this.storeId; + this.whereObject['pageNum'] = pageNum; + this.whereObject['pageSize'] = 10; + this.storeDiscountActivityService.getActivityList(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(); + } + + /** + * 弹出上线对话框 + */ + showUpOnlineConfirm(id: number): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否删除优惠活动?
', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'danger', + nzOnOk: () => this.upOnline(id) + }); + } + + /** + * 活动上线数据 + * + */ + upOnline(id: number) { + this.storeDiscountActivityService.upOnline(id, data => { + if (data['return_code'] === '000000') { + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'] + }); + } + }); + } + + /** + * 弹出活动下线对话框 + */ + showLowerOnlineConfirm(id: number): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否删除优惠活动?
', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'danger', + nzOnOk: () => this.lowerOnline(id) + }); + } + + /** + * 活动下线数据 + * + */ + lowerOnline(id: number) { + this.storeDiscountActivityService.lowerOnline(id, data => { + if (data['return_code'] === '000000') { + this.requestData(this.whereObject['pageNum']); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'] + }); + } + }); + } + + /** + * 弹出删除对话框 + */ + showDelConfirm(id: number): void { + this.modal.confirm({ + nzTitle: '警告', + nzContent: '是否删除优惠活动?
', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'danger', + nzOnOk: () => this.delete(id) + }); + } + + /** + * 删除数据 + * + */ + delete(id: number) { + this.storeDiscountActivityService.delete(id, 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/store-discount-activity/store-discount-activity-routing.module.ts b/src/app/admin/store-discount-activity/store-discount-activity-routing.module.ts new file mode 100644 index 0000000..767b998 --- /dev/null +++ b/src/app/admin/store-discount-activity/store-discount-activity-routing.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import {StoreDiscountActivityListComponent} from './store-discount-activity-list/store-discount-activity-list.component'; +import {StoreDiscountActivityEditComponent} from './store-discount-activity-edit/store-discount-activity-edit.component'; + + +const routes: Routes = [ + { path: 'list', component: StoreDiscountActivityListComponent }, + { path: 'edit', component: StoreDiscountActivityEditComponent }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class StoreDiscountActivityRoutingModule { } diff --git a/src/app/admin/store-discount-activity/store-discount-activity.module.ts b/src/app/admin/store-discount-activity/store-discount-activity.module.ts new file mode 100644 index 0000000..7071f47 --- /dev/null +++ b/src/app/admin/store-discount-activity/store-discount-activity.module.ts @@ -0,0 +1,25 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { StoreDiscountActivityRoutingModule } from './store-discount-activity-routing.module'; +import { StoreDiscountActivityListComponent } from './store-discount-activity-list/store-discount-activity-list.component'; +import { StoreDiscountActivityEditComponent } from './store-discount-activity-edit/store-discount-activity-edit.component'; +import {NgZorroAntdModule} from 'ng-zorro-antd'; +import {FormsModule, ReactiveFormsModule} from '@angular/forms'; +import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; +import {AppCommonModule} from '../../app-common.module'; + + +@NgModule({ + declarations: [StoreDiscountActivityListComponent, StoreDiscountActivityEditComponent], + imports: [ + CommonModule, + StoreDiscountActivityRoutingModule, + NgZorroAntdModule, + ReactiveFormsModule, + FormsModule, + BreadcrumbModule, + AppCommonModule, + ] +}) +export class StoreDiscountActivityModule { } diff --git a/src/app/admin/store/store-list/store-list.component.html b/src/app/admin/store/store-list/store-list.component.html index b9c7bdb..b3cbb60 100644 --- a/src/app/admin/store/store-list/store-list.component.html +++ b/src/app/admin/store/store-list/store-list.component.html @@ -56,13 +56,13 @@ 序号 - 门店号 - 门店名称 + 门店号 + 门店名称 联系电话 门店地址 状态 创建时间 - 操作 + 操作 diff --git a/src/app/admin/store/store-list/store-list.component.ts b/src/app/admin/store/store-list/store-list.component.ts index 0c22a50..bc44810 100644 --- a/src/app/admin/store/store-list/store-list.component.ts +++ b/src/app/admin/store/store-list/store-list.component.ts @@ -36,8 +36,6 @@ export class StoreListComponent implements OnInit { this.activatedRoute.queryParams.subscribe((queryParams: Params) => { if (queryParams['merId'] != null && queryParams['merId'].length > 0) { this.whereObject['merId'] = queryParams['merId']; - } else { - this.whereObject['merId'] = this.store.get(ADMIN_INFO_OBJECT)['mer']['id']; } this.requestData(1); }); @@ -50,7 +48,7 @@ export class StoreListComponent implements OnInit { this.tableLoading = true; this.whereObject['pageNum'] = pageNum; this.whereObject['pageSize'] = 10; - this.storeService.getStoreListByMer(this.whereObject, data => { + this.storeService.getStoreList(this.whereObject, data => { if (data['return_code'] === '000000') { this.dataObject = data['return_data']; } else { diff --git a/src/app/app-common.module.ts b/src/app/app-common.module.ts index 9574a20..84486af 100644 --- a/src/app/app-common.module.ts +++ b/src/app/app-common.module.ts @@ -22,8 +22,10 @@ import { CardTypePipe, MerStatusPipe, CompleteStatusPipe, - MerTypePipe, DeviceStatusPipe, PlatformTypePipe, + MerTypePipe, DeviceStatusPipe, PlatformTypePipe, DeviceTypePipe, DeviceOrderTypePipe, } from './pipes'; +import {DeviceOrderStatusPipe} from './pipes/device/device-order-status.pipe'; +import {DeviceOrderPayTypePipe} from './pipes/device/device-order-pay-type.pipe'; const PIPES = [ TimesPipe, @@ -40,6 +42,10 @@ const PIPES = [ MerTypePipe, CompleteStatusPipe, DeviceStatusPipe, + DeviceTypePipe, + DeviceOrderTypePipe, + DeviceOrderStatusPipe, + DeviceOrderPayTypePipe, PlatformTypePipe ]; diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 4682723..6c82736 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -28,6 +28,11 @@ const routes: Routes = [ loadChildren: () => import('./admin/pay-qr-code/pay-qr-code.module').then(m => m.PayQrCodeModule), canActivate: [InitGuardService] }, + { + path: 'company', + loadChildren: () => import('./admin/company/company.module').then(m => m.CompanyModule), + canActivate: [InitGuardService] + }, { path: 'agent', loadChildren: () => import('./admin/agent/agent.module').then(m => m.AgentModule), @@ -53,6 +58,11 @@ const routes: Routes = [ loadChildren: () => import('./admin/store-device/store-device.module').then(m => m.StoreDeviceModule), canActivate: [InitGuardService] }, + { + path: 'store-discount-activity', + loadChildren: () => import('./admin/store-discount-activity/store-discount-activity.module').then(m => m.StoreDiscountActivityModule), + canActivate: [InitGuardService] + }, { path: 'salesman', loadChildren: () => import('./admin/salesman/salesman.module').then(m => m.SalesmanModule), diff --git a/src/app/pipes/device/device-order-pay-type.pipe.ts b/src/app/pipes/device/device-order-pay-type.pipe.ts new file mode 100644 index 0000000..3219f8b --- /dev/null +++ b/src/app/pipes/device/device-order-pay-type.pipe.ts @@ -0,0 +1,17 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'deviceOrderPayType' +}) +export class DeviceOrderPayTypePipe implements PipeTransform { + + transform(type: number): string { + switch (type) { + case 1: + return '微信'; + default: + return '未知'; + } + } + +} diff --git a/src/app/pipes/device/device-order-status.pipe.ts b/src/app/pipes/device/device-order-status.pipe.ts new file mode 100644 index 0000000..7ca117b --- /dev/null +++ b/src/app/pipes/device/device-order-status.pipe.ts @@ -0,0 +1,22 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'deviceOrderStatus' +}) +export class DeviceOrderStatusPipe implements PipeTransform { + + transform(status: number): string { + switch (status) { + case 1: + return '待支付'; + case 2: + return '已支付'; + case 3: + return '已完成'; + case 4: + return '已退款'; + default: + return '未知'; + } + } +} diff --git a/src/app/pipes/device/device-order-type.pipe.ts b/src/app/pipes/device/device-order-type.pipe.ts new file mode 100644 index 0000000..12698d1 --- /dev/null +++ b/src/app/pipes/device/device-order-type.pipe.ts @@ -0,0 +1,19 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'deviceOrderType' +}) +export class DeviceOrderTypePipe implements PipeTransform { + + transform(type: number): string { + switch (type) { + case 1: + return '押金'; + case 2: + return '购买'; + default: + return '未知'; + } + } + +} diff --git a/src/app/pipes/device/device-type.pipe.ts b/src/app/pipes/device/device-type.pipe.ts new file mode 100644 index 0000000..49f7c79 --- /dev/null +++ b/src/app/pipes/device/device-type.pipe.ts @@ -0,0 +1,17 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'deviceType' +}) +export class DeviceTypePipe implements PipeTransform { + + transform(statusNum: number): string { + switch (statusNum) { + case 1: + return '4G收款音响'; + default: + return '未知'; + } + } + +} diff --git a/src/app/pipes/index.ts b/src/app/pipes/index.ts index 4202a68..e575872 100644 --- a/src/app/pipes/index.ts +++ b/src/app/pipes/index.ts @@ -13,3 +13,8 @@ export * from './mer/mer-type.pipe'; export * from './mer/complete-status.pipe'; export * from './device/device-status.pipe'; export * from './platform-type.pipe'; +export * from './device/device-type.pipe'; +export * from './device/device-order-type.pipe'; +export * from './device/device-order-status.pipe'; +export * from './device/device-order-pay-type.pipe'; + diff --git a/src/app/services/commons.service.ts b/src/app/services/commons.service.ts index 07a56bb..6915562 100644 --- a/src/app/services/commons.service.ts +++ b/src/app/services/commons.service.ts @@ -97,6 +97,16 @@ export class CommonsService { }); } + /** + * 获取全部省地区数据 + * @param callBack 回调 + */ + public getProvinceList(callBack) { + this.http.get(environment.baseUrl + 'common/getProvinceList').subscribe(data => { + callBack(data); + }); + } + /** * 获取所有 省 市 区 * @param callBack 回调 diff --git a/src/app/services/company.service.ts b/src/app/services/company.service.ts new file mode 100644 index 0000000..aabfa19 --- /dev/null +++ b/src/app/services/company.service.ts @@ -0,0 +1,60 @@ +import { Injectable } from '@angular/core'; +import {HttpClient} from '@angular/common/http'; +import {environment} from '../../environments/environment'; +import {CommonsService} from './commons.service'; + +@Injectable({ + providedIn: 'root' +}) +export class CompanyService { + + constructor( + private http: HttpClient, + private commonsService: CommonsService, + ) { } + + /** + * 增加公司 + * @param paramObject 参数 + * @param callBack + */ + insertCompany(paramObject: object, callBack) { + this.http.post(environment.baseUrl + 'bsCompany/insert', paramObject).subscribe(data => { + callBack(data); + }); + } + + /** + * 修改公司 + * @param paramObject 参数 + * @param callBack + */ + updateCompany(paramObject: object, callBack) { + this.http.post(environment.baseUrl + 'bsCompany/update', paramObject).subscribe(data => { + callBack(data); + }); + } + + /** + * 获取公司列表 + * @param paramObject 参数 + * @param callBack + */ + selectCompanyList(paramObject: object, callBack) { + this.http.get(environment.baseUrl + 'bsCompany/selectCompanyList?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => { + callBack(data); + }); + } + + /** + * 公司详情 + * @param paramObject 参数 + * @param callBack + */ + companyView(companyId: number, callBack) { + this.http.get(environment.baseUrl + 'bsCompany/companyView?companyId=' + companyId).subscribe(data => { + callBack(data); + }); + } + +} diff --git a/src/app/services/device-order.service.ts b/src/app/services/device-order.service.ts new file mode 100644 index 0000000..b185451 --- /dev/null +++ b/src/app/services/device-order.service.ts @@ -0,0 +1,48 @@ +import { Injectable } from '@angular/core'; +import {HttpClient} from '@angular/common/http'; +import {CommonsService} from './commons.service'; +import {environment} from '../../environments/environment'; + +@Injectable({ + providedIn: 'root' +}) +export class DeviceOrderService { + + constructor( + private http: HttpClient, + private commonsService: CommonsService + ) { } + + /** + * 分配设备订单 + * @param paramObject 参数 + * @param callBack + */ + assignOrder(paramObject: object, callBack) { + this.http.post(environment.baseUrl + 'deviceOrder/assignOrder?orderNo', paramObject).subscribe(data => { + callBack(data); + }); + } + + /** + * 设备订单详情 + * @param paramObject 参数 + * @param callBack + */ + getOrderDetail(orderNo: string, callBack) { + this.http.get(environment.baseUrl + 'deviceOrder/getOrderDetail?orderNo' + orderNo).subscribe(data => { + callBack(data); + }); + } + + /** + * 设备订单列表 + * @param paramObject 参数 + * @param callBack + */ + getOrderList(paramObject: object, callBack) { + this.http.get(environment.baseUrl + 'deviceOrder/getOrderList?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => { + callBack(data); + }); + } +} diff --git a/src/app/services/device.service.ts b/src/app/services/device.service.ts index 4d97668..5793c6b 100644 --- a/src/app/services/device.service.ts +++ b/src/app/services/device.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import {CommonsService} from './commons.service'; import {environment} from '../../environments/environment'; -import {HttpClient} from "@angular/common/http"; +import {HttpClient} from '@angular/common/http'; @Injectable({ providedIn: 'root' @@ -13,6 +13,28 @@ export class DeviceService { private commonsService: CommonsService ) { } + /** + * 导入设备 + * @param paramObject 参数 + * @param callBack + */ + importDevice(paramObject: object, callBack) { + this.http.post(environment.baseUrl + 'device/importDevice', paramObject).subscribe(data => { + callBack(data); + }); + } + + /** + * 分配公司 + * @param paramObject 参数 + * @param callBack + */ + assignCompany(paramObject: object, callBack) { + this.http.post(environment.baseUrl + 'device/assignCompany', paramObject).subscribe(data => { + callBack(data); + }); + } + /** * 分配代理商 * @param paramObject 参数 @@ -67,4 +89,27 @@ export class DeviceService { callBack(data); }); } + + /** + * 启用设备 + * @param paramObject 参数 + * @param callBack + */ + enableDevice(paramObject: object, callBack) { + this.http.post(environment.baseUrl + 'device/enableDevice', paramObject).subscribe(data => { + callBack(data); + }); + } + + /** + * 停用设备 + * @param paramObject 参数 + * @param callBack + */ + disableDevice(paramObject: object, callBack) { + this.http.post(environment.baseUrl + 'device/disableDevice', paramObject).subscribe(data => { + callBack(data); + }); + } + } diff --git a/src/app/services/pay-qr-code.service.ts b/src/app/services/pay-qr-code.service.ts index 18d6b65..944f4dc 100644 --- a/src/app/services/pay-qr-code.service.ts +++ b/src/app/services/pay-qr-code.service.ts @@ -24,6 +24,16 @@ export class PayQrCodeService { }); } + /** + * 分配公司 + * @param paramObject 参数 + * @param callBack + */ + assignCompany(param: object, callBack) { + this.http.post(environment.baseUrl + 'payQrCode/assignCompany', param).subscribe(data => { + callBack(data); + }); + } /** * 分配代理商 diff --git a/src/app/services/salesman.service.ts b/src/app/services/salesman.service.ts index 3fcaf74..af17159 100644 --- a/src/app/services/salesman.service.ts +++ b/src/app/services/salesman.service.ts @@ -84,8 +84,8 @@ export class SalesmanService { * @param paramObject 参数 * @param callBack */ - getSalesmanList(paramObject: object, callBack) { - this.http.get(environment.baseUrl + 'salesman/getSalesmanList?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => { + querySalesmanList(paramObject: object, callBack) { + this.http.get(environment.baseUrl + 'salesman/querySalesmanList?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => { callBack(data); }); } diff --git a/src/app/services/store-discount-activity.service.ts b/src/app/services/store-discount-activity.service.ts new file mode 100644 index 0000000..7f18618 --- /dev/null +++ b/src/app/services/store-discount-activity.service.ts @@ -0,0 +1,81 @@ +import { Injectable } from '@angular/core'; +import {HttpClient} from '@angular/common/http'; +import {CommonsService} from './commons.service'; +import {environment} from '../../environments/environment'; + +@Injectable({ + providedIn: 'root' +}) +export class StoreDiscountActivityService { + + constructor( + private http: HttpClient, + private commonsService: CommonsService + ) { } + + /** + * 配置优惠活动 + * @param paramObject 参数 + * @param callBack + */ + configActivity(paramObject: object, callBack) { + this.http.post(environment.baseUrl + 'storeDiscountActivity/configActivity', paramObject).subscribe(data => { + callBack(data); + }); + } + + /** + * 配置优惠活动 + * @param paramObject 参数 + * @param callBack + */ + getActivityDetail(activityId: number, callBack) { + this.http.get(environment.baseUrl + 'storeDiscountActivity/getActivityDetail?activityId=' + activityId).subscribe(data => { + callBack(data); + }); + } + + /** + * 活动上线 + * @param paramObject 参数 + * @param callBack + */ + upOnline(activityId: number, callBack) { + this.http.get(environment.baseUrl + 'storeDiscountActivity/upOnline?activityId=' + activityId).subscribe(data => { + callBack(data); + }); + } + + /** + * 活动下线 + * @param paramObject 参数 + * @param callBack + */ + lowerOnline(activityId: number, callBack) { + this.http.get(environment.baseUrl + 'storeDiscountActivity/lowerOnline?activityId=' + activityId).subscribe(data => { + callBack(data); + }); + } + + /** + * 删除 + * @param paramObject 参数 + * @param callBack + */ + delete(activityId: number, callBack) { + this.http.get(environment.baseUrl + 'storeDiscountActivity/delete?activityId=' + activityId).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询优惠活动列表 + * @param paramObject 参数 + * @param callBack + */ + getActivityList(paramObject: object, callBack) { + this.http.get(environment.baseUrl + 'storeDiscountActivity/getActivityList?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => { + callBack(data); + }); + } +} diff --git a/src/app/services/store.service.ts b/src/app/services/store.service.ts index 7a95c40..c8129f4 100644 --- a/src/app/services/store.service.ts +++ b/src/app/services/store.service.ts @@ -13,6 +13,17 @@ export class StoreService { private commonsService: CommonsService ) { } + /** + * 查询门店列表 + * @param paramObject 参数 + * @param callBack + */ + getStoreList(paramObject: object, callBack) { + this.http.get(environment.baseUrl + 'store/getStoreList?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => { + callBack(data); + }); + } + /** * 根据商户id,查询门店列表 * @param paramObject 参数 diff --git a/src/environments/environment.ts b/src/environments/environment.ts index c6cb300..cfbbb01 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,6 +4,7 @@ export const environment = { production: false, + // baseUrl: 'https://gratia-pay.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) baseUrl: 'https://gratia-pay.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) imageUrl: 'https://gratia-pay.dctpay.com/filesystem/', obsUrl: 'https://xuan-pay-private.obs.cn-southwest-2.myhuaweicloud.com',