This commit is contained in:
wangshiming
2022-04-26 16:52:20 +08:00
parent c7f22dbde0
commit c9afdb19d4
2 changed files with 36 additions and 25 deletions

View File

@ -4,7 +4,7 @@
* @Author : Shiming
* @Date : 2022-02-24 20:09:49
* @LastEditors : Shiming
* @LastEditTime : 2022-04-26 16:04:31
* @LastEditTime : 2022-04-26 16:51:07
* @FilePath : \\tms-obc-web\\src\\app\\routes\\partner\\rebate-management\\components\\rebate-setting\\add\\add.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved.
-->
@ -38,10 +38,10 @@
<sv col="1">
<div style="width: 850px" *ngIf="configType == '1'">
<app-rebate-table #table [(data)]="tabelData" [type]="1"></app-rebate-table>
<app-rebate-table #table [(data)]="tabelData" [type]="1" [hiden]="hiden"></app-rebate-table>
</div>
<div style="width: 850px" *ngIf="configType == '2'">
<app-rebate-table #table [(data)]="tabelData" [type]="2"></app-rebate-table>
<app-rebate-table #table [(data)]="tabelData" [type]="2" [hiden]="hiden"></app-rebate-table>
</div>
</sv>

View File

@ -3,35 +3,55 @@ import { Subject } from 'rxjs';
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'
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 {
@Input() data: any =[];
@Input() data: any = [];
@Input() type: any;
@Input() hiden!: boolean;
@Output()
private dataChange: EventEmitter<any> = new EventEmitter();
emit() {
this.dataChange.emit(this.data)
this.dataChange.emit(this.data);
}
headers: any[] = [];
gradeConfigId: string ='';
gradeConfigId: string = '';
grage: any[] = [];
formatterDollar = (value: number): string => `${value}`;
changeSub = new Subject<string>();
constructor(public service: BaseService, private cdr: ChangeDetectorRef) {}
ngOnInit(): void {
if(this.type == '2') {
this.loadData();
if (this.type == '2') {
this.loadData();
}
if (!this.hiden && this.type == '2') {
this.data = [
{
gradeConfigId: '',
startAmount: 0,
endAmount: 0,
managementFeeRatio: 0,
}
];
} else if (!this.hiden && this.type == '1'){
this.data = [
{
gradeConfigId: 0,
startAmount: 0,
endAmount: 0,
managementFeeRatio: 0,
}
];
}
console.log(this.type);
console.log(this.data);
this.changeendAmountAction();
}
@ -39,21 +59,12 @@ export class RebateTableComponent implements OnInit {
this.service.request('/api/mdc/partnerGradeConfig/listPartnerGradeConfig').subscribe(res => {
if (res) {
console.log(res);
this.grage = res;
this.grage = res;
this.cdr.detectChanges();
}
});
// this.service.request('/api/mdc/pbc/sysConfigItem/findItemValueByItemKeys', [
// "rebate.config.minrebatePrice"
// ]).subscribe(res => {
// if (res) {
// console.log(res);
// }
// });
}
/**
* 修改结束公里数
* @param event 车长
@ -70,7 +81,7 @@ export class RebateTableComponent implements OnInit {
this.changeSub.pipe(debounceTime(500)).subscribe((res: string) => {
if (res) {
console.log(res);
const paras = res.split(',');
const num = Number(paras[0]);
const i = Number(paras[1]);
@ -79,7 +90,7 @@ export class RebateTableComponent implements OnInit {
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);
return;
@ -99,7 +110,7 @@ export class RebateTableComponent implements OnInit {
gradeConfigId: '',
startAmount: 0,
endAmount: 0,
managementFeeRatio: 0,
managementFeeRatio: 0
});
this.data = [...this.data];
}
@ -108,7 +119,7 @@ export class RebateTableComponent implements OnInit {
deleteRow(index: number) {
console.log(index);
var newArr = this.data.concat();
newArr.splice(this.data.length-1,1)
newArr.splice(this.data.length - 1, 1);
// this.data = this.data.pop()
console.log(newArr);
this.data = [...newArr];