diff --git a/src/app/routes/insurance-management/components/list/list.component.html b/src/app/routes/insurance-management/components/list/list.component.html
index e4dbec7f..a4559f83 100644
--- a/src/app/routes/insurance-management/components/list/list.component.html
+++ b/src/app/routes/insurance-management/components/list/list.component.html
@@ -4,7 +4,7 @@
* @Author : Shiming
* @Date : 2022-01-12 10:52:50
* @LastEditors : Shiming
- * @LastEditTime : 2022-02-24 20:03:23
+ * @LastEditTime : 2022-02-28 17:00:48
* @FilePath : \\tms-obc-web\\src\\app\\routes\\insurance-management\\components\\list\\list.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved.
-->
@@ -91,6 +91,11 @@
{{ item?.billCode }}
+
+
+
+ {{ item?.resourceCode }}
+
{{ item?.resourceStatusLabel }}
diff --git a/src/app/routes/insurance-management/components/list/list.component.ts b/src/app/routes/insurance-management/components/list/list.component.ts
index 6a51122c..b163791f 100644
--- a/src/app/routes/insurance-management/components/list/list.component.ts
+++ b/src/app/routes/insurance-management/components/list/list.component.ts
@@ -412,7 +412,7 @@ export class insuranceManagementListComponent implements OnInit {
{
title: '货源编号',
className: 'text-right',
- index: 'resourceCode',
+ render: 'resourceCode',
width: '150px'
},
{
diff --git a/src/app/routes/order-management/components/vehicle/vehicle.component.ts b/src/app/routes/order-management/components/vehicle/vehicle.component.ts
index 5acae83a..42e4fd1a 100644
--- a/src/app/routes/order-management/components/vehicle/vehicle.component.ts
+++ b/src/app/routes/order-management/components/vehicle/vehicle.component.ts
@@ -12,6 +12,7 @@ import { VehicleFreightPeopleComponent } from '../../modal/vehicle/freight-peopl
import { VehicleModifyCaptainComponent } from '../../modal/vehicle/modify-captain/modify-captain.component';
import { VehicleModifyRateComponent } from '../../modal/vehicle/modify-rate/modify-rate.component';
import { VehicleUpdateFreightComponent } from '../../modal/vehicle/update-freight/update-freight.component';
+import { OneCarOrderViewtrackComponent } from '../../modal/vehicle/view-track/view-track.component';
import { OrderManagementService } from '../../services/order-management.service';
@@ -458,8 +459,8 @@ resourceStatus: any;
},
{
text: '查看轨迹 ',
- click: (_record) => this.cancellation(_record),
- iif: item => item.billStatus == '4' || item.billStatus == '5' || item.billStatus == '2' || item.billStatus == '3',
+ click: (_record) => this.viewTrack(_record),
+ iif: item => item.billStatus !== '1' && item.billStatus !== '6',
// acl: { ability: ['VEHICLE-LIST-view'] },
},
@@ -856,4 +857,22 @@ resourceStatus: any;
}
});
}
+ /**
+ *查看轨迹
+ */
+ viewTrack(item: any) {
+ const modalRef = this.modal.create({
+ nzTitle: '查看轨迹',
+ nzContent: OneCarOrderViewtrackComponent,
+ nzWidth: 1200,
+ nzComponentParams: {
+ i: item,
+ },
+ nzFooter: null
+ });
+ modalRef.afterClose.subscribe((res: boolean) => {
+ if(res) {
+ }
+ });
+ }
}
diff --git a/src/app/routes/order-management/modal/vehicle/cancel-confirm/cancel-confirm.component.ts b/src/app/routes/order-management/modal/vehicle/cancel-confirm/cancel-confirm.component.ts
index 257180aa..dc868538 100644
--- a/src/app/routes/order-management/modal/vehicle/cancel-confirm/cancel-confirm.component.ts
+++ b/src/app/routes/order-management/modal/vehicle/cancel-confirm/cancel-confirm.component.ts
@@ -4,7 +4,7 @@
* @Author : Shiming
* @Date : 2022-02-22 13:53:29
* @LastEditors : Shiming
- * @LastEditTime : 2022-02-22 15:51:53
+ * @LastEditTime : 2022-02-28 15:56:46
* @FilePath : \\tms-obc-web\\src\\app\\routes\\order-management\\modal\\vehicle\\cancel-confirm\\cancel-confirm.component.ts
* Copyright (C) 2022 huzhenhong. All rights reserved.
*/
@@ -75,8 +75,7 @@ export class OneCarOrderCancelConfirmComponent implements OnInit {
initData() {
let indexId = 0
let index = 0
- console.log(this.i);
-
+ let indexSurcharge = 0
this.i?.mybidDetailInfo.forEach((ele: any) => {
if(this.sts == 1) {
// 大宗
@@ -85,25 +84,21 @@ export class OneCarOrderCancelConfirmComponent implements OnInit {
}
if (ele?.paymentStatusLabel == '已支付') {
indexId += 1;
+ indexSurcharge += ele?.surcharge;
}
} else {
// 整车
if (ele?.paymentStatusLabel == '已支付') {
indexId += 1;
index += ele?.price;
+ indexSurcharge += ele?.surcharge;
}
console.log(ele.expenseCode)
}
- if (ele.expenseCode == '"ATT"' || ele.expenseCode == 'ATT'){
- if(ele?.paymentStatusLabel == '已支付') {
- this.ATTPrice = ele.price;
- } else {
- this.ATTPrice = 0;
- }
- }
});
this.index = indexId
this.List = index
+ this.ATTPrice = indexSurcharge
console.log(this.index)
console.log(this.List)
}
diff --git a/src/app/routes/order-management/modal/vehicle/view-track/view-track.component.html b/src/app/routes/order-management/modal/vehicle/view-track/view-track.component.html
new file mode 100644
index 00000000..474bc951
--- /dev/null
+++ b/src/app/routes/order-management/modal/vehicle/view-track/view-track.component.html
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/routes/order-management/modal/vehicle/view-track/view-track.component.less b/src/app/routes/order-management/modal/vehicle/view-track/view-track.component.less
new file mode 100644
index 00000000..14049ec8
--- /dev/null
+++ b/src/app/routes/order-management/modal/vehicle/view-track/view-track.component.less
@@ -0,0 +1,11 @@
+:host {
+ ::ng-deep {
+ .mapBox {
+ iframe, canvas {
+ width: 400px !important;
+ }
+ }
+
+ }
+
+ }
\ No newline at end of file
diff --git a/src/app/routes/order-management/modal/vehicle/view-track/view-track.component.ts b/src/app/routes/order-management/modal/vehicle/view-track/view-track.component.ts
new file mode 100644
index 00000000..dc25b3f4
--- /dev/null
+++ b/src/app/routes/order-management/modal/vehicle/view-track/view-track.component.ts
@@ -0,0 +1,98 @@
+/*
+ * @Description :
+ * @Version : 1.0
+ * @Author : Shiming
+ * @Date : 2022-02-22 13:53:29
+ * @LastEditors : Shiming
+ * @LastEditTime : 2022-02-28 14:37:42
+ * @FilePath : \\tms-obc-web\\src\\app\\routes\\order-management\\modal\\vehicle\\view-track\\view-track.component.ts
+ * Copyright (C) 2022 huzhenhong. All rights reserved.
+ */
+import { Component, OnInit, ViewChild } from '@angular/core';
+import { STColumn } from '@delon/abc/st';
+import {
+ SFComponent,
+ SFCustomWidgetSchema,
+ SFNumberWidgetSchema,
+ SFRadioWidgetSchema,
+ SFSchema,
+ SFTextareaWidgetSchema,
+ SFUISchema
+} from '@delon/form';
+import format from 'date-fns/format';
+import { _HttpClient } from '@delon/theme';
+import { NzMessageService } from 'ng-zorro-antd/message';
+import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
+import { OrderManagementService } from '../../../services/order-management.service';
+
+
+@Component({
+ selector: 'app-order-management-view-track',
+ styleUrls: ['./view-track.component.less'],
+ templateUrl: './view-track.component.html'
+})
+export class OneCarOrderViewtrackComponent implements OnInit {
+ i: any; // 单行数据
+ MapList: any; // 地图数据
+ trajectory = 'car';
+ addressItems: any[] = []; //打点地址数据组
+ logColumns: STColumn[] = [
+ { title: '款项', index: 'expenseCodeLabel' },
+ { title: '小计(元)', render: 'price' },
+ { title: '运输费(元)', render: 'price' },
+ { title: '附加费(元)', render: 'surcharge' },
+ { title: '支付时间', index: 'paymentTime' },
+ {
+ title: '支付状态',
+ className: 'text-center',
+ index: 'paymentStatus',
+ type: 'badge',
+ width: '120px',
+ badge: {
+ '1': { text: '待申请', color: 'warning' },
+ '2': { text: '已支付', color: 'success' },
+ '3': { text: '已拒绝', color: 'warning' },
+ '4': { text: '申请中', color: 'warning' }
+ }
+ }
+ ];
+ constructor(
+ private modalRef: NzModalRef,
+ private modal: NzModalService,
+ private msgSrv: NzMessageService,
+ public service: OrderManagementService
+ ) {}
+
+ ngOnInit(): void {
+ console.log(this.i);
+ this.MapInit();
+
+ }
+ // 获取轨迹
+ MapInit() {
+ this.service.request(this.service.$api_get_getTrajectory, { id: this.i.id }).subscribe(res => {
+ if (res) {
+ const points = res.trackArray;
+ points?.forEach((item: any) => {
+ this.MapList.push({
+ name: item.hgt,
+ lnglat: [Number((Number(item.lon) / 600000).toFixed(6)), Number((Number(item.lat) / 600000).toFixed(6))]
+ });
+ });
+ this.addressItems = res.parkArray;
+ if (this.addressItems && this.addressItems.length > 0) {
+ this.addressItems.forEach(item => {
+ item.parkBte = this.getLocalTime(item.parkBte);
+ item.parkEte = this.getLocalTime(item.parkEte);
+ });
+ }
+ }
+ });
+ }
+ close(value: boolean): void {
+ this.modalRef.close(false);
+ }
+ getLocalTime(time: any) {
+ return format(new Date(parseInt(time)), 'yyyy-MM-dd HH:mm:ss');
+ }
+}
diff --git a/src/app/routes/order-management/order-management.module.ts b/src/app/routes/order-management/order-management.module.ts
index 8d59ea15..b71b0fda 100644
--- a/src/app/routes/order-management/order-management.module.ts
+++ b/src/app/routes/order-management/order-management.module.ts
@@ -36,6 +36,7 @@ import { VehicleModifyRateComponent } from './modal/vehicle/modify-rate/modify-r
import { VehicleSureArriveComponent } from './modal/vehicle/sure-arrive/sure-arrive.component';
import { VehicleSureDepartComponent } from './modal/vehicle/sure-depart/sure-depart.component';
import { VehicleUpdateFreightComponent } from './modal/vehicle/update-freight/update-freight.component';
+import { OneCarOrderViewtrackComponent } from './modal/vehicle/view-track/view-track.component';
import { OrderManagementRoutingModule } from './order-management-routing.module';
const COMPONENTS: Type[] = [
@@ -62,7 +63,8 @@ const COMPONENTS: Type[] = [
OrderManagementReceiptsAuditComponent,
orderManagementVoucherViewComponent,
OrderManagementComplianceAuditComponent,
- OneCarOrderCancelConfirmComponent
+ OneCarOrderCancelConfirmComponent,
+ OneCarOrderViewtrackComponent
];
@NgModule({
diff --git a/src/app/routes/supply-management/components/bulk-publish/bulk-publish.component.ts b/src/app/routes/supply-management/components/bulk-publish/bulk-publish.component.ts
index 9e5c484b..a2222101 100644
--- a/src/app/routes/supply-management/components/bulk-publish/bulk-publish.component.ts
+++ b/src/app/routes/supply-management/components/bulk-publish/bulk-publish.component.ts
@@ -412,6 +412,7 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
grid: { lg: 8, md: 12, sm: 12, xs: 24 }
},
$carModel: {
+ spanLabelFixed: 120,
grid: { span: 8 }
},
$carLength: {
diff --git a/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.ts b/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.ts
index 94e45979..35f68fc2 100644
--- a/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.ts
+++ b/src/app/routes/supply-management/components/bulk-release-publish/bulk-release-publish.component.ts
@@ -435,6 +435,7 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
grid: { lg: 8, md: 12, sm: 12, xs: 24 }
},
$carModel: {
+ spanLabelFixed: 120,
grid: { span: 8 }
},
$carLength: {
diff --git a/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.html b/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.html
index 4b2384b3..3547171e 100644
--- a/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.html
+++ b/src/app/routes/supply-management/components/onecar-publish/onecar-publish.component.html
@@ -33,10 +33,10 @@
@@ -69,7 +69,7 @@
-
@@ -131,7 +131,7 @@
-
+
添加卸货地
@@ -144,12 +144,11 @@
装货时间
+ nzShowTime
+ nzFormat="yyyy-MM-dd HH:mm:ss"
+ formControlName="loadingTime"
+ [nzDisabledDate]="disabledDateStart"
+ >
@@ -158,13 +157,7 @@
卸货时间
-
+
@@ -172,55 +165,56 @@
-
货物信息
@@ -353,7 +347,7 @@
acl [acl-ability]="['SUPPLY-VEHICLE-AMEND-submitChange']">提交修改
指派熟车
- 司机抢单
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 66f3d209..edebb36b 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
@@ -1,6 +1,7 @@
import { Component, OnInit, ViewChild } from '@angular/core';
-import { debounceTime } from 'rxjs/operators';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
+import differenceInCalendarDays from 'date-fns/differenceInCalendarDays';
+import format from 'date-fns/format';
import { Subject } from 'rxjs';
import { ActivatedRoute, Router } from '@angular/router';
import {
@@ -14,9 +15,8 @@ import {
SFUISchema
} from '@delon/form';
import { _HttpClient } from '@delon/theme';
-import { AmapPoiPickerComponent, AmapService, ShipperBaseService } from '@shared';
+import { AmapPoiPickerComponent, AmapService, EACacheService, ShipperBaseService } from '@shared';
import { NzModalService } from 'ng-zorro-antd/modal';
-import { type } from 'os';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';
import { SupplyManagementService } from '../../services/supply-management.service';
@@ -24,13 +24,22 @@ import { SupplyManagementVehicleAssignedCarComponent } from '../assigned-car/ass
import { TranAgreementComponent } from '../tran-agreement/tran-agreement.component';
import { PublishAddressListComponent } from './address-list/address-list.component';
import { PublishSuccessComponent } from './publish-success/publish-success.component';
+import { cacheConf } from '@conf/cache.conf';
+
@Component({
selector: 'app-publish-goods-onecar-publish',
templateUrl: './onecar-publish.component.html',
styleUrls: ['./onecar-publish.component.less']
})
export class SupplyManagementOnecarPublishComponent implements OnInit {
+ // 环境信息 appId、tenantId
+ envInfo = this.eaCacheSrv.get(cacheConf.env);
validateForm1: FormGroup;
+ limitValues = {
+ maxWeight: 99999,
+ maxVolume: 99999,
+ maxPiece: 99999
+ };
sf1data: any; // 货源单设置回显
sf3data: any; // 货源单设置回显
sf4data: any; // 货源单设置回显
@@ -61,18 +70,14 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
private modalService: NzModalService,
public service: SupplyManagementService,
private amapService: AmapService,
- public shipperSrv: ShipperBaseService
+ public shipperSrv: ShipperBaseService,
+ private eaCacheSrv: EACacheService
) {
this.validateForm1 = fb.group({
- loadAddress0: [null, [Validators.required]],
- loadName0: [null, [Validators.required]],
- loadPhone0: [null, [Validators.required, Validators.pattern('^[0-9]*$')]],
- unloadAddress0: [null, [Validators.required]],
- unloadName0: [null, [Validators.required]],
- unloadPhone0: [null, [Validators.required, Validators.pattern('^[0-9]*$')]],
- loadingTime: [null, []],
- unloadingTime: [null, []]
+ loadingTime: [null, [Validators.required]],
+ unloadingTime: [null, [Validators.required]]
});
+ this.envCache = this.eaCacheSrv.get(cacheConf.env);
}
@ViewChild('sf1', { static: false }) sf1!: SFComponent;
schema1: SFSchema = {};
@@ -105,15 +110,14 @@ 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});
+ 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(',','');
+ return `¥ 0.00`;
+ };
+ parserRmb = (value: string): string => value.replace('¥ ', '').replace(',', '');
// 页面初始化
ngOnInit(): void {
if (this.route.snapshot?.queryParams?.sta === '1') {
@@ -127,8 +131,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.initSF5();
this.initSF6();
this.initSF7();
+ this.getLimitvalue();
this.initdata();
- this.getInsurers()
}
initSF1() {
this.schema1 = {
@@ -336,13 +340,13 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
ui: {
widget: 'select',
mode: 'multiple',
- maxMultipleCount:3,
+ maxMultipleCount: 3,
placeholder: '请选择车型',
errors: { required: '请选择车型' },
asyncData: () => this.service.getDictOptions({ dictKey: 'car:model' }),
- change:(tag:any , org:any)=>{
- if(tag.includes("999")){
- this.sf4.setValue('/carModel',["999"]);
+ change: (tag: any, org: any) => {
+ if (tag.includes('999')) {
+ this.sf4.setValue('/carModel', ['999']);
}
}
}
@@ -353,17 +357,17 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
ui: {
widget: 'select',
mode: 'multiple',
- maxMultipleCount:3,
+ maxMultipleCount: 3,
placeholder: '请选择车长',
errors: { required: '请选择车长' },
asyncData: () => this.service.getDictOptions({ dictKey: 'car:length' }),
- change:(tag:any , org:any)=>{
- if(tag.includes("999")){
- this.sf4.setValue('/carModel',["999"]);
+ change: (tag: any, org: any) => {
+ if (tag.includes('999')) {
+ this.sf4.setValue('/carModel', ['999']);
}
}
}
- },
+ }
},
required: ['weight', 'carModel', 'carLength']
};
@@ -397,8 +401,17 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
type: 'string',
title: '增值服务套餐',
ui: {
- widget: 'dict-select',
- params: { dictKey: 'bill:insurance:type' },
+ widget: 'select',
+ asyncData: () => {
+ return this.service.request(this.service.$api_getDictValue, { dictKey: 'bill:insurance:type' }).pipe(
+ map((res: any) => {
+ return [...res];
+ })
+ );
+ },
+ change: (tag: any, org: any) => {
+ this.getInsurersPrice(tag);
+ }
},
default: '3'
},
@@ -409,7 +422,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
readOnly: true,
ui: {
widget: 'checkbox',
- visibleIf: { insuranceType: (value: string) => value === '0' }
+ visibleIf: { insuranceType: (value: string) => value === '1' }
} as SFCheckboxWidgetSchema,
default: ['车辆实时定位', '轨迹查询', '数据保护', '赠送基本险']
},
@@ -420,7 +433,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
readOnly: true,
ui: {
widget: 'checkbox',
- visibleIf: { insuranceType: (value: string) => value === '1' }
+ visibleIf: { insuranceType: (value: string) => value === '2' }
} as SFCheckboxWidgetSchema,
default: ['车辆实时定位', '轨迹查询', '数据保护', '专属技术服务', '赠送综合险']
},
@@ -432,21 +445,22 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
visibleIf: { insuranceType: (value: string) => value !== '3' }
}
},
- insurancePackagedGoods:{
+ insurancePackagedGoods: {
type: 'string',
title: '货物包装',
ui: {
widget: 'dict-select',
params: { dictKey: 'insure:packaged:goods' },
+ containsAllLabel: false,
visibleIf: { insuranceType: (value: string) => value !== '3' }
} as SFSelectWidgetSchema
},
- hidenField:{
+ hidenField: {
type: 'string',
title: '',
- default:' ',
+ default: ' ',
ui: {
- widget:'text'
+ widget: 'text'
}
},
goodsValue: {
@@ -463,6 +477,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
title: '',
ui: {
widget: 'custom',
+ validator: val => this.customValidator(val),
visibleIf: { insuranceType: (value: string) => value !== '3' }
}
},
@@ -472,26 +487,43 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
ui: {
hidden: true
}
- },
+ }
},
- required: ['insurancePackagedGoods']
+ required: ['insurancePackagedGoods', 'insurancePremium']
};
this.ui5 = {
'*': {
spanLabelFixed: 115,
grid: { span: 12 }
},
- $type1:{
+ $type1: {
grid: { span: 24 }
},
- $type2:{
+ $type2: {
grid: { span: 24 }
},
- $freeInsurance:{
+ $freeInsurance: {
grid: { span: 24 }
- },
+ }
};
}
+ /**
+ * 自定义校验数据
+ * @param val
+ */
+ customValidator(val: number) {
+ if (this.isEmpty(val)) {
+ return [{ keyword: 'required', message: '不能为空' }];
+ } else {
+ if (val <= 0) {
+ return [{ keyword: 'required', message: '数值需大于0' }];
+ }
+ return [];
+ }
+ }
+ isEmpty(val: any) {
+ return val === undefined || val === null || val.toString().trim() === '';
+ }
initSF6() {
this.schema6 = {
properties: {
@@ -522,45 +554,65 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
}
},
+ receiptAddress: {
+ type: 'string',
+ title: '回单收件人信息',
+ ui: {
+ widget: 'custom',
+ placeholder: '请点击选择回单收件人信息',
+ // validator: val => (this.sf6?.value?.receiptType === '2' ? [{ keyword: 'required', message: '请点击选择收回单地址' }] : []),
+ visibleIf: {
+ receiptType: value => value === '2'
+ }
+ },
+ default: ''
+ },
+ receiptAddressId: {
+ type: 'string',
+ title: '',
+ ui: {
+ hidden: true
+ }
+ },
receiptUserName: {
type: 'string',
title: '联系人',
- maxLength: 15,
ui: {
visibleIf: {
receiptType: value => value === '2'
}
- }
+ },
+ readOnly: true
},
- receiptUserPhone: {
+ phon: {
type: 'string',
title: '联系电话',
- maxLength: 11,
ui: {
visibleIf: {
receiptType: value => value === '2'
}
- }
+ },
+ readOnly: true
},
- receiptAddressArea: {
+ area: {
type: 'string',
title: '所在地区',
- maxLength: 30,
ui: {
visibleIf: {
receiptType: value => value === '2'
}
- }
+ },
+ readOnly: true
},
- receiptAddress: {
+ address: {
type: 'string',
title: '详细地址',
- maxLength: 30,
ui: {
visibleIf: {
receiptType: value => value === '2'
}
- }
+ },
+ readOnly: true
},
remarks: {
type: 'string',
@@ -573,11 +625,11 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
} as SFTextareaWidgetSchema
}
},
- required: ['stateReceipt', 'receiptType', 'receiptUserName', 'receiptUserPhone', 'receiptAddressArea', 'receiptAddress']
+ required: ['stateReceipt', 'receiptType', 'receiptAddress']
};
this.ui6 = {
'*': {
- spanLabelFixed: 90,
+ spanLabelFixed: 115,
grid: { span: 24 }
}
};
@@ -590,19 +642,19 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
type: 'number',
title: '预付',
default: 0,
- ui: {widget: 'custom'}
+ ui: { widget: 'custom' }
},
toPay: {
type: 'number',
title: '到付',
default: 0,
- ui: { widget: 'custom'}
+ ui: { widget: 'custom' }
},
receiptPay: {
type: 'number',
title: '回单付',
default: 0,
- ui: {widget: 'custom'}
+ 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 },
@@ -646,50 +698,42 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
});
}
- changeValue() {
- this.totalFees =
- Number(this.sf7?.value?.appendFee) +
- Number(this.sf7?.value?.prePay) +
- Number(this.sf7?.value?.receiptPay) +
- Number(this.sf7?.value?.toPay);
- console.log(this.totalFees);
- }
payChange() {
const prePay = this.sf7.value.prePay || 0;
- const toPay = this.sf7.value.toPay || 0
+ const toPay = this.sf7.value.toPay || 0;
const receiptPay = this.sf7.value.receiptPay || 0;
- // const oilCardPay = 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,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 => {
- if (res) {
- this.currentRate = res.rate * 100;
- } else {
- this.service.msgSrv.error(res.msg);
- }
- });
- } else {
- this.service.msgSrv.error(res.msg);
- }
- });
+ totalFreight: subtotal,
+ fuelCardAmount: oilCardPay,
+ resourcetype: '1'
+ };
+ this.service.request(this.service.$api_getCalculatedSurcharge, params).subscribe(res => {
+ console.log('999');
+ console.log(this.envCache);
+ 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_getAdditionalRate +
+ `?shipperId=${this.envCache?.enterpriseId}&enterpriseInfoId=${this?.enterpriseProjectIds}&resourcetype='1'`
+ )
+ .subscribe(res => {
+ if (res) {
+ this.currentRate = res.rate * 100;
+ }
+ });
+ } else {
+ this.service.msgSrv.error(res.msg);
+ }
+ });
}
- // 添加 删除发货卸货地址
- addStartInfo(_event: any) {
+ addStartInfo() {
if (this.startInfo.length < 5) {
const controlId = this.startInfo.length;
this.startInfo.push({
@@ -701,29 +745,37 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
province: '',
city: '',
area: '',
- type: 1
+ type: '1'
});
this.validateForm1.addControl(`loadAddress${controlId}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`loadName${controlId}`, new FormControl(null, Validators.required));
- this.validateForm1.addControl(`loadPhone${controlId}`, new FormControl(null, Validators.required));
+ this.validateForm1.addControl(`loadPhone${controlId}`, new FormControl(null, [Validators.required, Validators.pattern('^[0-9]*$')]));
}
}
- // 添加 删除发货卸货地址
- subStartInfo(event: any, index: number, id?: any) {
- console.log(event, index, id);
- if (id) {
- this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe(res => {
- console.log(res);
- });
- }
+
+ getLimitvalue() {
+ // 货物核载信息最大值
+ // 货物运输费(小计)最大值
+ const getlimitvaluesParms = [this.service.limitKeys.weight, this.service.limitKeys.volume, this.service.limitKeys.piece];
+ this.service.request(this.service.$api_findItemValueByItemKeys, getlimitvaluesParms).subscribe(res => {
+ const maxWeight = res.filter((item: any) => item.itemKey === this.service.limitKeys.weight)[0].itemValue;
+ const maxVolume = res.filter((item: any) => item.itemKey === this.service.limitKeys.volume)[0].itemValue;
+ const maxPiece = res.filter((item: any) => item.itemKey === this.service.limitKeys.piece)[0].itemValue;
+ this.limitValues = {
+ maxWeight: Number(maxWeight),
+ maxVolume: Number(maxVolume),
+ maxPiece: Number(maxPiece)
+ };
+ });
+ }
+ subStartInfo(event: any, index: number) {
this.startInfo.splice(index, 1);
this.validateForm1.removeControl(`loadAddress${index}`);
this.validateForm1.removeControl(`loadName${index}`);
this.validateForm1.removeControl(`loadPhone${index}`);
}
- // 添加 删除发货卸货地址
- addEndInfo(_event: any) {
- if (this.addEndInfo.length < 5) {
+ addEndInfo() {
+ if (this.endInfo.length < 5) {
const controlId = this.endInfo.length;
this.endInfo.push({
detailedAddress: '',
@@ -734,21 +786,17 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
province: '',
city: '',
area: '',
- type: 2
+ type: '2'
});
this.validateForm1.addControl(`unloadAddress${controlId}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`unloadName${controlId}`, new FormControl(null, Validators.required));
- this.validateForm1.addControl(`unloadPhone${controlId}`, new FormControl(null, Validators.required));
+ this.validateForm1.addControl(
+ `unloadPhone${controlId}`,
+ new FormControl(null, [Validators.required, Validators.pattern('^[0-9]*$')])
+ );
}
}
- // 添加 删除发货卸货地址
- subEndInfo(event: any, index: number, id?: any) {
- if (id) {
- this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe(res => {
- console.log(res);
- });
- }
- console.log(event, index, id);
+ subEndInfo(event: any, index: number) {
this.endInfo.splice(index, 1);
this.validateForm1.removeControl(`unloadAddress${index}`);
this.validateForm1.removeControl(`unloadName${index}`);
@@ -773,10 +821,12 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
.subscribe(res => {
if (res) {
this.sf3.getProperty('/goodsNameId')!.schema.enum = res;
- this.sf3.getProperty('/goodsNameId')!.widget?.reset(res);
+ this.sf3.getProperty('/goodsNameId')!.widget.reset(res);
if (this.sf3data.goodsNameId) {
this.sf3.setValue('/goodsNameId', this.sf3data.goodsNameId);
}
+ } else {
+ this.service.msgSrv.error(res.msg);
}
});
}
@@ -812,26 +862,76 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
});
}
// 提交前确认,委托运输协议弹窗
- submitConfirm(submitType?: any) {
+ submitConfirm(submitType?: string) {
Object.keys(this.validateForm1.controls).forEach(key => {
this.validateForm1.controls[key].markAsDirty();
this.validateForm1.controls[key].updateValueAndValidity();
});
- this.sf1.validator({ emitError: true });
this.sf3.validator({ emitError: true });
this.sf4.validator({ emitError: true });
+ this.sf5.validator({ emitError: true });
this.sf6.validator({ emitError: true });
this.sf7.validator({ emitError: true });
- console.log(this.sf1.valid);
- if (this.validateForm1.invalid || !this.sf3.valid || !this.sf1.valid || !this.sf4.valid || !this.sf6.valid || !this.sf7.valid) {
+ console.log(this.validateForm1.invalid)
+ console.log(this.sf4.valid)
+ console.log(this.sf5.valid)
+ console.log(this.sf6.valid)
+ console.log(this.sf7.valid)
+ if (this.validateForm1.invalid || !this.sf3.valid || !this.sf4.valid || !this.sf5.valid || !this.sf6.valid || !this.sf7.valid) {
+ this.service.msgSrv.warning('请完善必填项!');
+ return;
+ }
+ if (this.validateForm1.value.loadingTime < new Date()) {
+ this.service.msgSrv.warning('装货时间必须大于当前时间!');
+ return;
+ }
+ if (this.validateForm1.value.loadingTime > this.validateForm1.value.unloadingTime) {
+ this.service.msgSrv.warning('装货时间不能大于卸货时间!');
+ return;
+ }
+ if (this.sf7.value.total <= 0) {
+ this.service.msgSrv.warning('总费用不能为0!');
return;
}
+ if (
+ this.sf4.value.weight > this.limitValues.maxWeight ||
+ this.sf4.value.volume > this.limitValues.maxVolume ||
+ this.sf4.value.number > this.limitValues.maxPiece
+ ) {
+ this.service.msgSrv.error(
+ `当前货物核载信息已超出限定值【${this.limitValues.maxWeight}吨、${this.limitValues.maxVolume}方、${this.limitValues.maxPiece}件】`
+ );
+ return;
+ }
+
+ const getFreightParms = { carLengthKeys: this.sf4.value.carLength, km: this.totalDistance };
+ this.service.request(this.service.$api_getFreight, getFreightParms).subscribe(res => {
+ if (this.sf7.value.subtotal > res.maxPrice) {
+ this.service.msgSrv.error(`运费过高,请调整录入`);
+ return;
+ } else if (this.sf7.value.subtotal > res.ewPrice) {
+ this.modalService.confirm({
+ nzTitle: '',
+ nzContent: `您的录入的运费过高,可能会影响支付,请仔细确认`,
+ nzOkText: '继续',
+ nzCancelText: '取消',
+ nzOnOk: () => {
+ this.agreementConfirm(submitType);
+ }
+ });
+ } else {
+ this.agreementConfirm(submitType);
+ }
+ });
+ }
+ // 提交前协议弹窗
+ agreementConfirm(submitType?: string) {
const modalRef = this.modalService.create({
nzTitle: '运输协议',
nzContent: TranAgreementComponent,
nzWidth: 900,
- nzFooter: null,
+ nzFooter: null
});
modalRef.afterClose.subscribe(result => {
if (result) {
@@ -841,73 +941,77 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
// 提交
submit(submitType?: string): void {
- Object.keys(this.validateForm1.controls).forEach(key => {
- this.validateForm1.controls[key].markAsDirty();
- this.validateForm1.controls[key].updateValueAndValidity();
- });
- this.sf1.validator({ emitError: true });
- this.sf3.validator({ emitError: true });
- this.sf4.validator({ emitError: true });
- this.sf6.validator({ emitError: true });
- this.sf7.validator({ emitError: true });
- console.log(this.sf1.valid);
- if (this.validateForm1.invalid || !this.sf3.valid || !this.sf1.valid || !this.sf4.valid || !this.sf6.valid || !this.sf7.valid) {
- return;
+ //装卸货信息
+ const LoadingList = this.startInfo.concat(this.endInfo);
+
+ // 货物信息
+ const sf3Values = { ...this.sf3.value };
+ if (sf3Values.goodsTypeName === '其它') {
+ sf3Values.goodsName = sf3Values.goodsName1;
+ delete sf3Values.goodsName1;
}
- console.log(this?.loadingTime);
- console.log(this?.unloadingTime);
- if (typeof this.unloadingTime !== 'string') {
- var c = new Date(this.unloadingTime);
- this.unloadingTime =
- c.getFullYear() +
- '-' +
- this.addPreZero(c.getMonth() + 1) +
- '-' +
- this.addPreZero(c.getDate()) +
- ' ' +
- this.addPreZero(c.getHours()) +
- ':' +
- this.addPreZero(c.getMinutes()) +
- ':' +
- this.addPreZero(c.getSeconds());
+ if (this.sf4.value.carModel.includes('999')) {
+ this.sf4.value.carModel = ['999'];
}
- if (typeof this.loadingTime !== 'string') {
- var c = new Date(this.loadingTime);
- this.loadingTime =
- c.getFullYear() +
- '-' +
- this.addPreZero(c.getMonth() + 1) +
- '-' +
- this.addPreZero(c.getDate()) +
- ' ' +
- this.addPreZero(c.getHours()) +
- ':' +
- this.addPreZero(c.getMinutes()) +
- ':' +
- this.addPreZero(c.getSeconds());
+ if (this.sf4.value.carLength.includes('999')) {
+ this.sf4.value.carLength = ['999'];
}
- console.log(this.loadingTime)
- const params: any = {
+ const goodsInfoVOList = [
+ {
+ ...sf3Values,
+ ...this.sf4.value,
+ carModel: this.sf4.value.carModel.join(','),
+ carLength: this.sf4.value.carLength.join(',')
+ }
+ ];
+ // 运费信息
+ const expenseList = [
+ { expenseCode: 'PRE', expenseName: '预付', price: this.sf7.value.prePay || 0, id: this.sf7data?.prePayId || '' },
+ { expenseCode: 'RECE', expenseName: '到付', price: this.sf7.value.toPay || 0, id: this.sf7data?.toPayId || '' },
+ { expenseCode: 'BACK', expenseName: '回单付', price: this.sf7.value.receiptPay || 0, id: this.sf7data?.receiptPayId || '' }
+ ];
+
+ // 从“再下一单”过来,将所有的子参数内的id都删除
+ if ((this.PageStatus = '整车下一单')) {
+ LoadingList.forEach((ele: any) => {
+ delete ele.id;
+ });
+ goodsInfoVOList.forEach((ele: any) => {
+ delete ele.id;
+ });
+ expenseList.forEach((ele: any) => {
+ delete ele.id;
+ });
+ }
+ const params = {
+ id: '',
...this.sf1.value,
+ unLoadingPlaceDTOList: LoadingList,
+ unloadingTime: format(this.validateForm1.value.unloadingTime, 'yyyy-MM-dd HH:mm:ss'),
+ loadingTime: format(this.validateForm1.value.loadingTime, 'yyyy-MM-dd HH:mm:ss'),
+ goodsInfoDTOList: goodsInfoVOList,
...this.sf5.value,
...this.sf6.value,
- paymentDays: this.sf7.value.paymentDays,
- loadingTime: this.loadingTime,
- unloadingTime: this.unloadingTime,
- unLoadingPlaceDTOList: [...this.startInfo, ...this.endInfo],
- goodsInfoDTOList: [
- {
- ...this.sf4.value,
- ...this.sf3.value,
- carModel: this.sf4.value.carModel.join(','),
- carLength: this.sf4.value.carLength.join(',')
- }
- ]
- };
- params.shippingInformationDTO = {
- ...this.sf7.value,
- totalFees: this.totalFees
+ expenseDTOList: expenseList,
+ paymentDays: this.sf7.value.paymentDays
};
+ // const params: any = {
+ // ...this.sf1.value,
+ // ...this.sf5.value,
+ // ...this.sf6.value,
+ // paymentDays: this.sf7.value.paymentDays,
+ // loadingTime: this.loadingTime,
+ // unloadingTime: this.unloadingTime,
+ // unLoadingPlaceDTOList: [...this.startInfo, ...this.endInfo],
+ // goodsInfoDTOList: [
+ // {
+ // ...this.sf4.value,
+ // ...this.sf3.value,
+ // carModel: this.sf4.value.carModel.join(','),
+ // carLength: this.sf4.value.carLength.join(',')
+ // }
+ // ]
+ // };
console.log(params);
if (submitType) {
if (submitType == 'assign') {
@@ -979,6 +1083,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe((res: any) => {
this.totalDistance = res.distance;
this.totalTime = res.time;
+ this.getInsurersPrice(); // 计算保费金额
});
}
}
@@ -1088,14 +1193,14 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.validateForm1.addControl(`unloadName${controlId}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`unloadPhone${controlId}`, new FormControl(null, Validators.required));
}
-
- // 计算里程,时间
- if (this.startInfo?.[0]?.area && this.endInfo?.[0]?.area) {
- this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
- this.totalDistance = res.distance;
- this.totalTime = res.time;
- });
- }
+
+ // 计算里程,时间
+ if (this.startInfo?.[0]?.area && this.endInfo?.[0]?.area) {
+ this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
+ this.totalDistance = res.distance;
+ this.totalTime = res.time;
+ });
+ }
});
this.sf3data = {
@@ -1108,26 +1213,27 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.sf3data.goodsName1 = res?.goodsInfoVOList[0]?.goodsName || '';
}
this.changeGoodsType(this.sf3data.goodsTypeId, { label: this.sf3data.goodsTypeName, value: this.sf3data.goodsTypeId });
- this.sf4data = {
- weight: res?.goodsInfoVOList[0]?.weight,
- volume: res?.goodsInfoVOList[0]?.volume,
- vehicleDemand: res?.goodsInfoVOList[0]?.vehicleDemand,
- carLength: res?.goodsInfoVOList[0]?.carLength?.split(','),
- carModel: res?.goodsInfoVOList[0]?.carModel?.split(',') || '',
- number: res?.goodsInfoVOList[0]?.number,
- goodsTypeName: res?.goodsInfoVOList[0]?.goodsTypeName,
- modifyUserId: res?.goodsInfoVOList[0]?.modifyUserId,
- resourceId: res?.goodsInfoVOList[0]?.resourceId,
- rule: res?.goodsInfoVOList[0]?.rule,
- settlementBasis: res?.goodsInfoVOList[0]?.settlementBasis
- };
+
if (res?.loadingTime) {
this.loadingTime = res?.loadingTime;
}
if (res?.unloadingTime) {
this.unloadingTime = res?.unloadingTime;
}
-
+ this.validateForm1.patchValue(
+ {
+ loadingTime: new Date(Date.parse(res.loadingTime.replace(/-/g, '/'))),
+ unloadingTime: new Date(Date.parse(res.unloadingTime.replace(/-/g, '/')))
+ },
+ { onlySelf: true }
+ );
+ this.sf4data = {
+ weight: res?.goodsInfoVOList[0]?.weight || '',
+ volume: res?.goodsInfoVOList[0]?.volume || '',
+ number: res?.goodsInfoVOList[0]?.number || '',
+ carModel: res?.goodsInfoVOList[0]?.carModel?.split(',') || [],
+ carLength: res?.goodsInfoVOList[0]?.carLength?.split(',') || []
+ };
if (this.PageStatus === '整车修改') {
this.sf4data.id = res?.goodsInfoVOList[0]?.id;
}
@@ -1203,48 +1309,29 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
default:
break;
}
+ // 计算里程,时间
+ if (this.startInfo[0]?.area && this.endInfo[0]?.area) {
+ this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
+ this.totalDistance = res.distance;
+ this.totalTime = res.time;
+ this.getInsurersPrice(); //计算保费金额
+ });
+ }
}
});
}
- changeUn(event: Date) {
- console.log(event)
- this.unloadingTime = event;
- if(typeof this.loadingTime === 'string') {
- var a = new Date(this.loadingTime)
- if ( a > this.unloadingTime?.getTime() ) {
- this.service.msgSrv.error('卸货时间不能小于装货时间!');
- this.unloadingTime = '';
- }
- } else {
- if ( this.loadingTime?.getTime() > this.unloadingTime?.getTime() ) {
- this.service.msgSrv.error('卸货时间不能小于装货时间!');
- this.unloadingTime = '';
- }
- }
- }
- changeLO(event: Date) {
- this.loadingTime = event;
- if(typeof this.unloadingTime === 'string') {
- var a = new Date(this.unloadingTime)
- if ( a.getTime()< this.loadingTime?.getTime()) {
- this.service.msgSrv.error('装货时间不能大于卸货时间!');
- this.loadingTime = '';
- }
- } else {
- if ( this.unloadingTime?.getTime()< this.loadingTime?.getTime()) {
- this.service.msgSrv.error('装货时间不能大于卸货时间!');
- this.loadingTime = '';
- }
- }
- }
+ // 不可选择的时间
+ disabledDateStart = (current: Date): boolean => {
+ return differenceInCalendarDays(new Date(), current) > 0;
+ };
// 装卸货地址互换
- swapAddress(){
- this.startInfo.forEach((element:any, index:any) => {
+ swapAddress() {
+ this.startInfo.forEach((element: any, index: any) => {
this.validateForm1.removeControl(`loadAddress${index}`);
this.validateForm1.removeControl(`loadName${index}`);
this.validateForm1.removeControl(`loadPhone${index}`);
});
- this.endInfo.forEach((element:any, index:any) => {
+ this.endInfo.forEach((element: any, index: any) => {
this.validateForm1.removeControl(`unloadAddress${index}`);
this.validateForm1.removeControl(`unloadName${index}`);
this.validateForm1.removeControl(`unloadPhone${index}`);
@@ -1254,13 +1341,13 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.startInfo = this.endInfo;
this.endInfo = item;
- this.startInfo.forEach((element:any,index:any) => {
+ this.startInfo.forEach((element: any, index: any) => {
element.type = '1';
this.validateForm1.addControl(`loadAddress${index}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`loadName${index}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`loadPhone${index}`, new FormControl(null, [Validators.required, Validators.pattern('^[0-9]*$')]));
});
- this.endInfo.forEach((element:any,index:any) => {
+ this.endInfo.forEach((element: any, index: any) => {
element.type = '2';
this.validateForm1.addControl(`unloadAddress${index}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`unloadName${index}`, new FormControl(null, Validators.required));
@@ -1271,78 +1358,27 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
this.totalDistance = res.distance;
this.totalTime = res.time;
+ this.getInsurersPrice(); //计算保费金额
});
}
}
- goodsValuesChange(value: any) {
- console.log(value);
- console.log(this.totalDistance);
-
- if(value >= 50000 && this.totalDistance > 0){
+ // 计算保价费金额
+ getInsurersPrice(insuranceType = this.sf5.value.insuranceType) {
+ if (this.sf5.value.goodsValue >= 50000 && this.totalDistance > 0) {
const params = {
- goodsValue: value,
- insuranceType: this.sf55.value.insuranceType,
+ insuranceType,
+ goodsValue: this.sf5.value.goodsValue,
km: this.totalDistance
};
- this.service
- .request(this.service.$api_getWholeInsuranceInfo, params)
- .subscribe(res => {
- if (res) {
- this.sf5.setValue('/insurancePremium',res.insurancePremium);
- }else{
- this.sf5.setValue('/insurancePremium',null);
- }
+ this.service.request(this.service.$api_getWholeInsuranceInfo, params).subscribe(res => {
+ if (res) {
+ this.sf5.setValue('/insurancePremium', res.insurancePremium);
+ this.sf5.setValue('/insuranceRate', res.insuranceRate);
+ } else {
+ this.sf5.setValue('/insurancePremium', null);
+ this.sf5.setValue('/insuranceRate', null);
+ }
});
}
}
- getInsurersPrice($event?: any) {
- console.log($event);
- this.changeSub.next(`${$event}`);
-
-
- }
- getInsurers($event?: any) {
- this.changeSub.pipe(debounceTime(500)).subscribe((res: any) => {
- console.log(res)
- if (res) {
- console.log(res)
- if(res > 3000000 ) {
- console.log('1111')
- this.sf5.getProperty('/goodsValue')!.widget.reset(3000000);
- this.sf5.setValue('/goodsValue', 3000000);
- this.service.msgSrv.error('请输入50000-3000000之间数值!')
- }
- if(res < 50000) {
- // this.sf5.setValue('/goodsValue', 50000);
- this.sf5.getProperty('/goodsValue')!.widget.reset(50000);
- this.sf5.setValue('/goodsValue', 50000);
-
- console.log('2222')
- this.service.msgSrv.error('请输入50000-3000000之间数值!')
- }
- if (this.sf5.value.goodsValue >= 50000) {
- if(this.totalDistance <=0){
- this.service.msgSrv.warning('当前装卸货距离为0,无法计算保价费金额');
- return;
- }
- const params = {
- goodsValue: this.sf5.value.goodsValue,
- insuranceType: this.sf5.value.insuranceType,
- km: this.totalDistance
- };
- this.service.request(this.service.$api_getWholeInsuranceInfo, params).subscribe(res => {
- if (res) {
- this.sf5.setValue('/insurancePremium', res.insurancePremium);
- this.sf5.setValue('/insuranceRate', res.insuranceRate);
- } else {
- this.sf5.setValue('/insurancePremium', null);
- this.sf5.setValue('/insuranceRate', null);
- }
- });
- }
- }
-
- });
- }
-
}
diff --git a/src/app/routes/supply-management/components/release-publish/release-publish.component.html b/src/app/routes/supply-management/components/release-publish/release-publish.component.html
index 90b3a193..e8cf8c34 100644
--- a/src/app/routes/supply-management/components/release-publish/release-publish.component.html
+++ b/src/app/routes/supply-management/components/release-publish/release-publish.component.html
@@ -158,7 +158,12 @@
装货时间
-
+
@@ -167,7 +172,7 @@
卸货时间
-
+
diff --git a/src/app/routes/supply-management/components/release-publish/release-publish.component.ts b/src/app/routes/supply-management/components/release-publish/release-publish.component.ts
index df1da26e..8eeedaa6 100644
--- a/src/app/routes/supply-management/components/release-publish/release-publish.component.ts
+++ b/src/app/routes/supply-management/components/release-publish/release-publish.component.ts
@@ -2,6 +2,7 @@ import { Component, OnInit, ViewChild } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { cacheConf } from '@conf/cache.conf';
+import differenceInCalendarDays from 'date-fns/differenceInCalendarDays';
import {
SFCheckboxWidgetSchema,
SFComponent,
@@ -241,7 +242,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
ui: {
widget: 'select',
placeholder: '请选择',
- errors: { required: '请选择货物类型' },
+ errors: { required: '请选择货物名称' },
asyncData: () =>
this.shipperSrv.loadConfigByKey('goods.name.config.type').pipe(
map((data: any) => {
@@ -270,7 +271,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
widget: 'select',
placeholder: '请选择',
errors: { required: '请填写货物名称' },
- change: (_value: any, data: any) => {
+ change: (value: any, data: any) => {
this.sf3.setValue('/goodsName', data.label);
},
visibleIf: {
@@ -299,11 +300,11 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
}
}
},
- required: ['goodsTypeId', 'goodsName', 'goodsNameId']
+ required: ['goodsTypeId', 'goodsName', 'goodsNameId', 'goodsName1']
};
this.ui3 = {
'*': {
- spanLabelFixed: 90,
+ spanLabelFixed: 115,
grid: { span: 12 }
}
};
@@ -317,7 +318,8 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
ui: {
widget: 'custom',
placeholder: '请输入',
- errors: { required: '必填项' }
+ errors: { required: '必填项' },
+ validator: val => this.customValidator(val)
}
},
volume: {
@@ -325,7 +327,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
title: '',
ui: {
widget: 'custom',
- placeholder: '请输入'
+ placeholder: '请输入',
}
},
number: {
@@ -333,7 +335,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
title: '',
ui: {
widget: 'custom',
- placeholder: '请输入'
+ placeholder: '请输入',
}
},
carModel: {
@@ -342,13 +344,13 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
ui: {
widget: 'select',
mode: 'multiple',
- maxMultipleCount:3,
+ maxMultipleCount: 3,
placeholder: '请选择车型',
errors: { required: '请选择车型' },
asyncData: () => this.service.getDictOptions({ dictKey: 'car:model' }),
- change:(tag:any , org:any)=>{
- if(tag.includes("999")){
- this.sf4.setValue('/carModel',["999"]);
+ change: (tag: any, org: any) => {
+ if (tag.includes('999')) {
+ this.sf4.setValue('/carModel', ['999']);
}
}
}
@@ -359,43 +361,32 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
ui: {
widget: 'select',
mode: 'multiple',
- maxMultipleCount:3,
+ maxMultipleCount: 3,
placeholder: '请选择车长',
errors: { required: '请选择车长' },
asyncData: () => this.service.getDictOptions({ dictKey: 'car:length' }),
- change:(tag:any , org:any)=>{
- if(tag.includes("999")){
- this.sf4.setValue('/carModel',["999"]);
+ change: (tag: any, org: any) => {
+ if (tag.includes('999')) {
+ this.sf4.setValue('/carLength', ['999']);
}
}
}
- },
+ }
},
required: ['weight', 'carModel', 'carLength']
};
this.ui4 = {
'*': {
- spanLabelFixed: 90,
- grid: { span: 24 }
- },
- $weight: {
- grid: { lg: 8, md: 12, sm: 12, xs: 24 }
- },
- $volume: {
- grid: { lg: 8, md: 12, sm: 12, xs: 24 }
- },
- $number: {
- grid: { lg: 8, md: 12, sm: 12, xs: 24 }
+ spanLabelFixed: 115,
+ grid: { span: 8 }
},
$carModel: {
spanLabelFixed: 100,
grid: { span: 8 }
},
- $carLength: {
- grid: { span: 8 }
- }
};
}
+
initSF5() {
this.schema5 = {
properties: {
@@ -403,8 +394,17 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
type: 'string',
title: '增值服务套餐',
ui: {
- widget: 'dict-select',
- params: { dictKey: 'bill:insurance:type' },
+ widget: 'select',
+ asyncData: () => {
+ return this.service.request(this.service.$api_getDictValue, { dictKey: 'bill:insurance:type' }).pipe(
+ map((res: any) => {
+ return [...res];
+ })
+ )
+ },
+ change: (tag: any, org: any) => {
+ this.getInsurersPrice(tag);
+ }
},
default: '3'
},
@@ -415,7 +415,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
readOnly: true,
ui: {
widget: 'checkbox',
- visibleIf: { insuranceType: (value: string) => value === '0' }
+ visibleIf: { insuranceType: (value: string) => value === '1' }
} as SFCheckboxWidgetSchema,
default: ['车辆实时定位', '轨迹查询', '数据保护', '赠送基本险']
},
@@ -426,7 +426,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
readOnly: true,
ui: {
widget: 'checkbox',
- visibleIf: { insuranceType: (value: string) => value === '1' }
+ visibleIf: { insuranceType: (value: string) => value === '2' }
} as SFCheckboxWidgetSchema,
default: ['车辆实时定位', '轨迹查询', '数据保护', '专属技术服务', '赠送综合险']
},
@@ -438,21 +438,22 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
visibleIf: { insuranceType: (value: string) => value !== '3' }
}
},
- insurancePackagedGoods:{
+ insurancePackagedGoods: {
type: 'string',
title: '货物包装',
ui: {
widget: 'dict-select',
params: { dictKey: 'insure:packaged:goods' },
+ containsAllLabel: false,
visibleIf: { insuranceType: (value: string) => value !== '3' }
} as SFSelectWidgetSchema
},
- hidenField:{
+ hidenField: {
type: 'string',
title: '',
- default:' ',
+ default: ' ',
ui: {
- widget:'text'
+ widget: 'text'
}
},
goodsValue: {
@@ -469,6 +470,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
title: '',
ui: {
widget: 'custom',
+ validator: val => this.customValidator(val),
visibleIf: { insuranceType: (value: string) => value !== '3' }
}
},
@@ -478,26 +480,27 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
ui: {
hidden: true
}
- },
+ }
},
- required: ['insurancePackagedGoods']
+ required: ['insurancePackagedGoods', 'insurancePremium']
};
this.ui5 = {
'*': {
spanLabelFixed: 115,
grid: { span: 12 }
},
- $type1:{
+ $type1: {
grid: { span: 24 }
},
- $type2:{
+ $type2: {
grid: { span: 24 }
},
- $freeInsurance:{
+ $freeInsurance: {
grid: { span: 24 }
- },
+ }
};
}
+
initSF6() {
this.schema6 = {
properties: {
@@ -520,7 +523,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
ui: {
widget: 'dict-select',
params: { dictKey: 'receipt:type' },
- containsAllLable: false,
+ containsAllLabel: false,
placeholder: '请选择',
errors: { required: '请选择' },
visibleIf: {
@@ -528,58 +531,65 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
}
}
},
- // receiptAddressId: {
- // type: 'string',
- // title: '选择地址',
- // ui: {
- // widget: 'custom',
- // placeholder: '请点击选择收回单地址',
- // // validator: val => (this.sf6?.value?.receiptType === '2' ? [{ keyword: 'required', message: '请点击选择收回单地址' }] : []),
- // visibleIf: {
- // receiptType: value => value === '2'
- // }
- // },
- // default: ''
- // },
+ receiptAddress: {
+ type: 'string',
+ title: '回单收件人信息',
+ ui: {
+ widget: 'custom',
+ placeholder: '请点击选择回单收件人信息',
+ // validator: val => (this.sf6?.value?.receiptType === '2' ? [{ keyword: 'required', message: '请点击选择收回单地址' }] : []),
+ visibleIf: {
+ receiptType: value => value === '2'
+ }
+ },
+ default: ''
+ },
+ receiptAddressId: {
+ type: 'string',
+ title: '',
+ ui: {
+ hidden: true
+ }
+ },
receiptUserName: {
type: 'string',
title: '联系人',
- maxLength: 15,
ui: {
visibleIf: {
receiptType: value => value === '2'
}
},
+ readOnly: true
},
- receiptUserPhone: {
+ phon: {
type: 'string',
title: '联系电话',
- maxLength: 11,
ui: {
visibleIf: {
receiptType: value => value === '2'
}
},
+ readOnly: true
},
- receiptAddressArea: {
+ area: {
type: 'string',
title: '所在地区',
- maxLength: 30,
ui: {
visibleIf: {
receiptType: value => value === '2'
}
},
+ readOnly: true
},
- receiptAddress: {
+ address: {
type: 'string',
title: '详细地址',
- maxLength: 50,
ui: {
visibleIf: {
receiptType: value => value === '2'
}
},
+ readOnly: true
},
remarks: {
type: 'string',
@@ -592,15 +602,16 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
} as SFTextareaWidgetSchema
}
},
- required: ['stateReceipt', 'receiptType', 'receiptUserName','receiptUserPhone','receiptAddressArea','receiptAddress']
+ required: ['stateReceipt', 'receiptType', 'receiptAddress']
};
this.ui6 = {
'*': {
- spanLabelFixed: 90,
+ spanLabelFixed: 115,
grid: { span: 24 }
}
};
}
+
initSF7() {
this.schema7 = {
properties: {
@@ -608,19 +619,19 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
type: 'number',
title: '预付',
default: 0,
- ui: {widget: 'custom'}
+ ui: { widget: 'custom' }
},
toPay: {
type: 'number',
title: '到付',
default: 0,
- ui: { widget: 'custom'}
+ ui: { widget: 'custom' }
},
receiptPay: {
type: 'number',
title: '回单付',
default: 0,
- ui: {widget: 'custom'}
+ 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 },
@@ -643,6 +654,29 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
}
};
}
+ // 不可选择的时间
+ disabledDateStart = (current: Date): boolean => {
+ return differenceInCalendarDays(new Date(), current) > 0;
+ };
+
+ /**
+ * 自定义校验数据
+ * @param val
+ */
+ customValidator(val: number) {
+ if (this.isEmpty(val)) {
+ return [{ keyword: 'required', message: '不能为空' }];
+ } else {
+ if (val <= 0) {
+ return [{ keyword: 'required', message: '数值需大于0' }];
+ }
+ return [];
+ }
+ }
+
+ isEmpty(val: any) {
+ return val === undefined || val === null || val.toString().trim() === '';
+ }
// 获取城市列表
getRegionCode(regionCode: any) {
console.log(regionCode);
@@ -663,37 +697,35 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
}
payChange() {
const prePay = this.sf7.value.prePay || 0;
- const toPay = this.sf7.value.toPay || 0
+ const toPay = this.sf7.value.toPay || 0;
const receiptPay = this.sf7.value.receiptPay || 0;
- // const oilCardPay = 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,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 => {
- if (res) {
- this.currentRate = res.rate * 100;
- } else {
- this.service.msgSrv.error(res.msg);
- }
- });
- } else {
- this.service.msgSrv.error(res.msg);
- }
- });
+ shipperId: this?.sf1.value?.shipperAppUserId,
+ enterpriseInfoId: this?.sf1.value?.enterpriseInfoName,
+ totalFreight: subtotal,
+ fuelCardAmount: oilCardPay,
+ resourcetype: '1'
+ };
+ this.service.request(this.service.$api_getCalculatedSurcharge, params).subscribe(res => {
+ console.log('999')
+ console.log(this?.sf1.value)
+ 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_getAdditionalRate + `?shipperId=${this?.sf1.value?.shipperAppUserId}&enterpriseInfoId=${this?.sf1.value?.enterpriseInfoName}&resourcetype='1'`)
+ .subscribe(res => {
+ if (res) {
+ this.currentRate = res.rate * 100;
+ }
+ });
+ } else {
+ this.service.msgSrv.error(res.msg);
+ }
+ });
}
// 添加 删除发货卸货地址
addStartInfo() {
@@ -983,6 +1015,8 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
if (this.sf3data.goodsNameId) {
this.sf3.setValue('/goodsNameId', this.sf3data.goodsNameId);
}
+ } else {
+ this.service.msgSrv.error(res.msg);
}
});
}
@@ -1049,28 +1083,24 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
});
}
}
- getInsurersPrice() {
- console.log(this.sf5.value.goodsValue)
- console.log(this.sf5.value.insuranceType)
- if (this.sf5.value.goodsValue >= 50000) {
- if(this.totalDistance <=0){
- this.service.msgSrv.warning('当前装卸货距离为0,无法计算保价费金额');
- return;
+ // 计算保价费金额
+ getInsurersPrice(insuranceType = this.sf5.value.insuranceType) {
+ if (this.sf5.value.goodsValue >= 50000 && this.totalDistance > 0) {
+
+ const params = {
+ insuranceType,
+ goodsValue: this.sf5.value.goodsValue,
+ km: this.totalDistance
+ };
+ this.service.request(this.service.$api_getWholeInsuranceInfo, params).subscribe(res => {
+ if (res) {
+ this.sf5.setValue('/insurancePremium', res.insurancePremium);
+ this.sf5.setValue('/insuranceRate', res.insuranceRate);
+ } else {
+ this.sf5.setValue('/insurancePremium', null);
+ this.sf5.setValue('/insuranceRate', null);
}
- const params = {
- goodsValue: this.sf5.value.goodsValue,
- insuranceType: this.sf5.value.insuranceType,
- km: this.totalDistance
- };
- this.service.request(this.service.$api_getWholeInsuranceInfo, params).subscribe(res => {
- if (res) {
- this.sf5.setValue('/insurancePremium', res.insurancePremium);
- this.sf5.setValue('/insuranceRate', res.insuranceRate);
- } else {
- this.sf5.setValue('/insurancePremium', null);
- this.sf5.setValue('/insuranceRate', null);
- }
- });
- }
+ });
}
+ }
}
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 04ff9de7..dfde3bc3 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-28 11:31:44
+ * @LastEditTime : 2022-02-28 15:22:19
* @FilePath : \\tms-obc-web\\src\\app\\routes\\supply-management\\services\\supply-management.service.ts
* Copyright (C) 2022 huzhenhong. All rights reserved.
*/
@@ -54,6 +54,8 @@ export class SupplyManagementService extends BaseService {
$api_getCalculatedSurcharge = `/api/sdc/expense/getCalculatedSurcharge`;
// 整车计算附加费率
$api_getcalculatedServiceRate = `/api/sdc/expense/getAdditionalRate`;
+ // 整车计算附加费率
+ $api_getAdditionalRate = `/api/sdc/expense/getAdditionalRate`;
// 代发整车货源
$api_consignWhole = `/api/sdc/goodsResourceOperate/consignWhole`;
// 代发大宗货源
@@ -111,8 +113,10 @@ export class SupplyManagementService extends BaseService {
public $api_getOperationLogRecordsList = '/api/mdc/pbc/operationLogRecords/getOperationLogRecordsList';
// 获取数据字典
$api_getDictValue = `/api/mdc/pbc/dictItems/getDictValue`;
- // 获取协议信息
- public $api_getAgreementInfoByType = '/api/mdc/pbc/agreementInfo/getAgreementInfoByType';
+ // 获取协议信息
+ public $api_getAgreementInfoByType = '/api/mdc/pbc/agreementInfo/getAgreementInfoByType';
+ // 获取运价
+ public $api_getFreight = '/api/mdc/cuc/freightConfig/getFreight';
/**
* 获取车型、车长字典数据
* @returns
@@ -132,6 +136,13 @@ export class SupplyManagementService extends BaseService {
constructor(public injector: Injector) {
super(injector);
}
+ public limitKeys = {
+ weight: 'sys.config.goods.approvalCarMaxWeight', //整车-核载重量上限
+ volume: 'sys.config.goods.approvalCarMaxVolume', //整车-核载体积上限
+ piece: 'sys.config.goods.approvalCarMaxPiece' //整车-核载件数上限
+ };
+ // 根据ItemKey获取项值
+ public $api_findItemValueByItemKeys = '/api/mdc/pbc/sysConfigItem/findItemValueByItemKeys';
// 获取保价费信息
public $api_getWholeInsuranceInfo = '/api/sdc/goodsResourceShipper/getWholeInsuranceInfo';
}