pull/1/head
袁野 3 years ago
parent 716ce5841b
commit 529a2e7eec
  1. 38
      src/app/admin/index/index.module.ts
  2. 11
      src/app/admin/index/index/index.component.html
  3. 407
      src/app/admin/index/index/index.component.ts
  4. 5
      src/app/app-common.module.ts
  5. 1
      src/app/pipes/index.ts
  6. 19
      src/app/pipes/index/energy-type.pipe.ts
  7. 13
      src/app/services/index.service.ts

@ -6,27 +6,29 @@ import { IndexComponent } from './index/index.component';
import {NgxEchartsModule} from 'ngx-echarts'; import {NgxEchartsModule} from 'ngx-echarts';
import {SystemRoutingModule} from '../system/system-routing.module'; import {SystemRoutingModule} from '../system/system-routing.module';
import {NgZorroAntdModule} from 'ng-zorro-antd'; import {NgZorroAntdModule} from 'ng-zorro-antd';
import {FormsModule, ReactiveFormsModule} from "@angular/forms"; import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {NgxNeditorModule} from "@notadd/ngx-neditor"; import {NgxNeditorModule} from '@notadd/ngx-neditor';
import {RichtextModule} from "../../common/richtext/richtext.module"; import {RichtextModule} from '../../common/richtext/richtext.module';
import {BreadcrumbModule} from "../../common/breadcrumb/breadcrumb.module"; import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module';
import {RegionSelectorModule} from "../../common/region-selector/region-selector.module"; import {RegionSelectorModule} from '../../common/region-selector/region-selector.module';
import {AppCommonModule} from '../../app-common.module';
@NgModule({ @NgModule({
declarations: [IndexComponent], declarations: [IndexComponent],
imports: [ imports: [
CommonModule, CommonModule,
SystemRoutingModule, SystemRoutingModule,
NgZorroAntdModule, NgZorroAntdModule,
FormsModule, FormsModule,
ReactiveFormsModule, ReactiveFormsModule,
NgxNeditorModule, NgxNeditorModule,
RichtextModule, RichtextModule,
BreadcrumbModule, BreadcrumbModule,
RegionSelectorModule, RegionSelectorModule,
NgxEchartsModule, NgxEchartsModule,
IndexRoutingModule IndexRoutingModule,
] AppCommonModule
]
}) })
export class IndexModule { } export class IndexModule { }

@ -44,17 +44,22 @@
<!--运营角色--> <!--运营角色-->
<div class="inner-content" *ngIf="roleType == 1"> <div class="inner-content" *ngIf="roleType == 1">
<div nz-row style="margin-top: 20px;" [nzGutter]="16"> <div nz-row style="margin-top: 20px;" [nzGutter]="16">
<div nz-col nzSpan="8"> <div nz-col nzSpan="8" *ngFor="let item of tyBalance">
<nz-card nzHoverable [nzLoading]="loading" [nzTitle]="item['energyType'] | energyType">
<h3>{{item['accountBalance']}}</h3>
</nz-card>
</div>
<div nz-col nzSpan="8" style="margin-top: 20px">
<nz-card nzHoverable [nzLoading]="loading" [nzTitle]="'注册总人数'"> <nz-card nzHoverable [nzLoading]="loading" [nzTitle]="'注册总人数'">
<h3>{{countData['registrantNum']}}</h3> <h3>{{countData['registrantNum']}}</h3>
</nz-card> </nz-card>
</div> </div>
<div nz-col nzSpan="8"> <div nz-col nzSpan="8" style="margin-top: 20px">
<nz-card nzHoverable [nzLoading]="loading" [nzTitle]="'总交易金额'"> <nz-card nzHoverable [nzLoading]="loading" [nzTitle]="'总交易金额'">
<h3>{{countData['transactionNum']}}</h3> <h3>{{countData['transactionNum']}}</h3>
</nz-card> </nz-card>
</div> </div>
<div nz-col nzSpan="8"> <div nz-col nzSpan="8" style="margin-top: 20px">
<nz-card nzHoverable [nzLoading]="loading" [nzTitle]="'总交易订单数量'"> <nz-card nzHoverable [nzLoading]="loading" [nzTitle]="'总交易订单数量'">
<h3>{{countData['transactionOrder']}}</h3> <h3>{{countData['transactionOrder']}}</h3>
</nz-card> </nz-card>

@ -1,218 +1,233 @@
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace';
import {LocalStorageService} from '../../../services/local-storage.service'; import {LocalStorageService} from '../../../services/local-storage.service';
import {CommonsService} from '../../../services/commons.service';
import {IndexService} from '../../../services/index.service'; import {IndexService} from '../../../services/index.service';
import {NzMessageService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; import {NzMessageService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd';
import {environment} from '../../../../environments/environment'; import {environment} from '../../../../environments/environment';
@Component({ @Component({
selector: 'app-index', selector: 'app-index',
templateUrl: './index.component.html', templateUrl: './index.component.html',
styleUrls: ['./index.component.less'] styleUrls: ['./index.component.less']
}) })
export class IndexComponent implements OnInit { export class IndexComponent implements OnInit {
FILE_URL = environment.imageUrl; FILE_URL = environment.imageUrl;
roleType: number; roleType: number;
loading = true; loading = true;
isVisible = false; isVisible = false;
isVisibleAdd = false; isVisibleAdd = false;
balance: number; balance: number;
price: number; price: number;
code = 60; code = 60;
listOfData; listOfData;
countData: any = {}; countData: any = {};
data: any = {}; data: any = {};
orderData = {}; orderData = {};
balanceData = {}; balanceData = {};
rechargeData = {}; rechargeData = {};
constructor( tyBalance;
private store: LocalStorageService, // 数据缓存
private message: NzMessageService, // 信息提示 constructor(
private index: IndexService private store: LocalStorageService, // 数据缓存
) { } private message: NzMessageService, // 信息提示
private index: IndexService
ngOnInit(): void { ) {
this.roleType = this.store.get(ADMIN_INFO_OBJECT)['secRole'].roleType;
if (this.roleType === 1) {
this.getIndexCount();
this.getLineCount();
} }
if (this.store.get(ADMIN_INFO_OBJECT)['highAgent'] != null) { ngOnInit(): void {
this.code = this.store.get(ADMIN_INFO_OBJECT)['highAgent'].id; this.roleType = this.store.get(ADMIN_INFO_OBJECT)['secRole'].roleType;
if (this.roleType === 1) {
this.getIndexCount();
this.getLineCount();
this.queryCompanyAccountInfo2JD();
}
if (this.store.get(ADMIN_INFO_OBJECT)['highAgent'] != null) {
this.code = this.store.get(ADMIN_INFO_OBJECT)['highAgent'].id;
}
if (this.store.get(ADMIN_INFO_OBJECT)['bsCompany'].id === 3) {
this.code = 60;
this.getHLTBalance();
this.orderByIndex();
this.HLTOrderByIndex();
this.rechargeOrderByIndex();
this.HLTOrderByList();
}
}
// 查询余额
public getHLTBalance(): void {
const paramsObject = {
codeType: 'HLT_BALANCE'
};
this.index.getHLTBalance(paramsObject, data => {
if (data['return_code'] === '000000') {
this.loading = false;
this.balance = data['return_data'];
} else {
this.message.error(data['return_msg']);
}
});
}
public orderByIndex(): void {
this.index.orderByIndex(this.code, data => {
if (data['return_code'] === '000000') {
this.orderData = data['return_data'];
this.loading = false;
} else {
this.message.error(data['return_msg']);
}
});
}
// 查询团油余额
public queryCompanyAccountInfo2JD() {
this.index.queryCompanyAccountInfo2JD(data => {
if (data['return_code'] === '000000') {
console.log(data);
this.tyBalance = data['return_data'];
} else {
this.message.error(data['return_msg']);
}
});
}
public HLTOrderByIndex(): void {
this.index.HLTOrderByIndex(this.code, data => {
if (data['return_code'] === '000000') {
this.balanceData = data['return_data'];
this.loading = false;
} else {
this.message.error(data['return_msg']);
}
});
} }
if (this.store.get(ADMIN_INFO_OBJECT)['bsCompany'].id === 3) {
this.code = 60; public rechargeOrderByIndex(): void {
this.getHLTBalance(); this.index.rechargeOrderByIndex(this.code, data => {
this.orderByIndex(); if (data['return_code'] === '000000') {
this.HLTOrderByIndex(); this.rechargeData = data['return_data'];
this.rechargeOrderByIndex(); this.loading = false;
this.HLTOrderByList(); } else {
this.message.error(data['return_msg']);
}
});
}
public HLTOrderByList(): void {
this.index.HLTOrderByList(this.code, data => {
if (data['return_code'] === '000000') {
this.listOfData = data['return_data'];
} else {
this.message.error(data['return_msg']);
}
});
}
public getIndexCount(): void {
this.index.getIndexCount(data => {
if (data['return_code'] === '000000') {
this.loading = false;
this.countData = data['return_data'];
} else {
this.message.error(data['return_msg']);
}
});
} }
} public getLineCount(): void {
this.index.getLineCount(data => {
// 查询余额 console.log(data);
public getHLTBalance(): void { if (data['return_code'] === '000000') {
const paramsObject = { this.data = {
codeType: 'HLT_BALANCE' tooltip: {
}; trigger: 'axis',
this.index.getHLTBalance(paramsObject , data => { axisPointer: {
if (data['return_code'] === '000000') { type: 'cross',
this.loading = false; label: {
this.balance = data['return_data']; backgroundColor: '#6a7985'
} else { }
this.message.error(data['return_msg']); }
} },
}); legend: {},
} xAxis: {
type: 'category',
public orderByIndex(): void { data: data['return_data']['date']
this.index.orderByIndex(this.code , data => { },
if (data['return_code'] === '000000') { yAxis: {
this.orderData = data['return_data']; type: 'value'
this.loading = false; },
} else { series: [
this.message.error(data['return_msg']); {
} name: '订单金额',
}); data: data['return_data']['orderPriceSum'],
} type: 'line'
},
public HLTOrderByIndex(): void { {
this.index.HLTOrderByIndex(this.code , data => { name: '话费订单金额',
if (data['return_code'] === '000000') { data: data['return_data']['orderRechargePriceSum'],
this.balanceData = data['return_data']; type: 'line'
this.loading = false; },
} else { {
this.message.error(data['return_msg']); name: '订单数量',
} data: data['return_data']['orderCount'],
}); type: 'line'
} },
{
public rechargeOrderByIndex(): void { name: '话费订单数量',
this.index.rechargeOrderByIndex(this.code , data => { data: data['return_data']['orderRechargeCount'],
if (data['return_code'] === '000000') { type: 'line'
this.rechargeData = data['return_data']; },
this.loading = false; {
} else { name: '用户注册数量',
this.message.error(data['return_msg']); data: data['return_data']['userCount'],
} type: 'line'
}); },
} {
name: '话费订单金额',
public HLTOrderByList(): void { data: data['return_data']['orderRechargePriceSum'],
this.index.HLTOrderByList(this.code , data => { type: 'line'
if (data['return_code'] === '000000') { }
this.listOfData = data['return_data']; ]
} else { };
this.message.error(data['return_msg']); } else {
} this.message.error(data['return_msg']);
});
}
public getIndexCount(): void {
this.index.getIndexCount(data => {
if (data['return_code'] === '000000') {
this.loading = false;
this.countData = data['return_data'];
} else {
this.message.error(data['return_msg']);
}
});
}
public getLineCount(): void {
this.index.getLineCount(data => {
console.log(data);
if (data['return_code'] === '000000') {
this.data = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
} }
}, });
legend: {}, }
xAxis: {
type: 'category', // 下载模板
data: data['return_data']['date'] downloadTemplate() {
}, this.index.exportHLTOrderByList(this.code, data => {
yAxis: { if (data['return_code'] === '000000') {
type: 'value' window.location.href = this.FILE_URL + data['return_data'];
}, } else {
series: [ this.message.error(data['return_msg']);
{
name: '订单金额',
data: data['return_data']['orderPriceSum'],
type: 'line'
},
{
name: '话费订单金额',
data: data['return_data']['orderRechargePriceSum'],
type: 'line'
},
{
name: '订单数量',
data: data['return_data']['orderCount'],
type: 'line'
},
{
name: '话费订单数量',
data: data['return_data']['orderRechargeCount'],
type: 'line'
},
{
name: '用户注册数量',
data: data['return_data']['userCount'],
type: 'line'
},
{
name: '话费订单金额',
data: data['return_data']['orderRechargePriceSum'],
type: 'line'
} }
] });
}
handleOk(): void {
if (this.price == null) {
this.message.error('请输入充值金额');
return;
}
const paramsObject = {
codeType: 'HLT_BALANCE',
price: this.price
}; };
} else { this.index.addHLTBalance(paramsObject, data => {
this.message.error(data['return_msg']); if (data['return_code'] === '000000') {
} this.getHLTBalance();
}); this.isVisibleAdd = false;
} } else {
this.message.error(data['return_msg']);
// 下载模板 }
downloadTemplate() { });
this.index.exportHLTOrderByList(this.code , data => {
if (data['return_code'] === '000000') {
window.location.href = this.FILE_URL + data['return_data'];
} else {
this.message.error(data['return_msg']);
}
});
}
handleOk(): void {
if (this.price == null) {
this.message.error('请输入充值金额');
return;
} }
const paramsObject = {
codeType: 'HLT_BALANCE',
price: this.price
};
this.index.addHLTBalance(paramsObject , data => {
if (data['return_code'] === '000000') {
this.getHLTBalance();
this.isVisibleAdd = false;
} else {
this.message.error(data['return_msg']);
}
});
}
} }

@ -36,7 +36,8 @@ import {
ButtonPipe, ButtonPipe,
DiscountPackageStatusPipe, DiscountPackageStatusPipe,
PriceShowPipe, PriceShowPipe,
ShowTypePipe ShowTypePipe,
EnergyTypePipe
} from './pipes'; } from './pipes';
@ -72,6 +73,8 @@ const PIPES = [
DiscountPackageStatusPipe, DiscountPackageStatusPipe,
ShowTypePipe, ShowTypePipe,
PriceShowPipe, PriceShowPipe,
EnergyTypePipe,
]; ];

@ -25,3 +25,4 @@ export * from './commons/button.pipe';
export * from './discount-package-status.pipe'; export * from './discount-package-status.pipe';
export * from './show-type.pipe'; export * from './show-type.pipe';
export * from './price-show.pipe'; export * from './price-show.pipe';
export * from './index/energy-type.pipe';

@ -0,0 +1,19 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'energyType'
})
export class EnergyTypePipe implements PipeTransform {
transform(value: number): string {
switch (value) {
case 1:
return '团油汽油余额';
case 2:
return '团油柴油余额';
case 3:
return '团油天然气余额';
}
}
}

@ -53,6 +53,19 @@ export class IndexService {
}); });
} }
/**
* @Author Sum1Dream
* @methodName queryCompanyAccountInfo2JD
* @Description // 查询团油余额
* @Date 12:12 2022/1/10
* @Param
*/
public queryCompanyAccountInfo2JD(callBack) {
this.http.get(environment.baseUrl + 'common/queryCompanyAccountInfo2JD').subscribe(data => {
callBack(data);
});
}
/** /**
* @Author Sum1Dream * @Author Sum1Dream
* @methodName orderByIndex * @methodName orderByIndex

Loading…
Cancel
Save