fix bug
This commit is contained in:
@ -97,7 +97,7 @@
|
||||
</nz-form-item>
|
||||
<nz-form-item>
|
||||
<nz-form-label [nzSpan]="3" nzRequired>联系人</nz-form-label>
|
||||
<div style="display: flex: flex;width: 86%">
|
||||
<div style="display: flex;width: 86%">
|
||||
<nz-form-control [nzErrorTip]="'请输入联系人姓名'">
|
||||
<input
|
||||
nz-input
|
||||
|
||||
@ -280,14 +280,53 @@
|
||||
<div nz-row>
|
||||
<div nz-col nzSpan="9">
|
||||
<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"
|
||||
>¥{{ 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">
|
||||
<div nz-row>
|
||||
<div class="align-center" style="width: 300px">
|
||||
<div class="align-center">
|
||||
<div nz-col nzSpan="16">
|
||||
<nz-input-number
|
||||
[ngModel]="i.value"
|
||||
@ -296,10 +335,12 @@
|
||||
[nzStep]="1"
|
||||
(ngModelChange)="i.setValue($event)"
|
||||
nzPlaceHolder="请输入1-30"
|
||||
[nzPrecision]="0"
|
||||
[nzPrecisionMode]="'cut'"
|
||||
></nz-input-number>
|
||||
</div>
|
||||
<div>
|
||||
<span> 天内支付运费</span>
|
||||
<div nz-col nzSpan="8">
|
||||
<span> 天内支付运费</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
// 选择地址
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* @Author : Shiming
|
||||
* @Date : 2021-12-03 11:10:14
|
||||
* @LastEditors : Shiming
|
||||
* @LastEditTime : 2022-02-17 15:25:57
|
||||
* @LastEditTime : 2022-02-17 16:44:23
|
||||
* @FilePath : \\tms-obc-web\\src\\app\\routes\\supply-management\\services\\supply-management.service.ts
|
||||
* Copyright (C) 2022 huzhenhong. All rights reserved.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user