From c8cf133b125aff5a446a63c6be7bfe0b6c766d55 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Fri, 4 Nov 2022 14:17:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E9=A6=96=E9=A1=B5=20?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/admin/index/index-routing.module.ts | 4 +- src/app/admin/index/index.module.ts | 3 +- .../admin/index/index/index.component.html | 59 +++---- .../admin/index/index/index.component.less | 42 +++++ src/app/admin/index/index/index.component.ts | 150 +++++++++++++++++- .../navigation/navigation.component.html | 4 +- .../order-manage-routing.module.ts | 4 +- .../order-list/order-list.component.html | 1 + src/app/pipes/recharge-pay-type.pipe.ts | 8 +- src/app/services/commons.service.ts | 59 ++++++- src/app/services/index.service.ts | 24 +++ src/environments/environment.ts | 8 +- 12 files changed, 323 insertions(+), 43 deletions(-) diff --git a/src/app/admin/index/index-routing.module.ts b/src/app/admin/index/index-routing.module.ts index 74da3ab..9dd1c26 100644 --- a/src/app/admin/index/index-routing.module.ts +++ b/src/app/admin/index/index-routing.module.ts @@ -2,11 +2,13 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import {IndexComponent} from './index/index.component'; import {TestComponent} from './test/test.component'; +import {OrderStatisticsComponent} from './order-statistics/order-statistics.component'; const routes: Routes = [ { path: '', component: IndexComponent }, - { path: 'test', component: TestComponent } + { path: 'test', component: TestComponent }, + { path: 'order-statistics', component: OrderStatisticsComponent } ]; @NgModule({ diff --git a/src/app/admin/index/index.module.ts b/src/app/admin/index/index.module.ts index dcb69aa..8f89def 100644 --- a/src/app/admin/index/index.module.ts +++ b/src/app/admin/index/index.module.ts @@ -14,11 +14,12 @@ import {RegionSelectorModule} from '../../common/region-selector/region-selector import {AppCommonModule} from '../../app-common.module'; import { TestComponent } from './test/test.component'; import {NzSpaceModule} from 'ng-zorro-antd/space'; +import { OrderStatisticsComponent } from './order-statistics/order-statistics.component'; @NgModule({ - declarations: [IndexComponent, TestComponent], + declarations: [IndexComponent, TestComponent, OrderStatisticsComponent], imports: [ CommonModule, SystemRoutingModule, diff --git a/src/app/admin/index/index/index.component.html b/src/app/admin/index/index/index.component.html index 5d24a5d..e0f1fa8 100644 --- a/src/app/admin/index/index/index.component.html +++ b/src/app/admin/index/index/index.component.html @@ -132,41 +132,44 @@
-
-
- -

{{item['accountBalance']}}

-
-
-
- -

{{countData['registrantNum']}}

-
-
-
- -

{{countData['transactionNum']}}

-
+
+
+
+ + + +
+
-
- -

{{countData['transactionOrder']}}

-
+
+
+
+

注册总人数

+ {{countData['registrantNum']}} +

总交易金额(元)

+ {{countData['transactionNum']}} +

总交易订单数量

+ {{countData['transactionOrder']}}
-
- -

{{countData['transactionToday']}}

-
+
+
-
- -

{{countData['transactionOrderToday']}}

-
+
+
+ + + + +
+
-
+
+ + +
diff --git a/src/app/admin/index/index/index.component.less b/src/app/admin/index/index/index.component.less index cb1e546..904d3b2 100644 --- a/src/app/admin/index/index/index.component.less +++ b/src/app/admin/index/index/index.component.less @@ -5,3 +5,45 @@ .row-bottom { margin-bottom: 16px; } + +.date { + + float: right; + +} +.span-block { + display:block; + margin-left: 10px; + text-align: center; + cursor:pointer; + color: white; + +} +.wh-date { + width: 30px; + height: 30px; + border-radius: 4px; + line-height: 30px; +} +.wh-price { + width: 140px; + height: 50px; + line-height: 50px; + font-size: 18px; +} +.day { + background: #f50; +} +.week { + background: #faad14; +} +.month { + background: #2db7f5; +} +.year { + background: #87d068; +} +h3 { + margin-top: 14px; + margin-left: 10px; +} diff --git a/src/app/admin/index/index/index.component.ts b/src/app/admin/index/index/index.component.ts index a3411cc..01d7cab 100644 --- a/src/app/admin/index/index/index.component.ts +++ b/src/app/admin/index/index/index.component.ts @@ -5,6 +5,7 @@ import {IndexService} from '../../../services/index.service'; import {environment} from '../../../../environments/environment'; import {NzMessageService} from 'ng-zorro-antd'; import {Router} from '@angular/router'; +import {CommonsService} from "../../../services/commons.service"; @Component({ @@ -42,11 +43,18 @@ export class IndexComponent implements OnInit { tyBalance; webSocket: WebSocket; adminInfoObject: {}; + + // 根据年月日查询总交易金额 + orderStatisticsByYMDData: any; + // 查询每日交易总额 + orderStatisticsByProductTypeByDay: any; + orderStatisticsByProductTypeAll: any; constructor( private store: LocalStorageService, // 数据缓存 private message: NzMessageService, // 信息提示 private router: Router, - private index: IndexService + private index: IndexService, + private common: CommonsService ) { } @@ -57,6 +65,9 @@ export class IndexComponent implements OnInit { this.getIndexCount(); this.getLineCount(); this.queryCompanyAccountInfo2JD(); + this.orderStatisticsByYMD(1); + this.orderStatisticsByProductType(1); + this.orderStatisticsByProductTypeByAll(3); } if (this.store.get(ADMIN_INFO_OBJECT)['highAgent'] != null) { this.code = this.store.get(ADMIN_INFO_OBJECT)['highAgent'].id; @@ -314,5 +325,142 @@ export class IndexComponent implements OnInit { } }).then(r => console.log(r)); } + + // 查询 + public orderStatisticsByYMD(type: number): void { + const queryParams = { + dateType: type, + num: this.common.dateTimeType(type) + }; + this.index.orderStatisticsByYMD(queryParams , data => { + if (data['return_code'] === '000000') { + const timeData = []; + const sumData = []; + for (const i of data['return_data']) { + timeData.push(i['time']); + sumData.push(i['sum']); + } + this.orderStatisticsByYMDData = { + title: { + text: this.common.dateType(type) + '总交易额(元)', + }, + xAxis: { + type: 'category', + + data: timeData + }, + yAxis: { + type: 'value' + }, + series: [ + { + data: sumData, + label: { + show: true, + color: 'black', + position: 'top' + }, + type: 'bar', + showBackground: true, + color: '#1890ff', + backgroundStyle: { + color: 'rgba(180, 180, 180, 0.2)' + } + } + ] + }; + } else { + this.message.error(data['return_msg']); + } + }); + + } + + public orderStatisticsByProductType(type): void { + const queryParams = { + dateType: type, + }; + this.index.orderStatisticsByProductType(queryParams , data => { + if (data['return_code'] === '000000') { + const productData = []; + const sumData = []; + for (const i of data['return_data']) { + productData.push(this.common.productType(i['name'])); + sumData.push(i['value']); + } + this.orderStatisticsByProductTypeByDay = { + title: { + text: '今日交易总额(元)', + }, + xAxis: { + type: 'value' + }, + yAxis: { + type: 'category', + + data: productData + }, + series: [ + { + data: sumData, + label: { + show: true, + color: 'black', + position: 'right' + }, + type: 'bar', + showBackground: true, + color: '#1890ff', + backgroundStyle: { + color: 'rgba(180, 180, 180, 0.2)' + } + } + ] + }; + + } else { + this.message.error(data['return_msg']); + } + }); + } + + + public orderStatisticsByProductTypeByAll(type): void { + const queryParams = { + dateType: type, + }; + this.index.orderStatisticsByProductType(queryParams , data => { + if (data['return_code'] === '000000') { + const dataShow = []; + for (const i of data['return_data']) { + dataShow.push({ + name: this.common.productType(i['name']), + value: i['value'] + }); + } + this.orderStatisticsByProductTypeAll = { + title: { + text: this.common.dateType(type) + '交易占比分布', + left: 'center' + }, + tooltip: { + trigger: 'item' + }, + series: [ + { + name: '交易金额总额(元)', + type: 'pie', + radius: '50%', + data: dataShow, + + } + ] + }; + + } else { + this.message.error(data['return_msg']); + } + }); + } } diff --git a/src/app/admin/navigation/navigation.component.html b/src/app/admin/navigation/navigation.component.html index a85efac..b0a960d 100644 --- a/src/app/admin/navigation/navigation.component.html +++ b/src/app/admin/navigation/navigation.component.html @@ -5,11 +5,11 @@ {{userInfo.secRole.roleName}}
    -
  • +
  • 首页
  • -
  • +
  • {{item.menuName}}
    • diff --git a/src/app/admin/order-manage/order-manage-routing.module.ts b/src/app/admin/order-manage/order-manage-routing.module.ts index f0c21ed..40cec00 100644 --- a/src/app/admin/order-manage/order-manage-routing.module.ts +++ b/src/app/admin/order-manage/order-manage-routing.module.ts @@ -7,10 +7,10 @@ import {OrderRefundListComponent} from './order-refund-list/order-refund-list.co import {KfcOrderListComponent} from './kfc-order/kfc-order-list/kfc-order-list.component'; import {StarbucksOrderListComponent} from './starbucks-order/starbucks-order-list/starbucks-order-list.component'; import {MemberChargeOrderListComponent} from './member-charge-order/member-charge-order-list/member-charge-order-list.component'; -import {OrderHListComponent} from '../order/order-h-list/order-h-list.component'; import {PreOrderComponent} from '../order/pre-order/pre-order.component'; import {DiscountUseConditionListComponent} from '../order/discount-use-condition-list/discount-use-condition-list.component'; import {DicountPackageOrderListComponent} from '../order/dicount-package-order-list/dicount-package-order-list.component'; +import {OrderListComponent} from '../recharge-order/order-list/order-list.component'; const routes: Routes = [ @@ -21,7 +21,7 @@ const routes: Routes = [ { path: 'order-kfc-list', component: KfcOrderListComponent}, { path: 'order-starbucks--list', component: StarbucksOrderListComponent}, { path: 'order-member-charge--list', component: MemberChargeOrderListComponent}, - { path: 'order-h-list', component: OrderHListComponent }, + { path: 'mobile-recharge-order-list', component: OrderListComponent }, { path: 'pre-order', component: PreOrderComponent }, { path: 'discount-use-condition-list', component: DiscountUseConditionListComponent }, { path: 'discount-package-order-list', component: DicountPackageOrderListComponent}, 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 b6348f3..f767ff7 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 @@ -163,6 +163,7 @@ { + callBack(data); + }); + } + /** + * @Author Sum1Dream + * @methodName orderStatisticsByYMD + * @Description // + * @Date 15:56 2022/11/3 + * @Param params: object, callBack + */ + public orderStatisticsByProductType(params: object, callBack) { + this.http.get(environment.baseUrl + 'homeOrderStatistics/orderStatisticsByProductType?' + this.common.getWhereCondition(params)).subscribe(data => { + callBack(data); + }); + } } diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 7a35916..264e5d9 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,11 +4,11 @@ export const environment = { production: false, - // baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址) - // orderUrl: 'http://localhost:9304/order/', + baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址) + orderUrl: 'http://localhost:9304/order/', // imageUrl: 'https://hsgcs.dctpay.com/filesystem/', - baseUrl: 'https://hsgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) - orderUrl: 'https://hsgcs.dctpay.com/order/', + // baseUrl: 'https://hsgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) + // orderUrl: 'https://hsgcs.dctpay.com/order/', imageUrl: 'https://hsgcs.dctpay.com/filesystem/', key: 'https://hsgcs.dctpay.com/phone-recharge-H5/index.html?codeValue=', inviteUrl: 'https://hsgcs.dctpay.com/wx/?action=ic&id=',