This commit is contained in:
wangshiming
2022-02-17 16:56:01 +08:00
parent b1a18bbc54
commit c56e0218ac
2 changed files with 81 additions and 47 deletions

View File

@ -42,6 +42,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
sf6data: any; // 货源单设置回显
sf7data: any; // 货源单设置回显
id = '';
envCache: any;
type = 'add';
// // 单位
startInfo: any[] = [];
@ -100,6 +101,15 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
@ViewChild('sf7', { static: false }) sf7!: SFComponent;
schema7: SFSchema = {};
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 {
this.initSF1();
@ -569,49 +579,19 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
type: 'number',
title: '预付',
default: 0,
minimum: 0,
maximum: 999999,
ui: {
prefix: '¥',
widgetWidth: 300,
change: _args => this.payChange()
} as SFNumberWidgetSchema
ui: {widget: 'custom'}
},
toPay: {
type: 'number',
title: '到付',
minimum: 0,
maximum: 999999,
default: 0,
ui: {
prefix: '¥',
widgetWidth: 300,
change: _args => this.payChange()
} as SFNumberWidgetSchema
ui: { widget: 'custom'}
},
// oilCardPay: {
// type: 'number',
// title: '油卡',
// maximum: 999999,
// minimum: 0,
// default: 0,
// ui: {
// prefix: '¥',
// widgetWidth: 300,
// change: _args => this.payChange()
// } as SFNumberWidgetSchema
// },
receiptPay: {
type: 'number',
title: '回单付',
maximum: 999999,
minimum: 0,
default: 0,
ui: {
prefix: '¥',
widgetWidth: 300,
change: _args => this.payChange()
} as SFNumberWidgetSchema
ui: {widget: 'custom'}
},
subtotal: { 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: '到货后',
ui: {
widget: 'custom',
placeholder: '请输入',
errors: { required: '请输入付款承诺天数' }
}
}
@ -630,7 +609,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
};
this.ui7 = {
'*': {
spanLabelFixed: 90,
spanLabelFixed: 115,
grid: { span: 24 }
}
};
@ -654,22 +633,36 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
});
}
payChange() {
const subtotal = this.sf7.value.prePay + this.sf7.value.toPay + this.sf7.value.receiptPay || 0;
const oilCardPay = 0
const prePay = this.sf7.value.prePay || 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
.request(this.service.$api_getCalculatedSurcharge + `?totalFreight=${subtotal}&fuelCardAmount=${oilCardPay}`)
.subscribe((res: any) => {
.request(this.service.$api_getCalculatedSurcharge,params)
.subscribe(res => {
if (res) {
this.sf7.setValue('/appendFee', res.surcharge);
this.sf7.setValue('/subtotal', subtotal);
this.sf7.setValue('/total', subtotal + res.surcharge);
this.service
.request(this.service.$api_getcalculatedServiceRate + `?invoiceAmount=${subtotal + res.surcharge}&totalFreight=${subtotal}`)
.subscribe((res: any) => {
.subscribe(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);
}
});
}