commit
87095cc97a
@ -0,0 +1 @@ |
|||||||
|
<p>company-detail works!</p> |
@ -0,0 +1,25 @@ |
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; |
||||||
|
|
||||||
|
import { CompanyDetailComponent } from './company-detail.component'; |
||||||
|
|
||||||
|
describe('CompanyDetailComponent', () => { |
||||||
|
let component: CompanyDetailComponent; |
||||||
|
let fixture: ComponentFixture<CompanyDetailComponent>; |
||||||
|
|
||||||
|
beforeEach(async(() => { |
||||||
|
TestBed.configureTestingModule({ |
||||||
|
declarations: [ CompanyDetailComponent ] |
||||||
|
}) |
||||||
|
.compileComponents(); |
||||||
|
})); |
||||||
|
|
||||||
|
beforeEach(() => { |
||||||
|
fixture = TestBed.createComponent(CompanyDetailComponent); |
||||||
|
component = fixture.componentInstance; |
||||||
|
fixture.detectChanges(); |
||||||
|
}); |
||||||
|
|
||||||
|
it('should create', () => { |
||||||
|
expect(component).toBeTruthy(); |
||||||
|
}); |
||||||
|
}); |
@ -0,0 +1,15 @@ |
|||||||
|
import { Component, OnInit } from '@angular/core'; |
||||||
|
|
||||||
|
@Component({ |
||||||
|
selector: 'app-company-detail', |
||||||
|
templateUrl: './company-detail.component.html', |
||||||
|
styleUrls: ['./company-detail.component.scss'] |
||||||
|
}) |
||||||
|
export class CompanyDetailComponent implements OnInit { |
||||||
|
|
||||||
|
constructor() { } |
||||||
|
|
||||||
|
ngOnInit(): void { |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,109 @@ |
|||||||
|
<!-- start 面包屑 --> |
||||||
|
<nz-breadcrumb> |
||||||
|
<nz-breadcrumb-item> |
||||||
|
系统管理 |
||||||
|
</nz-breadcrumb-item> |
||||||
|
<nz-breadcrumb-item> |
||||||
|
增加单位 |
||||||
|
</nz-breadcrumb-item> |
||||||
|
</nz-breadcrumb> |
||||||
|
<!-- end 面包屑 --> |
||||||
|
|
||||||
|
<div class="inner-content"> |
||||||
|
|
||||||
|
<div nz-row> |
||||||
|
<div nz-col nzSpan="2"></div> |
||||||
|
<div nz-col nzSpan="20"> |
||||||
|
<form nz-form [formGroup]="validateForm" > |
||||||
|
<div nz-row [nzGutter]="24"> |
||||||
|
<nz-divider nzText="账号信息"></nz-divider> |
||||||
|
<div nz-col [nzSpan]="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzFor]="'loginName'" nzRequired>用户名</nz-form-label> |
||||||
|
<nz-form-control nzErrorTip="请输入用户名!"> |
||||||
|
<input nz-input placeholder="请输入用户名..." [formControlName]="'loginName'" id="'loginName'" /> |
||||||
|
</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]="'phone'" nzRequired>联系电话</nz-form-label> |
||||||
|
<nz-form-control nzErrorTip="请输入联系电话!"> |
||||||
|
<input nz-input placeholder="请输入联系电话..." [formControlName]="'phone'" id="'phone'" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<nz-divider nzText="单位信息"></nz-divider> |
||||||
|
<div nz-col [nzSpan]="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzFor]="'telephone'" nzRequired>所属地区</nz-form-label> |
||||||
|
<nz-form-control nzErrorTip="请输入所属地区!"> |
||||||
|
<app-region-selector *ngIf="!editFlag" [selectLevel]="2" (selectedRegionIdChange)="regionChange($event)"></app-region-selector> |
||||||
|
<input *ngIf="editFlag" nz-input [formControlName]="'regionName'" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-col [nzSpan]="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzFor]="'name'" nzRequired>单位名称</nz-form-label> |
||||||
|
<nz-form-control nzErrorTip="请输入单位名称!"> |
||||||
|
<input nz-input placeholder="请输入单位名称..." [formControlName]="'name'" id="'name'" /> |
||||||
|
</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 nz-col [nzSpan]="20"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label>单位LOGO</nz-form-label> |
||||||
|
<nz-form-control> |
||||||
|
<nz-upload |
||||||
|
nzAction="{{WEB_SERVE_URL}}/fileUpload/uploadfile" |
||||||
|
nzListType="picture-card" |
||||||
|
[(nzFileList)]="logoFile" |
||||||
|
[nzShowButton]="logoFile.length < 1" |
||||||
|
[nzPreview]="handlePreview" |
||||||
|
> |
||||||
|
<i nz-icon nzType="plus"></i> |
||||||
|
<div class="ant-upload-text">上传LOGO</div> |
||||||
|
</nz-upload> |
||||||
|
<nz-modal [nzVisible]="previewVisible" [nzContent]="modalContent" [nzFooter]="null" (nzOnCancel)="previewVisible = false"> |
||||||
|
<ng-template #modalContent> |
||||||
|
<img [src]="previewImage" [ngStyle]="{ width: '100%' }" /> |
||||||
|
</ng-template> |
||||||
|
</nz-modal> |
||||||
|
</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> |
||||||
|
</div> |
||||||
|
<div nz-col nzSpan="2"></div> |
||||||
|
</div> |
||||||
|
</div> |
@ -0,0 +1,6 @@ |
|||||||
|
button { |
||||||
|
margin-left: 8px; |
||||||
|
} |
||||||
|
:host ::ng-deep .ant-upload { |
||||||
|
background-color: #ffffff; |
||||||
|
} |
@ -0,0 +1,168 @@ |
|||||||
|
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'; |
||||||
|
import {CompanyService} from '../../../services/company.service'; |
||||||
|
|
||||||
|
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); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
@Component({ |
||||||
|
selector: 'app-company-edit', |
||||||
|
templateUrl: './company-edit.component.html', |
||||||
|
styleUrls: ['./company-edit.component.scss'] |
||||||
|
}) |
||||||
|
export class CompanyEditComponent implements OnInit { |
||||||
|
|
||||||
|
validateForm!: FormGroup; |
||||||
|
data: any; |
||||||
|
editFlag = false; |
||||||
|
id: number; |
||||||
|
passwordVisible = false; |
||||||
|
logoFile = []; |
||||||
|
WEB_SERVE_URL = environment.baseUrl; |
||||||
|
previewImage: string | undefined = ''; |
||||||
|
previewVisible = false; |
||||||
|
regionId; |
||||||
|
constructor( |
||||||
|
private fb: FormBuilder, |
||||||
|
private company: CompanyService, |
||||||
|
private message: NzMessageService, // 信息提示
|
||||||
|
private activatedRoute: ActivatedRoute, |
||||||
|
) { |
||||||
|
} |
||||||
|
|
||||||
|
ngOnInit(): void { |
||||||
|
this.activatedRoute.queryParams.subscribe(queryParams => { |
||||||
|
if (queryParams.companyId != null) { |
||||||
|
this.editFlag = true; |
||||||
|
this.id = queryParams.companyId; |
||||||
|
this.getDetails(queryParams.companyId); |
||||||
|
} |
||||||
|
}); |
||||||
|
this.validateForm = this.fb.group({ |
||||||
|
loginName: [null, [Validators.required, ValidatorsService.maxLength(20)]], |
||||||
|
password: [null, [Validators.required, ValidatorsService.maxLength(20)]], |
||||||
|
phone: [null, [Validators.required, ValidatorsService.mobile]], |
||||||
|
regionId: [null], |
||||||
|
name: [null, [Validators.required, ValidatorsService.maxLength(50)]], |
||||||
|
address: [null, [Validators.required, ValidatorsService.maxLength(80)]], |
||||||
|
logo: [null], |
||||||
|
status: [null], |
||||||
|
createTime: [null], |
||||||
|
regionName: [null], |
||||||
|
company: {}, |
||||||
|
user: {}, |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
// 返回
|
||||||
|
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; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (this.logoFile.length !== 0) { |
||||||
|
if (this.logoFile[0]['response'] != null) { |
||||||
|
this.validateForm.value.logo = this.logoFile[0]['response']['return_data'][0]; |
||||||
|
} else { |
||||||
|
this.validateForm.value.logo = this.logoFile[0].name; |
||||||
|
} |
||||||
|
} |
||||||
|
this.validateForm.value['company']['name'] = this.validateForm.value.name; |
||||||
|
this.validateForm.value['company']['regionId'] = this.regionId; |
||||||
|
this.validateForm.value['company']['address'] = this.validateForm.value.address; |
||||||
|
this.validateForm.value['company']['phone'] = this.validateForm.value.phone; |
||||||
|
this.validateForm.value['company']['logo'] = this.validateForm.value.logo; |
||||||
|
this.validateForm.value['user']['loginName'] = this.validateForm.value.loginName; |
||||||
|
this.validateForm.value['user']['password'] = this.validateForm.value.password; |
||||||
|
console.log(this.validateForm.value); |
||||||
|
if (this.editFlag) { |
||||||
|
this.validateForm.value.id = this.id; |
||||||
|
this.company.updateCompany(this.validateForm.value, data => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.getBack(); |
||||||
|
this.message.success('修改成功'); |
||||||
|
} else { |
||||||
|
this.message.create('error', '修改失败'); |
||||||
|
} |
||||||
|
}); |
||||||
|
} else { |
||||||
|
|
||||||
|
this.company.addCompanyAndUser(this.validateForm.value, data => { |
||||||
|
console.log(data); |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
this.getBack(); |
||||||
|
this.message.success('添加成功'); |
||||||
|
} else { |
||||||
|
this.message.create('error', data['return_msg']); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// 图片查看
|
||||||
|
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; |
||||||
|
} |
||||||
|
|
||||||
|
public getDetails(id) { |
||||||
|
this.company.getMerchantById(id, data => { |
||||||
|
if (data['return_code'] === '000000') { |
||||||
|
console.log(data); |
||||||
|
data['return_data']['company'].loginName = data['return_data'].user.loginName; |
||||||
|
data['return_data']['company'].password = data['return_data'].user.password; |
||||||
|
if (data['return_data']['company']['logo'] != null && data['return_data']['company']['logo'] !== '') { |
||||||
|
const logo = String(data['return_data']['company']['logo']); |
||||||
|
const logoArray = []; |
||||||
|
logoArray.push( |
||||||
|
{ |
||||||
|
uid: 1, |
||||||
|
name: logo, |
||||||
|
status: 'done', |
||||||
|
url: environment.imageUrl + logo |
||||||
|
}); |
||||||
|
this.logoFile = logoArray; |
||||||
|
} |
||||||
|
this.validateForm.patchValue(data['return_data']['company']); |
||||||
|
console.log(this.validateForm.value); |
||||||
|
} else { |
||||||
|
this.message.create('error', data['return_msg']); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
regionChange(regionId) { |
||||||
|
this.regionId = regionId; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,85 @@ |
|||||||
|
<!-- 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="name"/> |
||||||
|
</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/company/company-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">联系方式</th> |
||||||
|
<th nzWidth="100px">地址</th> |
||||||
|
<th nzWidth="100px">创建时间</th> |
||||||
|
<th nzWidth="100px">更新时间</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.regionName}}</td> |
||||||
|
<td>{{data.name}}</td> |
||||||
|
<td>{{data.phone}}</td> |
||||||
|
<td>{{data.address}}</td> |
||||||
|
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||||
|
<td>{{data.updateTime | date: 'yyyy-MM-dd HH:mm'}}</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-xiangqing'" nz-tooltip="商户详情"></i></a> |
||||||
|
<nz-divider nzType="vertical"></nz-divider> |
||||||
|
<a (click)="getList(data.id , data.merchantName)"><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,135 @@ |
|||||||
|
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 {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 { |
||||||
|
|
||||||
|
searchForm: FormGroup; // 搜索框
|
||||||
|
requestData = []; // 列表数据
|
||||||
|
total: number; // 页码
|
||||||
|
pageNum = 1; // 页码
|
||||||
|
pageSize = 10; // 条码
|
||||||
|
loading = true; |
||||||
|
|
||||||
|
constructor( |
||||||
|
private form: FormBuilder, |
||||||
|
private company: CompanyService, |
||||||
|
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.company.selectCompanyList(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.company.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.company.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/company/company-edit'], { |
||||||
|
queryParams: { |
||||||
|
companyId: 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 , merchantName: string): void { |
||||||
|
this.router.navigate(['/admin/merchantStore/store-list'], { |
||||||
|
queryParams: { |
||||||
|
merchantId: id, |
||||||
|
name: merchantName, |
||||||
|
} |
||||||
|
}).then(r => console.log(r)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
@ -0,0 +1,18 @@ |
|||||||
|
import { NgModule } from '@angular/core'; |
||||||
|
import { Routes, RouterModule } from '@angular/router'; |
||||||
|
import {CompanyEditComponent} from './company-edit/company-edit.component'; |
||||||
|
import {CompanyDetailComponent} from './company-detail/company-detail.component'; |
||||||
|
import {CompanyListComponent} from './company-list/company-list.component'; |
||||||
|
|
||||||
|
|
||||||
|
const routes: Routes = [ |
||||||
|
{ path: 'company-list', component: CompanyListComponent }, |
||||||
|
{ path: 'company-edit', component: CompanyEditComponent}, |
||||||
|
{ path: 'company-detail', component: CompanyDetailComponent} |
||||||
|
]; |
||||||
|
|
||||||
|
@NgModule({ |
||||||
|
imports: [RouterModule.forChild(routes)], |
||||||
|
exports: [RouterModule] |
||||||
|
}) |
||||||
|
export class CompanyRoutingModule { } |
@ -0,0 +1,28 @@ |
|||||||
|
import { NgModule } from '@angular/core'; |
||||||
|
import { CommonModule } from '@angular/common'; |
||||||
|
|
||||||
|
import { CompanyRoutingModule } from './company-routing.module'; |
||||||
|
import { CompanyListComponent } from './company-list/company-list.component'; |
||||||
|
import { CompanyEditComponent } from './company-edit/company-edit.component'; |
||||||
|
import { CompanyDetailComponent } from './company-detail/company-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'; |
||||||
|
import {RegionSelectorModule} from '../../common/region-selector/region-selector.module'; |
||||||
|
|
||||||
|
|
||||||
|
@NgModule({ |
||||||
|
declarations: [CompanyListComponent, CompanyEditComponent, CompanyDetailComponent], |
||||||
|
imports: [ |
||||||
|
CommonModule, |
||||||
|
CompanyRoutingModule, |
||||||
|
NgZorroAntdModule, |
||||||
|
SeparateModule, |
||||||
|
ReactiveFormsModule, |
||||||
|
FormsModule, |
||||||
|
BreadcrumbModule, |
||||||
|
RegionSelectorModule |
||||||
|
] |
||||||
|
}) |
||||||
|
export class CompanyModule { } |
@ -0,0 +1,92 @@ |
|||||||
|
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 CompanyService { |
||||||
|
|
||||||
|
constructor( |
||||||
|
private http: HttpClient, |
||||||
|
private common: CommonsService |
||||||
|
) { } |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询公司列表 |
||||||
|
* |
||||||
|
* @param paramsObject 对象 |
||||||
|
* @param callBack 回调 |
||||||
|
*/ |
||||||
|
public selectCompanyList(paramsObject: object, callBack) { |
||||||
|
this.http.get(environment.baseUrl + 'bsCompany/selectCompanyList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增卡券 |
||||||
|
* |
||||||
|
* @param params 上传对象 |
||||||
|
* @param callBack 回调 |
||||||
|
* @return data 返回结果 |
||||||
|
*/ |
||||||
|
public addCompanyAndUser(params: object, callBack) { |
||||||
|
this.http.post(environment.baseUrl + 'bsCompany/addCompanyAndUser', params).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改卡券 |
||||||
|
* |
||||||
|
* @param params 上传对象 |
||||||
|
* @param callBack 回调 |
||||||
|
* @return data 返回结果 |
||||||
|
*/ |
||||||
|
public updateCompany(params: object, callBack) { |
||||||
|
this.http.post(environment.baseUrl + 'bsCompany/updateCompany', params).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据id查询详情 |
||||||
|
* |
||||||
|
* @param companyId 公司id |
||||||
|
* @param callBack 回调 |
||||||
|
*/ |
||||||
|
public getMerchantById(companyId: number, callBack) { |
||||||
|
this.http.get(environment.baseUrl + 'bsCompany/companyView?companyId=' + companyId).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); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,91 @@ |
|||||||
|
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 CouponService { |
||||||
|
constructor( |
||||||
|
private http: HttpClient, |
||||||
|
private common: CommonsService |
||||||
|
) { } |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询卡券列表 |
||||||
|
* |
||||||
|
* @param paramsObject 对象 |
||||||
|
* @param callBack 回调 |
||||||
|
*/ |
||||||
|
public getCouponList(paramsObject: object, callBack) { |
||||||
|
this.http.get(environment.baseUrl + 'coupon/getCouponList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增卡券 |
||||||
|
* |
||||||
|
* @param params 上传对象 |
||||||
|
* @param callBack 回调 |
||||||
|
* @return data 返回结果 |
||||||
|
*/ |
||||||
|
public insertCoupon(params: object, callBack) { |
||||||
|
this.http.post(environment.baseUrl + 'coupon/insertCoupon', params).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改卡券 |
||||||
|
* |
||||||
|
* @param params 上传对象 |
||||||
|
* @param callBack 回调 |
||||||
|
* @return data 返回结果 |
||||||
|
*/ |
||||||
|
public updateCoupon(params: object, callBack) { |
||||||
|
this.http.post(environment.baseUrl + 'coupon/updateCoupon', 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); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue