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

@ -97,7 +97,7 @@
</nz-form-item> </nz-form-item>
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="3" nzRequired>联系人</nz-form-label> <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]="'请输入联系人姓名'"> <nz-form-control [nzErrorTip]="'请输入联系人姓名'">
<input <input
nz-input nz-input

View File

@ -280,14 +280,53 @@
<div nz-row> <div nz-row>
<div nz-col nzSpan="9"> <div nz-col nzSpan="9">
<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"
@ -296,10 +335,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>&nbsp;&nbsp; 天内支付运费</span> <span>&nbsp;天内支付运费</span>
</div> </div>
</div> </div>
</div> </div>

View File

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

View File

@ -4,7 +4,7 @@
* @Author : Shiming * @Author : Shiming
* @Date : 2021-12-03 11:10:14 * @Date : 2021-12-03 11:10:14
* @LastEditors : Shiming * @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 * @FilePath : \\tms-obc-web\\src\\app\\routes\\supply-management\\services\\supply-management.service.ts
* Copyright (C) 2022 huzhenhong. All rights reserved. * Copyright (C) 2022 huzhenhong. All rights reserved.
*/ */