<!--
 * @Author: your name
 * @Date: 2021-12-03 15:31:52
 * @LastEditTime: 2021-12-27 14:15:35
 * @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\components\vehicle-detail\vehicle-detail.component.html
-->
<page-header-wrapper [title]="''" [logo]="logo" [content]="headerContent">
  <ng-template #logo>
    <button nz-button nz-tooltip nzTooltipTitle="返回上一页" (click)="goBack()">
      <i nz-icon nzType="left" nzTheme="outline"></i>
    </button>
  </ng-template>
  <ng-template #headerContent>
    <div class="mb-xs" nz-row>
      <h4 class="ml-md" style="font-size: 18px;">订单号: {{ i?.billCode }}</h4>
    </div>
    <div nz-row style="display: flex; justify-content: end;">
      <div nz-col nzSpan="10">
        <button nz-button (click)="cancelChange()">取消修改</button>
        <button nz-button nzType="primary" (click)="save()" nzGhost>保存修改</button>
      </div>
    </div>
   <div>
     <div style="display: flex; justify-content: space-between;">
      <div sv-container>
        <sv label="网络货运人">{{ i?.goodsResource?.[0]?.enterpriseInfoName }} </sv>
        <sv label="货主">{{ i?.goodsResource?.[0]?.shipperAppUserName }} </sv>
        <sv label="所属项目">{{i?.goodsResource?.[0]?.enterpriseProjectName}}</sv>
        <sv label="服务类型">{{i?.goodsResource?.[0]?.serviceTypeLabel}}</sv>
        <sv label="录单员">{{i?.goodsResource?.[0]?.dispatchName}} 18100000000 </sv>
        <sv label="调度员">{{i?.goodsResource?.[0]?.dispatchName}} </sv>
      </div>
      <div>
        <div>状态</div>
        <div style="font-size: 22px;font-weight: 700;">{{i?.billStatusLabel}}</div>
      </div>
     </div>
     <nz-tabset nzType="card" style="margin-top: 15px;">
      <nz-tab [nzTitle]="tempt" >
        <ng-template #tempt>
          <nz-anchor>
            <nz-link nzHref="#distannce1" nzTitle="装卸货信息"></nz-link>
          </nz-anchor>
        </ng-template>
      </nz-tab>
      <nz-tab [nzTitle]="tempt2" >
        <ng-template #tempt2>
          <nz-anchor>
            <nz-link nzHref="#distannce2" nzTitle="基本信息"></nz-link>
          </nz-anchor>
        </ng-template>
      </nz-tab>
      <nz-tab [nzTitle]="tempt3" >
        <ng-template #tempt3>
          <nz-anchor>
            <nz-link nzHref="#distannce3" nzTitle="运费信息"></nz-link>
          </nz-anchor>
        </ng-template>
      </nz-tab>
      <nz-tab [nzTitle]="tempt4" >
        <ng-template #tempt4>
          <nz-anchor>
            <nz-link nzHref="#distannce4" nzTitle="附件信息"></nz-link>
          </nz-anchor>
        </ng-template>
      </nz-tab>
      <nz-tab [nzTitle]="tempt5" >
        <ng-template #tempt5>
          <nz-anchor>
            <nz-link nzHref="#distannce5" nzTitle="轨迹信息"></nz-link>
          </nz-anchor>
        </ng-template>
      </nz-tab>
    </nz-tabset>
   </div>
  </ng-template>
</page-header-wrapper>
<nz-card nzTitle="运单进度">
  <div class="approval-status">
    <div style="width: 60%; margin: 0 auto">
      <nz-steps [nzLabelPlacement]="'vertical'">
        <nz-step [nzStatus]="i?.resourceStatus !== '1'?'finish':'process'" nzIcon="solution"
        [nzDescription]="i?.createAt" nzTitle="下单"></nz-step>

        <nz-step *ngIf="i?.resourceStatus === '1' || i?.resourceStatus === '2' "
          [nzStatus]="i?.resourceStatus=== '1'? 'wait':'finish'" nzIcon="file-done" [nzTitle]="'接单'"></nz-step>
          
        <nz-step nzStatus="finish" nzIcon="close-circle" nzTitle="取消货源" *ngIf="i?.resourceStatus === '3'"></nz-step>
      </nz-steps>
    </div>
  </div>
</nz-card>


<nz-card>
  <div class="card-title" id="distannce1"
    >装卸货信息<span class="tip-font">预计公里数：{{ totalDistance }}km，预计行程耗时：{{ totalTime }}小时</span></div
  >
  <form nz-form [formGroup]="validateForm1" role="form">
    <div nz-row [nzGutter]="24">
      <div nz-col [nzSpan]="8">
        <div *ngFor="let data of startInfo; let idx = index">
          <nz-form-item>
            <nz-form-label [nzSpan]="4" nzRequired>装货地</nz-form-label>
            <nz-form-control [nzErrorTip]="'请输入装货地'">
              <div class="align-center">
                <nz-input-group [nzSuffix]="endInconTemp1">
                  <input
                    nz-input
                    [(ngModel)]="data.detailedAddress"
                    (click)="openMap('start', idx)"
                    formControlName="loadAddress{{ idx }}"
                    placeholder="请输入装货地"
                  />
                </nz-input-group>
                <span  style="padding: 0 10px"
                  ><i nz-icon nzType="menu" nzTheme="outline" style="color: #1890ff" (click)="openMap('start', idx)"></i
                ></span>
              </div>
            </nz-form-control>
          </nz-form-item>
          <nz-form-item>
            <nz-form-label [nzSpan]="4" nzRequired>联系人</nz-form-label>
            <nz-form-control [nzErrorTip]="'请输入联系人信息'">
              <div class="align-center">
                <input nz-input [(ngModel)]="data.appUserName" [ngModelOptions]="{ standalone: true }" maxlength="30" />
                <input style="margin-left: 12px" nz-input [(ngModel)]="data.contractTelephone" [ngModelOptions]="{ standalone: true }" maxlength="11" />
              </div>
            </nz-form-control>
          </nz-form-item>
        </div>
      </div>
      <div nz-col [nzSpan]="8">
        <div style="display: flex; justify-content: center">
          <span style="padding: 24 px; font-size: 30px; color: #7d7d7d"><i nz-icon nzType="swap" nzTheme="outline"></i></span>
        </div>
      </div>
      <div nz-col [nzSpan]="8">
        <div *ngFor="let data of endInfo; let idx = index">
          <nz-form-item>
            <nz-form-label [nzSpan]="4" nzRequired>卸货地</nz-form-label>
            <nz-form-control [nzErrorTip]="'请输入卸货地'">
              <div class="align-center">
                <nz-input-group [nzSuffix]="endInconTemp1">
                  <input
                    nz-input
                    [(ngModel)]="data.detailedAddress"
                    (click)="openMap('end', idx)"
                    formControlName="unloadAddress{{ idx }}"
                    placeholder="请输入卸货地"
                  />
                </nz-input-group>
                <span  style="padding: 0 10px"><i nz-icon nzType="menu" nzTheme="outline" style="color: #1890ff"></i></span>
              </div>
            </nz-form-control>
          </nz-form-item>
          <nz-form-item>
            <nz-form-label [nzSpan]="4" nzRequired>联系人</nz-form-label>
            <nz-form-control [nzErrorTip]="'请输入联系人信息'">
              <div class="align-center">
                <input nz-input [(ngModel)]="data.appUserName" [ngModelOptions]="{ standalone: true }" maxlength="30" />
                <input style="margin-left: 12px" nz-input [(ngModel)]="data.contractTelephone" [ngModelOptions]="{ standalone: true }" maxlength="11" />
              </div>
            </nz-form-control>
          </nz-form-item>
        </div>
      </div>
    </div>
    <div  nz-row [nzGutter]="24" style="margin-top: 24px">
      <div nz-col [nzSpan]="9">
        <p class="time-info">计划装货时间：{{i?.loadPlanTime}}</p>
      </div>
      <div nz-col [nzSpan]="8">
        <p class="time-info">计划卸货时间：{{i?.unloadPlanTime}}</p>
      </div>
    </div>
    <ng-template #endInconTemp1><i nz-icon nzType="global"></i></ng-template>
  </form>
</nz-card>
<nz-card nzTitle="基本信息" id="distannce2">
  <div nz-row>
    <div nz-col nzSpan="12">
      <sf #sf3 [schema]="schema3" [formData]="sf3data" [button]="'none'" [ui]="ui3"></sf>
      <sf #sf4 [schema]="schema4" [formData]="sf4data" [button]="'none'" [ui]="ui4">
        <ng-template sf-template="weight" let-item let-ui="ui">
          <nz-input-group [nzAddOnAfter]="'吨'">
            <input
              nz-input
              type="number"
              [ngModel]="item.value"
              min="0"
              step="0.01"
              (ngModelChange)="item.setValue($event)"
              placeholder="总重量，必填"
            />
          </nz-input-group>
        </ng-template>
        <ng-template sf-template="volume" let-item let-ui="ui">
          <nz-input-group [nzAddOnAfter]="'方'">
            <input
              nz-input
              type="number"
              [ngModel]="item.value"
              min="0"
              step="0.01"
              (ngModelChange)="item.setValue($event)"
              placeholder="总体积"
            />
          </nz-input-group>
        </ng-template>
 
        <ng-template sf-template="number" let-item let-ui="ui">
          <nz-input-group [nzAddOnAfter]="'车'">
            <input
              nz-input
              type="number"
              [ngModel]="item.value"
              min="0"
              step="0.01"
              (ngModelChange)="item.setValue($event)"
              placeholder="总车次"
            />
          </nz-input-group>
        </ng-template>

        <ng-template sf-template="carmand" let-item let-ui="ui">
        {{i?.goodsInfoList?.[0]?.maxWeightLabel}}/{{i?.goodsInfoList?.[0]?.maxCubeLabel}}
        </ng-template>

        <ng-template sf-template="drivers" let-item let-ui="ui">
          {{i?.driverId}}
      </ng-template>

      <ng-template sf-template="weightModel" let-item let-ui="ui">
          {{i?.goodsInfoList?.[0]?.weight}}顿,{{i?.goodsInfoList?.[0]?.volume}}方,{{i?.goodsInfoList?.[0]?.number}}件
        </ng-template>

      <ng-template sf-template="loadTime" let-item let-ui="ui">
               <nz-date-picker nzShowTime nzFormat="yyyy-MM-dd HH:mm:ss"  [(ngModel)]="loadTime"></nz-date-picker>
        </ng-template>
      <ng-template sf-template="unloadTime" let-item let-ui="ui">
        <nz-date-picker nzShowTime nzFormat="yyyy-MM-dd HH:mm:ss"  [(ngModel)]="unloadTime"></nz-date-picker>
        </ng-template>

      </sf>
    </div>
  </div>

</nz-card>


<!-- <nz-card nzTitle="运费信息" id="distannce3">
  <st #st [data]="dirvingMessage" [columns]="logColumns" [ps]="0" [page]="{ show: false, showSize: false }">
  </st>
  <div style="margin-top: 15px;">总计：{{i?.total | currency: '￥'}}（运费￥3500.00，附加运费￥191.98，附加费率3.5%）</div>
  <div style="display: flex;">收款人：
    <div style="display: flex;">
      <input nz-input placeholder="请输入司机手机号" [(ngModel)]="dirverPhone" />
    &nbsp;&nbsp;&nbsp;&nbsp;<input nz-input placeholder="选择银行卡" [(ngModel)]="dirverBankCard" />
    </div>
    
  </div>
</nz-card> -->
<nz-card nzTitle="运费信息" id="distannce3">
  <h2>{{i?.freightPrice}}{{i?.freightTypeLabel}}（以发货为准，保留小数）</h2>
  <st #st [data]="i?.billExpenseDetails" [columns]="logColumns" [ps]="0" [page]="{ show: false, showSize: false }">

  </st>
  <div>总计：{{i?.total | currency: '￥'}}（运费￥3500.00，附加运费￥191.98，附加费率3.5%）</div>
  <div>收款人：</div>
</nz-card>

<nz-card nzTitle="附件信息" id="distannce4">
  <sv-container>
    <sv label="协议附件">
      <!-- {{i?.supplementaryInformationVO?.stateReceipt?'是':'否'}} -->
      <a href="javascript:;" (click)="agreement('1')">查看附件</a>&nbsp;&nbsp;&nbsp;&nbsp;
      <a href="javascript:;" (click)="agreement('2')">补充协议</a>
    </sv>
  </sv-container>
  <sv-container col="2" class="mt-md">
    <sf #sf mode="edit" [schema]="schema" [ui]="ui" [formData]="formData" button="none"></sf>
  </sv-container>
</nz-card>
<nz-card nzTitle="补充信息">
  <sv-container>
    <sv label="是否回单">
      {{i?.goodsResource?.stateReceipt ?'是':'否'}}
    </sv>
    <sv label="回单类型">
      {{i?.goodsResource?.receiptTypeLabel}}
    </sv>
    <sv label="联系人">
      {{i?.goodsResource?.receiptUserId}} / {{i?.supplementaryInformationVO?.phon}}
    </sv>
    <sv label="所在地区">
      {{i?.goodsResource?.receiptAddress}}
    </sv>
    <sv label="详细地址">
      {{i?.goodsResource?.receiptAddress}}
    </sv>
  </sv-container>
  <sv-container col="1" class="mt-md">
    <sv label="回单凭证">
      <nz-upload
      class="avatar-uploader"
      [nzAction]="service.$api_upload_url"
      [nzName]="'multipartFile'"
      nzListType="picture-card"
      [(nzFileList)]="listImagUrls"
      [nzShowButton]="listImagUrls.length < 5"
      [nzPreview]="handlePreview1"
      [nzBeforeUpload]="beforeUpload"
      (nzChange)="handleChange1($event)"
    >
      <div>
        <i nz-icon nzType="plus"></i>
        <div style="margin-top: 8px">请上传图片</div>
      </div>
    </nz-upload>
    <nz-modal [nzVisible]="previewVisible1" [nzContent]="modalContent" [nzFooter]="null" (nzOnCancel)="previewVisible1 = false">
      <ng-template #modalContent>
        <img [src]="previewImage1" [ngStyle]="{ width: '100%' }" />
      </ng-template>
    </nz-modal>
    </sv>
    <sv label="备注">
      {{i?.goodsResource?.remarks}}
    </sv>
  </sv-container>
</nz-card>

<nz-card>
  <div nz-row>
    <nz-card nzTitle="轨迹信息" style="width: 100%;" id="distannce5">
      <div nz-row > 
        <div nz-col [nzSpan]='12'>
    <!-- <st #st [data]="i?.auditRecordList" [columns]="logColumns" [ps]="0" [page]="{ show: false, showSize: false }">
    </st> -->
  </div>
  <div nz-col [nzSpan]='12'>
     <amap-path-simplifier></amap-path-simplifier>
   </div>
   </div>
    </nz-card>
  </div>
</nz-card>
<nz-modal [(nzVisible)]="isVisible"   [nzFooter]="nzModalFooter" nzTitle="附件信息" (nzOnOk)="handleOK()" (nzOnCancel)="handleCancel()">
  <ng-container *nzModalContent>
    <app-imagelist [imgList]="imges"></app-imagelist>
  </ng-container>
  <ng-template #nzModalFooter>
    <button nz-button nzType="primary" (click)="handleOK()" [disabled]="">取消</button>
    <button nz-button nzType="default" (click)="handleCancel()">确定  </button>
  </ng-template>
</nz-modal>