From 1b68d67ae86f6bde717a8ac17b52c6492e1ffb12 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Wed, 23 Jun 2021 01:11:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agent/agent-edit/agent-edit.component.ts | 1 + .../agent/agent-list/agent-list.component.ts | 1 + .../order-list/order-list.component.html | 20 ++- .../order-list/order-list.component.ts | 34 ++++- .../order-statistical.component.html | 4 +- .../order-statistical.component.ts | 17 +++ .../recharge-order-routing.module.ts | 6 +- .../recharge-order/recharge-order.module.ts | 4 +- .../user-edit/user-edit.component.html | 86 ++++++++++++ .../user-edit/user-edit.component.scss | 6 + .../user-edit/user-edit.component.ts | 122 ++++++++++++++++++ .../user-statistical.component.html | 63 ++++++++- .../user-statistical.component.ts | 68 +++++++++- .../recharge-order/user/user.component.html | 105 +++++++++++++++ .../recharge-order/user/user.component.scss | 12 ++ .../recharge-order/user/user.component.ts | 111 ++++++++++++++++ src/app/services/agent.service.ts | 13 ++ src/app/services/recharge.service.ts | 50 +++++++ 18 files changed, 714 insertions(+), 9 deletions(-) create mode 100644 src/app/admin/recharge-order/user-edit/user-edit.component.html create mode 100644 src/app/admin/recharge-order/user-edit/user-edit.component.scss create mode 100644 src/app/admin/recharge-order/user-edit/user-edit.component.ts create mode 100644 src/app/admin/recharge-order/user/user.component.html create mode 100644 src/app/admin/recharge-order/user/user.component.scss create mode 100644 src/app/admin/recharge-order/user/user.component.ts diff --git a/src/app/admin/agent/agent-edit/agent-edit.component.ts b/src/app/admin/agent/agent-edit/agent-edit.component.ts index ec899e6..69a99ee 100644 --- a/src/app/admin/agent/agent-edit/agent-edit.component.ts +++ b/src/app/admin/agent/agent-edit/agent-edit.component.ts @@ -43,6 +43,7 @@ export class AgentEditComponent implements OnInit { loginName: [null, [Validators.required, ValidatorsService.maxLength(20)]], password: [null, [Validators.required]], agentName: [null, [Validators.required]], + type: [1], agentUser: [null, [Validators.required, ValidatorsService.maxLength(50)]], agentPhone: [null, [Validators.required, ValidatorsService.maxLength(50)]], agentAddress: [null, [Validators.required, ValidatorsService.maxLength(80)]], diff --git a/src/app/admin/agent/agent-list/agent-list.component.ts b/src/app/admin/agent/agent-list/agent-list.component.ts index c3a165c..389b346 100644 --- a/src/app/admin/agent/agent-list/agent-list.component.ts +++ b/src/app/admin/agent/agent-list/agent-list.component.ts @@ -70,6 +70,7 @@ export class AgentListComponent implements OnInit { agentName: [null], agentPhone: [null], status: [null], + type: [1], }); this.validateForm = this.form.group({ discountId: [null, [Validators.required]], diff --git a/src/app/admin/recharge-order/order-list/order-list.component.html b/src/app/admin/recharge-order/order-list/order-list.component.html index c78b40c..847d1a5 100644 --- a/src/app/admin/recharge-order/order-list/order-list.component.html +++ b/src/app/admin/recharge-order/order-list/order-list.component.html @@ -59,6 +59,22 @@ +
+ + 支付时间 + + + + +
+
+ + 创建时间 + + + + +
@@ -72,9 +88,11 @@
-
共计 {{total}} 条数据 +
+ +
{ + if (data['return_code'] === '000000') { + window.location.href = this.FILE_URL + data['return_data']; + } else { + this.message.error(data['return_msg']); + } + }); + } + + } diff --git a/src/app/admin/recharge-order/order-statistical/order-statistical.component.html b/src/app/admin/recharge-order/order-statistical/order-statistical.component.html index 88dc1ce..8d58059 100644 --- a/src/app/admin/recharge-order/order-statistical/order-statistical.component.html +++ b/src/app/admin/recharge-order/order-statistical/order-statistical.component.html @@ -29,7 +29,7 @@
共计 {{total}} 条数据
- +
{{i+1}} - {{data.day}} + {{data.day | date: 'yyyy-MM-dd'}} {{data.count}} {{data.payPrice}} {{data.orderPrice}} diff --git a/src/app/admin/recharge-order/order-statistical/order-statistical.component.ts b/src/app/admin/recharge-order/order-statistical/order-statistical.component.ts index a52305d..db730e4 100644 --- a/src/app/admin/recharge-order/order-statistical/order-statistical.component.ts +++ b/src/app/admin/recharge-order/order-statistical/order-statistical.component.ts @@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core'; import {RechargeService} from '../../../services/recharge.service'; import {FormBuilder, FormGroup} from '_@angular_forms@9.0.7@@angular/forms'; import {NzMessageService} from 'ng-zorro-antd'; +import {environment} from '../../../../environments/environment'; @Component({ selector: 'app-order-statistical', @@ -10,6 +11,7 @@ import {NzMessageService} from 'ng-zorro-antd'; }) export class OrderStatisticalComponent implements OnInit { searchForm: FormGroup; // 搜索框 + FILE_URL = environment.imageUrl; requestData = []; // 列表数据 total: number; // 页码 pageNum = 1; // 页码 @@ -60,4 +62,19 @@ export class OrderStatisticalComponent implements OnInit { this.searchForm.reset(); } + // 下载模板 + downloadTemplate(whereObject) { + if (whereObject['finishTime'] != null && whereObject['finishTime'].length !== 0) { + whereObject['finishTimeS'] = whereObject['finishTime'][0].getTime(); + whereObject['finishTimeE'] = whereObject['finishTime'][1].getTime(); + } + this.recharge.exportOrderListCount(whereObject, data => { + if (data['return_code'] === '000000') { + window.location.href = this.FILE_URL + data['return_data']; + } else { + this.message.error(data['return_msg']); + } + }); + } + } diff --git a/src/app/admin/recharge-order/recharge-order-routing.module.ts b/src/app/admin/recharge-order/recharge-order-routing.module.ts index 32c5b6f..170c1fe 100644 --- a/src/app/admin/recharge-order/recharge-order-routing.module.ts +++ b/src/app/admin/recharge-order/recharge-order-routing.module.ts @@ -4,13 +4,17 @@ import {OrderListComponent} from './order-list/order-list.component'; import {PriceListComponent} from './price-list/price-list.component'; import {OrderStatisticalComponent} from './order-statistical/order-statistical.component'; import {UserStatisticalComponent} from './user-statistical/user-statistical.component'; +import {UserComponent} from './user/user.component'; +import {UserEditComponent} from './user-edit/user-edit.component'; const routes: Routes = [ { path: 'order-list', component: OrderListComponent }, { path: 'price-list', component: PriceListComponent}, { path: 'price-list', component: PriceListComponent}, { path: 'order-statistical', component: OrderStatisticalComponent}, - { path: 'user-statistical', component: UserStatisticalComponent}, + { path: 'user-statistics', component: UserStatisticalComponent}, + { path: 'user', component: UserComponent}, + { path: 'user-edit', component: UserEditComponent}, ]; @NgModule({ diff --git a/src/app/admin/recharge-order/recharge-order.module.ts b/src/app/admin/recharge-order/recharge-order.module.ts index b0479d4..12d9959 100644 --- a/src/app/admin/recharge-order/recharge-order.module.ts +++ b/src/app/admin/recharge-order/recharge-order.module.ts @@ -12,10 +12,12 @@ import {RegionSelectorModule} from '../../common/region-selector/region-selector import {AppCommonModule} from '../../app-common.module'; import { OrderStatisticalComponent } from './order-statistical/order-statistical.component'; import { UserStatisticalComponent } from './user-statistical/user-statistical.component'; +import { UserComponent } from './user/user.component'; +import { UserEditComponent } from './user-edit/user-edit.component'; @NgModule({ - declarations: [OrderListComponent, PriceListComponent, OrderStatisticalComponent, UserStatisticalComponent], + declarations: [OrderListComponent, PriceListComponent, OrderStatisticalComponent, UserStatisticalComponent, UserComponent, UserEditComponent], imports: [ CommonModule, RechargeOrderRoutingModule, diff --git a/src/app/admin/recharge-order/user-edit/user-edit.component.html b/src/app/admin/recharge-order/user-edit/user-edit.component.html new file mode 100644 index 0000000..a4a9f08 --- /dev/null +++ b/src/app/admin/recharge-order/user-edit/user-edit.component.html @@ -0,0 +1,86 @@ + + + + 系统管理 + + + 增加代理商 + + + + +
+ +
+
+
+
+
+ +
+ + 用户名 + + + + +
+
+ + 登录密码 + + + + + + + + + +
+ + +
+ + 代理商名称 + + + + +
+
+ + 代理商地址 + + + + +
+
+ + 联系人 + + + + +
+
+ + 联系方式 + + + + +
+ +
+
+
+ +
+
+
+
+
+
+
diff --git a/src/app/admin/recharge-order/user-edit/user-edit.component.scss b/src/app/admin/recharge-order/user-edit/user-edit.component.scss new file mode 100644 index 0000000..ac60fb8 --- /dev/null +++ b/src/app/admin/recharge-order/user-edit/user-edit.component.scss @@ -0,0 +1,6 @@ +button { + margin-left: 8px; +} +:host ::ng-deep .ant-upload { + background-color: #ffffff; +} diff --git a/src/app/admin/recharge-order/user-edit/user-edit.component.ts b/src/app/admin/recharge-order/user-edit/user-edit.component.ts new file mode 100644 index 0000000..21a7873 --- /dev/null +++ b/src/app/admin/recharge-order/user-edit/user-edit.component.ts @@ -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']); + } + }); + } + +} diff --git a/src/app/admin/recharge-order/user-statistical/user-statistical.component.html b/src/app/admin/recharge-order/user-statistical/user-statistical.component.html index 56d2252..013ceba 100644 --- a/src/app/admin/recharge-order/user-statistical/user-statistical.component.html +++ b/src/app/admin/recharge-order/user-statistical/user-statistical.component.html @@ -1 +1,62 @@ -

user-statistical works!

+ + + + + +
+
+
+
+ + 时间区间 + + + + +
+
+ +
+
+ + +
+
+
+
+ + +
+ 共计 {{total}} 条数据 +
+ +
+ + + + 编号 + 员工名称 + 数量 + 支付金额 + + + + + {{i+1}} + {{data.agentName}} + {{data.count}} + {{data.payPrice}} + + +
diff --git a/src/app/admin/recharge-order/user-statistical/user-statistical.component.ts b/src/app/admin/recharge-order/user-statistical/user-statistical.component.ts index 82d589e..f61e91e 100644 --- a/src/app/admin/recharge-order/user-statistical/user-statistical.component.ts +++ b/src/app/admin/recharge-order/user-statistical/user-statistical.component.ts @@ -1,4 +1,8 @@ import { Component, OnInit } from '@angular/core'; +import {FormBuilder, FormGroup} from "_@angular_forms@9.0.7@@angular/forms"; +import {environment} from "../../../../environments/environment"; +import {RechargeService} from "../../../services/recharge.service"; +import {NzMessageService} from "_ng-zorro-antd@9.3.0@ng-zorro-antd"; @Component({ selector: 'app-user-statistical', @@ -7,9 +11,71 @@ import { Component, OnInit } from '@angular/core'; }) export class UserStatisticalComponent implements OnInit { - constructor() { } + searchForm: FormGroup; // 搜索框 + FILE_URL = environment.imageUrl; + requestData = []; // 列表数据 + total: number; // 页码 + pageNum = 1; // 页码 + pageSize = 10; // 条码 + loading = true; + + constructor( + private recharge: RechargeService, + private form: FormBuilder, + private message: NzMessageService, + ) { } ngOnInit(): void { + this.searchForm = this.form.group({ + finishTime: [null], + }); + this.getRequest(true, this.searchForm.value); + } + + // 查询列表 + public getRequest(reset: boolean = false, whereObject: object) { + + if (whereObject['finishTime'] != null && whereObject['finishTime'].length !== 0) { + whereObject['finishTimeS'] = whereObject['finishTime'][0].getTime(); + whereObject['finishTimeE'] = whereObject['finishTime'][1].getTime(); + } + + + this.loading = false; + if (reset) { + this.pageNum = 1; + } + whereObject['pageNum'] = this.pageNum; + whereObject['pageSize'] = this.pageSize; + this.recharge.getUserCountList(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(); + } + + // 下载模板 + downloadTemplate(whereObject) { + if (whereObject['finishTime'] != null && whereObject['finishTime'].length !== 0) { + whereObject['finishTimeS'] = whereObject['finishTime'][0].getTime(); + whereObject['finishTimeE'] = whereObject['finishTime'][1].getTime(); + } + this.recharge.exportUserOrderListCount(whereObject, data => { + if (data['return_code'] === '000000') { + window.location.href = this.FILE_URL + data['return_data']; + } else { + this.message.error(data['return_msg']); + } + }); } } diff --git a/src/app/admin/recharge-order/user/user.component.html b/src/app/admin/recharge-order/user/user.component.html new file mode 100644 index 0000000..3b37ac2 --- /dev/null +++ b/src/app/admin/recharge-order/user/user.component.html @@ -0,0 +1,105 @@ + + + + + +
+
+
+ +
+ + 名称 + + + + +
+
+ + 电话 + + + + +
+
+ + 代理商状态 + + + + + + + +
+ +
+ +
+
+ + +
+
+
+
+ + +
+ 共计 {{total}} 条数据 +
+ +
+ + + + 编号 + 代理商名称 + 代理商地址 + 联系人 + 联系方式 + 创建时间 + 操作 + + + + + {{i + 1}} + {{data.agentName}} + {{data.agentAddress}} + {{data.agentUser}} + {{data.agentPhone}} + {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} + + 编辑 + 更多 + + + + + + +
+ diff --git a/src/app/admin/recharge-order/user/user.component.scss b/src/app/admin/recharge-order/user/user.component.scss new file mode 100644 index 0000000..b9c92c7 --- /dev/null +++ b/src/app/admin/recharge-order/user/user.component.scss @@ -0,0 +1,12 @@ +.head_img { + height: 80px; + width: 80px; +} +.table-td-operation { + a { + margin-left: 8px; + } +} +.li-a :hover { + color: #1890ff; +} diff --git a/src/app/admin/recharge-order/user/user.component.ts b/src/app/admin/recharge-order/user/user.component.ts new file mode 100644 index 0000000..9258774 --- /dev/null +++ b/src/app/admin/recharge-order/user/user.component.ts @@ -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']); + } + }); + } + +} diff --git a/src/app/services/agent.service.ts b/src/app/services/agent.service.ts index 28883f0..5b754c5 100644 --- a/src/app/services/agent.service.ts +++ b/src/app/services/agent.service.ts @@ -79,6 +79,19 @@ export class AgentService { }); } + /** + * 生成二维码 + * + * @param id 用户id + * @param status status + * @param callBack 返回参数 + */ + public generateRechargeAgentQrCode(id: number, callBack) { + this.http.get(environment.baseUrl + 'highAgent/generateRechargeAgentQrCode?agentId=' + id).subscribe(data => { + callBack(data); + }); + } + /** * 分配优惠券给代理商 * diff --git a/src/app/services/recharge.service.ts b/src/app/services/recharge.service.ts index 0304427..dde414b 100644 --- a/src/app/services/recharge.service.ts +++ b/src/app/services/recharge.service.ts @@ -148,4 +148,54 @@ export class RechargeService { }); } + /** + * 到处订单统计 + * + * @param paramsObject 对象 + * @param callBack 回调 + */ + public exportOrderListCount(paramsObject: object, callBack) { + this.http.get(environment.baseUrl + 'outRechargeOrder/exportOrderListCount?' + this.common.getWhereCondition(paramsObject)).subscribe(data => { + callBack(data); + }); + } + + /** + * 到处订单统计 + * + * @param paramsObject 对象 + * @param callBack 回调 + */ + public exportOrderList(paramsObject: object, callBack) { + this.http.get(environment.baseUrl + 'outRechargeOrder/exportOrderList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询订单列表 + * + * @param paramsObject 对象 + * @param callBack 回调 + */ + public getUserCountList(paramsObject: object, callBack) { + this.http.get(environment.baseUrl + 'outRechargeOrder/getUserCountList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => { + callBack(data); + }); + } + + /** + * 到处订单统计 + * + * @param paramsObject 对象 + * @param callBack 回调 + */ + public exportUserOrderListCount(paramsObject: object, callBack) { + this.http.get(environment.baseUrl + 'outRechargeOrder/exportUserOrderListCount?' + this.common.getWhereCondition(paramsObject)).subscribe(data => { + callBack(data); + }); + } + + + }