You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
3.1 KiB
111 lines
3.1 KiB
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']);
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|
|
|