提交修改

pull/1/head
yuanye 4 years ago
parent a27ab17c17
commit beb234c28d
  1. 11
      src/app/admin/merchant/merchant-routing.module.ts
  2. 14
      src/app/admin/merchant/merchant.module.ts
  3. 22
      src/app/admin/user/user-list/user-list.component.html
  4. 123
      src/app/admin/user/user-list/user-list.component.ts
  5. 2
      src/app/services/icon.service.ts
  6. 12
      src/app/services/user.service.ts

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

@ -22,6 +22,17 @@
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8">
<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 nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="6">注册时间</nz-form-label>
@ -65,7 +76,7 @@
<th nzWidth="50px">性别</th>
<th nzWidth="50px">金币数量</th>
<th nzWidth="100px">注册时间</th>
<th nzWidth="50px">状态</th>
<th nzWidth="50px" [nzSortFn]="true">状态</th>
<th nzWidth="80px" nzRight="0px">操作</th>
</tr>
</thead>
@ -82,12 +93,15 @@
<td>{{data.regTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.status ===1 ? '正常' : '禁用'}}</td>
<td nzRight="0px" class="table-td-operation">
<!-- <a (click)='getDetails(data.id)'><i nz-icon nzType="search" nzTheme="outline" nz-tooltip="详情"></i></a>-->
<a ><i nz-icon [nzIconfont]="'icon-dingdanxiangqing_icon'" nz-tooltip="订单列表"></i></a>
<nz-divider nzType="vertical"></nz-divider>
<!-- <a *ngIf="data.status !== 2" (click)="getEdit(data.id)"><i nz-icon nzType="form" nzTheme="outline" nz-tooltip="修改"></i></a>-->
<!-- <a *ngIf="data.status !== 2 && data.status !== 3 " (click)='getAudit(data.id)'><i nz-icon nzType="audit" nzTheme="outline" nz-tooltip="提交审核"></i></a>-->
<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 *ngIf="data.status !== 2 && data.status !== 3 " (click)='getDelete(data.id)'><i nz-icon nzType="delete" nzTheme="outline" nz-tooltip="删除"></i></a>-->
</td>
</tr>
</tbody>
</nz-table>
</div>

@ -1,68 +1,89 @@
import { Component, OnInit } from '@angular/core';
import {Component, OnInit} from '@angular/core';
import {FormBuilder, FormGroup} from '@angular/forms';
import {UserService} from '../../../services/user.service';
import {NzMessageService} from 'ng-zorro-antd';
import {IconService} from '../../../services/icon.service';
import {CommonsService} from '../../../services/commons.service';
@Component({
selector: 'app-user-list',
templateUrl: './user-list.component.html',
styleUrls: ['./user-list.component.scss']
selector: 'app-user-list',
templateUrl: './user-list.component.html',
styleUrls: ['./user-list.component.scss']
})
export class UserListComponent implements OnInit {
searchForm: FormGroup; // 搜索框
requestData = []; // 列表数据
total: number; // 页码
pageNum = 1; // 页码
pageSize = 10; // 条码
loading = true;
regTime;
constructor(
private form: FormBuilder,
private user: UserService,
private message: NzMessageService
) { }
searchForm: FormGroup; // 搜索框
requestData = []; // 列表数据
total: number; // 页码
pageNum = 1; // 页码
pageSize = 10; // 条码
loading = true;
regTime;
ngOnInit(): void {
this.init();
}
constructor(
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({
name: [null],
phone: [null],
regTime: [null],
});
this.getRequest(true , this.searchForm.value);
}
// 查询列表
public getRequest(reset: boolean = false, whereObject: object) {
// 查询列表
public getRequest(reset: boolean = false , whereObject: object) {
if (whereObject['regTime'] != null && whereObject['regTime'].length !== 0) {
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];
whereObject['regTimeEnd'] = whereObject['regTime'][1];
// 重置
public resetForm(): void {
this.searchForm.reset();
}
this.loading = false;
if (reset) {
this.pageNum = 1;
public getForbiddenUser(id, status: any): void {
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();
}
}

@ -12,7 +12,7 @@ export class IconService {
constructor(private iconService: NzIconService) {
this.iconService.fetchFromIconfont({
scriptUrl: 'https://at.alicdn.com/t/font_2413274_o08racrjdz.js'
scriptUrl: 'https://at.alicdn.com/t/font_2413274_zk7ae4qcrvg.js'
});
}
}

@ -48,4 +48,16 @@ export class UserService {
});
}
/**
*
*
* @param userId id
* @param callBack
*/
public forbiddenUser(userId: number, callBack) {
this.http.get(environment.baseUrl + 'highUser/forbiddenUser?userId=' + userId).subscribe(data => {
callBack(data);
});
}
}

Loading…
Cancel
Save