parent
ebe6a8a603
commit
d87b23bc08
@ -0,0 +1,73 @@ |
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '1200' }" |
||||
[nzBordered]="true" |
||||
[nzShowPagination]="false" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="false" |
||||
[nzShowTotal]="totalTemplate" |
||||
[nzTotal]="tableData.length" |
||||
[nzData]="tableData" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="100px">渠道</th> |
||||
<th nzWidth="100px">一级佣金</th> |
||||
<th nzWidth="100px">二级佣金</th> |
||||
<th nzWidth="100px">更新时间</th> |
||||
<th nzRight nzWidth="50px">操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td style="{{today == data.weeks?'color: red':''}}">{{data.channel | dictionary: "MER_SOURCE_TYPE"}}</td> |
||||
<td style="{{today == data.weeks?'color: red':''}}">{{data.rebate}} %</td> |
||||
<td style="{{today == data.weeks?'color: red':''}}">{{data.rebateOne}} %</td> |
||||
<td style="{{today == data.weeks?'color: red':''}}">{{data.updateTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
<td nzRight> |
||||
<button nz-button nzType="link" (click)="showEditModal(data)" [nzSize]="'small'" >修改</button> |
||||
</td> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
||||
|
||||
<nz-modal [(nzVisible)]="editDataModal" |
||||
[nzWidth]="500" |
||||
nzTitle="修改" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="closeEditModal()"> |
||||
<ng-container *nzModalContent> |
||||
<form nz-form [formGroup]="editDataForm"> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24">渠道</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-select formControlName="channel" [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of merSourceTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>一级佣金</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-input-group nzAddOnAfter="%"> |
||||
<nz-input-number formControlName="rebate" [nzMin]="0" [nzMax]="100" [nzStep]="1" [nzPrecision]="2" [nzPlaceHolder]="'一级佣金'"></nz-input-number> |
||||
</nz-input-group> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>二级佣金</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-input-group nzAddOnAfter="%"> |
||||
<nz-input-number formControlName="rebateOne" [nzMin]="0" [nzMax]="100" [nzStep]="1" [nzPrecision]="2" [nzPlaceHolder]="'二级佣金'"></nz-input-number> |
||||
</nz-input-group> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
|
||||
<div nz-flex style="margin-top: 15px" [nzJustify]="'center'"> |
||||
<button nz-button nzType="primary" (click)="submitData()" class="submit-btn">保存</button> |
||||
</div> |
||||
</form> |
||||
</ng-container> |
||||
</nz-modal> |
@ -0,0 +1,6 @@ |
||||
nz-input-number { |
||||
width: 100%; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
@ -0,0 +1,193 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, NzTableModule, |
||||
NzTbodyComponent, NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzInputNumberComponent, NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||
import {NzModalComponent, NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {WeekPipe} from "../../../pipes/common/week.pipe"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzInputDirective, NzInputGroupComponent} from "ng-zorro-antd/input"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||
import {NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {BrowserStorageService} from "../../../utils/localStorage.service"; |
||||
import {OilChannelWeekService} from "../../../services/mer-oil-price/oil-channel-week.service"; |
||||
import {CommonService} from "../../../services/common/common.service"; |
||||
import {SpreadOilChannelService} from "../../../services/spread/spread-oil-channel.service"; |
||||
|
||||
@Component({ |
||||
selector: 'app-spread-channel-config', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzInputDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
NzTableModule, |
||||
NzModalModule, |
||||
NzFlexDirective, |
||||
NzDescriptionsModule, |
||||
NzUploadComponent, |
||||
NzAvatarModule, |
||||
NzImageModule, |
||||
NzSwitchComponent, |
||||
NzDatePickerComponent, |
||||
NzInputNumberModule, |
||||
WeekPipe, |
||||
NzInputGroupComponent |
||||
], |
||||
templateUrl: './spread-channel-config.component.html', |
||||
styleUrl: './spread-channel-config.component.less' |
||||
}) |
||||
export class SpreadChannelConfigComponent { |
||||
// 表单数据
|
||||
tableData: any = []; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
// 油站渠道
|
||||
merSourceTypeArray = new DictionaryPipe().getDictionaryList('MER_SOURCE_TYPE'); |
||||
// 编辑数据表单
|
||||
editDataForm: FormGroup; |
||||
editDataModal = false; |
||||
// 当前日期
|
||||
today:number = new Date().getDay(); |
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private message: NzMessageService, |
||||
private storage: BrowserStorageService, |
||||
private spreadOilChannelService: SpreadOilChannelService, |
||||
private commonService: CommonService, |
||||
private modal: NzModalService) { |
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
}); |
||||
|
||||
this.editDataForm = this.fb.group({ |
||||
id: [null, [Validators.required]], |
||||
channel: [null], |
||||
rebate: [null, [Validators.required]], |
||||
rebateOne: [null, [Validators.required]], |
||||
}); |
||||
// 查询数据
|
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
this.searchForm.value.time = new Date().getTime(); |
||||
this.spreadOilChannelService.getOilChannelList(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
/** |
||||
* 打开编辑模态框 |
||||
*/ |
||||
showEditModal(data: any) { |
||||
data['channel'] = String(data['channel']); |
||||
this.editDataForm.patchValue(data); |
||||
this.editDataForm.controls['channel'].disable(); |
||||
this.editDataModal = true; |
||||
} |
||||
|
||||
/** |
||||
* 提交数据 |
||||
*/ |
||||
submitData() { |
||||
if (this.editDataForm.valid) { |
||||
const param = { |
||||
channel: this.editDataForm.controls['channel'].value, |
||||
rebate: this.editDataForm.controls['rebate'].value, |
||||
rebateOne: this.editDataForm.controls['rebateOne'].value |
||||
}; |
||||
this.spreadOilChannelService.editOilChannel(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
// 刷新数据
|
||||
this.queryData(); |
||||
// 关闭弹窗
|
||||
this.closeEditModal(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} else { |
||||
Object.values(this.editDataForm.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 关闭编辑任务模态框 |
||||
*/ |
||||
closeEditModal() { |
||||
this.editDataForm.reset(); |
||||
this.editDataModal = false; |
||||
} |
||||
} |
@ -0,0 +1,100 @@ |
||||
<nz-row [nzGutter]="6" style="margin-bottom: 15px;"> |
||||
<nz-col [nzSpan]="6"> |
||||
<nz-statistic [nzValue]="'¥'+countData" [nzTitle]="'佣金金额'"></nz-statistic> |
||||
</nz-col> |
||||
</nz-row> |
||||
<form nz-form [formGroup]="searchForm" class="search_form"> |
||||
<div nz-row [nzGutter]="24"> |
||||
<div nz-col [nzSpan]="16"> |
||||
<nz-form-item> |
||||
<nz-form-label>时间</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-range-picker formControlName="payTimeArray" nzShowTime [nzAllowClear]="false" [nzFormat]="'yyyy/MM/dd HH:mm:ss'"></nz-range-picker> |
||||
<nz-radio-group nzButtonStyle="solid" formControlName="payTimeSelect" (ngModelChange)="payTimeInit()"> |
||||
<label nz-radio-button *ngFor="let item of dateTypeSelect" nzValue="{{item.value}}">{{item.name}}</label> |
||||
</nz-radio-group> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>状态</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="orderStatus" [nzPlaceHolder]="'请选择'"> |
||||
<nz-option nzValue="2" nzLabel="已支付"></nz-option> |
||||
<nz-option nzValue="4" nzLabel="已退款"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="2"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzNoColon]="true"></nz-form-label> |
||||
<nz-form-control> |
||||
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '1200' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="queryData()" |
||||
nzShowSizeChanger |
||||
(nzPageSizeChange)="this.tablePageSize = $event;queryData()" |
||||
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="100px">订单号</th> |
||||
<th nzWidth="120px">油站名称</th> |
||||
<th nzWidth="60px">油号</th> |
||||
<th nzWidth="60px">枪号</th> |
||||
<th nzWidth="60px">升数</th> |
||||
<th nzWidth="80px">加油金额</th> |
||||
<th nzWidth="80px">实付金额</th> |
||||
<th nzWidth="100px">支付时间</th> |
||||
<th nzWidth="60px" *ngIf="userId == null">一级佣金</th> |
||||
<th nzWidth="60px" *ngIf="userId == null">二级佣金</th> |
||||
<th nzWidth="60px" *ngIf="userId != null">佣金</th> |
||||
<!-- <th nzRight nzWidth="80px">操作</th>--> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>{{data.orderNo}}</td> |
||||
<td>{{data.merName}}</td> |
||||
<td>{{data.gasOilNo}}#</td> |
||||
<td>{{data.gasGunNo}}</td> |
||||
<td>{{data.gasOilLiters}}L</td> |
||||
<td>¥{{data.gasRefuelPrice}}</td> |
||||
<td>¥{{data.payablePrice}}</td> |
||||
<td>{{data.payTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
<td *ngIf="userId == null">¥{{data.gainsRebateAmount!=null?data.gainsRebateAmount:0}}</td> |
||||
<td *ngIf="userId == null">¥{{data.gainsRebateOneAmount!=null?data.gainsRebateOneAmount:0}}</td> |
||||
<td *ngIf="userId != null">¥ |
||||
<span *ngIf="userId == data.gainsRebateUserId">{{data.gainsRebateAmount}}</span> |
||||
<span *ngIf="userId == data.gainsRebateOneUserId">{{data.gainsRebateOneAmount}}</span> |
||||
</td> |
||||
<!-- <td nzRight> |
||||
<a nz-dropdown [nzDropdownMenu]="menu"> |
||||
操作列表 |
||||
<span nz-icon nzType="down"></span> |
||||
</a> |
||||
<nz-dropdown-menu #menu="nzDropdownMenu"> |
||||
<ul nz-menu nzSelectable> |
||||
<li nz-menu-item ><a >详情</a></li> |
||||
</ul> |
||||
</nz-dropdown-menu> |
||||
</td>--> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
@ -0,0 +1,200 @@ |
||||
import {Component, Input, OnInit} from '@angular/core'; |
||||
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzDatePickerComponent, NzDatePickerModule, NzRangePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzRadioButtonDirective, NzRadioComponent, NzRadioGroupComponent, NzRadioModule} from "ng-zorro-antd/radio"; |
||||
import {NzStatisticComponent, NzStatisticModule} from "ng-zorro-antd/statistic"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, NzTableModule, |
||||
NzTbodyComponent, |
||||
NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule} from "@angular/forms"; |
||||
import {DateSelectType, DateUtils} from "../../../utils/dateUtils.service"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {BrowserStorageService} from "../../../utils/localStorage.service"; |
||||
import {SpreadUserService} from "../../../services/spread/spread-user.service"; |
||||
import {CommonService} from "../../../services/common/common.service"; |
||||
import {NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||
import {NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||
import {NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||
import {WeekPipe} from "../../../pipes/common/week.pipe"; |
||||
|
||||
@Component({ |
||||
selector: 'app-spread-commission', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzInputDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
NzTableModule, |
||||
NzModalModule, |
||||
NzFlexDirective, |
||||
NzDescriptionsModule, |
||||
NzUploadComponent, |
||||
NzAvatarModule, |
||||
NzImageModule, |
||||
NzSwitchComponent, |
||||
NzDatePickerComponent, |
||||
NzInputNumberModule, |
||||
WeekPipe, |
||||
NzStatisticModule, |
||||
NzRadioModule, |
||||
NzDatePickerModule |
||||
], |
||||
templateUrl: './spread-commission.component.html', |
||||
styleUrl: './spread-commission.component.less' |
||||
}) |
||||
export class SpreadCommissionComponent implements OnInit { |
||||
@Input() userId: any; |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 每页数量
|
||||
tablePageSize = 10; |
||||
// 表单数据
|
||||
tableData: any = []; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
// 时间快速选择项
|
||||
dateTypeSelect = DateSelectType; |
||||
countData = 0; |
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private message: NzMessageService, |
||||
private storage: BrowserStorageService, |
||||
private spreadUserService: SpreadUserService, |
||||
private commonService: CommonService, |
||||
private modal: NzModalService) { |
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
userId: [null], |
||||
orderStatus: ['2'], |
||||
payTimeSelect: ['1'], |
||||
payTimeArray: [[]], |
||||
payTimeS: [null], |
||||
payTimeE: [null], |
||||
}); |
||||
// 初始化创建时间
|
||||
this.payTimeInit(); |
||||
|
||||
} |
||||
|
||||
ngOnInit(): void { |
||||
// 查询佣金统计
|
||||
this.countAccount(); |
||||
// 查询数据
|
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 创建时间初始化 |
||||
*/ |
||||
payTimeInit() { |
||||
let createTimeSelect = this.searchForm.controls['payTimeSelect'].value; |
||||
if (createTimeSelect != null) { |
||||
let timeObj = DateUtils.getDate(new Date(), Number(createTimeSelect)); |
||||
this.searchForm.controls['payTimeArray'].setValue([timeObj.timeS, timeObj.timeE]); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 查询佣金统计 |
||||
*/ |
||||
countAccount() { |
||||
if (this.searchForm.controls['payTimeArray'].value != null |
||||
&& this.searchForm.controls['payTimeArray'].value.length > 0) { |
||||
this.searchForm.controls['payTimeS'].setValue(new Date(this.searchForm.controls['payTimeArray'].value[0]).getTime()); |
||||
this.searchForm.controls['payTimeE'].setValue(new Date(this.searchForm.controls['payTimeArray'].value[1]).getTime()); |
||||
} else { |
||||
this.searchForm.controls['payTimeS'].setValue(null); |
||||
this.searchForm.controls['payTimeE'].setValue(null); |
||||
} |
||||
this.searchForm.value.userId = this.userId; |
||||
// 佣金情况
|
||||
this.spreadUserService.countAccount(this.searchForm.value,(data: any) => { |
||||
if (data['return_code'] == '000000'){ |
||||
this.countData = data['return_data']; |
||||
} |
||||
}) |
||||
} |
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
if (this.searchForm.controls['payTimeArray'].value != null |
||||
&& this.searchForm.controls['payTimeArray'].value.length > 0) { |
||||
this.searchForm.controls['payTimeS'].setValue(new Date(this.searchForm.controls['payTimeArray'].value[0]).getTime()); |
||||
this.searchForm.controls['payTimeE'].setValue(new Date(this.searchForm.controls['payTimeArray'].value[1]).getTime()); |
||||
} else { |
||||
this.searchForm.controls['payTimeS'].setValue(null); |
||||
this.searchForm.controls['payTimeE'].setValue(null); |
||||
} |
||||
this.searchForm.value.userId = this.userId; |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = this.tablePageSize; |
||||
this.searchForm.value.time = new Date().getTime(); |
||||
this.spreadUserService.queryOilOrderSpread(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.queryData(); |
||||
this.countAccount(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
} |
@ -0,0 +1,96 @@ |
||||
<nz-row [nzGutter]="6" style="margin-bottom: 15px;"> |
||||
<nz-col [nzSpan]="6"> |
||||
<nz-statistic [nzValue]="'¥'+countData.amount" [nzTitle]="'账户余额'"></nz-statistic> |
||||
</nz-col> |
||||
<nz-col [nzSpan]="6"> |
||||
<nz-statistic [nzValue]="'¥'+countData.cashOutAmount" [nzTitle]="'已提现金额'"></nz-statistic> |
||||
</nz-col> |
||||
<nz-col [nzSpan]="6"> |
||||
<nz-statistic [nzValue]="'¥'+countData.notCashOutAmount" [nzTitle]="'今日收益'"></nz-statistic> |
||||
</nz-col> |
||||
</nz-row> |
||||
<form nz-form [formGroup]="searchForm" class="search_form"> |
||||
<div nz-row [nzGutter]="24"> |
||||
<div nz-col [nzSpan]="16"> |
||||
<nz-form-item> |
||||
<nz-form-label>时间</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-range-picker formControlName="createTimeArray" nzShowTime [nzAllowClear]="false" [nzFormat]="'yyyy/MM/dd HH:mm:ss'"></nz-range-picker> |
||||
<nz-radio-group nzButtonStyle="solid" formControlName="createTimeSelect" (ngModelChange)="payTimeInit()"> |
||||
<label nz-radio-button *ngFor="let item of dateTypeSelect" nzValue="{{item.value}}">{{item.name}}</label> |
||||
</nz-radio-group> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label>记录来源</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="sourceType" [nzPlaceHolder]="'请选择'"> |
||||
<nz-option nzValue="1" nzLabel="佣金结算"></nz-option> |
||||
<nz-option nzValue="2" nzLabel="佣金提现"></nz-option> |
||||
<nz-option nzValue="3" nzLabel="订单退款"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="2"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzNoColon]="true"></nz-form-label> |
||||
<nz-form-control> |
||||
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '1200' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="queryData()" |
||||
nzShowSizeChanger |
||||
(nzPageSizeChange)="this.tablePageSize = $event;queryData()" |
||||
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="60px">类型</th> |
||||
<th nzWidth="60px">记录来源</th> |
||||
<th nzWidth="60px">交易金额</th> |
||||
<th nzWidth="60px">变更前金额</th> |
||||
<th nzWidth="60px">变更后金额</th> |
||||
<th nzWidth="150px">来源内容</th> |
||||
<th nzWidth="100px">创建时间</th> |
||||
<!-- <th nzRight nzWidth="80px">操作</th>--> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>{{data.type | dictionary: 'USER_SPREAD_ACCOUNT_RECORD_TYPE'}}</td> |
||||
<td>{{data.sourceType | dictionary: 'USER_SPREAD_ACCOUNT_RECORD_SOURCE_TYPE'}}</td> |
||||
<td>¥{{data.transactionAmount}}</td> |
||||
<td>¥{{data.beforeAmount}}</td> |
||||
<td>¥{{data.afterAmount}}</td> |
||||
<td>{{data.sourceContent}}</td> |
||||
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
<!-- <td nzRight> |
||||
<a nz-dropdown [nzDropdownMenu]="menu"> |
||||
操作列表 |
||||
<span nz-icon nzType="down"></span> |
||||
</a> |
||||
<nz-dropdown-menu #menu="nzDropdownMenu"> |
||||
<ul nz-menu nzSelectable> |
||||
<li nz-menu-item ><a >详情</a></li> |
||||
</ul> |
||||
</nz-dropdown-menu> |
||||
</td>--> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
@ -0,0 +1,197 @@ |
||||
import {Component, Input, OnInit} from '@angular/core'; |
||||
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, NzTableModule, |
||||
NzTbodyComponent, NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzInputNumberComponent, NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzModalComponent, NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||
import {NzStatisticComponent, NzStatisticModule} from "ng-zorro-antd/statistic"; |
||||
import {SpreadUserStatusPipe} from "../../../pipes/spread/spread-user-status.pipe"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {BrowserStorageService} from "../../../utils/localStorage.service"; |
||||
import {SpreadUserService} from "../../../services/spread/spread-user.service"; |
||||
import {CommonService} from "../../../services/common/common.service"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||
import {NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||
import {NzDatePickerComponent, NzDatePickerModule, NzRangePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {WeekPipe} from "../../../pipes/common/week.pipe"; |
||||
import {DateSelectType, DateUtils} from "../../../utils/dateUtils.service"; |
||||
import {NzRadioButtonDirective, NzRadioComponent, NzRadioGroupComponent, NzRadioModule} from "ng-zorro-antd/radio"; |
||||
|
||||
@Component({ |
||||
selector: 'app-spread-user-account-record', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzInputDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
NzTableModule, |
||||
NzModalModule, |
||||
NzFlexDirective, |
||||
NzDescriptionsModule, |
||||
NzUploadComponent, |
||||
NzAvatarModule, |
||||
NzImageModule, |
||||
NzSwitchComponent, |
||||
NzDatePickerComponent, |
||||
NzInputNumberModule, |
||||
WeekPipe, |
||||
NzStatisticModule, |
||||
NzRadioModule, |
||||
NzDatePickerModule |
||||
], |
||||
templateUrl: './spread-user-account-record.component.html', |
||||
styleUrl: './spread-user-account-record.component.less' |
||||
}) |
||||
export class SpreadUserAccountRecordComponent implements OnInit { |
||||
@Input() userId: any; |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 每页数量
|
||||
tablePageSize = 10; |
||||
// 表单数据
|
||||
tableData: any = []; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
// 时间快速选择项
|
||||
dateTypeSelect = DateSelectType; |
||||
countData: any = { |
||||
amount: 0, |
||||
cashOutAmount: 0, |
||||
notCashOutAmount: 0, |
||||
}; |
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private message: NzMessageService, |
||||
private storage: BrowserStorageService, |
||||
private spreadUserService: SpreadUserService, |
||||
private commonService: CommonService, |
||||
private modal: NzModalService) { |
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
userId: [null], |
||||
sourceType: ['1'], |
||||
createTimeSelect: ['1'], |
||||
createTimeArray: [[]], |
||||
createTimeS: [null], |
||||
createTimeE: [null], |
||||
}); |
||||
// 初始化创建时间
|
||||
this.payTimeInit(); |
||||
|
||||
} |
||||
|
||||
ngOnInit(): void { |
||||
// 查询佣金统计
|
||||
this.countAccount(); |
||||
// 查询数据
|
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 创建时间初始化 |
||||
*/ |
||||
payTimeInit() { |
||||
let createTimeSelect = this.searchForm.controls['createTimeSelect'].value; |
||||
if (createTimeSelect != null) { |
||||
let timeObj = DateUtils.getDate(new Date(), Number(createTimeSelect)); |
||||
this.searchForm.controls['createTimeArray'].setValue([timeObj.timeS, timeObj.timeE]); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 查询佣金统计 |
||||
*/ |
||||
countAccount() { |
||||
this.searchForm.value.userId = this.userId; |
||||
// 佣金情况
|
||||
this.spreadUserService.getAccount(this.searchForm.value,(data: any) => { |
||||
if (data['return_code'] == '000000'){ |
||||
this.countData = data['return_data']; |
||||
} |
||||
}) |
||||
} |
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
if (this.searchForm.controls['createTimeArray'].value != null |
||||
&& this.searchForm.controls['createTimeArray'].value.length > 0) { |
||||
this.searchForm.controls['createTimeS'].setValue(new Date(this.searchForm.controls['createTimeArray'].value[0]).getTime()); |
||||
this.searchForm.controls['createTimeE'].setValue(new Date(this.searchForm.controls['createTimeArray'].value[1]).getTime()); |
||||
} else { |
||||
this.searchForm.controls['createTimeS'].setValue(null); |
||||
this.searchForm.controls['createTimeE'].setValue(null); |
||||
} |
||||
this.searchForm.value.userId = this.userId; |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = this.tablePageSize; |
||||
this.searchForm.value.time = new Date().getTime(); |
||||
this.spreadUserService.getRecordList(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.queryData(); |
||||
this.countAccount(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,140 @@ |
||||
<nz-row [nzGutter]="6" style="margin-bottom: 15px;"> |
||||
<nz-col [nzSpan]="6"> |
||||
<nz-statistic [nzValue]="'¥'+countDataObj.surplusAmount" [nzTitle]="'可提现余额'" [nzSuffix]="suffixTpl"></nz-statistic> |
||||
<ng-template #suffixTpl><a style="font-size: 15px;" (click)="showRechargeModal()">充值</a></ng-template> |
||||
</nz-col> |
||||
<nz-col [nzSpan]="6"> |
||||
<nz-statistic [nzValue]="'¥'+countDataObj.totalAmount" [nzTitle]="'全部佣金'"></nz-statistic> |
||||
</nz-col> |
||||
<nz-col [nzSpan]="6"> |
||||
<nz-statistic [nzValue]="'¥'+countDataObj.sysSperadAmount" [nzTitle]="'佣金总额'"></nz-statistic> |
||||
</nz-col> |
||||
<nz-col [nzSpan]="6"> |
||||
<nz-statistic [nzValue]="'¥'+countDataObj.cashOutAmount" [nzTitle]="'已提现佣金'"></nz-statistic> |
||||
</nz-col> |
||||
</nz-row> |
||||
<form nz-form [formGroup]="searchForm" class="search_form"> |
||||
<div nz-row [nzGutter]="24"> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label nzRequired>用户手机号</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="phone" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzNoColon]="true"></nz-form-label> |
||||
<nz-form-control> |
||||
<button nz-button style="margin-right: 8px" [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '1200' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="queryData()" |
||||
nzShowSizeChanger |
||||
(nzPageSizeChange)="this.tablePageSize = $event;queryData()" |
||||
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="80px">用户手机号</th> |
||||
<th nzWidth="80px">用户名</th> |
||||
<th nzWidth="80px">佣金余额</th> |
||||
<th nzWidth="80px">已提现</th> |
||||
<th nzWidth="80px">推广人数</th> |
||||
<th nzWidth="60px">状态</th> |
||||
<th nzWidth="100px">成为时间</th> |
||||
<th nzRight nzWidth="80px">操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>{{data.phone}}</td> |
||||
<td>{{data.userName}}</td> |
||||
<td>¥{{data.amount}}</td> |
||||
<td>¥{{data.cashOutAmount}}</td> |
||||
<td>{{data.spreadCount}}</td> |
||||
<td>{{data.status | spreadUserStatus}}</td> |
||||
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
<td nzRight> |
||||
<a nz-dropdown [nzDropdownMenu]="menu"> |
||||
操作列表 |
||||
<span nz-icon nzType="down"></span> |
||||
</a> |
||||
<nz-dropdown-menu #menu="nzDropdownMenu"> |
||||
<ul nz-menu nzSelectable> |
||||
<li nz-menu-item ><a (click)="freezeUserSpread(data.userId)" >冻结账户</a></li> |
||||
<li nz-menu-item ><a (click)="unfreezeUserSpread(data.userId)" >恢复账户</a></li> |
||||
<li nz-menu-item ><a (click)="showSettle(data.userId)">结算明细</a></li> |
||||
<li nz-menu-item ><a (click)="showCommission(data.userId)">佣金明细</a></li> |
||||
</ul> |
||||
</nz-dropdown-menu> |
||||
</td> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
||||
|
||||
<nz-modal [(nzVisible)]="rechargeModal" |
||||
[nzWidth]="500" |
||||
nzTitle="充值佣金" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="closeRechargeModal()"> |
||||
<ng-container *nzModalContent> |
||||
<form nz-form [formGroup]="rechargeForm"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>金额</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-input-number formControlName="amount" [nzMin]="1" [nzMax]="9999" [nzStep]="1" [nzPrecision]="2" [nzPlaceHolder]="'充值佣金金额'"></nz-input-number> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
<div nz-flex style="margin-top: 15px" [nzJustify]="'center'"> |
||||
<button nz-button nzType="primary" (click)="submitRechargeModal()" class="submit-btn">充值</button> |
||||
</div> |
||||
</form> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
|
||||
<nz-modal [(nzVisible)]="commissionModal" |
||||
[nzWidth]="1300" |
||||
nzTitle="佣金明细" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="commissionModal = false"> |
||||
<ng-container *nzModalContent> |
||||
<app-spread-commission [userId]="userId"></app-spread-commission> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
<nz-modal [(nzVisible)]="commissionModal" |
||||
[nzWidth]="1300" |
||||
nzTitle="结算明细" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="commissionModal = false"> |
||||
<ng-container *nzModalContent> |
||||
<app-spread-user-account-record [userId]="userId"></app-spread-user-account-record> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
|
||||
<nz-modal [(nzVisible)]="settleModal" |
||||
[nzWidth]="1300" |
||||
nzTitle="结算明细" |
||||
[nzFooter]="null" |
||||
(nzOnCancel)="settleModal = false"> |
||||
<ng-container *nzModalContent> |
||||
<app-spread-user-account-record [userId]="userId"></app-spread-user-account-record> |
||||
</ng-container> |
||||
</nz-modal> |
@ -0,0 +1,3 @@ |
||||
nz-input-number { |
||||
width: 100%; |
||||
} |
@ -0,0 +1,276 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {BrowserStorageService} from "../../../utils/localStorage.service" |
||||
import {CommonService} from "../../../services/common/common.service"; |
||||
import {NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, NzTableModule, |
||||
NzTbodyComponent, NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||
import {NzAvatarModule} from "ng-zorro-antd/avatar"; |
||||
import {NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzSwitchComponent} from "ng-zorro-antd/switch"; |
||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {NzInputNumberModule} from "ng-zorro-antd/input-number"; |
||||
import {WeekPipe} from "../../../pipes/common/week.pipe"; |
||||
import {SpreadUserService} from "../../../services/spread/spread-user.service"; |
||||
import {SpreadUserStatusPipe} from "../../../pipes/spread/spread-user-status.pipe"; |
||||
import {NzStatisticModule} from "ng-zorro-antd/statistic"; |
||||
import {SpreadUserAccountRecordComponent} from "../spread-user-account-record/spread-user-account-record.component"; |
||||
import {SpreadCommissionComponent} from "../spread-commission/spread-commission.component"; |
||||
|
||||
@Component({ |
||||
selector: 'app-spread-user-list', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzInputDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
NzTableModule, |
||||
NzModalModule, |
||||
NzFlexDirective, |
||||
NzDescriptionsModule, |
||||
NzUploadComponent, |
||||
NzAvatarModule, |
||||
NzImageModule, |
||||
NzSwitchComponent, |
||||
NzDatePickerComponent, |
||||
NzInputNumberModule, |
||||
WeekPipe, |
||||
SpreadUserStatusPipe, |
||||
NzStatisticModule, |
||||
SpreadCommissionComponent, |
||||
SpreadUserAccountRecordComponent, |
||||
], |
||||
templateUrl: './spread-user-list.component.html', |
||||
styleUrl: './spread-user-list.component.less' |
||||
}) |
||||
export class SpreadUserListComponent { |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 每页数量
|
||||
tablePageSize = 10; |
||||
// 表单数据
|
||||
tableData: any = []; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
|
||||
countDataObj: any = { |
||||
totalAmount: 0, |
||||
sysSperadAmount: 0, |
||||
cashOutAmount: 0, |
||||
surplusAmount: 0, |
||||
}; |
||||
|
||||
rechargeModal = false; |
||||
rechargeForm: FormGroup; |
||||
|
||||
commissionModal = false; |
||||
userId = null; |
||||
|
||||
settleModal = false; |
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private message: NzMessageService, |
||||
private storage: BrowserStorageService, |
||||
private spreadUserService: SpreadUserService, |
||||
private commonService: CommonService, |
||||
private modal: NzModalService) { |
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
phone: [null], |
||||
}); |
||||
this.rechargeForm = this.fb.group({ |
||||
amount: ['',[Validators.required]], |
||||
}); |
||||
|
||||
this.queryCountCommission(); |
||||
// 查询数据
|
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 查询佣金统计 |
||||
*/ |
||||
queryCountCommission() { |
||||
// 佣金情况
|
||||
this.spreadUserService.countCommission((data: any) => { |
||||
if (data['return_code'] == '000000'){ |
||||
this.countDataObj = data['return_data']; |
||||
} |
||||
}) |
||||
} |
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = this.tablePageSize; |
||||
this.searchForm.value.time = new Date().getTime(); |
||||
this.spreadUserService.getUserSpreadList(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
/** |
||||
* 展示模态框 |
||||
*/ |
||||
showRechargeModal() { |
||||
this.rechargeModal = true; |
||||
} |
||||
|
||||
/** |
||||
* 提交模态框 |
||||
*/ |
||||
submitRechargeModal() { |
||||
if (this.rechargeForm.valid) { |
||||
this.spreadUserService.recharge(this.rechargeForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
// 刷新数据
|
||||
this.queryCountCommission(); |
||||
// 关闭弹窗
|
||||
this.closeRechargeModal(); |
||||
// 表单重置
|
||||
this.rechargeForm.reset(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} else { |
||||
Object.values(this.rechargeForm.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 关闭模态框 |
||||
*/ |
||||
closeRechargeModal() { |
||||
this.rechargeModal = false; |
||||
} |
||||
|
||||
/** |
||||
* 冻结账户 |
||||
* @param id |
||||
*/ |
||||
freezeUserSpread(id: number) { |
||||
this.modal.confirm({ |
||||
nzTitle: '提示', |
||||
nzContent: '确定冻结用户推广账户吗?', |
||||
nzOnOk: () => |
||||
this.spreadUserService.freezeUserSpread({userId: id}, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
// 刷新数据
|
||||
this.queryData(); |
||||
this.message.create('success', '操作成功'); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}) |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 恢复账户 |
||||
* @param id |
||||
*/ |
||||
unfreezeUserSpread(id: number) { |
||||
this.modal.confirm({ |
||||
nzTitle: '提示', |
||||
nzContent: '确定恢复用户推广账户状态吗?', |
||||
nzOnOk: () => |
||||
this.spreadUserService.unfreezeUserSpread({userId: id}, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
// 刷新数据
|
||||
this.queryData(); |
||||
this.message.create('success', '操作成功'); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}) |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 打开佣金明细 |
||||
* @param userId |
||||
*/ |
||||
showCommission(userId: any) { |
||||
this.userId = userId; |
||||
this.commissionModal = true; |
||||
} |
||||
|
||||
/** |
||||
* 打款结算明细 |
||||
* @param userId |
||||
*/ |
||||
showSettle(userId: any) { |
||||
this.userId = userId; |
||||
this.settleModal = true; |
||||
} |
||||
} |
@ -0,0 +1,12 @@ |
||||
import { NgModule } from '@angular/core'; |
||||
import { CommonModule } from '@angular/common'; |
||||
|
||||
|
||||
|
||||
@NgModule({ |
||||
declarations: [], |
||||
imports: [ |
||||
CommonModule |
||||
] |
||||
}) |
||||
export class SpreadModule { } |
@ -0,0 +1,12 @@ |
||||
import { Routes } from '@angular/router'; |
||||
import {SpreadUserListComponent} from "./spread-user-list/spread-user-list.component"; |
||||
import {SpreadChannelConfigComponent} from "./spread-channel-config/spread-channel-config.component"; |
||||
import {SpreadUserAccountRecordComponent} from "./spread-user-account-record/spread-user-account-record.component"; |
||||
import {SpreadCommissionComponent} from "./spread-commission/spread-commission.component"; |
||||
|
||||
|
||||
export const SPREAD_ROUTES: Routes = [ |
||||
{ path : 'user-list', component: SpreadUserListComponent }, |
||||
{ path : 'user-commission', component: SpreadCommissionComponent }, |
||||
{ path : 'channel-config', component: SpreadChannelConfigComponent }, |
||||
]; |
@ -0,0 +1,20 @@ |
||||
import { Pipe, PipeTransform } from '@angular/core'; |
||||
|
||||
@Pipe({ |
||||
name: 'spreadUserStatus', |
||||
standalone: true |
||||
}) |
||||
export class SpreadUserStatusPipe implements PipeTransform { |
||||
|
||||
transform(value: number): any { |
||||
switch (value) { |
||||
case 1: |
||||
return '正常'; |
||||
case 2: |
||||
return '冻结'; |
||||
default: |
||||
return '未知状态' |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,35 @@ |
||||
import { Injectable } from '@angular/core'; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {environment} from "../../../environments/environment"; |
||||
import {ObjectData} from "../../utils/objectData.service"; |
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class SpreadOilChannelService { |
||||
|
||||
constructor(private http: HttpClient) { } |
||||
|
||||
/** |
||||
* 编辑 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public editOilChannel(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'userSpread/editOilChannel', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getOilChannelList(params: any, callBack:any) { |
||||
this.http.get(environment.baseUrl + 'userSpread/getOilChannelList?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,118 @@ |
||||
import { Injectable } from '@angular/core'; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
import {environment} from "../../../environments/environment"; |
||||
import {ObjectData} from "../../utils/objectData.service"; |
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class SpreadUserService { |
||||
|
||||
constructor(private http: HttpClient) { } |
||||
|
||||
/** |
||||
* 冻结用户推广功能 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public freezeUserSpread(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'userSpread/freezeUserSpread', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 解冻用户推广功能 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public unfreezeUserSpread(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'userSpread/unfreezeUserSpread', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 充值佣金 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public recharge(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'userSpread/recharge', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 推广用户列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getUserSpreadList(params: any, callBack:any) { |
||||
this.http.get(environment.baseUrl + 'userSpread/getUserSpreadList?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 用户账户记录列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getRecordList(params: any, callBack:any) { |
||||
this.http.get(environment.baseUrl + 'userSpread/getRecordList?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
/** |
||||
* 查询推广订单 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public queryOilOrderSpread(params: any, callBack:any) { |
||||
this.http.get(environment.baseUrl + 'userSpread/queryOilOrderSpread?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 统计用户账户记录佣金 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public countAccount(params: any, callBack:any) { |
||||
params.t = new Date().getTime() |
||||
this.http.get(environment.baseUrl + 'userSpread/countAccount?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 用户账户详情 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getAccount(params: any, callBack:any) { |
||||
params.t = new Date().getTime() |
||||
this.http.get(environment.baseUrl + 'userSpread/getAccount?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 统计佣金情况 |
||||
* @param callBack |
||||
*/ |
||||
public countCommission(callBack:any) { |
||||
const params = { |
||||
t: new Date().getTime() |
||||
}; |
||||
this.http.get(environment.baseUrl + 'userSpread/countCommission?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
} |
Loading…
Reference in new issue