From 30c7db98131270820b36b10bfa0761e9b03f6e50 Mon Sep 17 00:00:00 2001 From: youmengting <2080639302@qq.com> Date: Wed, 18 Oct 2023 18:09:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=B4=BB=E5=8A=A8=E9=87=91?= =?UTF-8?q?=EF=BC=9A=E5=95=86=E6=88=B7=E9=85=8D=E7=BD=AE=EF=BC=8C=E5=A5=96?= =?UTF-8?q?=E6=B1=A0=E4=B8=9A=E5=8A=A1(=E5=BE=85=E6=B5=8B=E8=AF=95)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activity-money-routing.module.ts | 19 ++ .../activity-money/activity-money.module.ts | 30 +++ .../merchant-allocation.component.html | 152 ++++++++++++ .../merchant-allocation.component.scss | 6 + .../merchant-allocation.component.spec.ts | 28 +++ .../merchant-allocation.component.ts | 229 ++++++++++++++++++ .../prize-pool-detail.component.html | 67 +++++ .../prize-pool-detail.component.scss | 4 + .../prize-pool-detail.component.spec.ts | 28 +++ .../prize-pool-detail.component.ts | 69 ++++++ .../prize-pool/prize-pool.component.html | 93 +++++++ .../prize-pool/prize-pool.component.scss | 0 .../prize-pool/prize-pool.component.spec.ts | 28 +++ .../prize-pool/prize-pool.component.ts | 100 ++++++++ src/app/app-common.module.ts | 5 +- src/app/app-routing.module.ts | 5 + .../activity-money/activity-money.pipe.ts | 41 ++++ src/app/pipes/index.ts | 1 + src/app/services/activity-money.service.ts | 121 +++++++++ 19 files changed, 1025 insertions(+), 1 deletion(-) create mode 100644 src/app/admin/activity-money/activity-money-routing.module.ts create mode 100644 src/app/admin/activity-money/activity-money.module.ts create mode 100644 src/app/admin/activity-money/merchant-allocation/merchant-allocation.component.html create mode 100644 src/app/admin/activity-money/merchant-allocation/merchant-allocation.component.scss create mode 100644 src/app/admin/activity-money/merchant-allocation/merchant-allocation.component.spec.ts create mode 100644 src/app/admin/activity-money/merchant-allocation/merchant-allocation.component.ts create mode 100644 src/app/admin/activity-money/prize-pool-detail/prize-pool-detail.component.html create mode 100644 src/app/admin/activity-money/prize-pool-detail/prize-pool-detail.component.scss create mode 100644 src/app/admin/activity-money/prize-pool-detail/prize-pool-detail.component.spec.ts create mode 100644 src/app/admin/activity-money/prize-pool-detail/prize-pool-detail.component.ts create mode 100644 src/app/admin/activity-money/prize-pool/prize-pool.component.html create mode 100644 src/app/admin/activity-money/prize-pool/prize-pool.component.scss create mode 100644 src/app/admin/activity-money/prize-pool/prize-pool.component.spec.ts create mode 100644 src/app/admin/activity-money/prize-pool/prize-pool.component.ts create mode 100644 src/app/pipes/activity-money/activity-money.pipe.ts create mode 100644 src/app/services/activity-money.service.ts diff --git a/src/app/admin/activity-money/activity-money-routing.module.ts b/src/app/admin/activity-money/activity-money-routing.module.ts new file mode 100644 index 0000000..bbe5eb7 --- /dev/null +++ b/src/app/admin/activity-money/activity-money-routing.module.ts @@ -0,0 +1,19 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import { MerchantAllocationComponent } from './merchant-allocation/merchant-allocation.component'; +import { PrizePoolDetailComponent } from './prize-pool-detail/prize-pool-detail.component'; +import { PrizePoolComponent } from './prize-pool/prize-pool.component'; + + + +const routes: Routes = [ + { path: 'merchant-allocation', component: MerchantAllocationComponent }, + { path: 'prize-pool', component: PrizePoolComponent }, + {path: 'prize-pool-detail', component:PrizePoolDetailComponent} +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class ActivityMoneyRoutingModule { } diff --git a/src/app/admin/activity-money/activity-money.module.ts b/src/app/admin/activity-money/activity-money.module.ts new file mode 100644 index 0000000..6a1d4b0 --- /dev/null +++ b/src/app/admin/activity-money/activity-money.module.ts @@ -0,0 +1,30 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +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 { ActivityMoneyRoutingModule } from './activity-money-routing.module'; +import { MerchantAllocationComponent } from './merchant-allocation/merchant-allocation.component'; +import { PrizePoolComponent } from './prize-pool/prize-pool.component'; +import { PrizePoolDetailComponent } from './prize-pool-detail/prize-pool-detail.component'; + + +@NgModule({ + declarations: [ + MerchantAllocationComponent, + PrizePoolComponent, + PrizePoolDetailComponent + ], + imports: [ + CommonModule, + ActivityMoneyRoutingModule, + NgZorroAntdModule, + ReactiveFormsModule, + FormsModule, + BreadcrumbModule, + AppCommonModule, + ] +}) +export class ActivityMoneyModule { } diff --git a/src/app/admin/activity-money/merchant-allocation/merchant-allocation.component.html b/src/app/admin/activity-money/merchant-allocation/merchant-allocation.component.html new file mode 100644 index 0000000..7b2172b --- /dev/null +++ b/src/app/admin/activity-money/merchant-allocation/merchant-allocation.component.html @@ -0,0 +1,152 @@ + + + + + +
+
+
+
+ + 商户号 + + + + +
+ +
+ + 商户名称 + + + + +
+ +
+ + 商户简称 + + + + +
+ + +
+
+
+ + 状态 + + + + + + + + +
+
+ +
+
+ + +
+
+
+
+ + + +
+
+ + + +
+ 共计 {{dataObject.total?dataObject.total:0}} 条数据 + + + + + 商户号 + 商户名称 + 商户简称 + + + + + + + {{data.merNo}} + {{data.merName}} + {{data.merAbbreviate}} + + + +
+
+ +
+ 共计 {{dataObject.total?dataObject.total:0}} 条数据 + + + + + 商户号 + 商户名称 + 商户简称 + 状态 + 加入时间 + 操作 + + + + + {{data.merNo}} + {{data.merName}} + {{data.merAbbreviate}} + {{data.status | allocationStatus}} + {{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} + + + 禁用 + 启用 + + + + + + + +
+
+ +
+
diff --git a/src/app/admin/activity-money/merchant-allocation/merchant-allocation.component.scss b/src/app/admin/activity-money/merchant-allocation/merchant-allocation.component.scss new file mode 100644 index 0000000..72cf4d9 --- /dev/null +++ b/src/app/admin/activity-money/merchant-allocation/merchant-allocation.component.scss @@ -0,0 +1,6 @@ +.mart10{ + margin-top: 10px; +} +.fred{ + color: red; +} \ No newline at end of file diff --git a/src/app/admin/activity-money/merchant-allocation/merchant-allocation.component.spec.ts b/src/app/admin/activity-money/merchant-allocation/merchant-allocation.component.spec.ts new file mode 100644 index 0000000..3a2f5a6 --- /dev/null +++ b/src/app/admin/activity-money/merchant-allocation/merchant-allocation.component.spec.ts @@ -0,0 +1,28 @@ +/* tslint:disable:no-unused-variable */ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { By } from '@angular/platform-browser'; +import { DebugElement } from '@angular/core'; + +import { MerchantAllocationComponent } from './merchant-allocation.component'; + +describe('MerchantAllocationComponent', () => { + let component: MerchantAllocationComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ MerchantAllocationComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(MerchantAllocationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/activity-money/merchant-allocation/merchant-allocation.component.ts b/src/app/admin/activity-money/merchant-allocation/merchant-allocation.component.ts new file mode 100644 index 0000000..5c7891f --- /dev/null +++ b/src/app/admin/activity-money/merchant-allocation/merchant-allocation.component.ts @@ -0,0 +1,229 @@ + + +import { Component, OnInit } from '@angular/core'; +import {TradeOrderService} from '../../../services/trade-order.service'; +import {LocalStorageService} from '../../../services/local-storage.service'; + +import {FormBuilder, FormGroup} from '@angular/forms'; +import {NzMessageService, NzModalService} from 'ng-zorro-antd'; +import {environment} from '../../../../environments/environment'; +import { ActivityMoneyService } from 'src/app/services/activity-money.service'; + +@Component({ + selector: 'app-merchant-allocation', + templateUrl: './merchant-allocation.component.html', + styleUrls: ['./merchant-allocation.component.scss'] +}) +export class MerchantAllocationComponent implements OnInit { + FILE_URL = environment.imageUrl; + loading = false; + dataObject: any = {}; + tableLoading = true; + searchForm: FormGroup; + pageNum: number; + whereObject: any = {}; + + + loadingObject = { + spinning: false, + msg: '加载中' + }; + + + + + selectedIndex:number = 0; + checked = false; + setOfCheckedId = new Set(); + + constructor( + private modal: NzModalService, + private message: NzMessageService, + private activityMoneyService:ActivityMoneyService, + private form: FormBuilder) { } + + ngOnInit(): void { + + this.searchForm = this.form.group({ + merNo: [null], + merName: [null], + merAbbreviate: [null], + status:[null], + }); + /* this.requestData(1); */ + if(this.selectedIndex==0){ + this.requestqueryNotPartMerList(1);//未参与 + }else{ + this.requestqueryPartMerList(1);//已参与 + } + } + + /** + * 请求未参与数据 + */ + requestqueryNotPartMerList(pageNum) { + this.setOfCheckedId.clear(); + this.checked=false; + + this.tableLoading = true; + this.whereObject['pageNum'] = pageNum; + this.whereObject['pageSize'] = 10; + this.activityMoneyService.queryNotPartMerList(this.whereObject, data => { + if (data['return_code'] === '000000') { + this.dataObject = data['return_data']; + } else { + this.message.error(data['return_msg']); + } + this.tableLoading = false; + }); + } + /** + * 请求已参与数据 + */ + requestqueryPartMerList(pageNum) { + this.tableLoading = true; + this.whereObject['pageNum'] = pageNum; + this.whereObject['pageSize'] = 10; + this.activityMoneyService.queryPartMerList(this.whereObject, data => { + if (data['return_code'] === '000000') { + this.dataObject = data['return_data']; + } else { + this.message.error(data['return_msg']); + } + this.tableLoading = false; + }); + } + + /** + * 搜索 + * @param whereObject 条件 + */ + search(whereObject: object) { + this.whereObject = whereObject; + + if(this.selectedIndex==0){ + this.requestqueryNotPartMerList(1);//未参与 + }else{ + this.requestqueryPartMerList(1);//已参与 + } + + } + + /** + * 重置 + */ + resetForm(): void { + this.searchForm.reset(); + } + + /** + * 添加参与活动用户 + */ + attendConfirm(): void { + const requestData = [...this.setOfCheckedId]; + this.modal.confirm({ + nzTitle: '提示', + nzContent: '确定选中这些商户吗?', + nzOkText: '是', + nzCancelText: '否', + nzOkType: 'primary', + nzOnOk: () => this.addPartMer(requestData) + }); + + } + + addPartMer(merNoList){ + let arr = merNoList.map(item=>{ + return {merNo: item} + }) + + let params={ + "merNoArray": arr + } + + this.activityMoneyService.addPartMer(params, data => { + if (data['return_code'] === '000000') { + this.message.create("success", data['return_data']); + this.requestqueryNotPartMerList(1) + } else { + this.message.error(data['return_msg']); + } + }); + } + + /* 禁用 */ + forbidden(merNo){ + let params = { + "merNo":merNo + } + this.activityMoneyService.disable(params, data => { + if (data['return_code'] === '000000') { + this.message.create("success", data['return_data']); + this.requestqueryPartMerList(1);//已参与 + } else { + this.message.error(data['return_msg']); + } + }); + } + /* 启用 */ + enable(merNo){ + let params = { + "merNo":merNo + } + this.activityMoneyService.enable(params, data => { + if (data['return_code'] === '000000') { + this.message.create("success", data['return_data']); + this.requestqueryPartMerList(1);//已参与 + } else { + this.message.error(data['return_msg']); + } + }); + } + + /* 切换tab */ + nzSelectChange(e){ + this.whereObject={}; + this.resetForm(); + this.dataObject={}; + this.setOfCheckedId.clear(); + this.checked=false; + + if(this.selectedIndex==0){ + this.requestqueryNotPartMerList(1);//未参与 + }else{ + this.requestqueryPartMerList(1);//已参与 + } + + } + + + /* */ + updateCheckedSet(merNo: number, checked: boolean): void { + if (checked) { + this.setOfCheckedId.add(merNo); + } else { + this.setOfCheckedId.delete(merNo); + } + } + refreshCheckedStatus(): void { + const listOfEnabledData = this.dataObject.list; + this.checked = listOfEnabledData.every(({ merNo }) => this.setOfCheckedId.has(merNo)); + } + + onItemChecked(merNo: number, checked: boolean): void { + this.updateCheckedSet(merNo, checked); + this.refreshCheckedStatus(); + } + + /*全选 */ + onAllChecked(checked: boolean): void { + console.log(checked,"checked") + this.dataObject.list.forEach(({ merNo }) => this.updateCheckedSet(merNo, checked)); + this.refreshCheckedStatus(); + } + /* */ + + + + +} diff --git a/src/app/admin/activity-money/prize-pool-detail/prize-pool-detail.component.html b/src/app/admin/activity-money/prize-pool-detail/prize-pool-detail.component.html new file mode 100644 index 0000000..6080656 --- /dev/null +++ b/src/app/admin/activity-money/prize-pool-detail/prize-pool-detail.component.html @@ -0,0 +1,67 @@ + + + + 订单详情 + + + +
+ + + + {{prizePoolDetailsObject.rebateReward.batchIdentifier }} + {{prizePoolDetailsObject.rebateReward.amount }} + {{prizePoolDetailsObject.rebateReward.partMerNum }} + {{prizePoolDetailsObject.rebateReward.partTradeAmount }} + {{prizePoolDetailsObject.rebateReward.ratio }} + {{prizePoolDetailsObject.rebateReward.status | activityMoneyStatus }} + {{prizePoolDetailsObject.rebateReward.timeStart | date : 'yyyy-MM-dd HH:mm:ss' }} + {{prizePoolDetailsObject.rebateReward.timeEnd | date : 'yyyy-MM-dd HH:mm:ss' }} + + + +
+ +
+ + + + + 奖池编号 + 业务员名称 + 商户号 + 商户名称 + 商户简称 + 商户账户 + 奖池占比(%) + 返利金额 + 状态 + + + + + {{data.batchIdentifier}} + {{data.salesmanName}} + {{data.merNo}} + {{data.merName}} + {{data.merAbbreviate}} + {{data.merAccountNumber}} + {{data.rewardRatio}} + {{data.amount}} + {{data.status | activityMoneyStatus}} + + + + +
+
+ +
diff --git a/src/app/admin/activity-money/prize-pool-detail/prize-pool-detail.component.scss b/src/app/admin/activity-money/prize-pool-detail/prize-pool-detail.component.scss new file mode 100644 index 0000000..704fc02 --- /dev/null +++ b/src/app/admin/activity-money/prize-pool-detail/prize-pool-detail.component.scss @@ -0,0 +1,4 @@ +.btr{ + text-align: right; + margin-bottom: 10px; +} \ No newline at end of file diff --git a/src/app/admin/activity-money/prize-pool-detail/prize-pool-detail.component.spec.ts b/src/app/admin/activity-money/prize-pool-detail/prize-pool-detail.component.spec.ts new file mode 100644 index 0000000..3be5f03 --- /dev/null +++ b/src/app/admin/activity-money/prize-pool-detail/prize-pool-detail.component.spec.ts @@ -0,0 +1,28 @@ +/* tslint:disable:no-unused-variable */ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { By } from '@angular/platform-browser'; +import { DebugElement } from '@angular/core'; + +import { PrizePoolDetailComponent } from './prize-pool-detail.component'; + +describe('PrizePoolDetailComponent', () => { + let component: PrizePoolDetailComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ PrizePoolDetailComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PrizePoolDetailComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/activity-money/prize-pool-detail/prize-pool-detail.component.ts b/src/app/admin/activity-money/prize-pool-detail/prize-pool-detail.component.ts new file mode 100644 index 0000000..c5384e0 --- /dev/null +++ b/src/app/admin/activity-money/prize-pool-detail/prize-pool-detail.component.ts @@ -0,0 +1,69 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivityMoneyService } from 'src/app/services/activity-money.service'; +import {NzMessageService, NzModalService} from 'ng-zorro-antd'; +import {environment} from '../../../../environments/environment'; +import {ActivatedRoute, Params} from '@angular/router'; +@Component({ + selector: 'app-prize-pool-detail', + templateUrl: './prize-pool-detail.component.html', + styleUrls: ['./prize-pool-detail.component.scss'] +}) +export class PrizePoolDetailComponent implements OnInit { + FILE_URL = environment.imageUrl; + selectedIndex:number = 0; + + prizePoolDetailsObject:any={}; + + loadingObject = { + spinning: false, + msg: '加载中' + }; + batchIdentifier=""; + constructor( + private modal: NzModalService, + private message: NzMessageService, + private activityMoneyService:ActivityMoneyService, + private activatedRoute: ActivatedRoute, + ) { } + + ngOnInit() { + this.activatedRoute.queryParams.subscribe((queryParams: Params) => { + if (queryParams['batchIdentifier'] != null && queryParams['batchIdentifier'].length > 0) { + this.batchIdentifier=queryParams['batchIdentifier']; + this.prizePoolDetails(queryParams['batchIdentifier']); + } + }); + } + + /*打开奖池详情 */ + prizePoolDetails(batchIdentifier){ + let params ={ + batchIdentifier:batchIdentifier + } + this.activityMoneyService.queryRewardDetail(params, data => { + if (data['return_code'] === '000000') { + this.prizePoolDetailsObject = data['return_data']; + } else { + this.message.error(data['return_msg']); + } + }); + } + + /* 导出商户明天 */ + exportTradeOrder(batchIdentifier) { + this.loadingObject.spinning = true; + this.loadingObject.msg = '导出中...'; + let params ={ + batchIdentifier:batchIdentifier + } + this.activityMoneyService.exportRewardRoster(params, data => { + if (data['return_code'] === '000000') { + window.location.href = this.FILE_URL + data['return_data']; + } else { + this.message.error(data['return_msg']); + } + this.loadingObject.spinning = false; + }); + } + +} diff --git a/src/app/admin/activity-money/prize-pool/prize-pool.component.html b/src/app/admin/activity-money/prize-pool/prize-pool.component.html new file mode 100644 index 0000000..69be025 --- /dev/null +++ b/src/app/admin/activity-money/prize-pool/prize-pool.component.html @@ -0,0 +1,93 @@ + + + + + +
+
+
+
+ + 奖池编号 + + + + +
+ +
+ + 奖池状态 + + + + + + + + +
+ + +
+ +
+
+ + +
+
+
+
+ + +
+ 共计 {{dataObject.total?dataObject.total:0}} 条数据 + + + + + + 奖池编号 + 奖池金额 + 参与商家数量 + 参与交易金额 + 活动金比例(%) + 状态 + 奖池开始时间 + 奖池结束时间 + + 操作 + + + + + {{data.batchIdentifier}} + {{data.amount}} + {{data.partMerNum}} + {{data.partTradeAmount}} + {{data.ratio}} + {{data.status | activityMoneyStatus}} + {{data.timeStart | date : 'yyyy-MM-dd HH:mm:ss'}} + {{data.timeEnd | date : 'yyyy-MM-dd HH:mm:ss'}} + + + 详情 + + 发放 + + + + +
+ diff --git a/src/app/admin/activity-money/prize-pool/prize-pool.component.scss b/src/app/admin/activity-money/prize-pool/prize-pool.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/activity-money/prize-pool/prize-pool.component.spec.ts b/src/app/admin/activity-money/prize-pool/prize-pool.component.spec.ts new file mode 100644 index 0000000..42e70ea --- /dev/null +++ b/src/app/admin/activity-money/prize-pool/prize-pool.component.spec.ts @@ -0,0 +1,28 @@ +/* tslint:disable:no-unused-variable */ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { By } from '@angular/platform-browser'; +import { DebugElement } from '@angular/core'; + +import { PrizePoolComponent } from './prize-pool.component'; + +describe('PrizePoolComponent', () => { + let component: PrizePoolComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ PrizePoolComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PrizePoolComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/activity-money/prize-pool/prize-pool.component.ts b/src/app/admin/activity-money/prize-pool/prize-pool.component.ts new file mode 100644 index 0000000..fa755e9 --- /dev/null +++ b/src/app/admin/activity-money/prize-pool/prize-pool.component.ts @@ -0,0 +1,100 @@ + + + +import { Component, OnInit } from '@angular/core'; +import {LocalStorageService} from '../../../services/local-storage.service'; +import {FormBuilder, FormGroup} from '@angular/forms'; +import {NzMessageService, NzModalService} from 'ng-zorro-antd'; +import {environment} from '../../../../environments/environment'; +import { ActivityMoneyService } from 'src/app/services/activity-money.service'; +@Component({ + selector: 'app-prize-pool', + templateUrl: './prize-pool.component.html', + styleUrls: ['./prize-pool.component.scss'] +}) +export class PrizePoolComponent implements OnInit { + FILE_URL = environment.imageUrl; + loading = false; + dataObject: any = {}; + tableLoading = true; + searchForm: FormGroup; + pageNum: number; + whereObject: any = {}; + + + constructor(private store: LocalStorageService, // 数据请求 + private modal: NzModalService, + private message: NzMessageService, + private activityMoneyService:ActivityMoneyService, + private form: FormBuilder) { } + + ngOnInit(): void { + + + this.searchForm = this.form.group({ + batchIdentifier: [null], + status: [null], + }); + this.requestData(1); + } + + /** + * 请求数据 + */ + requestData(pageNum) { + this.tableLoading = true; + this.whereObject['pageNum'] = pageNum; + this.whereObject['pageSize'] = 10; + this.activityMoneyService.queryRewardList(this.whereObject, data => { + if (data['return_code'] === '000000') { + this.dataObject = data['return_data']; + } else { + this.modal.error(data['return_msg']); + } + this.tableLoading = false; + }); + } + + /** + * 搜索 + * @param whereObject 条件 + */ + search(whereObject: object) { + this.whereObject = whereObject; + this.requestData(1); + } + + /** + * 重置 + */ + resetForm(): void { + this.searchForm.reset(); + } + + /* 发放奖池金额 */ + disbursementAmount(batchIdentifier){ + let params ={ + batchIdentifier:batchIdentifier + } + this.modal.confirm({ + nzTitle: '提示', + nzContent: '确定发放奖池金额吗?', + nzOnOk: () => this.grantReward(params) + }); + } + grantReward(params){ + this.activityMoneyService.grantReward(params, data => { + if (data['return_code'] === '000000') { + this.message.create("success", data['return_data']); + this.requestData(1); + } else { + this.message.error(data['return_msg']); + } + }); + } + + +} + + + diff --git a/src/app/app-common.module.ts b/src/app/app-common.module.ts index bc6e81a..de77283 100644 --- a/src/app/app-common.module.ts +++ b/src/app/app-common.module.ts @@ -23,6 +23,7 @@ import { MerStatusPipe, CompleteStatusPipe, MerTypePipe, DeviceStatusPipe, PlatformTypePipe, DeviceTypePipe, DeviceOrderTypePipe, CreateTypePipe, + ActivityMoneyPipe,AllocationStatus } from './pipes'; import {DeviceOrderStatusPipe} from './pipes/device/device-order-status.pipe'; import {DeviceOrderPayTypePipe} from './pipes/device/device-order-pay-type.pipe'; @@ -49,7 +50,9 @@ const PIPES = [ DeviceOrderPayTypePipe, PlatformTypePipe, CreateTypePipe, - SettleTypePipe + SettleTypePipe, + ActivityMoneyPipe, + AllocationStatus ]; @NgModule({ diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index bd70510..7a09708 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -88,6 +88,11 @@ const routes: Routes = [ loadChildren: () => import('./admin/cms/cms.module').then(m => m.CmsModule), canActivate: [InitGuardService] }, + { + path: 'activity-money', + loadChildren: () => import('./admin/activity-money/activity-money.module').then(m => m.ActivityMoneyModule), + canActivate: [InitGuardService] + }, ], }, { diff --git a/src/app/pipes/activity-money/activity-money.pipe.ts b/src/app/pipes/activity-money/activity-money.pipe.ts new file mode 100644 index 0000000..80bc196 --- /dev/null +++ b/src/app/pipes/activity-money/activity-money.pipe.ts @@ -0,0 +1,41 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'activityMoneyStatus' +}) +export class ActivityMoneyPipe implements PipeTransform { + + transform(statusNum: number): string { + switch (statusNum) { + case 0: + return '不可用'; + case 1: + return '未发放'; + case 2: + return '已发放'; + default: + return '未知'; + } + } + +} + +@Pipe({ + name: 'allocationStatus' +}) +export class AllocationStatus implements PipeTransform { + + transform(statusNum: number): string { + switch (statusNum) { + case 0: + return '不可用'; + case 1: + return '正常'; + case 2: + return '冻结'; + default: + return '未知'; + } + } + +} diff --git a/src/app/pipes/index.ts b/src/app/pipes/index.ts index c191b94..f7f52d4 100644 --- a/src/app/pipes/index.ts +++ b/src/app/pipes/index.ts @@ -18,4 +18,5 @@ export * from './device/device-type.pipe'; export * from './device/device-order-type.pipe'; export * from './device/device-order-status.pipe'; export * from './device/device-order-pay-type.pipe'; +export * from './activity-money/activity-money.pipe'; diff --git a/src/app/services/activity-money.service.ts b/src/app/services/activity-money.service.ts new file mode 100644 index 0000000..09de984 --- /dev/null +++ b/src/app/services/activity-money.service.ts @@ -0,0 +1,121 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { environment } from '../../environments/environment'; +import { CommonsService } from './commons.service'; + +@Injectable({ + providedIn: 'root' +}) +export class ActivityMoneyService { + + constructor( + private http: HttpClient, + private commonsService: CommonsService, + ) { } + +/* ----------------------------活动金 - 参与用户配置--------------------------------- */ + + /** + * 获取未参与的商户列表 + * @param paramObject 参数 + * @param callBack + */ + queryNotPartMerList(paramObject: object, callBack) { + this.http.get(environment.baseUrl + 'rebatePartMer/queryNotPartMerList?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => { + callBack(data); + }); + } + + + + /** + * 添加参与活动用户 + * @param paramObject 参数 + * @param callBack + */ + addPartMer(paramObject: object, callBack) { + this.http.post(environment.baseUrl + 'rebatePartMer/addPartMer', paramObject).subscribe(data => { + callBack(data); + }); + } + + /** + * 禁用 + * @param paramObject 参数 + * @param callBack + */ + disable(paramObject: object, callBack) { + this.http.post(environment.baseUrl + 'rebatePartMer/disable', paramObject).subscribe(data => { + callBack(data); + }); + } + + /** + * 启用 + * @param paramObject 参数 + * @param callBack + */ + enable(paramObject: object, callBack) { + this.http.post(environment.baseUrl + 'rebatePartMer/enable', paramObject).subscribe(data => { + callBack(data); + }); + } + + /** + * 获取参与的商户列表 + * @param paramObject 参数 + * @param callBack + */ + queryPartMerList(paramObject: object, callBack) { + this.http.get(environment.baseUrl + 'rebatePartMer/queryPartMerList?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => { + callBack(data); + }); + } + + /* ----------------------------活动金 - 奖池业务--------------------------------- */ + + /** + * 获取奖池列表 + * @param paramObject 参数 + * @param callBack + */ + queryRewardList(paramObject: object, callBack) { + this.http.get(environment.baseUrl + 'rebateReward/queryRewardList?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => { + callBack(data); + }); + } + + /** + * 获取奖池详情、奖池名单 + * @param paramObject 参数 + * @param callBack + */ + queryRewardDetail(paramObject: object, callBack) { + this.http.get(environment.baseUrl + 'rebateReward/queryRewardDetail?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => { + callBack(data); + }); + } + + /** + * 发放奖池金额 + * @param paramObject 参数 + * @param callBack + */ + grantReward(paramObject: object, callBack) { + this.http.post(environment.baseUrl + 'rebateReward/grantReward', paramObject).subscribe(data => { + callBack(data); + }); + } + + /** + * 导出奖池商户名单 + * @param paramObject 参数 + * @param callBack + */ + exportRewardRoster(paramObject: object, callBack) { + this.http.get(environment.baseUrl + 'rebateReward/exportRewardRoster?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => { + callBack(data); + }); + } + +}