<template>
  <div v-loading="dataLoading" class="full n-app-container bg-w orderManagement">
    <div style="margin: 10px 0">
      <el-tabs v-model="listTablName" @tab-click="handleClick">
        <el-tab-pane name="all">
          <span slot="label">全部订单({{ orderQtyDtos.all }})</span>
        </el-tab-pane>
        <el-tab-pane name="print">
          <span slot="label">待揽件({{ orderQtyDtos.createed }})</span>
        </el-tab-pane>
        <el-tab-pane name="transfer">
          <span slot="label">处理中({{ orderQtyDtos.receiver }})</span>
        </el-tab-pane>
        <el-tab-pane name="out">
          <span slot="label">已出库({{ orderQtyDtos.transfer }})</span>
        </el-tab-pane>
        <el-tab-pane name="bank">
          <span slot="label">已退件({{ orderQtyDtos.barck }})</span>
        </el-tab-pane>
        <el-tab-pane name="cancel">
          <span slot="label">已取消({{ orderQtyDtos.cancel }})</span>
        </el-tab-pane>
        <el-tab-pane name="draft">
          <span slot="label">草稿订单({{ orderQtyDtos.draft }})</span>
        </el-tab-pane>
      </el-tabs>
      <!--查询条件 start-->
      <div>
        <el-row :gutter="19"
          ><el-col :span="8">
            <el-form>
              <el-form-item>
                <el-input
                  v-model="pagerDto.SearchNumber"
                  type="textarea"
                  :rows="11"
                  resize="none"
                  placeholder="支持客户单号、服务商单号、行运易单号，请录入每行一个单号，最多可以输入500行数据"
                />
              </el-form-item>
            </el-form>
          </el-col>
          <el-col :span="16">
            <el-form inline label-position="top">
              <el-form-item
                label="产品名称"
                style="margin-bottom: 10px;"
              >
                <el-select
                  v-model="pagerDto._Eq_CreateOrderChannelId"
                  clearable
                  style="width: 290px"
                  placeholder=""
                  filterable
                >
                  <el-option
                    v-for="item in channels"
                    :key="item.Id"
                    :label="item.Name"
                    :value="item.Id"
                  />
                </el-select>
              </el-form-item>
              <el-form-item
                label="国　　家"
                style="margin-bottom: 10px;"
              >
                <el-select
                  v-model="pagerDto._Eq_ReceiverCountryCode"
                  clearable
                  filterable
                  auto-complete="false"
                  style="width: 290px"
                  fillter
                >
                  <el-option
                    v-for="(item, index) in serachCountryList"
                    :key="index"
                    :label="item.CnName + ' ' + item.Code + ' ' + item.EnName"
                    :value="item.Code"
                  >
                    <span style="float: left"
                      >{{ item.CnName }}
                      <span style="color: #8492a6; font-size: 10px">{{
                        item.EnName
                      }}</span>
                    </span>
                    <span style="float: right">{{ item.Code }}</span>
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="下单时间"
                style="margin-bottom: 10px;"
              >
                <el-date-picker
                  v-model="pagerDto._Range_CreateTime"
                  style="width: 290px"
                  type="daterange"
                  range-separator="~"
                  value-format="yyyy-MM-dd"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期"
                />
              </el-form-item>
              <el-form-item
                label="线上订单"
                style="margin-bottom: 10px;"
              >
                <el-select
                  v-model="pagerDto._Eq_IsOnline"
                  clearable
                  style="width: 290px"
                  placeholder=""
                  fillter
                >
                  <el-option
                    v-for="item in btypes"
                    :key="item.Id"
                    :label="item.Name"
                    :value="item.Id"
                  />
                </el-select>
              </el-form-item>
              <el-form-item
                label="收件时间"
                style="margin-bottom: 10px;"
              >
                <el-date-picker
                  v-model="pagerDto._Range_ReceiveTime"
                  style="width: 290px"
                  type="daterange"
                  range-separator="~"
                  value-format="yyyy-MM-dd"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期"
                />
              </el-form-item>
              <el-form-item
                label="收件人"
                style="margin-bottom: 10px;"
              >
                <el-input
                  v-model="pagerDto._Eq_ReceiverName"
                  style="width: 290px"
                />
              </el-form-item>
              <el-form-item
                label="是否一票多件"
                style="margin-bottom: 10px;"
                fillter
              >
                <el-select
                  v-model="IsMpsOrderId"
                  clearable
                  style="width: 290px"
                  placeholder=""
                >
                  <el-option
                    v-for="item in btypes"
                    :key="item.Id"
                    :label="item.Name"
                    :value="item.Id"
                  />
                </el-select>
              </el-form-item>
              <el-form-item
                label="客　　户"
                style="margin-bottom: 10px;"
              >
                <el-select
                  v-model="CustomerIds"
                  placeholder="客户"
                  clearable
                  filterable
                  multiple
                  style="width: 290px"
                >
                  <el-option
                    v-for="item in Customers"
                    :key="item.Id"
                    :label="item.CompanyName"
                    :value="item.Id"
                  />
                </el-select>
              </el-form-item>
              <el-form-item style="margin-bottom: 10px;margin-top: 36px;">
                <el-button type="primary" size="medium" :loading="searchLoading" @click="pagerSerach()"
                  >查询</el-button
                >
                <el-button>重置</el-button>
              </el-form-item>
            </el-form>
            <div style="clear: both" />
            <!-- <div style="text-align: left; margin-top: 20px; margin-left: 10px">
              <el-form>
                <el-button type="primary" size="medium" @click="pagerSerach()"
                  >查询</el-button
                >
                <el-button>重置</el-button>
              </el-form>
            </div> -->
          </el-col>
        </el-row>
      </div>
      <!--查询条件 end-->
      <!--table start-->
      <div>
        <div slot="header" class="clearfix">
          <el-button
            v-if="pagerDto._Eq_OrderStatus != '10000'"
            @click="outTableData()"
            >导出</el-button
          >
          <el-dropdown size="medium" @command="handleCommand">
            <el-button style="margin-left: 10px">
              面单获取<i class="el-icon-arrow-down el-icon--right" />
            </el-button>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item
                v-if="pagerDto._Eq_OrderStatus != '10000'"
                :lading="downLoadingLabel"
                :command="commands.downloadPdf"
                >下载面单</el-dropdown-item
              >
              <el-dropdown-item
                v-if="pagerDto._Eq_OrderStatus != '10000'"
                :lading="downLoadingLabel"
                :command="commands.downloadPdfEnd"
                >下载渠道面单</el-dropdown-item
              >
            </el-dropdown-menu>
          </el-dropdown>
          <!-- <el-button
            v-if="pagerDto._Eq_OrderStatus != '10000'"
            :loading="downLoadingLabel"
            @click="downloadPdf()"
          >下载面单</el-button> -->
          <el-dropdown size="medium" @command="handleCommand">
            <el-button style="margin-left: 10px">
              末端操作<i class="el-icon-arrow-down el-icon--right" />
            </el-button>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item
                v-if="pagerDto._Eq_OrderStatus != '10000'"
                :lading="orderLoading"
                :command="commands.createchannelorder"
                >一票多件下单</el-dropdown-item
              >
              <el-dropdown-item
                v-if="pagerDto._Eq_OrderStatus != '10000'"
                :lading="orderLoading"
                :command="commands.outorderboxs"
                >导出箱子信息</el-dropdown-item
              >
            </el-dropdown-menu>
          </el-dropdown>

          <el-dropdown size="medium" @command="handleCommand">
            <el-button style="margin-left: 10px">
              更多操作<i class="el-icon-arrow-down el-icon--right" />
            </el-button>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item
                v-if="pagerDto._Eq_OrderStatus != '10000'"
                :command="commands.downloadSendReceipt"
                >下载发货证明</el-dropdown-item
              >
              <el-dropdown-item
                v-if="
                  pagerDto._Eq_OrderStatus != '10000' &&
                  pagerDto._Eq_OrderStatus != '0'
                "
                :command="commands.cancelOrder"
                >取消订单</el-dropdown-item
              >
              <el-dropdown-item
                v-if="pagerDto._Eq_OrderStatus == '0'"
                :command="commands.deleteOrder"
                >彻底删除</el-dropdown-item
              >
              <el-dropdown-item
                v-if="pagerDto._Eq_OrderStatus == '0'"
                :command="commands.recovery"
                >还原订单</el-dropdown-item
              >
              <el-dropdown-item
                v-if="pagerDto._Eq_OrderStatus == '10000'"
                :command="commands.cancelDraftOrder"
                >删除草稿</el-dropdown-item
              >
              <el-dropdown-item
                v-if="pagerDto._Eq_OrderStatus == '10000'"
                :command="commands.retryDraftOrder"
                >草稿重试</el-dropdown-item
              >
              <el-dropdown-item
                v-if="pagerDto._Eq_OrderStatus != '10000'"
                :lading="orderLoading"
                :command="commands.EUHSCodeUpdate"
                >欧盟海关更新</el-dropdown-item
              >
              <el-dropdown-item
                v-if="pagerDto._Eq_OrderStatus != '10000'"
                :lading="downLoadingMps"
                :command="commands.outMpsOrder"
                >导出一票多件</el-dropdown-item
              >
              <el-dropdown-item
                v-if="pagerDto._Eq_OrderStatus != '10000'"
                :command="commands.modifyCreateOrderChannel"
                >修改FBA订单创建渠道</el-dropdown-item
              >
              <el-dropdown-item
                v-if="pagerDto._Eq_OrderStatus === '2'"
                :command="commands.smallToLarge"
                >小包订单转换FBA发货</el-dropdown-item
              >
              <el-dropdown-item
                :loading="orderAndGoodsLoading"
                :command="commands.smallPackageOrderInfo"
                >导出小包订单下单信息（含物品）</el-dropdown-item
              >
            </el-dropdown-menu>
          </el-dropdown>
          <el-dropdown size="medium" @command="batchHandleCommand">
            <el-button style="margin-left: 10px">
              批量调整<i class="el-icon-arrow-down el-icon--right" />
            </el-button>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item
                v-if="pagerDto._Eq_OrderStatus != '10000'"
                command="IncFBAIncidentals"
                >导入FBA费用</el-dropdown-item
              >
              <el-dropdown-item
                v-if="pagerDto._Eq_OrderStatus != '10000' && showFbaImportExcel"
                command="ImportFbaBoxInfo"
                >导入末端下单重量</el-dropdown-item
              >
               <el-dropdown-item
                v-if="pagerDto._Eq_OrderStatus != '10000'"
                command="ImportFbaOrderInfo"
                >导入FBA末端信息</el-dropdown-item
              >
            </el-dropdown-menu>
          </el-dropdown>

          <el-select
            v-if="pagerDto._Eq_OrderStatus == '1' && IsDS()"
            v-model="pagerDto._Eq_PostDSStatus"
            size="medium"
            style="float: right"
            >
            <!-- @change="queryCommand" -->
            <el-option value="" label="选择提交发货状态" />
            <el-option :value="true" label="已提交发货" />
            <el-option :value="false" label="未提交发货" />
          </el-select>
        </div>
        <el-table
          :data="sdata"
          :highlight-current-row="true"
          :select-on-indeterminate="true"
          width="100%"
          border
          header-row-class-name="tableHeader"
          style="margin-top: 20px"
          @selection-change="onSelection"
        >
          <el-table-column key="Id" prop="Id" type="selection" />
          <el-table-column key="CustomerOrderNo" label="客户单号" width="300">
            <template slot-scope="r">
              <el-button
                type="text"
                @click="
                  showOrderInfo(r.row.Id, 'info', r.row.MpsOrderId, r.row.Tags)
                "
              >
                {{ r.row.CustomerOrderNo }}
              </el-button>
              <el-tag v-if="r.row.MpsOrderId > 0">多件</el-tag>
              <el-tag v-for="(item, index) in r.row.Tags" :key="index">{{
                item
              }}</el-tag>
              <el-tag
                v-for="(item, index) in r.row.attrs"
                :key="index"
                type="danger"
                >{{ item }}</el-tag
              >
            </template>
          </el-table-column>
          <el-table-column
            v-if="pagerDto._Eq_OrderStatus != '10000'"
            key="TrackingNumber"
            label="服务商单号"
            prop="TrackingNumber"
            width="300"
          />
          <el-table-column
            v-if="pagerDto._Eq_OrderStatus != '10000'"
            key="TransferNumber"
            label="行运易单号"
            prop="TransferNumber"
            width="200"
          />
          <el-table-column
            key="ChannelName"
            label="服务产品"
            prop="ChannelName"
          />
          <el-table-column
            key="CreateOrderChannelName"
            label="下单渠道"
            prop="CreateOrderChannelName"
          />
          <el-table-column key="Quantity" label="件数" prop="Quantity" />
           <el-table-column v-if="listTablName=='all'" key="OrderStatusDec" label="订单状态" prop="OrderStatusDec" />
          <el-table-column
            key="ReceiverCountryCode"
            label="国家/地区"
            prop="ReceiverCountryCode"
          />
          <el-table-column
            key="CustomerName"
            label="客户名称"
            prop="CustomerName"
          />
          <el-table-column
            key="CreateTime"
            label="下单时间"
            prop="CreateTime"
            width="200"
          />
          <el-table-column
            key="ReceiveTime"
            label="称重时间"
            prop="ReceiveTime"
            width="200"
          />
          <el-table-column key="CustomerWeight" label="下单重量(Kg)">
            <template slot-scope="r">
              {{ r.row.CustomerWeight / 1000.0 }}
            </template>
          </el-table-column>
          <el-table-column
            v-if="pagerDto._Eq_OrderStatus == '10000'"
            key="DraftStatus"
            label="状态"
          >
            <template slot-scope="r">
              {{ r.row.DraftStatus == 0 ? "待处理" : "失败" }}
            </template>
          </el-table-column>
          <el-table-column
            v-if="pagerDto._Eq_OrderStatus == '1' && IsDS()"
            key="dsStatus"
            label="提交发货"
          >
            <template slot-scope="r">
              <el-tag v-if="r.row.PostDSStatus" type="success" effect="dark"
                >已提交</el-tag
              >
              <el-tag v-if="!r.row.PostDSStatus" type="warning" effect="dark"
                >未提交</el-tag
              >
            </template>
          </el-table-column>
          <el-table-column
            v-if="pagerDto._Eq_OrderStatus == '10000'"
            key="ErrorMessage"
            label="错误原因"
            prop="ErrorMessage"
            width="500"
          />
          <el-table-column
            v-if="pagerDto._Eq_OrderStatus != '10000'"
            key="CFright"
            label="预计费用"
            prop="CFright"
          >
            <template slot-scope="r">
              {{ r.row.CFright.toFixed(2) }}
            </template>
          </el-table-column>
          <el-table-column
            v-if="pagerDto._Eq_OrderStatus != '10000'"
            key="LatestLogisticsStatus"
            label="轨迹"
          >
            <template slot-scope="r">
              <el-button
                type="text"
                @click="showOrderInfo(r.row.Id, 'track', r.row.MpsOrderId)"
              >
                {{ r.row.LatestLogisticsStatus }}
              </el-button>
            </template>
          </el-table-column>

          <el-table-column
            v-if="pagerDto._Eq_OrderStatus != '10000'"
            label="操作"
            width="180"
          >
            <template slot-scope="r">
              <p style="margin: 5px">
                <el-tag
                  v-if="r.row.MpsOrderId > 0 && r.row.CustomerSettlement"
                  type="success"
                  >客户已结</el-tag
                >
              </p>
              <p style="margin: 5px">
                <el-tag
                  v-if="r.row.MpsOrderId > 0 && !r.row.CustomerSettlement"
                  type="danger"
                  >客户未结</el-tag
                >
              </p>
              <p style="margin: 5px">
                <el-tag
                  v-if="r.row.MpsOrderId > 0 && r.row.BranchOfficeSettlement"
                  type="success"
                  >结算已结</el-tag
                >
              </p>
              <p style="margin: 5px">
                <el-tag
                  v-if="r.row.MpsOrderId > 0 && !r.row.BranchOfficeSettlement"
                  type="danger"
                  >结算未结</el-tag
                >
              </p>
              <el-dropdown
                v-if="r.row.MpsOrderId > 0"
                trigger="click"
                @command="fbaHandleCommand"
              >
                <el-button size="mini">
                  FBA费用<i class="el-icon-arrow-down el-icon--right" />
                </el-button>
                <el-dropdown-menu slot="dropdown">
                  <el-dropdown-item
                    icon="el-icon-plus"
                    :command="{
                      orderId: r.row.Id,
                      target: 0,
                      action: 'showInputIncidentals',
                    }"
                    >客户杂费</el-dropdown-item
                  >
                  <el-dropdown-item
                    icon="el-icon-circle-plus"
                    :command="{
                      orderId: r.row.Id,
                      target: 1,
                      action: 'showInputIncidentals',
                    }"
                    >成本费用</el-dropdown-item
                  >
                  <el-dropdown-item
                    v-if="r.row.MpsOrderId > 0 && !r.row.CustomerSettlement"
                    :command="{
                      orderId: r.row.Id,
                      target: 0,
                      action: 'setComfig',
                    }"
                    icon="el-icon-circle-plus-outline"
                    >完成客户杂费</el-dropdown-item
                  >
                  <el-dropdown-item
                    v-if="r.row.MpsOrderId > 0 && !r.row.BranchOfficeSettlement"
                    :command="{
                      orderId: r.row.Id,
                      target: 1,
                      action: 'setComfig',
                    }"
                    icon="el-icon-check"
                    >完成成本费用</el-dropdown-item
                  >
                  <el-dropdown-item
                    icon="el-icon-plus"
                    :command="{ orderId: r.row.Id, action: 'showFee' }"
                    >费用查看</el-dropdown-item
                  >
                </el-dropdown-menu>
              </el-dropdown>
              <el-button v-if="r.row.TransferNumber" class="update-tracking-bill" size="mini" type="primary" @click="updateTrackingWaybill(r.row)">更新单号与面单</el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          style="margin-top: 10px"
          :page-sizes="[10, 20, 40, 100, 400]"
          :current-page="pagerDto.PageIndex"
          :page-size.sync="pagerDto.PageSize"
          background
          layout="prev, pager, next ,total ,jumper,sizes,slot "
          :total="pagerDto.total"
          @size-change="changePager"
          @current-change="pagerSerach"
        />
      </div>
      <!--table end-->
      <!--order detail start -->
      <el-drawer
        :visible.sync="visible"
        :with-header="false"
        direction="rtl"
        :modal-append-to-body="false"
        custom-class="orderInfo"
        size="70%"
      >
        <div class="demo-drawer__content">
          <el-tabs v-model="tabName">
            <el-tab-pane name="info">
              <span slot="label" class="tab-text2">订单信息</span>
              <div v-if="orderInfo.ErrorMessage" class="errorMessage">
                {{ orderInfo.ErrorMessage }}
              </div>
              <div class="profile-user-info profile-user-info-striped">
                <div class="profile-info-row">
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">客单号</div>
                    <div class="profile-info-value">
                      {{ orderInfo.CustomerOrderNo }}
                    </div>
                  </div>
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">跟踪号</div>
                    <div class="profile-info-value">
                      {{ orderInfo.TrackingNumber }}
                    </div>
                  </div>
                </div>
                <div class="profile-info-row">
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">转单号</div>
                    <div class="profile-info-value">
                      {{ orderInfo.TransferNumber }}
                    </div>
                  </div>
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">渠道名称</div>
                    <div class="profile-info-value">
                      {{ orderInfo.ChannelName }}
                    </div>
                  </div>
                </div>
                <div class="profile-info-row">
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">收件人</div>
                    <div class="profile-info-value">
                      {{ orderInfo.ReceiverName }}
                    </div>
                  </div>
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">收件国家</div>
                    <div class="profile-info-value">
                      {{ orderInfo.ReceiverCountryCode }}
                    </div>
                  </div>
                </div>
                <div class="profile-info-row">
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">收件洲</div>
                    <div class="profile-info-value">
                      {{ orderInfo.ReceiverState }}
                    </div>
                  </div>
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">收件城市</div>
                    <div class="profile-info-value">
                      {{ orderInfo.ReceiverCity }}
                    </div>
                  </div>
                </div>
                <div class="profile-info-row">
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">收件地址</div>
                    <div class="profile-info-value">
                      {{ orderInfo.ReceiverStreet }}
                    </div>
                  </div>
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">收件电话</div>
                    <div class="profile-info-value">
                      {{ orderInfo.ReceiverPhone }}
                    </div>
                  </div>
                </div>
                <div class="profile-info-row">
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">收件邮编</div>
                    <div class="profile-info-value">
                      {{ orderInfo.ReceiverZipCode }}
                    </div>
                  </div>
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">门牌号</div>
                    <div class="profile-info-value">{{ orderInfo.House }}</div>
                  </div>
                </div>
                <div class="profile-info-row">
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">收件邮箱</div>
                    <div class="profile-info-value">
                      {{ orderInfo.ReceiverEmail }}
                    </div>
                  </div>
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">操作</div>
                    <div class="profile-info-value">
                      <el-button
                        v-if="
                          orderInfo.MpsOrderId > 0 &&
                          (!orderInfo.TrackingNumber ||
                            orderInfo.TrackingNumber.indexOf('XYY') != -1)
                        "
                        type="text"
                        @click="dialogUpdateOrderInfo = true"
                      >
                        修改信息
                      </el-button>
                      <el-button
                        v-clipboard:copy="orderInfo.ReceiverStreet"
                        v-clipboard:success="onCopy"
                        v-clipboard:error="onErrorEvent"
                        type="text"
                      >
                        复制地址
                      </el-button>
                    </div>
                  </div>
                </div>
                <div class="profile-info-row">
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">下单重量</div>
                    <div class="profile-info-value">
                      {{ orderInfo.CustomerWeight }}
                    </div>
                  </div>
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">导入重量</div>
                    <div class="profile-info-value">
                      {{ orderInfo.SWeight }}
                    </div>
                  </div>
                </div>
                <!-- <div class="profile-info-row">
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">材质</div>
                    <div class="profile-info-value">
                      {{ orderInfo.Meterial }}
                    </div>
                  </div>
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">用途</div>
                    <div class="profile-info-value">
                      {{ orderInfo.Usage }}
                    </div>
                  </div>
                </div>
                <div class="profile-info-row">
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">品牌</div>
                    <div class="profile-info-value">
                      {{ orderInfo.Brand }}
                    </div>
                  </div>
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">型号</div>
                    <div class="profile-info-value">
                      {{ orderInfo.ModelNumber }}
                    </div>
                  </div>
                </div> -->
                <div class="profile-info-row">
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">已上传IOSS</div>
                    <div class="profile-info-value">
                      {{ orderInfo.HasIOSS ? "已上传" : "未上传" }}
                    </div>
                  </div>
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">线上发货</div>
                    <div class="profile-info-value">
                      {{ orderInfo.IsOnline ? "线上发货" : "线下发货" }}
                    </div>
                  </div>
                </div>
                <div class="profile-info-row">
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">拦截状态</div>
                    <div class="profile-info-value">
                      {{ orderInfo.UnusualReason }}
                    </div>
                  </div>
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">状态</div>
                    <div class="profile-info-value">
                      {{
                        orderInfo.StrDraftStatus
                          ? orderInfo.StrDraftStatus
                          : orderInfo.StrOrderStatus
                      }}
                    </div>
                  </div>
                </div>
                <div class="profile-info-row">
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">报关方式</div>
                    <div class="profile-info-value">
                      {{ orderInfo.DeclarationMethod }}
                    </div>
                  </div>
                  <div class="profile-info-row-c">
                    <div class="profile-info-name">订单文件</div>
                    <div class="profile-info-value">
                      <a
                        v-if="orderInfo.UploadFileUrl"
                        :href="orderInfo.UploadFileUrl"
                        target="_blank"
                        >下载文件</a
                      >
                    </div>
                  </div>
                </div>
              </div>
              <div v-if="boxs.length > 0">
                <el-table :data="boxs" border style="margin-top: 20px">
                  <el-table-column prop="BoxNumber" label="箱号" />
                  <el-table-column prop="BoxTrackingNumber" label="派送单号" />
                  <el-table-column prop="BoxServiceNumber" label="系统单号" />
                  <el-table-column prop="Weight" label="客户数据">
                    <template slot-scope="r">
                      {{ r.row.Weight }}(kg)<br />
                      {{ r.row.Length }}x{{ r.row.Width }}x{{
                        r.row.Height
                      }}(cm)
                    </template>
                  </el-table-column>
                  <el-table-column label="拣货数据/实重/材重">
                    <template slot-scope="r">
                      {{ r.row.OpInputWeight }}/<span
                        v-if="r.row.VolumeWeight > r.row.OpInputWeight"
                        style="color: green"
                        >{{ r.row.VolumeWeight }}</span
                      >
                      <span v-else>{{ r.row.VolumeWeight }}</span
                      >(kg)
                      <br />
                      {{ r.row.OpLength }}x{{ r.row.OpWidth }}x{{
                        r.row.OpHeight
                      }}(cm)
                    </template>
                  </el-table-column>
                  <el-table-column label="确认数据/最终计费重">
                    <template slot-scope="r">
                      {{ r.row.BillWeight }} / {{ r.row.OpWeight }}(kg)
                      <br />
                      {{ r.row.BillLenght }}x{{ r.row.BillWidth }}x{{
                        r.row.BillHeight
                      }}(cm)
                    </template>
                  </el-table-column>
                  <el-table-column prop="Weight" label="标识">
                    <template slot-scope="r">
                      <el-tag v-if="r.row.BoxStatus == 15">先发</el-tag>
                      <el-tag v-else-if="r.row.BoxStatus == 30">退回</el-tag>
                      <el-tag v-if="r.row.BoxOutStatus == 20">收货</el-tag>
                      <el-tag v-else-if="r.row.BoxOutStatus == 25"
                        >转运出库</el-tag
                      >
                      <el-tag v-else-if="r.row.BoxOutStatus == 30"
                        >退回出库</el-tag
                      >
                    </template>
                  </el-table-column>
                  <el-table-column label="操作">
                    <template slot-scope="scope">
                      <el-button
                        v-if="
                          scope.row.BoxStatus < 15 &&
                          scope.row.BoxOutStatus < 25
                        "
                        type="primary"
                        plain
                        @click="BoxStatusOp(scope.row, 'BeforeReceiptToSend')"
                        >先发</el-button
                      >
                      <el-button
                        v-if="
                          scope.row.BoxStatus != 30 &&
                          scope.row.BoxOutStatus < 25
                        "
                        type="danger"
                        plain
                        @click="BoxStatusOp(scope.row, 'Back')"
                        >退回</el-button
                      >
                    </template>
                  </el-table-column>
                </el-table>
              </div>
              <el-table style="margin-top: 20px" border :data="goods">
                <el-table-column
                  v-if="boxs.length > 0"
                  prop="BoxNumber"
                  label="箱号"
                />
                <el-table-column
                  v-if="boxs.length <= 0"
                  prop="GoodsNumber"
                  label="产品编号"
                />
                <el-table-column prop="CnName" label="中文品名" />
                <el-table-column prop="EnName" label="英文品名" />
                <el-table-column prop="HsCode" label="海关编码" />
                <el-table-column
                  prop="DeclareFee"
                  label="申报价值"
                  width="80"
                />
                <el-table-column
                  prop="DeclareCurrency"
                  label="申报币种"
                  width="80"
                />
                <el-table-column prop="Quantity" label="申报数量" width="80" />
                <el-table-column
                  v-if="boxs.length > 0"
                  prop="Meterial"
                  label="材质"
                />

                <el-table-column
                  v-if="boxs.length > 0"
                  prop="Usage"
                  label="用途"
                />
                <el-table-column
                  v-if="boxs.length > 0"
                  prop="Magnetic"
                  label="带磁"
                >
                  <template slot-scope="r">
                    <el-tag v-if="r.row.Magnetic" type="danger">是</el-tag>
                    <el-tag v-else>否</el-tag>
                  </template>
                </el-table-column>
                <el-table-column
                  v-if="boxs.length > 0"
                  prop="Electric"
                  label="带电"
                >
                  <template slot-scope="r">
                    <el-tag v-if="r.row.Electric" type="danger">是</el-tag>
                    <el-tag v-else>否</el-tag>
                  </template>
                </el-table-column>
                <el-table-column
                  v-if="boxs.length > 0"
                  prop="Liquid"
                  label="危险品"
                >
                  <template slot-scope="r">
                    <el-tag v-if="r.row.Liquid" type="danger">是</el-tag>
                    <el-tag v-else>否</el-tag>
                  </template>
                </el-table-column>
              </el-table>
            </el-tab-pane>
            <el-tab-pane name="track">
              <span slot="label" class="tab-text2">物流信息</span>
              <div class="tracking-box">
                <div class="tracking-left">
                  <div class="tracking-label">
                    <div class="tracking-status">
                      {{
                        orderInfo.LatestLogisticsStatus +
                        (orderInfo.LatestLogisticsStatus == "Delivered"
                          ? "(" + orderInfo.SignDay + " days)"
                          : "")
                      }}
                    </div>
                    <div class="tracking-number">
                      {{ orderInfo.TrackingNumber }}
                    </div>
                  </div>
                </div>
                <div class="tracking-content">
                  <div class="trakcing-service">
                    <a :href="orderInfo.ShippingServiceUrl" target="_blank">
                      {{ orderInfo.ShippingServiceName }}</a
                    >
                  </div>
                  <div class="tracking-country">
                    <div class="dian" />
                    <div>
                      CN <span class="iconfont icon-xiangyoujiaohuan" />{{
                        orderInfo.ReceiverCountryCode
                      }}
                    </div>
                    <div class="dian" />
                  </div>
                </div>
                <div class="tracking-right">
                  <div class="lastGetTime">
                    {{ orderInfo.LastGetTime }}
                  </div>
                  <div class="lastTrackingTime">
                    {{ orderInfo.TransferNumber }}
                  </div>
                </div>
              </div>
              <el-timeline
                :reverse="true"
                style="margin-top: 20px; padding-left: 10px"
              >
                <el-timeline-item
                  v-for="(activity, index) in orderInfo.TrackingLogs"
                  :key="index"
                  :timestamp="activity.TriggerTime"
                  :type="
                    index == orderInfo.TrackingLogs.length - 1 ? 'primary' : ''
                  "
                >
                  {{ activity.StatusString }} {{ activity.Location }}
                </el-timeline-item>
              </el-timeline>
            </el-tab-pane>
            <el-tab-pane>
              <span slot="label" class="tab-text2">操作记录</span>
              <el-timeline
                :reverse="true"
                style="margin-top: 20px; padding-left: 10px"
              >
                <el-timeline-item
                  v-for="(activity, index) in fristTrackingLogs"
                  :key="index"
                  :timestamp="activity.TriggerTime"
                  :type="index == fristTrackingLogs.length - 1 ? 'primary' : ''"
                >
                  {{ activity.StatusString }}
                </el-timeline-item>
              </el-timeline>
            </el-tab-pane>
          </el-tabs>
        </div>
      </el-drawer>
      <!--order detail end -->
    </div>
    <el-dialog title="选择服务渠道" :visible.sync="dialogVisible" width="80%">
      <el-form>
        <el-form-item label="服务渠道">
          <el-select v-model="channelId" filterable>
            <el-option
              v-for="item in lastChannelList"
              :key="item.Id"
              :label="item.Name"
              :value="item.Id"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="合并订单">
          <el-checkbox v-model="meger" />
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" :loading="orderLoading" @click="createOrder()"
          >确 定</el-button
        >
      </span>
    </el-dialog>

    <el-dialog
      :title="supplementModel"
      :visible.sync="dialogSupplementModel"
      width="80%"
    >
      <el-form inline label-width="100">
        <el-row v-if="inputFBADto.target > 0">
          <el-col :span="7">
            <el-form-item label="成本单价">
              <el-input
                v-model="inputFBADto.CostPrice"
                placeholder="请填入成本单价"
              />
            </el-form-item>
          </el-col>
          <el-col :span="7">
            <el-form-item label="计费重量(Kg)">
              <el-input
                v-model="inputFBADto.ChargedWeight"
                placeholder="请填入计费重量"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row
          v-for="(domain, index) in inputFBADto.incidentals"
          :key="index"
          :gutter="20"
        >
          <el-col :span="7">
            <el-form-item label="费用名称">
              <el-select
                v-model="domain.Name"
                placeholder="输入或选择一个费用名称"
                allow-create
                default-first-option
                filterable
                clearable
              >
                <el-option
                  v-for="item in FBAFeeType"
                  :key="item"
                  :value="item"
                  :label="item"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="7">
            <el-form-item label="计费方式">
              <el-select
                v-model="domain.CalculateType"
                placeholder="请选择计费方式"
              >
                <el-option :value="0" label="称重_KG" />
                <el-option :value="1" label="固定" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="7">
            <el-form-item label="计费值">
              <el-input v-model="domain.Fee" placeholder="请填入计费值" />
            </el-form-item>
          </el-col>
          <el-col :span="3">
            <el-form-item>
              <el-button type="danger" @click="deleteIncidentals(index)"
                >删除</el-button
              >
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button type="info" @click="pushIncidentals">添加明细</el-button>
        <el-button type="primary" @click="saveFee()">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog title="费用查看" :visible.sync="dialogFeeList">
      <el-tabs v-model="activeName">
        <el-tab-pane label="成本费用" name="first">
          <p>成本明细</p>
          <el-table :data="feeList.CBDetail" border>
            <el-table-column label="费用名称" prop="FeeDescription" />
            <el-table-column label="重量" prop="BillingWeight" />
            <el-table-column label="费用总计" prop="AmountinOriginalCurrency" />
            <el-table-column label="计算方式" prop="Remark" />
          </el-table>
          <p>成本总计</p>
          <el-table :data="feeList.CBSum" style="width: 100%" border>
            <el-table-column prop="ShippingFee" label="运费" />
            <el-table-column prop="AttachFee" label="附加费" />
            <el-table-column label="总计">
              <template slot-scope="r">
                {{ r.row.ShippingFee + r.row.AttachFee }}
              </template>
            </el-table-column>
            <el-table-column prop="Profit" label="毛利" />
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="结算费用" name="second">
          <p>结算明细</p>
          <el-table :data="feeList.JSDetail" border>
            <el-table-column label="费用名称" prop="FeeDescription" />
            <el-table-column label="重量" prop="BillingWeight" />
            <el-table-column label="费用总计" prop="AmountinOriginalCurrency" />
            <el-table-column label="计算方式" prop="Remark" />
          </el-table>
          <p>结算总计</p>
          <el-table :data="feeList.JSSum" style="width: 100%" border>
            <el-table-column prop="ShippingFee" label="运费" />
            <el-table-column prop="AttachFee" label="附加费" />
            <el-table-column label="总计">
              <template slot-scope="r">
                {{ r.row.ShippingFee + r.row.AttachFee }}
              </template>
            </el-table-column>
            <el-table-column prop="Profit" label="毛利" />
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="客户费用" name="third">
          <p>客户明细</p>
          <el-table :data="feeList.KHDetail" border>
            <el-table-column label="费用名称" prop="FeeDescription" />
            <el-table-column label="重量" prop="BillingWeight" />
            <el-table-column label="费用总计" prop="AmountinOriginalCurrency" />
            <el-table-column label="计算方式" prop="Remark" />
          </el-table>
          <p>客户总计</p>
          <el-table :data="feeList.KHSum" style="width: 100%" border>
            <el-table-column prop="ShippingFee" label="运费" />
            <el-table-column prop="AttachFee" label="附加费" />
            <el-table-column label="总计">
              <template slot-scope="r">
                {{ r.row.ShippingFee + r.row.AttachFee }}
              </template>
            </el-table-column>
            <el-table-column prop="Profit" label="毛利" />
          </el-table>
        </el-tab-pane>
      </el-tabs>
    </el-dialog>
    <el-dialog
      title="订单信息更新"
      width="60%"
      :visible.sync="dialogUpdateOrderInfo"
    >
      <el-form inline>
        <el-form-item>
          <el-button :loading="saveLoading" @click="SaveMpsOrderInfo"
            >保存修改</el-button
          >
        </el-form-item>
        <el-tabs v-model="activeName">
          <el-tab-pane label="订单信息调整" name="first">
            <el-row>
              <el-col :span="12">
                <el-form-item label="收件人">
                  <el-input v-model="orderInfo.ReceiverName" type="text" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="收件国家">
                  <el-input
                    v-model="orderInfo.ReceiverCountryCode"
                    type="text"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="收件洲">
                  <el-input v-model="orderInfo.ReceiverState" type="text" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="收件城市">
                  <el-input v-model="orderInfo.ReceiverCity" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="收件地址">
                  <el-input v-model="orderInfo.ReceiverStreet" type="text" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="收件电话">
                  <el-input v-model="orderInfo.ReceiverPhone" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="收件邮编">
                  <el-input v-model="orderInfo.ReceiverZipCode" type="text" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="门牌号">
                  <el-input v-model="orderInfo.House" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="收件邮箱">
                  <el-input v-model="orderInfo.ReceiverEmail" type="text" />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="收件人公司">
                  <el-input v-model="orderInfo.ReceiverCompany" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="报关方式">
                  <el-input v-model="orderInfo.DeclarationMethod" type="text" />
                </el-form-item>
              </el-col>
            </el-row>
          </el-tab-pane>
          <el-tab-pane label="物品属性修改" name="second">
            <el-table
              style="margin-top: 20px"
              border
              :data="goods"
              height="400px"
            >
              <el-table-column
                v-if="boxs.length > 0"
                prop="BoxNumber"
                label="箱号"
              />
              <el-table-column
                v-if="boxs.length <= 0"
                prop="GoodsNumber"
                label="产品编号"
              />
              <el-table-column prop="CnName" label="中文品名" />
              <el-table-column prop="EnName" label="英文品名" />
              <el-table-column prop="HsCode" label="海关编码" />
              <el-table-column prop="DeclareFee" label="申报价值" width="80" />
              <el-table-column
                prop="DeclareCurrency"
                label="申报币种"
                width="80"
              />
              <el-table-column prop="Quantity" label="申报数量" width="80" />
              <el-table-column
                v-if="boxs.length > 0"
                prop="Meterial"
                label="材质"
              />

              <el-table-column
                v-if="boxs.length > 0"
                prop="Usage"
                label="用途"
              />
              <el-table-column
                v-if="boxs.length > 0"
                prop="Magnetic"
                label="带磁"
              >
                <template slot-scope="r">
                  <div @click="changeValue(r.row, r.row.Magnetic, 'Magnetic')">
                    <el-tag v-if="r.row.Magnetic" type="danger">是</el-tag>
                    <el-tag v-else>否</el-tag>
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                v-if="boxs.length > 0"
                prop="Electric"
                label="带电"
              >
                <template slot-scope="r">
                  <div @click="changeValue(r.row, r.row.Electric, 'Electric')">
                    <el-tag v-if="r.row.Electric" type="danger">是</el-tag>
                    <el-tag v-else>否</el-tag>
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                v-if="boxs.length > 0"
                prop="Liquid"
                label="危险品"
              >
                <template slot-scope="r">
                  <div @click="changeValue(r.row, r.row.Liquid, 'Liquid')">
                    <el-tag v-if="r.row.Liquid" type="danger">是</el-tag>
                    <el-tag v-else>否</el-tag>
                  </div>
                </template>
              </el-table-column>
            </el-table>
          </el-tab-pane>
        </el-tabs>
      </el-form>
    </el-dialog>
    <el-dialog
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      title="欧盟海关编码替换"
      width="90%"
      top="20px"
      :visible.sync="dialogEUHSCodeReplace"
    >
      <el-form inline>
        <el-form-item>
          <el-button :loading="saveLoading" @click="SaveEUHSCodeUpdate"
            >保存修改</el-button
          >
        </el-form-item>
        <el-tabs v-model="EUHSCodeActiveName">
          <el-tab-pane
            v-for="(item, index) in EUHSCodeDto"
            :key="index"
            :label="item.CustomerOrderNumber"
            :name="item.CustomerOrderNumber"
          >
            <el-table
              style="margin-top: 20px"
              border
              :data="item.mappings"
              height="600px"
            >
              <el-table-column prop="CnName" label="中文品名" width="150px" />
              <el-table-column prop="EnName" label="英文品名" width="150px" />
              <el-table-column prop="HsCode" label="海关编码" width="150px" />
              <el-table-column prop="EUHSCode" label="欧盟海关编码">
                <template slot-scope="r">
                  <el-select
                    v-model="r.row.EUHSCode"
                    clearable
                    filterable
                    auto-complete="false"
                    style="width: 290px"
                  >
                    <el-option
                      v-for="(code, codeIndex) in r.row.EUHSCodes"
                      :key="codeIndex"
                      :label="code.HSCode + '  ' + code.CodeDescription"
                      :value="code.HSCode"
                    >
                      <span style="float: left"
                        >{{ code.HSCode }}
                        <span style="color: #8492a6; font-size: 10px">{{
                          code.CodeDescription
                        }}</span>
                      </span>
                    </el-option>
                  </el-select>
                </template>
              </el-table-column>
              <el-table-column prop="EUHSCode" label="是否更新" width="60px">
                <template slot-scope="r">
                  <el-checkbox v-model="r.row.IsUpdate" />
                </template>
              </el-table-column>
            </el-table>
          </el-tab-pane>
        </el-tabs>
      </el-form>
    </el-dialog>
    <el-dialog title="导入FBA费用" :visible.sync="dialogIncFBA">
      <el-form>
        <el-form-item label="费用类型">
          <el-select v-model="IncFBATarget" @change="IncFBATargetChange">
            <el-option value="0" label="客户杂费">客户杂费</el-option>
            <el-option value="1" label="成本费用">成本费用</el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="导入FBA费用">
          <el-upload
            :action="BaseOrderApi2"
            :headers="header"
            :multiple="false"
            :on-success="inputTHOrderSuccess"
            :loading="updateTHOrderLoading"
            :on-error="inputThOrderError"
            :before-upload="inputTHLoadd"
          >
            <el-button size="small" type="primary">点击上传</el-button>
          </el-upload>
        </el-form-item>
        <el-card class="batchInputInfo" style="margin-top: 20px">
          <div class="el-card__header">
            <span class="el-icon-warning-outline">注意事项</span>
          </div>
          <p>
            1、根据指定模板文件进行订单导入，<a
              href="http://wms.xingyunyi.cn/Data/Template/FBA附加费导入模板.xlsx"
            >
              下载模板</a
            >
          </p>
        </el-card>
      </el-form>
    </el-dialog>
    <el-dialog title="导入FBA下单重量" :visible.sync="dialogImportFbaBoxInfo">
      <el-form>
        <el-form-item label="导入FBA下单重量">
          <el-upload
            :action="ImportOrderBoxApi"
            :headers="header"
            :multiple="false"
            :on-success="inputTHOrderSuccess"
            :loading="updateTHOrderLoading"
            :on-error="inputThOrderError"
            :before-upload="ImportOrderBoxLoadd"
          >
            <el-button size="small" type="primary">点击上传</el-button>
          </el-upload>
        </el-form-item>
        <el-card class="batchInputInfo" style="margin-top: 20px">
          <div class="el-card__header">
            <span class="el-icon-warning-outline">注意事项</span>
          </div>
          <p>
            1、根据指定模板文件进行重量导入，<a
              href="http://wms.xingyunyi.cn/Data/Template/FBA修改下单数据模板.xlsx"
            >
              下载模板</a
            >
          </p>
        </el-card>
      </el-form>
    </el-dialog>
     <el-dialog title="导入FBA末端信息" :visible.sync="dialogImportFbaOrderInfo">
      <el-form>
        <el-form-item label="导入FBA末端信息">
          <el-upload
            :action="ImportFBAChannelOrderApi"
            :headers="header"
            :multiple="false"
            :on-success="inputTHOrderSuccess"
            :loading="updateTHOrderLoading"
            :on-error="inputThOrderError"
            :before-upload="ImportOrderBoxLoadd"
          >
            <el-button size="small" type="primary">点击上传</el-button>
          </el-upload>
        </el-form-item>
        <el-card class="batchInputInfo" style="margin-top: 20px">
          <div class="el-card__header">
            <span class="el-icon-warning-outline">注意事项</span>
          </div>
          <p>
            1、根据指定模板文件进行数据导入，<a
              href="http://wms.xingyunyi.cn/Data/Template/FBA末端信息导入模板.xlsx"
            >
              下载模板</a
            >
          </p>
        </el-card>
      </el-form>
    </el-dialog>
    <el-dialog
      title="修改FBA创建渠道"
      :visible.sync="dialogModifyCreateOrderChannelVisible"
    >
      <el-form>
        <el-form-item label="选择下单渠道">
           <el-select v-model="CreateOrderChannelId" filterable>
            <el-option
              v-for="item in FBACreateOrderChannels"
              :key="item.Id"
              :label="item.Name"
              :value="item.Id"
            />
          </el-select>
           </el-form-item>
        <el-form-item>
          <el-button
            :loading="saveLoading"
            @click="SaveModifyCreateOrderChannel"
            >保存修改</el-button
          >
        </el-form-item>
      </el-form>
    </el-dialog>
    <el-dialog title="更新单号与面单" width="760px" :close-on-click-modal="false" :visible.sync="showTrackingWaybill">
      <el-form :model="imageAndTrakcingDto" :rules="imageAndTrakcingRules" label-width="100px" ref="updateTrakcingRef">
        <el-form-item label="运单号" prop="TrackingNumber">
          <el-input v-model="imageAndTrakcingDto.TrackingNumber" placeholder="请输入运单号"></el-input>
        </el-form-item>
        <el-form-item label="PDF面单" prop="ServiceLabelUrl">
          <el-upload
            class="upload-demo"
            :action="`${apiAddress}/api/Finance/updateLoadFile`"
            :limit="2"
            :file-list="imageFileList"
            :on-success="successFileUrl"
            :on-change="changeFileUrl"
            :before-upload="beforeUploadFileUrl"
            accept="application/pdf"
          >
            <el-button class="define-upload-btn" size="small" type="primary">点击上传</el-button>
            <span slot="tip" class="define-upload__tip">只能上传PDF文件</span>
          </el-upload>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" :loading="imageAndTrakcingLoad" @click="hanleConfirmModifications">确定修改</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { getToken } from "@/utils/auth";
import NProgress from "nprogress";
import axios from "axios";
import "nprogress/nprogress.css";
import {
  _getFeeType,
  _saveFee,
  _getIncidentals,
  _setComfig,
  _getFees,
  _getFBAIncidentalDto,
} from "@/api/FBAIncidental";
import {
  _getCountries,
  _getAllPublic,
  _getDeliverChannel,
  _getCustomers,
  _getFBAChannel,
} from "@/api/baseInfo";
import {
  GetOrderPager,
  GetCounts,
  Get,
  GetCustomerDraftOrder,
  getMps,
  BoxStatusOp,
  OutData,
  CreateChannelOrder,
  CreateMegerOrder,
  _downloadSendReceipt,
  UpdateMpsOrder,
  InsPage,
  EUHSCodeUpdateSave,
  outMpsOrdermethod,
  ModifyCreateOrderChannelSave,
  UpdateImageAndTrakcing,
outOrderAndGoods
} from "@/api/order/orderManagement";
import { mapGetters } from "vuex";
import { _smallToLarge } from "@/api/fba/Receiving";

export default {
  name: "OrderManagementList",
  computed: {
    ...mapGetters(["roles"]),
  },
  // components: { "public-channel": PublicChannel },
  data() {
    return {
      IncFBATarget: "",
      dialogIncFBA: false,
      dialogImportFbaBoxInfo: false,
      dialogImportFbaOrderInfo:false,
      updateTHOrderLoading: false,
      header: { Authorization: "token " + getToken() },
      BaseOrderApi:
        process.env.VUE_APP_New_API +
        "/FBAIncidental/IncFBAIncidentals?IncFBATarget=",
      ImportOrderBoxApi:
        process.env.VUE_APP_9518_API +
        "/GetMoreThanOneTicketMps/ImportMpsBoxInfo",
        ImportFBAChannelOrderApi:
        process.env.VUE_APP_9518_API +
        "/GetMoreThanOneTicketMps/ImportFBAChannelOrder",
      BaseOrderApi2: "",
      dialogFeeList: false,
      dialogUpdateOrderInfo: false,
      dialogEUHSCodeReplace: false,
      showSeal: true,
      showFbaImportExcel: false,
      Customers: [],
      CustomerIds: [],
      feeList: {
        JSSum: [],
        KHSum: [],
        JSDetail: [],
        KHDetail: [],
        CBSum: [],
        CBDetail: [],
      },
      inputFBADto: {
        target: 0,
        orderId: 0,
        ChargedWeight: 0,
        CostPrice: 0,
        incidentals: [],
      },
      FBAFeeType: [],
      dialogSupplementModel: false,
      supplementModel: "收入补录",
      dialogVisible: false,
      dialogModifyCreateOrderChannelVisible: false,
      downLoadingLabel: false,
      downLoadingMps: false,
      orderLoading: false,
      saveLoading: false,
      channelId: 0,
      lastChannelList: [],
      createorderIds: [],
      commands: {
        outorderboxs: "outorderboxs",
        createchannelorder: "createchannelorder",
        outorderbox: "outorderbox",
        cancelOrder: "cancelOrder",
        cancelDraftOrder: "cancelDraftOrder",
        retryDraftOrder: "retryDraftOrder",
        downloadSendReceipt: "downloadSendReceipt",
        deleteOrder: "deleteOrder",
        recovery: "recovery",
        EUHSCodeUpdate: "EUHSCodeUpdate",
        outMpsOrder: "outMpsOrder",
        downloadPdf: "downloadPdf",
        downloadPdfEnd: "downloadPdfEnd",
        modifyCreateOrderChannel: "modifyCreateOrderChannel",
        smallToLarge: "smallToLarge",
        smallPackageOrderInfo: "smallPackageOrderInfo"
      },
      tabName: "",
      listTablName: "all",
      visible: false,
      IsMpsOrderId: null,
      numberType: ["服务商单号", "客户单号", "行运易单号"],
      selectType: "服务商单号",
      sdata: [],
      btypes: [
        { Id: 1, Name: "是" },
        { Id: 0, Name: "否" },
      ],
      channels: [],
      countryList: [],
      fristTrackingLogs: [],
      goods: [],
      activeName: "first",
      EUHSCodeActiveName: "",
      EUHSCodeDto: [],
      statusColor: "#43a047",
      dataLoading: false,
      searchLoading: false,
      serachCountryList: [],
      orderInfo: {},
      boxs: [],
      tablName: "",
      orderQtyDtos: {
        all: 0,
        createed: 0,
        receiver: 0,
        transfer: 0,
        cancel: 0,
        barck: 0,
      },
      selectIds: "",
      updateMpsOrderInfo: {
        mpsOrder: {},
        goods: [],
      },
      CreateOrderChannelId:0,
      FBACreateOrderChannels:[],
      pagerDto: {
        SearchNumber: "",
        _Eq_SearchNumberList: "",
        _Eq_ChannelId: "",
        _Eq_PostDSStatus: "",
        PageIndex: 1,
        PageSize: 20,
        total: 0,
        _Range_CreateTime: [],
        _Eq_ReceiverCountryCode: "",
        _Eq_OrderStatus: "",
        _IsNlNumLe_MpsOrderId: null,
        _IsNlNumGr_MpsOrderId: null,
      },
      showTrackingWaybill: false,
      imageAndTrakcingDto: {
        TrackingNumber: undefined,
        SystemNo: undefined,
        ServiceLabelUrl: undefined,
      },
      imageAndTrakcingRules: {
        TrackingNumber: [{ required: true, message: '请输入运单号', trigger: 'blur' }],
        ServiceLabelUrl: [{ required: true, message: '请上传面单', trigger: 'change' }],
      },
      imageAndTrakcingLoad: false,
      apiAddress: "http://wms.xingyunyi.cn",
      imageFileList: [],
      orderAndGoodsLoading: false
    };
  },
  created() {
    this.showSeal = !this.roles.includes("销售");
    this.showFbaImportExcel = this.roles.includes("FBA末端重量修改");

    var end = this.addDays(new Date(), 0);
    var start = this.addDays(end, -7);
    this.pagerDto._Range_CreateTime = [
      this.DateFormat(start, "yyyy-MM-dd"),
      this.DateFormat(end, "yyyy-MM-dd"),
    ];
    _getCountries().then((r) => {
      this.countryList = r;
      this.serachCountryList = Object.assign(r);
    });
    _getAllPublic().then((r) => {
      this.channels = r;
    });
    _getDeliverChannel().then((r) => {
      this.lastChannelList = r.filter((x) => {
        return x.CanMPS;
      });
    });
    _getCustomers().then((response) => {
      this.Customers = response;
    });
    _getFBAChannel().then((res)=>{
      this.FBACreateOrderChannels=res;
    })
  },
  methods: {
    // 导入FBA费用 start
    IncFBATargetChange() {
      this.BaseOrderApi2 = this.BaseOrderApi + this.IncFBATarget;
    },
    inputTHOrderSuccess(response, file, fileList) {
      this.$message("上传成功");
      this.updateTHOrderLoading = false;
    },
    inputThOrderError(response) {
      var msg = JSON.parse(response.message);
      this.$confirm(msg.message, "错误提示");
      // this.$message(msg.message);
      this.updateTHOrderLoading = false;
    },
    inputTHLoadd() {
      if (!this.IncFBATarget) {
        this.$message("请选择费用类型！");
        return false;
      }
      if (this.updateTHOrderLoading) {
        this.$message("上传中，请勿重复上传");
        return false;
      } else {
        this.updateTHOrderLoading = true;
      }
    },
    ImportOrderBoxLoadd() {
      if (this.updateTHOrderLoading) {
        this.$message("上传中，请勿重复上传");
        return false;
      } else {
        this.updateTHOrderLoading = true;
      }
    },
    // 导入FBA费用 end
    // mpsOrder修改 start
    changeValue(row, value, filed) {
      if (value) {
        value = false;
      } else {
        value = true;
      }
      if (filed == "Magnetic") {
        row.Magnetic = value;
      } else if (filed == "Electric") {
        row.Electric = value;
      } else if (filed == "Liquid") {
        row.Liquid = value;
      }
    },
    SaveMpsOrderInfo() {
      this.updateMpsOrderInfo.mpsOrder = this.orderInfo;
      this.updateMpsOrderInfo.goods = this.goods;
      this.saveLoading = true;
      UpdateMpsOrder(this.updateMpsOrderInfo)
        .then((res) => {
          this.$alert("修改成功");
          this.dialogUpdateOrderInfo = false;
        })
        .finally(() => {
          this.saveLoading = false;
        });
    },
    // mpsOrder修改 end
    // 列表操作按钮
    showInputIncidentals(target, orderId) {
      this.inputFBADto.target = target;
      _getFeeType(this.inputFBADto.target).then((r) => {
        this.FBAFeeType = r;
      });
      this.inputFBADto.orderId = orderId;
      _getFBAIncidentalDto(this.inputFBADto).then((r) => {
        this.inputFBADto.target = r.Target;
        this.inputFBADto.orderId = r.OrderId;
        this.inputFBADto.ChargedWeight = r.ChargedWeight;
        this.inputFBADto.CostPrice = r.CostPrice;
        this.inputFBADto.incidentals = r.Incidentals;
      });
      this.supplementModel = target == 0 ? "客户FBA杂费" : "成本费用";
      this.dialogSupplementModel = true;
    },
    fbaHandleCommand(command) {
      debugger;
      if (command.action == "showInputIncidentals") {
        this.showInputIncidentals(command.target, command.orderId);
      } else if (command.action == "setComfig") {
        this.setComfig(command.target, command.orderId);
      } else if (command.action == "showFee") {
        this.showFee(command.orderId);
      }
    },
    showFee(orderId) {
      _getFees(orderId).then((r) => {
        this.feeList = r;
      });
      this.dialogFeeList = true;
    },
    setComfig(target, orderid) {
      var that = this;
      this.$confirm("是否该确认操作，确认后无法退回", "确认操作").then((r) => {
        _setComfig({ target: target, orderId: orderid }).then((r) => {
          that.$alert("操作成功");
          this.pagerSerach();
        });
      });
    },
    saveFee() {
      _saveFee(this.inputFBADto).then((r) => {
        this.$alert("提交成功");
        this.dialogSupplementModel = false;
        this.pagerSerach();
      });
    },
    outTableData() {
      this.setCustomer();
      OutData(this.pagerDto);
    },
    pushIncidentals() {
      this.inputFBADto.incidentals.push({
        CalculateType: 0,
        Fee: 0,
        Name: "",
      });
    },
    deleteIncidentals(index) {
      this.inputFBADto.incidentals.splice(index, 1);
    },
    downloadPdf() {
      if (this.selectIds != "") {
        this.downLoadingLabel = true;
        const that = this;
        const data = { orderIds: this.selectIds };
        axios({
          method: "post",
          url: process.env.VUE_APP_BASE_API + "/order/PostDownLabels",
          data: data,
          responseType: "blob",
          headers: { "Content-Type": "application/json" },
        })
          .then((res) => {
            that.downLoadingLabel = false;
            const _res = res.data;
            const blob = new Blob([res.data], { type: res.data.type });

            var url = window.URL.createObjectURL(blob);
            var a = document.createElement("a");
            a.href = url;
            a.download = `labels.pdf`;
            a.click();
          })
          .catch((err) => {
            this.$message({ type: "error", message: "下载面单出错" });
          })
          .finally(() => {
            this.downLoadingLabel = false;
          });
      } else {
        this.$alert("必须勾选需打印的单号");
      }
    },
    downloadPdfEnd() {
      if (this.selectIds != "") {
        this.downLoadingLabel = true;
        const that = this;
        const data = { orderIds: this.selectIds };
        axios({
          method: "post",
          url: process.env.VUE_APP_BASE_API + "/order/PostDownChannelLabels",
          data: data,
          responseType: "blob",
          headers: { "Content-Type": "application/json" },
        })
          .then((res) => {
            that.downLoadingLabel = false;
            const _res = res.data;
            const blob = new Blob([res.data], { type: res.data.type });

            var url = window.URL.createObjectURL(blob);
            var a = document.createElement("a");
            a.href = url;
            a.download = `labels.pdf`;
            a.click();
          })
          .catch((err) => {
            this.$message({ type: "error", message: "下载面单出错" });
          })
          .finally(() => {
            this.downLoadingLabel = false;
          });
      } else {
        this.$alert("必须勾选需打印的单号");
      }
    },
    showCreateOrder() {
      this.channelId = 0;
      this.meger = false;
      this.dialogVisible = true;
    },
    outMpsOrdermethod() {
      this.downLoadingMps = true;
      const data = { orderIds: this.createorderIds };
      outMpsOrdermethod(data).finally(() => {
        this.downLoadingMps = false;
      });
    },
    outOrderAndGoodsMethod(Ids) {
      this.orderAndGoodsLoading = true;
      outOrderAndGoods({ orderIdList: Ids }).then(() => {
        this.orderAndGoodsLoading = false
      })
    },
    // 欧盟海关编码修改  start
    showEUHSCodeUpdate() {
      const ids = this.createorderIds.split(",");
      InsPage(ids).then((res) => {
        this.EUHSCodeDto = res;
        this.EUHSCodeActiveName = this.EUHSCodeDto[0].CustomerOrderNumber;
        this.dialogEUHSCodeReplace = true;
      });
    },
    SaveEUHSCodeUpdate() {
      this.saveLoading = true;
      EUHSCodeUpdateSave(this.EUHSCodeDto)
        .then((res) => {
          this.$alert("修改成功");
          this.dialogEUHSCodeReplace = false;
        })
        .finally(() => {
          this.saveLoading = false;
        });
    },
    // 欧盟海关编码 end
    //fba修改创建渠道 start
    SaveModifyCreateOrderChannel() {
      if (this.CreateOrderChannelId > 0) {
        this.saveLoading = true;
        var data = {
          OrderId: this.createorderIds,
          CreateOrderChannelId: this.CreateOrderChannelId,
        };
        ModifyCreateOrderChannelSave(data)
          .then((res) => {
            this.$alert("修改成功");
            this.dialogModifyCreateOrderChannelVisible = false;
            this.pagerSerach();
          })
          .finally(() => {
            this.saveLoading = false;
          });
      } else {
        this.$message({ type: "warning", message: "请选择创建渠道" });
      }
    },
    //fba修改创建渠道 end
    // 复制功能提示 start
    onCopy() {
      this.$message({ type: "success", message: "复制成功" });
    },
    onErrorEvent() {
      this.$message({ type: "warning", message: "复制失败" });
    },
    // 复制功能提示 end
    createOrder() {
      if (this.channelId == 0) {
        this.$alert("需要选择下单渠道");
        return;
      }
      if (this.orderLoading) {
        return false;
      }
      this.orderLoading = true;
      const idArry = this.createorderIds.split(",");
      var requestUrl = [];
      if (idArry.length > 20) {
        this.orderLoading = false;
        this.$alert("一票多件下单一次不能超过20单！", "错误", {
          type: "warning",
        });
        return;
      }
      if (!this.meger) {
        idArry.forEach((element) => {
          requestUrl.push(CreateChannelOrder(element, this.channelId));
        });
        axios
          .all(requestUrl)
          .then((res) => {
            console.log(res);
            this.$message({ type: "success", message: "末端渠道下单成功" });
            this.pagerSerach();
          })
          .finally(() => {
            this.orderLoading = false;
          });
      } else {
        this.$confirm("是否确定合并下单？").then(() => {
          CreateMegerOrder(idArry, this.channelId)
            .then((r) => {
              this.$message({ type: "success", message: "末端渠道下单成功" });
              this.pagerSerach();
            })
            .finally(() => {
              this.orderLoading = false;
            });
        });
      }
    },
    batchHandleCommand(command) {
      if (command == "IncFBAIncidentals") {
        this.dialogIncFBA = true;
        return;
      }
      if (command == "ImportFbaBoxInfo") {
        this.dialogImportFbaBoxInfo = true;
        return;
      }
      if(command=="ImportFbaOrderInfo"){
         this.dialogImportFbaOrderInfo = true;
        return;
      }
    },
    handleCommand(command) {
      var ids = this.selectIds;
      if (ids == "") {
        this.$alert("请勾选需要操作的明细", "错误", { type: "warning" });
        return;
      }
      var that = this;
      var action = "";
      if (command == this.commands.downloadSendReceipt) {
        _downloadSendReceipt({ ids: ids });
        return;
      }
      if (command == this.commands.outorderboxs) {
        const that = this;
        const data = { orderIds: this.selectIds };
        axios({
          method: "post",
          url: "http://120.24.149.148:9518/api/GetMoreThanOneTicketMps/OutBoxData",
          data: data,
          responseType: "blob",
          headers: {
            "Content-Type": "application/json",
            Authorization: "token 132A7468DE079C6CEB59F383A661E612",
          },
        })
          .then((res) => {
            that.downLoadingLabel = false;
            const _res = res.data;
            const blob = new Blob([res.data], { type: res.data.type });

            var url = window.URL.createObjectURL(blob);
            var a = document.createElement("a");
            a.href = url;
            a.download = `boxNumbers.xlsx`;
            a.click();
          })
          .catch((err) => {
            this.$message({ type: "error", message: "下载excel出错" + err });
          })
          .finally(() => {
            this.downLoadingLabel = false;
          });

        return;
      }
      if (command == "createchannelorder") {
        this.createorderIds = ids;
        this.showCreateOrder();
        return;
      }
      if (command == this.commands.EUHSCodeUpdate) {
        this.createorderIds = ids;
        this.showEUHSCodeUpdate();
        return;
      }
      if (command == this.commands.outMpsOrder) {
        this.createorderIds = ids;
        this.outMpsOrdermethod();
        return;
      }
      if (command == this.commands.downloadPdf) {
        this.createorderIds = ids;
        this.downloadPdf();
        return;
      }
      if (command == this.commands.downloadPdfEnd) {
        this.createorderIds = ids;
        this.downloadPdfEnd();
        return;
      }
      if (command == this.commands.modifyCreateOrderChannel) {
        var items = ids.split(",");
        if (items.length > 1) {
          this.$alert("此操作不可批量处理！请逐单操作", "错误", {
            type: "warning",
          });
          return;
        }
        this.createorderIds = ids;
        this.dialogModifyCreateOrderChannelVisible = true;
        return;
      }

      // 小包订单转换FBA发货
      if (command == this.commands.smallToLarge) {
        const Ids = ids.split(",");
        if (Ids.length === 0) {
          this.$alert("请勾选订单", "错误", {
            type: "warning",
          });
          return;
        }
        _smallToLarge(Ids).then(re => {
          this.$message({ type: 'success', message: '转换成功！' })
        })
        return;
      }

      // 导出小包订单下单信息（含物品）
      if (command == this.commands.smallPackageOrderInfo) {
        const Ids = ids.split(",");
        if (Ids.length === 0) {
          this.$alert("请勾选订单", "错误", {
            type: "warning",
          });
          return;
        }
        this.outOrderAndGoodsMethod(Ids)
        return;
      }

      if (command == this.commands.cancelOrder) {
        action = "Cancel";
      } else if (command == this.commands.cancelDraftOrder) {
        action = "DeleteDraftOrder";
      } else if (command == this.commands.retryDraftOrder) {
        action = "RetryDraftOrder";
      } else if (command == this.commands.deleteOrder) {
        action = "DeleteOrder";
      } else if (command == this.commands.recovery) {
        action = "Recovery";
      }
      this.$confirm("是否确定该操作", "确定", { type: "warning" }).then((r) => {
        axios({
          method: "post",
          url: "http://wms.xingyunyi.cn/api/Order/" + action,
          data: JSON.stringify({ ids: ids }),
          headers: { "Content-Type": "application/json" },
        })
          .then((r) => {
            that.$alert("操作成功", "成功", { type: "scuesss" });
            that.pagerSerach();
          })
          .catch((error) => {
            var msg =
              error.response.data.message ||
              error.response.data.errors ||
              error.response.data;
            that.$alert(msg, "失败", { type: "warning" });
          });
      });
    },
    // 详情页面
    showOrderInfo(rowId, tabName, showBoxs, row) {
      var that = this;
      this.boxs = [];
      var isDraftOrder = this.pagerDto._Eq_OrderStatus == "10000";
      var meth = Get;
      if (this.pagerDto._Eq_OrderStatus == "10000") {
        meth = GetCustomerDraftOrder;
      }
      meth(rowId).then((r) => {
        that.orderInfo = r;
        if (r.Goods && r.Goods.length > 0) {
          this.goods = r.Goods;
        }
        this.tabName = tabName;
        this.visible = true;
        this.fristTrackingLogs = r.FristTrackingLogs;
        for (var i = 0; i < this.fristTrackingLogs.length; i++) {
          this.fristTrackingLogs[i].color = "#e4e7ed";
          this.fristTrackingLogs[i].icon = "";
        }
        var lst = this.fristTrackingLogs[this.fristTrackingLogs.length - 1];
        // lst.color = '#643be2'
        // lst.icon = 'el-icon-position'

        if (showBoxs) {
          var orderId = rowId;
          var draftOrderId = 0;
          if (isDraftOrder) {
            orderId = 0;
            draftOrderId = rowId;
          }
          getMps(orderId, draftOrderId).then((r) => {
            that.orderInfo.DeclarationMethod = r.DeclarationMethod;
            this.goods = [];
            for (var i = 0; i < r.Boxs.length; i++) {
              r.Boxs[i].Goods.forEach((y) => {
                y.DeclareFee = y.GoodsValue;
                y.DeclareCurrency = y.Currency;
                this.goods.push(y);
              });
            }
            this.boxs = r.Boxs;
          });
        }
      });
    },
    BoxStatusOp(row, BoxStatus) {
      BoxStatusOp(row.Id, BoxStatus).then(() => {
        switch (BoxStatus) {
          case "BeforeReceiptToSend":
            row.BoxStatus = 15;
            // this.boxs.find(x=>x.Id==row.Id).BoxStatus=15
            break;
          case "Back":
            row.BoxStatus = 30;
            // this.boxs.find(x=>x.Id==row.Id).BoxStatus=30
            break;
        }
      });
    },
    // 时间处理函数
    addDays(d, days) {
      var adjustDate = new Date(d.getTime() + 24 * 60 * 60 * 1000 * days);
      return adjustDate;
    },
    DateFormat(d, format) {
      var date = {
        "M+": d.getMonth() + 1,
        "d+": d.getDate(),
        "h+": d.getHours(),
        "m+": d.getMinutes(),
        "s+": d.getSeconds(),
        "q+": Math.floor((d.getMonth() + 3) / 3),
        "S+": d.getMilliseconds(),
      };
      if (/(y+)/i.test(format)) {
        format = format.replace(
          RegExp.$1,
          (d.getFullYear() + "").substr(4 - RegExp.$1.length)
        );
      }
      for (var k in date) {
        if (new RegExp("(" + k + ")").test(format)) {
          format = format.replace(
            RegExp.$1,
            RegExp.$1.length == 1
              ? date[k]
              : ("00" + date[k]).substr(("" + date[k]).length)
          );
        }
      }
      return format;
    },
    // 页面动效
    IsDS() {
      var roles = this.$store.getters["roles"];
      for (var i = 0; i < roles.length; i++) {
        if (roles[i] == "一键代发") {
          return true;
        }
      }
      return false;
    },
    onSelection(s) {
      var ids = [];
      for (let i = 0; i < s.length; i++) {
        ids.push(s[i].Id);
      }
      this.selectIds = ids.join(",");
    },
    handleClick(t, event) {
      if (t.index == 0) {
        this.pagerDto._Eq_OrderStatus = "";
      } else if (t.index == 1) {
        this.pagerDto._Eq_OrderStatus = "1";
      } else if (t.index == 2) {
        this.pagerDto._Eq_OrderStatus = "2";
      } else if (t.index == 3) {
        this.pagerDto._Eq_OrderStatus = "3";
      } else if (t.index == 4) {
        this.pagerDto._Eq_OrderStatus = "4";
      } else if (t.index == 5) {
        this.pagerDto._Eq_OrderStatus = "0";
      } else if (t.index == 6) {
        this.pagerDto._Eq_OrderStatus = "10000";
      }
      this.pagerSerach();
    },
    // 销售权限设置
    setCustomer() {
      if (this.CustomerIds.length > 0) {
        this.pagerDto._In_CustomerId = this.CustomerIds.join(",");
      } else if (this.showSeal == false) {
        var Ids = [];
        this.Customers.forEach((x) => {
          Ids.push(x.Id);
        });
        this.pagerDto._In_CustomerId = Ids.join(",");
      }
    },
    // 列表查询
    changePager(v) {
      this.pagerDto.PageSize = v;
      this.pagerSerach();
    },
    pagerSerach(index) {
      this.pagerDto._Eq_SearchNumberList = [];
      if (index) {
        this.pagerDto.PageIndex = index;
      } else {
        this.pagerDto.PageIndex = 1;
      }
      if (this.pagerDto.SearchNumber != "") {
        this.pagerDto._Eq_SearchNumberList = this.pagerDto.SearchNumber.replace(
          /\r/g,
          ","
        )
          .replace(/\n/g, ",")
          .replace(/\r\n/g, ",");
      }
      if (this.IsMpsOrderId != 0 && this.IsMpsOrderId != 1) {
        this.pagerDto._IsNlNumLe_MpsOrderId = null;
        this.pagerDto._IsNlNumGr_MpsOrderId = null;
      } else {
        if (this.IsMpsOrderId == 0) {
          this.pagerDto._IsNlNumLe_MpsOrderId = 0;
          this.pagerDto._IsNlNumGr_MpsOrderId = null;
        } else if (this.IsMpsOrderId == 1) {
          this.pagerDto._IsNlNumGr_MpsOrderId = 1;
          this.pagerDto._IsNlNumLe_MpsOrderId = null;
        }
      }
      this.setCustomer();
      // this.dataLoading = true
      this.searchLoading = true
      NProgress.start();
      GetOrderPager(this.pagerDto)
        .then((res) => {
          this.sdata = res.Result;
          this.pagerDto.total = res.TotalCount;
        })
        .finally((res) => {
          NProgress.done();
          // that.dataLoading = false
          this.searchLoading = false
        });
      GetCounts(this.pagerDto).then((res) => {
        this.orderQtyDtos.all = 0;
        this.orderQtyDtos.cancel = 0;
        this.orderQtyDtos.createed = 0;
        this.orderQtyDtos.receiver = 0;
        this.orderQtyDtos.transfer = 0;
        this.orderQtyDtos.barck = 0;
        for (var i = 0; i < res.length; i++) {
          var status = res[i].OrderStatus;
          this.orderQtyDtos.all += res[i].Qty;
          if (status <= 0) {
            this.orderQtyDtos.cancel += res[i].Qty;
          } else if (status == 1) {
            this.orderQtyDtos.createed = res[i].Qty;
          } else if (status == 2) {
            this.orderQtyDtos.receiver = res[i].Qty;
          } else if (status == 3) {
            this.orderQtyDtos.transfer = res[i].Qty;
          } else if (status == 4) {
            this.orderQtyDtos.barck = res[i].Qty;
          } else if (status == 10000) {
            this.orderQtyDtos.draft = res[i].Qty;
          }
        }
      });
    },
    updateTrackingWaybill(row) {
      this.imageAndTrakcingDto.SystemNo = row.SystemNo
      this.showTrackingWaybill = true
    },
    beforeUploadFileUrl(file) {
      const isPDF = file.type === 'application/pdf';
      if (!isPDF) {
        this.imageFileList = []
        this.$message.error('只能上传PDF文件!');
      }
      return isPDF;
    },
    successFileUrl(r) {
      const fileUrl = r.Data.url
      this.imageAndTrakcingDto.ServiceLabelUrl = fileUrl
    },
    changeFileUrl(file, fileList) {
      if (fileList.length > 1) this.imageFileList = fileList.slice(1);
    },
    hanleConfirmModifications() {
      this.$refs.updateTrakcingRef.validate((valid) => {
        if (valid) {
          this.imageAndTrakcingLoad = true
          UpdateImageAndTrakcing(this.imageAndTrakcingDto).then(res => {
            this.$message({ type: "success", message: "更新成功" });
          }).finally(() => {
            this.imageAndTrakcingLoad = false
          })
        } else {
          return false;
        }
      });
    }
  },
};
</script>
<style>
#app .full .v-modal {
  top: 130px;
}
.el-card {
  border-radius: 4px;
  border: 1px solid #e6ebf5;
  background-color: #fff;
  overflow: hidden;
  color: #303133;
  -webkit-transition: 0.3s;
  transition: 0.3s;
}
#app .full .orderInfo {
  top: 130px;
}
.demo-drawer__content {
  margin-left: 20px;
  margin-right: 20px;
  margin-top: 10px;
  max-height: calc(100vh - 170px);
  overflow: auto;
}
.tab-text2 {
  font-size: 16px;
}

.profile-user-info-striped {
  border: 1px solid #d1e9ff;
}
.profile-info-row {
  line-height: 2.8em;
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
}
.profile-info-name {
  width: 30%;
  min-width: 120px;
  background: #e8f4ff;
  color: #1890ff;
  padding-left: 20px;
  border-bottom: 1px solid #d1e9ff;
}
.profile-info-value {
  width: 70%;
  min-width: 250px;
  border-bottom: 1px solid #f2f0f7;
  border-right: 1px solid #f2f0f7;
  padding-left: 20px;
}
.profile-info-row-c {
  min-width: 370px;
  display: flex;
  width: 50%;
}
.tracking-box {
  width: 100%;
  display: flex;
  height: 100px;
  padding: 20px 0;
  border-bottom: 1px dotted #cccc;
  justify-content: space-around;
}
.tracking-icon {
  width: 50px;
  height: 50px;
  margin-top: 2px;
  margin-left: 2px;
  border-radius: 5px;
  text-align: center;
  vertical-align: middle;
  line-height: 50px;
  margin-right: 10px;
}
.tracking-icon span {
  font-size: 30px;
  color: #fff;
}
.tracking-number,
.tracking-country,
.trakcing-service,
.tracking-status,
.lastGetTime,
.lastTrackingTime {
  line-height: 30px;
  font-size: 14px;
  color: #303133;
}
.tracking-status,
.trakcing-service,
.lastGetTime {
  font-size: 16px;
  line-height: 30px;
  color: #643be2;
}
.tracking-status {
  text-align: right;
}
.trakcing-service {
  text-align: center;
}
.trakcing-service button {
  font-size: 16px;
  margin: 0;
  padding: 0;
}
.tracking-country {
  display: flex;
}
.dian {
  width: 150px;
  border-top: 1px dotted #cccc;
}

.errorMessage {
  background: #ffe6e6;
  color: red;
  line-height: 36px;
  padding: 10px;
  font-size: 14px;
  margin-bottom: 20px;
  border-radius: 5px;
}
.batchInputInfo a {
  color: #643be2;
}
.batchInputInfo p {
  font-size: 14px;
}
.orderManagement .el-form-item__label {
  padding-bottom: 0;
}
.define-upload__tip {
  padding-left: 10px;
}
.define-upload-btn {
  width: 138px;
  font-size: 14px;
}
.update-tracking-bill {
  margin-top: 5px;
}
</style>

