parent
a27ab17c17
commit
beb234c28d
@ -0,0 +1,11 @@ |
|||||||
|
import { NgModule } from '@angular/core'; |
||||||
|
import { Routes, RouterModule } from '@angular/router'; |
||||||
|
|
||||||
|
|
||||||
|
const routes: Routes = []; |
||||||
|
|
||||||
|
@NgModule({ |
||||||
|
imports: [RouterModule.forChild(routes)], |
||||||
|
exports: [RouterModule] |
||||||
|
}) |
||||||
|
export class MerchantRoutingModule { } |
@ -0,0 +1,14 @@ |
|||||||
|
import { NgModule } from '@angular/core'; |
||||||
|
import { CommonModule } from '@angular/common'; |
||||||
|
|
||||||
|
import { MerchantRoutingModule } from './merchant-routing.module'; |
||||||
|
|
||||||
|
|
||||||
|
@NgModule({ |
||||||
|
declarations: [], |
||||||
|
imports: [ |
||||||
|
CommonModule, |
||||||
|
MerchantRoutingModule |
||||||
|
] |
||||||
|
}) |
||||||
|
export class MerchantModule { } |
@ -1,68 +1,89 @@ |
|||||||
import { Component, OnInit } from '@angular/core'; |
import {Component, OnInit} from '@angular/core'; |
||||||
import {FormBuilder, FormGroup} from '@angular/forms'; |
import {FormBuilder, FormGroup} from '@angular/forms'; |
||||||
import {UserService} from '../../../services/user.service'; |
import {UserService} from '../../../services/user.service'; |
||||||
import {NzMessageService} from 'ng-zorro-antd'; |
import {NzMessageService} from 'ng-zorro-antd'; |
||||||
|
import {IconService} from '../../../services/icon.service'; |
||||||
|
import {CommonsService} from '../../../services/commons.service'; |
||||||
|
|
||||||
@Component({ |
@Component({ |
||||||
selector: 'app-user-list', |
selector: 'app-user-list', |
||||||
templateUrl: './user-list.component.html', |
templateUrl: './user-list.component.html', |
||||||
styleUrls: ['./user-list.component.scss'] |
styleUrls: ['./user-list.component.scss'] |
||||||
}) |
}) |
||||||
export class UserListComponent implements OnInit { |
export class UserListComponent implements OnInit { |
||||||
|
|
||||||
searchForm: FormGroup; // 搜索框
|
searchForm: FormGroup; // 搜索框
|
||||||
requestData = []; // 列表数据
|
requestData = []; // 列表数据
|
||||||
total: number; // 页码
|
total: number; // 页码
|
||||||
pageNum = 1; // 页码
|
pageNum = 1; // 页码
|
||||||
pageSize = 10; // 条码
|
pageSize = 10; // 条码
|
||||||
loading = true; |
loading = true; |
||||||
regTime; |
regTime; |
||||||
constructor( |
|
||||||
private form: FormBuilder, |
|
||||||
private user: UserService, |
|
||||||
private message: NzMessageService |
|
||||||
) { } |
|
||||||
|
|
||||||
ngOnInit(): void { |
constructor( |
||||||
this.init(); |
private form: FormBuilder, |
||||||
} |
private user: UserService, |
||||||
|
private iconService: IconService, |
||||||
|
private message: NzMessageService, |
||||||
|
private common: CommonsService |
||||||
|
) { |
||||||
|
} |
||||||
|
|
||||||
|
ngOnInit(): void { |
||||||
|
this.init(); |
||||||
|
} |
||||||
|
|
||||||
|
public init(): void { |
||||||
|
this.searchForm = this.form.group({ |
||||||
|
name: [null], |
||||||
|
status: [null], |
||||||
|
phone: [null], |
||||||
|
regTime: [null], |
||||||
|
}); |
||||||
|
this.getRequest(true, this.searchForm.value); |
||||||
|
} |
||||||
|
|
||||||
public init(): void { |
// 查询列表
|
||||||
this.searchForm = this.form.group({ |
public getRequest(reset: boolean = false, whereObject: object) { |
||||||
name: [null], |
|
||||||
phone: [null], |
|
||||||
regTime: [null], |
|
||||||
}); |
|
||||||
this.getRequest(true , this.searchForm.value); |
|
||||||
} |
|
||||||
|
|
||||||
// 查询列表
|
if (whereObject['regTime'] != null && whereObject['regTime'].length !== 0) { |
||||||
public getRequest(reset: boolean = false , whereObject: object) { |
whereObject['regTimeStart'] = whereObject['regTime'][0].getTime(); |
||||||
|
whereObject['regTimeEnd'] = whereObject['regTime'][1].getTime(); |
||||||
|
} |
||||||
|
this.loading = false; |
||||||
|
if (reset) { |
||||||
|
this.pageNum = 1; |
||||||
|
} |
||||||
|
whereObject['pageNum'] = this.pageNum; |
||||||
|
whereObject['pageSize'] = this.pageSize; |
||||||
|
this.user.getListUser(whereObject, data => { |
||||||
|
console.log(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']); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
if (whereObject['regTime'] != null && whereObject['regTime'].length !== 0) { |
// 重置
|
||||||
whereObject['regTimeStart'] = whereObject['regTime'][0]; |
public resetForm(): void { |
||||||
whereObject['regTimeEnd'] = whereObject['regTime'][1]; |
this.searchForm.reset(); |
||||||
} |
} |
||||||
this.loading = false; |
|
||||||
if (reset) { |
public getForbiddenUser(id, status: any): void { |
||||||
this.pageNum = 1; |
const message = (status === 1 ? '是否禁用当前用户' : '是否启用当前用户'); |
||||||
|
|
||||||
|
this.common.showConfirm(message, data => { |
||||||
|
if (data) { |
||||||
|
this.user.forbiddenUser(id, dataUser => { |
||||||
|
console.log(dataUser); |
||||||
|
this.getRequest(false , this.searchForm.value); |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
} |
} |
||||||
whereObject['pageNum'] = this.pageNum; |
|
||||||
whereObject['pageSize'] = this.pageSize; |
|
||||||
this.user.getListUser( whereObject, data => { |
|
||||||
console.log(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(); |
|
||||||
} |
|
||||||
|
|
||||||
} |
} |
||||||
|
Loading…
Reference in new issue