diff --git a/src/app/admin/index/index/index.component.html b/src/app/admin/index/index/index.component.html
index 56c512b..e69de29 100644
--- a/src/app/admin/index/index/index.component.html
+++ b/src/app/admin/index/index/index.component.html
@@ -1,18 +0,0 @@
-
-
-
-
-
diff --git a/src/app/admin/index/index/index.component.ts b/src/app/admin/index/index/index.component.ts
index 45a0ca6..c11f7ae 100644
--- a/src/app/admin/index/index/index.component.ts
+++ b/src/app/admin/index/index/index.component.ts
@@ -1,9 +1,5 @@
import {Component, OnInit} from '@angular/core';
-import {AdminIndexService} from "../../../services/admin-index.service";
-import {FormBuilder} from "@angular/forms";
-import {Router} from "@angular/router";
-import {NzMessageService, NzModalService} from "ng-zorro-antd";
-import {HttpClient} from "../../../../../node_modules/@angular/common/http";
+
@Component({
selector: 'app-index',
@@ -11,263 +7,13 @@ import {HttpClient} from "../../../../../node_modules/@angular/common/http";
styleUrls: ['./index.component.less']
})
export class IndexComponent implements OnInit {
- positionTopTen = {};
- resumeByAge = {};
- resumeByEdu = {};
- enterpriseTopTen = {};
- deliveryByMonth = {};
-
constructor(
- private fb: FormBuilder,
- private router: Router, // 路由
- private message: NzMessageService,
- private http: HttpClient,
- private modalService: NzModalService,
- private adminIndexService: AdminIndexService,
+
) { }
ngOnInit(): void {
- this.getPositionTopTen();
- this.findResumeByAge();
- this.findResumeByEdu();
- this.getEnterpriseTopTen();
- this.findDeliveryByMonth();
- }
- // 按职位类型统计前十职位数量
- getPositionTopTen() {
- this.adminIndexService.getPositionTopTen(data => {
- if (data['return_code'] === '000000') {
- this.positionTopTen = {
- title: {
- text: '职位发布数量排名',
- },
- color: ['#3398DB'],
- tooltip: {
- trigger: 'axis',
- axisPointer: { // 坐标轴指示器,坐标轴触发有效
- type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
- }
- },
- grid: {
- left: '3%',
- right: '4%',
- bottom: '3%',
- containLabel: true
- },
- xAxis: [
- {
- type: 'category',
- data: data['return_data']['label'],
- axisTick: {
- alignWithLabel: true
- }
- }
- ],
- yAxis: [
- {
- type: 'value'
- }
- ],
- series: [
- {
- name: '',
- type: 'bar',
- barWidth: '60%',
- data: data['return_data']['value']
- }
- ]
- };
- } else {
- this.message.error(data['return_msg']);
- }
- });
- }
- // 按年龄段统计简历
- findResumeByAge() {
- this.adminIndexService.findResumeByAge(data => {
- if (data['return_code'] === '000000') {
- this.resumeByAge = {
- title: {
- text: '人才库年龄分布',
- },
- tooltip: {
- trigger: 'item',
- formatter: '{a}{b} : {c} ({d}%)'
- },
- legend: {
- orient: 'vertical',
- bottom: 'bottom',
- // right: 'right',
- width: '20%',
- itemWidth: 15,
- itemHeight: 15,
- textStyle: {
- color: '#000000'
- },
- data: data['return_data']['label']
- },
- series: [
- {
- name: '',
- type: 'pie',
- radius: ['40%', '60%'],
- hoverAnimation: true,
- clockwise: false,
- data: data['return_data']['data'],
- itemStyle: {
- hoverAnimation: false,
- normal: {
- borderWidth: 6,
- // borderColor: '#011358',
- color: function (params) {
- var colorList = ['#e69a2a', '#ff9745', '#3a51ec', '#e7b82e', '#34abff','#2F4554'];
- return colorList[params.dataIndex];
- }
- }
- }
- }
- ]
- };
- } else {
- this.message.error(data['return_msg']);
- }
- });
}
- // 按学历统计简历
- findResumeByEdu() {
- this.adminIndexService.findResumeByEdu(data => {
- if (data['return_code'] === '000000') {
- this.resumeByEdu = {
- title: {
- text: '人才库学历分布',
- },
- tooltip: {
- trigger: 'item',
- formatter: '{a}{b}: {c} ({d}%)'
- },
- legend: {
- orient: 'vertical',
- bottom: 'bottom',
- itemWidth: 10,
- itemHeight: 10,
- textStyle: {
- color: '#000000'
- },
- data: ['博士', '硕士', '本科', '大专', '大专以下', '学历不限']
- },
- series: [
- {
- name: '',
- type: 'pie',
- label: {
- show: false,
- position: 'center'
- },
- data: data['return_data']['value'],
- itemStyle: {
- normal: {
- color: function (params) {
- var colorList = ['#749F83', '#91C7AE', '#D48265', '#61A0A8', '#2F4554', '#C23531'];
- return colorList[params.dataIndex];
- }
- }
- }
- }
- ]
- };
- } else {
- this.message.error(data['return_msg']);
- }
- });
- }
-
- // 按行业统计前十企业数量
- getEnterpriseTopTen() {
- this.adminIndexService.getEnterpriseTopTen(data => {
- if (data['return_code'] === '000000') {
- this.enterpriseTopTen = {
- title: {
- text: '行业分类企业数量排名',
- },
- color: ['#3398DB'],
- tooltip: {
- trigger: 'axis',
- axisPointer: { // 坐标轴指示器,坐标轴触发有效
- type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
- }
- },
- grid: {
- left: '3%',
- right: '4%',
- bottom: '3%',
- containLabel: true
- },
- xAxis: [
- {
- type: 'category',
- data: data['return_data']['label'],
- axisTick: {
- alignWithLabel: true
- }
- }
- ],
- yAxis: [
- {
- type: 'value'
- }
- ],
- series: [
- {
- name: '',
- type: 'bar',
- barWidth: '60%',
- data: data['return_data']['value']
- }
- ]
- };
- } else {
- this.message.error(data['return_msg']);
- }
- });
- }
- // 当前年份按月统计简历投递数
- findDeliveryByMonth() {
- this.adminIndexService.findDeliveryByMonth(data => {
- if (data['return_code'] === '000000') {
- this.deliveryByMonth = {
- title: {
- text: '今年每月简历投递数(总计:' + data['return_data']['total'] +")",
- },
- tooltip: {
- position: ['50%', '50%']
- },
- xAxis: {
- type: 'category',
- data: data['return_data']['label']
- },
- yAxis: {
- type: 'value',
- axisTick: {
- show: false
- }
- },
- lineStyle: {
- color: '#132363'
- },
- itemStyle: {
- color: '#43b0f6'
- },
- series: [{
- data: data['return_data']['data'],
- type: 'line'
- }]
- };
- } else {
- this.message.error(data['return_msg']);
- }
- });
- }
}
diff --git a/src/app/admin/merchant-store/merchant-store-routing.module.ts b/src/app/admin/merchant-store/merchant-store-routing.module.ts
new file mode 100644
index 0000000..d2468cb
--- /dev/null
+++ b/src/app/admin/merchant-store/merchant-store-routing.module.ts
@@ -0,0 +1,18 @@
+import { NgModule } from '@angular/core';
+import { Routes, RouterModule } from '@angular/router';
+import {StoreListComponent} from './store-list/store-list.component';
+import {StoreEditComponent} from './store-edit/store-edit.component';
+import {StoreDetailComponent} from './store-detail/store-detail.component';
+
+
+const routes: Routes = [
+ { path: 'store-list', component: StoreListComponent },
+ { path: 'store-edit', component: StoreEditComponent },
+ { path: 'store-detail', component: StoreDetailComponent },
+];
+
+@NgModule({
+ imports: [RouterModule.forChild(routes)],
+ exports: [RouterModule]
+})
+export class MerchantStoreRoutingModule { }
diff --git a/src/app/admin/merchant-store/merchant-store.module.ts b/src/app/admin/merchant-store/merchant-store.module.ts
new file mode 100644
index 0000000..3603174
--- /dev/null
+++ b/src/app/admin/merchant-store/merchant-store.module.ts
@@ -0,0 +1,26 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+
+import { MerchantStoreRoutingModule } from './merchant-store-routing.module';
+import { StoreListComponent } from './store-list/store-list.component';
+import { StoreEditComponent } from './store-edit/store-edit.component';
+import { StoreDetailComponent } from './store-detail/store-detail.component';
+import {NgZorroAntdModule} from 'ng-zorro-antd';
+import {SeparateModule} from '../../common/separate/separate.module';
+import {FormsModule, ReactiveFormsModule} from '@angular/forms';
+import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module';
+
+
+@NgModule({
+ declarations: [StoreListComponent, StoreEditComponent, StoreDetailComponent],
+ imports: [
+ CommonModule,
+ MerchantStoreRoutingModule,
+ NgZorroAntdModule,
+ SeparateModule,
+ ReactiveFormsModule,
+ FormsModule,
+ BreadcrumbModule
+ ]
+})
+export class MerchantStoreModule { }
diff --git a/src/app/admin/merchant-store/store-detail/store-detail.component.html b/src/app/admin/merchant-store/store-detail/store-detail.component.html
new file mode 100644
index 0000000..0a0860f
--- /dev/null
+++ b/src/app/admin/merchant-store/store-detail/store-detail.component.html
@@ -0,0 +1 @@
+store-detail works!
diff --git a/src/app/admin/merchant-store/store-detail/store-detail.component.scss b/src/app/admin/merchant-store/store-detail/store-detail.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/admin/merchant-store/store-detail/store-detail.component.ts b/src/app/admin/merchant-store/store-detail/store-detail.component.ts
new file mode 100644
index 0000000..52c49e9
--- /dev/null
+++ b/src/app/admin/merchant-store/store-detail/store-detail.component.ts
@@ -0,0 +1,15 @@
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+ selector: 'app-store-detail',
+ templateUrl: './store-detail.component.html',
+ styleUrls: ['./store-detail.component.scss']
+})
+export class StoreDetailComponent implements OnInit {
+
+ constructor() { }
+
+ ngOnInit(): void {
+ }
+
+}
diff --git a/src/app/admin/merchant-store/store-edit/store-edit.component.html b/src/app/admin/merchant-store/store-edit/store-edit.component.html
new file mode 100644
index 0000000..ccabe2f
--- /dev/null
+++ b/src/app/admin/merchant-store/store-edit/store-edit.component.html
@@ -0,0 +1,70 @@
+
+
+
+ 门店管理
+
+
+ 编辑门店
+
+
+
+
+
+
+
+
+
diff --git a/src/app/admin/merchant-store/store-edit/store-edit.component.scss b/src/app/admin/merchant-store/store-edit/store-edit.component.scss
new file mode 100644
index 0000000..ac60fb8
--- /dev/null
+++ b/src/app/admin/merchant-store/store-edit/store-edit.component.scss
@@ -0,0 +1,6 @@
+button {
+ margin-left: 8px;
+}
+:host ::ng-deep .ant-upload {
+ background-color: #ffffff;
+}
diff --git a/src/app/admin/merchant-store/store-edit/store-edit.component.ts b/src/app/admin/merchant-store/store-edit/store-edit.component.ts
new file mode 100644
index 0000000..105fbb8
--- /dev/null
+++ b/src/app/admin/merchant-store/store-edit/store-edit.component.ts
@@ -0,0 +1,136 @@
+import { Component, OnInit } from '@angular/core';
+import {FormBuilder, FormGroup, Validators} from '@angular/forms';
+import {environment} from '../../../../environments/environment';
+import {MerchantService} from '../../../services/merchant.service';
+import {NzMessageService, NzUploadFile} from 'ng-zorro-antd';
+import {ActivatedRoute} from '@angular/router';
+import {ValidatorsService} from '../../../services/validators.service';
+
+@Component({
+ selector: 'app-store-edit',
+ templateUrl: './store-edit.component.html',
+ styleUrls: ['./store-edit.component.scss']
+})
+export class StoreEditComponent implements OnInit {
+
+ validateForm!: FormGroup;
+ data: any;
+ editFlag = false;
+ id: number;
+ passwordVisible = false;
+ logoFile = [];
+ WEB_SERVE_URL = environment.baseUrl;
+ previewImage: string | undefined = '';
+ previewVisible = false;
+
+ constructor(
+ private fb: FormBuilder,
+ private merchant: MerchantService,
+ private message: NzMessageService, // 信息提示
+ private activatedRoute: ActivatedRoute,
+ ) {
+ }
+
+ ngOnInit(): void {
+ this.activatedRoute.queryParams.subscribe(queryParams => {
+ if (queryParams.merchantId != null) {
+ this.editFlag = true;
+ this.id = queryParams.merchantId;
+ this.getDetails(queryParams.merchantId);
+ }
+ });
+ this.validateForm = this.fb.group({
+ loginTelephone: [null, [Validators.required, ValidatorsService.mobile]],
+ password: [null, [Validators.required, ValidatorsService.minLength(6)]],
+ storeKey: [null, [Validators.required, ValidatorsService.maxLength(10)]],
+ storeKeyName: [null, [Validators.required, ValidatorsService.pwdLength(2, 12)]],
+ telephone: [null, [Validators.required]],
+ address: [null, [Validators.required]],
+ latitude: [null, [Validators.required]],
+ longitude: [null, [Validators.required]],
+ status: [null],
+ createTime: [null],
+ secUser: {},
+ });
+ }
+
+ // 返回
+ getBack() {
+ history.back();
+ }
+
+ // 重置
+ public resetForm(): void {
+ this.validateForm.reset();
+ }
+
+ // 课程保存
+ public getSave(): void {
+ // tslint:disable-next-line:forin
+ for (const i in this.validateForm.controls) {
+ this.validateForm.controls[i].markAsDirty();
+ this.validateForm.controls[i].updateValueAndValidity();
+ if (this.validateForm.controls[i].errors != null) {
+ this.message.error('必填项不能为空');
+ return;
+ }
+ }
+
+ this.validateForm.value['secUser']['telephone'] = this.validateForm.value.loginTelephone;
+ this.validateForm.value['secUser']['password'] = this.validateForm.value.password;
+ if (this.logoFile.length !== 0) {
+ if (this.logoFile[0]['response'] != null) {
+ this.validateForm.value.merchantLogo = this.logoFile[0]['response']['return_data'][0];
+ } else {
+ this.validateForm.value.merchantLogo = this.logoFile[0].name;
+ }
+ }
+ console.log(this.validateForm.value);
+ if (this.editFlag) {
+ this.validateForm.value.id = this.id;
+ this.merchant.updateMerchant(this.validateForm.value, data => {
+ if (data['return_code'] === '000000') {
+ this.getBack();
+ this.message.success('修改成功');
+ } else {
+ this.message.create('error', '修改失败');
+ }
+ });
+ } else {
+
+ this.merchant.insertMerchant(this.validateForm.value, data => {
+ console.log(data);
+ if (data['return_code'] === '000000') {
+ this.getBack();
+ this.message.success('添加成功');
+ } else {
+ this.message.create('error', '保存失败');
+ }
+ });
+ }
+ }
+
+ public getDetails(id) {
+ this.merchant.getMerchantById(id, data => {
+ if (data['return_code'] === '000000') {
+ data['return_data'].loginTelephone = data['return_data'].secUser.loginName;
+ data['return_data'].password = data['return_data'].secUser.password;
+ if (data['return_data']['merchantLogo'] != null && data['return_data']['merchantLogo'] !== '') {
+ const logo = String(data['return_data']['merchantLogo']);
+ const logoArray = [];
+ logoArray.push(
+ {
+ uid: 1,
+ name: logo,
+ status: 'done',
+ url: environment.imageUrl + logo
+ });
+ this.logoFile = logoArray;
+ }
+ this.validateForm.patchValue(data['return_data']);
+ } else {
+ this.message.create('error', data['return_msg']);
+ }
+ });
+ }
+}
diff --git a/src/app/admin/merchant-store/store-list/store-list.component.html b/src/app/admin/merchant-store/store-list/store-list.component.html
new file mode 100644
index 0000000..d3ee79b
--- /dev/null
+++ b/src/app/admin/merchant-store/store-list/store-list.component.html
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+
+
+
+
共计 {{total}} 条数据
+
+
+
+
+
+
+ 编号 |
+ 商户编号 |
+ 商户名称 |
+ 商户LOGO |
+ 商户电话 |
+ 创建时间 |
+ 状态 |
+ 操作 |
+
+
+
+
+ {{i+1}} |
+ {{data.merchantKey}} |
+ {{data.merchantName}} |
+
+
+ |
+ {{data.telephone}} |
+ {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} |
+ {{data.status ===1 ? '正常' : '禁用'}} |
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
diff --git a/src/app/admin/merchant-store/store-list/store-list.component.scss b/src/app/admin/merchant-store/store-list/store-list.component.scss
new file mode 100644
index 0000000..8bee3fb
--- /dev/null
+++ b/src/app/admin/merchant-store/store-list/store-list.component.scss
@@ -0,0 +1,4 @@
+.head_img {
+ height: 60px;
+ width: 60px;
+}
diff --git a/src/app/admin/merchant-store/store-list/store-list.component.ts b/src/app/admin/merchant-store/store-list/store-list.component.ts
new file mode 100644
index 0000000..13d2c62
--- /dev/null
+++ b/src/app/admin/merchant-store/store-list/store-list.component.ts
@@ -0,0 +1,133 @@
+import { Component, OnInit } from '@angular/core';
+import {FormBuilder, FormGroup} from '@angular/forms';
+import {MerchantService} from '../../../services/merchant.service';
+import {IconService} from '../../../services/icon.service';
+import {NzMessageService} from 'ng-zorro-antd';
+import {Router} from '@angular/router';
+import {CommonsService} from '../../../services/commons.service';
+import {MerchantStoreService} from '../../../services/merchant-store.service';
+
+@Component({
+ selector: 'app-store-list',
+ templateUrl: './store-list.component.html',
+ styleUrls: ['./store-list.component.scss']
+})
+export class StoreListComponent implements OnInit {
+
+ searchForm: FormGroup; // 搜索框
+ requestData = []; // 列表数据
+ total: number; // 页码
+ pageNum = 1; // 页码
+ pageSize = 10; // 条码
+ loading = true;
+
+ constructor(
+ private form: FormBuilder,
+ private merchantStore: MerchantStoreService,
+ private iconService: IconService,
+ private message: NzMessageService,
+ private router: Router,
+ private common: CommonsService
+ ) {
+ }
+
+ ngOnInit(): void {
+ this.init();
+ }
+
+ public init(): void {
+ this.searchForm = this.form.group({
+ merchantKey: [null],
+ merchantName: [null],
+ telephone: [null],
+ status: [null],
+ });
+ this.getRequest(true, this.searchForm.value);
+ }
+
+ // 查询列表
+ public getRequest(reset: boolean = false, whereObject: object) {
+
+ this.loading = false;
+ if (reset) {
+ this.pageNum = 1;
+ }
+ whereObject['pageNum'] = this.pageNum;
+ whereObject['pageSize'] = this.pageSize;
+ this.merchantStore.getStoreListByMerchant(whereObject, data => {
+ if (data['return_code'] === '000000') {
+ this.requestData = data['return_data'].list;
+ this.total = data['return_data'].total;
+ } else {
+ this.message.error(data['return_msg']);
+ }
+ });
+ }
+
+ // 重置
+ public resetForm(): void {
+ this.searchForm.reset();
+ }
+
+ // 禁用商户
+ public disableMerchant(id): void {
+ const message = '是否禁用商户';
+ this.common.showConfirm(message, data => {
+ if (data) {
+ this.merchantStore.disableMerchant(id, dataReturn => {
+ if (dataReturn['return_code'] === '000000') {
+ this.message.success('操作成功');
+ this.getRequest(false , this.searchForm.value);
+ } else {
+ this.message.warning(dataReturn['return_msg']);
+ }
+ });
+ }
+ });
+ }
+
+ // 启动商户
+ public enableMerchant(id): void {
+ const message = '是否启用商户';
+ this.common.showConfirm(message, data => {
+ if (data) {
+ this.merchantStore.enableMerchant(id, dataReturn => {
+ if (dataReturn['return_code'] === '000000') {
+ this.message.success('操作成功');
+ this.getRequest(false , this.searchForm.value);
+ } else {
+ this.message.warning(dataReturn['return_msg']);
+ }
+ });
+ }
+ });
+ }
+
+
+ // 修改
+ public getEdit(id: number): void {
+ this.router.navigate(['/admin/merchant/merchant-edit'], {
+ queryParams: {
+ merchantId: id
+ }
+ }).then(r => console.log(r));
+ }
+
+ // 查看详情
+ public getDetail(id: number): void {
+ this.router.navigate(['/admin/merchant/merchant-detail'], {
+ queryParams: {
+ merchantId: id
+ }
+ }).then(r => console.log(r));
+ }
+
+ // 查看门店列表
+ public getList(id: number): void {
+ this.router.navigate(['/admin/merchant/merchant-detail'], {
+ queryParams: {
+ merchantId: id
+ }
+ }).then(r => console.log(r));
+ }
+}
diff --git a/src/app/admin/merchant/merchant-detail/merchant-detail.component.html b/src/app/admin/merchant/merchant-detail/merchant-detail.component.html
index 62ffba3..5ea9a7b 100644
--- a/src/app/admin/merchant/merchant-detail/merchant-detail.component.html
+++ b/src/app/admin/merchant/merchant-detail/merchant-detail.component.html
@@ -1 +1,32 @@
-merchant-detail works!
+
+
+
+
+
+ {{data['secUser']['loginName']}}
+ {{data['merchantKey']}}
+ {{data.merchantName}}
+ {{data.secUser.telephone}}
+ {{data.address}}
+ {{data.status ===1 ? '正常' : '禁用'}}
+
+ {{data.bankName == null ? '未上传' : data.bankName}}
+
+
+ {{data.bankAccount == null ? '未上传' : data.bankAccount}}
+
+
+ {{data.bankHolder == null ? '未上传' : data.bankHolder}}
+
+
+ {{data.createTime | date: 'yyyy-MM-dd'}}
+
+
+ {{data.updateTime | date: 'yyyy-MM-dd'}}
+
+ {{data.operatorName }}
+
+ {{data.merchantDesc}}
+
+
+
diff --git a/src/app/admin/merchant/merchant-detail/merchant-detail.component.scss b/src/app/admin/merchant/merchant-detail/merchant-detail.component.scss
index e69de29..8bee3fb 100644
--- a/src/app/admin/merchant/merchant-detail/merchant-detail.component.scss
+++ b/src/app/admin/merchant/merchant-detail/merchant-detail.component.scss
@@ -0,0 +1,4 @@
+.head_img {
+ height: 60px;
+ width: 60px;
+}
diff --git a/src/app/admin/merchant/merchant-detail/merchant-detail.component.spec.ts b/src/app/admin/merchant/merchant-detail/merchant-detail.component.spec.ts
deleted file mode 100644
index 51c0eb3..0000000
--- a/src/app/admin/merchant/merchant-detail/merchant-detail.component.spec.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { MerchantDetailComponent } from './merchant-detail.component';
-
-describe('MerchantDetailComponent', () => {
- let component: MerchantDetailComponent;
- let fixture: ComponentFixture;
-
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- declarations: [ MerchantDetailComponent ]
- })
- .compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(MerchantDetailComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-});
diff --git a/src/app/admin/merchant/merchant-detail/merchant-detail.component.ts b/src/app/admin/merchant/merchant-detail/merchant-detail.component.ts
index e5f7006..f33cfad 100644
--- a/src/app/admin/merchant/merchant-detail/merchant-detail.component.ts
+++ b/src/app/admin/merchant/merchant-detail/merchant-detail.component.ts
@@ -1,4 +1,7 @@
import { Component, OnInit } from '@angular/core';
+import {MerchantService} from '../../../services/merchant.service';
+import {NzMessageService} from 'ng-zorro-antd';
+import {ActivatedRoute} from '@angular/router';
@Component({
selector: 'app-merchant-detail',
@@ -7,9 +10,29 @@ import { Component, OnInit } from '@angular/core';
})
export class MerchantDetailComponent implements OnInit {
- constructor() { }
+ data: any = {};
+ id: number;
+ constructor(
+ private merchant: MerchantService,
+ private message: NzMessageService, // 信息提示
+ private activatedRoute: ActivatedRoute,
+ ) { }
ngOnInit(): void {
+ this.activatedRoute.queryParams.subscribe(queryParams => {
+ if (queryParams.merchantId != null) {
+ this.id = queryParams.merchantId;
+ this.getDetails(queryParams.merchantId);
+ }
+ });
+ }
+
+ // 查询课程详情
+ public getDetails(id: number) {
+ this.merchant.getMerchantById(id , data => {
+ this.data = data['return_data'];
+ console.log(data);
+ });
}
}
diff --git a/src/app/admin/merchant/merchant-edit/merchant-edit.component.ts b/src/app/admin/merchant/merchant-edit/merchant-edit.component.ts
index f085f81..13de7f4 100644
--- a/src/app/admin/merchant/merchant-edit/merchant-edit.component.ts
+++ b/src/app/admin/merchant/merchant-edit/merchant-edit.component.ts
@@ -1,4 +1,4 @@
-import { Component, OnInit } from '@angular/core';
+import {Component, OnInit} from '@angular/core';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {MerchantService} from '../../../services/merchant.service';
import {NzMessageService, NzUploadFile} from 'ng-zorro-antd';
@@ -7,127 +7,151 @@ import {ValidatorsService} from '../../../services/validators.service';
import {environment} from '../../../../environments/environment';
function getBase64(file: File): Promise {
- return new Promise((resolve, reject) => {
- const reader = new FileReader();
- reader.readAsDataURL(file);
- reader.onload = () => resolve(reader.result);
- reader.onerror = error => reject(error);
- });
+ return new Promise((resolve, reject) => {
+ const reader = new FileReader();
+ reader.readAsDataURL(file);
+ reader.onload = () => resolve(reader.result);
+ reader.onerror = error => reject(error);
+ });
}
@Component({
- selector: 'app-merchant-edit',
- templateUrl: './merchant-edit.component.html',
- styleUrls: ['./merchant-edit.component.scss']
+ selector: 'app-merchant-edit',
+ templateUrl: './merchant-edit.component.html',
+ styleUrls: ['./merchant-edit.component.scss']
})
export class MerchantEditComponent implements OnInit {
- validateForm!: FormGroup;
- data: any;
- editFlag = false;
- id: number;
- passwordVisible = false;
- logoFile = [];
- WEB_SERVE_URL = environment.baseUrl;
- previewImage: string | undefined = '';
- previewVisible = false;
- constructor(
- private fb: FormBuilder,
- private merchant: MerchantService,
- private message: NzMessageService, // 信息提示
- private activatedRoute: ActivatedRoute,
- ) { }
-
- ngOnInit(): void {
- this.activatedRoute.queryParams.subscribe(queryParams => {
- this.editFlag = true;
- if (queryParams.merchantId != null ) {
- this.id = queryParams.merchantId;
- this.getDetails(queryParams.merchantId);
- }
- });
- this.validateForm = this.fb.group({
- loginTelephone: [null, [Validators.required, ValidatorsService.mobile]],
- password: [null, [Validators.required, ValidatorsService.pwdLength(6 , 12)]],
- merchantKey: [null, [Validators.required, ValidatorsService.maxLength(10)]],
- merchantName: [null, [Validators.required, ValidatorsService.pwdLength(2 , 12)]],
- telephone: [null, [Validators.required]],
- address: [null, [Validators.required]],
- bankName: [null],
- bankAccount: [null],
- bankHolder: [null],
- merchantDesc: [null],
- secUser: {},
- });
- }
+ validateForm!: FormGroup;
+ data: any;
+ editFlag = false;
+ id: number;
+ passwordVisible = false;
+ logoFile = [];
+ WEB_SERVE_URL = environment.baseUrl;
+ previewImage: string | undefined = '';
+ previewVisible = false;
- // 返回
- getBack() {
- history.back();
- }
+ constructor(
+ private fb: FormBuilder,
+ private merchant: MerchantService,
+ private message: NzMessageService, // 信息提示
+ private activatedRoute: ActivatedRoute,
+ ) {
+ }
- // 重置
- public resetForm(): void {
- this.validateForm.reset();
- }
+ ngOnInit(): void {
+ this.activatedRoute.queryParams.subscribe(queryParams => {
+ if (queryParams.merchantId != null) {
+ this.editFlag = true;
+ this.id = queryParams.merchantId;
+ this.getDetails(queryParams.merchantId);
+ }
+ });
+ this.validateForm = this.fb.group({
+ loginTelephone: [null, [Validators.required, ValidatorsService.mobile]],
+ password: [null, [Validators.required, ValidatorsService.minLength(6)]],
+ merchantKey: [null, [Validators.required, ValidatorsService.maxLength(10)]],
+ merchantName: [null, [Validators.required, ValidatorsService.pwdLength(2, 12)]],
+ telephone: [null, [Validators.required]],
+ address: [null, [Validators.required]],
+ bankName: [null],
+ bankAccount: [null],
+ bankHolder: [null],
+ status: [null],
+ createTime: [null],
+ merchantDesc: [null],
+ secUser: {},
+ });
+ }
- // 课程保存
- public getSave(): void {
- // tslint:disable-next-line:forin
- for (const i in this.validateForm.controls) {
- this.validateForm.controls[i].markAsDirty();
- this.validateForm.controls[i].updateValueAndValidity();
- // if (this.validateForm.controls[i].errors != null) {
- // this.message.error('必填项不能为空');
- // return;
- // }
+ // 返回
+ getBack() {
+ history.back();
}
- this.validateForm.value['secUser']['telephone'] = this.validateForm.value.loginTelephone;
- this.validateForm.value['secUser']['password'] = this.validateForm.value.password;
- if (this.logoFile.length !== 0) {
- this.validateForm.value.merchantLogo = this.logoFile[0]['response']['return_data'][0];
+ // 重置
+ public resetForm(): void {
+ this.validateForm.reset();
}
- if (this.editFlag) {
- // this.lessonsService.getUpDataLesson(this.lessonData, data => {
- // if (data['return_code'] === '000000') {
- // this.returnData.emit(this.lessonData);
- // } else {
- // this.message.create('error', '修改失败');
- // }
- // });
- } else {
+ // 课程保存
+ public getSave(): void {
+ // tslint:disable-next-line:forin
+ for (const i in this.validateForm.controls) {
+ this.validateForm.controls[i].markAsDirty();
+ this.validateForm.controls[i].updateValueAndValidity();
+ if (this.validateForm.controls[i].errors != null) {
+ this.message.error('必填项不能为空');
+ return;
+ }
+ }
- this.merchant.insertMerchant(this.validateForm.value, data => {
- console.log(data);
- if (data['return_code'] === '000000') {
- this.getBack();
- this.message.success('添加成功');
+ this.validateForm.value['secUser']['telephone'] = this.validateForm.value.loginTelephone;
+ this.validateForm.value['secUser']['password'] = this.validateForm.value.password;
+ if (this.logoFile.length !== 0) {
+ if (this.logoFile[0]['response'] != null) {
+ this.validateForm.value.merchantLogo = this.logoFile[0]['response']['return_data'][0];
+ } else {
+ this.validateForm.value.merchantLogo = this.logoFile[0].name;
+ }
+ }
+ console.log(this.validateForm.value);
+ if (this.editFlag) {
+ this.validateForm.value.id = this.id;
+ this.merchant.updateMerchant(this.validateForm.value, data => {
+ if (data['return_code'] === '000000') {
+ this.getBack();
+ this.message.success('修改成功');
+ } else {
+ this.message.create('error', '修改失败');
+ }
+ });
} else {
- this.message.create('error', '保存失败');
+
+ this.merchant.insertMerchant(this.validateForm.value, data => {
+ console.log(data);
+ if (data['return_code'] === '000000') {
+ this.getBack();
+ this.message.success('添加成功');
+ } else {
+ this.message.create('error', '保存失败');
+ }
+ });
}
- });
}
- }
- // 图片查看
- handlePreview = async (file: NzUploadFile) => {
- if (!file.url && !file.preview) {
- // tslint:disable-next-line:no-non-null-assertion
- file.preview = await getBase64(file.originFileObj!);
+ // 图片查看
+ handlePreview = async (file: NzUploadFile) => {
+ if (!file.url && !file.preview) {
+ // tslint:disable-next-line:no-non-null-assertion
+ file.preview = await getBase64(file.originFileObj!);
+ }
+ this.previewImage = file.url || file.preview;
+ this.previewVisible = true;
}
- this.previewImage = file.url || file.preview;
- this.previewVisible = true;
- }
- public getDetails(id) {
- this.merchant.getMerchantById(id, data => {
- if (data['return_code'] === '000000') {
- console.log(data);
- } else {
- this.message.create('error', data['return_msg']);
- }
- });
- }
+ public getDetails(id) {
+ this.merchant.getMerchantById(id, data => {
+ if (data['return_code'] === '000000') {
+ data['return_data'].loginTelephone = data['return_data'].secUser.loginName;
+ data['return_data'].password = data['return_data'].secUser.password;
+ if (data['return_data']['merchantLogo'] != null && data['return_data']['merchantLogo'] !== '') {
+ const logo = String(data['return_data']['merchantLogo']);
+ const logoArray = [];
+ logoArray.push(
+ {
+ uid: 1,
+ name: logo,
+ status: 'done',
+ url: environment.imageUrl + logo
+ });
+ this.logoFile = logoArray;
+ }
+ this.validateForm.patchValue(data['return_data']);
+ } else {
+ this.message.create('error', data['return_msg']);
+ }
+ });
+ }
}
diff --git a/src/app/admin/merchant/merchant-list/merchant-list.component.html b/src/app/admin/merchant/merchant-list/merchant-list.component.html
index 76e2f5d..1bbf77d 100644
--- a/src/app/admin/merchant/merchant-list/merchant-list.component.html
+++ b/src/app/admin/merchant/merchant-list/merchant-list.component.html
@@ -95,11 +95,14 @@
{{data.createTime | date: 'yyyy-MM-dd HH:mm'}} |
{{data.status ===1 ? '正常' : '禁用'}} |
-
+
-
+
-
+
+
+
+
|
diff --git a/src/app/admin/merchant/merchant-list/merchant-list.component.ts b/src/app/admin/merchant/merchant-list/merchant-list.component.ts
index 83c7176..7fff044 100644
--- a/src/app/admin/merchant/merchant-list/merchant-list.component.ts
+++ b/src/app/admin/merchant/merchant-list/merchant-list.component.ts
@@ -69,14 +69,36 @@ export class MerchantListComponent implements OnInit {
this.searchForm.reset();
}
- public getForbiddenUser(id, status: any): void {
- const message = (status === 1 ? '是否禁用当前用户' : '是否启用当前用户');
+ // 禁用商户
+ public disableMerchant(id): void {
+ const message = '是否禁用商户';
+ this.common.showConfirm(message, data => {
+ if (data) {
+ this.merchant.disableMerchant(id, dataReturn => {
+ if (dataReturn['return_code'] === '000000') {
+ this.message.success('操作成功');
+ this.getRequest(false , this.searchForm.value);
+ } else {
+ this.message.warning(dataReturn['return_msg']);
+ }
+ });
+ }
+ });
+ }
+ // 启动商户
+ public enableMerchant(id): void {
+ const message = '是否启用商户';
this.common.showConfirm(message, data => {
if (data) {
- // this.user.forbiddenUser(id, dataUser => {
- // this.getRequest(false , this.searchForm.value);
- // });
+ this.merchant.enableMerchant(id, dataReturn => {
+ if (dataReturn['return_code'] === '000000') {
+ this.message.success('操作成功');
+ this.getRequest(false , this.searchForm.value);
+ } else {
+ this.message.warning(dataReturn['return_msg']);
+ }
+ });
}
});
}
@@ -84,11 +106,29 @@ export class MerchantListComponent implements OnInit {
// 修改
public getEdit(id: number): void {
- this.router.navigate(['/admin/merchant/merchant-list'], {
+ this.router.navigate(['/admin/merchant/merchant-edit'], {
queryParams: {
merchantId: id
}
}).then(r => console.log(r));
}
+ // 查看详情
+ public getDetail(id: number): void {
+ this.router.navigate(['/admin/merchant/merchant-detail'], {
+ queryParams: {
+ merchantId: id
+ }
+ }).then(r => console.log(r));
+ }
+
+ // 查看门店列表
+ public getList(id: number): void {
+ this.router.navigate(['/admin/merchant/merchant-detail'], {
+ queryParams: {
+ merchantId: id
+ }
+ }).then(r => console.log(r));
+ }
}
+
diff --git a/src/app/admin/merchant/merchant-routing.module.ts b/src/app/admin/merchant/merchant-routing.module.ts
index a7f6174..5dc907f 100644
--- a/src/app/admin/merchant/merchant-routing.module.ts
+++ b/src/app/admin/merchant/merchant-routing.module.ts
@@ -2,11 +2,13 @@ import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import {MerchantListComponent} from './merchant-list/merchant-list.component';
import {MerchantEditComponent} from './merchant-edit/merchant-edit.component';
+import {MerchantDetailComponent} from './merchant-detail/merchant-detail.component';
const routes: Routes = [
{ path: 'merchant-list', component: MerchantListComponent },
{ path: 'merchant-edit', component: MerchantEditComponent },
+ { path: 'merchant-detail', component: MerchantDetailComponent },
];
@NgModule({
diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index a362f3a..0c72719 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -31,6 +31,11 @@ const routes: Routes = [
loadChildren: () => import('./admin/merchant/merchant.module').then(m => m.MerchantModule),
canActivate: [InitGuardService]
},
+ {
+ path: 'merchantStore',
+ loadChildren: () => import('./admin/merchant-store/merchant-store.module').then(m => m.MerchantStoreModule),
+ canActivate: [InitGuardService]
+ },
{
path: 'system',
loadChildren: () => import('./admin/system/system.module').then(m => m.SystemModule),
diff --git a/src/app/services/admin-index.service.ts b/src/app/services/admin-index.service.ts
deleted file mode 100644
index 02cab95..0000000
--- a/src/app/services/admin-index.service.ts
+++ /dev/null
@@ -1,64 +0,0 @@
-import {Injectable} from '@angular/core';
-import {HttpClient} from '@angular/common/http';
-import {environment} from '../../environments/environment';
-
-@Injectable({
- providedIn: 'root'
-})
-export class AdminIndexService {
-
- constructor(
- private http: HttpClient,
- ) {
- }
-
- /**
- * 按职位类型统计前十职位数量
- * @param callBack
- */
- public getPositionTopTen(callBack) {
- this.http.get(environment.baseUrl + '/statistics/getPositionTopTen').subscribe(data => {
- callBack(data);
- });
- }
-
- /**
- * 按年龄段统计简历
- * @param callBack
- */
- public findResumeByAge(callBack) {
- this.http.get(environment.baseUrl + '/statistics/findResumeByAge').subscribe(data => {
- callBack(data);
- });
- }
-
- /**
- * 按学历统计简历
- * @param callBack
- */
- public findResumeByEdu(callBack) {
- this.http.get(environment.baseUrl + '/statistics/findResumeByEdu').subscribe(data => {
- callBack(data);
- });
- }
-
- /**
- * 按行业统计前十企业数量
- * @param callBack
- */
- public getEnterpriseTopTen(callBack) {
- this.http.get(environment.baseUrl + '/statistics/getEnterpriseTopTen').subscribe(data => {
- callBack(data);
- });
- }
-
- /**
- * 按照月份统计简历投递数量(当前年份)
- * @param callBack
- */
- public findDeliveryByMonth(callBack) {
- this.http.get(environment.baseUrl + '/statistics/findDeliveryByMonth').subscribe(data => {
- callBack(data);
- });
- }
-}
diff --git a/src/app/services/merchant-store.service.ts b/src/app/services/merchant-store.service.ts
new file mode 100644
index 0000000..bf52d11
--- /dev/null
+++ b/src/app/services/merchant-store.service.ts
@@ -0,0 +1,91 @@
+import { Injectable } from '@angular/core';
+import {environment} from '../../environments/environment';
+import {HttpClient} from '@angular/common/http';
+import {CommonsService} from './commons.service';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class MerchantStoreService {
+
+ constructor(
+ private http: HttpClient,
+ private common: CommonsService
+ ) { }
+
+ /**
+ * 查询门店列表
+ *
+ * @param paramsObject 对象
+ * @param callBack 回调
+ */
+ public getStoreListByMerchant(paramsObject: object, callBack) {
+ this.http.get(environment.baseUrl + 'highMerchantStore/getStoreListByMerchant?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
+ callBack(data);
+ });
+ }
+
+ /**
+ * 新增商户
+ *
+ * @param params 上传对象
+ * @param callBack 回调
+ * @return data 返回结果
+ */
+ public insertMerchant(params: object, callBack) {
+ this.http.post(environment.baseUrl + 'highMerchant/insertMerchant', params).subscribe(data => {
+ callBack(data);
+ });
+ }
+
+ /**
+ * 修改商户
+ *
+ * @param params 上传对象
+ * @param callBack 回调
+ * @return data 返回结果
+ */
+ public updateMerchant(params: object, callBack) {
+ this.http.post(environment.baseUrl + 'highMerchant/updateMerchant', params).subscribe(data => {
+ callBack(data);
+ });
+ }
+
+ /**
+ * 根据id查询详情
+ *
+ * @param merchantId 职位id
+ * @param callBack 回调
+ */
+ public getMerchantById(merchantId: number, callBack) {
+ this.http.get(environment.baseUrl + 'highMerchant/getMerchantById?id=' + merchantId).subscribe(data => {
+ callBack(data);
+ });
+ }
+
+
+ /**
+ * 禁用商户
+ *
+ * @param id 用户id
+ * @param callBack 返回参数
+ */
+ public disableMerchant(id: number, callBack) {
+ this.http.get(environment.baseUrl + 'highMerchant/disableMerchant?id=' + id).subscribe(data => {
+ callBack(data);
+ });
+ }
+
+ /**
+ * 启用商户
+ *
+ * @param id 用户id
+ * @param callBack 返回参数
+ */
+ public enableMerchant(id: number, callBack) {
+ this.http.get(environment.baseUrl + 'highMerchant/enableMerchant?id=' + id).subscribe(data => {
+ callBack(data);
+ });
+ }
+
+}
diff --git a/src/app/services/merchant.service.ts b/src/app/services/merchant.service.ts
index 67cb29c..3967182 100644
--- a/src/app/services/merchant.service.ts
+++ b/src/app/services/merchant.service.ts
@@ -38,6 +38,19 @@ export class MerchantService {
});
}
+ /**
+ * 修改商户
+ *
+ * @param params 上传对象
+ * @param callBack 回调
+ * @return data 返回结果
+ */
+ public updateMerchant(params: object, callBack) {
+ this.http.post(environment.baseUrl + 'highMerchant/updateMerchant', params).subscribe(data => {
+ callBack(data);
+ });
+ }
+
/**
* 根据id查询详情
*
@@ -50,4 +63,30 @@ export class MerchantService {
});
}
+
+ /**
+ * 禁用商户
+ *
+ * @param id 用户id
+ * @param callBack 返回参数
+ */
+ public disableMerchant(id: number, callBack) {
+ this.http.get(environment.baseUrl + 'highMerchant/disableMerchant?id=' + id).subscribe(data => {
+ callBack(data);
+ });
+ }
+
+ /**
+ * 启用商户
+ *
+ * @param id 用户id
+ * @param callBack 返回参数
+ */
+ public enableMerchant(id: number, callBack) {
+ this.http.get(environment.baseUrl + 'highMerchant/enableMerchant?id=' + id).subscribe(data => {
+ callBack(data);
+ });
+ }
+
+
}