parent
391576c0ec
commit
e1ba3b8079
@ -0,0 +1 @@ |
|||||||
|
<p>merchant-detail works!</p> |
@ -0,0 +1,25 @@ |
|||||||
|
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(); |
||||||
|
}); |
||||||
|
}); |
@ -0,0 +1,15 @@ |
|||||||
|
import { Component, OnInit } from '@angular/core'; |
||||||
|
|
||||||
|
@Component({ |
||||||
|
selector: 'app-merchant-detail', |
||||||
|
templateUrl: './merchant-detail.component.html', |
||||||
|
styleUrls: ['./merchant-detail.component.scss'] |
||||||
|
}) |
||||||
|
export class MerchantDetailComponent implements OnInit { |
||||||
|
|
||||||
|
constructor() { } |
||||||
|
|
||||||
|
ngOnInit(): void { |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,132 @@ |
|||||||
|
<!-- 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]="'telephone'" nzRequired>联系电话</nz-form-label> |
||||||
|
<nz-form-control nzErrorTip="请输入联系电话!"> |
||||||
|
<input nz-input placeholder="请输入联系电话..." [formControlName]="'telephone'" id="'telephone'" /> |
||||||
|
</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]="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzFor]="'bankName'" >银行名称</nz-form-label> |
||||||
|
<nz-form-control nzErrorTip="请输入银行名称!"> |
||||||
|
<input nz-input placeholder="请输入银行名称..." [formControlName]="'bankName'" id="'bankName'" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-col [nzSpan]="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzFor]="'bankAccount'" >银行账号</nz-form-label> |
||||||
|
<nz-form-control nzErrorTip="请输入银行账号!"> |
||||||
|
<input nz-input placeholder="请输入银行账号..." [formControlName]="'bankAccount'" id="'bankAccount'" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-col [nzSpan]="8"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label [nzFor]="'bankHolder'" >开户人</nz-form-label> |
||||||
|
<nz-form-control nzErrorTip="请输入开户人!"> |
||||||
|
<input nz-input placeholder="请输入开户人..." [formControlName]="'bankHolder'" id="'bankHolder'" /> |
||||||
|
</nz-form-control> |
||||||
|
</nz-form-item> |
||||||
|
</div> |
||||||
|
<div nz-col [nzSpan]="16"> |
||||||
|
<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 nz-col [nzSpan]="16"> |
||||||
|
<nz-form-item> |
||||||
|
<nz-form-label>商户简介</nz-form-label> |
||||||
|
<nz-form-control> |
||||||
|
<textarea formControlName="merchantDesc" nz-input rows="2" placeholder="请输入商户简介"></textarea> |
||||||
|
</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,133 @@ |
|||||||
|
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'; |
||||||
|
import {ActivatedRoute} from '@angular/router'; |
||||||
|
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); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
@Component({ |
||||||
|
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: {}, |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
// 返回
|
||||||
|
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) { |
||||||
|
this.validateForm.value.merchantLogo = this.logoFile[0]['response']['return_data'][0]; |
||||||
|
} |
||||||
|
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 { |
||||||
|
|
||||||
|
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!); |
||||||
|
} |
||||||
|
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']); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,109 @@ |
|||||||
|
<!-- 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/merchant/merchant-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 ><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> |
||||||
|
</td> |
||||||
|
</tbody> |
||||||
|
</nz-table> |
||||||
|
</div> |
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,4 @@ |
|||||||
|
.head_img { |
||||||
|
height: 60px; |
||||||
|
width: 60px; |
||||||
|
} |
@ -0,0 +1,94 @@ |
|||||||
|
import { Component, OnInit } from '@angular/core'; |
||||||
|
import {FormBuilder, FormGroup} from '@angular/forms'; |
||||||
|
import {UserService} from '../../../services/user.service'; |
||||||
|
import {IconService} from '../../../services/icon.service'; |
||||||
|
import {NzMessageService} from 'ng-zorro-antd'; |
||||||
|
import {CommonsService} from '../../../services/commons.service'; |
||||||
|
import {MerchantService} from '../../../services/merchant.service'; |
||||||
|
import {Router} from '@angular/router'; |
||||||
|
|
||||||
|
@Component({ |
||||||
|
selector: 'app-merchant-list', |
||||||
|
templateUrl: './merchant-list.component.html', |
||||||
|
styleUrls: ['./merchant-list.component.scss'] |
||||||
|
}) |
||||||
|
export class MerchantListComponent implements OnInit { |
||||||
|
|
||||||
|
searchForm: FormGroup; // 搜索框
|
||||||
|
requestData = []; // 列表数据
|
||||||
|
total: number; // 页码
|
||||||
|
pageNum = 1; // 页码
|
||||||
|
pageSize = 10; // 条码
|
||||||
|
loading = true; |
||||||
|
|
||||||
|
constructor( |
||||||
|
private form: FormBuilder, |
||||||
|
private merchant: MerchantService, |
||||||
|
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.merchant.getMerchantList(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 getForbiddenUser(id, status: any): void { |
||||||
|
const message = (status === 1 ? '是否禁用当前用户' : '是否启用当前用户'); |
||||||
|
|
||||||
|
this.common.showConfirm(message, data => { |
||||||
|
if (data) { |
||||||
|
// this.user.forbiddenUser(id, dataUser => {
|
||||||
|
// this.getRequest(false , this.searchForm.value);
|
||||||
|
// });
|
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
// 修改
|
||||||
|
public getEdit(id: number): void { |
||||||
|
this.router.navigate(['/admin/merchant/merchant-list'], { |
||||||
|
queryParams: { |
||||||
|
merchantId: id |
||||||
|
} |
||||||
|
}).then(r => console.log(r)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,53 @@ |
|||||||
|
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 MerchantService { |
||||||
|
|
||||||
|
constructor( |
||||||
|
private http: HttpClient, |
||||||
|
private common: CommonsService |
||||||
|
) { } |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询商户列表 |
||||||
|
* |
||||||
|
* @param paramsObject 对象 |
||||||
|
* @param callBack 回调 |
||||||
|
*/ |
||||||
|
public getMerchantList(paramsObject: object, callBack) { |
||||||
|
this.http.get(environment.baseUrl + 'highMerchant/getMerchantList?' + 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); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据id查询详情 |
||||||
|
* |
||||||
|
* @param merchantId 职位id |
||||||
|
* @param callBack 回调 |
||||||
|
*/ |
||||||
|
public getMerchantById(merchantId: number, callBack) { |
||||||
|
this.http.get(environment.baseUrl + 'highMerchant/getMerchantById?id=' + merchantId).subscribe(data => { |
||||||
|
callBack(data); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue