Compare commits
3 Commits
master
...
feature/ym
Author | SHA1 | Date |
---|---|---|
游梦婷 | ff8c72397a | 1 year ago |
游梦婷 | 58b4517392 | 1 year ago |
游梦婷 | 30c7db9813 | 1 year ago |
@ -0,0 +1,21 @@ |
||||
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, data: { |
||||
customBreadcrumb: '奖池详情' |
||||
}} |
||||
]; |
||||
|
||||
@NgModule({ |
||||
imports: [RouterModule.forChild(routes)], |
||||
exports: [RouterModule] |
||||
}) |
||||
export class ActivityMoneyRoutingModule { } |
@ -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 { } |
@ -0,0 +1,152 @@ |
||||
<!-- start 面包屑 --> |
||||
<app-breadcrumb></app-breadcrumb> |
||||
<!-- end 面包屑 --> |
||||
<!--条件搜索--> |
||||
<nz-spin [nzSpinning]="loadingObject.spinning" nzTip="{{loadingObject.msg}}"> |
||||
<div class="inner-content"> |
||||
<form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)"> |
||||
<div nz-row> |
||||
<div nz-col nzSpan="8" > |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="8">商户号</nz-form-label> |
||||
<nz-form-control [nzSpan]="14"> |
||||
<input nz-input formControlName="merNo" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col nzSpan="8" > |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="8">商户名称</nz-form-label> |
||||
<nz-form-control [nzSpan]="14"> |
||||
<input nz-input formControlName="merName" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col nzSpan="8" > |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="8">商户简称</nz-form-label> |
||||
<nz-form-control [nzSpan]="14"> |
||||
<input nz-input formControlName="merAbbreviate" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
<div nz-row *ngIf="selectedIndex==1"> |
||||
<div nz-col nzSpan="8"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="8">状态</nz-form-label> |
||||
<nz-form-control [nzSpan]="14"> |
||||
<nz-select nzAllowClear formControlName="status"> |
||||
<!-- <nz-option nzLabel="不可用" nzValue="0"></nz-option> --> |
||||
<nz-option nzLabel="正常" nzValue="1"></nz-option> |
||||
<nz-option nzLabel="冻结" nzValue="2"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
|
||||
<div nz-row> |
||||
<div nz-col nzSpan="24" class="search-button"> |
||||
<button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button> |
||||
<button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload" nzTheme="outline"></i>重置</button> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
|
||||
<nz-tabset class="inner-content" [(nzSelectedIndex)]="selectedIndex" (nzSelectChange)="nzSelectChange([$event])"> |
||||
<nz-tab nzTitle="未参与" > |
||||
<div class="mart10"> |
||||
<div class="operating-button"> |
||||
<nz-badge [nzCount]="setOfCheckedId.size"> |
||||
<button nz-button nzType="primary" [disabled]="setOfCheckedId.size === 0" (click)="attendConfirm()"> |
||||
添加 |
||||
</button> |
||||
</nz-badge> |
||||
</div> |
||||
<span>共计 {{dataObject.total?dataObject.total:0}} 条数据</span> |
||||
<nz-table |
||||
#rowSelectionTable |
||||
[nzData]="dataObject.list" |
||||
[nzTotal]="dataObject.total" |
||||
[nzFrontPagination]="false" |
||||
[nzLoading]="tableLoading" |
||||
[nzPageIndex]="whereObject.pageNum" |
||||
[nzPageSize]="whereObject.pageSize" |
||||
(nzPageIndexChange)="requestqueryNotPartMerList($event)" |
||||
|
||||
> |
||||
<thead> |
||||
<tr> |
||||
<th [nzChecked]="checked" [nzShowCheckbox]="true" (nzCheckedChange)="onAllChecked($event)"></th> |
||||
<th >商户号</th> |
||||
<th>商户名称</th> |
||||
<th >商户简称</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
|
||||
<tr *ngFor="let data of rowSelectionTable.data;let i = index"> |
||||
<td |
||||
[nzChecked]="setOfCheckedId.has(data.merNo)" |
||||
(nzCheckedChange)="onItemChecked(data.merNo, $event)" |
||||
></td> |
||||
<td>{{data.merNo}}</td> |
||||
<td>{{data.merName}}</td> |
||||
<td>{{data.merAbbreviate}}</td> |
||||
</tr> |
||||
</tbody> |
||||
</nz-table> |
||||
</div> |
||||
</nz-tab> |
||||
<nz-tab nzTitle="已参与"> |
||||
<div class="mart10"> |
||||
<span>共计 {{dataObject.total?dataObject.total:0}} 条数据</span> |
||||
|
||||
<nz-table #basicTable |
||||
[nzData]="dataObject.list" |
||||
[nzTotal]="dataObject.total" |
||||
[nzFrontPagination]="false" |
||||
[nzLoading]="tableLoading" |
||||
[nzPageIndex]="whereObject.pageNum" |
||||
[nzPageSize]="whereObject.pageSize" |
||||
(nzPageIndexChange)="requestqueryPartMerList($event)" |
||||
> |
||||
<thead> |
||||
<tr> |
||||
<th >商户号</th> |
||||
<th >商户名称</th> |
||||
<th >商户简称</th> |
||||
<th >状态</th> |
||||
<th >加入时间</th> |
||||
<th>操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data;let i = index"> |
||||
<td>{{data.merNo}}</td> |
||||
<td>{{data.merName}}</td> |
||||
<td>{{data.merAbbreviate}}</td> |
||||
<td [class]="data.status==2?'fred':''">{{data.status | allocationStatus}}</td> |
||||
<td >{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
|
||||
<td nzRight="0px" class="table-td-operation"> |
||||
<a *ngIf="data.status==1" (click)="forbidden(data.merNo)">禁用</a> |
||||
<a *ngIf="data.status==2" (click)="enable(data.merNo)">启用</a> |
||||
</td> |
||||
|
||||
</tr> |
||||
</tbody> |
||||
</nz-table> |
||||
|
||||
|
||||
</div> |
||||
</nz-tab> |
||||
|
||||
</nz-tabset> |
||||
</nz-spin> |
@ -0,0 +1,6 @@ |
||||
.mart10{ |
||||
margin-top: 10px; |
||||
} |
||||
.fred{ |
||||
color: red; |
||||
} |
@ -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<MerchantAllocationComponent>; |
||||
|
||||
beforeEach(async(() => { |
||||
TestBed.configureTestingModule({ |
||||
declarations: [ MerchantAllocationComponent ] |
||||
}) |
||||
.compileComponents(); |
||||
})); |
||||
|
||||
beforeEach(() => { |
||||
fixture = TestBed.createComponent(MerchantAllocationComponent); |
||||
component = fixture.componentInstance; |
||||
fixture.detectChanges(); |
||||
}); |
||||
|
||||
it('should create', () => { |
||||
expect(component).toBeTruthy(); |
||||
}); |
||||
}); |
@ -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<number>(); |
||||
|
||||
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(); |
||||
} |
||||
/* */ |
||||
|
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,64 @@ |
||||
<!-- start 面包屑 --> |
||||
|
||||
<nz-breadcrumb [nzAutoGenerate]="true" [nzRouteLabel]="'customBreadcrumb'"></nz-breadcrumb> |
||||
<!-- end 面包屑 --> |
||||
<div class="inner-content"> |
||||
<nz-tabset [(nzSelectedIndex)]="selectedIndex"> |
||||
<nz-tab nzTitle="奖池详情"> |
||||
<nz-descriptions *ngIf="prizePoolDetailsObject.rebateReward" nzBordered [nzColumn]="{ xxl: 3, xl: 2, lg: 2, md: 2, sm: 2, xs: 1 }"> |
||||
<nz-descriptions-item nzTitle="奖池编号">{{prizePoolDetailsObject.rebateReward.batchIdentifier }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="奖池金额">{{prizePoolDetailsObject.rebateReward.amount }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="参与商家数量">{{prizePoolDetailsObject.rebateReward.partMerNum }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="参与交易金额">{{prizePoolDetailsObject.rebateReward.partTradeAmount }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="活动金比例(%)">{{prizePoolDetailsObject.rebateReward.ratio }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="状态">{{prizePoolDetailsObject.rebateReward.status | activityMoneyStatus }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="奖池开始时间">{{prizePoolDetailsObject.rebateReward.timeStart | date : 'yyyy-MM-dd HH:mm:ss' }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="奖池结束时间">{{prizePoolDetailsObject.rebateReward.timeEnd | date : 'yyyy-MM-dd HH:mm:ss' }}</nz-descriptions-item> |
||||
</nz-descriptions> |
||||
</nz-tab> |
||||
<nz-tab nzTitle="奖池名单"> |
||||
<div class="btr"> |
||||
<button nz-button nzType="primary" [(disabled)]="loadingObject.spinning" (click)="exportTradeOrder(batchIdentifier) "> |
||||
<i nz-icon nzType="upload" nzTheme="outline"></i> |
||||
导出 |
||||
</button> |
||||
</div> |
||||
<nz-spin [nzSpinning]="loadingObject.spinning" nzTip="{{loadingObject.msg}}"> |
||||
<nz-table |
||||
#basicTable2 |
||||
[nzData]="prizePoolDetailsObject.rebateRewardRoster || [] " |
||||
[nzScroll]="{ x: '1350px'}" |
||||
[nzPageSize]="10" |
||||
> |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="150px">奖池编号</th> |
||||
<th nzWidth="150px">业务员名称</th> |
||||
<th nzWidth="180px">商户号</th> |
||||
<th nzWidth="180px">商户名称</th> |
||||
<th nzWidth="150px">商户简称</th> |
||||
<th nzWidth="150px">商户账户</th> |
||||
<th nzWidth="150px">奖池占比(%)</th> |
||||
<th nzWidth="150px">返利金额</th> |
||||
<th nzWidth="150px" nzRight="0px">状态</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable2.data"> |
||||
<td>{{data.batchIdentifier}}</td> |
||||
<td>{{data.salesmanName}}</td> |
||||
<td>{{data.merNo}}</td> |
||||
<td>{{data.merName}}</td> |
||||
<td>{{data.merAbbreviate}}</td> |
||||
<td>{{data.merAccountNumber}}</td> |
||||
<td>{{data.rewardRatio}}</td> |
||||
<td>{{data.amount}}</td> |
||||
<td nzRight="0px" class="table-td-operation">{{data.status | activityMoneyStatus}}</td> |
||||
</tr> |
||||
</tbody> |
||||
</nz-table> |
||||
</nz-spin> |
||||
</nz-tab> |
||||
</nz-tabset> |
||||
|
||||
</div> |
@ -0,0 +1,4 @@ |
||||
.btr{ |
||||
text-align: right; |
||||
margin-bottom: 10px; |
||||
} |
@ -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<PrizePoolDetailComponent>; |
||||
|
||||
beforeEach(async(() => { |
||||
TestBed.configureTestingModule({ |
||||
declarations: [ PrizePoolDetailComponent ] |
||||
}) |
||||
.compileComponents(); |
||||
})); |
||||
|
||||
beforeEach(() => { |
||||
fixture = TestBed.createComponent(PrizePoolDetailComponent); |
||||
component = fixture.componentInstance; |
||||
fixture.detectChanges(); |
||||
}); |
||||
|
||||
it('should create', () => { |
||||
expect(component).toBeTruthy(); |
||||
}); |
||||
}); |
@ -0,0 +1,70 @@ |
||||
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'];
|
||||
window.open(data['return_data']); |
||||
} else { |
||||
this.message.error(data['return_msg']); |
||||
} |
||||
this.loadingObject.spinning = false; |
||||
}); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,93 @@ |
||||
<!-- start 面包屑 --> |
||||
<app-breadcrumb></app-breadcrumb> |
||||
<!-- end 面包屑 --> |
||||
<!--条件搜索--> |
||||
|
||||
<div class="inner-content"> |
||||
<form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)"> |
||||
<div nz-row> |
||||
<div nz-col nzSpan="8" > |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="8">奖池编号</nz-form-label> |
||||
<nz-form-control [nzSpan]="14"> |
||||
<input nz-input formControlName="batchIdentifier" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col nzSpan="8"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="8">奖池状态</nz-form-label> |
||||
<nz-form-control [nzSpan]="14"> |
||||
<nz-select nzAllowClear formControlName="status"> |
||||
<!-- <nz-option nzLabel="不可用" nzValue="0"></nz-option> --> |
||||
<nz-option nzLabel="未发放" nzValue="1"></nz-option> |
||||
<nz-option nzLabel="已发放" nzValue="2"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
|
||||
<div nz-row> |
||||
<div nz-col nzSpan="24" class="search-button"> |
||||
<button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button> |
||||
<button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload" nzTheme="outline"></i>重置</button> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
|
||||
|
||||
<div class="inner-content"> |
||||
<span>共计 {{dataObject.total?dataObject.total:0}} 条数据</span> |
||||
<!-- <div class="operating-button"> |
||||
<button nz-button nzType="primary" class="right-btn" (click)="exportTradeOrder()" >导出交易</button> |
||||
</div> --> |
||||
<!--数组表格 --> |
||||
<nz-table #basicTable |
||||
[nzData]="dataObject.list" |
||||
[nzTotal]="dataObject.total" |
||||
[nzFrontPagination]="false" |
||||
[nzLoading]="tableLoading" |
||||
[nzPageIndex]="whereObject.pageNum" |
||||
[nzPageSize]="whereObject.pageSize" |
||||
(nzPageIndexChange)="requestData($event)" |
||||
[nzScroll]="{ x: '1150px'}"> |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="180px">奖池编号</th> |
||||
<th nzWidth="150px">奖池金额</th> |
||||
<th nzWidth="150px">参与商家数量</th> |
||||
<th nzWidth="150px">参与交易金额</th> |
||||
<th nzWidth="150px">活动金比例(%)</th> |
||||
<th nzWidth="100px">状态</th> |
||||
<th nzWidth="200px">奖池开始时间</th> |
||||
<th nzWidth="200px">奖池结束时间</th> |
||||
|
||||
<th nzWidth="150px" nzRight="0px">操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data;let i = index"> |
||||
<td>{{data.batchIdentifier}}</td> |
||||
<td>{{data.amount}}</td> |
||||
<td>{{data.partMerNum}}</td> |
||||
<td>{{data.partTradeAmount}}</td> |
||||
<td>{{data.ratio}}</td> |
||||
<td>{{data.status | activityMoneyStatus}}</td> |
||||
<td>{{data.timeStart | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
<td>{{data.timeEnd | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
|
||||
<td nzRight="0px" class="table-td-operation"> |
||||
<a [routerLink]="['/admin/activity-money/prize-pool-detail']" [queryParams]="{batchIdentifier: data.batchIdentifier}">详情</a> |
||||
<nz-divider *ngIf="data.status==1" nzType="vertical"></nz-divider> |
||||
<a *ngIf="data.status==1" (click)="disbursementAmount(data.batchIdentifier)">发放</a> |
||||
</td> |
||||
</tr> |
||||
</tbody> |
||||
</nz-table> |
||||
</div> |
||||
|
@ -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<PrizePoolComponent>; |
||||
|
||||
beforeEach(async(() => { |
||||
TestBed.configureTestingModule({ |
||||
declarations: [ PrizePoolComponent ] |
||||
}) |
||||
.compileComponents(); |
||||
})); |
||||
|
||||
beforeEach(() => { |
||||
fixture = TestBed.createComponent(PrizePoolComponent); |
||||
component = fixture.componentInstance; |
||||
fixture.detectChanges(); |
||||
}); |
||||
|
||||
it('should create', () => { |
||||
expect(component).toBeTruthy(); |
||||
}); |
||||
}); |
@ -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']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
|
||||
|
@ -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 '未知'; |
||||
} |
||||
} |
||||
|
||||
} |
@ -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); |
||||
}); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue