fix bug
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
* @Author : Shiming
|
||||
* @Date : 2022-02-24 15:07:57
|
||||
* @LastEditors : Shiming
|
||||
* @LastEditTime : 2022-02-24 15:23:48
|
||||
* @LastEditTime : 2022-03-11 15:22:36
|
||||
* @FilePath : \\tms-obc-web\\src\\app\\routes\\partner\\partner-routing.module.ts
|
||||
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
||||
*/
|
||||
@ -37,6 +37,7 @@ import { AddEtpPartnerComponent } from './partner-list/components/add-etp-partne
|
||||
import { AddPersonalPartnerComponent } from './partner-list/components/add-personal-partner/add-personal-partner.component';
|
||||
import { PartnerDetailComponent } from './partner-list/components/partner-detail/partner-detail.component';
|
||||
import { PartnerListComponent } from './partner-list/components/index/partner-list.component';
|
||||
import { ParterRebateManageMentAddComponent } from './rebate-management/components/rebate-setting/add/add.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
@ -72,7 +73,8 @@ const routes: Routes = [
|
||||
children: [
|
||||
{ path: 'particulars', component: ParterRebateManageMentParticularsComponent },
|
||||
{ path: 'record', component: ParterRebateManageMentRecordComponent },
|
||||
{ path: 'setting', component: ParterRebateManageMentSettingComponent }
|
||||
{ path: 'setting', component: ParterRebateManageMentSettingComponent },
|
||||
{ path: 'setting/add/:id', component: ParterRebateManageMentAddComponent },
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@ -4,13 +4,13 @@
|
||||
* @Author : Shiming
|
||||
* @Date : 2022-03-09 14:34:55
|
||||
* @LastEditors : Shiming
|
||||
* @LastEditTime : 2022-03-09 14:56:46
|
||||
* @LastEditTime : 2022-03-11 15:28:01
|
||||
* @FilePath : \\tms-obc-web\\src\\app\\routes\\partner\\partner.module.ts
|
||||
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
||||
*/
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { SharedModule } from '@shared';
|
||||
import { rebateTableModule, SharedModule } from '@shared';
|
||||
import { PartnerAccountManagementAccountDetailComponent } from './account-management/components/account-detail/account-detail.component';
|
||||
import { PartnerAccountManagementListComponent } from './account-management/components/list/list.component';
|
||||
import { PartnerAccountManagementRecordedDetailComponent } from './account-management/components/recorded-detail/recorded-detail.component';
|
||||
@ -49,6 +49,7 @@ import { AddPersonalPartnerComponent } from './partner-list/components/add-perso
|
||||
import { ParterRebateManageMenAbnormalFeedbackComponent } from './rebate-management/model/abnormal-feedback/abnormal-feedback.component';
|
||||
import { PartnerRecordedDetailComponent } from './recorded/components/detail/detail.component';
|
||||
import { PartnerRecordedRecordComponent } from './recorded/components/record/record.component';
|
||||
import { ParterRebateManageMentAddComponent } from './rebate-management/components/rebate-setting/add/add.component';
|
||||
|
||||
const COMPONENTS: any[] = [
|
||||
PartnerBusinessStatisticsIndexComponent,
|
||||
@ -86,13 +87,15 @@ const COMPONENTS: any[] = [
|
||||
ParterRebateManageMenAbnormalFeedbackComponent,
|
||||
ParterRebateManageMentSettingComponent,
|
||||
PartnerAuditModalComponent,
|
||||
ParterRebateManageMentAddComponent,
|
||||
AddEtpPartnerComponent,
|
||||
AddPersonalPartnerComponent
|
||||
AddPersonalPartnerComponent,
|
||||
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
declarations: [...COMPONENTS],
|
||||
imports: [CommonModule, PartnerRoutingModule, SharedModule],
|
||||
imports: [CommonModule, PartnerRoutingModule, SharedModule,rebateTableModule],
|
||||
providers: [PartnerListService]
|
||||
})
|
||||
export class PartnerModule { }
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
<!--
|
||||
* @Description :
|
||||
* @Version : 1.0
|
||||
* @Author : Shiming
|
||||
* @Date : 2022-02-24 20:09:49
|
||||
* @LastEditors : Shiming
|
||||
* @LastEditTime : 2022-03-11 15:25:00
|
||||
* @FilePath : \\tms-obc-web\\src\\app\\routes\\partner\\rebate-management\\components\\rebate-setting\\add\\add.component.html
|
||||
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
||||
-->
|
||||
<page-header-wrapper [title]="''"> </page-header-wrapper>
|
||||
<nz-card>
|
||||
<!-- 数据列表 -->
|
||||
12121212
|
||||
<app-rebate-table></app-rebate-table>
|
||||
</nz-card>
|
||||
@ -0,0 +1,25 @@
|
||||
import { ModalHelper } from '@delon/theme';
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { STColumn, STComponent, STData, STRequestOptions } from '@delon/abc/st';
|
||||
import { SFComponent, SFDateWidgetSchema, SFSchema, SFUISchema } from '@delon/form';
|
||||
import { processSingleSort, ShipperBaseService } from '@shared';
|
||||
import { NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { RebateManagementService } from '../../../services/rebate-management.service';
|
||||
@Component({
|
||||
selector: 'app-parter-channel-rebate-management-add',
|
||||
templateUrl: './add.component.html'
|
||||
})
|
||||
export class ParterRebateManageMentAddComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
public router: Router,
|
||||
public ar: ActivatedRoute,
|
||||
public service: RebateManagementService,
|
||||
private modal: NzModalService,
|
||||
public shipperservice: ShipperBaseService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
}
|
||||
@ -166,7 +166,7 @@ export class ParterRebateManageMentSettingComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
configAction() {
|
||||
|
||||
this.router.navigate(['/partner/rebate/setting/add', ''])
|
||||
}
|
||||
/**
|
||||
* 重置表单
|
||||
|
||||
@ -13,11 +13,11 @@ import { NgModule } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { NzInputNumberModule } from 'ng-zorro-antd/input-number';
|
||||
import { NzTableModule } from 'ng-zorro-antd/table';
|
||||
import { InsuranceTableComponent } from './insurance-table.component';
|
||||
import { NzPopconfirmModule } from 'ng-zorro-antd/popconfirm';
|
||||
import { NzInputModule } from 'ng-zorro-antd/input';
|
||||
import { DelonFormModule } from '@delon/form';
|
||||
import { NzButtonModule } from 'ng-zorro-antd/button';
|
||||
import { InsuranceTableComponent } from './insurance-table.component';
|
||||
const COMPONENTS = [InsuranceTableComponent];
|
||||
const MODULES = [NzTableModule, NzInputNumberModule, NzPopconfirmModule, NzInputModule, NzButtonModule, DelonFormModule];
|
||||
|
||||
|
||||
13
src/app/shared/components/rebate-table/index.ts
Normal file
13
src/app/shared/components/rebate-table/index.ts
Normal file
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* @Description :
|
||||
* @Version : 1.0
|
||||
* @Author : Shiming
|
||||
* @Date : 2022-01-25 20:20:07
|
||||
* @LastEditors : Shiming
|
||||
* @LastEditTime : 2022-01-26 11:05:44
|
||||
* @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\insurance-table\\index.ts
|
||||
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
||||
*/
|
||||
export * from './rebate-table.module'
|
||||
export * from './rebate-table.service'
|
||||
export * from './rebate-table.component'
|
||||
@ -0,0 +1,92 @@
|
||||
<!--
|
||||
* @Description :
|
||||
* @Version : 1.0
|
||||
* @Author : Shiming
|
||||
* @Date : 2022-01-25 20:18:52
|
||||
* @LastEditors : Shiming
|
||||
* @LastEditTime : 2022-03-11 15:12:01
|
||||
* @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\rebate-table\\rebate-table.component.html
|
||||
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
||||
-->
|
||||
<div nz-row>
|
||||
<div nz-col nzSpan="24">
|
||||
<!-- <div class="mb-md ml-xl" style="text-align: right;">
|
||||
<button nz-button nzType="primary" (click)="add()">新增公里数</button>
|
||||
<button class="ml-md" nz-button nzType="primary" (click)="save()">保存</button>
|
||||
</div> -->
|
||||
<div>
|
||||
<sf #sf [schema]="schema" [formData]="sfdata" [button]="'none'" [ui]="ui">
|
||||
<ng-template sf-template="freightPrice" let-i let-ui="ui">
|
||||
<nz-input-group [nzAddOnAfter]="addOnAfterTemplate">
|
||||
<nz-input-number [(ngModel)]="minrebatePrice" [nzMin]="0" ></nz-input-number>
|
||||
</nz-input-group>
|
||||
<ng-template #addOnAfterTemplate>
|
||||
<span >元</span>
|
||||
</ng-template>
|
||||
</ng-template>
|
||||
</sf>
|
||||
|
||||
</div>
|
||||
<nz-table #groupingTable [nzData]="data" nzBordered nzSize="small" [nzFrontPagination]="false"
|
||||
[nzScroll]="{ x: '900px' }" [nzShowPagination]="false" class="ml-xl" style="max-width: 1200px;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="2" nzWidth="250px" nzAlign="center" nzLeft>险种</th>
|
||||
<th nzWidth="220px" nzAlign="center" >普货-基本险</th>
|
||||
<th nzWidth="220px" nzAlign="center" >普货-综合险</th>
|
||||
<th rowspan="2" nzWidth="60px" nzAlign="center" nzRight>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let item of groupingTable.data;let i = index">
|
||||
<td nzWidth="250px" nzAlign="center" nzLeft>
|
||||
<div style="display: flex;align-items: center;justify-content: space-between;">
|
||||
<div >
|
||||
公里数(km)
|
||||
</div>
|
||||
<div style="color:#f0f0f0;">|</div>
|
||||
<div >
|
||||
<label style="width: 65px;text-align: right;"> {{item.startKm}}</label>
|
||||
<label>-</label>
|
||||
|
||||
<nz-input-number [ngModel]="item.endKm" (ngModelChange)="changeEndKm($event,i)" [nzMin]="0"
|
||||
[nzFormatter]="formatterDollar" nzSize="small">
|
||||
</nz-input-number>(含)
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
<td nzWidth="220px" nzAlign="center" >
|
||||
<div style=" margin-left: 26%">
|
||||
<nz-input-group [nzAddOnAfter]="addOnAfterTemplate2">
|
||||
<nz-input-number [(ngModel)]="item.baserebateRate" [nzMin]="0" nzSize="small"
|
||||
>
|
||||
</nz-input-number>
|
||||
</nz-input-group>
|
||||
<ng-template #addOnAfterTemplate2>
|
||||
<span >%</span>
|
||||
</ng-template>
|
||||
</div>
|
||||
</td>
|
||||
<td nzWidth="220px" nzAlign="center" >
|
||||
<div style=" margin-left: 26%">
|
||||
<nz-input-group [nzAddOnAfter]="addOnAfterTemplate2">
|
||||
<nz-input-number [(ngModel)]="item.blanketrebateRate" [nzMin]="0" nzSize="small" >
|
||||
</nz-input-number>
|
||||
</nz-input-group>
|
||||
</div>
|
||||
</td>
|
||||
<td nzWidth="60px" nzAlign="center" nzRight>
|
||||
<a *ngIf="i === groupingTable.data.length-1 && groupingTable.data.length>1"
|
||||
nz-popconfirm
|
||||
nzPopconfirmTitle="是否确认删除?" (nzOnConfirm)="deleteRow(i)"
|
||||
>删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</nz-table>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -0,0 +1,19 @@
|
||||
:host::ng-deep {
|
||||
nz-input-number {
|
||||
width: 85px;
|
||||
|
||||
input {
|
||||
width : 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.ant-input-number-handler-wrap {
|
||||
display: none;
|
||||
}
|
||||
|
||||
}
|
||||
.ant-input-group {
|
||||
display: -webkit-inline-box !important;
|
||||
}
|
||||
|
||||
}
|
||||
195
src/app/shared/components/rebate-table/rebate-table.component.ts
Normal file
195
src/app/shared/components/rebate-table/rebate-table.component.ts
Normal file
@ -0,0 +1,195 @@
|
||||
import { debounceTime } from 'rxjs/operators';
|
||||
import { Subject } from 'rxjs';
|
||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { BaseService } from '@shared';
|
||||
import { SFComponent, SFSchema, SFUISchema } from '@delon/form';
|
||||
|
||||
@Component({
|
||||
selector: 'app-rebate-table',
|
||||
templateUrl: './rebate-table.component.html',
|
||||
styleUrls: ['./rebate-table.component.less']
|
||||
})
|
||||
export class RebateTableComponent implements OnInit {
|
||||
data: any[] = [];
|
||||
headers: any[] = [];
|
||||
sfdata: any; // 货源单设置回显
|
||||
|
||||
@ViewChild('sf', { static: false }) sf!: SFComponent;
|
||||
schema: SFSchema = {};
|
||||
ui!: SFUISchema;
|
||||
|
||||
formatterDollar = (value: number): string => `${value}`;
|
||||
minrebatePrice: number = 0;
|
||||
changeSub = new Subject<string>();
|
||||
constructor(public service: BaseService, private cdr: ChangeDetectorRef) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loadData();
|
||||
this.initSF()
|
||||
this.changeEndKmAction();
|
||||
this.minrebatePrice = 1000
|
||||
}
|
||||
|
||||
loadData() {
|
||||
this.service.request('/api/mdc/cuc/rebateConfig/list').subscribe(res => {
|
||||
if (res) {
|
||||
console.log(res);
|
||||
this.data = res;
|
||||
this.cdr.detectChanges();
|
||||
}
|
||||
});
|
||||
this.service.request('/api/mdc/pbc/sysConfigItem/findItemValueByItemKeys', [
|
||||
"rebate.config.minrebatePrice"
|
||||
]).subscribe(res => {
|
||||
if (res) {
|
||||
console.log(res);
|
||||
this.minrebatePrice = Number(res[0].itemValue)
|
||||
}
|
||||
});
|
||||
}
|
||||
initSF() {
|
||||
this.schema = {
|
||||
properties: {
|
||||
freightPrice: {
|
||||
type: 'string',
|
||||
title: '单票投保最低保费',
|
||||
ui: {
|
||||
widget: 'custom',
|
||||
placeholder: '请输入',
|
||||
errors: { required: '请填写' }
|
||||
}
|
||||
},
|
||||
},
|
||||
required: ['freightPrice']
|
||||
};
|
||||
this.ui = {
|
||||
'*': {
|
||||
spanLabelFixed: 160,
|
||||
grid: { span: 24 }
|
||||
},
|
||||
$freightPrice: {
|
||||
grid: { span: 8 }
|
||||
},
|
||||
};
|
||||
}
|
||||
/**
|
||||
* 修改结束车长
|
||||
* @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 i 下标
|
||||
*/
|
||||
changeEndKm(event: any, i: number) {
|
||||
if (event) {
|
||||
console.log(event);
|
||||
|
||||
this.changeSub.next(`${event},${i}`);
|
||||
}
|
||||
}
|
||||
changeEndKmAction() {
|
||||
this.changeSub.pipe(debounceTime(500)).subscribe((res: string) => {
|
||||
if (res) {
|
||||
const paras = res.split(',');
|
||||
const num = Number(paras[0]);
|
||||
const i = Number(paras[1]);
|
||||
|
||||
if (num <= this.data[i].startKm) {
|
||||
this.data[i].endKm = null;
|
||||
setTimeout(() => {
|
||||
this.data[i].endKm = this.data[i].startKm + 1 ;
|
||||
}, 0);
|
||||
this.changeNextStartKm(this.data[i].startKm + 1, i + 1);
|
||||
return;
|
||||
}
|
||||
this.data[i].endKm = num;
|
||||
this.changeNextStartKm(num, i + 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
add() {
|
||||
console.log(this.data);
|
||||
|
||||
const tem = this.data[this.data?.length - 1];
|
||||
if (tem && tem.endKm) {
|
||||
this.data.push({
|
||||
endKm: '',
|
||||
startKm: tem.endKm
|
||||
});
|
||||
this.data = [...this.data];
|
||||
} else {
|
||||
this.service.msgSrv.warning('请填写完整公里数');
|
||||
}
|
||||
}
|
||||
|
||||
deleteRow(index: number) {
|
||||
console.log(index);
|
||||
var newArr = this.data.concat();
|
||||
newArr.splice(this.data.length-1,1)
|
||||
// this.data = this.data.pop()
|
||||
console.log(newArr);
|
||||
this.data = [...newArr];
|
||||
}
|
||||
|
||||
save() {
|
||||
if(!this.minrebatePrice) {
|
||||
this.service.msgSrv.error('必填项为空!')
|
||||
return
|
||||
}
|
||||
let params= {
|
||||
minrebatePrice: this.minrebatePrice,
|
||||
rebateConfigDTOS: this.data
|
||||
}
|
||||
console.log(params);
|
||||
this.service.request('/api/mdc/cuc/rebateConfig/saveBatch', params).subscribe(res => {
|
||||
if (res) {
|
||||
console.log(res);
|
||||
this.service.msgSrv.success('修改成功');
|
||||
this.loadData();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 遍历同步后置位车长
|
||||
* @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 i 下标
|
||||
*/
|
||||
private changeNextStartKm(event: number, i: number) {
|
||||
if (this.data[i]) {
|
||||
this.data[i].startKm = event;
|
||||
if (this.data[i].endKm <= event) {
|
||||
this.data[i].endKm = this.data[i].startKm + 1;
|
||||
this.changeNextStartKm(event + 1, i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* @Description :
|
||||
* @Version : 1.0
|
||||
* @Author : Shiming
|
||||
* @Date : 2022-01-25 20:23:54
|
||||
* @LastEditors : Shiming
|
||||
* @LastEditTime : 2022-02-11 17:20:49
|
||||
* @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\rebate-table\\rebate-table.module.ts
|
||||
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
||||
*/
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { NzInputNumberModule } from 'ng-zorro-antd/input-number';
|
||||
import { NzTableModule } from 'ng-zorro-antd/table';
|
||||
import { RebateTableComponent } from './rebate-table.component';
|
||||
import { NzPopconfirmModule } from 'ng-zorro-antd/popconfirm';
|
||||
import { NzInputModule } from 'ng-zorro-antd/input';
|
||||
import { DelonFormModule } from '@delon/form';
|
||||
import { NzButtonModule } from 'ng-zorro-antd/button';
|
||||
const COMPONENTS = [RebateTableComponent];
|
||||
const MODULES = [NzTableModule, NzInputNumberModule, NzPopconfirmModule, NzInputModule, NzButtonModule, DelonFormModule];
|
||||
|
||||
@NgModule({
|
||||
declarations: COMPONENTS,
|
||||
imports: [CommonModule, FormsModule, ...MODULES],
|
||||
exports: COMPONENTS
|
||||
})
|
||||
export class rebateTableModule {}
|
||||
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* @Description :
|
||||
* @Version : 1.0
|
||||
* @Author : Shiming
|
||||
* @Date : 2022-01-25 20:21:04
|
||||
* @LastEditors : Shiming
|
||||
* @LastEditTime : 2022-01-25 20:35:52
|
||||
* @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\insurance-table\\insurance-table.service.ts
|
||||
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
||||
*/
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
|
||||
export class RebateService {
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* @Author: your name
|
||||
* @Date: 2021-11-29 10:04:12
|
||||
* @LastEditTime : 2022-02-11 14:31:22
|
||||
* @LastEditTime : 2022-03-11 15:12:20
|
||||
* @LastEditors : Shiming
|
||||
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
* @FilePath : \\tms-obc-web\\src\\app\\shared\\index.ts
|
||||
@ -21,6 +21,7 @@ export * from './components/dict-select/index';
|
||||
export * from './components/dynamic-setting';
|
||||
export * from './components/singlepage-setting';
|
||||
export * from './components/insurance-table/index';
|
||||
export * from './components/rebate-table/index';
|
||||
|
||||
// Utils
|
||||
export * from './utils';
|
||||
|
||||
Reference in New Issue
Block a user