This commit is contained in:
wangshiming
2022-02-18 10:45:58 +08:00
parent 2660fea880
commit 35d19d4d7e
4 changed files with 86 additions and 50 deletions

View File

@ -220,21 +220,21 @@
<nz-card>
<div class="card-title">服务信息</div>
<div nz-row>
<div nz-col nzSpan="12">
<div nz-col nzSpan="18">
<sf #sf55 [schema]="schema55" [button]="'none'" [ui]="ui55" [formData]="sf55data"></sf>
</div>
</div>
<div nz-row [nzGutter]="24" style="margin: 24px 0">
<div nz-row [nzGutter]="24" style="margin-bottom: 24px">
<div nz-col [nzSpan]="10">
<div class="align-center">
<span style="font-weight: bolder; margin-right: 24px">购买货运险</span>
<span style="font-weight: bolder; margin-right: 12px">购买货运险</span>
<nz-alert nzType="warning" [nzMessage]="template1" nzShowIcon></nz-alert>
</div>
</div>
</div>
<ng-template #template1>推荐投保,填写货值自动估保费,司机接单后不可退保。详见<a>《投保告知》</a></ng-template>
<ng-template #template1>推荐投保,填写货值自动估保费,司机接单后不可退保。详见<a target="_blank" [queryParams]="{ type: 10 }" [routerLink]="['/passport/agreement']">《投保告知》</a></ng-template>
<div nz-row>
<div nz-col nzSpan="12">
<div nz-col nzSpan="18">
<sf #sf5 [schema]="schema5" [button]="'none'" [ui]="ui5" [formData]="sf5data">
<ng-template sf-template="goodsValue" let-i let-ui="ui">
<div class="align-center">
@ -243,12 +243,12 @@
[nzMin]="50000"
[nzMax]="3000000"
[nzStep]="0.01"
(ngModelChange)="i.setValue($event)"
(ngModelChange)="i.setValue($event);goodsValuesChange($event)"
nzPlaceHolder="请输入50000-3000000之间数值"
></nz-input-number>
</div>
</ng-template>
<ng-template sf-template="insureInfo" let-i let-ui="ui">
<ng-template sf-template="insurancePremium" let-i let-ui="ui">
<div class="align-center">
<input nz-input placeholder="保价费金额" [ngModel]="i.value" [disabled]="true" />
<span style="padding: 0 12px" nz-tooltip [nzTooltipTitle]="template2" nzTooltipPlacement="bottom"
@ -267,6 +267,7 @@
</div>
</nz-card>
<nz-card>
<div class="card-title">补充信息</div>
<div nz-row>

View File

@ -446,19 +446,25 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
widget: 'custom'
}
},
insureInfo: {
insurancePremium: {
type: 'string',
title: '',
ui: {
widget: 'custom'
}
},
insuranceRate: {
type: 'string',
title: '保险费率',
ui: {
hidden: true
}
}
},
required: ['goodsValue']
}
};
this.ui5 = {
'*': {
spanLabelFixed: 90,
spanLabelFixed: 115,
grid: { span: 12 }
}
};
@ -1059,6 +1065,16 @@ 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) {
console.log(this.startInfo[0]?.area);
console.log(this.endInfo[0]?.area);
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
this.totalDistance = res.distance;
this.totalTime = res.time;
});
}
});
this.sf3data = {
@ -1086,21 +1102,9 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
};
if (res?.loadingTime) {
this.loadingTime = res?.loadingTime;
// this.validateForm1.patchValue(
// {
// loadingTime: res?.loadingTime,
// },
// { onlySelf: true },
// );
}
if (res?.unloadingTime) {
this.unloadingTime = res?.unloadingTime;
// this.validateForm1.patchValue(
// {
// unloadingTime: res?.unloadingTime,
// },
// { onlySelf: true },
// );
}
if (this.PageStatus === '整车修改') {
@ -1108,7 +1112,9 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
this.totalFees = res?.shippingInformationVO?.totalFee || '0';
this.sf5data = {
goodsValue: res?.goodsValue
goodsValue: res?.goodsValue,
insurancePremium: res?.insurancePremium || '',
insuranceRate: res?.insuranceRate || ''
};
this.sf55data = {
insuranceType: res?.insuranceType || ''
@ -1122,9 +1128,6 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
receiptAddress: res?.receiptAddress || '',
remarks: res?.supplementaryInformationVO?.remarks || ''
};
// if (this.PageStatus === '整车修改') {
// this.sf6data.id = res?.supplementaryInformationVO?.id
// }
this.sf7data = {
prePay: res?.shippingInformationVO?.prePay,
toPay: res?.shippingInformationVO?.toPay,
@ -1250,7 +1253,6 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.validateForm1.addControl(`unloadName${index}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`unloadPhone${index}`, new FormControl(null, [Validators.required, Validators.pattern('^[0-9]*$')]));
});
// 计算里程,时间
if (this.startInfo[0]?.area && this.endInfo[0]?.area) {
this.amapService.drivingCompute([...this.startInfo], [...this.endInfo]).subscribe(res => {
@ -1259,4 +1261,25 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
});
}
}
goodsValuesChange(value: any) {
console.log(value);
console.log(this.totalDistance);
if(value >= 50000 && this.totalDistance > 0){
const params = {
goodsValue: value,
insuranceType: this.sf55.value.insuranceType,
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);
}
});
}
}
}

View File

@ -109,26 +109,28 @@ export class SupplyManagementService extends BaseService {
$api_consignBulkQRCode = '/api/sdc/goodsResourceOperate/consignBulkQRCode';
// 获取操作日志列表
public $api_getOperationLogRecordsList = '/api/mdc/pbc/operationLogRecords/getOperationLogRecordsList';
// 获取数据字典
$api_getDictValue = `/api/mdc/pbc/dictItems/getDictValue`;
// 获取数据字典
$api_getDictValue = `/api/mdc/pbc/dictItems/getDictValue`;
/**
* 获取车型、车长字典数据
* @returns
*/
getDictOptions(params = {}) {
return this.request(this.$api_getDictValue, params).pipe(
map((res: any) => {
if (!res) {
return [];
}
const obj = [];
obj.push({ label: '不限', value: "999" })
return [...obj,...res];
})
)
}
/**
* 获取车型、车长字典数据
* @returns
*/
getDictOptions(params = {}) {
return this.request(this.$api_getDictValue, params).pipe(
map((res: any) => {
if (!res) {
return [];
}
const obj = [];
obj.push({ label: '不限', value: '999' });
return [...obj, ...res];
})
);
}
constructor(public injector: Injector) {
super(injector);
}
// 获取保价费信息
public $api_getWholeInsuranceInfo = '/api/sdc/goodsResourceShipper/getWholeInsuranceInfo';
}

View File

@ -1,3 +1,13 @@
/*
* @Description :
* @Version : 1.0
* @Author : Shiming
* @Date : 2021-12-24 15:37:00
* @LastEditors : Shiming
* @LastEditTime : 2022-02-18 10:45:06
* @FilePath : \\tms-obc-web\\src\\app\\shared\\components\\amap\\amap.service.ts
* Copyright (C) 2022 huzhenhong. All rights reserved.
*/
import { Injectable } from '@angular/core';
import { Observable, Subject, throwError } from 'rxjs';
import AMapLoader from '@amap/amap-jsapi-loader';
@ -16,18 +26,18 @@ export class AmapService {
sub = new Subject<any>();
currentSub = new Subject<any>();
//计算路径驾车最优路线的长度与所需时间
drivingCompute(starts: any[], ends: any[]): Observable<any> {
//计算路径驾车最优路线的长度与所需时间
drivingCompute(starts: any[], ends: any[]): Observable<any> {
AMap.plugin('AMap.Driving', () => {
let driving = new AMap.Driving({
// 驾车路线规划策略AMap.DrivingPolicy.LEAST_TIME是最快捷模式
policy: AMap.DrivingPolicy.LEAST_TIME
});
const points = starts.concat(ends).map(item => {
return { keyword: item.address, city: item.city };
return { keyword: item.detailedAddress, city: item.city };
});
driving.search(points, (status: any, result: any) => {
const repData = { distance: (result.routes[0].distance / 1000).toFixed(2), time: (result.routes[0].time / 60 / 60).toFixed(2) };
const repData = { distance: (result?.routes?.[0]?.distance / 1000).toFixed(2), time: (result?.routes?.[0]?.time / 60 / 60).toFixed(2) };
this.sub.next(repData);
});
});