This commit is contained in:
wangshiming
2022-03-29 11:10:12 +08:00
parent 4439f94956
commit ed90f4090a
14 changed files with 159 additions and 92 deletions

View File

@ -1,41 +1,49 @@
import { debounceTime } from 'rxjs/operators';
import { Subject } from 'rxjs';
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core';
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnInit, Output, ViewChild } from '@angular/core';
import { BaseService } from '@shared';
import { SFComponent, SFSchema, SFUISchema } from '@delon/form';
import { EventEmitter} from '@angular/core'
@Component({
selector: 'app-rebate-table',
templateUrl: './rebate-table.component.html',
styleUrls: ['./rebate-table.component.less']
})
export class RebateTableComponent implements OnInit {
data: any[] = [
{
gradeConfigId: '',
startAmount: 0,
endAmount: 0,
managementFeeRatio: 0,
}
];
@Input() data: any =[];
@Output()
private dataChange: EventEmitter<any> = new EventEmitter();
emit() {
this.dataChange.emit(this.data)
}
headers: any[] = [];
gradeConfigId: string ='';
grage: any[] = [];
formatterDollar = (value: number): string => `${value}`;
changeSub = new Subject<string>();
constructor(public service: BaseService, private cdr: ChangeDetectorRef) {}
ngOnInit(): void {
this.data = [
{
gradeConfigId: '',
startAmount: 0,
endAmount: 0,
managementFeeRatio: 0,
}
];
this.loadData();
this.changeendAmountAction();
}
loadData() {
// this.service.request('/api/mdc/cuc/insuranceConfig/list').subscribe(res => {
// if (res) {
// console.log(res);
// this.data = res;
// this.cdr.detectChanges();
// }
// });
this.service.request('/api/mdc/partnerGradeConfig/listPartnerGradeConfig').subscribe(res => {
if (res) {
console.log(res);
this.grage = res;
this.cdr.detectChanges();
}
});
// this.service.request('/api/mdc/pbc/sysConfigItem/findItemValueByItemKeys', [
// "rebate.config.minrebatePrice"
// ]).subscribe(res => {
@ -66,12 +74,13 @@ export class RebateTableComponent implements OnInit {
const num = Number(paras[0]);
const i = Number(paras[1]);
if (num <= this.data[i].startAmount) {
if (num <= this.data[i]?.startAmount) {
console.log(this.data[i].endAmount);
this.data[i].endAmount = null;
setTimeout(() => {
this.data[i].endAmount = this.data[i].startAmount + 1 ;
this.data[i].endAmount = this.data[i]?.startAmount + 1 ;
}, 0);
this.changeNextstartAmount(this.data[i].startAmount + 1, i + 1);
this.changeNextstartAmount(this.data[i]?.startAmount + 1, i + 1);
return;
}
this.data[i].endAmount = num;