This commit is contained in:
wangshiming
2022-02-17 16:45:13 +08:00
parent dd93822325
commit d884571904
4 changed files with 82 additions and 55 deletions

View File

@ -48,6 +48,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
startInfo: any = []; // 发货地数据
endInfo: any = []; // 卸货地数据
PageStatus = '';
envCache: any;
enterpriseProjectIds: any;
constructor(
private http: _HttpClient,
@ -101,6 +102,15 @@ export class SupplyManagementOnecarPublishComponent 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 {
if (this.route.snapshot?.queryParams?.sta === '1') {
@ -533,56 +543,27 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
};
}
initSF7() {
this.schema7 = {
properties: {
prePay: {
type: 'number',
title: '预付',
minimum: 0,
maximum: 999999,
default: 0,
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: '油卡',
// minimum: 0,
// maximum: 999999,
// default: 0,
// ui: {
// prefix: '¥',
// widgetWidth: 300,
// change: _args => this.payChange()
// } as SFNumberWidgetSchema
// },
receiptPay: {
type: 'number',
title: '回单付',
minimum: 0,
maximum: 999999,
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 },
@ -592,7 +573,6 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
title: '到货后',
ui: {
widget: 'custom',
placeholder: '请输入',
errors: { required: '请输入付款承诺天数' }
}
}
@ -601,7 +581,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
};
this.ui7 = {
'*': {
spanLabelFixed: 90,
spanLabelFixed: 115,
grid: { span: 24 }
}
};
@ -635,19 +615,21 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
Number(this.sf7?.value?.toPay);
console.log(this.totalFees);
}
payChange(value?: any) {
let subtotal: any = {};
let oilCardPay: any = 0;
if (value) {
subtotal = value.prePay + value.toPay + value.receiptPay || 0;
// oilCardPay = value.oilCardPay || 0;
} else {
subtotal = this.sf7.value.prePay + this.sf7.value.toPay + this.sf7.value.receiptPay || 0;
// oilCardPay = this.sf7.value.oilCardPay || 0;
payChange() {
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'
}
console.log(this.sf7.value);
this.service
.request(this.service.$api_getCalculatedSurcharge + `?totalFreight=${subtotal}&fuelCardAmount=${oilCardPay}`)
.request(this.service.$api_getCalculatedSurcharge,params)
.subscribe(res => {
if (res) {
this.sf7.setValue('/appendFee', res.surcharge);
@ -658,8 +640,12 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
.subscribe(res => {
if (res) {
this.currentRate = res.rate * 100;
} else {
this.service.msgSrv.error(res.msg);
}
});
} else {
this.service.msgSrv.error(res.msg);
}
});
}
@ -1139,7 +1125,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
appendFee: res?.shippingInformationVO?.appendFee,
paymentDays: res?.paymentDays
};
this.payChange(this.sf7data);
this.payChange();
}
// 选择地址