From ee6023348870ccd5eb936c27af33bc8a01565559 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Fri, 14 Jul 2023 14:56:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goods-audit/goods-audit.component.ts | 4 +- .../freight/freight.component.ts | 4 +- src/app/admin/goods/goods.module.ts | 4 +- src/app/admin/goods/list/list.component.ts | 3 +- .../goods-child-order.component.ts | 4 +- .../goods-order/goods-order.component.ts | 6 +- .../mobile-recharge-order-list.component.ts | 3 +- .../coupon-use/coupon-use.component.html | 64 +++++++ .../coupon-use/coupon-use.component.scss | 0 .../coupon-use/coupon-use.component.spec.ts | 25 +++ .../coupon-use/coupon-use.component.ts | 167 ++++++++++++++++++ .../statistics/statistics-routing.module.ts | 14 ++ src/app/admin/statistics/statistics.module.ts | 26 +++ src/app/app-routing.module.ts | 5 + src/app/services/coupon.service.ts | 25 +++ src/app/services/goods/goods.service.ts | 2 +- src/environments/environment.ts | 4 +- 17 files changed, 342 insertions(+), 18 deletions(-) create mode 100644 src/app/admin/statistics/coupon-use/coupon-use.component.html create mode 100644 src/app/admin/statistics/coupon-use/coupon-use.component.scss create mode 100644 src/app/admin/statistics/coupon-use/coupon-use.component.spec.ts create mode 100644 src/app/admin/statistics/coupon-use/coupon-use.component.ts create mode 100644 src/app/admin/statistics/statistics-routing.module.ts create mode 100644 src/app/admin/statistics/statistics.module.ts diff --git a/src/app/admin/audit/goods-audit/goods-audit.component.ts b/src/app/admin/audit/goods-audit/goods-audit.component.ts index d2abdfd..a506a9f 100644 --- a/src/app/admin/audit/goods-audit/goods-audit.component.ts +++ b/src/app/admin/audit/goods-audit/goods-audit.component.ts @@ -1,9 +1,9 @@ import { Component, OnInit } from '@angular/core'; -import {FormBuilder, FormGroup} from '_@angular_forms@9.0.7@@angular/forms'; import {AuditService} from '../../../services/audit.service'; import {IconService} from '../../../services/icon.service'; -import {NzMessageService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; import {CommonsService} from '../../../services/commons.service'; +import {FormBuilder, FormGroup} from '@angular/forms'; +import {NzMessageService} from 'ng-zorro-antd'; @Component({ selector: 'app-goods-audit', diff --git a/src/app/admin/config-manage/freight/freight.component.ts b/src/app/admin/config-manage/freight/freight.component.ts index ca321ca..0970046 100644 --- a/src/app/admin/config-manage/freight/freight.component.ts +++ b/src/app/admin/config-manage/freight/freight.component.ts @@ -1,9 +1,9 @@ import { Component, OnInit } from '@angular/core'; -import {FormBuilder, FormGroup, Validators} from '_@angular_forms@9.0.7@@angular/forms'; import {environment} from '../../../../environments/environment'; -import {NzModalService, NzNotificationService, NzUploadFile} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; import {CommonsService} from '../../../services/commons.service'; import {GoodsService} from '../../../services/goods/goods.service'; +import {FormBuilder, FormGroup, Validators} from '@angular/forms'; +import {NzModalService, NzNotificationService} from 'ng-zorro-antd'; @Component({ selector: 'app-freight', diff --git a/src/app/admin/goods/goods.module.ts b/src/app/admin/goods/goods.module.ts index f011a5e..50d50fb 100644 --- a/src/app/admin/goods/goods.module.ts +++ b/src/app/admin/goods/goods.module.ts @@ -3,13 +3,13 @@ import { CommonModule } from '@angular/common'; import { GoodsRoutingModule } from './goods-routing.module'; import { ListComponent } from './list/list.component'; -import {NgZorroAntdModule} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; import {SeparateModule} from '../../common/separate/separate.module'; -import {FormsModule, ReactiveFormsModule} from '_@angular_forms@9.0.7@@angular/forms'; import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; import {RegionSelectorModule} from '../../common/region-selector/region-selector.module'; import {AppCommonModule} from '../../app-common.module'; import {PreviewImageModule} from '../../common/preview-image/preview-image.module'; +import {NgZorroAntdModule} from 'ng-zorro-antd'; +import {FormsModule, ReactiveFormsModule} from '@angular/forms'; @NgModule({ diff --git a/src/app/admin/goods/list/list.component.ts b/src/app/admin/goods/list/list.component.ts index 148090f..adb2072 100644 --- a/src/app/admin/goods/list/list.component.ts +++ b/src/app/admin/goods/list/list.component.ts @@ -2,8 +2,7 @@ import {Component, OnInit} from '@angular/core'; import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import {GoodsService} from '../../../services/goods/goods.service'; import {environment} from '../../../../environments/environment'; -import {NzNotificationService, NzUploadFile} from 'ng-zorro-antd'; -import {NzModalService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; +import {NzModalService, NzNotificationService, NzUploadFile} from 'ng-zorro-antd'; import {CommonsService} from '../../../services/commons.service'; import {AgentService} from '../../../services/agent.service'; import {CouponService} from '../../../services/coupon.service'; diff --git a/src/app/admin/order-manage/goods-child-order/goods-child-order.component.ts b/src/app/admin/order-manage/goods-child-order/goods-child-order.component.ts index df26d67..807fa21 100644 --- a/src/app/admin/order-manage/goods-child-order/goods-child-order.component.ts +++ b/src/app/admin/order-manage/goods-child-order/goods-child-order.component.ts @@ -1,13 +1,13 @@ import { Component, OnInit } from '@angular/core'; -import {FormBuilder, FormGroup} from '_@angular_forms@9.0.7@@angular/forms'; import {environment} from '../../../../environments/environment'; import {LocalStorageService} from '../../../services/local-storage.service'; -import {NzMessageService, NzNotificationService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; import {OrderThirdPartyService} from '../../../services/order/order-third-party.service'; import {GoodsService} from '../../../services/goods/goods.service'; import {CompanyService} from '../../../services/company.service'; import {CommonsService} from '../../../services/commons.service'; import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; +import {FormBuilder, FormGroup} from '@angular/forms'; +import {NzMessageService, NzNotificationService} from 'ng-zorro-antd'; @Component({ selector: 'app-goods-child-order', diff --git a/src/app/admin/order-manage/goods-order/goods-order.component.ts b/src/app/admin/order-manage/goods-order/goods-order.component.ts index 8ad7875..88ace19 100644 --- a/src/app/admin/order-manage/goods-order/goods-order.component.ts +++ b/src/app/admin/order-manage/goods-order/goods-order.component.ts @@ -1,14 +1,14 @@ import { Component, OnInit } from '@angular/core'; -import {FormBuilder, FormGroup} from '_@angular_forms@9.0.7@@angular/forms'; import {environment} from '../../../../environments/environment'; import {LocalStorageService} from '../../../services/local-storage.service'; -import {NzMessageService, NzNotificationService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; import {OrderThirdPartyService} from '../../../services/order/order-third-party.service'; import {CompanyService} from '../../../services/company.service'; import {CommonsService} from '../../../services/commons.service'; import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; -import {animate, state, style, transition, trigger} from '_@angular_animations@9.0.7@@angular/animations'; import {GoodsService} from "../../../services/goods/goods.service"; +import {animate, state, style, transition, trigger} from '@angular/animations'; +import {FormBuilder, FormGroup} from '@angular/forms'; +import {NzMessageService, NzNotificationService} from 'ng-zorro-antd'; @Component({ selector: 'app-goods-order', diff --git a/src/app/admin/order-manage/mobile-recharge-order-list/mobile-recharge-order-list.component.ts b/src/app/admin/order-manage/mobile-recharge-order-list/mobile-recharge-order-list.component.ts index 4240ac3..5eb2c00 100644 --- a/src/app/admin/order-manage/mobile-recharge-order-list/mobile-recharge-order-list.component.ts +++ b/src/app/admin/order-manage/mobile-recharge-order-list/mobile-recharge-order-list.component.ts @@ -6,9 +6,8 @@ import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; import {CommonsService} from '../../../services/commons.service'; import {OrderMobileRechargeService} from '../../../services/order/order-mobile-recharge.service'; import {FormBuilder, FormGroup} from '@angular/forms'; -import {NzMessageService} from 'ng-zorro-antd'; +import {NzMessageService, NzNotificationService} from 'ng-zorro-antd'; import {animate, state, style, transition, trigger} from '@angular/animations'; -import {NzNotificationService} from "_ng-zorro-antd@9.3.0@ng-zorro-antd"; @Component({ selector: 'app-mobile-recharge-order-list', diff --git a/src/app/admin/statistics/coupon-use/coupon-use.component.html b/src/app/admin/statistics/coupon-use/coupon-use.component.html new file mode 100644 index 0000000..9e5761d --- /dev/null +++ b/src/app/admin/statistics/coupon-use/coupon-use.component.html @@ -0,0 +1,64 @@ + + + + +
+
+
+
+ + 业务类型 + + + + + + +
+
+ + 卡券销售面值 + + + + + + + +
+
+ + 状态 + + + + + + + +
+
+ + 销售起止时间 + + + + +
+
+ + 销售结束时间 + + + + +
+
+ +
+
+
+
+
+
+
diff --git a/src/app/admin/statistics/coupon-use/coupon-use.component.scss b/src/app/admin/statistics/coupon-use/coupon-use.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/statistics/coupon-use/coupon-use.component.spec.ts b/src/app/admin/statistics/coupon-use/coupon-use.component.spec.ts new file mode 100644 index 0000000..6c6ca67 --- /dev/null +++ b/src/app/admin/statistics/coupon-use/coupon-use.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CouponUseComponent } from './coupon-use.component'; + +describe('CouponUseComponent', () => { + let component: CouponUseComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ CouponUseComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CouponUseComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/statistics/coupon-use/coupon-use.component.ts b/src/app/admin/statistics/coupon-use/coupon-use.component.ts new file mode 100644 index 0000000..7684dd6 --- /dev/null +++ b/src/app/admin/statistics/coupon-use/coupon-use.component.ts @@ -0,0 +1,167 @@ +import { Component, OnInit } from '@angular/core'; +import {FormBuilder, FormGroup} from '@angular/forms'; +import {CouponService} from '../../../services/coupon.service'; + +@Component({ + selector: 'app-coupon-use', + templateUrl: './coupon-use.component.html', + styleUrls: ['./coupon-use.component.scss'] +}) +export class CouponUseComponent implements OnInit { + + dataObject: {}; + couponSourceArray = [ + { codeValue: 4, codeName: '贵州中石化'}, + { codeValue: 5, codeName: '重庆中石油'}, + ] + statusArray = [ + { codeValue: 20, codeName: '未使用'}, + { codeValue: 40, codeName: '已使用'}, + ] + salesPriceArray = []; + searchForm: FormGroup; + whereObject: any = {}; + constructor(private form: FormBuilder, + private couponService: CouponService) { } + + ngOnInit(): void { + let salesTimeS = new Date(); + salesTimeS.setDate(salesTimeS.getDate() - 7) + salesTimeS.setHours(0); + salesTimeS.setMinutes(0); + salesTimeS.setSeconds(0); + + let salesTimeE = new Date(); + salesTimeE.setHours(23); + salesTimeE.setMinutes(59); + salesTimeE.setSeconds(59); + + this.searchForm = this.form.group({ + couponSource: [String(this.couponSourceArray[0].codeValue)], + salesPrice: ['null'], + status: ['null'], + salesTimeS: [salesTimeS.getTime()], + salesTimeE: [salesTimeE.getTime()], + }); + this.getCouponSalesPrice(); + } + + + getData() { + const param = this.searchForm.value; + if (this.searchForm.controls['salesPrice'].value == 'null') { + param['salesPrice'] = null; + } + if (this.searchForm.controls['status'].value == 'null') { + param['status'] = null; + } + this.couponService.useCouponStatistics(param, response => { + let returnData = response['return_data']; + var dataArray = []; + for (let obj of returnData['salesPriceList']) { + dataArray.push({ + value: obj['count'], + name: obj['salesPrice'] + '【' + (obj['status']===20?'未使用':'已使用') + '】', + }); + } + this.dataObject = { + title: { + text: this.couponSourceArray.find(o => o.codeValue == this.searchForm.controls['couponSource']['value']).codeName, + left: 'center' + }, + tooltip: { + trigger: 'item' + }, + legend: { + orient: 'vertical', + left: 'left' + }, + series: [ + { + name: '', + type: 'pie', + radius: '50%', + data: dataArray, + emphasis: { + itemStyle: { + shadowBlur: 10, + shadowOffsetX: 0, + shadowColor: 'rgba(0, 0, 0, 0.5)' + } + }, + /*label: { + formatter: '{a|{a}}{abg|}\n{hr|}\n {b|{b}:}{c} {per|{d}%} ', + backgroundColor: '#F6F8FC', + borderColor: '#8C8D8E', + borderWidth: 1, + borderRadius: 4, + rich: { + a: { + color: '#6E7079', + lineHeight: 22, + align: 'center' + }, + hr: { + borderColor: '#8C8D8E', + width: '100%', + borderWidth: 1, + height: 0 + }, + b: { + color: '#4C5058', + fontSize: 14, + fontWeight: 'bold', + lineHeight: 33 + }, + per: { + color: '#fff', + backgroundColor: '#4C5058', + padding: [3, 4], + borderRadius: 4 + } + } + },*/ + } + ] + }; + }); + + } + + + /** + * 搜索 + * @param whereObject 条件 + */ + search(whereObject: object) { + if (this.searchForm.controls['salesTimeS'].value != null) { + this.searchForm.controls['salesTimeS'].setValue(new Date(this.searchForm.controls['salesTimeS'].value).getTime()); + } + if (this.searchForm.controls['salesTimeE'].value != null) { + this.searchForm.controls['salesTimeE'].setValue(new Date(this.searchForm.controls['salesTimeE'].value).getTime()); + } + this.getData(); + } + + /** + * 重置 + */ + resetForm(): void { + this.searchForm.reset(); + this.searchForm.controls['couponSource'].setValue(String(this.couponSourceArray[0].codeValue)); + } + + /** + * 查询卡券销售面值 + */ + getCouponSalesPrice() { + this.salesPriceArray = []; + this.couponService.getCouponSalesPrice({couponSource : this.searchForm.controls['couponSource'].value}, data => { + for (let obj of data['return_data']) { + this.salesPriceArray.push({ codeValue: obj, codeName: obj}); + } + this.searchForm.controls['salesPrice'].setValue('null'); + this.getData(); + }); + } +} diff --git a/src/app/admin/statistics/statistics-routing.module.ts b/src/app/admin/statistics/statistics-routing.module.ts new file mode 100644 index 0000000..1557d9b --- /dev/null +++ b/src/app/admin/statistics/statistics-routing.module.ts @@ -0,0 +1,14 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import {CouponUseComponent} from './coupon-use/coupon-use.component'; + + +const routes: Routes = [ + { path: 'coupon-use', component: CouponUseComponent} +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class StatisticsRoutingModule { } diff --git a/src/app/admin/statistics/statistics.module.ts b/src/app/admin/statistics/statistics.module.ts new file mode 100644 index 0000000..eb3a02a --- /dev/null +++ b/src/app/admin/statistics/statistics.module.ts @@ -0,0 +1,26 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { StatisticsRoutingModule } from './statistics-routing.module'; +import { CouponUseComponent } from './coupon-use/coupon-use.component'; +import {NgZorroAntdModule} from 'ng-zorro-antd'; +import {FormsModule, ReactiveFormsModule} from '@angular/forms'; +import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; +import {AppCommonModule} from '../../app-common.module'; +import {NgxEchartsModule} from 'ngx-echarts'; + + +@NgModule({ + declarations: [CouponUseComponent], + imports: [ + CommonModule, + StatisticsRoutingModule, + NgZorroAntdModule, + ReactiveFormsModule, + FormsModule, + BreadcrumbModule, + AppCommonModule, + NgxEchartsModule, + ] +}) +export class StatisticsModule { } diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index f237673..8ac3f1f 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -172,6 +172,11 @@ const routes: Routes = [ loadChildren: () => import('./admin/goods/goods.module').then(m => m.GoodsModule), canActivate: [InitGuardService] }, + { + path: 'statistics', + loadChildren: () => import('./admin/statistics/statistics.module').then(m => m.StatisticsModule), + canActivate: [InitGuardService] + }, ], }, ]; diff --git a/src/app/services/coupon.service.ts b/src/app/services/coupon.service.ts index 5c085d9..ba2bd36 100644 --- a/src/app/services/coupon.service.ts +++ b/src/app/services/coupon.service.ts @@ -168,4 +168,29 @@ export class CouponService { }); } + + /** + * 卡券销售面值 + * + * @param id 用户id + * @param callBack 返回参数 + */ + public getCouponSalesPrice(params: object, callBack) { + this.http.get(environment.baseUrl + 'coupon/getCouponSalesPrice?' + this.common.getWhereCondition(params)).subscribe(data => { + callBack(data); + }); + } + + /** + * 使用卡券统计 + * + * @param id 用户id + * @param callBack 返回参数 + */ + public useCouponStatistics(params: object, callBack) { + this.http.get(environment.baseUrl + 'couponStatistics/useCouponStatistics?' + this.common.getWhereCondition(params)).subscribe(data => { + callBack(data); + }); + } + } diff --git a/src/app/services/goods/goods.service.ts b/src/app/services/goods/goods.service.ts index e52fbf7..eb8280f 100644 --- a/src/app/services/goods/goods.service.ts +++ b/src/app/services/goods/goods.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; -import {HttpClient} from '_@angular_common@9.0.7@@angular/common/http'; import {CommonsService} from '../commons.service'; import {environment} from '../../../environments/environment'; +import {HttpClient} from '@angular/common/http'; @Injectable({ providedIn: 'root' diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 0f718ac..5e3fc2a 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,9 +4,9 @@ export const environment = { production: false, - // baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址) +baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址) // orderUrl: 'http://localhost:9304/order/', // 测试环境服务器地址(请求数据地址) - baseUrl: 'https://hsgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) + // 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=',