This commit is contained in:
Taric Xin
2021-12-29 20:32:43 +08:00
parent a99a15e570
commit e2fbea997a

View File

@ -40,9 +40,9 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
totalFees: any; // 总数信息
totalDistance = 0.0; //总里程
totalTime = 0.0; //路程总时间
currentRate = 0 //实时计算的费率
currentRate = 0; //实时计算的费率
npp =false
npp = false;
id = this.route.snapshot.params.id;
// // 单位
unit1 = '吨';
@ -64,7 +64,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
) {
this.validateForm1 = fb.group({
loadingTime: [null, []],
unloadingTime: [null, []],
unloadingTime: [null, []]
});
}
@ViewChild('sf1', { static: false }) sf1!: SFComponent;
@ -96,7 +96,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
ui7!: SFUISchema;
ngOnInit(): void {
if (this.route.snapshot?.queryParams?.sta === '1') {
console.log('修改')
console.log('修改');
this.PageStatus = '整车修改';
} else if (this.route.snapshot?.queryParams?.sta === '2') {
this.PageStatus = '整车下一单';
@ -131,19 +131,19 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
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))))
.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)
this.getRegionCode(q);
},
visibleIf: {
_$expand: (value: boolean) => value,
},
} as SFSelectWidgetSchema,
_$expand: (value: boolean) => value
}
} as SFSelectWidgetSchema
},
enterpriseProjectId: {
type: 'string',
@ -151,7 +151,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
ui: {
widget: 'select',
placeholder: '请选择',
allowClear: true,
allowClear: true
} as SFSelectWidgetSchema
},
enterpriseInfoName: {
@ -159,7 +159,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
title: '网络货运人',
ui: {
widget: 'text'
},
}
},
externalResourceCode: {
type: 'string',
@ -243,7 +243,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
}
},
required: ['goodsName', ]
required: ['goodsName']
};
this.ui3 = {
'*': {
@ -335,18 +335,18 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
// 获取城市列表
getRegionCode(regionCode: any) {
console.log(regionCode)
console.log(regionCode);
return this.service
.request(this.service.$api_get_enterprise_project, { id: regionCode })
.pipe(
map((res) =>
map(res =>
res.map((item: any) => ({
label: item.projectName,
value: item.id,
})),
),
value: item.id
}))
)
.subscribe((res) => {
)
.subscribe(res => {
this.sf1.getProperty('/enterpriseProjectId')!.schema.enum = res;
this.sf1.getProperty('/enterpriseProjectId')!.widget.reset(res);
});
@ -475,8 +475,13 @@ 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)
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 = {
@ -531,14 +536,18 @@ 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 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 => {
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 => {
this.service
.request(this.service.$api_getcalculatedServiceRate + `?invoiceAmount=${subtotal + res.surcharge}&totalFreight=${subtotal}`)
.subscribe(res => {
if (res) {
this.currentRate = res.rate;
} else {
@ -549,10 +558,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.service.msgSrv.error(res.msg);
}
});
}
addStartInfo(event: any) {
if (this.startInfo.length < 5) {
const controlId = this.startInfo.length;
@ -573,11 +580,11 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
}
subStartInfo(event: any, index: number, id?: any) {
console.log(event, index, id)
console.log(event, index, id);
if (id) {
this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe((res) => {
console.log(res)
})
this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe(res => {
console.log(res);
});
}
this.startInfo.splice(index, 1);
this.validateForm1.removeControl(`loadAddress${index}`);
@ -606,11 +613,11 @@ export class SupplyManagementOnecarPublishComponent 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)
})
this.service.request(this.service.$api_delete_Wholedeletebatch, [id]).subscribe(res => {
console.log(res);
});
}
console.log(event, index, id)
console.log(event, index, id);
this.endInfo.splice(index, 1);
this.validateForm1.removeControl(`unloadAddress${index}`);
this.validateForm1.removeControl(`unloadName${index}`);
@ -626,8 +633,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
});
}
submit(): void {
console.log('进来了')
console.log(this.startInfo)
console.log('进来了');
console.log(this.startInfo);
// Object.keys(this.validateForm1.controls).forEach(key => {
// this.validateForm1.controls[key].markAsDirty();
// this.validateForm1.controls[key].updateValueAndValidity();
@ -639,14 +646,36 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
// if (this.validateForm1.invalid || !this.sf1.valid || !this.sf3.valid || !this.sf4.valid || !this.sf6.valid) {
// return;
// }
console.log(this.validateForm1.value)
if(typeof(this.validateForm1.value.unloadingTime) !== 'string' ) {
console.log(this.validateForm1.value);
if (typeof this.validateForm1.value.unloadingTime !== 'string') {
var c = new Date(this.validateForm1.value.unloadingTime);
this.validateForm1.value.unloadingTime = c.getFullYear() + '-' + this.addPreZero(c.getMonth() + 1) + '-' + this.addPreZero(c.getDate()) + ' ' + this.addPreZero(c.getHours()) + ':' + this.addPreZero(c.getMinutes()) + ':' + this.addPreZero(c.getSeconds())
this.validateForm1.value.unloadingTime =
c.getFullYear() +
'-' +
this.addPreZero(c.getMonth() + 1) +
'-' +
this.addPreZero(c.getDate()) +
' ' +
this.addPreZero(c.getHours()) +
':' +
this.addPreZero(c.getMinutes()) +
':' +
this.addPreZero(c.getSeconds());
}
if(typeof(this.validateForm1.value.loadingTime) !== 'string' ) {
if (typeof this.validateForm1.value.loadingTime !== 'string') {
var c = new Date(this.validateForm1.value.loadingTime);
this.validateForm1.value.loadingTime = c.getFullYear() + '-' + this.addPreZero(c.getMonth() + 1) + '-' + this.addPreZero(c.getDate()) + ' ' + this.addPreZero(c.getHours()) + ':' + this.addPreZero(c.getMinutes()) + ':' + this.addPreZero(c.getSeconds())
this.validateForm1.value.loadingTime =
c.getFullYear() +
'-' +
this.addPreZero(c.getMonth() + 1) +
'-' +
this.addPreZero(c.getDate()) +
' ' +
this.addPreZero(c.getHours()) +
':' +
this.addPreZero(c.getMinutes()) +
':' +
this.addPreZero(c.getSeconds());
}
// if (this.validateForm1.invalid) {
// return;
@ -658,7 +687,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
paymentDays: this.sf7.value.paymentDays,
loadingTime: this.validateForm1?.value?.loadingTime,
unloadingTime: this.validateForm1?.value?.unloadingTime,
unLoadingPlaceDTOList: [...this.startInfo, ...this.endInfo,],
unLoadingPlaceDTOList: [...this.startInfo, ...this.endInfo],
goodsInfoDTOList: [
{
...this.sf4.value,
@ -667,12 +696,12 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
maxCube: this.sf4.value.maxCube.join(',')
}
]
}
};
params.shippingInformationDTO = {
...this.sf7.value,
totalFees: this.totalFees
}
console.log(params)
};
console.log(params);
if (this.PageStatus === '整车修改') {
this.requests(this.service.$api_set_WholeModify, params);
} else if (this.PageStatus === '整车下一单') {
@ -699,7 +728,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
} else {
this.service.msgSrv.error(res.msg);
}
})
});
}
// 打开地图
openMap(type: string, index: number) {
@ -747,37 +776,37 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
// 初始化信息
initdata() {
this.service.request(`${this.service.$api_get_getCompleteVehicleDetail}`, {id:this.id}).subscribe((res) => {
this.service.request(`${this.service.$api_get_getCompleteVehicleDetail}`, { id: this.id }).subscribe(res => {
this.dataR(res);
})
});
}
asds(i: any) {
console.log(i)
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((res) => {
console.log(res)
res?.forEach((element: any) => {
List.push({ label: element.enterpriseName, value: element.id } )
const List: any = [];
this.service.request(this.service.$api_enterpriceList, { enterpriseName: res?.shipperAppUserName }).subscribe(rs => {
rs?.forEach((element: any) => {
List.push({ label: element.enterpriseName, value: element.id });
});
console.log(List)
this.sf1.getProperty('/shipperAppUserId')!.schema.enum = List;
this.sf1.getProperty('/shipperAppUserId')!.widget.reset(List);
})
}
if (res?.shipperAppUserId) {
this.getRegionCode(res?.shipperAppUserId)
this.sf1.setValue('/shipperAppUserId', res?.shipperAppUserId);
this.getRegionCode(res?.shipperAppUserId);
}
});
}
this.sf1data = {
// enterpriseProjectId: res?.enterpriseProjectId,
enterpriseInfoName: res?.enterpriseInfoName,
externalResourceCode: res?.externalResourceCode,
dispatchId: res?.dispatchId ,
}
dispatchId: res?.dispatchId
};
if (this.PageStatus === '整车修改') {
this.sf1data.id = res?.id;
}
@ -796,7 +825,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
area: element.area,
type: element.type,
id: element.id
})
});
} else {
this.startInfo.push({
detailedAddress: element.detailedAddress,
@ -807,8 +836,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
province: element.province,
city: element.city,
area: element.area,
type: element.type,
})
type: element.type
});
}
this.validateForm1.addControl(`loadAddress${controlId}`, new FormControl(null, Validators.required));
@ -828,7 +857,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
area: element.area,
type: element.type,
id: element.id
})
});
} else {
this.endInfo.push({
detailedAddress: element?.detailedAddress,
@ -840,7 +869,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
city: element.city,
area: element.area,
type: element.type
})
});
}
this.validateForm1.addControl(`unloadAddress${controlId}`, new FormControl(null, Validators.required));
this.validateForm1.addControl(`unloadName${controlId}`, new FormControl(null, Validators.required));
@ -849,8 +878,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
});
this.sf3data = {
goodsName: res?.goodsInfoVOList[0]?.goodsName ,
}
goodsName: res?.goodsInfoVOList[0]?.goodsName
};
this.sf4data = {
weight: res?.goodsInfoVOList[0]?.weight,
volume: res?.goodsInfoVOList[0]?.volume,
@ -862,8 +891,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
modifyUserId: res?.goodsInfoVOList[0]?.modifyUserId,
resourceId: res?.goodsInfoVOList[0]?.resourceId,
rule: res?.goodsInfoVOList[0]?.rule,
settlementBasis: res?.goodsInfoVOList[0]?.settlementBasis ,
}
settlementBasis: res?.goodsInfoVOList[0]?.settlementBasis
};
if (res?.loadingTime) {
this.loadingTime = res?.loadingTime;
}
@ -875,15 +904,15 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
this.totalFees = res?.shippingInformationVO?.totalFee || '0';
this.sf5data = {
goodsValue: res?.goodsValue ,
}
console.log(res?.stateReceipt)
goodsValue: res?.goodsValue
};
console.log(res?.stateReceipt);
this.sf6data = {
stateReceipt: res?.stateReceipt,
receiptType: res?.receiptType,
receiptUserId: res?.receiptUserId,
remarks: res?.remarks
}
};
this.sf7data = {
prePay: res?.shippingInformationVO?.prePay,
toPay: res?.shippingInformationVO?.toPay,
@ -891,8 +920,8 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
receiptPay: res?.shippingInformationVO?.receiptPay,
// subtotal: res?.shippingInformationVO?.oilCardPay ,
appendFee: res?.shippingInformationVO?.appendFee,
paymentDays: res?.paymentDays ,
}
paymentDays: res?.paymentDays
};
}
backBillChange() {
const modalRef = this.modalService.create({