This commit is contained in:
wangshiming
2022-02-28 15:55:57 +08:00
parent 03b1d6da82
commit 394aba4ba1
10 changed files with 689 additions and 361 deletions

View File

@ -12,6 +12,7 @@ import { VehicleFreightPeopleComponent } from '../../modal/vehicle/freight-peopl
import { VehicleModifyCaptainComponent } from '../../modal/vehicle/modify-captain/modify-captain.component'; import { VehicleModifyCaptainComponent } from '../../modal/vehicle/modify-captain/modify-captain.component';
import { VehicleModifyRateComponent } from '../../modal/vehicle/modify-rate/modify-rate.component'; import { VehicleModifyRateComponent } from '../../modal/vehicle/modify-rate/modify-rate.component';
import { VehicleUpdateFreightComponent } from '../../modal/vehicle/update-freight/update-freight.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'; import { OrderManagementService } from '../../services/order-management.service';
@ -458,8 +459,8 @@ resourceStatus: any;
}, },
{ {
text: '查看轨迹 ', text: '查看轨迹 ',
click: (_record) => this.cancellation(_record), click: (_record) => this.viewTrack(_record),
iif: item => item.billStatus == '4' || item.billStatus == '5' || item.billStatus == '2' || item.billStatus == '3', iif: item => item.billStatus !== '1' && item.billStatus !== '6',
// acl: { ability: ['VEHICLE-LIST-view'] }, // 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) {
}
});
}
} }

View File

@ -4,7 +4,7 @@
* @Author : Shiming * @Author : Shiming
* @Date : 2022-02-22 13:53:29 * @Date : 2022-02-22 13:53:29
* @LastEditors : Shiming * @LastEditors : Shiming
* @LastEditTime : 2022-02-22 15:51:53 * @LastEditTime : 2022-02-28 15:12:10
* @FilePath : \\tms-obc-web\\src\\app\\routes\\order-management\\modal\\vehicle\\cancel-confirm\\cancel-confirm.component.ts * @FilePath : \\tms-obc-web\\src\\app\\routes\\order-management\\modal\\vehicle\\cancel-confirm\\cancel-confirm.component.ts
* Copyright (C) 2022 huzhenhong. All rights reserved. * Copyright (C) 2022 huzhenhong. All rights reserved.
*/ */
@ -75,6 +75,7 @@ export class OneCarOrderCancelConfirmComponent implements OnInit {
initData() { initData() {
let indexId = 0 let indexId = 0
let index = 0 let index = 0
let indexSurcharge = 0
this.i?.mybidDetailInfo.forEach((ele: any) => { this.i?.mybidDetailInfo.forEach((ele: any) => {
if(this.sts == 1) { if(this.sts == 1) {
// 大宗 // 大宗
@ -83,25 +84,21 @@ export class OneCarOrderCancelConfirmComponent implements OnInit {
} }
if (ele?.paymentStatusLabel == '已支付') { if (ele?.paymentStatusLabel == '已支付') {
indexId += 1; indexId += 1;
indexSurcharge += ele?.surcharge;
} }
} else { } else {
// 整车 // 整车
if (ele?.paymentStatusLabel == '已支付') { if (ele?.paymentStatusLabel == '已支付') {
indexId += 1; indexId += 1;
index += ele?.price; index += ele?.price;
indexSurcharge += ele?.surcharge;
} }
console.log(ele.expenseCode) 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.index = indexId
this.List = index this.List = index
this.ATTPrice = indexSurcharge
console.log(this.index) console.log(this.index)
console.log(this.List) console.log(this.List)
} }

View File

@ -0,0 +1,34 @@
<!--
* @Description :
* @Version : 1.0
* @Author : Shiming
* @Date : 2022-02-22 13:53:29
* @LastEditors : Shiming
* @LastEditTime : 2022-02-28 14:35:50
* @FilePath : \\tms-obc-web\\src\\app\\routes\\order-management\\modal\\vehicle\\view-track\\view-track.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved.
-->
<div nz-row>
<nz-card nzTitle="轨迹信息" style="width: 100%" id="distannce5" [nzExtra]="extraTemplate" #distannce5>
<div nz-row>
<div nz-col [nzSpan]="12">
<st #st [data]="i?.auditRecordList" [columns]="logColumns" [ps]="0" [page]="{ show: false, showSize: false }">
</st>
</div>
<div nz-col [nzSpan]="12" class="mapBox">
<amap-path-simplifier style="width: 400px !important;" [MapList]="MapList"></amap-path-simplifier>
</div>
</div>
</nz-card>
<ng-template #extraTemplate>
<nz-radio-group [(ngModel)]="trajectory">
<label nz-radio-button nzValue="car">车辆轨迹</label>
<label nz-radio-button nzValue="driver">司机轨迹</label>
</nz-radio-group>
</ng-template>
</div>
<div class="modal-footer">
<button nz-button type="button" (click)="close(false)">取消</button>
<button nz-button type="submit" nzType="primary" (click)="close(true)">确认</button>
</div>

View File

@ -0,0 +1,11 @@
:host {
::ng-deep {
.mapBox {
iframe, canvas {
width: 400px !important;
}
}
}
}

View File

@ -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');
}
}

View File

@ -36,6 +36,7 @@ import { VehicleModifyRateComponent } from './modal/vehicle/modify-rate/modify-r
import { VehicleSureArriveComponent } from './modal/vehicle/sure-arrive/sure-arrive.component'; import { VehicleSureArriveComponent } from './modal/vehicle/sure-arrive/sure-arrive.component';
import { VehicleSureDepartComponent } from './modal/vehicle/sure-depart/sure-depart.component'; import { VehicleSureDepartComponent } from './modal/vehicle/sure-depart/sure-depart.component';
import { VehicleUpdateFreightComponent } from './modal/vehicle/update-freight/update-freight.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'; import { OrderManagementRoutingModule } from './order-management-routing.module';
const COMPONENTS: Type<void>[] = [ const COMPONENTS: Type<void>[] = [
@ -62,7 +63,8 @@ const COMPONENTS: Type<void>[] = [
OrderManagementReceiptsAuditComponent, OrderManagementReceiptsAuditComponent,
orderManagementVoucherViewComponent, orderManagementVoucherViewComponent,
OrderManagementComplianceAuditComponent, OrderManagementComplianceAuditComponent,
OneCarOrderCancelConfirmComponent OneCarOrderCancelConfirmComponent,
OneCarOrderViewtrackComponent
]; ];
@NgModule({ @NgModule({

View File

@ -239,7 +239,7 @@
[nzMin]="50000" [nzMin]="50000"
[nzMax]="3000000" [nzMax]="3000000"
[nzStep]="0.01" [nzStep]="0.01"
(ngModelChange)="i.setValue($event);getInsurersPrice($event)" (ngModelChange)="i.setValue($event);getInsurersPrice()"
nzPlaceHolder="请输入50000-3000000之间数值" nzPlaceHolder="请输入50000-3000000之间数值"
></nz-input-number> ></nz-input-number>
</div> </div>
@ -353,7 +353,7 @@
acl [acl-ability]="['SUPPLY-VEHICLE-AMEND-submitChange']">提交修改</button acl [acl-ability]="['SUPPLY-VEHICLE-AMEND-submitChange']">提交修改</button
> >
<button nz-button nzType="primary" *ngIf="this.PageStatus == '整车下一单'" (click)="submitConfirm('assign')" acl [acl-ability]="['SUPPLY-BULK-PLACEORDER-vehicleDesignate']">指派熟车</button> <button nz-button nzType="primary" *ngIf="this.PageStatus == '整车下一单'" (click)="submitConfirm('assign')" acl [acl-ability]="['SUPPLY-BULK-PLACEORDER-vehicleDesignate']">指派熟车</button>
<button *ngIf="this.PageStatus == '整车下一单'" nz-button nzType="primary" style="margin-left: 48px" (click)="submitConfirm()" <button *ngIf="this.PageStatus == '整车下一单'" nz-button nzType="primary" style="margin-left: 48px" (click)="submitConfirm('publish')"
acl [acl-ability]="['SUPPLY-BULK-PLACEORDER-vehicleAnotherOrder']">司机抢单</button acl [acl-ability]="['SUPPLY-BULK-PLACEORDER-vehicleAnotherOrder']">司机抢单</button
> >
</div> </div>

View File

@ -1,6 +1,7 @@
import { Component, OnInit, ViewChild } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { debounceTime } from 'rxjs/operators'; import { debounceTime } from 'rxjs/operators';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import format from 'date-fns/format';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { import {
@ -14,7 +15,7 @@ import {
SFUISchema SFUISchema
} from '@delon/form'; } from '@delon/form';
import { _HttpClient } from '@delon/theme'; 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 { NzModalService } from 'ng-zorro-antd/modal';
import { type } from 'os'; import { type } from 'os';
import { of } from 'rxjs'; import { of } from 'rxjs';
@ -24,13 +25,22 @@ import { SupplyManagementVehicleAssignedCarComponent } from '../assigned-car/ass
import { TranAgreementComponent } from '../tran-agreement/tran-agreement.component'; import { TranAgreementComponent } from '../tran-agreement/tran-agreement.component';
import { PublishAddressListComponent } from './address-list/address-list.component'; import { PublishAddressListComponent } from './address-list/address-list.component';
import { PublishSuccessComponent } from './publish-success/publish-success.component'; import { PublishSuccessComponent } from './publish-success/publish-success.component';
import { cacheConf } from '@conf/cache.conf';
@Component({ @Component({
selector: 'app-publish-goods-onecar-publish', selector: 'app-publish-goods-onecar-publish',
templateUrl: './onecar-publish.component.html', templateUrl: './onecar-publish.component.html',
styleUrls: ['./onecar-publish.component.less'] styleUrls: ['./onecar-publish.component.less']
}) })
export class SupplyManagementOnecarPublishComponent implements OnInit { export class SupplyManagementOnecarPublishComponent implements OnInit {
// 环境信息 appId、tenantId
envInfo = this.eaCacheSrv.get(cacheConf.env);
validateForm1: FormGroup; validateForm1: FormGroup;
limitValues = {
maxWeight: 99999,
maxVolume: 99999,
maxPiece: 99999,
}
sf1data: any; // 货源单设置回显 sf1data: any; // 货源单设置回显
sf3data: any; // 货源单设置回显 sf3data: any; // 货源单设置回显
sf4data: any; // 货源单设置回显 sf4data: any; // 货源单设置回显
@ -61,18 +71,15 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
private modalService: NzModalService, private modalService: NzModalService,
public service: SupplyManagementService, public service: SupplyManagementService,
private amapService: AmapService, private amapService: AmapService,
public shipperSrv: ShipperBaseService public shipperSrv: ShipperBaseService,
private eaCacheSrv: EACacheService,
) { ) {
this.validateForm1 = fb.group({ this.validateForm1 = fb.group({
loadAddress0: [null, [Validators.required]], loadingTime: [null, [Validators.required]],
loadName0: [null, [Validators.required]], unloadingTime: [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, []]
}); });
this.envCache = this.eaCacheSrv.get(cacheConf.env);
} }
@ViewChild('sf1', { static: false }) sf1!: SFComponent; @ViewChild('sf1', { static: false }) sf1!: SFComponent;
schema1: SFSchema = {}; schema1: SFSchema = {};
@ -127,8 +134,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.initSF5(); this.initSF5();
this.initSF6(); this.initSF6();
this.initSF7(); this.initSF7();
this.getLimitvalue();
this.initdata(); this.initdata();
this.getInsurers()
} }
initSF1() { initSF1() {
this.schema1 = { this.schema1 = {
@ -397,8 +404,17 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
type: 'string', type: 'string',
title: '增值服务套餐', title: '增值服务套餐',
ui: { ui: {
widget: 'dict-select', widget: 'select',
params: { dictKey: 'bill:insurance:type' }, 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' default: '3'
}, },
@ -409,7 +425,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
readOnly: true, readOnly: true,
ui: { ui: {
widget: 'checkbox', widget: 'checkbox',
visibleIf: { insuranceType: (value: string) => value === '0' } visibleIf: { insuranceType: (value: string) => value === '1' }
} as SFCheckboxWidgetSchema, } as SFCheckboxWidgetSchema,
default: ['车辆实时定位', '轨迹查询', '数据保护', '赠送基本险'] default: ['车辆实时定位', '轨迹查询', '数据保护', '赠送基本险']
}, },
@ -420,7 +436,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
readOnly: true, readOnly: true,
ui: { ui: {
widget: 'checkbox', widget: 'checkbox',
visibleIf: { insuranceType: (value: string) => value === '1' } visibleIf: { insuranceType: (value: string) => value === '2' }
} as SFCheckboxWidgetSchema, } as SFCheckboxWidgetSchema,
default: ['车辆实时定位', '轨迹查询', '数据保护', '专属技术服务', '赠送综合险'] default: ['车辆实时定位', '轨迹查询', '数据保护', '专属技术服务', '赠送综合险']
}, },
@ -432,21 +448,22 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
visibleIf: { insuranceType: (value: string) => value !== '3' } visibleIf: { insuranceType: (value: string) => value !== '3' }
} }
}, },
insurancePackagedGoods:{ insurancePackagedGoods: {
type: 'string', type: 'string',
title: '货物包装', title: '货物包装',
ui: { ui: {
widget: 'dict-select', widget: 'dict-select',
params: { dictKey: 'insure:packaged:goods' }, params: { dictKey: 'insure:packaged:goods' },
containsAllLabel: false,
visibleIf: { insuranceType: (value: string) => value !== '3' } visibleIf: { insuranceType: (value: string) => value !== '3' }
} as SFSelectWidgetSchema } as SFSelectWidgetSchema
}, },
hidenField:{ hidenField: {
type: 'string', type: 'string',
title: '', title: '',
default:' ', default: ' ',
ui: { ui: {
widget:'text' widget: 'text'
} }
}, },
goodsValue: { goodsValue: {
@ -463,6 +480,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
title: '', title: '',
ui: { ui: {
widget: 'custom', widget: 'custom',
validator: val => this.customValidator(val),
visibleIf: { insuranceType: (value: string) => value !== '3' } visibleIf: { insuranceType: (value: string) => value !== '3' }
} }
}, },
@ -472,26 +490,43 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
ui: { ui: {
hidden: true hidden: true
} }
}, }
}, },
required: ['insurancePackagedGoods'] required: ['insurancePackagedGoods', 'insurancePremium']
}; };
this.ui5 = { this.ui5 = {
'*': { '*': {
spanLabelFixed: 115, spanLabelFixed: 115,
grid: { span: 12 } grid: { span: 12 }
}, },
$type1:{ $type1: {
grid: { span: 24 } grid: { span: 24 }
}, },
$type2:{ $type2: {
grid: { span: 24 } grid: { span: 24 }
}, },
$freeInsurance:{ $freeInsurance: {
grid: { span: 24 } 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() { initSF6() {
this.schema6 = { this.schema6 = {
properties: { properties: {
@ -522,45 +557,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: { receiptUserName: {
type: 'string', type: 'string',
title: '联系人', title: '联系人',
maxLength: 15,
ui: { ui: {
visibleIf: { visibleIf: {
receiptType: value => value === '2' receiptType: value => value === '2'
} }
} },
readOnly: true
}, },
receiptUserPhone: { phon: {
type: 'string', type: 'string',
title: '联系电话', title: '联系电话',
maxLength: 11,
ui: { ui: {
visibleIf: { visibleIf: {
receiptType: value => value === '2' receiptType: value => value === '2'
} }
} },
readOnly: true
}, },
receiptAddressArea: { area: {
type: 'string', type: 'string',
title: '所在地区', title: '所在地区',
maxLength: 30,
ui: { ui: {
visibleIf: { visibleIf: {
receiptType: value => value === '2' receiptType: value => value === '2'
} }
} },
readOnly: true
}, },
receiptAddress: { address: {
type: 'string', type: 'string',
title: '详细地址', title: '详细地址',
maxLength: 30,
ui: { ui: {
visibleIf: { visibleIf: {
receiptType: value => value === '2' receiptType: value => value === '2'
} }
} },
readOnly: true
}, },
remarks: { remarks: {
type: 'string', type: 'string',
@ -573,11 +628,11 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
} as SFTextareaWidgetSchema } as SFTextareaWidgetSchema
} }
}, },
required: ['stateReceipt', 'receiptType', 'receiptUserName', 'receiptUserPhone', 'receiptAddressArea', 'receiptAddress'] required: ['stateReceipt', 'receiptType', 'receiptAddress']
}; };
this.ui6 = { this.ui6 = {
'*': { '*': {
spanLabelFixed: 90, spanLabelFixed: 115,
grid: { span: 24 } grid: { span: 24 }
} }
}; };
@ -590,19 +645,19 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
type: 'number', type: 'number',
title: '预付', title: '预付',
default: 0, default: 0,
ui: {widget: 'custom'} ui: { widget: 'custom' }
}, },
toPay: { toPay: {
type: 'number', type: 'number',
title: '到付', title: '到付',
default: 0, default: 0,
ui: { widget: 'custom'} ui: { widget: 'custom' }
}, },
receiptPay: { receiptPay: {
type: 'number', type: 'number',
title: '回单付', title: '回单付',
default: 0, default: 0,
ui: {widget: 'custom'} ui: { widget: 'custom' }
}, },
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 },
@ -646,47 +701,37 @@ 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() { payChange() {
const prePay = this.sf7.value.prePay || 0; 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 receiptPay = this.sf7.value.receiptPay || 0;
// const oilCardPay = 0; const oilCardPay = 0;
const subtotal = prePay + toPay + receiptPay; const subtotal = prePay + toPay + receiptPay;
const params = { const params = {
shipperId: this.envCache?.enterpriseId, shipperId: this.envCache?.enterpriseId,
enterpriseInfoId: this.envCache?.networkTransporterId, enterpriseInfoId: this.envCache?.networkTransporterId,
totalFreight:subtotal, totalFreight: subtotal,
// fuelCardAmount:oilCardPay, fuelCardAmount: oilCardPay,
resourcetype:'1' resourcetype: '1'
} };
this.service this.service.request(this.service.$api_getCalculatedSurcharge, params).subscribe(res => {
.request(this.service.$api_getCalculatedSurcharge,params) console.log('999')
.subscribe(res => { console.log(this.envCache)
if (res) { if (res) {
this.sf7.setValue('/appendFee', res.surcharge); this.sf7.setValue('/appendFee', res.surcharge);
this.sf7.setValue('/subtotal', subtotal); this.sf7.setValue('/subtotal', subtotal);
this.sf7.setValue('/total', subtotal + res.surcharge); this.sf7.setValue('/total', subtotal + res.surcharge);
this.service this.service
.request(this.service.$api_getcalculatedServiceRate + `?invoiceAmount=${subtotal + res.surcharge}&totalFreight=${subtotal}`) .request(this.service.$api_getAdditionalRate + `?shipperId=${this.envCache?.enterpriseId}&enterpriseInfoId=${this?.enterpriseProjectIds}&resourcetype='1'`)
.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);
} else { }
this.service.msgSrv.error(res.msg); });
}
});
} }
// 添加 删除发货卸货地址 // 添加 删除发货卸货地址
addStartInfo(_event: any) { addStartInfo(_event: any) {
@ -708,6 +753,26 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.validateForm1.addControl(`loadPhone${controlId}`, new FormControl(null, Validators.required)); this.validateForm1.addControl(`loadPhone${controlId}`, new FormControl(null, Validators.required));
} }
} }
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, id?: any) { subStartInfo(event: any, index: number, id?: any) {
console.log(event, index, id); console.log(event, index, id);
@ -773,10 +838,12 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
.subscribe(res => { .subscribe(res => {
if (res) { if (res) {
this.sf3.getProperty('/goodsNameId')!.schema.enum = 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) { if (this.sf3data.goodsNameId) {
this.sf3.setValue('/goodsNameId', this.sf3data.goodsNameId); this.sf3.setValue('/goodsNameId', this.sf3data.goodsNameId);
} }
} else {
this.service.msgSrv.error(res.msg);
} }
}); });
} }
@ -811,27 +878,94 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
nzComponentParams: { type: 'onecar', resourceObj, change: change } nzComponentParams: { type: 'onecar', resourceObj, change: change }
}); });
} }
// 提交前确认,委托运输协议弹窗 // // 提交前确认,委托运输协议弹窗
submitConfirm(submitType?: any) { // submitConfirm(submitType?: any) {
Object.keys(this.validateForm1.controls).forEach(key => { // Object.keys(this.validateForm1.controls).forEach(key => {
this.validateForm1.controls[key].markAsDirty(); // this.validateForm1.controls[key].markAsDirty();
this.validateForm1.controls[key].updateValueAndValidity(); // this.validateForm1.controls[key].updateValueAndValidity();
}); // });
this.sf1.validator({ emitError: true }); // this.sf1.validator({ emitError: true });
this.sf3.validator({ emitError: true }); // this.sf3.validator({ emitError: true });
this.sf4.validator({ emitError: true }); // this.sf4.validator({ emitError: true });
this.sf6.validator({ emitError: true }); // this.sf6.validator({ emitError: true });
this.sf7.validator({ emitError: true }); // this.sf7.validator({ emitError: true });
console.log(this.sf1.valid); // console.log(this.sf1.valid);
if (this.validateForm1.invalid || !this.sf3.valid || !this.sf1.valid || !this.sf4.valid || !this.sf6.valid || !this.sf7.valid) { // if (this.validateForm1.invalid || !this.sf3.valid || !this.sf1.valid || !this.sf4.valid || !this.sf6.valid || !this.sf7.valid) {
return; // return;
} // }
// const modalRef = this.modalService.create({
// nzTitle: '运输协议',
// nzContent: TranAgreementComponent,
// nzWidth: 900,
// nzFooter: null,
// });
// modalRef.afterClose.subscribe(result => {
// if (result) {
// this.submit(submitType);
// }
// });
// }
// 提交前确认,委托运输协议弹窗
submitConfirm(submitType?: string) {
Object.keys(this.validateForm1.controls).forEach(key => {
this.validateForm1.controls[key].markAsDirty();
this.validateForm1.controls[key].updateValueAndValidity();
});
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 });
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({ const modalRef = this.modalService.create({
nzTitle: '运输协议', nzTitle: '运输协议',
nzContent: TranAgreementComponent, nzContent: TranAgreementComponent,
nzWidth: 900, nzWidth: 900,
nzFooter: null, nzFooter: null
}); });
modalRef.afterClose.subscribe(result => { modalRef.afterClose.subscribe(result => {
if (result) { if (result) {
@ -841,73 +975,109 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
} }
// 提交 // 提交
submit(submitType?: string): void { submit(submitType?: string): void {
Object.keys(this.validateForm1.controls).forEach(key => { //装卸货信息
this.validateForm1.controls[key].markAsDirty(); const LoadingList = this.startInfo.concat(this.endInfo);
this.validateForm1.controls[key].updateValueAndValidity();
// 货物信息
const sf3Values = { ...this.sf3.value };
if (sf3Values.goodsTypeName === '其它') {
sf3Values.goodsName = sf3Values.goodsName1;
delete sf3Values.goodsName1;
}
if (this.sf4.value.carModel.includes('999')) {
this.sf4.value.carModel = ['999'];
}
if (this.sf4.value.carLength.includes('999')) {
this.sf4.value.carLength = ['999'];
}
const goodsInfoList = [
{
...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;
}); });
this.sf1.validator({ emitError: true }); goodsInfoList.forEach((ele: any) => {
this.sf3.validator({ emitError: true }); delete ele.id;
this.sf4.validator({ emitError: true }); });
this.sf6.validator({ emitError: true }); expenseList.forEach((ele: any) => {
this.sf7.validator({ emitError: true }); delete ele.id;
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;
} // if (typeof this.unloadingTime !== 'string') {
console.log(this?.loadingTime); // var c = new Date(this.unloadingTime);
console.log(this?.unloadingTime); // this.unloadingTime =
if (typeof this.unloadingTime !== 'string') { // c.getFullYear() +
var c = new Date(this.unloadingTime); // '-' +
this.unloadingTime = // this.addPreZero(c.getMonth() + 1) +
c.getFullYear() + // '-' +
'-' + // this.addPreZero(c.getDate()) +
this.addPreZero(c.getMonth() + 1) + // ' ' +
'-' + // this.addPreZero(c.getHours()) +
this.addPreZero(c.getDate()) + // ':' +
' ' + // this.addPreZero(c.getMinutes()) +
this.addPreZero(c.getHours()) + // ':' +
':' + // this.addPreZero(c.getSeconds());
this.addPreZero(c.getMinutes()) + // }
':' + // if (typeof this.loadingTime !== 'string') {
this.addPreZero(c.getSeconds()); // var c = new Date(this.loadingTime);
} // this.loadingTime =
if (typeof this.loadingTime !== 'string') { // c.getFullYear() +
var c = new Date(this.loadingTime); // '-' +
this.loadingTime = // this.addPreZero(c.getMonth() + 1) +
c.getFullYear() + // '-' +
'-' + // this.addPreZero(c.getDate()) +
this.addPreZero(c.getMonth() + 1) + // ' ' +
'-' + // this.addPreZero(c.getHours()) +
this.addPreZero(c.getDate()) + // ':' +
' ' + // this.addPreZero(c.getMinutes()) +
this.addPreZero(c.getHours()) + // ':' +
':' + // this.addPreZero(c.getSeconds());
this.addPreZero(c.getMinutes()) + // }
':' +
this.addPreZero(c.getSeconds()); const params = {
} id: '',
console.log(this.loadingTime) ...this.sf1.value,
const params: any = { unLoadingPlaceList: LoadingList,
...this.sf1.value, unloadingTime: format(this.validateForm1.value.unloadingTime, 'yyyy-MM-dd HH:mm:ss'),
...this.sf5.value, loadingTime: format(this.validateForm1.value.loadingTime, 'yyyy-MM-dd HH:mm:ss'),
...this.sf6.value, goodsInfoList: goodsInfoList,
paymentDays: this.sf7.value.paymentDays, ...this.sf5.value,
loadingTime: this.loadingTime, ...this.sf6.value,
unloadingTime: this.unloadingTime, expenseDTOList: expenseList,
unLoadingPlaceDTOList: [...this.startInfo, ...this.endInfo], paymentDays: this.sf7.value.paymentDays,
goodsInfoDTOList: [ };
{ // const params: any = {
...this.sf4.value, // ...this.sf1.value,
...this.sf3.value, // ...this.sf5.value,
carModel: this.sf4.value.carModel.join(','), // ...this.sf6.value,
carLength: this.sf4.value.carLength.join(',') // paymentDays: this.sf7.value.paymentDays,
} // loadingTime: this.loadingTime,
] // unloadingTime: this.unloadingTime,
}; // unLoadingPlaceDTOList: [...this.startInfo, ...this.endInfo],
params.shippingInformationDTO = { // goodsInfoDTOList: [
...this.sf7.value, // {
totalFees: this.totalFees // ...this.sf4.value,
}; // ...this.sf3.value,
// carModel: this.sf4.value.carModel.join(','),
// carLength: this.sf4.value.carLength.join(',')
// }
// ]
// };
console.log(params); console.log(params);
if (submitType) { if (submitType) {
if (submitType == 'assign') { if (submitType == 'assign') {
@ -979,6 +1149,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe((res: any) => { this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe((res: any) => {
this.totalDistance = res.distance; this.totalDistance = res.distance;
this.totalTime = res.time; this.totalTime = res.time;
this.getInsurersPrice(); // 计算保费金额
}); });
} }
} }
@ -1203,6 +1374,14 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
default: default:
break; 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(); //计算保费金额
});
}
} }
}); });
} }
@ -1271,78 +1450,29 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => { this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
this.totalDistance = res.distance; this.totalDistance = res.distance;
this.totalTime = res.time; this.totalTime = res.time;
this.getInsurersPrice(); //计算保费金额
}); });
} }
} }
goodsValuesChange(value: any) { // 计算保价费金额
console.log(value); getInsurersPrice(insuranceType = this.sf5.value.insuranceType) {
console.log(this.totalDistance); if (this.sf5.value.goodsValue >= 50000 && this.totalDistance > 0) {
if(value >= 50000 && this.totalDistance > 0){
const params = { const params = {
goodsValue: value, insuranceType,
insuranceType: this.sf55.value.insuranceType, goodsValue: this.sf5.value.goodsValue,
km: this.totalDistance km: this.totalDistance
}; };
this.service this.service.request(this.service.$api_getWholeInsuranceInfo, params).subscribe(res => {
.request(this.service.$api_getWholeInsuranceInfo, params) if (res) {
.subscribe(res => { this.sf5.setValue('/insurancePremium', res.insurancePremium);
if (res) { this.sf5.setValue('/insuranceRate', res.insuranceRate);
this.sf5.setValue('/insurancePremium',res.insurancePremium); } else {
}else{ this.sf5.setValue('/insurancePremium', null);
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);
}
});
}
}
});
}
} }

View File

@ -2,6 +2,7 @@ import { Component, OnInit, ViewChild } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { cacheConf } from '@conf/cache.conf'; import { cacheConf } from '@conf/cache.conf';
import differenceInCalendarDays from 'date-fns/differenceInCalendarDays';
import { import {
SFCheckboxWidgetSchema, SFCheckboxWidgetSchema,
SFComponent, SFComponent,
@ -241,7 +242,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
ui: { ui: {
widget: 'select', widget: 'select',
placeholder: '请选择', placeholder: '请选择',
errors: { required: '请选择货物类型' }, errors: { required: '请选择货物名称' },
asyncData: () => asyncData: () =>
this.shipperSrv.loadConfigByKey('goods.name.config.type').pipe( this.shipperSrv.loadConfigByKey('goods.name.config.type').pipe(
map((data: any) => { map((data: any) => {
@ -270,7 +271,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
widget: 'select', widget: 'select',
placeholder: '请选择', placeholder: '请选择',
errors: { required: '请填写货物名称' }, errors: { required: '请填写货物名称' },
change: (_value: any, data: any) => { change: (value: any, data: any) => {
this.sf3.setValue('/goodsName', data.label); this.sf3.setValue('/goodsName', data.label);
}, },
visibleIf: { visibleIf: {
@ -299,11 +300,11 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
} }
} }
}, },
required: ['goodsTypeId', 'goodsName', 'goodsNameId'] required: ['goodsTypeId', 'goodsName', 'goodsNameId', 'goodsName1']
}; };
this.ui3 = { this.ui3 = {
'*': { '*': {
spanLabelFixed: 90, spanLabelFixed: 115,
grid: { span: 12 } grid: { span: 12 }
} }
}; };
@ -317,7 +318,8 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
ui: { ui: {
widget: 'custom', widget: 'custom',
placeholder: '请输入', placeholder: '请输入',
errors: { required: '必填项' } errors: { required: '必填项' },
validator: val => this.customValidator(val)
} }
}, },
volume: { volume: {
@ -325,7 +327,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
title: '', title: '',
ui: { ui: {
widget: 'custom', widget: 'custom',
placeholder: '请输入' placeholder: '请输入',
} }
}, },
number: { number: {
@ -333,7 +335,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
title: '', title: '',
ui: { ui: {
widget: 'custom', widget: 'custom',
placeholder: '请输入' placeholder: '请输入',
} }
}, },
carModel: { carModel: {
@ -342,13 +344,13 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
ui: { ui: {
widget: 'select', widget: 'select',
mode: 'multiple', mode: 'multiple',
maxMultipleCount:3, maxMultipleCount: 3,
placeholder: '请选择车型', placeholder: '请选择车型',
errors: { required: '请选择车型' }, errors: { required: '请选择车型' },
asyncData: () => this.service.getDictOptions({ dictKey: 'car:model' }), asyncData: () => this.service.getDictOptions({ dictKey: 'car:model' }),
change:(tag:any , org:any)=>{ change: (tag: any, org: any) => {
if(tag.includes("999")){ if (tag.includes('999')) {
this.sf4.setValue('/carModel',["999"]); this.sf4.setValue('/carModel', ['999']);
} }
} }
} }
@ -359,43 +361,28 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
ui: { ui: {
widget: 'select', widget: 'select',
mode: 'multiple', mode: 'multiple',
maxMultipleCount:3, maxMultipleCount: 3,
placeholder: '请选择车长', placeholder: '请选择车长',
errors: { required: '请选择车长' }, errors: { required: '请选择车长' },
asyncData: () => this.service.getDictOptions({ dictKey: 'car:length' }), asyncData: () => this.service.getDictOptions({ dictKey: 'car:length' }),
change:(tag:any , org:any)=>{ change: (tag: any, org: any) => {
if(tag.includes("999")){ if (tag.includes('999')) {
this.sf4.setValue('/carModel',["999"]); this.sf4.setValue('/carLength', ['999']);
} }
} }
} }
}, }
}, },
required: ['weight', 'carModel', 'carLength'] required: ['weight', 'carModel', 'carLength']
}; };
this.ui4 = { this.ui4 = {
'*': { '*': {
spanLabelFixed: 90, spanLabelFixed: 115,
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 }
},
$carModel: {
spanLabelFixed: 100,
grid: { span: 8 }
},
$carLength: {
grid: { span: 8 } grid: { span: 8 }
} }
}; };
} }
initSF5() { initSF5() {
this.schema5 = { this.schema5 = {
properties: { properties: {
@ -403,8 +390,17 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
type: 'string', type: 'string',
title: '增值服务套餐', title: '增值服务套餐',
ui: { ui: {
widget: 'dict-select', widget: 'select',
params: { dictKey: 'bill:insurance:type' }, 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' default: '3'
}, },
@ -415,7 +411,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
readOnly: true, readOnly: true,
ui: { ui: {
widget: 'checkbox', widget: 'checkbox',
visibleIf: { insuranceType: (value: string) => value === '0' } visibleIf: { insuranceType: (value: string) => value === '1' }
} as SFCheckboxWidgetSchema, } as SFCheckboxWidgetSchema,
default: ['车辆实时定位', '轨迹查询', '数据保护', '赠送基本险'] default: ['车辆实时定位', '轨迹查询', '数据保护', '赠送基本险']
}, },
@ -426,7 +422,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
readOnly: true, readOnly: true,
ui: { ui: {
widget: 'checkbox', widget: 'checkbox',
visibleIf: { insuranceType: (value: string) => value === '1' } visibleIf: { insuranceType: (value: string) => value === '2' }
} as SFCheckboxWidgetSchema, } as SFCheckboxWidgetSchema,
default: ['车辆实时定位', '轨迹查询', '数据保护', '专属技术服务', '赠送综合险'] default: ['车辆实时定位', '轨迹查询', '数据保护', '专属技术服务', '赠送综合险']
}, },
@ -438,21 +434,22 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
visibleIf: { insuranceType: (value: string) => value !== '3' } visibleIf: { insuranceType: (value: string) => value !== '3' }
} }
}, },
insurancePackagedGoods:{ insurancePackagedGoods: {
type: 'string', type: 'string',
title: '货物包装', title: '货物包装',
ui: { ui: {
widget: 'dict-select', widget: 'dict-select',
params: { dictKey: 'insure:packaged:goods' }, params: { dictKey: 'insure:packaged:goods' },
containsAllLabel: false,
visibleIf: { insuranceType: (value: string) => value !== '3' } visibleIf: { insuranceType: (value: string) => value !== '3' }
} as SFSelectWidgetSchema } as SFSelectWidgetSchema
}, },
hidenField:{ hidenField: {
type: 'string', type: 'string',
title: '', title: '',
default:' ', default: ' ',
ui: { ui: {
widget:'text' widget: 'text'
} }
}, },
goodsValue: { goodsValue: {
@ -469,6 +466,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
title: '', title: '',
ui: { ui: {
widget: 'custom', widget: 'custom',
validator: val => this.customValidator(val),
visibleIf: { insuranceType: (value: string) => value !== '3' } visibleIf: { insuranceType: (value: string) => value !== '3' }
} }
}, },
@ -478,26 +476,27 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
ui: { ui: {
hidden: true hidden: true
} }
}, }
}, },
required: ['insurancePackagedGoods'] required: ['insurancePackagedGoods', 'insurancePremium']
}; };
this.ui5 = { this.ui5 = {
'*': { '*': {
spanLabelFixed: 115, spanLabelFixed: 115,
grid: { span: 12 } grid: { span: 12 }
}, },
$type1:{ $type1: {
grid: { span: 24 } grid: { span: 24 }
}, },
$type2:{ $type2: {
grid: { span: 24 } grid: { span: 24 }
}, },
$freeInsurance:{ $freeInsurance: {
grid: { span: 24 } grid: { span: 24 }
}, }
}; };
} }
initSF6() { initSF6() {
this.schema6 = { this.schema6 = {
properties: { properties: {
@ -520,7 +519,7 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
ui: { ui: {
widget: 'dict-select', widget: 'dict-select',
params: { dictKey: 'receipt:type' }, params: { dictKey: 'receipt:type' },
containsAllLable: false, containsAllLabel: false,
placeholder: '请选择', placeholder: '请选择',
errors: { required: '请选择' }, errors: { required: '请选择' },
visibleIf: { visibleIf: {
@ -528,58 +527,65 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
} }
} }
}, },
// receiptAddressId: { receiptAddress: {
// type: 'string', type: 'string',
// title: '选择地址', title: '回单收件人信息',
// ui: { ui: {
// widget: 'custom', widget: 'custom',
// placeholder: '请点击选择回单地址', placeholder: '请点击选择回单收件人信息',
// // validator: val => (this.sf6?.value?.receiptType === '2' ? [{ keyword: 'required', message: '请点击选择收回单地址' }] : []), // validator: val => (this.sf6?.value?.receiptType === '2' ? [{ keyword: 'required', message: '请点击选择收回单地址' }] : []),
// visibleIf: { visibleIf: {
// receiptType: value => value === '2' receiptType: value => value === '2'
// } }
// }, },
// default: '' default: ''
// }, },
receiptAddressId: {
type: 'string',
title: '',
ui: {
hidden: true
}
},
receiptUserName: { receiptUserName: {
type: 'string', type: 'string',
title: '联系人', title: '联系人',
maxLength: 15,
ui: { ui: {
visibleIf: { visibleIf: {
receiptType: value => value === '2' receiptType: value => value === '2'
} }
}, },
readOnly: true
}, },
receiptUserPhone: { phon: {
type: 'string', type: 'string',
title: '联系电话', title: '联系电话',
maxLength: 11,
ui: { ui: {
visibleIf: { visibleIf: {
receiptType: value => value === '2' receiptType: value => value === '2'
} }
}, },
readOnly: true
}, },
receiptAddressArea: { area: {
type: 'string', type: 'string',
title: '所在地区', title: '所在地区',
maxLength: 30,
ui: { ui: {
visibleIf: { visibleIf: {
receiptType: value => value === '2' receiptType: value => value === '2'
} }
}, },
readOnly: true
}, },
receiptAddress: { address: {
type: 'string', type: 'string',
title: '详细地址', title: '详细地址',
maxLength: 50,
ui: { ui: {
visibleIf: { visibleIf: {
receiptType: value => value === '2' receiptType: value => value === '2'
} }
}, },
readOnly: true
}, },
remarks: { remarks: {
type: 'string', type: 'string',
@ -592,15 +598,16 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
} as SFTextareaWidgetSchema } as SFTextareaWidgetSchema
} }
}, },
required: ['stateReceipt', 'receiptType', 'receiptUserName','receiptUserPhone','receiptAddressArea','receiptAddress'] required: ['stateReceipt', 'receiptType', 'receiptAddress']
}; };
this.ui6 = { this.ui6 = {
'*': { '*': {
spanLabelFixed: 90, spanLabelFixed: 115,
grid: { span: 24 } grid: { span: 24 }
} }
}; };
} }
initSF7() { initSF7() {
this.schema7 = { this.schema7 = {
properties: { properties: {
@ -608,19 +615,19 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
type: 'number', type: 'number',
title: '预付', title: '预付',
default: 0, default: 0,
ui: {widget: 'custom'} ui: { widget: 'custom' }
}, },
toPay: { toPay: {
type: 'number', type: 'number',
title: '到付', title: '到付',
default: 0, default: 0,
ui: { widget: 'custom'} ui: { widget: 'custom' }
}, },
receiptPay: { receiptPay: {
type: 'number', type: 'number',
title: '回单付', title: '回单付',
default: 0, default: 0,
ui: {widget: 'custom'} ui: { widget: 'custom' }
}, },
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 },
@ -643,6 +650,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) { getRegionCode(regionCode: any) {
console.log(regionCode); console.log(regionCode);
@ -663,37 +693,35 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
} }
payChange() { payChange() {
const prePay = this.sf7.value.prePay || 0; 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 receiptPay = this.sf7.value.receiptPay || 0;
// const oilCardPay = 0; const oilCardPay = 0;
const subtotal = prePay + toPay + receiptPay; const subtotal = prePay + toPay + receiptPay;
const params = { const params = {
shipperId: this.envCache?.enterpriseId, shipperId: this?.sf1.value?.shipperAppUserId,
enterpriseInfoId: this.envCache?.networkTransporterId, enterpriseInfoId: this?.sf1.value?.enterpriseInfoName,
totalFreight:subtotal, totalFreight: subtotal,
// fuelCardAmount:oilCardPay, fuelCardAmount: oilCardPay,
resourcetype:'1' resourcetype: '1'
} };
this.service this.service.request(this.service.$api_getCalculatedSurcharge, params).subscribe(res => {
.request(this.service.$api_getCalculatedSurcharge,params) console.log('999')
.subscribe(res => { console.log(this?.sf1.value)
if (res) { if (res) {
this.sf7.setValue('/appendFee', res.surcharge); this.sf7.setValue('/appendFee', res.surcharge);
this.sf7.setValue('/subtotal', subtotal); this.sf7.setValue('/subtotal', subtotal);
this.sf7.setValue('/total', subtotal + res.surcharge); this.sf7.setValue('/total', subtotal + res.surcharge);
this.service this.service
.request(this.service.$api_getcalculatedServiceRate + `?invoiceAmount=${subtotal + res.surcharge}&totalFreight=${subtotal}`) .request(this.service.$api_getAdditionalRate + `?shipperId=${this?.sf1.value?.shipperAppUserId}&enterpriseInfoId=${this?.sf1.value?.enterpriseInfoName}&resourcetype='1'`)
.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);
} else { }
this.service.msgSrv.error(res.msg); });
}
});
} }
// 添加 删除发货卸货地址 // 添加 删除发货卸货地址
addStartInfo() { addStartInfo() {
@ -983,6 +1011,8 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
if (this.sf3data.goodsNameId) { if (this.sf3data.goodsNameId) {
this.sf3.setValue('/goodsNameId', this.sf3data.goodsNameId); this.sf3.setValue('/goodsNameId', this.sf3data.goodsNameId);
} }
} else {
this.service.msgSrv.error(res.msg);
} }
}); });
} }
@ -1049,28 +1079,24 @@ export class SupplyManagementReleasePublishComponent implements OnInit {
}); });
} }
} }
getInsurersPrice() { // 计算保价费金额
console.log(this.sf5.value.goodsValue) getInsurersPrice(insuranceType = this.sf5.value.insuranceType) {
console.log(this.sf5.value.insuranceType) if (this.sf5.value.goodsValue >= 50000 && this.totalDistance > 0) {
if (this.sf5.value.goodsValue >= 50000) {
if(this.totalDistance <=0){ const params = {
this.service.msgSrv.warning('当前装卸货距离为0无法计算保价费金额'); insuranceType,
return; 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);
}
});
}
} }
}
} }

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-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 * @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.
*/ */
@ -54,6 +54,8 @@ export class SupplyManagementService extends BaseService {
$api_getCalculatedSurcharge = `/api/sdc/expense/getCalculatedSurcharge`; $api_getCalculatedSurcharge = `/api/sdc/expense/getCalculatedSurcharge`;
// 整车计算附加费率 // 整车计算附加费率
$api_getcalculatedServiceRate = `/api/sdc/expense/getAdditionalRate`; $api_getcalculatedServiceRate = `/api/sdc/expense/getAdditionalRate`;
// 整车计算附加费率
$api_getAdditionalRate = `/api/sdc/expense/getAdditionalRate`;
// 代发整车货源 // 代发整车货源
$api_consignWhole = `/api/sdc/goodsResourceOperate/consignWhole`; $api_consignWhole = `/api/sdc/goodsResourceOperate/consignWhole`;
// 代发大宗货源 // 代发大宗货源
@ -111,8 +113,10 @@ export class SupplyManagementService extends BaseService {
public $api_getOperationLogRecordsList = '/api/mdc/pbc/operationLogRecords/getOperationLogRecordsList'; public $api_getOperationLogRecordsList = '/api/mdc/pbc/operationLogRecords/getOperationLogRecordsList';
// 获取数据字典 // 获取数据字典
$api_getDictValue = `/api/mdc/pbc/dictItems/getDictValue`; $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 * @returns
@ -132,6 +136,13 @@ export class SupplyManagementService extends BaseService {
constructor(public injector: Injector) { constructor(public injector: Injector) {
super(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'; public $api_getWholeInsuranceInfo = '/api/sdc/goodsResourceShipper/getWholeInsuranceInfo';
} }