车辆对接

This commit is contained in:
wangshiming
2021-12-29 13:12:26 +08:00
parent 5aec1bf8f1
commit 0262716364
18 changed files with 2077 additions and 81 deletions

View File

@ -0,0 +1,236 @@
<page-header-wrapper [title]="''"></page-header-wrapper>
<nz-card>
<div class="card-title">货源单设置</div>
<div nz-row>
<div nz-col nzSpan="12">
<sf #sf1 [schema]="schema1" [button]="'none'" [ui]="ui1" [formData]="sf1data">
<ng-template sf-template="enterpriseInfoName" let-i let-ui="ui"> {{ i.value }} </ng-template>
</sf>
</div>
</div>
</nz-card>
<nz-card>
<div class="card-title"
>装卸货信息<span class="tip-font">预计公里数:{{ totalDistance }}km预计行程耗时{{ totalTime }}小时</span></div
>
<form nz-form [formGroup]="validateForm1" role="form">
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="10">
<div *ngFor="let data1 of startInfo; let idx = index">
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired>装货地</nz-form-label>
<nz-form-control [nzErrorTip]="'请输入装货地'">
<div class="align-center">
<nz-input-group [nzSuffix]="endInconTemp1">
<input
nz-input
[(ngModel)]="data1.detailedAddress"
(click)="openMap('start', idx)"
formControlName="loadAddress{{ idx }}"
placeholder="请输入装货地"
/>
</nz-input-group>
<span style="padding: 0 10px"
><i nz-icon nzType="menu" nzTheme="outline" style="color: #1890ff" (click)="chooseAddress(idx, 'start')"></i
></span>
</div>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired>联系人</nz-form-label>
<div class="align-center">
<nz-form-control [nzErrorTip]="'请输入联系人姓名'">
<input
nz-input
[(ngModel)]="data1.appUserName"
formControlName="loadName{{ idx }}"
maxlength="30"
placeholder="请输入联系人姓名"
/>
</nz-form-control>
<nz-form-control [nzErrorTip]="'请输入联系人电话'">
<input
style="margin-left: 12px"
nz-input
[(ngModel)]="data1.contractTelephone"
maxlength="11"
formControlName="loadPhone{{ idx }}"
placeholder="请输入联系人电话"
/>
</nz-form-control>
</div>
</nz-form-item>
</div>
</div>
<div nz-col [nzSpan]="4">
<div style="display: flex; justify-content: center">
<span style="padding: 24 px; font-size: 30px; color: #7d7d7d"><i nz-icon nzType="swap" nzTheme="outline"></i></span>
</div>
</div>
<div nz-col [nzSpan]="10">
<div *ngFor="let data2 of endInfo; let idx = index">
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired>卸货地</nz-form-label>
<nz-form-control [nzErrorTip]="'请输入卸货地'">
<div class="align-center">
<nz-input-group [nzSuffix]="endInconTemp1">
<input
nz-input
[(ngModel)]="data2.detailedAddress"
(click)="openMap('end', idx)"
formControlName="unloadAddress{{ idx }}"
placeholder="请输入卸货地"
/>
</nz-input-group>
<span style="padding: 0 10px"
><i nz-icon nzType="menu" nzTheme="outline" style="color: #1890ff" (click)="chooseAddress(idx, 'end')"></i
></span>
</div>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired>联系人</nz-form-label>
<div class="align-center">
<nz-form-control [nzErrorTip]="'请输入联系人姓名'">
<input
nz-input
[(ngModel)]="data2.appUserName"
maxlength="30"
formControlName="unloadName{{ idx }}"
placeholder="请输入联系人姓名"
/>
</nz-form-control>
<nz-form-control [nzErrorTip]="'请输入联系人电话'">
<input
style="margin-left: 12px"
nz-input
[(ngModel)]="data2.contractTelephone"
formControlName="unloadPhone{{ idx }}"
maxlength="11"
placeholder="请输入联系人电话"
/>
</nz-form-control>
</div>
</nz-form-item>
</div>
</div>
</div>
<ng-template #endInconTemp1><i nz-icon nzType="environment" nzTheme="outline"></i></ng-template>
</form>
</nz-card>
<nz-card>
<div class="card-title">货物信息</div>
<div nz-row>
<div nz-col nzSpan="12">
<sf #sf3 [schema]="schema3" [button]="'none'" [ui]="ui3" [formData]="sf3data"></sf>
<sf #sf4 [schema]="schema4" [button]="'none'" [ui]="ui4" [formData]="sf4data">
<ng-template sf-template="freightPrice" let-i let-ui="ui">
<nz-input-group [nzAddOnAfter]="addOnAfterTemplate">
<input nz-input [ngModel]="i.value" (ngModelChange)="i.setValue($event)" placeholder="请输入" />
</nz-input-group>
<ng-template #addOnAfterTemplate>
<nz-select [ngModel]="sf4.value.freightType" (ngModelChange)="sf4.setValue('/freightType', $event)">
<nz-option [nzValue]="item.value" [nzLabel]="item.label" *ngFor="let item of freightTypeOptions"></nz-option>
</nz-select>
</ng-template>
</ng-template>
<ng-template sf-template="rule" let-i let-ui="ui">
<div class="align-center">
<nz-select [ngModel]="i.value" (ngModelChange)="i.setValue($event)" nzPlaceHolder="运费取整规则">
<nz-option nzLabel="保留小数" nzValue="1"></nz-option>
<nz-option nzLabel="抹除小数" nzValue="2"></nz-option>
<nz-option nzLabel="抹除个数" nzValue="3"></nz-option>
</nz-select>
<span style="padding: 0 12px" nz-tooltip [nzTooltipTitle]="template2" nzTooltipPlacement="bottom"
><i nz-icon nzType="exclamation-circle" nzTheme="outline" style="color: #1890ff"></i
></span>
<ng-template #template2>
<p>例如 付司机运费 = 重量*单价 = 999.99</p>
<p>保留小数,即 999.99</p>
<p>抹除小数,即 999.00</p>
<p>抹除个位,即 990.00</p>
</ng-template>
</div>
</ng-template>
<ng-template sf-template="weight" let-i let-ui="ui">
<nz-input-group [nzAddOnAfter]="''">
<input
nz-input
type="number"
[ngModel]="i.value"
min="0"
step="0.01"
(ngModelChange)="i.setValue($event)"
placeholder="总重量,必填"
/>
</nz-input-group>
</ng-template>
<ng-template sf-template="volume" let-i let-ui="ui">
<nz-input-group [nzAddOnAfter]="''">
<input
nz-input
type="number"
[ngModel]="i.value"
min="0"
step="0.01"
(ngModelChange)="i.setValue($event)"
placeholder="总体积"
/>
</nz-input-group>
</ng-template>
<ng-template sf-template="number" let-i let-ui="ui">
<nz-input-group [nzAddOnAfter]="''">
<input
nz-input
type="number"
[ngModel]="i.value"
min="0"
step="0.01"
(ngModelChange)="i.setValue($event)"
placeholder="总车次"
/>
</nz-input-group>
</ng-template>
</sf>
</div>
</div>
</nz-card>
<nz-card>
<div class="card-title">补充信息</div>
<div nz-row>
<div nz-col nzSpan="12">
<sf #sf6 [schema]="schema6" [button]="'none'" [ui]="ui6" [formData]="sf6data">
<ng-template sf-template="paymentDays" let-i let-ui="ui">
<div nz-row>
<div class="align-center">
<div nz-col nzSpan="16">
<nz-input-number
[ngModel]="i.value"
[nzMin]="1"
[nzMax]="30"
[nzStep]="1"
(ngModelChange)="i.setValue($event)"
nzPlaceHolder="请输入1-30"
></nz-input-number>
</div>
<div nz-col nzSpan="8">
<span>天内支付运费</span>
</div>
</div>
</div>
</ng-template>
</sf>
</div>
</div>
</nz-card>
<nz-card>
<div class="align-center">
<button nz-button nzType="primary" (click)="submit('assign')">指派熟车</button>
<button nz-button nzType="primary" style="margin-left: 48px" (click)="submit('publish')">司机抢单</button>
</div>
</nz-card>

View File

@ -0,0 +1,22 @@
.tip-font {
margin-left: 16px;
font-weight: 500;
font-size: 12px;
}
.card-title {
margin-bottom: 24px;
font-weight: bold;
font-size: 16px;
}
.align-center {
display: flex;
align-items: center;
justify-content: center;
}
#container {
width: 300px;
height: 180px;
}

View File

@ -0,0 +1,595 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import {
SFArrayWidgetSchema,
SFComponent,
SFNumberWidgetSchema,
SFSchema,
SFSchemaEnum,
SFSelectWidgetSchema,
SFTextareaWidgetSchema,
SFUISchema
} from '@delon/form';
import { SettingsService, _HttpClient } from '@delon/theme';
import format from 'date-fns/format';
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';
import { AmapPoiPickerComponent, AmapService } from 'src/app/shared/components/amap';
import { SupplyManagementService } from '../../services/supply-management.service';
import { PublishGoodsChooseFamifiarComponent } from '../choose-famifiar/choose-famifiar.component';
// import { PublishGoodsChooseFamifiarComponent } from '../choose-famifiar-bulk/choose-famifiar.component';
import { PublishAddressListComponent } from '../onecar-publish/address-list/address-list.component';
import { PublishSuccessComponent } from '../onecar-publish/publish-success/publish-success.component';
// import { PublishSuccessComponent } from '../publish-success/publish-success.component';
@Component({
selector: 'app-publish-goods-bulk-publish',
templateUrl: './bulk-release-publish.component.html',
styleUrls: ['./bulk-release-publish.component.less']
})
export class SupplyManagementBulkReleasePublishComponent implements OnInit {
validateForm1: FormGroup;
sf1data: any; // 货源单设置回显
sf3data: any; // 货源单设置回显
sf4data: any; // 货源单设置回显
sf5data: any; // 货源单设置回显
sf6data: any; // 货源单设置回显
sf7data: any; // 货源单设置回显
creatTime: any; // 货源单设置回显
modifyTime: any; // 货源单设置回显
totalFees: any; // 总数信息
id = '';
type = 'add';
// // 单位
unit1 = '吨';
unit2 = '方';
unit3 = '保价费金额';
startInfo: any[] = [];
endInfo: any[] = [];
totalDistance = 0.0; //总里程
totalTime = 0.0; //路程总时间
currentGoodsTypeName: any;
freightTypeOptions: any;
ruleOptions: any;
constructor(
private http: _HttpClient,
fb: FormBuilder,
private modalService: NzModalService,
private settingSrv: SettingsService,
private service: SupplyManagementService,
private router: Router,
private route: ActivatedRoute,
private amapService: AmapService
) {
this.validateForm1 = fb.group({
loadAddress0: [null, [Validators.required]],
loadName0: [null, [Validators.required]],
loadPhone0: [null, [Validators.required]],
unloadAddress0: [null, [Validators.required]],
unloadName0: [null, [Validators.required]],
unloadPhone0: [null, [Validators.required]]
});
}
@ViewChild('sf1', { static: false }) sf1!: SFComponent;
schema1: SFSchema = {};
ui1!: SFUISchema;
@ViewChild('sf3', { static: false }) sf3!: SFComponent;
schema3: SFSchema = {};
ui3!: SFUISchema;
@ViewChild('sf4', { static: false }) sf4!: SFComponent;
schema4: SFSchema = {};
ui4!: SFUISchema;
@ViewChild('sf6', { static: false }) sf6!: SFComponent;
schema6: SFSchema = {};
ui6!: SFUISchema;
ngOnInit(): void {
this.initSF1();
this.initSF3();
this.initSF4();
this.initSF6();
this.startInfo = [
{
detailedAddress: '',
appUserName: '',
contractTelephone: '',
latitude: '',
longitude: '',
province: '',
city: '',
area: '',
type: '1'
}
];
this.endInfo = [
{
detailedAddress: '',
appUserName: '',
contractTelephone: '',
latitude: '',
longitude: '',
province: '',
city: '',
area: '',
type: '2'
}
]
}
initSF1() {
this.schema1 = {
properties: {
shipperAppUserId: {
title: '货主',
type: 'string',
maxLength: 30,
ui: {
widget: 'select',
serverSearch: true,
searchDebounceTime: 300,
searchLoadingText: '搜索中...',
onSearch: (q: any) => {
if (!!q) {
return this.service
.request(this.service.$api_enterpriceList, { enterpriseName: q})
.pipe(map((res: any[]) => (res as any[]).map((i) => ({ label: i.enterpriseName, value: i.id } as SFSchemaEnum))))
.toPromise();
} else {
return of([]);
}
},
change: (q: any) => {
this.getRegionCode(q)
},
visibleIf: {
_$expand: (value: boolean) => value,
},
} as SFSelectWidgetSchema,
},
enterpriseProjectId: {
type: 'string',
title: '项目',
ui: {
widget: 'select',
placeholder: '请选择',
allowClear: true,
} as SFSelectWidgetSchema
},
enterpriseInfoName: {
type: 'string',
title: '网络货运人',
ui: {
widget: 'custom'
},
default: '天津市怡亚通XXXX有限公司'
},
deadlineTime: {
title: '截至日期',
type: 'string',
format: 'date-time',
ui: {
placeholder: '请输入',
format: 'yyyy-MM-dd HH:mm:ss'
}
},
dispatchId: {
type: 'string',
title: '调度员',
enum: [
{ label: '周涛', value: 1 },
{ label: '李诞', value: 2 }
],
ui: {
widget: 'select',
placeholder: '请选择',
allowClear: true,
optionalHelp: '选择调度员,司机直接联系调度员 ; 不选择,司机直接联系您'
// asyncData: () =>
// this.service.loadChildData2('0', '2').pipe(
// map((data: any) => {
// return data.map((m: any) => {
// return { label: m.name, value: m.id };
// });
// }),
// ),
// change: (i) => this.updateCategory(i, '/categoryId2'),
} as SFSelectWidgetSchema
}
},
required: ['deadlineTime']
};
this.ui1 = {
'*': {
spanLabelFixed: 90,
grid: { span: 12 }
},
$enterpriseInfoName: {
grid: { span: 24 }
}
};
}
initSF3() {
this.schema3 = {
properties: {
goodsTypeId: {
type: 'string',
title: '货物名称',
enum: [
{ label: '服装', value: '1' },
{ label: '电子产品', value: '2' },
{ label: '其他', value: '3' }
],
ui: {
widget: 'select',
placeholder: '请选择',
errors: { required: '请填写货物名称' },
change: (value, data) => {
this.currentGoodsTypeName = data;
}
// asyncData: () =>
// this.categoryService.loadChildData2('0', '2').pipe(
// map((data: any) => {
// return data.map((m: any) => {
// return { label: m.name, value: m.id };
// });
// }),
// ),
// change: (i) => this.updateCategory(i, '/categoryId2'),
} as SFSelectWidgetSchema
},
goodsName: {
type: 'string',
title: '',
maxLength: 20,
ui: {
errors: { required: '请填写货物名称' },
visibleIf: {
goodsType: value => value === '其他'
}
}
}
},
required: ['goodsTypeId', 'goodsName']
};
this.ui3 = {
'*': {
spanLabelFixed: 90,
grid: { span: 12 }
}
};
}
initSF4() {
this.schema4 = {
properties: {
freightPrice: {
type: 'string',
title: '运费单价',
ui: {
errors: { required: '请选择运费单价' },
widget: 'custom',
placeholder: '请输入'
}
},
freightType: {
type: 'string',
title: '',
ui: {
hidden: true
},
default: '1'
},
rule: {
type: 'string',
title: '',
ui: {
widget: 'custom',
errors: { required: '请选择运费取整规则' }
}
},
settlementBasis: {
type: 'string',
title: '',
ui: {
widget: 'dict-select',
params: { dictKey: 'goodresource:settlement:type' },
placeholder: '结算依据',
errors: { required: '请选择结算依据' }
} as SFSelectWidgetSchema
},
weight: {
type: 'string',
title: '货物数量',
ui: {
widget: 'custom',
placeholder: '请输入',
errors: { required: '请填写总重量' }
}
},
volume: {
type: 'string',
title: '',
ui: {
widget: 'custom',
placeholder: '请输入'
}
},
number: {
type: 'string',
title: '',
ui: {
widget: 'custom',
placeholder: '请输入'
}
},
maxWeight: {
type: 'string',
title: '车型/车长',
default: [],
ui: {
widget: 'dict-select',
params: { dictKey: 'car:model' },
mode: 'multiple',
placeholder: '请选择车型',
errors: { required: '请选择车型' }
}
},
maxCube: {
type: 'string',
title: '',
default: [],
ui: {
widget: 'dict-select',
params: { dictKey: 'car:length' },
mode: 'multiple',
placeholder: '请选择车长',
errors: { required: '请选择车长' }
}
}
},
required: ['weight', 'maxWeight', 'maxCube', 'freightPrice', 'rule', 'settlementBasis']
};
this.ui4 = {
'*': {
spanLabelFixed: 90,
grid: { span: 24 }
},
$freightPrice: {
grid: { span: 8 }
},
$rule: {
grid: { span: 8 }
},
$settlementBasis: {
grid: { span: 8 }
},
$weight: {
grid: { span: 8 }
},
$volume: {
grid: { span: 8 }
},
$number: {
grid: { span: 8 }
},
$maxWeight: {
grid: { span: 12 }
},
$maxCube: {
grid: { span: 12 }
}
};
}
initSF6() {
this.schema6 = {
properties: {
paymentDays: {
type: 'string',
title: '到货后',
ui: {
widget: 'custom',
placeholder: '请输入',
errors: { required: '请输入付款承诺天数' }
}
},
remarks: {
type: 'string',
title: '备注',
maxLength: 200,
ui: {
widget: 'textarea',
placeholder: '请输入',
autosize: { minRows: 3, maxRows: 3 }
} as SFTextareaWidgetSchema
}
},
required: ['paymentDays']
};
this.ui6 = {
'*': {
spanLabelFixed: 90,
grid: { span: 24 }
}
};
}
//指派熟车
chooseFamifiar(item: any) {
// this.modalService.create({
// nzTitle: '指派熟车',
// nzContent: PublishGoodsChooseFamifiarComponent,
// nzComponentParams: {
// submitParams: item,
// submitUrl: this.service.$api_save_bulk_assign
// },
// nzWidth: 1300
// });
}
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 });
if (this.validateForm1.invalid || !this.sf1.valid || !this.sf3.valid || !this.sf4.valid || !this.sf6.valid) {
return;
}
// //装卸货信息
const LoadingList = this.startInfo.concat(this.endInfo);
// // 货物信息
const goodsInfoList = [
{
...this.sf3.value,
goodsTypeName: this.currentGoodsTypeName.label,
goodsName: '电子',
goodsNameId: '1',
...this.sf4.value,
maxWeight: this.sf4.value.maxWeight.join(','),
maxCube: this.sf4.value.maxCube.join(',')
}
];
const params = {
id: '',
...this.sf1.value,
unLoadingPlaceDTOList: LoadingList,
goodsInfoDTOList: goodsInfoList,
...this.sf6.value
};
let reqUrl = this.service.$api_consignBulk;
if (submitType === 'assign') {
console.log('params', params);
this.chooseFamifiar(params);
} else {
this.service.request(reqUrl, params).subscribe(res => {
if (res) {
this.modalService.create({
nzTitle: '',
nzContent: PublishSuccessComponent,
nzWidth: 900,
nzFooter: null,
nzComponentParams: { type: 'bulk' }
});
} else {
this.service.msgSrv.error(res.msg);
}
});
}
}
// 获取城市列表
getRegionCode(regionCode: any) {
console.log(regionCode)
return this.service
.request(this.service.$api_get_enterprise_project, { id: regionCode })
.pipe(
map((res) =>
res.map((item: any) => ({
label: item.projectName,
value: item.id,
})),
),
)
.subscribe((res) => {
this.sf1.getProperty('/enterpriseProjectId')!.schema.enum = res;
this.sf1.getProperty('/enterpriseProjectId')!.widget.reset(res);
});
}
// 打开地图
openMap(type: string, index: number) {
const modalRef = this.modalService.create({
nzTitle: '',
nzContent: AmapPoiPickerComponent,
nzWidth: 900,
nzOnOk: item => {
const poi = item.poi;
const locList = poi.pois;
switch (type) {
case 'start':
this.startInfo[index].detailedAddress = poi.formattedAddress;
this.startInfo[index].longitude = locList[0];
this.startInfo[index].latitude = locList[1];
this.startInfo[index].province = poi.addressComponent.province;
this.startInfo[index].city = poi.addressComponent.city;
this.startInfo[index].area = poi.addressComponent.district;
break;
case 'end':
this.endInfo[index].detailedAddress = poi.formattedAddress;
this.endInfo[index].longitude = locList[0];
this.endInfo[index].latitude = locList[1];
this.endInfo[index].province = poi.addressComponent.province;
this.endInfo[index].city = poi.addressComponent.city;
this.endInfo[index].area = poi.addressComponent.district;
break;
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;
});
}
}
});
}
chooseAddress(index: number, type: string) {
const modalRef = this.modalService.create({
nzTitle: '选择地址',
nzContent: PublishAddressListComponent,
nzWidth: 900,
nzComponentParams: { spuStatus: '1' },
nzOnOk: item => {
const data = item.seleteData;
if (JSON.stringify(data) === '{}') return;
switch (type) {
case 'start':
this.startInfo[index] = {
detailedAddress: data.detailedAddress,
appUserName: data.contactName,
contractTelephone: data.contactTelephone,
latitude: data.contactTelephone,
longitude: data.latitude,
province: data.province,
city: data.city,
area: data.area,
type: '1'
};
break;
case 'end':
this.endInfo[index] = {
detailedAddress: data.detailedAddress,
appUserName: data.contactName,
contractTelephone: data.contactTelephone,
latitude: data.contactTelephone,
longitude: data.latitude,
province: data.province,
city: data.city,
area: data.area,
type: '2'
};
break;
default:
break;
}
}
});
}
}

View File

@ -34,12 +34,18 @@
</ng-container>
</div>
</nz-card>
<ng-template #extraTemplate>
<div>
<button (click)="audit('',2)" nz-button nzType="primary">批量审核</button>
<button (click)="releaseGoods()" nz-button nzType="primary">代发货源</button>
</div>
</ng-template>
<nz-card>
<!-- <nz-tabset (nzSelectedIndexChange)="selectChange($event)" [nzTabBarExtraContent]="extraTemplate">
<nz-tab *ngFor="let tab of tabs; let i = index" [nzTitle]="tab.name + ' (' + tab.count + ') '" (nzClick)="tabChange(i)">
</nz-tab>
</nz-tabset> -->
<nz-tabset (nzSelectedIndexChange)="selectChange($event)">
<nz-tabset (nzSelectedIndexChange)="selectChange($event)" [nzTabBarExtraContent]="extraTemplate">
<nz-tab [nzTitle]="'全部('+tabs?.totalQuantity+')'"></nz-tab>
<nz-tab [nzTitle]="'进行中('+tabs?.stayQuantity+')'"></nz-tab>
<nz-tab [nzTitle]="'已完结('+tabs?.receivedQuantity+')'"></nz-tab>

View File

@ -397,6 +397,12 @@ export class SupplyManagementBulkComponent implements OnInit {
this.isVisible = false
}
/**
* 代发货源
*/
releaseGoods() {
this.router.navigate(['/supply-management/bulk-release']);
}
/**
* 审核通过按钮
*/
handleOK() {

View File

@ -222,21 +222,20 @@
</div>
</div>
</nz-card>
<nz-card>
<div class="card-title">运费信息</div>
<div nz-row>
<div nz-col nzSpan="12">
<sf #sf7 [schema]="schema7" [formData]="sf7data" [button]="'none'" [ui]="ui7">
<ng-template sf-template="totalFee" let-i let-ui="ui" >
<div>{{totalFees | currency: '¥'}}</div>
</ng-template>
<sf #sf7 [schema]="schema7" [button]="'none'" [ui]="ui7" [formData]="sf7data">
<ng-template sf-template="subtotal" let-i let-ui="ui">¥{{i.value}}</ng-template>
<ng-template sf-template="appendFee" let-i let-ui="ui">{{i.value}}(费率:{{currentRate | number: '0.2-4' }}%</ng-template>
<ng-template sf-template="total" let-i let-ui="ui">¥{{i.value}}</ng-template>
<ng-template sf-template="paymentDays" let-i let-ui="ui">
<div nz-row>
<div class="align-center">
<div nz-col nzSpan="16">
<!-- <input nz-input [ngModel]="i.value" (ngModelChange)="i.setValue($event)" /> -->
<nz-input-number [(ngModel)]="i.value" (ngModelChange)="i.setValue($event)" [nzMin]="1" [nzMax]="30" [nzStep]="1"></nz-input-number>
<nz-input-number [ngModel]="i.value" [nzMin]="1" [nzMax]="30" [nzStep]="1"
(ngModelChange)="i.setValue($event)" nzPlaceHolder="请输入1-30"></nz-input-number>
</div>
<div nz-col nzSpan="8">
<span>天内支付运费</span>
@ -250,7 +249,7 @@
</nz-card>
<nz-card>
<div class="align-center">
<button nz-button nzType="primary" (click)="chooseFamifiar()">指派熟车</button>
<button nz-button nzType="primary" style="margin-left: 48px" (click)="submit()">司机抢单</button>
<button nz-button nzType="primary" (click)="chooseFamifiar()">取消</button>
<button nz-button nzType="primary" style="margin-left: 48px" (click)="submit()">提交修改</button>
</div>
</nz-card>

View File

@ -40,6 +40,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
totalFees: any; // 总数信息
totalDistance = 0.0; //总里程
totalTime = 0.0; //路程总时间
currentRate = 0 //实时计算的费率
npp =false
id = this.route.snapshot.params.id;
// // 单位
@ -369,7 +371,6 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
};
}
initSF6() {
this.schema6 = {
properties: {
@ -392,6 +393,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
ui: {
widget: 'dict-select',
params: { dictKey: 'receipt:type' },
containsAllLable:false,
placeholder: '请选择',
errors: { required: '请选择' },
visibleIf: {
@ -399,56 +401,55 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
}
},
receiptUserId: {
receiptAddressId: {
type: 'string',
title: '选择地址',
ui: {
widget: 'custom',
placeholder: '请点击选择收回单地址',
validator: val => (this.sf6?.value?.receiptType === '2' ? [{ keyword: 'required', message: '请点击选择收回单地址' }] : []),
// validator: val => (this.sf6?.value?.receiptType === '2' ? [{ keyword: 'required', message: '请点击选择收回单地址' }] : []),
visibleIf: {
receiptType: value => value === 2
receiptType: value => value === '2'
}
},
default: '1212'
default: ''
},
name4: {
receiptUserName: {
type: 'string',
title: '联系人',
ui: {
visibleIf: {
receiptType: value => value === 2
receiptType: value => value === '2'
}
},
readOnly: true
},
name5: {
phon: {
type: 'string',
title: '联系电话',
ui: {
visibleIf: {
receiptType: value => value === 2
receiptType: value => value === '2'
}
},
readOnly: true
},
name6: {
area: {
type: 'string',
title: '所在地区',
ui: {
visibleIf: {
receiptType: value => value === 2
receiptType: value => value === '2'
}
},
readOnly: true
},
receiptAddress: {
address: {
type: 'string',
title: '详细地址',
maxLength: 20,
ui: {
visibleIf: {
receiptType: value => value === 2
receiptType: value => value === '2'
}
},
readOnly: true
@ -464,7 +465,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
} as SFTextareaWidgetSchema
}
},
required: ['stateReceipt', 'receiptType']
required: ['stateReceipt', 'receiptType','receiptAddressId']
};
this.ui6 = {
'*': {
@ -480,50 +481,43 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
initSF7() {
this.schema7 = {
properties: {
prePay: { type: 'number', title: '预付', default: 0, ui: { prefix: '¥', change: ()=> {
this.changeValue();
},
} as SFNumberWidgetSchema },
toPay: { type: 'number', title: '到付', default: 0, ui: { prefix: '¥',change: ()=> {
this.changeValue();
},
} as SFNumberWidgetSchema },
oilCardPay: { type: 'number', title: '油卡', default: 0, ui: { prefix: '¥',change: ()=> {this.changeValue();} ,
} as SFNumberWidgetSchema },
receiptPay: { type: 'number', title: '回单付', default: 0, ui: { prefix: '¥',change: ()=> {
this.changeValue();},
} as SFNumberWidgetSchema },
subtotal: {
type: 'string',
title: '小计',
prePay: {
type: 'number',
title: '预付',
default: 0,
ui: {
widget: 'custom',
placeholder: '请输入',
prefix: '',
change: args => this.payChange()
} as SFNumberWidgetSchema
},
toPay: {
type: 'number',
title: '到付',
default: 0,
ui: { prefix: '¥', change: args => this.payChange() } as SFNumberWidgetSchema
},
appendFee: {
type: 'string',
title: '附加费',
ui: {
widget: 'custom',
placeholder: '请输入',
oilCardPay: {
type: 'number',
title: '油卡',
default: 0,
ui: { prefix: '¥', change: args => this.payChange() } as SFNumberWidgetSchema
},
},
totalFee: {
type: 'string',
title: '总费用',
ui: {
widget: 'custom',
placeholder: '请输入'
}
receiptPay: {
type: 'number',
title: '回单付',
default: 0,
ui: { prefix: '', change: args => this.payChange() } as SFNumberWidgetSchema
},
subtotal: { type: 'number', title: '小计',default: 0, ui: {widget: 'custom' } as SFNumberWidgetSchema },
appendFee: { type: 'number', title: '附加费', default: 0, ui: {widget: 'custom' } as SFNumberWidgetSchema },
total: { type: 'number', title: '总费用', default: 0, ui: { widget: 'custom' } as SFNumberWidgetSchema },
paymentDays: {
type: 'string',
title: '到货后',
ui: {
widget: 'custom',
placeholder: '请输入',
errors: { required: '请输入付款承诺天数' }
}
}
},
@ -536,6 +530,28 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
};
}
payChange() {
const subtotal = (this.sf7.value.prePay + this.sf7.value.toPay + this.sf7.value.oilCardPay + this.sf7.value.receiptPay) || 0;
const oilCardPay = this.sf7.value.oilCardPay || 0;
this.service.request(this.service.$api_getCalculatedSurcharge+`?totalFreight=${subtotal}&fuelCardAmount=${oilCardPay}`).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;
} else {
this.service.msgSrv.error(res.msg);
}
});
} else {
this.service.msgSrv.error(res.msg);
}
});
}
addStartInfo(event: any) {
if (this.startInfo.length < 5) {

View File

@ -1,3 +1,11 @@
<!--
* @Author: your name
* @Date: 2021-12-14 20:39:34
* @LastEditTime: 2021-12-28 20:49:04
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \tms-obc-web\src\app\routes\supply-management\components\onecar-publish\publish-success\publish-success.component.html
-->
<div style="margin-top: 64px">
<nz-result nzStatus="success" nzTitle="下单成功!">
<div nz-result-extra>

View File

@ -1,11 +1,3 @@
/*
* @Author: your name
* @Date: 2021-12-14 20:39:34
* @LastEditTime: 2021-12-14 20:43:18
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \tms-obc-web\src\app\routes\supply-management\components\onecar-publish\publish-success\publish-success.component.ts
*/
import { Component } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { NzMessageService } from 'ng-zorro-antd/message';
@ -17,6 +9,7 @@ import { NzMessageService } from 'ng-zorro-antd/message';
})
export class PublishSuccessComponent {
type = 'onecar';
resourceObj: any = null;
constructor(private route: ActivatedRoute, private router: Router, public msg: NzMessageService) {
this.type = route.snapshot.queryParams.type || 'onecar';
}

View File

@ -0,0 +1,236 @@
<page-header-wrapper [title]="''"></page-header-wrapper>
<nz-card>
<div class="card-title">货源单设置</div>
<div nz-row>
<div nz-col nzSpan="12">
<sf #sf1 [schema]="schema1" [button]="'none'" [ui]="ui1" [formData]="sf1data">
<ng-template sf-template="enterpriseInfoName" let-i let-ui="ui"> {{ i.value }} </ng-template>
</sf>
</div>
</div>
</nz-card>
<nz-card>
<div class="card-title">装卸货信息<span class="tip-font">预计公里数:{{ totalDistance }}km预计行程耗时{{ totalTime }}小时</span></div>
<form nz-form [formGroup]="validateForm1" role="form">
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="10">
<div *ngFor="let data1 of startInfo; let idx = index">
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired>装货地</nz-form-label>
<nz-form-control [nzErrorTip]="'请输入装货地'">
<div class="align-center">
<nz-input-group [nzSuffix]="endInconTemp1">
<input nz-input [(ngModel)]="data1.detailedAddress" (click)="openMap('start', idx)"
formControlName="loadAddress{{ idx }}" placeholder="请输入装货地" />
</nz-input-group>
<span style="padding: 0 10px"><i nz-icon nzType="menu" nzTheme="outline" style="color: #1890ff"
(click)="chooseAddress(idx, 'start')"></i></span>
<span *ngIf="idx !== 0"><i nz-icon nzType="minus-circle-o" nzTheme="fill" style="color: #d9001b"
(click)="subStartInfo($event, idx)"></i></span>
</div>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired>联系人</nz-form-label>
<div class="align-center">
<nz-form-control [nzErrorTip]="'请输入联系人姓名'">
<input nz-input [(ngModel)]="data1.appUserName" formControlName="loadName{{ idx }}" name="loadName{{ idx }}" maxlength="30"
placeholder="请输入联系人姓名" />
</nz-form-control>
<nz-form-control [nzErrorTip]="'请输入联系人电话'">
<input style="margin-left: 12px" nz-input [(ngModel)]="data1.contractTelephone" maxlength="11"
formControlName="loadPhone{{ idx }}" name="loadPhone{{ idx }}" placeholder="请输入联系人电话" />
</nz-form-control>
</div>
</nz-form-item>
</div>
<div nz-row>
<div nz-col [nzSpan]="4"></div>
<button nz-button nzType="primary" (click)="addStartInfo()">
<i nz-icon nzType="plus"></i>
添加装货地
</button>
</div>
</div>
<div nz-col [nzSpan]="4">
<div style="display: flex; justify-content: center">
<span style="padding: 24 px; font-size: 30px; color: #7d7d7d"><i nz-icon nzType="swap"
nzTheme="outline"></i></span>
</div>
</div>
<div nz-col [nzSpan]="10">
<div *ngFor="let data2 of endInfo; let idx = index">
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired>卸货地</nz-form-label>
<nz-form-control [nzErrorTip]="'请输入卸货地'">
<div class="align-center">
<nz-input-group [nzSuffix]="endInconTemp1">
<input nz-input [(ngModel)]="data2.detailedAddress" (click)="openMap('end', idx)"
formControlName="unloadAddress{{ idx }}" placeholder="请输入卸货地" name="unloadAddress{{ idx }}" />
</nz-input-group>
<span style="padding: 0 10px"><i nz-icon nzType="menu" nzTheme="outline" style="color: #1890ff"
(click)="chooseAddress(idx, 'start')"></i></span>
<span *ngIf="idx !== 0"><i nz-icon nzType="minus-circle-o" nzTheme="fill" style="color: #d9001b"
(click)="subEndInfo($event, idx)"></i></span>
</div>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired>联系人</nz-form-label>
<div class="align-center">
<nz-form-control [nzErrorTip]="'请输入联系人姓名'">
<input nz-input [(ngModel)]="data2.appUserName" maxlength="30" formControlName="unloadName{{ idx }}" name="unloadAddress{{ idx }}"
placeholder="请输入联系人姓名" />
</nz-form-control>
<nz-form-control [nzErrorTip]="'请输入联系人电话'">
<input style="margin-left: 12px" nz-input [(ngModel)]="data2.contractTelephone"
formControlName="unloadPhone{{ idx }}" name="unloadAddress{{ idx }}" maxlength="11" placeholder="请输入联系人电话" />
</nz-form-control>
</div>
</nz-form-item>
</div>
<div nz-row>
<div nz-col [nzSpan]="4"></div>
<button nz-button nzType="primary" (click)="addEndInfo()">
<i nz-icon nzType="plus"></i>
添加卸货地
</button>
</div>
</div>
</div>
<div nz-row [nzGutter]="24" style="margin-top: 24px">
<div nz-col [nzSpan]="10">
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired>装货时间</nz-form-label>
<nz-form-control [nzErrorTip]="'请输入装货时间'">
<nz-date-picker nzShowTime nzFormat="yyyy-MM-dd HH:mm:ss" formControlName="loadingTime" name="loadingTime"></nz-date-picker>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="4"></div>
<div nz-col [nzSpan]="10">
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired>卸货时间</nz-form-label>
<nz-form-control [nzErrorTip]="'请输入卸货时间'">
<nz-date-picker nzShowTime nzFormat="yyyy-MM-dd HH:mm:ss" formControlName="unloadingTime" name="unloadingTime"></nz-date-picker>
</nz-form-control>
</nz-form-item>
</div>
</div>
<ng-template #endInconTemp1><i nz-icon nzType="environment" nzTheme="outline"></i></ng-template>
</form>
</nz-card>
<nz-card>
<div class="card-title">货物信息</div>
<div nz-row>
<div nz-col nzSpan="12">
<sf #sf3 [schema]="schema3" [button]="'none'" [ui]="ui3" [formData]="sf3data"></sf>
<sf #sf4 [schema]="schema4" [button]="'none'" [ui]="ui4" [formData]="sf4data">
<ng-template sf-template="weight" let-i let-ui="ui">
<nz-input-group [nzAddOnAfter]="''">
<input nz-input type="number" [ngModel]="i.value" min="0" step="0.01" (ngModelChange)="i.setValue($event)"
placeholder="总重量,必填" />
</nz-input-group>
</ng-template>
<ng-template sf-template="volume" let-i let-ui="ui">
<nz-input-group [nzAddOnAfter]="''">
<input nz-input type="number" [ngModel]="i.value" min="0" step="0.01" (ngModelChange)="i.setValue($event)"
placeholder="总体积" />
</nz-input-group>
</ng-template>
<ng-template sf-template="number" let-i let-ui="ui">
<nz-input-group [nzAddOnAfter]="''">
<input nz-input type="number" [ngModel]="i.value" min="0" step="0.01" (ngModelChange)="i.setValue($event)"
placeholder="总车次" />
</nz-input-group>
</ng-template>
</sf>
</div>
</div>
</nz-card>
<nz-card>
<div class="card-title">服务信息</div>
<div nz-row [nzGutter]="24" style="margin: 24px 0">
<div nz-col [nzSpan]="10">
<div class="align-center">
<span style="font-weight: bolder; margin-right: 24px">购买货运险</span>
<nz-alert nzType="warning" [nzMessage]="template1" nzShowIcon></nz-alert>
</div>
</div>
</div>
<ng-template #template1>推荐投保,填写货值自动估保费,司机接单后不可退保。详见<a>《投保告知》</a></ng-template>
<div nz-row>
<div nz-col nzSpan="8">
<sf #sf5 [schema]="schema5" [button]="'none'" [ui]="ui5" [formData]="sf5data">
<ng-template sf-template="goodsValue" let-i let-ui="ui">
<div class="align-center">
<nz-input-number [ngModel]="i.value" [nzMin]="50000" [nzMax]="3000000" [nzStep]="0.01"
(ngModelChange)="i.setValue($event)" nzPlaceHolder="请输入50000-3000000之间数值保留2位小数"></nz-input-number>
<span style="padding: 0 12px" nz-tooltip [nzTooltipTitle]="template2" nzTooltipPlacement="bottom"><i nz-icon
nzType="exclamation-circle" nzTheme="outline" style="color: #1890ff"></i></span>
<ng-template #template2>
<p>注意事项:</p>
<p>①请仔细阅读《投保告知》</p>
<p>②港澳台、西藏不在投保范围内,不予承保</p>
<p>③保价费最低收费2元请按真实货值填写录入的所有信息必须确保真实不如实录入的内容不承担对应赔偿责任。</p>
</ng-template>
</div>
</ng-template>
</sf>
</div>
</div>
</nz-card>
<nz-card>
<div class="card-title">补充信息</div>
<div nz-row>
<div nz-col nzSpan="12">
<sf #sf6 [schema]="schema6" [button]="'none'" [ui]="ui6" [formData]="sf6data">
<ng-template sf-template="receiptAddressId" let-i let-ui="ui">
<input nz-input [ngModel]="i.value" (ngModelChange)="i.setValue($event)" placeholder="请点击选择收回单地址"
(click)="backBillChange()" />
</ng-template>
</sf>
</div>
</div>
</nz-card>
<nz-card>
<div class="card-title">运费信息</div>
<div nz-row>
<div nz-col nzSpan="12">
<sf #sf7 [schema]="schema7" [button]="'none'" [ui]="ui7" [formData]="sf7data">
<ng-template sf-template="subtotal" let-i let-ui="ui">¥{{i.value}}</ng-template>
<ng-template sf-template="appendFee" let-i let-ui="ui">¥{{i.value}}(费率:{{currentRate | number: '0.2-4' }}%</ng-template>
<ng-template sf-template="total" let-i let-ui="ui">¥{{i.value}}</ng-template>
<ng-template sf-template="paymentDays" let-i let-ui="ui">
<div nz-row>
<div class="align-center">
<div nz-col nzSpan="16">
<nz-input-number [ngModel]="i.value" [nzMin]="1" [nzMax]="30" [nzStep]="1"
(ngModelChange)="i.setValue($event)" nzPlaceHolder="请输入1-30"></nz-input-number>
</div>
<div nz-col nzSpan="8">
<span>天内支付运费</span>
</div>
</div>
</div>
</ng-template>
</sf>
</div>
</div>
</nz-card>
<nz-card>
<div class="align-center">
<button nz-button nzType="primary" (click)="submit('assign')" *ngIf="type === 'add'">指派熟车</button>
<button nz-button nzType="primary" style="margin-left: 48px" (click)="submit('publish')"
*ngIf="type === 'add'">司机抢单</button>
<button nz-button nzType="primary" style="margin-left: 48px" (click)="submit('publish')" *ngIf="type === 'edit'"
[nzLoading]="service.http.loading">保存</button>
<button nz-button nzType="primary" style="margin-left: 48px" (click)="close()" *ngIf="type === 'edit'">取消</button>
</div>
</nz-card>

View File

@ -0,0 +1,30 @@
:host {
::ng-deep {
nz-input-number{width: 100%;}
}
}
.tip-font {
margin-left: 16px;
font-weight: 500;
font-size: 12px;
}
.card-title {
margin-bottom: 24px;
font-weight: bold;
font-size: 16px;
}
.align-center {
display: flex;
align-items: center;
justify-content: center;
}
#container {
width: 300px;
height: 180px;
}

View File

@ -0,0 +1,811 @@
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 {
SFArrayWidgetSchema,
SFComponent,
SFNumberWidgetSchema,
SFSchema,
SFSchemaEnum,
SFSelectWidgetSchema,
SFTextareaWidgetSchema,
SFUISchema
} from '@delon/form';
import { SettingsService, _HttpClient } from '@delon/theme';
import { EACacheService } from '@shared';
import format from 'date-fns/format';
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';
import { AmapPoiPickerComponent, AmapService } from 'src/app/shared/components/amap';
import { SupplyManagementService } from '../../services/supply-management.service';
import { SupplyManagementVehicleAssignedCarComponent } from '../assigned-car/assigned-car.component';
import { PublishAddressListComponent } from '../onecar-publish/address-list/address-list.component';
import { PublishSuccessComponent } from '../onecar-publish/publish-success/publish-success.component';
@Component({
selector: 'app-publish-goods-onecar-publish',
templateUrl: './release-publish.component.html',
styleUrls: ['./release-publish.component.less']
})
export class SupplyManagementReleasePublishComponent implements OnInit {
// 环境信息 appId、tenantId
envInfo = this.eaCacheSrv.get(cacheConf.env);
validateForm1: FormGroup;
sf1data: any; // 货源单设置回显
sf3data: any; // 货源单设置回显
sf4data: any; // 货源单设置回显
sf5data: any; // 货源单设置回显
sf6data: any; // 货源单设置回显
sf7data: any; // 货源单设置回显
creatTime: any; // 货源单设置回显
modifyTime: any; // 货源单设置回显
totalFees: any; // 总数信息
id = '';
type = 'add';
// // 单位
unit1 = '吨';
unit2 = '方';
unit3 = '保价费金额';
startInfo: any[] = [];
endInfo: any[] = [];
totalDistance = 0.0; //总里程
totalTime = 0.0; //路程总时间
currentGoodsTypeName: any;
currentRate = 0 //实时计算的费率
// formatterRmb = (value: number): string => `¥ ${value}`;
// parserRmb = (value: string): string => value.replace('¥ ', '');
constructor(
private http: _HttpClient,
fb: FormBuilder,
private modalService: NzModalService,
private settingSrv: SettingsService,
public service: SupplyManagementService,
private router: Router,
private route: ActivatedRoute,
private eaCacheSrv: EACacheService,
private amapService: AmapService
) {
this.validateForm1 = fb.group({
loadingTime: [null, [Validators.required]],
unloadingTime: [null, [Validators.required]]
});
}
@ViewChild('sf1', { static: false }) sf1!: SFComponent;
schema1: SFSchema = {};
ui1!: SFUISchema;
@ViewChild('sf3', { static: false }) sf3!: SFComponent;
schema3: SFSchema = {};
ui3!: SFUISchema;
@ViewChild('sf4', { static: false }) sf4!: SFComponent;
schema4: SFSchema = {};
ui4!: SFUISchema;
@ViewChild('sf5', { static: false }) sf5!: SFComponent;
schema5: SFSchema = {};
ui5!: SFUISchema;
@ViewChild('sf6', { static: false }) sf6!: SFComponent;
schema6: SFSchema = {};
ui6!: SFUISchema;
@ViewChild('sf7', { static: false }) sf7!: SFComponent;
schema7: SFSchema = {};
ui7!: SFUISchema;
ngOnInit(): void {
this.initSF1();
this.initSF3();
this.initSF4();
this.initSF5();
this.initSF6();
this.initSF7();
this.addStartInfo();
this.addEndInfo();
}
initSF1() {
this.schema1 = {
properties: {
shipperAppUserId: {
title: '货主',
type: 'string',
maxLength: 30,
ui: {
widget: 'select',
serverSearch: true,
searchDebounceTime: 300,
searchLoadingText: '搜索中...',
onSearch: (q: any) => {
if (!!q) {
return this.service
.request(this.service.$api_enterpriceList, { enterpriseName: q})
.pipe(map((res) => (res as any[]).map((i) => ({ label: i.enterpriseName, value: i.id } as SFSchemaEnum))))
.toPromise();
} else {
return of([]);
}
},
change: (q: any) => {
this.getRegionCode(q)
},
visibleIf: {
_$expand: (value: boolean) => value,
},
} as SFSelectWidgetSchema,
},
enterpriseProjectId: {
type: 'string',
title: '项目',
ui: {
widget: 'select',
placeholder: '请选择',
allowClear: true,
} as SFSelectWidgetSchema
},
enterpriseInfoName: {
type: 'string',
title: '网络货运人',
ui: {
widget: 'custom'
},
default: '天津市怡亚通XXXX有限公司'
},
externalResourceCode: {
type: 'string',
title: '外部货源号',
maxLength: 30,
ui: {
placeholder: '请输入'
}
},
dispatchId: {
type: 'string',
title: '调度员',
enum: [
{ label: '周涛', value: 1 },
{ label: '李诞', value: 2 }
],
ui: {
widget: 'select',
placeholder: '请选择',
allowClear: true,
optionalHelp: '选择调度员,司机直接联系调度员 ; 不选择,司机直接联系您'
// asyncData: () =>
// this.service.loadChildData2('0', '2').pipe(
// map((data: any) => {
// return data.map((m: any) => {
// return { label: m.name, value: m.id };
// });
// }),
// ),
// change: (i) => this.updateCategory(i, '/categoryId2'),
} as SFSelectWidgetSchema
}
}
};
this.ui1 = {
'*': {
spanLabelFixed: 90,
grid: { span: 12 }
},
$enterpriseInfoName: {
grid: { span: 24 }
}
};
}
// 获取城市列表
getRegionCode(regionCode: any) {
console.log(regionCode)
return this.service
.request(this.service.$api_get_enterprise_project, { id: regionCode })
.pipe(
map((res) =>
res.map((item: any) => ({
label: item.projectName,
value: item.id,
})),
),
)
.subscribe((res) => {
this.sf1.getProperty('/enterpriseProjectId')!.schema.enum = res;
this.sf1.getProperty('/enterpriseProjectId')!.widget.reset(res);
});
}
initSF3() {
this.schema3 = {
properties: {
goodsTypeId: {
type: 'string',
title: '货物名称',
enum: [
{ label: '服装', value: '1' },
{ label: '电子产品', value: '2' },
{ label: '其他', value: '3' }
],
ui: {
widget: 'select',
placeholder: '请选择',
errors: { required: '请选择货物名称' },
change: (value, data) => {
this.currentGoodsTypeName = data;
}
// asyncData: () =>
// this.categoryService.loadChildData2('0', '2').pipe(
// map((data: any) => {
// return data.map((m: any) => {
// return { label: m.name, value: m.id };
// });
// }),
// ),
// change: (i) => this.updateCategory(i, '/categoryId2'),
} as SFSelectWidgetSchema
},
goodsName: {
type: 'string',
title: '',
maxLength: 20,
ui: {
errors: { required: '请填写货物名称' },
visibleIf: {
goodsTypeId: value => value === '其他'
}
}
}
},
required: ['goodsTypeId', 'goodsName']
};
this.ui3 = {
'*': {
spanLabelFixed: 90,
grid: { span: 12 }
}
};
}
initSF4() {
this.schema4 = {
properties: {
weight: {
type: 'string',
title: '货物数量',
ui: {
widget: 'custom',
placeholder: '请输入',
errors: { required: '必填项' }
}
},
volume: {
type: 'string',
title: '',
ui: {
widget: 'custom',
placeholder: '请输入'
}
},
number: {
type: 'string',
title: '',
ui: {
widget: 'custom',
placeholder: '请输入'
}
},
maxWeight: {
type: 'string',
title: '车型/车长',
ui: {
widget: 'dict-select',
params: { dictKey: 'car:model' },
mode: 'multiple',
placeholder: '请选择车型',
errors: { required: '请选择车型' }
}
},
maxCube: {
type: 'string',
title: '',
ui: {
widget: 'dict-select',
params: { dictKey: 'car:length' },
mode: 'multiple',
placeholder: '请选择车长',
errors: { required: '请选择车长' }
}
}
},
required: ['weight', 'maxWeight', 'maxCube']
};
this.ui4 = {
'*': {
spanLabelFixed: 90,
grid: { span: 24 }
},
$weight: {
grid: { span: 8 }
},
$volume: {
grid: { span: 8 }
},
$number: {
grid: { span: 8 }
},
$maxWeight: {
grid: { span: 12 }
},
$maxCube: {
grid: { span: 12 }
}
};
}
initSF5() {
this.schema5 = {
properties: {
goodsValue: {
type: 'string',
title: '货物价值',
ui: {
widget: 'custom'
}
}
}
};
this.ui5 = {
'*': {
spanLabelFixed: 90,
grid: { span: 24 }
}
};
}
initSF6() {
this.schema6 = {
properties: {
stateReceipt: {
type: 'string',
title: '是否回单',
enum: [
{ label: '需要', value: true },
{ label: '不需要', value: false }
],
ui: {
widget: 'select',
errors: { required: '请选择' },
placeholder: '请选择'
}
},
receiptType: {
type: 'string',
title: '回单类型',
ui: {
widget: 'dict-select',
params: { dictKey: 'receipt:type' },
containsAllLable:false,
placeholder: '请选择',
errors: { required: '请选择' },
visibleIf: {
stateReceipt: value => value === true
}
}
},
receiptAddressId: {
type: 'string',
title: '选择地址',
ui: {
widget: 'custom',
placeholder: '请点击选择收回单地址',
// validator: val => (this.sf6?.value?.receiptType === '2' ? [{ keyword: 'required', message: '请点击选择收回单地址' }] : []),
visibleIf: {
receiptType: value => value === '2'
}
},
default: ''
},
receiptUserName: {
type: 'string',
title: '联系人',
ui: {
visibleIf: {
receiptType: value => value === '2'
}
},
readOnly: true
},
phon: {
type: 'string',
title: '联系电话',
ui: {
visibleIf: {
receiptType: value => value === '2'
}
},
readOnly: true
},
area: {
type: 'string',
title: '所在地区',
ui: {
visibleIf: {
receiptType: value => value === '2'
}
},
readOnly: true
},
address: {
type: 'string',
title: '详细地址',
ui: {
visibleIf: {
receiptType: value => value === '2'
}
},
readOnly: true
},
remarks: {
type: 'string',
title: '备注',
maxLength: 200,
ui: {
widget: 'textarea',
placeholder: '请输入',
autosize: { minRows: 3, maxRows: 3 }
} as SFTextareaWidgetSchema
}
},
required: ['stateReceipt', 'receiptType','receiptAddressId']
};
this.ui6 = {
'*': {
spanLabelFixed: 90,
grid: { span: 24 }
}
};
}
initSF7() {
this.schema7 = {
properties: {
prePay: {
type: 'number',
title: '预付',
default: 0,
ui: {
prefix: '¥',
change: args => this.payChange()
} as SFNumberWidgetSchema
},
toPay: {
type: 'number',
title: '到付',
default: 0,
ui: { prefix: '¥', change: args => this.payChange() } as SFNumberWidgetSchema
},
oilCardPay: {
type: 'number',
title: '油卡',
default: 0,
ui: { prefix: '¥', change: args => this.payChange() } as SFNumberWidgetSchema
},
receiptPay: {
type: 'number',
title: '回单付',
default: 0,
ui: { prefix: '¥', change: args => this.payChange() } as SFNumberWidgetSchema
},
subtotal: { type: 'number', title: '小计',default: 0, ui: {widget: 'custom' } as SFNumberWidgetSchema },
appendFee: { type: 'number', title: '附加费', default: 0, ui: {widget: 'custom' } as SFNumberWidgetSchema },
total: { type: 'number', title: '总费用', default: 0, ui: { widget: 'custom' } as SFNumberWidgetSchema },
paymentDays: {
type: 'string',
title: '到货后',
ui: {
widget: 'custom',
placeholder: '请输入',
errors: { required: '请输入付款承诺天数' }
}
}
},
required: ['paymentDays']
};
this.ui7 = {
'*': {
spanLabelFixed: 90,
grid: { span: 24 }
}
};
}
payChange() {
const subtotal = (this.sf7.value.prePay + this.sf7.value.toPay + this.sf7.value.oilCardPay + this.sf7.value.receiptPay) || 0;
const oilCardPay = this.sf7.value.oilCardPay || 0;
this.service.request(this.service.$api_getCalculatedSurcharge+`?totalFreight=${subtotal}&fuelCardAmount=${oilCardPay}`).subscribe((res: any) => {
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: any) => {
if (res) {
this.currentRate = res.rate;
} else {
this.service.msgSrv.error(res.msg);
}
});
} else {
this.service.msgSrv.error(res.msg);
}
});
}
addStartInfo() {
if (this.startInfo.length < 5) {
const controlId = this.startInfo.length;
this.startInfo.push({
detailedAddress: '',
appUserName: '',
contractTelephone: '',
latitude: '',
longitude: '',
province: '',
city: '',
area: '',
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));
}
}
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() {
if (this.addEndInfo.length < 5) {
const controlId = this.endInfo.length;
this.endInfo.push({
detailedAddress: '',
appUserName: '',
contractTelephone: '',
latitude: '',
longitude: '',
province: '',
city: '',
area: '',
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));
}
}
subEndInfo(event: any, index: number) {
this.endInfo.splice(index, 1);
this.validateForm1.removeControl(`unloadAddress${index}`);
this.validateForm1.removeControl(`unloadName${index}`);
this.validateForm1.removeControl(`unloadPhone${index}`);
}
//指派熟车
chooseFamifiar(item: any) {
const modalRef = this.modalService.create({
nzTitle: '指派熟车',
nzContent: SupplyManagementVehicleAssignedCarComponent,
nzWidth: 1200,
nzComponentParams: {
status: 'new',
url: this.service.$api_save_assign_bulk,
params: item
},
nzFooter: null
});
modalRef.afterClose.subscribe(result => {
if (result) {
this.openFinishPage(result);
}
});
}
submit(submitType: string): void {
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.sf6.validator({ emitError: true });
this.sf7.validator({ emitError: true });
if (this.validateForm1.invalid || !this.sf3.valid || !this.sf4.valid || !this.sf6.valid || !this.sf7.valid) {
return;
}
//装卸货信息
const LoadingList = this.startInfo.concat(this.endInfo);
// 货物信息
const goodsInfoList = [
{
...this.sf3.value,
goodsTypeName: this.currentGoodsTypeName.label,
goodsName: '电子',
goodsNameId: '1',
...this.sf4.value,
maxWeight: this.sf4.value.maxWeight.join(','),
maxCube: this.sf4.value.maxCube.join(',')
}
];
// 运费信息
const expenseList = [
{ expenseCode: 'PRE', expenseName: '预付', price: this.sf7.value.prePay, id: this.sf7data?.prePayId ? this.sf7data?.prePayId : '' },
{ expenseCode: 'RECE', expenseName: '到付', price: this.sf7.value.toPay, id: this.sf7data?.toPayId ? this.sf7data?.toPayId : '' },
{
expenseCode: 'OIL',
expenseName: '油卡',
price: this.sf7.value.oilCardPay,
id: this.sf7data?.oilCardPayId ? this.sf7data?.oilCardPayId : ''
},
{
expenseCode: 'BACK',
expenseName: '回单付',
price: this.sf7.value.receiptPay,
id: this.sf7data?.receiptPayId ? this.sf7data?.receiptPayId : ''
}
];
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: goodsInfoList,
...this.sf5.value,
...this.sf6.value,
expenseDTOList: expenseList,
paymentDays: this.sf7.value.paymentDays
};
let reqUrl = this.service.$api_consignWhole;
if (submitType === 'assign') {
this.chooseFamifiar(params);
return;
}
this.service.request(reqUrl, params).subscribe((res: any) => {
if (res) {
this.openFinishPage();
} else {
this.service.msgSrv.error(res.msg);
}
});
}
// 打开地图
openMap(type: string, index: number) {
const modalRef = this.modalService.create({
nzTitle: '',
nzContent: AmapPoiPickerComponent,
nzWidth: 900,
nzOnOk: item => {
const poi = item.poi;
const locList = poi.pois;
switch (type) {
case 'start':
this.startInfo[index].detailedAddress = poi.formattedAddress;
this.startInfo[index].longitude = locList[0];
this.startInfo[index].latitude = locList[1];
this.startInfo[index].province = poi.addressComponent.province;
this.startInfo[index].city = poi.addressComponent.city;
this.startInfo[index].area = poi.addressComponent.district;
break;
case 'end':
this.endInfo[index].detailedAddress = poi.formattedAddress;
this.endInfo[index].longitude = locList[0];
this.endInfo[index].latitude = locList[1];
this.endInfo[index].province = poi.addressComponent.province;
this.endInfo[index].city = poi.addressComponent.city;
this.endInfo[index].area = poi.addressComponent.district;
break;
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;
});
}
}
});
}
backBillChange() {
const modalRef = this.modalService.create({
nzTitle: '选择收回单地址',
nzContent: PublishAddressListComponent,
nzWidth: 900,
nzComponentParams: { spuStatus: '2' },
nzOnOk: item => {
const data = item.seleteData;
if (JSON.stringify(data) === '{}') return;
this.sf6.setValue('/receiptAddressId', data.id);
this.sf6.setValue('/receiptUserName', data.contactName);
this.sf6.setValue('/phon', data.contactTelephone);
this.sf6.setValue('/area', `${data.province}-${data.city}-${data.area}`);
this.sf6.setValue('/address', data.detailedAddress);
}
});
}
chooseAddress(index: number, type: string) {
const modalRef = this.modalService.create({
nzTitle: '选择地址',
nzContent: PublishAddressListComponent,
nzWidth: 900,
nzComponentParams: { spuStatus: '1' },
nzOnOk: item => {
const data = item.seleteData;
if (JSON.stringify(data) === '{}') return;
switch (type) {
case 'start':
this.startInfo[index] = {
detailedAddress: data.detailedAddress,
appUserName: data.contactName,
contractTelephone: data.contactTelephone,
latitude: data.contactTelephone,
longitude: data.latitude,
province: data.province,
city: data.city,
area: data.area,
type: '1'
};
break;
case 'end':
this.endInfo[index] = {
detailedAddress: data.detailedAddress,
appUserName: data.contactName,
contractTelephone: data.contactTelephone,
latitude: data.contactTelephone,
longitude: data.latitude,
province: data.province,
city: data.city,
area: data.area,
type: '2'
};
break;
default:
break;
}
}
});
}
// 打开下单完成页面
openFinishPage(resourceObj: any = null) {
this.modalService.create({
nzTitle: '',
nzContent: PublishSuccessComponent,
nzWidth: 900,
nzFooter: null,
nzComponentParams: { type: 'onecar', resourceObj }
});
}
/**
* 取消
*/
close() {
window.history.go(-1);
}
}

View File

@ -1,3 +1,11 @@
<!--
* @Author: your name
* @Date: 2021-12-22 11:28:28
* @LastEditTime: 2021-12-28 19:21:08
* @LastEditors: your name
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \tms-obc-web\src\app\routes\supply-management\components\vehicle\vehicle.component.html
-->
<!-- 搜索表单 -->
<nz-card>
<div nz-row nzGutter="8">
@ -67,7 +75,7 @@
<ng-template #extraTemplate>
<div>
<button (click)="audit('',2)" nz-button nzType="primary">批量审核</button>
<button (click)="importGoodsSource()" nz-button nzType="primary">货源</button>
<button (click)="releaseGoods()" nz-button nzType="primary">发货源</button>
<button (click)="importGoodsSource()" nz-button nzType="primary">导入货源</button>
</div>
</ng-template>

View File

@ -207,6 +207,12 @@ export class SupplyManagementVehicleComponent implements OnInit {
sta: 2
}
});
}
/**
* 代发货源
*/
releaseGoods() {
this.router.navigate(['/supply-management/vehicle-release']);
}
/**
* 取消货源

View File

@ -1,7 +1,7 @@
/*
* @Author: your name
* @Date: 2021-12-03 11:10:14
* @LastEditTime: 2021-12-28 10:15:55
* @LastEditTime: 2021-12-28 19:53:40
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \tms-obc-web\src\app\routes\supply-management\services\supply-management.service.ts
@ -46,7 +46,14 @@ export class SupplyManagementService extends BaseService {
public $api_enterpriceList = '/api/mdc/cuc/enterpriseInfo/operate/enterpriceList';
// 取消货源
public $api_cancelSource = '/api/sdc/goodsResourceOperate/cancelSource';
// 整车计算附加费
$api_getCalculatedSurcharge = `/api/sdc/expense/getCalculatedSurcharge`;
// 整车计算附加费率
$api_getcalculatedServiceRate = `/api/sdc/expense/getcalculatedServiceRate`;
// 代发整车货源
$api_consignWhole = `/api/sdc/goodsResourceOperate/consignWhole`;
// 代发大宗货源
$api_consignBulk = `/api/sdc/goodsResourceOperate/consignBulk`;

View File

@ -1,7 +1,7 @@
/*
* @Author: your name
* @Date: 2021-12-03 11:10:14
* @LastEditTime: 2021-12-27 15:25:01
* @LastEditTime: 2021-12-28 20:07:09
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \tms-obc-web\src\app\routes\supply-management\supply-management-routing.module.ts
@ -16,13 +16,18 @@ import { SupplyManagementAddDriversComponent } from './components/add-drivers/ad
import { SupplyManagementOnecarPublishComponent } from './components/onecar-publish/onecar-publish.component';
import { SupplyManagementBulkPublishComponent } from './components/bulk-publish/bulk-publish.component';
import { SupplyManagementBulkDetailComponent } from './components/bulk-detail/bulk-detail.component';
import { SupplyManagementReleasePublishComponent } from './components/release-publish/release-publish.component';
import { SupplyManagementBulkReleasePublishComponent } from './components/bulk-release-publish/bulk-release-publish.component';
const routes: Routes = [
{ path: 'index', component: SupplyManagementIndexComponent },
{ path: 'bulk-detail/:id', component: SupplyManagementBulkDetailComponent },
{ path: 'vehicle-detail/:id', component: SupplyManagementVehicleDetailComponent },
{ path: 'vehicle-detail/:id', component: SupplyManagementVehicleDetailComponent },
{ path: 'add-drivers', component: SupplyManagementAddDriversComponent },
{ path: 'vehicle-amend/:id', component: SupplyManagementOnecarPublishComponent },
{ path: 'vehicle-release', component: SupplyManagementReleasePublishComponent },
{ path: 'bulk-release', component: SupplyManagementBulkReleasePublishComponent },
{ path: 'bulk-amend/:id', component: SupplyManagementBulkPublishComponent },
];

View File

@ -1,7 +1,7 @@
/*
* @Author: your name
* @Date: 2021-12-03 11:10:14
* @LastEditTime: 2021-12-21 11:04:45
* @LastEditTime: 2021-12-28 20:31:23
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \tms-obc-web\src\app\routes\supply-management\supply-management.module.ts
@ -29,6 +29,8 @@ import { PublishSuccessComponent } from './components/onecar-publish/publish-suc
import { CarAddDriverComponent } from './components/add-driver/add-driver.component';
import { CarAddmodalComponent } from './components/addmodal/addmodal.component';
import { SupplyManagementBulkDetailComponent } from './components/bulk-detail/bulk-detail.component';
import { SupplyManagementReleasePublishComponent } from './components/release-publish/release-publish.component';
import { SupplyManagementBulkReleasePublishComponent } from './components/bulk-release-publish/bulk-release-publish.component';
const COMPONENTS: Type<void>[] = [
@ -51,7 +53,9 @@ const COMPONENTS: Type<void>[] = [
PublishSuccessComponent,
CarAddDriverComponent,
CarAddmodalComponent,
SupplyManagementBulkDetailComponent
SupplyManagementBulkDetailComponent,
SupplyManagementReleasePublishComponent,
SupplyManagementBulkReleasePublishComponent
];
@NgModule({

View File

@ -1,7 +1,7 @@
/*
* @Author: your name
* @Date: 2021-11-29 20:03:55
* @LastEditTime: 2021-12-28 09:33:19
* @LastEditTime: 2021-12-28 20:35:15
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \tms-obc-web\src\style-icons.ts
@ -23,7 +23,11 @@ import {
CheckCircleOutline,
QuestionCircleFill,
LeftOutline,
FileDoneOutline
FileDoneOutline,
MenuOutline,
SwapOutline,
EnvironmentOutline,
ExclamationCircleOutline
} from '@ant-design/icons-angular/icons';
export const ICONS = [
@ -41,5 +45,9 @@ export const ICONS = [
CheckCircleOutline,
QuestionCircleFill,
LeftOutline,
FileDoneOutline
FileDoneOutline,
MenuOutline,
SwapOutline,
EnvironmentOutline,
ExclamationCircleOutline
];