parent
31715635f4
commit
1b68d67ae8
@ -0,0 +1,86 @@ |
||||
<!-- 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> |
||||
|
||||
<nz-divider nzText="代理商信息"></nz-divider> |
||||
<div nz-col [nzSpan]="8"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzFor]="'agentName'" nzRequired>代理商名称</nz-form-label> |
||||
<nz-form-control nzErrorTip="请输入代理商名称!"> |
||||
<input nz-input placeholder="请输入代理商名称..." [formControlName]="'agentName'" id="'agentName'" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="8"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzFor]="'agentAddress'" nzRequired>代理商地址</nz-form-label> |
||||
<nz-form-control nzErrorTip="请输入代理商地址!"> |
||||
<input nz-input placeholder="请输入代理商地址..." [formControlName]="'agentAddress'" id="'agentAddress'" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="8"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzFor]="'agentUser'" nzRequired>联系人</nz-form-label> |
||||
<nz-form-control nzErrorTip="请输入联系人!"> |
||||
<input nz-input placeholder="请输入联系人..." [formControlName]="'agentUser'" id="'agentUser'" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="8"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzFor]="'agentPhone'" nzRequired>联系方式</nz-form-label> |
||||
<nz-form-control nzErrorTip="请输入联系方式!"> |
||||
<input nz-input placeholder="请输入联系方式..." [formControlName]="'agentPhone'" id="'agentPhone'" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
</div> |
||||
<div nz-row> |
||||
<div nz-col [nzSpan]="24" class="search-area"> |
||||
<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,122 @@ |
||||
import { Component, OnInit } from '@angular/core'; |
||||
import {FormBuilder, FormGroup, Validators} from '_@angular_forms@9.0.7@@angular/forms'; |
||||
import {environment} from '../../../../environments/environment'; |
||||
import {AgentService} from '../../../services/agent.service'; |
||||
import {NzMessageService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; |
||||
import {ActivatedRoute} from '_@angular_router@9.0.7@@angular/router'; |
||||
import {ValidatorsService} from '../../../services/validators.service'; |
||||
|
||||
@Component({ |
||||
selector: 'app-user-edit', |
||||
templateUrl: './user-edit.component.html', |
||||
styleUrls: ['./user-edit.component.scss'] |
||||
}) |
||||
export class UserEditComponent implements OnInit { |
||||
|
||||
validateForm!: FormGroup; |
||||
data: any; |
||||
editFlag = false; |
||||
id: number; |
||||
passwordVisible = false; |
||||
logoFile = []; |
||||
WEB_SERVE_URL = environment.baseUrl; |
||||
userId: number; |
||||
time; |
||||
constructor( |
||||
private fb: FormBuilder, |
||||
private agent: AgentService, |
||||
private message: NzMessageService, // 信息提示
|
||||
private activatedRoute: ActivatedRoute, |
||||
) { |
||||
} |
||||
|
||||
ngOnInit(): void { |
||||
this.activatedRoute.queryParams.subscribe(queryParams => { |
||||
if (queryParams.agentId != null) { |
||||
this.editFlag = true; |
||||
this.id = queryParams.agentId; |
||||
this.getDetails(queryParams.agentId); |
||||
} |
||||
}); |
||||
this.validateForm = this.fb.group({ |
||||
loginName: [null, [Validators.required, ValidatorsService.maxLength(20)]], |
||||
password: [null, [Validators.required]], |
||||
agentName: [null, [Validators.required]], |
||||
type: [2], |
||||
agentUser: [null, [Validators.required, ValidatorsService.maxLength(50)]], |
||||
agentPhone: [null, [Validators.required, ValidatorsService.maxLength(50)]], |
||||
agentAddress: [null, [Validators.required, ValidatorsService.maxLength(80)]], |
||||
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']['loginName'] = this.validateForm.value.loginName; |
||||
this.validateForm.value['secUser']['password'] = this.validateForm.value.password; |
||||
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; |
||||
} |
||||
} |
||||
|
||||
if (this.editFlag) { |
||||
this.validateForm.value.id = this.id; |
||||
this.agent.updateAgent(this.validateForm.value, data => { |
||||
if (data['return_code'] === '000000') { |
||||
this.getBack(); |
||||
this.message.success('修改成功'); |
||||
} else { |
||||
this.message.create('error', '修改失败'); |
||||
} |
||||
}); |
||||
} else { |
||||
|
||||
this.agent.insertAgent(this.validateForm.value, data => { |
||||
if (data['return_code'] === '000000') { |
||||
this.getBack(); |
||||
this.message.success('添加成功'); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
public getDetails(id) { |
||||
this.agent.findByAgentId(id, data => { |
||||
console.log(data); |
||||
if (data['return_code'] === '000000') { |
||||
data['return_data'].loginName = data['return_data'].secUser.loginName; |
||||
data['return_data'].password = data['return_data'].secUser.password; |
||||
this.validateForm.patchValue(data['return_data']); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
} |
@ -1 +1,62 @@ |
||||
<p>user-statistical works!</p> |
||||
<!-- 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="8"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="6">时间区间</nz-form-label> |
||||
<nz-form-control [nzSpan]="16"> |
||||
<nz-range-picker [nzShowTime]="{ nzFormat: 'HH:mm' }" formControlName="finishTime"></nz-range-picker> |
||||
</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" (click)="downloadTemplate(searchForm.value)" ><i nz-icon nzType="download" nzTheme="outline"></i>导出订单</button> |
||||
</div> |
||||
<nz-table |
||||
class="table" |
||||
#ajaxTable |
||||
nzShowSizeChanger |
||||
[nzFrontPagination]="false" |
||||
[nzData]="requestData" |
||||
[nzLoading]="loading" |
||||
[nzTotal]="total" |
||||
[(nzPageIndex)]="pageNum" |
||||
[(nzPageSize)]="pageSize" |
||||
(nzPageIndexChange)="getRequest(false , searchForm.value)" |
||||
(nzPageSizeChange)="getRequest(false , searchForm.value)"> |
||||
<thead nzSingleSort> |
||||
<tr> |
||||
<th nzWidth="50px">编号</th> |
||||
<th nzWidth="180px">员工名称</th> |
||||
<th nzWidth="180px">数量</th> |
||||
<th nzWidth="180px">支付金额</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of ajaxTable.data; let i = index"> |
||||
<td>{{i+1}}</td> |
||||
<td>{{data.agentName}}</td> |
||||
<td>{{data.count}}</td> |
||||
<td>{{data.payPrice}}</td> |
||||
</tbody> |
||||
</nz-table> |
||||
</div> |
||||
|
@ -0,0 +1,105 @@ |
||||
<!-- 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="8"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="6">名称</nz-form-label> |
||||
<nz-form-control [nzSpan]="16"> |
||||
<input nz-input formControlName="agentName"/> |
||||
</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"> |
||||
<input nz-input formControlName="agentPhone"/> |
||||
</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> |
||||
|
||||
<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/rechargeOrder/user-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="80px">联系人</th> |
||||
<th nzWidth="70px">联系方式</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.agentName}}</td> |
||||
<td>{{data.agentAddress}}</td> |
||||
<td>{{data.agentUser}}</td> |
||||
<td>{{data.agentPhone}}</td> |
||||
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td nzRight="0px" class="table-td-operation"> |
||||
<a (click)="getEdit(data.id)">编辑</a> |
||||
<a nz-dropdown [nzDropdownMenu]="menu">更多</a> |
||||
<nz-dropdown-menu #menu="nzDropdownMenu"> |
||||
<ul nz-menu nzSelectable> |
||||
<li class="li-a" nz-menu-item><a (click)="generateRechargeAgentQrCode(data.id)">生成二维码</a></li> |
||||
<li class="li-a" nz-menu-item><a (click)='getForbiddenUser(data.id , data.status)'>{{data.status === 1 ? '禁用': '启用'}}</a></li> |
||||
</ul> |
||||
</nz-dropdown-menu> |
||||
</td> |
||||
</tbody> |
||||
</nz-table> |
||||
</div> |
||||
|
@ -0,0 +1,12 @@ |
||||
.head_img { |
||||
height: 80px; |
||||
width: 80px; |
||||
} |
||||
.table-td-operation { |
||||
a { |
||||
margin-left: 8px; |
||||
} |
||||
} |
||||
.li-a :hover { |
||||
color: #1890ff; |
||||
} |
@ -0,0 +1,111 @@ |
||||
import { Component, OnInit } from '@angular/core'; |
||||
import {environment} from '../../../../environments/environment'; |
||||
import {FormBuilder, FormGroup, Validators} from '_@angular_forms@9.0.7@@angular/forms'; |
||||
import {AgentService} from '../../../services/agent.service'; |
||||
import {DiscountService} from '../../../services/discount.service'; |
||||
import {CouponService} from '../../../services/coupon.service'; |
||||
import {IconService} from '../../../services/icon.service'; |
||||
import {NzMessageService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; |
||||
import {Router} from '_@angular_router@9.0.7@@angular/router'; |
||||
import {CommonsService} from '../../../services/commons.service'; |
||||
|
||||
@Component({ |
||||
selector: 'app-user', |
||||
templateUrl: './user.component.html', |
||||
styleUrls: ['./user.component.scss'] |
||||
}) |
||||
export class UserComponent implements OnInit { |
||||
|
||||
WEB_SERVE_URL = environment.imageUrl; |
||||
FILE_URL = environment.imageUrl; |
||||
searchForm: FormGroup; // 搜索框
|
||||
requestData = []; // 列表数据
|
||||
total: number; // 页码
|
||||
pageNum = 1; // 页码
|
||||
pageSize = 10; // 条码
|
||||
loading = true; |
||||
|
||||
|
||||
constructor( |
||||
private form: FormBuilder, |
||||
private agent: AgentService, |
||||
private discount: DiscountService, |
||||
private coupon: CouponService, |
||||
private iconService: IconService, |
||||
private message: NzMessageService, |
||||
private router: Router, |
||||
private common: CommonsService |
||||
) { |
||||
} |
||||
|
||||
ngOnInit(): void { |
||||
this.init(); |
||||
} |
||||
|
||||
public init(): void { |
||||
this.searchForm = this.form.group({ |
||||
agentName: [null], |
||||
agentPhone: [null], |
||||
status: [null], |
||||
type: [2], |
||||
}); |
||||
|
||||
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.agent.getListAgent(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.agent.editStatus(id, dataUser => { |
||||
this.getRequest(false, this.searchForm.value); |
||||
}); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// 修改
|
||||
public getEdit(id: number): void { |
||||
this.router.navigate(['/admin/rechargeOrder/user-edit'], { |
||||
queryParams: { |
||||
agentId: id |
||||
} |
||||
}).then(r => console.log(r)); |
||||
} |
||||
|
||||
public generateRechargeAgentQrCode(id: number): void { |
||||
this.agent.generateRechargeAgentQrCode(id, data => { |
||||
if (data['return_code'] === '000000') { |
||||
window.location.href = this.FILE_URL + data['return_data']; |
||||
} else { |
||||
this.message.error(data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue