From d884571904b7f1e46cd64dafb61417df771071e8 Mon Sep 17 00:00:00 2001 From: wangshiming Date: Thu, 17 Feb 2022 16:45:13 +0800 Subject: [PATCH] fix bug --- .../bulk-release-publish.component.html | 2 +- .../onecar-publish.component.html | 53 ++++++++++-- .../onecar-publish.component.ts | 80 ++++++++----------- .../services/supply-management.service.ts | 2 +- 4 files changed, 82 insertions(+), 55 deletions(-) diff --git a/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.html b/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.html index 8a3b04e9..cf77265f 100644 --- a/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.html +++ b/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.html @@ -97,7 +97,7 @@ 联系人 -
+
- ¥{{ i.value | number: '0.2-2' }} + + + + + + + + + + + + + {{ i.value | currency }} ¥{{ i.value | number: '0.2-2' }}(费率:{{ currentRate | number: '0.2-4' }}%){{ i.value | currency }}(费率:{{ currentRate | number: '0.2-4' }}%) - ¥{{ i.value | number: '0.2-2' }} + {{ i.value | currency }}
-
+
-
-    天内支付运费 +
+  天内支付运费
diff --git a/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.ts b/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.ts index 988e35d1..0afb8f55 100644 --- a/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.ts +++ b/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.ts @@ -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(); } // 选择地址 diff --git a/src/app/routes/supply-management/services/supply-management.service.ts b/src/app/routes/supply-management/services/supply-management.service.ts index 6881bac6..03be2ee6 100644 --- a/src/app/routes/supply-management/services/supply-management.service.ts +++ b/src/app/routes/supply-management/services/supply-management.service.ts @@ -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. */