query.vue 26 KB
Newer Older
1
<template>
huhaiqing's avatar
huhaiqing committed
2
  <div class="app-container shipping-detail">
3
    <el-row type="flex" style="margin-top: 15px; margin-bottom: 15px" justify="center">
huhaiqing's avatar
huhaiqing committed
4
      <el-col :xs="24" :sm="24" :md="24" :lg="20" :xl="22">
5
        <div style="display: flex; justify-content: space-between;align-items: flex-end;">
6
          <h2>{{$t('出货详情')}}</h2>
7
          <div>
huhaiqing's avatar
huhaiqing committed
8
            <!-- <el-button size="small" @click="handleCommand('edit')">{{$t('编辑')}}</el-button> -->
9 10 11
            <el-button size="small" v-hasPermi="['shipment:box:action:sea']" @click="handleCommand('router')">{{$t('操作')}}</el-button>
            <el-button type="primary" v-hasPermi="['shipment:box:action:error']" size="small" @click="handleCommand('error')">{{$t('异常登记')}}</el-button>
            <el-button type="primary" v-hasPermi="['shipment:box:action:cost']" size="small" @click="handleCommand('cost')">{{$t('费用登记')}}</el-button>
huhaiqing's avatar
huhaiqing committed
12
            <!-- <el-button type="danger" size="small" @click="handleCommand('delete')">{{$t('删除')}}</el-button> -->
13 14 15 16
          </div>
        </div>
        <el-card style="margin-top: 15px">
          <el-descriptions :column="4" border>
17
            <el-descriptions-item :label="$t('自编号')">
huhaiqing's avatar
huhaiqing committed
18 19
              {{shipmentObj.selfNo}}
            </el-descriptions-item>
20
            <el-descriptions-item :label="$t('运输方式')">
huhaiqing's avatar
huhaiqing committed
21 22
              <dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="shipmentObj.transportType" />
            </el-descriptions-item>
23
            <!-- <el-descriptions-item :label="$t('出货渠道')">
huhaiqing's avatar
huhaiqing committed
24
              {{getShipChannelName(shipmentObj.shippingChannelId)}}
huhaiqing's avatar
huhaiqing committed
25
            </el-descriptions-item> -->
26
            <el-descriptions-item :label="$t('柜型')">
huhaiqing's avatar
huhaiqing committed
27 28
              {{getCabinetLabel(shipmentObj.cabinetId)}}
            </el-descriptions-item>
29
            <el-descriptions-item :label="$t('状态')">
huhaiqing's avatar
huhaiqing committed
30
              {{shipmentObj.shipmentStatusText}}
huhaiqing's avatar
huhaiqing committed
31
            </el-descriptions-item>
32
            <el-descriptions-item :label="$t('总计')">
huhaiqing's avatar
huhaiqing committed
33 34
              {{getBoxSum(shipmentObj.boxStatistics)}}
            </el-descriptions-item>
35
            <el-descriptions-item :label="$t('始发地')">
huhaiqing's avatar
huhaiqing committed
36 37
              {{getCityName(shipmentObj.startWarehouseId)}}
            </el-descriptions-item>
38
            <el-descriptions-item :label="$t('目的地')">
huhaiqing's avatar
huhaiqing committed
39 40 41 42 43
              {{getCityName(shipmentObj.destWarehouseId)}}
            </el-descriptions-item>
            <el-descriptions-item label="SO NO">
              {{shipmentObj.bookSeaInfo ? shipmentObj.bookSeaInfo.sono : '' }}
            </el-descriptions-item>
44 45 46
          </el-descriptions>
        </el-card>

huhaiqing's avatar
huhaiqing committed
47
        <el-tabs style="margin-top: 15px" type="border-card" value="detail">
48
          <el-tab-pane :label="$t('明细')" name="detail">
49
            <div class="detail-pane">
50 51 52
              <div>{{$t('当前部分')}}</div>
              <el-select :placeholder="$t('请选择')" v-model="sectionId" @change="sectionChange">
                <el-option key="0" :label="$t('全部')" value="0"></el-option>
huhaiqing's avatar
huhaiqing committed
53
                <el-option v-for="item in sectionList" :key="item.id" :label="item.title" :value="item.id"></el-option>
54
              </el-select>
huhaiqing's avatar
huhaiqing committed
55 56 57
              <p class="box-weight">
                {{getSectionInfo}}
              </p>
huhaiqing's avatar
huhaiqing committed
58
              <div style="margin-left:30px;">
zhoutong's avatar
zhoutong committed
59 60
                <el-button type="primary" v-hasPermi="['shipment:box:order:select']" size="small" @click="()=>updateStatus('selected')">{{$t('更新所选订单状态')}}</el-button>
                <el-button type="primary" v-hasPermi="['shipment:box:order:all']" size="small" @click="()=>updateStatus('all')">{{$t('更新全部订单状态')}}</el-button>
huhaiqing's avatar
huhaiqing committed
61
              </div>
huhaiqing's avatar
huhaiqing committed
62
              <div class="document-status">
63
                <p>{{$t('单证状态')}}</p>
huhaiqing's avatar
huhaiqing committed
64 65 66 67
                <template v-for="(item, index) in getDocStatus(sectionObj.sectionOrderList)">
                  <dict-tag :type="DICT_TYPE.ECW_CUSTOMS_TYPE" :value="item" :key="index" />
                </template>
              </div>
68
            </div>
huhaiqing's avatar
huhaiqing committed
69 70
            <el-table :data="sectionObj.sectionOrderList" style="width: 100%" border @selection-change="handleSelectionChange">
              <el-table-column type="selection" width="50" :selectable="selectable"></el-table-column>>
huhaiqing's avatar
huhaiqing committed
71
              <el-table-column align="center" :label="$t('序号')" width="50" prop="tidanNum" />
72
              <el-table-column prop="orderNo" :label="$t('订单号')" align="center">
huhaiqing's avatar
huhaiqing committed
73 74 75 76
                <template v-slot="scope">
                  <a href="javascript:void(0)" @click="jumpOrderDetail(scope.row)">{{ scope.row.orderNo }}</a>
                </template>
              </el-table-column>
huhaiqing's avatar
huhaiqing committed
77
              <el-table-column prop="goodsList" :label="$t('货物信息')" width="230px" align="center">
huhaiqing's avatar
huhaiqing committed
78 79 80 81 82 83 84 85
                <template v-slot="{row}">
                  <section>
                    <div v-for="(item, index) in row.goodsList" :key="index">
                      {{index+1}}{{item.prodTitleZh}}
                    </div>
                  </section>
                </template>
              </el-table-column>
86 87 88 89 90 91 92 93
              <el-table-column prop="num" :label="$t('计划箱数')" align="center"></el-table-column>
              <el-table-column prop="installNum" :label="$t('实装箱数')" align="center"></el-table-column>
              <el-table-column prop="unloadNum" :label="$t('卸柜箱数')" align="center"></el-table-column>
              <el-table-column prop="destWarehouseName" :label="$t('提货点')" align="center"></el-table-column>
              <el-table-column prop="volume" :label="$t('体积')" align="center"></el-table-column>
              <el-table-column prop="weight" :label="$t('重量')" align="center"></el-table-column>
              <el-table-column prop="totalWorth" :label="$t('货值')" align="center"></el-table-column>
              <el-table-column prop="customsType" :label="$t('报关方式')" align="center">
huhaiqing's avatar
huhaiqing committed
94 95 96 97 98 99
                <template slot-scope="scope">
                  <div :class="scope.row.customsType !== 1 ? 'customsType-red' : ''">
                    <dict-tag :type="DICT_TYPE.ECW_CUSTOMS_TYPE" :value="scope.row.customsType" />
                  </div>
                </template>
              </el-table-column>
100
              <el-table-column prop="customsFee" :label="$t('报关费用')" align="center"></el-table-column>
huhaiqing's avatar
huhaiqing committed
101
              <el-table-column prop="" :label="$t('操作')" align="center" width="120px">
huhaiqing's avatar
huhaiqing committed
102 103 104 105
                <template slot-scope="scope">
                  <el-button type="primary" size="small" :disabled="scope.row.abnormalDealStatus === 1" @click="()=>updateStatus('single', scope.row)">{{$t('更新状态')}}</el-button>
                </template>
              </el-table-column>
106 107
            </el-table>
          </el-tab-pane>
108
          <el-tab-pane :label="$t('状态')" name="status">
huhaiqing's avatar
huhaiqing committed
109 110 111 112
            <div v-for="(item, index) in logList" :key="item.id" :class="`shipping-status ${index === 0 ? 'curr-status' : '' }`">
              <div class="status-line"></div>
              <div class="status-number">{{logList.length - index}}</div>
              <div class="status-info">
huhaiqing's avatar
huhaiqing committed
113
                <div>{{$l(item, 'title')}}</div>
huhaiqing's avatar
huhaiqing committed
114 115 116 117 118 119 120
                <div>
                  <p>{{formatDate(item.createTime)}}</p>
                  <p>{{item.operator}}</p>
                </div>
              </div>
            </div>
          </el-tab-pane>
121
          <el-tab-pane :label="$t('费用')" name="fee">
huhaiqing's avatar
huhaiqing committed
122
            <el-table :data="costList" style="width: 100%" border>
123 124
              <el-table-column type="index" align="center" :label="$t('序号')" width="50" />
              <el-table-column prop="costType" :label="$t('费用类型')" align="center">
huhaiqing's avatar
huhaiqing committed
125 126 127 128
                <template slot-scope="scope">
                  <dict-tag :type="DICT_TYPE.FEE_TYPE" :value="scope.row.costType" />
                </template>
              </el-table-column>
129
              <el-table-column prop="supplierId" :label="$t('供应商')" align="center">
huhaiqing's avatar
huhaiqing committed
130 131 132 133
                <template slot-scope="scope">
                  {{getSupplier(scope.row.supplierId)}}
                </template>
              </el-table-column>
134
              <el-table-column prop="price" :label="$t('金额')" align="center"></el-table-column>
huhaiqing's avatar
huhaiqing committed
135 136 137 138 139 140 141
              <el-table-column prop="payPrice" :label="$t('实付金额')" align="center"></el-table-column>
              <el-table-column prop="payTime" :label="$t('实付日期')" align="center">
                <template slot-scope="scope">
                  <span v-if="scope.row.payTime">{{formatDate(scope.row.payTime)}}</span>
                </template>
              </el-table-column>
              <el-table-column :label="$t('操作')" align="center">
huhaiqing's avatar
huhaiqing committed
142
                <template slot-scope="scope">
zhoutong's avatar
zhoutong committed
143
                  <el-button type="primary" size="small" @click="editCostClick(scope.row)" style="marginRight:10px;" v-hasPermi="['ecw:box-cost:update']">{{$t('编辑')}}</el-button>
144
                  <el-popconfirm :title="$t('确定是否删除')" @confirm="deleteCostClick(scope.row)">
145
                    <el-button type="danger" size="small" slot="reference" v-hasPermi="['ecw:box-cost:delete']">{{$t('删除')}}</el-button>
huhaiqing's avatar
huhaiqing committed
146 147 148
                  </el-popconfirm>
                </template>
              </el-table-column>
149 150
            </el-table>
          </el-tab-pane>
151
          <el-tab-pane :label="$t('异常')" name="error">
huhaiqing's avatar
huhaiqing committed
152
            <el-table :data="errorList" style="width: 100%" border>
153
              <el-table-column type="index" align="center" :label="$t('序号')" width="50" />
huhaiqing's avatar
huhaiqing committed
154
              <el-table-column prop="opStep" :label="$t('操作')" align="center">
huhaiqing's avatar
huhaiqing committed
155 156 157 158
                <template slot-scope="scope">
                  <dict-tag :type="DICT_TYPE.BOX_SHIPPING_PROCESS" :value="scope.row.opStep" />
                </template>
              </el-table-column>
159
              <el-table-column prop="billAbnId" :label="$t('异常')" align="center">
huhaiqing's avatar
huhaiqing committed
160
                <template slot-scope="scope">
huhaiqing's avatar
huhaiqing committed
161
                  <dict-tag :type="DICT_TYPE.BOX_SHIPPING_TICKET_EXCEPTION" :value="scope.row.billAbnId" />
huhaiqing's avatar
huhaiqing committed
162 163
                </template>
              </el-table-column>
houjn@hikoon.cn's avatar
houjn@hikoon.cn committed
164
              <el-table-column prop="abnDetail" :label="$t('异常描述')" align="center" width="300"></el-table-column>
huhaiqing's avatar
huhaiqing committed
165
              <el-table-column prop="delayDays" :label="$t('异常延迟天数')" align="center"></el-table-column>
houjn@hikoon.cn's avatar
houjn@hikoon.cn committed
166
              <el-table-column prop="" :label="$t('异常时间')" align="center" width="200">
huhaiqing's avatar
huhaiqing committed
167 168 169 170 171
                <template slot-scope="scope">
                  <span v-if="scope.row.abnStartTime">{{formatDate(scope.row.abnStartTime)}} - </span>
                  <span v-if="scope.row.abnEndTime">{{formatDate(scope.row.abnEndTime)}}</span>
                </template>
              </el-table-column>
172 173
            </el-table>
          </el-tab-pane>
174
          <el-tab-pane :label="$t('表单')" name="download">
huhaiqing's avatar
huhaiqing committed
175
            <el-table :data="downloadList" style="width: 50%">
176 177
              <el-table-column prop="title" :label="$t('文件类型')"></el-table-column>
              <el-table-column prop="" :label="$t('下载链接')">
huhaiqing's avatar
huhaiqing committed
178
                <template slot-scope="scope">
zhoutong's avatar
zhoutong committed
179
                  <a v-if="scope.row.serviceName" href="javascript:void(0)" @click="downloadDetailFile(scope.row)" v-hasPermi="[`${scope.row.hasPermi}`]">{{$t('下载')}}</a>
180
                  <div v-else>{{$t('未完成')}}</div>
huhaiqing's avatar
huhaiqing committed
181 182
                </template>
              </el-table-column>
183 184 185 186 187
            </el-table>
          </el-tab-pane>
        </el-tabs>
      </el-col>
    </el-row>
huhaiqing's avatar
huhaiqing committed
188 189 190 191 192 193 194 195 196 197

    <!-- 对话框(添加 / 修改) -->
    <el-dialog :title="dialogConfig.title" :visible.sync="dialogConfig.visible" :width="dialogConfig.width" append-to-body class="shippingSea-dialog">
      <template v-if="dialogConfig.type === 'edit'">
        <editForm v-if="dialogConfig.visible" @closeDialog="closeDialog" :shipmentObj="shipmentObj" :warehouseList="warehouseList" :transportTypes="transportTypes" :cabinetList="cabinetList" />
      </template>
      <template v-if="dialogConfig.type === 'cost'">
        <costForm v-if="dialogConfig.visible" @closeDialog="closeDialog" :shipmentObj="shipmentObj" :costDetail="costDetail" />
      </template>
      <template v-if="dialogConfig.type === 'error'">
huhaiqing's avatar
huhaiqing committed
198
        <regError v-if="dialogConfig.visible" @closeDialog="closeDialog" :shipmentObj="shipmentObj" :allUsers="allUsers" />
huhaiqing's avatar
huhaiqing committed
199
      </template>
huhaiqing's avatar
huhaiqing committed
200 201 202
      <template v-if="dialogConfig.type === 'updateError'">
        <updateError v-if="dialogConfig.visible" @closeDialog="closeDialog" :shipmentObj="shipmentObj" :errorInfo="errorInfo" />
      </template>
huhaiqing's avatar
huhaiqing committed
203
    </el-dialog>
204 205 206 207
  </div>
</template>

<script>
huhaiqing's avatar
huhaiqing committed
208 209 210 211 212 213 214 215
import {
  getbox,
  getLogList,
  getCostList,
  getAbnormalList,
  deleteCost,
  deletebox,
} from "@/api/ecw/box";
huhaiqing's avatar
huhaiqing committed
216 217 218 219 220
import { getChannelList } from "@/api/ecw/channel";
import { getCabinetPage } from "@/api/ecw/cabinet";
import { getWarehouseList } from "@/api/ecw/warehouse";
import {
  getTotlContent,
huhaiqing's avatar
huhaiqing committed
221 222
  formatDate,
  serviceMsg,
huhaiqing's avatar
huhaiqing committed
223
  downloadFile,
224
  downloadFileByUrl,
huhaiqing's avatar
huhaiqing committed
225 226
} from "./shippingSea/utils";
import { getSectionList, boxGoodsDetail } from "@/api/ecw/boxSea";
huhaiqing's avatar
huhaiqing committed
227 228 229 230
import { getSupplierPage } from "@/api/ecw/supplier";
import costForm from "./costForm.vue";
import regError from "./regError.vue";
import editForm from "./editForm.vue";
huhaiqing's avatar
huhaiqing committed
231
import updateError from "./updateError.vue";
huhaiqing's avatar
huhaiqing committed
232
import { listUser } from "@/api/system/user";
233 234

export default {
huhaiqing's avatar
huhaiqing committed
235
  name: "boxDetail",
236
  props: {
huhaiqing's avatar
huhaiqing committed
237
    shipmentId: String,
238
  },
huhaiqing's avatar
huhaiqing committed
239 240 241 242
  components: {
    costForm,
    regError,
    editForm,
huhaiqing's avatar
huhaiqing committed
243
    updateError,
huhaiqing's avatar
huhaiqing committed
244
  },
245
  created() {
huhaiqing's avatar
huhaiqing committed
246 247 248 249 250
    this.transportTypes = this.getDictDatas(
      this.DICT_TYPE.ECW_TRANSPORT_TYPE
    ).filter((item) => item.value == "1" || item.value == "2");
    this.initData();
    this.queryAllData();
huhaiqing's avatar
huhaiqing committed
251 252 253 254 255
    // 用户
    listUser({ pageNo: "1", pageSize: "10000" }).then((res) => {
      const { data } = res;
      this.allUsers = data.list ?? [];
    });
256 257 258
  },
  data() {
    return {
huhaiqing's avatar
huhaiqing committed
259 260 261 262 263 264 265 266
      // 出货对象
      shipmentObj: {},
      // 渠道
      channelList: [],
      // 柜型
      cabinetList: [],
      // 仓库
      warehouseList: [],
huhaiqing's avatar
huhaiqing committed
267 268
      // 供应商
      allSupplier: [],
huhaiqing's avatar
huhaiqing committed
269
      allUsers: [],
huhaiqing's avatar
huhaiqing committed
270 271
      // 部分list
      sectionList: [],
huhaiqing's avatar
huhaiqing committed
272 273 274 275 276 277 278 279
      // 单证数组
      docStatus: [],
      // 操作日志
      logList: [],
      // 费用
      costList: [],
      // 异常
      errorList: [],
huhaiqing's avatar
huhaiqing committed
280 281 282 283 284
      // 部分订单商品
      sectionObj: {
        secStatistics: {},
        sectionOrderList: [],
        totalStatistics: {},
285
      },
huhaiqing's avatar
huhaiqing committed
286 287 288 289 290 291 292 293 294 295 296 297 298
      // 部分ID
      sectionId: "0",
      // 弹窗配置
      dialogConfig: {
        visible: false,
        title: "",
        width: "600px",
        type: "",
      },
      // 运输方式
      transportTypes: [],
      // 费用详情
      costDetail: {},
huhaiqing's avatar
huhaiqing committed
299 300
      // 下载
      downloadList: [
zhoutong's avatar
zhoutong committed
301 302 303
        { title: this.$t("预装单"), serviceName: "downloadPreloadGoodsList", hasPermi: "shipment:box:download:downloadPreloadGoodsList" },
        { title: this.$t("已装单"), serviceName: "downloadLoadGoodsList", hasPermi: "shipment:box:download:downloadLoadGoodsList" },
        { title: this.$t("应收汇总表"), serviceName: "downloadReceivableList", hasPermi: "shipment:box:download:downloadReceivableList" },
huhaiqing's avatar
huhaiqing committed
304 305 306 307
        {
          title: this.$t("提货单"),
          serviceName: "zipDownload",
          fileFormat: "zip",
zhoutong's avatar
zhoutong committed
308
          hasPermi: "shipment:box:download:zipDownload"
huhaiqing's avatar
huhaiqing committed
309
        },
310 311 312 313
        {
          title: "agent list",
          serviceName: "downloadAgentListFiles",
          type: "url",
zhoutong's avatar
zhoutong committed
314
          hasPermi: "shipment:box:download:downloadAgentListFiles"
315
        },
zhoutong's avatar
zhoutong committed
316
        { title: "soncap", serviceName: "downloadSoncapFiles", type: "url", hasPermi: "shipment:box:download:downloadSoncapFiles" },
huhaiqing's avatar
huhaiqing committed
317 318 319 320
        {
          title: this.$t("提单Copy"),
          serviceName: "downloadLadingCopy",
          type: "url",
zhoutong's avatar
zhoutong committed
321
          hasPermi: "shipment:box:download:downloadLadingCopy"
huhaiqing's avatar
huhaiqing committed
322
        },
huhaiqing's avatar
huhaiqing committed
323
      ],
huhaiqing's avatar
huhaiqing committed
324 325 326 327 328
      // 选中行
      selectedRows: [],
      // 修改异常
      errorInfo: {
        orderList: [],
huhaiqing's avatar
huhaiqing committed
329 330
        errorType: "",
        operate: "",
huhaiqing's avatar
huhaiqing committed
331
      },
332 333
    };
  },
huhaiqing's avatar
huhaiqing committed
334
  methods: {
huhaiqing's avatar
huhaiqing committed
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365
    selectable(row, index) {
      if (row.abnormalDealStatus === 1) return false;
      return true;
    },
    /* 全选 */
    handleSelectionChange(selected) {
      this.selectedRows = selected;
    },
    /* 更新状态 */
    updateStatus(type, row) {
      let orders = [];
      if (type === "selected") {
        if (!this.selectedRows.length) {
          this.$message.error("请选择需要更新的订单");
          return;
        }
        orders = this.selectedRows;
      } else if (type === "all") {
        // 筛选未处理的订单
        orders = this.sectionObj.sectionOrderList.filter(
          (item) => item.abnormalDealStatus === 0
        );
        if (!orders.length) {
          this.$message.error("没有订单需要更新");
          return;
        }
      } else if (type === "single") {
        orders = [row];
      }
      this.getErrorType();
      this.$set(this.errorInfo, "orderList", orders);
huhaiqing's avatar
huhaiqing committed
366
      this.$set(this.errorInfo, "operate", type);
huhaiqing's avatar
huhaiqing committed
367 368 369 370 371
      // 判断异常类型
      this.handleCommand("updateError");
    },
    getErrorType() {
      for (const [key, value] of Object.entries(this.shipmentObj)) {
huhaiqing's avatar
huhaiqing committed
372 373
        // 报关异常 customsHasAbnormal
        if (key === "customsHasAbnormal" && value) {
huhaiqing's avatar
huhaiqing committed
374 375 376
          this.$set(this.errorInfo, "errorType", "customs");
          this.$set(this.dialogConfig, "title", this.$t("更新报关异常状态"));
        }
huhaiqing's avatar
huhaiqing committed
377 378
        // 起运异常 shippingHasAbnormal
        if (key === "shippingHasAbnormal" && value) {
huhaiqing's avatar
huhaiqing committed
379 380 381
          this.$set(this.errorInfo, "errorType", "shipping");
          this.$set(this.dialogConfig, "title", this.$t("更新起运异常状态"));
        }
huhaiqing's avatar
huhaiqing committed
382 383
        // 到港异常 arrivalHasAbnormal
        if (key === "arrivalHasAbnormal" && value) {
huhaiqing's avatar
huhaiqing committed
384 385 386 387 388
          this.$set(this.errorInfo, "errorType", "arrival");
          this.$set(this.dialogConfig, "title", this.$t("更新到港异常状态"));
        }
      }
    },
huhaiqing's avatar
huhaiqing committed
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405
    // 初始化字典数据
    initData() {
      // 查询渠道
      getChannelList().then((res) => (this.channelList = res.data));
      // 查询柜型
      getCabinetPage(null).then(
        (response) => (this.cabinetList = response.data.list)
      );
      // 仓库
      getWarehouseList().then((r) => {
        this.warehouseList = r.data;
      });
      // 供应商
      getSupplierPage({ pageNo: "1", pageSize: "10000" }).then((res) => {
        const { data } = res;
        this.allSupplier = data.list;
      });
huhaiqing's avatar
huhaiqing committed
406
    },
huhaiqing's avatar
huhaiqing committed
407 408 409 410 411 412 413 414 415 416
    // 查询详情页所有数据
    queryAllData() {
      let param = { shipmentId: this.shipmentId };
      // 查询出货信息
      this.getBoxDetail();
      // 部分
      getSectionList(param).then((res) => {
        this.sectionList = res.data.map((item, index) => {
          return {
            ...item,
huhaiqing's avatar
huhaiqing committed
417
            title: this.$t("第{index}部分", { index: index + 1 }),
huhaiqing's avatar
huhaiqing committed
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457
          };
        });
      });
      // 明细
      this.getBoxGoodsDetail();
      // 状态
      getLogList(param).then((res) => {
        this.logList = res.data;
      });
      // 费用
      this.getCost();
      // 异常
      getAbnormalList(param).then((res) => {
        this.errorList = res.data;
      });
      //表单
    },
    // 出货信息
    getBoxDetail() {
      getbox(this.shipmentId).then((res) => {
        const { data } = res;
        this.shipmentObj = data ?? {};
      });
    },
    // 获取费用
    getCost() {
      getCostList({ shipmentId: this.shipmentId }).then((res) => {
        this.costList = res.data;
      });
    },
    // 部分切换
    sectionChange() {
      this.getBoxGoodsDetail();
    },
    // 获取部分详情以及物品
    getBoxGoodsDetail() {
      boxGoodsDetail({
        shipmentId: this.shipmentId,
        secId: this.sectionId,
      }).then((res) => {
huhaiqing's avatar
huhaiqing committed
458 459 460
        this.sectionObj = res.data;
      });
    },
huhaiqing's avatar
huhaiqing committed
461 462 463
    // 供应商
    getSupplier(id) {
      let arr = this.allSupplier.find((item) => item.id == id) ?? {};
huhaiqing's avatar
huhaiqing committed
464
      return this.$l(arr, "company");
huhaiqing's avatar
huhaiqing committed
465 466 467 468 469 470 471 472 473 474 475 476
    },
    editCostClick(row) {
      this.costDetail = row;
      this.handleCommand("cost");
    },
    deleteCostClick(row) {
      deleteCost(row.id).then((res) => {
        serviceMsg(res, this).then((res) => {
          this.getCost();
        });
      });
    },
huhaiqing's avatar
huhaiqing committed
477 478 479 480 481 482 483
    /* 跳转订单详情 */
    jumpOrderDetail(row) {
      this.$router.push({
        path: "/order/detail",
        query: { orderId: row.orderId },
      });
    },
huhaiqing's avatar
huhaiqing committed
484 485 486 487 488
    // 事件执行
    handleCommand(type) {
      switch (type) {
        case "edit":
          this.$set(this.dialogConfig, "visible", true);
489
          this.$set(this.dialogConfig, "title", this.$t("修改出货"));
huhaiqing's avatar
huhaiqing committed
490 491 492 493 494 495 496 497 498
          this.$set(this.dialogConfig, "type", "edit");
          break;

        case "router":
          this.$router.push("/boxSea/shippingSea/" + this.shipmentId);
          break;

        case "cost":
          this.$set(this.dialogConfig, "visible", true);
499
          this.$set(this.dialogConfig, "title", this.$t("费用登记"));
huhaiqing's avatar
huhaiqing committed
500 501
          this.$set(this.dialogConfig, "type", "cost");
          break;
huhaiqing's avatar
huhaiqing committed
502

huhaiqing's avatar
huhaiqing committed
503 504
        case "error":
          this.$set(this.dialogConfig, "visible", true);
505
          this.$set(this.dialogConfig, "title", this.$t("异常登记"));
huhaiqing's avatar
huhaiqing committed
506 507
          this.$set(this.dialogConfig, "type", "error");
          break;
huhaiqing's avatar
huhaiqing committed
508

huhaiqing's avatar
huhaiqing committed
509
        case "delete":
huhaiqing's avatar
huhaiqing committed
510 511
          this.$modal
            .confirm(
huhaiqing's avatar
huhaiqing committed
512 513 514
              this.$t("是否确认删除出货编号为 {no} 的数据项?", {
                no: this.shipmentObj.selfNo,
              })
huhaiqing's avatar
huhaiqing committed
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533
            )
            .then(() => {
              return deletebox(this.shipmentId);
            })
            .then((res) => {
              serviceMsg(res, this).then((res) => {
                // 获取当前path
                const currPath = this.$router.currentRoute.path;
                // 根据path获取view
                const view = this.visitedViews.find(
                  (item) => item.path === currPath
                );
                if (view) {
                  this.$store.dispatch("tagsView/delView", view);
                  this.$router.push("/shipment/boxSea");
                }
              });
            })
            .catch(() => {});
huhaiqing's avatar
huhaiqing committed
534
          break;
huhaiqing's avatar
huhaiqing committed
535 536 537 538 539

        case "updateError":
          this.$set(this.dialogConfig, "visible", true);
          this.$set(this.dialogConfig, "type", "updateError");
          break;
huhaiqing's avatar
huhaiqing committed
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555
      }
    },
    // 关闭弹框
    closeDialog(type) {
      this.$set(this.dialogConfig, "visible", false);
      if (type === "edit") {
        this.getBoxDetail();
      }
      if (type === "cost") {
        this.getCost();
      }
      if (type === "error") {
        getAbnormalList({ shipmentId: this.shipmentId }).then((res) => {
          this.errorList = res.data;
        });
      }
huhaiqing's avatar
huhaiqing committed
556 557 558
      if (type === "detail") {
        this.getBoxGoodsDetail();
      }
huhaiqing's avatar
huhaiqing committed
559 560
    },
    formatDate,
huhaiqing's avatar
huhaiqing committed
561
    downloadDetailFile(row) {
562 563 564 565 566 567 568 569 570 571 572 573 574 575
      const { fileFormat, type } = row;
      if (type === "url") {
        downloadFileByUrl(row.serviceName, { shipmentId: this.shipmentId });
      } else {
        let fileName = `${row.title}(${this.shipmentObj.selfNo}).${
          fileFormat ?? "xlsx"
        }`;
        downloadFile(
          row.serviceName,
          { shipmentId: this.shipmentId },
          fileName,
          fileFormat ?? "xlsx"
        );
      }
huhaiqing's avatar
huhaiqing committed
576
    },
huhaiqing's avatar
huhaiqing committed
577
  },
578
  computed: {
huhaiqing's avatar
huhaiqing committed
579 580 581
    visitedViews() {
      return this.$store.state.tagsView.visitedViews;
    },
huhaiqing's avatar
huhaiqing committed
582 583 584 585 586 587 588 589 590
    // 单证状态
    getDocStatus() {
      return (list = []) => {
        // 获取类型
        let customsTypes = list.map((item) => item.customsType);
        // 去重
        return Array.from(new Set(customsTypes));
      };
    },
huhaiqing's avatar
huhaiqing committed
591 592 593 594 595
    /* 渠道 */
    getShipChannelName() {
      return (shippingChannelId) => {
        for (const channelItem of this.channelList) {
          if (channelItem.channelId == shippingChannelId) {
huhaiqing's avatar
huhaiqing committed
596
            return this.$l(channelItem, "name");
huhaiqing's avatar
huhaiqing committed
597 598 599 600 601 602 603 604 605 606 607 608 609
          }
        }
      };
    },
    /* 获取柜型 */
    getCabinetLabel() {
      return (cabinetId) => {
        for (const cabinetItem of this.cabinetList) {
          if (cabinetItem.id == cabinetId) {
            return cabinetItem.name;
          }
        }
      };
610
    },
huhaiqing's avatar
huhaiqing committed
611 612 613 614
    /* 总计 */
    getBoxSum() {
      return (boxStatistics) => {
        if (boxStatistics) {
huhaiqing's avatar
huhaiqing committed
615
          return this.$t("{num}箱 {volume}m³ {weight}kg", {
616
            num: boxStatistics.num ?? 0,
huhaiqing's avatar
huhaiqing committed
617 618
            volume: boxStatistics.volume ?? 0,
            weight: boxStatistics.weight ?? 0,
huhaiqing's avatar
huhaiqing committed
619
          });
huhaiqing's avatar
huhaiqing committed
620 621 622
        }
        return;
      };
623
    },
huhaiqing's avatar
huhaiqing committed
624 625 626 627
    /* 获取仓库 */
    getCityName() {
      return (id) => {
        let arr = this.warehouseList.filter((item) => item.id == id);
huhaiqing's avatar
huhaiqing committed
628
        return arr.length > 0 ? this.$l(arr[0], "title") : this.$t("无");
huhaiqing's avatar
huhaiqing committed
629
      };
630
    },
huhaiqing's avatar
huhaiqing committed
631 632 633 634 635 636 637 638
    // 部分信息
    getSectionInfo() {
      const { totalStatistics, secStatistics } = this.sectionObj;
      if (!this.sectionId) {
        return getTotlContent(totalStatistics);
      } else {
        return getTotlContent(secStatistics);
      }
639 640 641 642 643
    },
  },
};
</script>

huhaiqing's avatar
huhaiqing committed
644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661
<style lang="scss">
.shipping-detail {
  .detail-pane {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    .box-weight {
      margin-left: 10px;
    }
    .document-status {
      flex: 1;
      justify-content: flex-end;
      display: flex;
      align-items: center;
      > span {
        margin-right: 10px;
      }
    }
662
  }
huhaiqing's avatar
huhaiqing committed
663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715
  .el-table__body {
    .customsType-red {
      color: red;
    }
  }
  .shipping-status {
    position: relative;
    display: flex;
    .status-line {
      width: 1px;
      height: calc(100% - 35px);
      background-color: #e8eaec;
      position: absolute;
      left: 13px;
      top: 30px;
    }
    .status-number {
      width: 26px;
      height: 26px;
      border: 1px solid #ccc;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .status-info {
      color: #999;
      margin-left: 20px;
      > :first-child {
        font-size: 14px;
        font-weight: bolder;
        line-height: 26px;
      }
      > :last-child {
        line-height: 26px;
        display: flex;
        > p {
          margin: 0;
          margin-right: 10px;
        }
      }
    }

    &.curr-status {
      .status-number {
        color: #fff;
        background-color: #2d8cf0;
        border-color: #2d8cf0;
      }
      .status-info {
        color: #666;
      }
    }
716 717 718
  }
}
</style>