提交修改

pull/1/head
yuanye 4 years ago
parent e1ba3b8079
commit f52300394b
  1. 18
      src/app/admin/index/index/index.component.html
  2. 258
      src/app/admin/index/index/index.component.ts
  3. 18
      src/app/admin/merchant-store/merchant-store-routing.module.ts
  4. 26
      src/app/admin/merchant-store/merchant-store.module.ts
  5. 1
      src/app/admin/merchant-store/store-detail/store-detail.component.html
  6. 0
      src/app/admin/merchant-store/store-detail/store-detail.component.scss
  7. 15
      src/app/admin/merchant-store/store-detail/store-detail.component.ts
  8. 70
      src/app/admin/merchant-store/store-edit/store-edit.component.html
  9. 6
      src/app/admin/merchant-store/store-edit/store-edit.component.scss
  10. 136
      src/app/admin/merchant-store/store-edit/store-edit.component.ts
  11. 112
      src/app/admin/merchant-store/store-list/store-list.component.html
  12. 4
      src/app/admin/merchant-store/store-list/store-list.component.scss
  13. 133
      src/app/admin/merchant-store/store-list/store-list.component.ts
  14. 33
      src/app/admin/merchant/merchant-detail/merchant-detail.component.html
  15. 4
      src/app/admin/merchant/merchant-detail/merchant-detail.component.scss
  16. 25
      src/app/admin/merchant/merchant-detail/merchant-detail.component.spec.ts
  17. 25
      src/app/admin/merchant/merchant-detail/merchant-detail.component.ts
  18. 232
      src/app/admin/merchant/merchant-edit/merchant-edit.component.ts
  19. 9
      src/app/admin/merchant/merchant-list/merchant-list.component.html
  20. 52
      src/app/admin/merchant/merchant-list/merchant-list.component.ts
  21. 2
      src/app/admin/merchant/merchant-routing.module.ts
  22. 5
      src/app/app-routing.module.ts
  23. 64
      src/app/services/admin-index.service.ts
  24. 91
      src/app/services/merchant-store.service.ts
  25. 39
      src/app/services/merchant.service.ts

@ -1,18 +0,0 @@
<div nz-row>
<div nz-col [nzSpan]="8">
<!--<div>职位发布数量排名</div>-->
<div echarts [options]="positionTopTen"></div>
<div class="enterprise-top" echarts [options]="enterpriseTopTen"></div>
</div>
<div nz-col [nzSpan]="8">
<div echarts [options]="resumeByAge"></div>
<div class="enterprise-top" echarts [options]="deliveryByMonth"></div>
</div>
<div nz-col [nzSpan]="8">
<div echarts [options]="resumeByEdu"></div>
</div>
</div>

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

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

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

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

@ -0,0 +1,70 @@
<!-- start 面包屑 -->
<nz-breadcrumb>
<nz-breadcrumb-item>
<a (click)="getBack()">门店管理</a>
</nz-breadcrumb-item>
<nz-breadcrumb-item>
编辑门店
</nz-breadcrumb-item>
</nz-breadcrumb>
<!-- end 面包屑 -->
<nz-content class="inner-content">
<form nz-form [formGroup]="validateForm" class="ant-advanced-search-form">
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="8">
<nz-form-item>
<nz-form-label [nzFor]="'loginTelephone'" nzRequired>登录手机号</nz-form-label>
<nz-form-control nzErrorTip="请输入登录手机号!">
<input nz-input placeholder="请输入登录手机号..." [formControlName]="'loginTelephone'" id="'loginTelephone'" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="8">
<nz-form-item>
<nz-form-label [nzFor]="'password'" nzRequired>登录密码</nz-form-label>
<nz-form-control nzErrorTip="请输入登录密码!">
<nz-input-group [nzSuffix]="suffixTemplate">
<input [type]="passwordVisible ? 'text' : 'password'" nz-input placeholder="请输入登录密码..." [formControlName]="'password'" id="'password'" />
</nz-input-group>
<ng-template #suffixTemplate>
<i nz-icon [nzType]="passwordVisible ? 'eye-invisible' : 'eye'" (click)="passwordVisible = !passwordVisible"></i>
</ng-template>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="8">
<nz-form-item>
<nz-form-label [nzFor]="'merchantKey'" nzRequired>门店编号</nz-form-label>
<nz-form-control nzErrorTip="请输入门店编号!">
<input nz-input placeholder="请输入门店编号..." [formControlName]="'merchantKey'" id="'merchantKey'" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="8">
<nz-form-item>
<nz-form-label [nzFor]="'merchantName'" nzRequired>门店名称</nz-form-label>
<nz-form-control nzErrorTip="请输入门店名称!">
<input nz-input placeholder="请输入门店名称..." [formControlName]="'merchantName'" id="'merchantName'" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="8">
<nz-form-item>
<nz-form-label [nzFor]="'address'" nzRequired>门店地址</nz-form-label>
<nz-form-control nzErrorTip="请输入门店地址!">
<input nz-input placeholder="请输入门店地址..." [formControlName]="'address'" id="'address'" />
</nz-form-control>
</nz-form-item>
</div>
</div>
<div nz-row>
<div nz-col [nzSpan]="24" class="search-area">
<button nz-button (click)="resetForm()">重置</button>
<button nz-button [nzType]="'primary'" (click)="getSave()">提交</button>
</div>
</div>
</form>
</nz-content>

@ -0,0 +1,6 @@
button {
margin-left: 8px;
}
:host ::ng-deep .ant-upload {
background-color: #ffffff;
}

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

@ -0,0 +1,112 @@
<!-- start 面包屑 -->
<app-breadcrumb></app-breadcrumb>
<!-- end 面包屑 -->
<!--条件搜索-->
<div class="inner-content">
<form nz-form [formGroup]="searchForm" (ngSubmit)="getRequest(true , searchForm.value)">
<div nz-row>
<div nz-col nzSpan="6">
<nz-form-item>
<nz-form-label [nzSpan]="6">商户编号</nz-form-label>
<nz-form-control [nzSpan]="16">
<input nz-input formControlName="merchantKey"/>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="6">
<nz-form-item>
<nz-form-label [nzSpan]="6">商户名称</nz-form-label>
<nz-form-control [nzSpan]="16">
<input nz-input formControlName="merchantName"/>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="6">
<nz-form-item>
<nz-form-label [nzSpan]="6">商户电话</nz-form-label>
<nz-form-control [nzSpan]="16">
<input nz-input formControlName="telephone"/>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="6">
<nz-form-item>
<nz-form-label [nzSpan]="6">商户状态</nz-form-label>
<nz-form-control [nzSpan]="16">
<nz-select nzShowSearch nzAllowClear formControlName="status" nzPlaceHolder="请选择状态">
<nz-option nzLabel="禁用" nzValue="0"></nz-option>
<nz-option nzLabel="正常" nzValue="1"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
</div>
<div nz-row>
<div nz-col nzSpan="24" class="search-button">
<button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button>
<button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload" nzTheme="outline"></i>重置</button>
</div>
</div>
</form>
</div>
<div class="inner-content">
<span>共计 {{total}} 条数据</span>
<div class="operating-button">
<button nz-button nzType="primary" class="right-btn" [routerLink]="['/admin/merchantStore/store-edit']" ><i nz-icon nzType="plus" nzTheme="outline"></i>添加</button>
</div>
<nz-table
class="table"
#ajaxTable
nzShowSizeChanger
[nzFrontPagination]="false"
[nzData]="requestData"
[nzLoading]="loading"
[nzTotal]="total"
[(nzPageIndex)]="pageNum"
[(nzPageSize)]="pageSize"
[nzScroll]="{ x: '1200px' }"
(nzPageIndexChange)="getRequest(false , searchForm.value)"
(nzPageSizeChange)="getRequest(false , searchForm.value)">
<thead nzSingleSort>
<tr>
<th nzWidth="50px">编号</th>
<th nzWidth="80px">商户编号</th>
<th nzWidth="80px">商户名称</th>
<th nzWidth="70px">商户LOGO</th>
<th nzWidth="100px">商户电话</th>
<th nzWidth="100px">创建时间</th>
<th nzWidth="50px">状态</th>
<th nzWidth="80px" nzRight="0px">操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of ajaxTable.data; let i = index">
<td>{{i+1}}</td>
<td>{{data.merchantKey}}</td>
<td>{{data.merchantName}}</td>
<td>
<img class="head_img" src="{{data.merchantLogo}}" onerror="this.src='../../../../assets/admin/navigation/icon.png'" alt="">
</td>
<td>{{data.telephone}}</td>
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.status ===1 ? '正常' : '禁用'}}</td>
<td nzRight="0px" class="table-td-operation">
<a (click)="getEdit(data.id)"><i nz-icon nzType="form" nzTheme="outline" nz-tooltip="编辑"></i></a>
<nz-divider nzType="vertical"></nz-divider>
<a (click)="getDetail(data.id)"><i nz-icon [nzIconfont]="'icon-dingdanxiangqing_icon'" nz-tooltip="商户详情"></i></a>
<nz-divider nzType="vertical"></nz-divider>
<a (click)="getEdit(data.id)"><i nz-icon nzType="unordered-list" nzTheme="outline" nz-tooltip="门店列表"></i></a>
<nz-divider nzType="vertical"></nz-divider>
<a *ngIf="data.status === 1" (click)='disableMerchant(data.id)'><i nz-icon nzType="stop" nzTheme="outline" nz-tooltip="禁用"></i></a>
<a *ngIf="data.status !== 1" (click)='enableMerchant(data.id)'><i nz-icon nzType="check-circle" nzTheme="outline" nz-tooltip="启用"></i></a>
</td>
</tbody>
</nz-table>
</div>

@ -0,0 +1,4 @@
.head_img {
height: 60px;
width: 60px;
}

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

@ -1 +1,32 @@
<p>merchant-detail works!</p>
<div class="inner-content">
<nz-descriptions nzBordered>
<nz-descriptions-item nzTitle="商户logo" [nzSpan]="3">
<img class="head_img" src="{{data.merchantLogo}}" onerror="this.src='../../../../assets/admin/navigation/icon.png'" alt="">
</nz-descriptions-item>
<nz-descriptions-item nzTitle="登录账户">{{data['secUser']['loginName']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="商户编号">{{data['merchantKey']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="商户名称">{{data.merchantName}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="联系电话">{{data.secUser.telephone}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="商户地址">{{data.address}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="状态">{{data.status ===1 ? '正常' : '禁用'}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="银行名称">
{{data.bankName == null ? '未上传' : data.bankName}}
</nz-descriptions-item>
<nz-descriptions-item nzTitle="银行账号">
{{data.bankAccount == null ? '未上传' : data.bankAccount}}
</nz-descriptions-item>
<nz-descriptions-item nzTitle="开户人">
{{data.bankHolder == null ? '未上传' : data.bankHolder}}
</nz-descriptions-item>
<nz-descriptions-item nzTitle="创建时间">
{{data.createTime | date: 'yyyy-MM-dd'}}
</nz-descriptions-item>
<nz-descriptions-item nzTitle="更新时间">
{{data.updateTime | date: 'yyyy-MM-dd'}}
</nz-descriptions-item>
<nz-descriptions-item nzTitle="操作人员">{{data.operatorName }}</nz-descriptions-item>
<nz-descriptions-item nzTitle="简介" [nzSpan]="3">
{{data.merchantDesc}}
</nz-descriptions-item>
</nz-descriptions>
</div>

@ -0,0 +1,4 @@
.head_img {
height: 60px;
width: 60px;
}

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

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

@ -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<string | ArrayBuffer | null> {
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']);
}
});
}
}

@ -95,11 +95,14 @@
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.status ===1 ? '正常' : '禁用'}}</td>
<td nzRight="0px" class="table-td-operation">
<a (click)="getEdit(data.id)"><i nz-icon nzType="form" nzTheme="outline" nz-tooltip="编辑"></i></a>
<a (click)="getEdit(data.id)"><i nz-icon nzType="form" nzTheme="outline" nz-tooltip="编辑"></i></a>
<nz-divider nzType="vertical"></nz-divider>
<a ><i nz-icon [nzIconfont]="'icon-dingdanxiangqing_icon'" nz-tooltip="商户详情"></i></a>
<a (click)="getDetail(data.id)"><i nz-icon [nzIconfont]="'icon-dingdanxiangqing_icon'" nz-tooltip="商户详情"></i></a>
<nz-divider nzType="vertical"></nz-divider>
<a (click)='getForbiddenUser(data.id , data.status)'><i nz-icon nzType="{{data.status === 1 ? 'stop': 'check-circle'}}" nzTheme="outline" nz-tooltip="{{data.status === 1 ? '禁用': '启用'}}"></i></a>
<a (click)="getList(data.id)"><i nz-icon nzType="unordered-list" nzTheme="outline" nz-tooltip="门店列表"></i></a>
<nz-divider nzType="vertical"></nz-divider>
<a *ngIf="data.status === 1" (click)='disableMerchant(data.id)'><i nz-icon nzType="stop" nzTheme="outline" nz-tooltip="禁用"></i></a>
<a *ngIf="data.status !== 1" (click)='enableMerchant(data.id)'><i nz-icon nzType="check-circle" nzTheme="outline" nz-tooltip="启用"></i></a>
</td>
</tbody>
</nz-table>

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

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

@ -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),

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

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

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

Loading…
Cancel
Save