This commit is contained in:
wangshiming
2021-12-10 14:42:47 +08:00
parent b513099359
commit 144b2eb8b9
13 changed files with 299 additions and 269 deletions

View File

@ -38,6 +38,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
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) {
this.validateForm1 = fb.group({
@ -73,6 +74,16 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
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.initSF2();
this.initSF3();
@ -81,7 +92,6 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.initSF6();
this.initSF7();
this.initdata();
console.log( this.route.snapshot?.queryParams)
}
initSF1() {
@ -187,7 +197,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
initSF3() {
this.schema3 = {
properties: {
goodsNameId: {
goodsName: {
type: 'string',
title: '货物名称',
enum: [
@ -214,7 +224,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
title: '',
ui: {
visibleIf: {
goodsNameId: value => value === '3'
goodsName: value => value === '3'
}
}
}
@ -225,7 +235,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
spanLabelFixed: 90,
grid: { span: 12 }
},
$goodsNameId: {
$goodsName: {
grid: { span: 12 }
},
$qita: {
@ -273,7 +283,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
// change: (i) => this.updateCategory(i, '/categoryId2'),
} as SFSelectWidgetSchema
},
name6: {
maxCube: {
type: 'string',
title: '',
enum: [
@ -310,7 +320,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
$vehicleDemand: {
grid: { span: 12 }
},
$name6: {
$maxCube: {
grid: { span: 12 }
}
};
@ -380,38 +390,42 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
};
}
changeValue() {
this.totalFees = this.sf7?.value?.appendFee + this.sf7?.value?.oilCardPay + this.sf7?.value?.prePay +this.sf7?.value?.receiptPay + this.sf7?.value?.toPay
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() {
if(this.PageStatus === '整车修改' || this.PageStatus === '整车下一单') {
this.schema7 = {
properties: {
prePay: { type: 'number', title: '预付', default: 0, ui: { prefix: '¥', change: ()=> {
this.changeValue();
} } as SFNumberWidgetSchema },
},
} 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 },
},
} 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 },
this.changeValue();},
} as SFNumberWidgetSchema },
oilCardPay2: {
type: 'string',
title: '小计',
ui: {
widget: 'custom',
placeholder: '请输入'
}
placeholder: '请输入',
},
},
appendFee: {
type: 'string',
title: '附加费',
ui: {
widget: 'custom',
placeholder: '请输入'
}
placeholder: '请输入',
},
},
totalFee: {
type: 'string',
@ -421,9 +435,22 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
placeholder: '请输入'
}
},
name8: {
paymentDays: {
type: 'string',
title: '到货后',
ui: {
widget: 'custom',
placeholder: '请输入',
}
}
}
};
} else {
this.schema7 = {
properties: {
totalFee: {
type: 'string',
title: '总费用',
ui: {
widget: 'custom',
placeholder: '请输入'
@ -431,6 +458,7 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
}
};
}
this.ui7 = {
'*': {
spanLabelFixed: 90,
@ -447,7 +475,13 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
type: 1
});
}
subStartInfo(event: any, index: number) {
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);
}
@ -459,7 +493,13 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
type: 2
});
}
subEndInfo(event: any, index: number) {
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);
}
@ -476,8 +516,6 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
this.validateForm1.controls[key].markAsDirty();
this.validateForm1.controls[key].updateValueAndValidity();
});
console.log(this.validateForm1);
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()
@ -486,38 +524,45 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
var c = new Date(this.validateForm1.value.createTime);
this.validateForm1.value.createTime = c.getFullYear() + '-' + (c.getMonth() + 1) + '-' + c.getDate() + ' ' + c.getHours() + ':' + c.getMinutes() + ':' + c.getSeconds()
}
console.log(typeof(this.validateForm1.value.createTime) === 'string')
if (this.validateForm1.invalid) {
return;
}
console.log({...this.sf4.value, ...this.sf3.value})
this.startInfo.createTime = this.validateForm1.value.createTime
this.startInfo.modifyTime = this.validateForm1.value.modifyTime
const params = {
const params: any = {
...this.sf1.value,
...this.sf5.value,
shippingInformationDTO: {
...this.sf7.value
},
unLoadingPlaceList: [...this.startInfo, ...this.endInfo,],
goodsInfoList: [
unLoadingPlaceDTOList: [...this.startInfo, ...this.endInfo,],
goodsInfoDTOList: [
{...this.sf4.value, ...this.sf3.value}
]
}
console.log(params)
console.log(this.startInfo)
console.log(this.endInfo)
console.log(this.validateForm1.value)
console.log(this.sf3.value)
console.log(this.sf4.value)
console.log(this.sf5.value)
console.log(this.sf6.value)
if(this.PageStatus === '整车修改' || this.PageStatus === '整车下一单') {
params.shippingInformationDTO = {
...this.sf7.value,
totalFees: this.totalFees
}
} else {
params.freightPrice = this.totalFees
}
console.log(this.sf7.value)
this.service.request(this.service.$api_set_saveAnotherWholeOrder, params).subscribe((res: any) => {
console.log(res)
})
console.log(params)
if(this.PageStatus === '整车修改') {
this.requests(this.service.$api_set_WholeModify, params);
} else if(this.PageStatus === '整车下一单') {
this.requests(this.service.$api_set_saveAnotherWholeOrder, params);
} else 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) => {
console.log(res)
})
}
openMap(type: string, index: number) {
const modalRef = this.modalService.create({
nzTitle: '',
@ -549,40 +594,64 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
}
// 初始化信息
initdata() {
console.log(this.id)
if(this.PageStatus === '整车修改' || this.PageStatus === '整车下一单') {
this.service.request(`${this.service.$api_get_getCompleteVehicleDetail}`, {id:this.id}).subscribe((res) => {
console.log(res)
// this.dataList = res;
this.sf1data = {
// shipperAppUserName: res?.shipperAppUserName || '',
enterpriseProjectName: res?.enterpriseProjectName || '',
enterpriseInfoName: res?.enterpriseInfoName || '',
externalResourceCode: res?.externalResourceCode || '',
dispatchId: res?.dispatchId || '',
}
res.unLoadingPlaceList.forEach((element: any) => {
if(element.type === 1) {
if(this.id) {
this.startInfo.push({
detailedAddress: element.detailedAddress,
appUserName: element.appUserName,
contractTelephone: element.contractTelephone,
type: element.type
})
} else {
this.startInfo.push({
detailedAddress: element.detailedAddress,
appUserName: element.appUserName,
contractTelephone: element.contractTelephone,
type: element.type,
id: element.id
})
}
if(element.createTime) {
this.creatTime = element?.createTime
this.modifyTime = element?.modifyTime
}
} else if(element.type === 2) {
this.dataR(res);
})
} else if(this.PageStatus === '大宗修改' || this.PageStatus === '大宗下一单') {
this.service.request(`${this.service.$api_get_getBulkDetail}`, {id:this.id}).subscribe((res) => {
this.dataR(res);
})
}
}
asds(i: any) {
console.log(i)
}
// const data =
dataR (res: any) {
// this.dataList = res;
this.sf1data = {
// shipperAppUserName: res?.shipperAppUserName || '',
enterpriseProjectName: res?.enterpriseProjectName || '',
enterpriseInfoName: res?.enterpriseInfoName || '',
externalResourceCode: res?.externalResourceCode || '',
dispatchId: res?.dispatchId || '',
}
if(this.PageStatus === '整车修改' || this.PageStatus === '大宗修改') {
this.sf1data.id = res?.id;
}
res?.unLoadingPlaceList.forEach((element: any) => {
if(element.type === 1) {
if(this.PageStatus === '整车修改' || this.PageStatus === '大宗修改') {
this.startInfo.push({
detailedAddress: element.detailedAddress,
appUserName: element.appUserName,
contractTelephone: element.contractTelephone,
type: element.type,
id: element.id
})
} else {
this.startInfo.push({
detailedAddress: element.detailedAddress,
appUserName: element.appUserName,
contractTelephone: element.contractTelephone,
type: element.type,
})
}
if(element.createTime) {
this.creatTime = element?.createTime
this.modifyTime = element?.modifyTime
}
} else if(element.type === 2) {
if(this.PageStatus === '整车修改' || this.PageStatus === '大宗修改') {
this.endInfo.push({
detailedAddress: element?.detailedAddress,
appUserName: element?.appUserName,
contractTelephone: element?.contractTelephone,
type: element.type,
id: element.id
})
} else {
this.endInfo.push({
detailedAddress: element?.detailedAddress,
appUserName: element?.appUserName,
@ -590,53 +659,64 @@ export class SupplyManagementOnecarPublishComponent implements OnInit {
type: element.type
})
}
});
this.sf3data = {
goodsNameId: res?.goodsInfoList[0]?.goodsNameId || '',
}
this.sf4data = {
weight: res?.goodsInfoList[0]?.weight || '',
volume: res?.goodsInfoList[0]?.volume || '',
vehicleDemand: res?.goodsInfoList[0]?.vehicleDemand || '',
}
this.sf5data = {
goodsValue: res?.goodsValue || '',
}
this.sf6data = {
stateReceipt: res?.supplementaryInformationVO?.stateReceipt || '',
remarks: res?.supplementaryInformationVO?.remarks || '',
}
console.log('99999')
console.log(res?.shippingInformationVO)
this.sf7data = {
prePay: res?.shippingInformationVO?.prePay || '',
toPay: res?.shippingInformationVO?.toPay || '',
oilCardPay: res?.shippingInformationVO?.oilCardPay || '',
receiptPay: res?.shippingInformationVO?.receiptPay || '',
oilCardPay2: res?.shippingInformationVO?.oilCardPay || '',
appendFee: res?.shippingInformationVO?.appendFee || '',
name8: res?.shippingInformationVO?.appendFee || '',
}
this.totalFees = res?.shippingInformationVO?.totalFee || '0';
// <p>预付:{{dataList?.shippingInformationVO?.prePay | currency: '¥' }}</p>
// <p>油卡:{{dataList?.shippingInformationVO?.oilCardPay | currency: '¥'}}</p>
// <p>到付:{{dataList?.shippingInformationVO?.toPay | currency: '¥'}}</p>
// <p>回单付:{{dataList?.shippingInformationVO?.receiptPay | currency: '¥'}}</p>
// <p>保险费:{{dataList?.shippingInformationVO?.insuranceFee | currency: '¥'}}</p>
// <p>附加费保险费:{{dataList?.shippingInformationVO?.appendFee | currency: '¥'}}</p> totalFee
console.log(this.sf1.value)
console.log(this.startInfo)
console.log(this.endInfo)
console.log(this.validateForm1.value)
console.log(this.sf3.value)
console.log(this.sf4.value)
console.log(this.sf5.value)
console.log(this.sf6.value)
})
});
this.sf3data = {
goodsName: res?.goodsInfoList[0]?.goodsName || '',
}
this.sf4data = {
weight: res?.goodsInfoList[0]?.weight || '',
volume: res?.goodsInfoList[0]?.volume || '',
vehicleDemand: res?.goodsInfoList[0]?.vehicleDemand || '',
maxCube: res?.goodsInfoList[0]?.maxCube || '',
maxWeight: res?.goodsInfoList[0]?.maxWeight || '',
number: res?.goodsInfoList[0]?.number || '',
freightPrice: res?.goodsInfoList[0]?.freightPrice || '',
freightType: res?.goodsInfoList[0]?.freightType || '',
goodsType: res?.goodsInfoList[0]?.goodsType || '',
modifyTime: res?.goodsInfoList[0]?.modifyTime || '',
modifyUserId: res?.goodsInfoList[0]?.modifyUserId || '',
resourceId: res?.goodsInfoList[0]?.resourceId || '',
rule: res?.goodsInfoList[0]?.rule || '',
settlementBasis: res?.goodsInfoList[0]?.settlementBasis || '',
}
if(this.PageStatus === '整车修改' || this.PageStatus === '大宗修改') {
this.sf4data.id = res?.goodsInfoList[0]?.id;
}
if(this.PageStatus === '大宗下一单' || this.PageStatus === '大宗修改') {
this.totalFees = res?.freightPrice || '0';
} else {
this.totalFees = res?.shippingInformationVO?.totalFee || '0';
}
this.sf5data = {
goodsValue: res?.goodsValue || '',
}
this.sf6data = {
stateReceipt: res?.supplementaryInformationVO?.stateReceipt || '',
remarks: res?.supplementaryInformationVO?.remarks || '',
}
this.sf7data = {
prePay: res?.shippingInformationVO?.prePay || '',
toPay: res?.shippingInformationVO?.toPay || '',
oilCardPay: res?.shippingInformationVO?.oilCardPay || '',
receiptPay: res?.shippingInformationVO?.receiptPay || '',
// oilCardPay2: res?.shippingInformationVO?.oilCardPay || '',
appendFee: res?.shippingInformationVO?.appendFee || '',
paymentDays: res?.shippingInformationVO?.paymentDays || '',
}
if(this.PageStatus === '整车修改' || this.PageStatus === '大宗修改') {
}
// console.log(this.sf1.value)
// console.log(this.startInfo)
// console.log(this.endInfo)
// console.log(this.validateForm1.value)
// console.log(this.sf3.value)
// console.log(this.sf4.value)
// console.log(this.sf5.value)
// console.log(this.sf6.value)
}
asds(i: any) {
console.log(i)
}
// const data =
}