From 529a2e7eeca2a5b6bb6e07f68e6bee691900cf7e Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Sat, 2 Apr 2022 10:06:35 +0800 Subject: [PATCH] 1 --- src/app/admin/index/index.module.ts | 38 +- .../admin/index/index/index.component.html | 11 +- src/app/admin/index/index/index.component.ts | 407 +++++++++--------- src/app/app-common.module.ts | 5 +- src/app/pipes/index.ts | 1 + src/app/pipes/index/energy-type.pipe.ts | 19 + src/app/services/index.service.ts | 13 + 7 files changed, 276 insertions(+), 218 deletions(-) create mode 100644 src/app/pipes/index/energy-type.pipe.ts diff --git a/src/app/admin/index/index.module.ts b/src/app/admin/index/index.module.ts index 09875b3..5a685a4 100644 --- a/src/app/admin/index/index.module.ts +++ b/src/app/admin/index/index.module.ts @@ -6,27 +6,29 @@ import { IndexComponent } from './index/index.component'; import {NgxEchartsModule} from 'ngx-echarts'; import {SystemRoutingModule} from '../system/system-routing.module'; import {NgZorroAntdModule} from 'ng-zorro-antd'; -import {FormsModule, ReactiveFormsModule} from "@angular/forms"; -import {NgxNeditorModule} from "@notadd/ngx-neditor"; -import {RichtextModule} from "../../common/richtext/richtext.module"; -import {BreadcrumbModule} from "../../common/breadcrumb/breadcrumb.module"; -import {RegionSelectorModule} from "../../common/region-selector/region-selector.module"; +import {FormsModule, ReactiveFormsModule} from '@angular/forms'; +import {NgxNeditorModule} from '@notadd/ngx-neditor'; +import {RichtextModule} from '../../common/richtext/richtext.module'; +import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; +import {RegionSelectorModule} from '../../common/region-selector/region-selector.module'; +import {AppCommonModule} from '../../app-common.module'; @NgModule({ declarations: [IndexComponent], - imports: [ - CommonModule, - SystemRoutingModule, - NgZorroAntdModule, - FormsModule, - ReactiveFormsModule, - NgxNeditorModule, - RichtextModule, - BreadcrumbModule, - RegionSelectorModule, - NgxEchartsModule, - IndexRoutingModule - ] + imports: [ + CommonModule, + SystemRoutingModule, + NgZorroAntdModule, + FormsModule, + ReactiveFormsModule, + NgxNeditorModule, + RichtextModule, + BreadcrumbModule, + RegionSelectorModule, + NgxEchartsModule, + IndexRoutingModule, + AppCommonModule + ] }) export class IndexModule { } diff --git a/src/app/admin/index/index/index.component.html b/src/app/admin/index/index/index.component.html index 1a68edb..b6be464 100644 --- a/src/app/admin/index/index/index.component.html +++ b/src/app/admin/index/index/index.component.html @@ -44,17 +44,22 @@
-
+
+ +

{{item['accountBalance']}}

+
+
+

{{countData['registrantNum']}}

-
+

{{countData['transactionNum']}}

-
+

{{countData['transactionOrder']}}

diff --git a/src/app/admin/index/index/index.component.ts b/src/app/admin/index/index/index.component.ts index a051195..c1cc6f1 100644 --- a/src/app/admin/index/index/index.component.ts +++ b/src/app/admin/index/index/index.component.ts @@ -1,218 +1,233 @@ import {Component, OnInit} from '@angular/core'; import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; import {LocalStorageService} from '../../../services/local-storage.service'; -import {CommonsService} from '../../../services/commons.service'; import {IndexService} from '../../../services/index.service'; import {NzMessageService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; import {environment} from '../../../../environments/environment'; @Component({ - selector: 'app-index', - templateUrl: './index.component.html', - styleUrls: ['./index.component.less'] + selector: 'app-index', + templateUrl: './index.component.html', + styleUrls: ['./index.component.less'] }) export class IndexComponent implements OnInit { - FILE_URL = environment.imageUrl; - roleType: number; - loading = true; - isVisible = false; - isVisibleAdd = false; - balance: number; - price: number; - code = 60; - listOfData; - countData: any = {}; - data: any = {}; - orderData = {}; - balanceData = {}; - rechargeData = {}; - constructor( - 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(); + FILE_URL = environment.imageUrl; + roleType: number; + loading = true; + isVisible = false; + isVisibleAdd = false; + balance: number; + price: number; + code = 60; + listOfData; + countData: any = {}; + data: any = {}; + orderData = {}; + balanceData = {}; + rechargeData = {}; + tyBalance; + + constructor( + private store: LocalStorageService, // 数据缓存 + private message: NzMessageService, // 信息提示 + private index: IndexService + ) { } - if (this.store.get(ADMIN_INFO_OBJECT)['highAgent'] != null) { - this.code = this.store.get(ADMIN_INFO_OBJECT)['highAgent'].id; + ngOnInit(): void { + 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; - this.getHLTBalance(); - this.orderByIndex(); - this.HLTOrderByIndex(); - this.rechargeOrderByIndex(); - this.HLTOrderByList(); + + public rechargeOrderByIndex(): void { + this.index.rechargeOrderByIndex(this.code, data => { + if (data['return_code'] === '000000') { + this.rechargeData = data['return_data']; + this.loading = false; + } 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 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 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']); - } - }); - } - - public rechargeOrderByIndex(): void { - this.index.rechargeOrderByIndex(this.code , data => { - if (data['return_code'] === '000000') { - this.rechargeData = data['return_data']; - this.loading = false; - } 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); - if (data['return_code'] === '000000') { - this.data = { - tooltip: { - trigger: 'axis', - axisPointer: { - type: 'cross', - label: { - backgroundColor: '#6a7985' - } + 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'] + }, + yAxis: { + type: 'value' + }, + series: [ + { + 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' + } + ] + }; + } else { + this.message.error(data['return_msg']); } - }, - legend: {}, - xAxis: { - type: 'category', - data: data['return_data']['date'] - }, - yAxis: { - type: 'value' - }, - series: [ - { - 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' + }); + } + + // 下载模板 + 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 }; - } 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; + this.index.addHLTBalance(paramsObject, data => { + if (data['return_code'] === '000000') { + this.getHLTBalance(); + this.isVisibleAdd = false; + } else { + this.message.error(data['return_msg']); + } + }); } - 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']); - } - }); - } } diff --git a/src/app/app-common.module.ts b/src/app/app-common.module.ts index 10a9425..d654cac 100644 --- a/src/app/app-common.module.ts +++ b/src/app/app-common.module.ts @@ -36,7 +36,8 @@ import { ButtonPipe, DiscountPackageStatusPipe, PriceShowPipe, - ShowTypePipe + ShowTypePipe, + EnergyTypePipe } from './pipes'; @@ -72,6 +73,8 @@ const PIPES = [ DiscountPackageStatusPipe, ShowTypePipe, PriceShowPipe, + EnergyTypePipe, + ]; diff --git a/src/app/pipes/index.ts b/src/app/pipes/index.ts index 5fad168..3649206 100644 --- a/src/app/pipes/index.ts +++ b/src/app/pipes/index.ts @@ -25,3 +25,4 @@ export * from './commons/button.pipe'; export * from './discount-package-status.pipe'; export * from './show-type.pipe'; export * from './price-show.pipe'; +export * from './index/energy-type.pipe'; diff --git a/src/app/pipes/index/energy-type.pipe.ts b/src/app/pipes/index/energy-type.pipe.ts new file mode 100644 index 0000000..342d260 --- /dev/null +++ b/src/app/pipes/index/energy-type.pipe.ts @@ -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 '团油天然气余额'; + } + } + +} diff --git a/src/app/services/index.service.ts b/src/app/services/index.service.ts index b255fa5..3e22da1 100644 --- a/src/app/services/index.service.ts +++ b/src/app/services/index.service.ts @@ -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 * @methodName orderByIndex