车辆对接
This commit is contained in:
		| @ -2,7 +2,7 @@ import { preloaderFinished } from '@delon/theme'; | ||||
| /* | ||||
|  * @Author: your name | ||||
|  * @Date: 2021-12-14 14:03:07 | ||||
|  * @LastEditTime: 2021-12-14 16:34:52 | ||||
|  * @LastEditTime: 2021-12-20 16:13:16 | ||||
|  * @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\order-management\modal\bulk\update-freight\update-freight.component.ts | ||||
| @ -34,6 +34,8 @@ import { Observable, Observer } from 'rxjs'; | ||||
| export class SureDepartComponent implements OnInit { | ||||
|   record: any = {}; | ||||
|   i: any; | ||||
|   Status: any; | ||||
|  | ||||
|   data: any ={ | ||||
|     place1: '', | ||||
|     place2: '' | ||||
|  | ||||
| @ -2,7 +2,7 @@ import { preloaderFinished } from '@delon/theme'; | ||||
| /* | ||||
|  * @Author: your name | ||||
|  * @Date: 2021-12-14 14:03:07 | ||||
|  * @LastEditTime: 2021-12-14 17:38:20 | ||||
|  * @LastEditTime: 2021-12-20 16:21:19 | ||||
|  * @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\order-management\modal\bulk\update-freight\update-freight.component.ts | ||||
| @ -34,6 +34,7 @@ import { Observable, Observer } from 'rxjs'; | ||||
| export class VehicleSureArriveComponent implements OnInit { | ||||
|   record: any = {}; | ||||
|   i: any; | ||||
|   Status: any; | ||||
|   data: any ={ | ||||
|     place1: '', | ||||
|     place2: '' | ||||
|  | ||||
| @ -1,21 +1,21 @@ | ||||
| <!-- | ||||
|  * @Author: your name | ||||
|  * @Date: 2021-12-14 15:53:03 | ||||
|  * @LastEditTime: 2021-12-14 16:19:03 | ||||
|  * @LastEditTime: 2021-12-20 16:28:39 | ||||
|  * @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\order-management\modal\bulk\sure-depart\sure-depart.component.html | ||||
| --> | ||||
| <sf #sf mode="edit" [schema]="schema" [ui]="ui" [formData]="i" button="none"> | ||||
|   <ng-template sf-template="no2" let-me let-ui="ui" let-schema="schema"> | ||||
|   <ng-template sf-template="weight" let-me let-ui="ui" let-schema="schema"> | ||||
|     <div style="display: flex;"> | ||||
|      <nz-input-number [(ngModel)]="data.place1" [nzMin]="1" [nzMax]="10" [nzStep]="1"></nz-input-number> | ||||
|      <nz-input-number [(ngModel)]="data.weight" [nzMin]="1" [nzMax]="999999" [nzStep]="1"></nz-input-number> | ||||
|      <div class="left_btn">吨</div> | ||||
|     </div> | ||||
|    </ng-template> | ||||
|   <ng-template sf-template="no3" let-me let-ui="ui" let-schema="schema"> | ||||
|   <ng-template sf-template="volume" let-me let-ui="ui" let-schema="schema"> | ||||
|     <div style="display: flex;"> | ||||
|      <nz-input-number [(ngModel)]="data.place2" [nzMin]="1" [nzMax]="10" [nzStep]="1"></nz-input-number> | ||||
|      <nz-input-number [(ngModel)]="data.volume" [nzMin]="1" [nzMax]="999999" [nzStep]="1"></nz-input-number> | ||||
|      <div class="left_btn">方</div> | ||||
|     </div> | ||||
|    </ng-template> | ||||
|  | ||||
| @ -2,7 +2,7 @@ import { preloaderFinished } from '@delon/theme'; | ||||
| /* | ||||
|  * @Author: your name | ||||
|  * @Date: 2021-12-14 14:03:07 | ||||
|  * @LastEditTime: 2021-12-14 16:34:52 | ||||
|  * @LastEditTime: 2021-12-20 16:54:21 | ||||
|  * @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\order-management\modal\bulk\update-freight\update-freight.component.ts | ||||
| @ -20,11 +20,13 @@ import { | ||||
|   SFUISchema, | ||||
|   SFUploadWidgetSchema | ||||
| } from '@delon/form'; | ||||
| import { apiConf } from '@conf/api.conf'; | ||||
| import { _HttpClient } from '@delon/theme'; | ||||
| import { NzMessageService } from 'ng-zorro-antd/message'; | ||||
| import { NzModalRef } from 'ng-zorro-antd/modal'; | ||||
| import { SupplyManagementService } from 'src/app/routes/supply-management/services/supply-management.service'; | ||||
| import { Observable, Observer } from 'rxjs'; | ||||
| import { WaybillManagementServe } from 'src/app/routes/waybill-management/services/waybill-management.service'; | ||||
| import { EAEnvironmentService, EADateUtil } from '@shared'; | ||||
|  | ||||
| @Component({ | ||||
|   selector: 'app-order-management-vehicle-sure-depart', | ||||
| @ -34,162 +36,257 @@ import { Observable, Observer } from 'rxjs'; | ||||
| export class VehicleSureDepartComponent implements OnInit { | ||||
|   record: any = {}; | ||||
|   i: any; | ||||
|   Status: any; | ||||
|   data: any ={ | ||||
|     place1: '', | ||||
|     place2: '' | ||||
|     weight: '', | ||||
|     volume: '' | ||||
|   }; | ||||
|   @ViewChild('sf', { static: false }) sf!: SFComponent; | ||||
|   schema: SFSchema = {}; | ||||
|   ui: SFUISchema = {}; | ||||
|   constructor(private modal: NzModalRef, private msgSrv: NzMessageService, public http: _HttpClient, public service: SupplyManagementService ) {} | ||||
|   constructor(private modal: NzModalRef, private msgSrv: NzMessageService, public http: _HttpClient, public service: WaybillManagementServe, private envSrv: EAEnvironmentService,) {} | ||||
|  | ||||
|   ngOnInit(): void { | ||||
|     this.initSF(); | ||||
|     console.log(this.i) | ||||
|     this.data.weight = this.i?.weight | ||||
|     this.i.time = this.i.loadingTime; | ||||
|     console.log(this.Status) | ||||
|   } | ||||
|   initSF() { | ||||
|     this.schema = { | ||||
|       properties: { | ||||
|         datetime: { | ||||
|           type: 'string', | ||||
|           title: '装货时间', | ||||
|           format: 'date-time', | ||||
|         }, | ||||
|         no2: { | ||||
|           type: 'string', | ||||
|           title: '装货重量', | ||||
|           ui: { | ||||
|             widget: 'custom', | ||||
|            } | ||||
|         }, | ||||
|         no3: { | ||||
|           type: 'string', | ||||
|           title: '装货体积', | ||||
|           ui: { | ||||
|             widget: 'custom', | ||||
|            } | ||||
|         }, | ||||
|         no4: { | ||||
|           type: 'string', | ||||
|           title: '', | ||||
|           ui: { | ||||
|             widget: 'text', | ||||
|            }, | ||||
|            default: '单张大小不超过5M,支持.jpg、.jpeg和 .png格式', | ||||
|         }, | ||||
|         avatar: { | ||||
|           type: 'string', | ||||
|           title: '装货凭证', | ||||
|           ui: { | ||||
|             action: `/scm/cms/cms/upload/multipartFile/fileModel`, | ||||
|             fileType: 'image/png,image/jpeg,image/jpg', | ||||
|             limit: 1, | ||||
|             limitFileCount: 1, | ||||
|             resReName: 'url', | ||||
|             urlReName: 'url', | ||||
|             widget: 'upload', | ||||
|             descriptionI18n: ' 提单号', | ||||
|             data: { | ||||
|               // appId: environment.appId, | ||||
|             }, | ||||
|             name: 'multipartFile', | ||||
|             multiple: true, | ||||
|             listType: 'picture-card', | ||||
|             change: (args: any) => { | ||||
|               if (args.type === 'success') { | ||||
|                 const avatar = [ | ||||
|                   { | ||||
|                     uid: -1, | ||||
|                     name: 'LOGO', | ||||
|                     status: 'done', | ||||
|                     url: args.fileList[0].response.url, | ||||
|                     response: { | ||||
|                       url: args.fileList[0].response.url | ||||
|                     } | ||||
|     if(this.Status === 1) { | ||||
|       this.schema = { | ||||
|         properties: { | ||||
|           datetime: { | ||||
|             type: 'string', | ||||
|             title: '装货时间', | ||||
|             format: 'date-time', | ||||
|           }, | ||||
|           imgUrl1: { | ||||
|             type: 'string', | ||||
|             title: '装货凭证', | ||||
|             ui: { | ||||
|               widget: 'upload', | ||||
|               action: apiConf.fileUpload, | ||||
|               fileType: 'image/png,image/jpeg,image/jpg,image/gif', | ||||
|               limit: 1, | ||||
|               limitFileCount: 1, | ||||
|               resReName: 'data.fullFileWatermarkPath', | ||||
|               urlReName: 'data.fullFileWatermarkPath', | ||||
|               descriptionI18n: '提货单', | ||||
|               data: { | ||||
|                 appId: this.envSrv.env.appId, | ||||
|               }, | ||||
|               name: 'multipartFile', | ||||
|               beforeUpload: (file: any, fileList: any) => { | ||||
|                 return new Observable((observer: Observer<boolean>) => { | ||||
|                   const isLt1M = file.size / 1024 / 1024 < 5; | ||||
|                   const fileType = 'image/png,image/jpeg'; | ||||
|                   if (fileType.indexOf(file.type) === -1) { | ||||
|                     this.service.msgSrv.warning('图片格式不正确!'); | ||||
|                     observer.complete(); | ||||
|                     return; | ||||
|                   } | ||||
|                 ]; | ||||
|                 this.sf?.setValue('/avatar', avatar); | ||||
|               } | ||||
|             }, | ||||
|             beforeUpload: (file: any, _fileList: any) => { | ||||
|               return new Observable((observer: Observer<boolean>) => { | ||||
|                 const isLt2M = file.size / 1024 / 1024 < 5; | ||||
|                 if (!isLt2M) { | ||||
|                   this.service.msgSrv.warning('图片大小超过5M!'); | ||||
|                   observer.complete(); | ||||
|                   return; | ||||
|                 } | ||||
|                 observer.next(isLt2M); | ||||
|                 observer.complete(); | ||||
|               }); | ||||
|             } | ||||
|           } as SFUploadWidgetSchema | ||||
|         }, | ||||
|         avatar2: { | ||||
|           type: 'string', | ||||
|           title: '', | ||||
|           ui: { | ||||
|             action: `/scm/cms/cms/upload/multipartFile/fileModel`, | ||||
|             fileType: 'image/png,image/jpeg,image/jpg', | ||||
|             limit: 1, | ||||
|             limitFileCount: 1, | ||||
|             resReName: 'url', | ||||
|             urlReName: 'url', | ||||
|             widget: 'upload', | ||||
|             descriptionI18n: '人车货照片', | ||||
|             data: { | ||||
|               // appId: environment.appId, | ||||
|             }, | ||||
|             name: 'multipartFile', | ||||
|             multiple: true, | ||||
|             listType: 'picture-card', | ||||
|             change: (args: any) => { | ||||
|               if (args.type === 'success') { | ||||
|                 const avatar = [ | ||||
|                   { | ||||
|                     uid: -1, | ||||
|                     name: 'LOGO', | ||||
|                     status: 'done', | ||||
|                     url: args.fileList[0].response.url, | ||||
|                     response: { | ||||
|                       url: args.fileList[0].response.url | ||||
|                     } | ||||
|                   if (!isLt1M) { | ||||
|                     this.service.msgSrv.warning('图片大小超过5M!'); | ||||
|                     observer.complete(); | ||||
|                     return; | ||||
|                   } | ||||
|                 ]; | ||||
|                 this.sf?.setValue('/avatar', avatar); | ||||
|               } | ||||
|             }, | ||||
|             beforeUpload: (file: any, _fileList: any) => { | ||||
|               return new Observable((observer: Observer<boolean>) => { | ||||
|                 const isLt2M = file.size / 1024 / 1024 < 5; | ||||
|                 if (!isLt2M) { | ||||
|                   this.service.msgSrv.warning('图片大小超过5M!'); | ||||
|                   observer.next(isLt1M); | ||||
|                   observer.complete(); | ||||
|                   return; | ||||
|                 } | ||||
|                 observer.next(isLt2M); | ||||
|                 observer.complete(); | ||||
|               }); | ||||
|             } | ||||
|           } as SFUploadWidgetSchema | ||||
|         } | ||||
|       }, | ||||
|       required: ['reason'] | ||||
|     }; | ||||
|                 }); | ||||
|               }, | ||||
|               multiple: false, | ||||
|               listType: 'picture-card', | ||||
|               showRequired: true, | ||||
|             } as SFUploadWidgetSchema, | ||||
|           }, | ||||
|           imgUrl2: { | ||||
|             type: 'string', | ||||
|             title: '', | ||||
|             ui: { | ||||
|               widget: 'upload', | ||||
|               action: apiConf.fileUpload, | ||||
|               fileType: 'image/png,image/jpeg,image/jpg,image/gif', | ||||
|               limit: 1, | ||||
|               limitFileCount: 1, | ||||
|               resReName: 'data.fullFileWatermarkPath', | ||||
|               urlReName: 'data.fullFileWatermarkPath', | ||||
|               descriptionI18n: '人车货照片', | ||||
|               data: { | ||||
|                 appId: this.envSrv.env.appId, | ||||
|               }, | ||||
|               name: 'multipartFile', | ||||
|               beforeUpload: (file: any, fileList: any) => { | ||||
|                 return new Observable((observer: Observer<boolean>) => { | ||||
|                   const isLt1M = file.size / 1024 / 1024 < 5; | ||||
|                   const fileType = 'image/png,image/jpeg'; | ||||
|                   if (fileType.indexOf(file.type) === -1) { | ||||
|                     this.service.msgSrv.warning('图片格式不正确!'); | ||||
|                     observer.complete(); | ||||
|                     return; | ||||
|                   } | ||||
|                   if (!isLt1M) { | ||||
|                     this.service.msgSrv.warning('图片大小超过5M!'); | ||||
|                     observer.complete(); | ||||
|                     return; | ||||
|                   } | ||||
|                   observer.next(isLt1M); | ||||
|                   observer.complete(); | ||||
|                 }); | ||||
|               }, | ||||
|               multiple: false, | ||||
|               listType: 'picture-card', | ||||
|               showRequired: true, | ||||
|             } as SFUploadWidgetSchema, | ||||
|           } | ||||
|         }, | ||||
|         required: ['reason'] | ||||
|       }; | ||||
|     } else { | ||||
|       this.schema = { | ||||
|         properties: { | ||||
|           time: { | ||||
|             type: 'string', | ||||
|             title: '装货时间', | ||||
|             format: 'date-time', | ||||
|           }, | ||||
|           weight: { | ||||
|             type: 'string', | ||||
|             title: '装货重量', | ||||
|             ui: { | ||||
|               widget: 'custom', | ||||
|              } | ||||
|           }, | ||||
|           volume: { | ||||
|             type: 'string', | ||||
|             title: '装货体积', | ||||
|             ui: { | ||||
|               widget: 'custom', | ||||
|              } | ||||
|           }, | ||||
|           no4: { | ||||
|             type: 'string', | ||||
|             title: '', | ||||
|             ui: { | ||||
|               widget: 'text', | ||||
|              }, | ||||
|              default: '单张大小不超过5M,支持.jpg、.jpeg和 .png格式', | ||||
|           }, | ||||
|           imgUrl1: { | ||||
|             type: 'string', | ||||
|             title: '装货凭证', | ||||
|             ui: { | ||||
|               widget: 'upload', | ||||
|               action: apiConf.fileUpload, | ||||
|               fileType: 'image/png,image/jpeg,image/jpg,image/gif', | ||||
|               limit: 1, | ||||
|               limitFileCount: 1, | ||||
|               resReName: 'data.fullFileWatermarkPath', | ||||
|               urlReName: 'data.fullFileWatermarkPath', | ||||
|               descriptionI18n: '提货单', | ||||
|               data: { | ||||
|                 appId: this.envSrv.env.appId, | ||||
|               }, | ||||
|               name: 'multipartFile', | ||||
|               beforeUpload: (file: any, fileList: any) => { | ||||
|                 return new Observable((observer: Observer<boolean>) => { | ||||
|                   const isLt1M = file.size / 1024 / 1024 < 5; | ||||
|                   const fileType = 'image/png,image/jpeg'; | ||||
|                   if (fileType.indexOf(file.type) === -1) { | ||||
|                     this.service.msgSrv.warning('图片格式不正确!'); | ||||
|                     observer.complete(); | ||||
|                     return; | ||||
|                   } | ||||
|                   if (!isLt1M) { | ||||
|                     this.service.msgSrv.warning('图片大小超过5M!'); | ||||
|                     observer.complete(); | ||||
|                     return; | ||||
|                   } | ||||
|                   observer.next(isLt1M); | ||||
|                   observer.complete(); | ||||
|                 }); | ||||
|               }, | ||||
|               multiple: false, | ||||
|               listType: 'picture-card', | ||||
|               showRequired: true, | ||||
|             } as SFUploadWidgetSchema, | ||||
|           }, | ||||
|           imgUrl2: { | ||||
|             type: 'string', | ||||
|             title: '', | ||||
|             ui: { | ||||
|               widget: 'upload', | ||||
|               action: apiConf.fileUpload, | ||||
|               fileType: 'image/png,image/jpeg,image/jpg,image/gif', | ||||
|               limit: 1, | ||||
|               limitFileCount: 1, | ||||
|               resReName: 'data.fullFileWatermarkPath', | ||||
|               urlReName: 'data.fullFileWatermarkPath', | ||||
|               descriptionI18n: '人车货照片', | ||||
|               data: { | ||||
|                 appId: this.envSrv.env.appId, | ||||
|               }, | ||||
|               name: 'multipartFile', | ||||
|               beforeUpload: (file: any, fileList: any) => { | ||||
|                 return new Observable((observer: Observer<boolean>) => { | ||||
|                   const isLt1M = file.size / 1024 / 1024 < 5; | ||||
|                   const fileType = 'image/png,image/jpeg'; | ||||
|                   if (fileType.indexOf(file.type) === -1) { | ||||
|                     this.service.msgSrv.warning('图片格式不正确!'); | ||||
|                     observer.complete(); | ||||
|                     return; | ||||
|                   } | ||||
|                   if (!isLt1M) { | ||||
|                     this.service.msgSrv.warning('图片大小超过5M!'); | ||||
|                     observer.complete(); | ||||
|                     return; | ||||
|                   } | ||||
|                   observer.next(isLt1M); | ||||
|                   observer.complete(); | ||||
|                 }); | ||||
|               }, | ||||
|               multiple: false, | ||||
|               listType: 'picture-card', | ||||
|               showRequired: true, | ||||
|             } as SFUploadWidgetSchema, | ||||
|           } | ||||
|         }, | ||||
|         required: ['reason'] | ||||
|       }; | ||||
|     } | ||||
|    | ||||
|     this.ui = { | ||||
|       '*': { | ||||
|         spanLabelFixed: 100, | ||||
|         grid: { span: 20 } | ||||
|       }, | ||||
|       $avatar: { grid: { span: 12} }, | ||||
|       $avatar2: { grid: { span: 12} }, | ||||
|       $imgUrl1: { grid: { span: 12} }, | ||||
|       $imgUrl2: { grid: { span: 12} }, | ||||
|     }; | ||||
|   } | ||||
|   save(value: any): void { | ||||
|     | ||||
|     console.log(value) | ||||
|     // this.http.post(`/user/${this.record.id}`, value).subscribe(res => { | ||||
|     //   this.msgSrv.success('保存成功'); | ||||
|     //   this.modal.close(true); | ||||
|     // }); | ||||
|     const params = { | ||||
|       id: this.i.id, | ||||
|       imgUrl1: value.imgUrl1.data.fullFilePath, | ||||
|       imgUrl2: value.imgUrl2.data.fullFilePath, | ||||
|       time: value.time, | ||||
|       volume: this.data.volume, | ||||
|       weight: this.data.weight | ||||
|     } | ||||
|     console.log(EADateUtil.yearToDateTime(value.time)) | ||||
|     params.time = EADateUtil.yearToDateTime(value.time) | ||||
|     console.log(params) | ||||
|     | ||||
|     // this.service.request(this.service.$api_get_insertBulkStartCarInfo, params).subscribe((res) => { | ||||
|     //   if(res) { | ||||
|     //     this.service.msgSrv.success('确认发车成功!') | ||||
|     //   } else{ | ||||
|     //     this.service.msgSrv.error(res.msg) | ||||
|     //   } | ||||
|     // }) | ||||
|   } | ||||
|  | ||||
|   close(): void { | ||||
|  | ||||
| @ -1,22 +1,27 @@ | ||||
| <!-- | ||||
|  * @Author: your name | ||||
|  * @Date: 2021-12-14 14:03:07 | ||||
|  * @LastEditTime: 2021-12-15 15:53:02 | ||||
|  * @LastEditors: Please set LastEditors | ||||
|  * @Date: 2021-12-15 13:17:42 | ||||
|  * @LastEditTime: 2021-12-20 15:55:51 | ||||
|  * @LastEditors: your name | ||||
|  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE | ||||
|  * @FilePath: \tms-obc-web\src\app\routes\order-management\modal\bulk\update-freight\update-freight.component.html | ||||
|  * @FilePath: \tms-obc-web\src\app\routes\order-management\modal\vehicle\update-freight\update-freight.component.html | ||||
| --> | ||||
| <sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"> | ||||
| </sf> | ||||
| <nz-spin *ngIf="!i" class="modal-spin"></nz-spin> | ||||
| <sf #sf mode="edit" [schema]="schema" [ui]="ui" [formData]="i" button="none"></sf> | ||||
| <nz-divider></nz-divider> | ||||
| <div> | ||||
|   <p style="font-weight: bolder;">总运费:<span style="color: red;">¥{{gross}}</span></p> | ||||
|   <p>运输费:¥{{transportation}},附加费:¥{{additional}}</p> | ||||
|   <p> | ||||
|     <span style="font-weight: bolder" | ||||
|       >总运费:<span style="color: #dc112a">¥{{ totalPrice }}</span></span | ||||
|     > | ||||
|     (运输费:¥{{ tranPrice }},附加费:¥{{ otherPrice }}) | ||||
|   </p> | ||||
|   <p> | ||||
|     <label nz-checkbox [(ngModel)]="aggreechecked">确认已阅读并知晓<a>《变更协议》</a></label> | ||||
|   </p> | ||||
| </div> | ||||
|  | ||||
| <div class="modal-footer"> | ||||
|   <button nz-button type="button" (click)="close()">关闭</button> | ||||
|   <button nz-button type="submit" nzType="primary" (click)="save(sf.value)" [disabled]="!sf.valid" [nzLoading]="http.loading" | ||||
|     >确认</button | ||||
|   > | ||||
|   <button nz-button type="submit" nzType="primary" (click)="save(sf.value)" [disabled]="!aggreechecked">确定</button> | ||||
| </div> | ||||
|  | ||||
| @ -2,7 +2,7 @@ import { preloaderFinished } from '@delon/theme'; | ||||
| /* | ||||
|  * @Author: your name | ||||
|  * @Date: 2021-12-14 14:03:07 | ||||
|  * @LastEditTime: 2021-12-15 15:52:36 | ||||
|  * @LastEditTime: 2021-12-20 15:57:37 | ||||
|  * @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\order-management\modal\bulk\update-freight\update-freight.component.ts | ||||
| @ -21,6 +21,7 @@ import { | ||||
| import { _HttpClient } from '@delon/theme'; | ||||
| import { NzMessageService } from 'ng-zorro-antd/message'; | ||||
| import { NzModalRef } from 'ng-zorro-antd/modal'; | ||||
| import { OrderManagementService } from '../../../services/order-management.service'; | ||||
|  | ||||
| @Component({ | ||||
|   selector: 'app-order-management-vehicle-update-freight', | ||||
| @ -28,68 +29,140 @@ import { NzModalRef } from 'ng-zorro-antd/modal'; | ||||
|   styleUrls: ['./update-freight.component.less'] | ||||
| }) | ||||
| export class VehicleUpdateFreightComponent implements OnInit { | ||||
|   record: any = {}; | ||||
|   record: any; | ||||
|   i: any; | ||||
|   @ViewChild('sf', { static: false }) sf!: SFComponent; | ||||
|   schema: SFSchema = {}; | ||||
|   ui: SFUISchema = {}; | ||||
|   data: any = {}; | ||||
|   constructor(private modal: NzModalRef, private msgSrv: NzMessageService, public http: _HttpClient) {} | ||||
|  | ||||
|   totalPrice = 0; | ||||
|   tranPrice = 0; | ||||
|   otherPrice = 0; | ||||
|  | ||||
|   aggreechecked = false; | ||||
|   constructor(private modal: NzModalRef, private msgSrv: NzMessageService, public service: OrderManagementService) {} | ||||
|  | ||||
|   ngOnInit(): void { | ||||
|     this.i = { | ||||
|       prePay: this.record?.mybidDetailInfo?.filter((data: any) => data.expenseCode === 'PRE')[0]?.price || 0, | ||||
|       toPay: this.record?.mybidDetailInfo?.filter((data: any) => data.expenseCode === 'RECE')[0]?.price || 0, | ||||
|       oilCardPay: this.record?.mybidDetailInfo?.filter((data: any) => data.expenseCode === 'OIL')[0]?.price || 0, | ||||
|       receiptPay: this.record?.mybidDetailInfo?.filter((data: any) => data.expenseCode === 'BACK')[0]?.price || 0, | ||||
|       prePayStatus: this.record?.mybidDetailInfo?.filter((data: any) => data.expenseCode === 'PRE')[0]?.paymentStatus, | ||||
|       toPayStatus: this.record?.mybidDetailInfo?.filter((data: any) => data.expenseCode === 'RECE')[0]?.paymentStatus, | ||||
|       oilCardPayStatus: this.record?.mybidDetailInfo?.filter((data: any) => data.expenseCode === 'OIL')[0]?.paymentStatus, | ||||
|       receiptPayStatus: this.record?.mybidDetailInfo?.filter((data: any) => data.expenseCode === 'BACK')[0]?.paymentStatus | ||||
|     }; | ||||
|     this.tranPrice = this.i.prePay + this.i.toPay + this.i.oilCardPay + this.i.receiptPay; | ||||
|     this.totalPrice = this.i.prePay + this.i.toPay + this.i.oilCardPay + this.i.receiptPay + this.otherPrice; | ||||
|     this.initSF(); | ||||
|  | ||||
|     if (this.record.id > 0) this.http.get(`/user/${this.record.id}`).subscribe(res => (this.i = res)); | ||||
|   } | ||||
|   // 运输费 | ||||
|   get transportation () { | ||||
|     console.log(this.sf?.value) | ||||
|     const value = Number(this.sf?.value?.number || 0) + Number(this.sf?.value?.number2 || 0) + Number(this.sf?.value?.number3 || 0) | ||||
|     console.log( value ) | ||||
|     return value || 0 | ||||
|   } | ||||
|   // 总运费 | ||||
|   get gross () { | ||||
|     const value = Number(this.transportation || 0) + Number(this.transportation || 0) | ||||
|     console.log( value ) | ||||
|     return value || 0 | ||||
|   } | ||||
|   // 附加费 | ||||
|   get additional () { | ||||
|     return 100 | ||||
|     this.service.request(this.service.$api_get_getFreightChangeWholeDetail, { id: this.record.id}).subscribe((res) => { | ||||
|       console.log(res) | ||||
|       console.log(this.i) | ||||
|       console.log(this.tranPrice) | ||||
|     }) | ||||
|   } | ||||
|   initSF() { | ||||
|     this.schema= { | ||||
|     this.schema = { | ||||
|       properties: { | ||||
|         number: { type: 'number',title: '预付' ,minimum: 1, maximum: 999999999, multipleOf: 1, ui: { widgetWidth: 200 } }, | ||||
|         number2: { type: 'number',title: '到付' ,minimum: 1, maximum: 999999999, multipleOf: 1, ui: { widgetWidth: 200 } }, | ||||
|         number3: { type: 'number',title: '回单付' ,minimum: 1, maximum: 999999999, multipleOf: 1, ui: { widgetWidth: 200 } }, | ||||
|         name3: { | ||||
|         prePay: { | ||||
|           type: 'number', | ||||
|           title: '预付', | ||||
|           default: 0.0, | ||||
|           readOnly: this.i.prePayStatus !== '3', | ||||
|           ui: { | ||||
|             prefix: '¥', | ||||
|             widgetWidth: 200, | ||||
|             precision: 2, | ||||
|             change: (val: any) => this.changeNumVal() | ||||
|           } as SFNumberWidgetSchema | ||||
|         }, | ||||
|         toPay: { | ||||
|           type: 'number', | ||||
|           title: '到付', | ||||
|           default: 0.0, | ||||
|           readOnly: this.i.toPayStatus !== '3', | ||||
|           ui: { | ||||
|             prefix: '¥', | ||||
|             widgetWidth: 200, | ||||
|             precision: 2, | ||||
|             change: (val: any) => this.changeNumVal() | ||||
|           } as SFNumberWidgetSchema | ||||
|         }, | ||||
|         // oilCardPay: { | ||||
|         //   type: 'number', | ||||
|         //   title: '油卡', | ||||
|         //   default: 0.0, | ||||
|         //   readOnly: this.i.oilCardPayStatus === '1' || this.i.oilCardPayStatus === '3', | ||||
|         //   ui: { | ||||
|         //     prefix: '¥', | ||||
|         //     widgetWidth: 200, | ||||
|         //     precision: 2, | ||||
|         //     change: (val: any) => this.changeNumVal() | ||||
|         //   } as SFNumberWidgetSchema | ||||
|         // }, | ||||
|         receiptPay: { | ||||
|           type: 'number', | ||||
|           title: '回单付', | ||||
|           default: 0.0, | ||||
|           readOnly: this.i.receiptPayStatus !== '3', | ||||
|           ui: { | ||||
|             prefix: '¥', | ||||
|             widgetWidth: 200, | ||||
|             precision: 2, | ||||
|             change: (val: any) => this.changeNumVal() | ||||
|           } as SFNumberWidgetSchema | ||||
|         }, | ||||
|         changeCause: { | ||||
|           type: 'string', | ||||
|           title: '变更原因', | ||||
|           maxLength: 100, | ||||
|           ui: { | ||||
|             widgetWidth: 300, | ||||
|             placeholder:"选填,最多不超过100字", | ||||
|             widget: 'textarea', | ||||
|             autosize: { minRows: 3, maxRows: 6 } | ||||
|           } as SFTextareaWidgetSchema | ||||
|         }, | ||||
|         } | ||||
|       }, | ||||
|       required: ['name3'], | ||||
|       type: 'object', | ||||
|       required: ['changeCause'] | ||||
|     }; | ||||
|     this.ui = { '*': { spanLabelFixed: 100, grid: { span: 16,gutter:8 } } | ||||
|     this.ui = { | ||||
|       '*': { | ||||
|         spanLabelFixed: 100, | ||||
|         grid: { span: 16 } | ||||
|       } | ||||
|     }; | ||||
|   } | ||||
|   save(value: any): void { | ||||
|     console.log(this.sf.value) | ||||
|     console.log(value) | ||||
|     console.log(this.data) | ||||
|     this.http.post(`/user/${this.record.id}`, value).subscribe(res => { | ||||
|       this.msgSrv.success('保存成功'); | ||||
|       this.modal.close(true); | ||||
|     const editItems = this.record?.mybidDetailInfo.filter((data: any) => data.receiptPayStatus === '3'); | ||||
|     editItems.forEach((item: any) => { | ||||
|       switch (item.expenseName) { | ||||
|         case '预付': | ||||
|           item.price = this.sf.value.prePay; | ||||
|           break; | ||||
|         case '到付': | ||||
|           item.price = this.sf.value.toPay; | ||||
|           break; | ||||
|         case '回单付': | ||||
|           item.price = this.sf.value.receiptPay; | ||||
|           break; | ||||
|         default: | ||||
|           break; | ||||
|       } | ||||
|     }); | ||||
|  | ||||
|     const params = { | ||||
|       id: this.record?.id, | ||||
|       dtos: editItems, | ||||
|       changeCause: this.sf.value.changeCause | ||||
|     }; | ||||
|  | ||||
|     // this.service.request(this.service.$api_insertFreightChangeWhole, params).subscribe((res: any) => { | ||||
|     //   if (res) { | ||||
|     //     this.modal.destroy(); | ||||
|     //   } else { | ||||
|     //     this.service.msgSrv.error(res.msg); | ||||
|     //   } | ||||
|     // }); | ||||
|   } | ||||
|  | ||||
|   close(): void { | ||||
| @ -97,8 +170,10 @@ export class VehicleUpdateFreightComponent implements OnInit { | ||||
|   } | ||||
|   /** | ||||
|    * 更新数字框 | ||||
|    * @param value | ||||
|    * @param type | ||||
|    * | ||||
|    */ | ||||
|   changeNumVal(value: any, type: number) {} | ||||
|   changeNumVal() { | ||||
|     this.tranPrice = this.sf.value.prePay + this.sf.value.toPay + this.sf.value.oilCardPay + this.sf.value.receiptPay; | ||||
|     this.totalPrice = this.sf.value.prePay + this.sf.value.toPay + this.sf.value.oilCardPay + this.sf.value.receiptPay + this.otherPrice; | ||||
|   } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user