This commit is contained in:
wangshiming
2022-03-28 20:29:22 +08:00
parent cb50d0c36b
commit ac7eb6e3db
9 changed files with 191 additions and 240 deletions

View File

@ -1,38 +1,30 @@
<!--
* @Description :
* @Version : 1.0
* @Author : Shiming
* @Date : 2022-03-28 14:53:52
* @LastEditors : Shiming
* @LastEditTime : 2022-03-28 17:03:21
* @FilePath : \\tms-obc-web\\src\\app\\routes\\partner\\rebate-management\\components\\rebate-setting\\add-partnerlist\\add-partnerlist.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved.
-->
<nz-card> <nz-card>
<div nz-row nzGutter="8"> <div nz-row nzGutter="8">
<!-- 查询字段小于或等于3个时不显示伸缩按钮 --> <!-- 查询字段小于或等于3个时不显示伸缩按钮 -->
<div nz-col nzSpan="24" *ngIf="queryFieldCount <= 4"> <div nz-col nzSpan="24" >
<sf #sf [schema]="schema" [ui]="ui" [mode]="'search'" [disabled]="!sf?.valid" [loading]="false" <sf #sf [schema]="schema" [ui]="ui" [mode]="'search'" [disabled]="!sf?.valid" [loading]="false"
(formSubmit)="search()" (formReset)="resetSF()"></sf> (formSubmit)="search()" (formReset)="resetSF()"></sf>
</div> </div>
<!-- 查询字段大于3个时根据展开状态调整布局 -->
<ng-container *ngIf="queryFieldCount > 4">
<div nz-col [nzSpan]="_$expand ? 24 : 18">
<sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
</div>
<div nz-col [nzSpan]="_$expand ? 24 : 6" [class.text-right]="_$expand">
<button nz-button nzType="primary" [disabled]="!sf.valid" [nzLoading]="false" (click)="search()" acl
[acl-ability]="['AbnormalAppear-serach']">查询</button>
<button nz-button (click)="resetSF()" acl [acl-ability]="['AbnormalAppear-reset']">重置</button>
<button nz-button nzType="link" (click)="expandToggle()">
{{ !_$expand ? '展开' : '收起' }}
<i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
</button>
</div>
</ng-container>
</div> </div>
</nz-card> </nz-card>
<nz-card class="content-box"> <nz-card class="content-box">
<st #st [data]="service.$api_get_rebateConfig" [columns]="columns" <st #st [data]="service.$api_get_partner_page " [columns]="columns"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }" [req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' }, params: reqParams }"
[res]="{ reName: { list: 'data.records', total: 'data.total' } }" [res]="{ reName: { list: 'data.records', total: 'data.total' } }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }" [loading]="false" [page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }" [loading]="false"
[scroll]="{ x: '2000px' }"> [scroll]="{ x: '1000' }">
</st> </st>
<ng-template #extraTemplate>
<button *ngIf="selectedIndex===0" (click)="batchReply()" nz-button nzType="primary" acl <button *ngIf="selectedIndex===0" (click)="batchReply()" nz-button nzType="primary" acl
[acl-ability]="['AbnormalAppear-batchReply']">批量回复</button> [acl-ability]="['AbnormalAppear-batchReply']">批量回复</button>
</ng-template>
</nz-card> </nz-card>

View File

@ -2,7 +2,7 @@ import { Component, OnInit, ViewChild, Type } from '@angular/core';
import { STComponent, STColumn, STChange } from '@delon/abc/st'; import { STComponent, STColumn, STChange } from '@delon/abc/st';
import { SFComponent, SFDateWidgetSchema, SFRadioWidgetSchema, SFSchema, SFSchemaEnum, SFSelectWidgetSchema, SFUISchema } from '@delon/form'; import { SFComponent, SFDateWidgetSchema, SFRadioWidgetSchema, SFSchema, SFSchemaEnum, SFSelectWidgetSchema, SFUISchema } from '@delon/form';
import { ShipperBaseService } from '@shared'; import { ShipperBaseService } from '@shared';
import { NzModalService } from 'ng-zorro-antd/modal'; import { NzModalService, NzModalRef } from 'ng-zorro-antd/modal';
import { of } from 'rxjs'; import { of } from 'rxjs';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
import { RebateManagementService } from '../../../services/rebate-management.service'; import { RebateManagementService } from '../../../services/rebate-management.service';
@ -32,45 +32,30 @@ export class ParterRebateManageMentAddPartnerListComponent implements OnInit {
columns: STColumn[] = [ columns: STColumn[] = [
{ title: '', type: 'checkbox', width: '50px', className: 'text-center' }, { title: '', type: 'checkbox', width: '50px', className: 'text-center' },
{ title: '异常编号', index: 'exceptionCode', width: '140px', className: 'text-left', },
{ title: '订单号', index: 'billCode', width: '160px', className: 'text-left', },
{ title: '装货地', index: 'loadingAddressArr', width: '220px', className: 'text-left', },
{ title: '卸货地', index: 'unloadingAddressArr', width: '220px', className: 'text-left', },
{ title: '承运司机', index: 'driver', width: '180px', className: 'text-left', },
{ title: '异常信息', index: 'exceptionContent', width: '100px', className: 'text-left', },
{ title: '异常图片', render: 'exceptionCertificateFirstFilePath', width: '150px', className: 'text-left', },
{ title: '上报时间', index: 'createTime', width: '140px', className: 'text-left', },
{ {
title: '操作', index: 'createTime', width: '90px', className: 'text-left', title: '合伙人名称',
index: 'enterpriseName',
width: 180,
format: item => (item.partnerType ? `${item.enterpriseName || item.contactName}` : '')
},
{ title: '联系人', index: 'contactName', width: 150, format: item => (item.partnerType ? `${item.contactName}` : '') },
{ title: '手机号', index: 'contactMobile', className: 'text-center', width: 150 },
{ title: '类型', index: 'partnerType', className: 'text-center', width: 130, type: 'enum', enum: { 1: '企业', 2: '个人' } },
{
title: '操作', width: '90px', fixed: 'right',
buttons: [ buttons: [
{ {
text: '回复', text: '添加',
click: _record => this.reply(_record), click: _record => this.add(_record),
acl: { ability: ['AbnormalAppear-reply'] } acl: { ability: ['AbnormalAppear-reply'] }
}, },
] ]
}, },
]; ];
columns2: STColumn[] = [
{ title: '异常编号', index: 'exceptionCode', width: '140px', className: 'text-left' },
{ title: '订单号', index: 'billCode', width: '160px', className: 'text-left' },
{ title: '装货地', index: 'loadingAddressArr', width: '220px', className: 'text-left' },
{ title: '卸货地', index: 'unloadingAddressArr', width: '220px', className: 'text-left' },
{ title: '承运司机', index: 'driver', width: '180px', className: 'text-left' },
{ title: '异常信息', index: 'exceptionContent', width: '100px', className: 'text-left' },
{ title: '异常图片', render: 'exceptionCertificateFirstFilePath', width: '150px', className: 'text-left' },
{ title: '上报时间', index: 'createTime', width: '140px', className: 'text-left' },
{ title: '回复内容', index: 'replyContent', width: '150px', className: 'text-left' },
{ title: '回复人', index: 'replyAppUserName', width: '90px', className: 'text-left' },
{ title: '回复时间', index: 'replyTime', width: '140px', className: 'text-left' },
];
get reqParams() { get reqParams() {
let params: any = { ...this.sf?.value }; // signStatus固定传20 代表签约完成
if (params.reportingTime) { let params: any = { ...this.sf?.value,signStatus: 20 };
const reportingTime = { start: this.sf?.value?.reportingTime?.[0], end: this.sf?.value?.reportingTime?.[1] }
params.reportingTime = reportingTime;
}
return params; return params;
} }
@ -80,93 +65,46 @@ export class ParterRebateManageMentAddPartnerListComponent implements OnInit {
constructor( constructor(
public service: RebateManagementService, public service: RebateManagementService,
private nzModalService: NzModalService,
public shipperSrv: ShipperBaseService, public shipperSrv: ShipperBaseService,
private modal: NzModalService, private modal: NzModalService,
private modals: NzModalRef,
) { } ) { }
ngOnInit(): void { ngOnInit(): void {
this.initSF() this.initSF()
} }
/**
* 伸缩查询条件
*/
expandToggle(): void {
this._$expand = !this._$expand;
this.sf?.setValue('/_$expand', this._$expand);
}
/**
* 查询字段个数
*/
get queryFieldCount(): number {
return Object.keys(this.schema?.properties || {}).length;
}
initSF() { initSF() {
this.schema = { this.schema = {
properties: { properties: {
_$expand: { type: 'boolean', ui: { hidden: true } }, enterpriseName: {
exceptionCode: {
type: 'string', type: 'string',
title: '异常编号', title: '合伙人名称'
ui: { placeholder: '请输入' }
}, },
billCode: { partnerType: {
type: 'string',
title: '订单号',
ui: {
placeholder: '最多100个订单空号隔开',
}
},
exceptionType: {
title: '异常类型',
type: 'string',
ui: {
widget: 'dict-select',
containsAllLabel: true,
params: { dictKey: 'exception:report:type' },
} as SFSelectWidgetSchema
},
driverName: {
title: '承运司机',
type: 'string', type: 'string',
title: '类型',
enum: [
{ value: '', label: '全部' },
{ value: 1, label: '企业' },
{ value: 2, label: '个人' }
],
ui: { ui: {
widget: 'select',
placeholder: '请选择',
visibleIf: { visibleIf: {
_$expand: (value: boolean) => value expand: (value: boolean) => value
} }
} },
default: ''
}, },
carNo: {
title: '车牌号',
type: 'string',
ui: {
visibleIf: {
_$expand: (value: boolean) => value
}
}
},
reportingTime: {
title: '上报时间',
type: 'string',
ui: {
widget: 'date',
mode: 'range',
format: 'yyyy-MM-dd',
visibleIf: {
_$expand: (value: boolean) => value
}
} as SFDateWidgetSchema
} }
} }
};
this.ui = { '*': { spanLabelFixed: 110, grid: { span: 8, gutter: 4 } } }; this.ui = { '*': { spanLabelFixed: 110, grid: { span: 8, gutter: 4 } } };
} }
search() { search() {
if (this.selectedIndex === 0) {
this.st?.load(1) this.st?.load(1)
}
} }
selectedIndexChange(event: any) { selectedIndexChange(event: any) {
@ -181,22 +119,10 @@ export class ParterRebateManageMentAddPartnerListComponent implements OnInit {
this.sf.reset(); this.sf.reset();
} }
// 回复操作 // 回复操作
reply(item: any) { add(item: any) {
// const modalRef = this.modal.create({ console.log(item);
// nzTitle: '回复', this.modals.destroy(item)
// nzWidth: 700,
// nzContent: AbnormalReplyComponent,
// nzComponentParams: {
// i: item
// },
// nzFooter: null
// });
// modalRef.afterClose.subscribe((res) => {
// if (res) {
// this.resetSF;
// this.st.load();
// }
// });
} }
// 批量回复操作 // 批量回复操作
batchReply() { batchReply() {
@ -204,17 +130,6 @@ export class ParterRebateManageMentAddPartnerListComponent implements OnInit {
// this.service.msgSrv.warning('请勾选数据!') // this.service.msgSrv.warning('请勾选数据!')
// return; // return;
// } // }
// const modalRef = this.modal.create({ this.modals.destroy(this.selectedRows)
// nzTitle: '批量回复',
// nzContent: AbnormalreplyBatchComponent,
// nzComponentParams: {
// selectedRows: this.selectedRows
// },
// nzFooter: null
// });
// modalRef.afterClose.subscribe(() => {
// this.resetSF;
// this.st.load();
// });
} }
} }

View File

@ -4,7 +4,7 @@
* @Author : Shiming * @Author : Shiming
* @Date : 2022-02-24 20:09:49 * @Date : 2022-02-24 20:09:49
* @LastEditors : Shiming * @LastEditors : Shiming
* @LastEditTime : 2022-03-28 15:39:27 * @LastEditTime : 2022-03-28 19:46:23
* @FilePath : \\tms-obc-web\\src\\app\\routes\\partner\\rebate-management\\components\\rebate-setting\\add\\add.component.html * @FilePath : \\tms-obc-web\\src\\app\\routes\\partner\\rebate-management\\components\\rebate-setting\\add\\add.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved. * Copyright (C) 2022 huzhenhong. All rights reserved.
--> -->
@ -14,26 +14,34 @@
<!-- 数据列表 --> <!-- 数据列表 -->
<sv-container col="1"> <sv-container col="1">
&nbsp;&nbsp;<sv label="配置名称"> <input style="max-width: 400px;" nz-input placeholder="请输入" [(ngModel)]="setValue" /></sv> &nbsp;&nbsp;<sv label="配置名称"> <input style="max-width: 400px;" nz-input placeholder="请输入" [(ngModel)]="configName" /></sv>
<sv-title>固定结算费率配置</sv-title> <sv-title>固定结算费率配置</sv-title>
&nbsp;&nbsp;<sv label="固定结算费率"> <nz-input-number [(ngModel)]="toFixedValue" [nzPrecision]="precision" nzPlaceHolder="请输入"></nz-input-number>&nbsp;%</sv> &nbsp;&nbsp;<sv label="固定结算费率"> <nz-input-number [(ngModel)]="accountingRate" [nzPrecision]="precision" nzPlaceHolder="请输入"></nz-input-number>&nbsp;%</sv>
<sv-title>业务量和管理费比例配置</sv-title> <sv-title>业务量和管理费比例配置</sv-title>
&nbsp;&nbsp;<sv label="选择配置类型"> &nbsp;&nbsp;<sv label="选择配置类型">
<nz-radio-group [(ngModel)]="radioValue"> <nz-radio-group [(ngModel)]="configType">
<label nz-radio nzValue="A">按全部等级配置</label> <label nz-radio nzValue="1">按全部等级配置</label>
<label nz-radio nzValue="B">按不同等级配置</label> <label nz-radio nzValue="2">按不同等级配置</label>
</nz-radio-group> </nz-radio-group>
</sv> </sv>
<sv col="1"> <sv col="1">
&nbsp;&nbsp;<app-rebate-table></app-rebate-table> &nbsp;&nbsp;
<app-rebate-table ></app-rebate-table>
</sv> </sv>
<sv-title>关联合伙人配置</sv-title> <sv-title>关联合伙人配置</sv-title>
&nbsp;&nbsp;<sv label="合伙人选择"> &nbsp;&nbsp;<sv label="合伙人选择">
<nz-select ngModel="lucy" style="max-width: 400px; min-width: 200px;"> <!-- <nz-select ngModel="lucy" style="max-width: 400px; min-width: 200px;">
<nz-option nzValue="jack" nzLabel="Jack"></nz-option> <nz-option nzValue="jack" nzLabel="Jack"></nz-option>
<nz-option nzValue="lucy" nzLabel="Lucy"></nz-option> <nz-option nzValue="lucy" nzLabel="Lucy"></nz-option>
</nz-select> </nz-select> -->
&nbsp;&nbsp;<span (click)="add()">添加</span> <input *ngIf="peopleStatus" nz-input disabled style=" max-width: 200px;" placeholder="请添加" [(ngModel)]="partnerPeople" />
&nbsp;&nbsp;<span style="color: #0000FF;" (click)="add()">添加</span>
<st *ngIf="!peopleStatus" #st [data]="partnerPeopleList" [columns]="columns"
[req]="{ method: 'POST', allInBody: true, reName: { pi: 'pageIndex', ps: 'pageSize' } }"
[res]="{ reName: { list: 'data.records', total: 'data.total' } }"
[page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100] }" [loading]="false"
[scroll]="{ x: '1000' }">
</st>
</sv> </sv>
&nbsp;&nbsp;<sv label="优先级" col="1"> &nbsp;&nbsp;<sv label="优先级" col="1">
<nz-select ngModel="lucy" style="max-width: 400px; min-width: 200px;"> <nz-select ngModel="lucy" style="max-width: 400px; min-width: 200px;">
@ -49,17 +57,11 @@
<textarea style="max-width: 400px; min-width: 200px;" rows="4" nz-input [(ngModel)]="inputValue"></textarea> <textarea style="max-width: 400px; min-width: 200px;" rows="4" nz-input [(ngModel)]="inputValue"></textarea>
</sv> </sv>
</sv-container> </sv-container>
<div> <div class="align-center" style="margin-top: 15px;">
<button>返回</button> <button nz-button nzType="primary" (click)="goBack()">取消</button>
<button>提交</button> <button nz-button nzType="primary" style="margin-left: 48px" (click)="submit()"
</div> acl [acl-ability]="['SUPPLY-VEHICLE-AMEND-submitChange']">提交</button
>
</div>
</div> </div>
</nz-card> </nz-card>
<nz-card>
<div class="align-center">
<button nz-button nzType="primary" (click)="goBack()">取消</button>
<button nz-button nzType="primary" style="margin-left: 48px" (click)="submit()"
acl [acl-ability]="['SUPPLY-VEHICLE-AMEND-submitChange']">提交</button
>
</div>
</nz-card>

View File

@ -7,4 +7,10 @@
font-weight: 700; font-weight: 700;
} }
} }
.align-center {
display: flex;
align-items: center;
justify-content: center;
}
} }

View File

@ -4,7 +4,7 @@
* @Author : Shiming * @Author : Shiming
* @Date : 2022-03-21 09:26:45 * @Date : 2022-03-21 09:26:45
* @LastEditors : Shiming * @LastEditors : Shiming
* @LastEditTime : 2022-03-28 14:45:41 * @LastEditTime : 2022-03-28 19:47:56
* @FilePath : \\tms-obc-web\\src\\app\\routes\\partner\\rebate-management\\components\\rebate-setting\\add\\add.component.ts * @FilePath : \\tms-obc-web\\src\\app\\routes\\partner\\rebate-management\\components\\rebate-setting\\add\\add.component.ts
* Copyright (C) 2022 huzhenhong. All rights reserved. * Copyright (C) 2022 huzhenhong. All rights reserved.
*/ */
@ -17,17 +17,23 @@ import { processSingleSort, ShipperBaseService } from '@shared';
import { NzModalService } from 'ng-zorro-antd/modal'; import { NzModalService } from 'ng-zorro-antd/modal';
import { RebateManagementService } from '../../../services/rebate-management.service'; import { RebateManagementService } from '../../../services/rebate-management.service';
import { ParterRebateManageMentAddPartnerListComponent } from '../add-partnerlist/add-partnerlist.component'; import { ParterRebateManageMentAddPartnerListComponent } from '../add-partnerlist/add-partnerlist.component';
import { inRange } from '@delon/util';
@Component({ @Component({
selector: 'app-parter-channel-rebate-management-add', selector: 'app-parter-channel-rebate-management-add',
styleUrls: ['./add.component.less'], styleUrls: ['./add.component.less'],
templateUrl: './add.component.html' templateUrl: './add.component.html'
}) })
export class ParterRebateManageMentAddComponent implements OnInit { export class ParterRebateManageMentAddComponent implements OnInit {
setValue: string = ''; configName: string = '';
toFixedValue: Number = 2; accountingRate: Number = 2;
radioValue = 'A'; partnerPeople: any;
partnerPeopleList: any;
peopleStatus: boolean = true;
configType = '1';
precision = 2; precision = 2;
inputValue = ''; inputValue = '';
@ViewChild('st', { static: true })
st!: STComponent;
@ViewChild('sf', { static: false }) sf!: SFComponent; @ViewChild('sf', { static: false }) sf!: SFComponent;
schema1!: SFSchema; schema1!: SFSchema;
constructor( constructor(
@ -37,6 +43,27 @@ export class ParterRebateManageMentAddComponent implements OnInit {
private modal: NzModalService, private modal: NzModalService,
public shipperservice: ShipperBaseService public shipperservice: ShipperBaseService
) {} ) {}
columns: STColumn[] = [
{
title: '合伙人名称',
index: 'enterpriseName',
width: 180,
format: item => (item.partnerType ? `${item.enterpriseName || item.contactName}` : '')
},
{ title: '联系人', index: 'contactName', width: 150, format: item => (item.partnerType ? `${item.contactName}` : '') },
{ title: '手机号', index: 'contactMobile', className: 'text-center', width: 150 },
{ title: '类型', index: 'partnerType', className: 'text-center', width: 130, type: 'enum', enum: { 1: '企业', 2: '个人' } },
{
title: '操作', width: '90px', fixed: 'right',
buttons: [
{
text: '移除',
click: _record => this.delete(_record),
acl: { ability: ['AbnormalAppear-reply'] }
},
]
},
];
initSF(data?: any) { initSF(data?: any) {
this.schema1 = { this.schema1 = {
properties: { properties: {
@ -63,21 +90,46 @@ export class ParterRebateManageMentAddComponent implements OnInit {
window.history.go(-1); window.history.go(-1);
} }
/** /**
*申请退款 *合伙人选择
*/ */
add(item?: any) { add(item?: any) {
const modalRef = this.modal.create({ const modalRef = this.modal.create({
nzTitle: '申请退款', nzTitle: '合伙人选择',
nzWidth: 1000,
nzContent: ParterRebateManageMentAddPartnerListComponent, nzContent: ParterRebateManageMentAddPartnerListComponent,
nzComponentParams: { nzComponentParams: {
i: item, i: item,
}, },
nzFooter: null nzFooter: null
}); });
modalRef.afterClose.subscribe((res: boolean) => { modalRef.afterClose.subscribe((res: any) => {
if (res) { if (res) {
console.log(Array.isArray(res));
console.log(res);
if(Array.isArray(res)) {
this.partnerPeopleList = res;
this.peopleStatus = false
} else {
this.partnerPeople = res?.enterpriseName;
}
} }
}); });
} }
delete(item: any) {
console.log(item);
}
save () {
const params = {
accountingRate: this.accountingRate,
configName: this.configName,
configType: this.configType,
rebateConfigLineDTO: {}
}
this.service.request(this.service.$api_save_rebateConfig, params).subscribe((res: any) => {
if(res) {
console.log(res);
}
})
}
} }

View File

@ -166,7 +166,7 @@ export class ParterRebateManageMentSettingComponent implements OnInit {
}); });
} }
configAction() { configAction() {
this.router.navigate(['/partner/rebate/setting/add', '']) this.router.navigate(['/partner/rebate/setting/add/', 1])
} }
/** /**
* 重置表单 * 重置表单

View File

@ -19,6 +19,10 @@ export class RebateManagementService extends BaseService {
public $api_get_listCompliancePage = '/api/sdc/billRiskOperate/listRiskPage'; public $api_get_listCompliancePage = '/api/sdc/billRiskOperate/listRiskPage';
// 查询返佣配置表 // 查询返佣配置表
public $api_get_rebateConfig = '/api/mdc/rebateConfig/list/page'; public $api_get_rebateConfig = '/api/mdc/rebateConfig/list/page';
// 保存返佣配置表
public $api_save_rebateConfig = '/api/mdc/rebateConfig/save';
  // 查询合伙人信息-分页
public $api_get_partner_page = '/api/mdc/partner/list/page';
constructor(public injector: Injector) { constructor(public injector: Injector) {
super(injector); super(injector);
} }

View File

@ -4,7 +4,7 @@
* @Author : Shiming * @Author : Shiming
* @Date : 2022-01-25 20:18:52 * @Date : 2022-01-25 20:18:52
* @LastEditors : Shiming * @LastEditors : Shiming
* @LastEditTime : 2022-03-21 14:14:06 * @LastEditTime : 2022-03-28 20:26:30
* @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\rebate-table\\rebate-table.component.html * @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\rebate-table\\rebate-table.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved. * Copyright (C) 2022 huzhenhong. All rights reserved.
--> -->
@ -37,7 +37,7 @@
</td> </td>
<td nzWidth="220px" nzAlign="center" > <td nzWidth="220px" nzAlign="center" >
<div > <div >
<nz-select ngModel="lucy"> <nz-select ngModel="gradeConfigId">
<nz-option nzValue="jack" nzLabel="Jack154654564654"></nz-option> <nz-option nzValue="jack" nzLabel="Jack154654564654"></nz-option>
<nz-option nzValue="lucy" nzLabel="Lucy"></nz-option> <nz-option nzValue="lucy" nzLabel="Lucy"></nz-option>
</nz-select> </nz-select>
@ -46,7 +46,7 @@
<td nzWidth="220px" nzAlign="center" > <td nzWidth="220px" nzAlign="center" >
<div style=" margin-left: 26%"> <div style=" margin-left: 26%">
<nz-input-group nzPrefix="="> <nz-input-group nzPrefix="=">
<nz-input-number [(ngModel)]="item.baserebateRate" [nzMin]="0" nzSize="small" <nz-input-number [(ngModel)]="item.startAmount" [nzMin]="0" nzSize="small" (ngModelChange)="changeendAmount($event,i)"
> >
</nz-input-number> </nz-input-number>
</nz-input-group> </nz-input-group>
@ -56,7 +56,7 @@
<td nzWidth="220px" nzAlign="center" > <td nzWidth="220px" nzAlign="center" >
<div style=" margin-left: 26%"> <div style=" margin-left: 26%">
<nz-input-group nzPrefix=""> <nz-input-group nzPrefix="">
<nz-input-number [(ngModel)]="item.blanketrebateRate" [nzMin]="0" nzSize="small" > <nz-input-number [(ngModel)]="item.endAmount" [nzMin]="0" nzSize="small" >
</nz-input-number> </nz-input-number>
</nz-input-group> </nz-input-group>
</div> </div>
@ -64,7 +64,7 @@
<td nzWidth="220px" nzAlign="center" > <td nzWidth="220px" nzAlign="center" >
<div style=" margin-left: 26%"> <div style=" margin-left: 26%">
<nz-input-group [nzAddOnAfter]="addOnAfterTemplate2"> <nz-input-group [nzAddOnAfter]="addOnAfterTemplate2">
<nz-input-number [(ngModel)]="item.baserebateRate" [nzMin]="0" nzSize="small" <nz-input-number [(ngModel)]="item.managementFeeRatio" [nzMin]="0" nzSize="small"
> >
</nz-input-number> </nz-input-number>
</nz-input-group> </nz-input-group>

View File

@ -10,7 +10,14 @@ import { SFComponent, SFSchema, SFUISchema } from '@delon/form';
styleUrls: ['./rebate-table.component.less'] styleUrls: ['./rebate-table.component.less']
}) })
export class RebateTableComponent implements OnInit { export class RebateTableComponent implements OnInit {
data: any[] = []; data: any[] = [
{
gradeConfigId: '',
startAmount: 0,
endAmount: 0,
managementFeeRatio: 0,
}
];
headers: any[] = []; headers: any[] = [];
formatterDollar = (value: number): string => `${value}`; formatterDollar = (value: number): string => `${value}`;
changeSub = new Subject<string>(); changeSub = new Subject<string>();
@ -18,70 +25,57 @@ export class RebateTableComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
this.loadData(); this.loadData();
this.changeEndKmAction(); this.changeendAmountAction();
} }
loadData() { loadData() {
this.service.request('/api/mdc/cuc/insuranceConfig/list').subscribe(res => { // this.service.request('/api/mdc/cuc/insuranceConfig/list').subscribe(res => {
if (res) { // if (res) {
console.log(res); // console.log(res);
this.data = res; // this.data = res;
this.cdr.detectChanges(); // this.cdr.detectChanges();
} // }
}); // });
this.service.request('/api/mdc/pbc/sysConfigItem/findItemValueByItemKeys', [ // this.service.request('/api/mdc/pbc/sysConfigItem/findItemValueByItemKeys', [
"rebate.config.minrebatePrice" // "rebate.config.minrebatePrice"
]).subscribe(res => { // ]).subscribe(res => {
if (res) { // if (res) {
console.log(res); // console.log(res);
} // }
}); // });
} }
/**
* 修改结束车长
* @param event 车长
* @param i 下标
*/
changeEndLength(event: any, i: number) {
if (event <= this.headers[i].startLength) {
this.headers[i].endLength = this.headers[i].startLength + 1;
this.changeNextStartLength(event, i + 1);
return;
}
this.headers[i].endLength = event;
this.changeNextStartLength(event, i + 1);
}
/** /**
* 修改结束公里数 * 修改结束公里数
* @param event 车长 * @param event 车长
* @param i 下标 * @param i 下标
*/ */
changeEndKm(event: any, i: number) { changeendAmount(event: any, i: number) {
if (event) { if (event) {
console.log(event); console.log(event);
this.changeSub.next(`${event},${i}`); this.changeSub.next(`${event},${i}`);
} }
} }
changeEndKmAction() { changeendAmountAction() {
this.changeSub.pipe(debounceTime(500)).subscribe((res: string) => { this.changeSub.pipe(debounceTime(500)).subscribe((res: string) => {
if (res) { if (res) {
const paras = res.split(','); const paras = res.split(',');
const num = Number(paras[0]); const num = Number(paras[0]);
const i = Number(paras[1]); const i = Number(paras[1]);
if (num <= this.data[i].startKm) { if (num <= this.data[i].startAmount) {
this.data[i].endKm = null; this.data[i].endAmount = null;
setTimeout(() => { setTimeout(() => {
this.data[i].endKm = this.data[i].startKm + 1 ; this.data[i].endAmount = this.data[i].startAmount + 1 ;
}, 0); }, 0);
this.changeNextStartKm(this.data[i].startKm + 1, i + 1); this.changeNextstartAmount(this.data[i].startAmount + 1, i + 1);
return; return;
} }
this.data[i].endKm = num; this.data[i].endAmount = num;
this.changeNextStartKm(num, i + 1); this.changeNextstartAmount(num, i + 1);
} }
}); });
} }
@ -90,14 +84,14 @@ export class RebateTableComponent implements OnInit {
console.log(this.data); console.log(this.data);
const tem = this.data[this.data?.length - 1]; const tem = this.data[this.data?.length - 1];
if (tem && tem.endKm) { if (tem) {
this.data.push({ this.data.push({
endKm: '', gradeConfigId: '',
startKm: tem.endKm startAmount: 0,
endAmount: 0,
managementFeeRatio: 0,
}); });
this.data = [...this.data]; this.data = [...this.data];
} else {
this.service.msgSrv.warning('请填写完整公里数');
} }
} }
@ -125,32 +119,18 @@ export class RebateTableComponent implements OnInit {
}); });
} }
/**
* 遍历同步后置位车长
* @param event 车长
* @param i 下标
*/
private changeNextStartLength(event: number, i: number) {
if (this.headers[i]) {
this.headers[i].startLength = event;
if (this.headers[i].endLength <= event) {
this.headers[i].endLength = this.headers[i].startLength + 0.5;
this.changeNextStartLength(event + 0.5, i + 1);
}
}
}
/** /**
* 遍历同步后置位公里数 * 遍历同步后置位公里数
* @param event 车长 * @param event 车长
* @param i 下标 * @param i 下标
*/ */
private changeNextStartKm(event: number, i: number) { private changeNextstartAmount(event: number, i: number) {
if (this.data[i]) { if (this.data[i]) {
this.data[i].startKm = event; this.data[i].startAmount = event;
if (this.data[i].endKm <= event) { if (this.data[i].endAmount <= event) {
this.data[i].endKm = this.data[i].startKm + 1; this.data[i].endAmount = this.data[i].startAmount + 1;
this.changeNextStartKm(event + 1, i + 1); this.changeNextstartAmount(event + 1, i + 1);
} }
} }
} }