Merge branch 'develop' of https://gitlab.eascs.com/tms-ui/tms-obc-web into develop

This commit is contained in:
Taric Xin
2022-01-11 17:47:16 +08:00
6 changed files with 894 additions and 981 deletions

View File

@ -26,7 +26,6 @@ import { PublishAddressListComponent } from '../onecar-publish/address-list/addr
})
export class SupplyManagementBulkPublishComponent implements OnInit {
validateForm1: FormGroup;
newTempchecked = false; //是否存入新模板
sf1data: any; // 货源单设置回显
sf3data: any; // 货源单设置回显
sf4data: any; // 货源单设置回显
@ -39,24 +38,20 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
totalTime = 0.0; //路程总时间
currentGoodsTypeName: any;
enterpriseProjectIds: any;
id = this.route.snapshot.params.id;
id = this.route.snapshot.params.id; // 传参id
// // 单位
unit1 = '吨';
unit2 = '方';
unit3 = '保价费金额';
startInfo: any = [];
endInfo: any = [];
PageStatus = '';
dataList: any;
constructor(
private http: _HttpClient,
fb: FormBuilder,
private router: Router,
private route: ActivatedRoute,
private modalService: NzModalService,
public service: SupplyManagementService,
private amapService: AmapService,
public shipperSrv: ShipperBaseService,) {
fb: FormBuilder,
private router: Router,
private route: ActivatedRoute,
private modalService: NzModalService,
public service: SupplyManagementService,
private amapService: AmapService,
public shipperSrv: ShipperBaseService,) {
this.validateForm1 = fb.group({
createTime: [null, []],
modifyTime: [null, []],
@ -84,17 +79,12 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
schema4: SFSchema = {};
ui4!: SFUISchema;
@ViewChild('sf7', { static: false }) sf7!: SFComponent;
schema7: SFSchema = {};
ui7!: SFUISchema;
// 初始化
ngOnInit(): void {
if(this.route.snapshot?.queryParams?.sta === '1') {
console.log('修改')
this.PageStatus = '整车修改';
} else if(this.route.snapshot?.queryParams?.sta === '2') {
this.PageStatus = '整车下一单';
} else if(this.route.snapshot?.queryParams?.sta === '3') {
if(this.route.snapshot?.queryParams?.sta === '3') {
this.PageStatus = '大宗修改';
} else if(this.route.snapshot?.queryParams?.sta === '4') {
this.PageStatus = '大宗下一单';
@ -105,9 +95,7 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
this.initSF6();
this.initdata();
}
initSF1() {
this.schema1 = {
properties: {
shipperAppUserId: {
@ -207,28 +195,6 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
}
};
}
// 获取城市列表
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);
if(this.enterpriseProjectIds) {
this.sf1.setValue('/enterpriseProjectId', this.enterpriseProjectIds);
}
});
}
initSF3() {
this.schema3 = {
properties: {
@ -428,11 +394,6 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
}
};
}
changeValue() {
this.totalFees = Number(this.sf7?.value?.appendFee) + Number(this.sf7?.value?.oilCardPay) + Number(this.sf7?.value?.prePay) + Number(this.sf7?.value?.receiptPay) + Number(this.sf7?.value?.toPay)
console.log(this.totalFees)
}
initSF6() {
this.schema7 = {
properties: {
@ -545,8 +506,29 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
}
};
}
changeValue() {
this.totalFees = Number(this.sf7?.value?.appendFee) + Number(this.sf7?.value?.oilCardPay) + Number(this.sf7?.value?.prePay) + Number(this.sf7?.value?.receiptPay) + Number(this.sf7?.value?.toPay)
}
// 获取城市列表
getRegionCode(regionCode: any) {
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);
if(this.enterpriseProjectIds) {
this.sf1.setValue('/enterpriseProjectId', this.enterpriseProjectIds);
}
});
}
addStartInfo(event: any) {
if (this.startInfo.length < 5) {
const controlId = this.startInfo.length;
@ -567,10 +549,8 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
}
}
subStartInfo(event: any, index: number, id?:any) {
console.log(event, index, id)
if(id) {
this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe((res) => {
console.log(res)
})
}
this.startInfo.splice(index, 1);
@ -578,7 +558,6 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
this.validateForm1.removeControl(`loadName${index}`);
this.validateForm1.removeControl(`loadPhone${index}`);
}
addEndInfo(event: any) {
if (this.addEndInfo.length < 5) {
const controlId = this.endInfo.length;
@ -601,18 +580,14 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
subEndInfo(event: any, index: number, id?:any) {
if(id) {
this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe((res) => {
console.log(res)
})
}
console.log(event, index, id)
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: '指派熟车',
@ -629,8 +604,8 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
}
});
}
// 打开下单完成页面
openFinishPage(resourceObj: any = null) {
// 打开下单完成页面
openFinishPage(resourceObj: any = null) {
this.modalService.create({
nzTitle: '',
nzContent: PublishSuccessComponent,
@ -638,8 +613,10 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
nzFooter: null,
nzComponentParams: { type: 'bulk' }
});
}
}
// 确认提交
submit(submitType?: string): void {
// 校验规则
Object.keys(this.validateForm1.controls).forEach(key => {
this.validateForm1.controls[key].markAsDirty();
this.validateForm1.controls[key].updateValueAndValidity();
@ -651,7 +628,6 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
if (this.validateForm1.invalid || !this.sf3.valid || !this.sf1.valid|| !this.sf4.valid || !this.sf7.valid) {
return;
}
console.log(this.startInfo)
if(typeof(this.validateForm1.value.modifyTime) !== 'string' ) {
var c = new Date(this.validateForm1.value.modifyTime);
this.validateForm1.value.modifyTime = c.getFullYear() + '-' + (c.getMonth() + 1) + '-' + c.getDate() + ' ' + c.getHours() + ':' + c.getMinutes() + ':' + c.getSeconds()
@ -680,14 +656,12 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
return;
}
}
console.log(params)
if(this.PageStatus === '大宗修改') {
this.requests(this.service.$api_set_bulkModify, params);
} else if(this.PageStatus === '大宗下一单') {
this.requests(this.service.$api_set_saveAnotherBulkOrder, params);
}
}
requests(url: any, params: any) {
this.service.request(url, params).subscribe((res: any) => {
if (res) {
@ -749,7 +723,7 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
});
}
// 打开地图
openMap(type: string, index: number) {
openMap(type: string, index: number) {
const modalRef = this.modalService.create({
nzTitle: '',
nzContent: AmapPoiPickerComponent,
@ -798,12 +772,10 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
this.dataR(res);
})
}
asds(i: any) {
console.log(i)
}
// 初始化信息
dataR (res: any) {
// this.dataList = res;
// 注:区分编辑和下一单 区别是初始化的时候加不加ID
if (res?.shipperAppUserName) {
const List: any = [];
this.service.request(this.service.$api_enterpriceList, { enterpriseName: res?.shipperAppUserName }).subscribe(rs => {
@ -942,9 +914,11 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
remarks: res?.remarks || ''
};
}
// 回退
choose(){
window.history.go(-1);
}
// 选择地址
chooseAddress(index: number, type: string) {
const modalRef = this.modalService.create({
nzTitle: '选择地址',
@ -952,8 +926,6 @@ export class SupplyManagementBulkPublishComponent implements OnInit {
nzWidth: 900,
nzComponentParams: { spuStatus: '1' },
nzOnOk: item => {
console.log(item)
console.log(type)
const data = item.seleteData;
if (JSON.stringify(data) === '{}') return;
switch (type) {

View File

@ -1,10 +1,8 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, NgForm, Validators } from '@angular/forms';
import { NgForm } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import {
SFArrayWidgetSchema,
SFComponent,
SFNumberWidgetSchema,
SFSchema,
SFSchemaEnum,
SFSelectWidgetSchema,
@ -13,18 +11,14 @@ import {
} from '@delon/form';
import { SettingsService, _HttpClient } from '@delon/theme';
import { ShipperBaseService } from '@shared';
import format from 'date-fns/format';
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
import { 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',
@ -33,7 +27,6 @@ import { PublishSuccessComponent } from '../onecar-publish/publish-success/publi
export class SupplyManagementBulkReleasePublishComponent implements OnInit {
@ViewChild('ngForm')
ngForm!: NgForm;
sf1data: any; // 货源单设置回显
sf3data: any; // 货源单设置回显
sf4data: any; // 货源单设置回显
@ -46,19 +39,11 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
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,
private modalService: NzModalService,
@ -69,7 +54,6 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
private amapService: AmapService,
public shipperSrv: ShipperBaseService
) {}
@ViewChild('sf1', { static: false }) sf1!: SFComponent;
schema1: SFSchema = {};
ui1!: SFUISchema;
@ -85,7 +69,7 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
@ViewChild('sf6', { static: false }) sf6!: SFComponent;
schema6: SFSchema = {};
ui6!: SFUISchema;
// 初始化
ngOnInit(): void {
this.initSF1();
this.initSF3();
@ -118,7 +102,6 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
}
];
}
initSF1() {
this.schema1 = {
properties: {
@ -231,7 +214,6 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
}
};
}
initSF3() {
this.schema3 = {
properties: {
@ -430,7 +412,6 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
}
};
}
initSF6() {
this.schema6 = {
properties: {
@ -543,6 +524,7 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
}
};
}
// 选择收回单地址
backBillChange() {
const modalRef = this.modalService.create({
nzTitle: '选择收回单地址',
@ -587,6 +569,7 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
nzComponentParams: { type: 'bulk' }
});
}
// 确认提交(下单)
submit(submitType: string): void {
Object.keys(this.ngForm.form.controls).forEach(key => {
this.ngForm.form.controls[key].markAsDirty();
@ -599,7 +582,6 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
if (this.ngForm.form.invalid || !this.sf1.valid || !this.sf3.valid || !this.sf4.valid || !this.sf6.valid) {
return;
}
// //装卸货信息
const LoadingList = this.startInfo.concat(this.endInfo);
// 货物信息
@ -626,7 +608,6 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
let reqUrl = this.service.$api_consignBulk;
if (submitType === 'assign') {
console.log('params', params);
this.chooseFamifiar(params);
} else {
this.service.request(reqUrl, params).subscribe(res => {
@ -644,7 +625,6 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
}
// 获取城市列表
getRegionCode(regionCode: any) {
console.log(regionCode);
return this.service
.request(this.service.$api_get_enterprise_project, { id: regionCode })
.pipe(
@ -698,7 +678,7 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
}
});
}
// 选择地址
chooseAddress(index: number, type: string) {
const modalRef = this.modalService.create({
nzTitle: '选择地址',
@ -741,6 +721,7 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
}
});
}
// 返回上一页
goBack() {
window.history.go(-1);
}
@ -772,7 +753,4 @@ export class SupplyManagementBulkReleasePublishComponent implements OnInit {
}
});
}
choose() {
window.history.go(-1);
}
}

View File

@ -44,7 +44,7 @@
<nz-form-label [nzSpan]="4" nzRequired>联系人</nz-form-label>
<nz-form-control [nzErrorTip]="'请输入联系人信息'">
<div class="align-center">
<input nz-input [(ngModel)]="data.appUserName" formControlName="loadName{{ idx }}" maxlength="30" />
<input nz-input [(ngModel)]="data.appUserName" formControlName="loadName{{ idx }}" maxlength="30" />
<input
style="margin-left: 12px"
nz-input
@ -280,7 +280,7 @@
</nz-card>
<nz-card>
<div class="align-center">
<button nz-button nzType="primary" *ngIf="this.PageStatus == '整车修改'" (click)="choose()">取消</button>
<button nz-button nzType="primary" *ngIf="this.PageStatus == '整车修改'" (click)="goBack()">取消</button>
<button *ngIf="this.PageStatus == '整车修改'" nz-button nzType="primary" style="margin-left: 48px" (click)="submit()">提交修改</button>
<button nz-button nzType="primary" *ngIf="this.PageStatus == '整车下一单'" (click)="submitConfirm('assign')">指派熟车</button>
<button *ngIf="this.PageStatus == '整车下一单'" nz-button nzType="primary" style="margin-left: 48px" (click)="submit()"

View File

@ -1,5 +1,5 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import {
SFComponent,
@ -13,15 +13,13 @@ import {
import { _HttpClient } from '@delon/theme';
import { AmapPoiPickerComponent, AmapService, ShipperBaseService } from '@shared';
import { NzModalService } from 'ng-zorro-antd/modal';
import { PublishGoodsChooseFamifiarComponent } from '../choose-famifiar/choose-famifiar.component';
import { of } from 'rxjs';
import { map } from 'rxjs/operators';
import { SupplyManagementService } from '../../services/supply-management.service';
import { debug } from 'console';
import { SupplyManagementVehicleAssignedCarComponent } from '../assigned-car/assigned-car.component';
import { TranAgreementComponent } from '../tran-agreement/tran-agreement.component';
import { PublishAddressListComponent } from './address-list/address-list.component';
import { PublishSuccessComponent } from './publish-success/publish-success.component';
import { map } from 'rxjs/operators';
import { of } from 'rxjs';
import { TranAgreementComponent } from '../tran-agreement/tran-agreement.component';
import { SupplyManagementVehicleAssignedCarComponent } from '../assigned-car/assigned-car.component';
@Component({
selector: 'app-publish-goods-onecar-publish',
templateUrl: './onecar-publish.component.html',
@ -29,7 +27,6 @@ import { SupplyManagementVehicleAssignedCarComponent } from '../assigned-car/ass
})
export class SupplyManagementOnecarPublishComponent implements OnInit {
validateForm1: FormGroup;
newTempchecked = false; //是否存入新模板
sf1data: any; // 货源单设置回显
sf3data: any; // 货源单设置回显
sf4data: any; // 货源单设置回显
@ -43,17 +40,11 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
totalDistance = 0.0; //总里程
totalTime = 0.0; //路程总时间
currentRate = 0; //实时计算的费率
npp = false;
id = this.route.snapshot.params.id;
// // 单位
unit1 = '吨';
unit2 = '方';
unit3 = '保价费金额';
startInfo: any = [];
endInfo: any = [];
startInfo: any = []; // 发货地数据
endInfo: any = []; // 卸货地数据
PageStatus = '';
dataList: any;
enterpriseProjectIds: any;
constructor(
private http: _HttpClient,
@ -97,16 +88,12 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
@ViewChild('sf7', { static: false }) sf7!: SFComponent;
schema7: SFSchema = {};
ui7!: SFUISchema;
// 页面初始化
ngOnInit(): void {
if (this.route.snapshot?.queryParams?.sta === '1') {
console.log('修改');
this.PageStatus = '整车修改';
} else if (this.route.snapshot?.queryParams?.sta === '2') {
this.PageStatus = '整车下一单';
} else if (this.route.snapshot?.queryParams?.sta === '3') {
this.PageStatus = '大宗修改';
} else if (this.route.snapshot?.queryParams?.sta === '4') {
this.PageStatus = '大宗下一单';
}
this.initSF1();
this.initSF3();
@ -116,7 +103,6 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.initSF7();
this.initdata();
}
initSF1() {
this.schema1 = {
properties: {
@ -141,7 +127,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
},
change: (q: any) => {
this.getRegionCode(q);
},
}
} as SFSelectWidgetSchema
},
enterpriseProjectId: {
@ -149,7 +135,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
title: '项目',
ui: {
widget: 'select',
placeholder: '请选择',
placeholder: '请选择'
} as SFSelectWidgetSchema
},
enterpriseInfoName: {
@ -172,8 +158,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
title: '手机号',
maxLength: 30,
ui: {
hidden: true,
placeholder: '请输入'
hidden: true,
placeholder: '请输入'
}
},
dispatchName: {
@ -193,18 +179,18 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
placeholder: '请选择',
allowClear: true,
optionalHelp: '选择调度员,司机直接联系调度员 ; 不选择,司机直接联系您',
change: (value: any, data: any) => {
if(data.label) {
const dat = data.label.split('/')
this.sf1.setValue('/dispatchName', dat[0]);
this.sf1.setValue('/dispatchPhone', dat[1]);
change: (_value: any, data: any) => {
if (data.label) {
const dat = data.label.split('/');
this.sf1.setValue('/dispatchName', dat[0]);
this.sf1.setValue('/dispatchPhone', dat[1]);
}
},
asyncData: () => this.shipperSrv.getStaffList2()
} as SFSelectWidgetSchema
}
},
required: ['shipperAppUserId','enterpriseProjectId','dispatchId']
required: ['shipperAppUserId', 'enterpriseProjectId', 'dispatchId']
};
this.ui1 = {
'*': {
@ -251,7 +237,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
widget: 'select',
placeholder: '请选择',
errors: { required: '请填写货物名称' },
change: (value: any, data: any) => {
change: (_value: any, data: any) => {
this.sf3.setValue('/goodsName', data.label);
},
visibleIf: {
@ -364,30 +350,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
};
}
// 获取城市列表
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);
console.log('12345645454545454=============')
console.log(this.enterpriseProjectIds)
console.log(res)
if(this.enterpriseProjectIds) {
this.sf1.setValue('/enterpriseProjectId', this.enterpriseProjectIds);
}
});
}
initSF5() {
this.schema5 = {
properties: {
@ -409,7 +372,6 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
};
}
initSF6() {
this.schema6 = {
properties: {
@ -504,7 +466,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
} as SFTextareaWidgetSchema
}
},
required: ['stateReceipt', 'receiptType', 'receiptAddressId',]
required: ['stateReceipt', 'receiptType', 'receiptAddressId']
};
this.ui6 = {
'*': {
@ -513,15 +475,6 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
};
}
changeValue() {
this.totalFees =
Number(this.sf7?.value?.appendFee) +
Number(this.sf7?.value?.oilCardPay) +
Number(this.sf7?.value?.prePay) +
Number(this.sf7?.value?.receiptPay) +
Number(this.sf7?.value?.toPay);
console.log(this.totalFees);
}
initSF7() {
this.schema7 = {
properties: {
@ -532,7 +485,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
default: 0,
ui: {
prefix: '¥',
change: args => this.payChange()
change: _args => this.payChange()
} as SFNumberWidgetSchema
},
toPay: {
@ -540,21 +493,21 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
title: '到付',
minimum: 0,
default: 0,
ui: { prefix: '¥', change: args => this.payChange() } as SFNumberWidgetSchema
ui: { prefix: '¥', change: _args => this.payChange() } as SFNumberWidgetSchema
},
oilCardPay: {
type: 'number',
title: '油卡',
minimum: 0,
default: 0,
ui: { prefix: '¥', change: args => this.payChange() } as SFNumberWidgetSchema
ui: { prefix: '¥', change: _args => this.payChange() } as SFNumberWidgetSchema
},
receiptPay: {
type: 'number',
title: '回单付',
minimum: 0,
default: 0,
ui: { prefix: '¥', change: args => this.payChange() } as SFNumberWidgetSchema
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 },
@ -578,38 +531,74 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
};
}
payChange(value?: any) {
let subtotal: any ={}
let oilCardPay: any ={}
if(value) {
subtotal = (value.prePay +value.toPay + value.oilCardPay + value.receiptPay) || 0;
oilCardPay = value.oilCardPay || 0;
} else {
subtotal = (this.sf7.value.prePay + this.sf7.value.toPay + this.sf7.value.oilCardPay + this.sf7.value.receiptPay) || 0;
oilCardPay = this.sf7.value.oilCardPay || 0;
}
console.log(this.sf7.value)
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 * 100;
} 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);
console.log('12345645454545454=============');
console.log(this.enterpriseProjectIds);
console.log(res);
if (this.enterpriseProjectIds) {
this.sf1.setValue('/enterpriseProjectId', this.enterpriseProjectIds);
}
});
} else {
this.service.msgSrv.error(res.msg);
}
});
}
changeValue() {
this.totalFees =
Number(this.sf7?.value?.appendFee) +
Number(this.sf7?.value?.oilCardPay) +
Number(this.sf7?.value?.prePay) +
Number(this.sf7?.value?.receiptPay) +
Number(this.sf7?.value?.toPay);
console.log(this.totalFees);
}
payChange(value?: any) {
let subtotal: any = {};
let oilCardPay: any = {};
if (value) {
subtotal = value.prePay + value.toPay + value.oilCardPay + value.receiptPay || 0;
oilCardPay = value.oilCardPay || 0;
} else {
subtotal = this.sf7.value.prePay + this.sf7.value.toPay + this.sf7.value.oilCardPay + this.sf7.value.receiptPay || 0;
oilCardPay = this.sf7.value.oilCardPay || 0;
}
console.log(this.sf7.value);
addStartInfo(event: any) {
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 * 100;
} else {
this.service.msgSrv.error(res.msg);
}
});
} else {
this.service.msgSrv.error(res.msg);
}
});
}
// 添加 删除发货卸货地址
addStartInfo(_event: any) {
if (this.startInfo.length < 5) {
const controlId = this.startInfo.length;
this.startInfo.push({
@ -628,6 +617,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.validateForm1.addControl(`loadPhone${controlId}`, new FormControl(null, Validators.required));
}
}
// 添加 删除发货卸货地址
subStartInfo(event: any, index: number, id?: any) {
console.log(event, index, id);
if (id) {
@ -640,6 +630,39 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.validateForm1.removeControl(`loadName${index}`);
this.validateForm1.removeControl(`loadPhone${index}`);
}
// 添加 删除发货卸货地址
addEndInfo(_event: any) {
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, id?: any) {
if (id) {
this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe(res => {
console.log(res);
});
}
console.log(event, index, id);
this.endInfo.splice(index, 1);
this.validateForm1.removeControl(`unloadAddress${index}`);
this.validateForm1.removeControl(`unloadName${index}`);
this.validateForm1.removeControl(`unloadPhone${index}`);
}
changeGoodsType(value: string, data: any) {
if (data.label === '其它') return;
const params = {
@ -660,50 +683,17 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
if (res) {
this.sf3.getProperty('/goodsNameId')!.schema.enum = res;
this.sf3.getProperty('/goodsNameId')!.widget?.reset(res);
if(this.sf3data.goodsNameId){
this.sf3.setValue('/goodsNameId',this.sf3data.goodsNameId);
if (this.sf3data.goodsNameId) {
this.sf3.setValue('/goodsNameId', this.sf3data.goodsNameId);
}
} else {
this.service.msgSrv.error(res.msg);
}
});
}
addEndInfo(event: any) {
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, id?: any) {
if (id) {
this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe(res => {
console.log(res);
});
}
console.log(event, index, id);
this.endInfo.splice(index, 1);
this.validateForm1.removeControl(`unloadAddress${index}`);
this.validateForm1.removeControl(`unloadName${index}`);
this.validateForm1.removeControl(`unloadPhone${index}`);
}
//指派熟车
chooseFamifiar(item: any) {
console.log('999')
//指派熟车
chooseFamifiar(item: any) {
console.log('999');
const modalRef = this.modalService.create({
nzTitle: '指派熟车',
nzContent: SupplyManagementVehicleAssignedCarComponent,
@ -713,7 +703,6 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
url: this.service.$api_save_assign_whole,
params: item,
type: 'next'
},
nzFooter: null
});
@ -723,31 +712,32 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
});
}
// 打开下单完成页面
openFinishPage(resourceObj: any = null) {
this.modalService.create({
nzTitle: '',
nzContent: PublishSuccessComponent,
nzWidth: 900,
nzFooter: null,
nzComponentParams: { type: 'onecar', resourceObj }
});
}
// 提交前确认,委托运输协议弹窗
submitConfirm(submitType?: any) {
const modalRef = this.modalService.create({
nzTitle: '运输协议',
nzContent: TranAgreementComponent,
nzWidth: 900,
nzFooter: null,
nzComponentParams: { type: 'next' }
});
modalRef.afterClose.subscribe(result => {
if (result) {
this.submit(submitType);
}
});
}
// 打开下单完成页面
openFinishPage(resourceObj: any = null) {
this.modalService.create({
nzTitle: '',
nzContent: PublishSuccessComponent,
nzWidth: 900,
nzFooter: null,
nzComponentParams: { type: 'onecar', resourceObj }
});
}
// 提交前确认,委托运输协议弹窗
submitConfirm(submitType?: any) {
const modalRef = this.modalService.create({
nzTitle: '运输协议',
nzContent: TranAgreementComponent,
nzWidth: 900,
nzFooter: null,
nzComponentParams: { type: 'next' }
});
modalRef.afterClose.subscribe(result => {
if (result) {
this.submit(submitType);
}
});
}
// 提交
submit(submitType?: string): void {
Object.keys(this.validateForm1.controls).forEach(key => {
this.validateForm1.controls[key].markAsDirty();
@ -758,8 +748,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.sf4.validator({ emitError: true });
this.sf6.validator({ emitError: true });
this.sf7.validator({ emitError: true });
console.log(this.sf1.valid)
if (this.validateForm1.invalid || !this.sf3.valid || !this.sf1.valid|| !this.sf4.valid || !this.sf6.valid || !this.sf7.valid) {
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.validateForm1.value.unloadingTime !== 'string') {
@ -814,7 +804,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
totalFees: this.totalFees
};
console.log(params);
if(submitType) {
if (submitType) {
if (submitType == 'assign') {
this.chooseFamifiar(params);
return;
@ -833,6 +823,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
return num;
}
}
// 下单成功提示弹窗
requests(url: any, params: any) {
this.service.request(url, params).subscribe((res: any) => {
if (res) {
@ -889,21 +880,18 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
});
}
// 返回上一页
goBack() {
window.history.go(-1);
}
// 初始化信息
// 初始化赋值信息
initdata() {
this.service.request(`${this.service.$api_get_getCompleteVehicleDetail}`, { id: this.id }).subscribe(res => {
this.dataR(res);
});
}
asds(i: any) {
console.log(i);
}
// 初始化信息
// 初始化赋值信息函数
dataR(res: any) {
// this.dataList = res;
if (res?.shipperAppUserName) {
const List: any = [];
this.service.request(this.service.$api_enterpriceList, { enterpriseName: res?.shipperAppUserName }).subscribe(rs => {
@ -918,8 +906,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
});
}
if(res?.enterpriseProjectId) {
this.enterpriseProjectIds = res.enterpriseProjectId
if (res?.enterpriseProjectId) {
this.enterpriseProjectIds = res.enterpriseProjectId;
}
this.sf1data = {
enterpriseInfoName: res?.enterpriseInfoName,
@ -1002,7 +990,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
goodsTypeId: res?.goodsInfoVOList[0]?.goodsTypeId || '',
goodsTypeName: res?.goodsInfoVOList[0]?.goodsTypeName || '',
goodsNameId: res?.goodsInfoVOList[0]?.goodsNameId || '',
goodsName: res?.goodsInfoVOList[0]?.goodsName || '',
goodsName: res?.goodsInfoVOList[0]?.goodsName || ''
};
if (this.sf3data.goodsTypeName === '其它') {
this.sf3data.goodsName1 = res?.goodsInfoVOList[0]?.goodsName || '';
@ -1049,7 +1037,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
area: res?.supplementaryInformationVO?.area || '',
phon: res?.supplementaryInformationVO?.phon || '',
address: res?.supplementaryInformationVO?.address || '',
remarks: res?.supplementaryInformationVO?.remarks || '',
remarks: res?.supplementaryInformationVO?.remarks || ''
};
// if (this.PageStatus === '整车修改') {
// this.sf6data.id = res?.supplementaryInformationVO?.id
@ -1066,6 +1054,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
};
this.payChange(this.sf7data);
}
// 选择收回单地址
backBillChange() {
const modalRef = this.modalService.create({
nzTitle: '选择收回单地址',
@ -1083,9 +1072,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
});
}
choose(){
window.history.go(-1);
}
// 选择地址
chooseAddress(index: number, type: string) {
const modalRef = this.modalService.create({
nzTitle: '选择地址',
@ -1093,8 +1080,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
nzWidth: 900,
nzComponentParams: { spuStatus: '1' },
nzOnOk: item => {
console.log(item)
console.log(type)
console.log(item);
console.log(type);
const data = item.seleteData;
if (JSON.stringify(data) === '{}') return;
switch (type) {
@ -1130,5 +1117,4 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
});
}
}

View File

@ -324,6 +324,6 @@
[nzLoading]="service.http.loading"
>保存</button
>
<button nz-button nzType="primary" style="margin-left: 48px" (click)="close()" *ngIf="type === 'edit'">取消</button>
<button nz-button nzType="primary" style="margin-left: 48px" (click)="goBack()" *ngIf="type === 'edit'">取消</button>
</div>
</nz-card>