fix bug
This commit is contained in:
@ -293,14 +293,53 @@
|
|||||||
<div nz-row>
|
<div nz-row>
|
||||||
<div nz-col nzSpan="12">
|
<div nz-col nzSpan="12">
|
||||||
<sf #sf7 [schema]="schema7" [button]="'none'" [ui]="ui7" [formData]="sf7data">
|
<sf #sf7 [schema]="schema7" [button]="'none'" [ui]="ui7" [formData]="sf7data">
|
||||||
<ng-template sf-template="subtotal" let-i let-ui="ui">¥{{ i.value | number: '0.2-2' }}</ng-template>
|
<ng-template sf-template="prePay" let-i let-ui="ui">
|
||||||
|
<nz-input-number
|
||||||
|
[ngModel]="i.value"
|
||||||
|
[nzMin]="0"
|
||||||
|
[nzMax]="99999"
|
||||||
|
[nzStep]="0.01"
|
||||||
|
[nzPrecision]="2"
|
||||||
|
(ngModelChange)="i.setValue($event); payChange()"
|
||||||
|
[nzFormatter]="formatterRmb"
|
||||||
|
[nzParser]="parserRmb"
|
||||||
|
>
|
||||||
|
</nz-input-number>
|
||||||
|
</ng-template>
|
||||||
|
<ng-template sf-template="toPay" let-i let-ui="ui">
|
||||||
|
<nz-input-number
|
||||||
|
[ngModel]="i.value"
|
||||||
|
[nzMin]="0"
|
||||||
|
[nzMax]="99999"
|
||||||
|
[nzStep]="0.01"
|
||||||
|
[nzPrecision]="2"
|
||||||
|
(ngModelChange)="i.setValue($event); payChange()"
|
||||||
|
[nzFormatter]="formatterRmb"
|
||||||
|
[nzParser]="parserRmb"
|
||||||
|
>
|
||||||
|
</nz-input-number>
|
||||||
|
</ng-template>
|
||||||
|
<ng-template sf-template="receiptPay" let-i let-ui="ui">
|
||||||
|
<nz-input-number
|
||||||
|
[ngModel]="i.value"
|
||||||
|
[nzMin]="0"
|
||||||
|
[nzMax]="99999"
|
||||||
|
[nzStep]="0.01"
|
||||||
|
[nzPrecision]="2"
|
||||||
|
(ngModelChange)="i.setValue($event); payChange()"
|
||||||
|
[nzFormatter]="formatterRmb"
|
||||||
|
[nzParser]="parserRmb"
|
||||||
|
>
|
||||||
|
</nz-input-number>
|
||||||
|
</ng-template>
|
||||||
|
<ng-template sf-template="subtotal" let-i let-ui="ui">{{ i.value | currency }}</ng-template>
|
||||||
<ng-template sf-template="appendFee" let-i let-ui="ui"
|
<ng-template sf-template="appendFee" let-i let-ui="ui"
|
||||||
>¥{{ i.value | number: '0.2-2' }}(费率:{{ currentRate | number: '0.2-4' }}%)</ng-template
|
>{{ i.value | currency }}(费率:{{ currentRate | number: '0.2-4' }}%)</ng-template
|
||||||
>
|
>
|
||||||
<ng-template sf-template="total" let-i let-ui="ui">¥{{ i.value | number: '0.2-2' }}</ng-template>
|
<ng-template sf-template="total" let-i let-ui="ui">{{ i.value | currency }}</ng-template>
|
||||||
<ng-template sf-template="paymentDays" let-i let-ui="ui">
|
<ng-template sf-template="paymentDays" let-i let-ui="ui">
|
||||||
<div nz-row>
|
<div nz-row>
|
||||||
<div class="align-center" style="width: 300px">
|
<div class="align-center">
|
||||||
<div nz-col nzSpan="16">
|
<div nz-col nzSpan="16">
|
||||||
<nz-input-number
|
<nz-input-number
|
||||||
[ngModel]="i.value"
|
[ngModel]="i.value"
|
||||||
@ -309,10 +348,12 @@
|
|||||||
[nzStep]="1"
|
[nzStep]="1"
|
||||||
(ngModelChange)="i.setValue($event)"
|
(ngModelChange)="i.setValue($event)"
|
||||||
nzPlaceHolder="请输入1-30"
|
nzPlaceHolder="请输入1-30"
|
||||||
|
[nzPrecision]="0"
|
||||||
|
[nzPrecisionMode]="'cut'"
|
||||||
></nz-input-number>
|
></nz-input-number>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div nz-col nzSpan="8">
|
||||||
<span> 天内支付运费</span>
|
<span> 天内支付运费</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -42,6 +42,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
|
|||||||
sf6data: any; // 货源单设置回显
|
sf6data: any; // 货源单设置回显
|
||||||
sf7data: any; // 货源单设置回显
|
sf7data: any; // 货源单设置回显
|
||||||
id = '';
|
id = '';
|
||||||
|
envCache: any;
|
||||||
type = 'add';
|
type = 'add';
|
||||||
// // 单位
|
// // 单位
|
||||||
startInfo: any[] = [];
|
startInfo: any[] = [];
|
||||||
@ -100,6 +101,15 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
|
|||||||
@ViewChild('sf7', { static: false }) sf7!: SFComponent;
|
@ViewChild('sf7', { static: false }) sf7!: SFComponent;
|
||||||
schema7: SFSchema = {};
|
schema7: SFSchema = {};
|
||||||
ui7!: SFUISchema;
|
ui7!: SFUISchema;
|
||||||
|
formatterRmb = (value: number): string =>{
|
||||||
|
if(value){
|
||||||
|
let value2 = Number(value).toLocaleString(undefined,{'minimumFractionDigits':2,'maximumFractionDigits':2});
|
||||||
|
return `¥ ${value2}`;
|
||||||
|
}
|
||||||
|
return `¥ 0.00`
|
||||||
|
|
||||||
|
} ;
|
||||||
|
parserRmb = (value: string): string => value.replace('¥ ', '').replace(',','');
|
||||||
// 页面初始化
|
// 页面初始化
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.initSF1();
|
this.initSF1();
|
||||||
@ -569,49 +579,19 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
|
|||||||
type: 'number',
|
type: 'number',
|
||||||
title: '预付',
|
title: '预付',
|
||||||
default: 0,
|
default: 0,
|
||||||
minimum: 0,
|
ui: {widget: 'custom'}
|
||||||
maximum: 999999,
|
|
||||||
ui: {
|
|
||||||
prefix: '¥',
|
|
||||||
widgetWidth: 300,
|
|
||||||
change: _args => this.payChange()
|
|
||||||
} as SFNumberWidgetSchema
|
|
||||||
},
|
},
|
||||||
toPay: {
|
toPay: {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
title: '到付',
|
title: '到付',
|
||||||
minimum: 0,
|
|
||||||
maximum: 999999,
|
|
||||||
default: 0,
|
default: 0,
|
||||||
ui: {
|
ui: { widget: 'custom'}
|
||||||
prefix: '¥',
|
|
||||||
widgetWidth: 300,
|
|
||||||
change: _args => this.payChange()
|
|
||||||
} as SFNumberWidgetSchema
|
|
||||||
},
|
},
|
||||||
// oilCardPay: {
|
|
||||||
// type: 'number',
|
|
||||||
// title: '油卡',
|
|
||||||
// maximum: 999999,
|
|
||||||
// minimum: 0,
|
|
||||||
// default: 0,
|
|
||||||
// ui: {
|
|
||||||
// prefix: '¥',
|
|
||||||
// widgetWidth: 300,
|
|
||||||
// change: _args => this.payChange()
|
|
||||||
// } as SFNumberWidgetSchema
|
|
||||||
// },
|
|
||||||
receiptPay: {
|
receiptPay: {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
title: '回单付',
|
title: '回单付',
|
||||||
maximum: 999999,
|
|
||||||
minimum: 0,
|
|
||||||
default: 0,
|
default: 0,
|
||||||
ui: {
|
ui: {widget: 'custom'}
|
||||||
prefix: '¥',
|
|
||||||
widgetWidth: 300,
|
|
||||||
change: _args => this.payChange()
|
|
||||||
} as SFNumberWidgetSchema
|
|
||||||
},
|
},
|
||||||
subtotal: { type: 'number', title: '小计', default: 0, ui: { widget: 'custom' } as SFNumberWidgetSchema },
|
subtotal: { type: 'number', title: '小计', default: 0, ui: { widget: 'custom' } as SFNumberWidgetSchema },
|
||||||
appendFee: { type: 'number', title: '附加费', default: 0, ui: { widget: 'custom' } as SFNumberWidgetSchema },
|
appendFee: { type: 'number', title: '附加费', default: 0, ui: { widget: 'custom' } as SFNumberWidgetSchema },
|
||||||
@ -621,7 +601,6 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
|
|||||||
title: '到货后',
|
title: '到货后',
|
||||||
ui: {
|
ui: {
|
||||||
widget: 'custom',
|
widget: 'custom',
|
||||||
placeholder: '请输入',
|
|
||||||
errors: { required: '请输入付款承诺天数' }
|
errors: { required: '请输入付款承诺天数' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -630,7 +609,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
|
|||||||
};
|
};
|
||||||
this.ui7 = {
|
this.ui7 = {
|
||||||
'*': {
|
'*': {
|
||||||
spanLabelFixed: 90,
|
spanLabelFixed: 115,
|
||||||
grid: { span: 24 }
|
grid: { span: 24 }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -654,22 +633,36 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
payChange() {
|
payChange() {
|
||||||
const subtotal = this.sf7.value.prePay + this.sf7.value.toPay + this.sf7.value.receiptPay || 0;
|
const prePay = this.sf7.value.prePay || 0;
|
||||||
const oilCardPay = 0
|
const toPay = this.sf7.value.toPay || 0
|
||||||
|
const receiptPay = this.sf7.value.receiptPay || 0;
|
||||||
|
const oilCardPay = 0;
|
||||||
|
const subtotal = prePay + toPay + receiptPay;
|
||||||
|
const params = {
|
||||||
|
shipperId: this.envCache?.enterpriseId,
|
||||||
|
enterpriseInfoId: this.envCache?.networkTransporterId,
|
||||||
|
totalFreight:subtotal,
|
||||||
|
fuelCardAmount:oilCardPay,
|
||||||
|
resourcetype:'1'
|
||||||
|
}
|
||||||
this.service
|
this.service
|
||||||
.request(this.service.$api_getCalculatedSurcharge + `?totalFreight=${subtotal}&fuelCardAmount=${oilCardPay}`)
|
.request(this.service.$api_getCalculatedSurcharge,params)
|
||||||
.subscribe((res: any) => {
|
.subscribe(res => {
|
||||||
if (res) {
|
if (res) {
|
||||||
this.sf7.setValue('/appendFee', res.surcharge);
|
this.sf7.setValue('/appendFee', res.surcharge);
|
||||||
this.sf7.setValue('/subtotal', subtotal);
|
this.sf7.setValue('/subtotal', subtotal);
|
||||||
this.sf7.setValue('/total', subtotal + res.surcharge);
|
this.sf7.setValue('/total', subtotal + res.surcharge);
|
||||||
this.service
|
this.service
|
||||||
.request(this.service.$api_getcalculatedServiceRate + `?invoiceAmount=${subtotal + res.surcharge}&totalFreight=${subtotal}`)
|
.request(this.service.$api_getcalculatedServiceRate + `?invoiceAmount=${subtotal + res.surcharge}&totalFreight=${subtotal}`)
|
||||||
.subscribe((res: any) => {
|
.subscribe(res => {
|
||||||
if (res) {
|
if (res) {
|
||||||
this.currentRate = res.rate;
|
this.currentRate = res.rate * 100;
|
||||||
|
} else {
|
||||||
|
this.service.msgSrv.error(res.msg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
this.service.msgSrv.error(res.msg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user