query.vue 19.4 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 6 7
        <div style="display: flex; justify-content: space-between;align-items: flex-end;">
          <h2>出货详情</h2>
          <div>
huhaiqing's avatar
huhaiqing committed
8 9 10 11
            <el-button size="small" @click="handleCommand('edit')">编辑</el-button>
            <el-button size="small" @click="handleCommand('router')">操作</el-button>
            <el-button type="primary" size="small" @click="handleCommand('error')">异常登记</el-button>
            <el-button type="primary" size="small" @click="handleCommand('cost')">费用登记</el-button>
huhaiqing's avatar
huhaiqing committed
12
            <el-button type="danger" size="small" @click="handleCommand('delete')">删除</el-button>
13 14 15 16
          </div>
        </div>
        <el-card style="margin-top: 15px">
          <el-descriptions :column="4" border>
huhaiqing's avatar
huhaiqing committed
17 18 19 20 21 22
            <el-descriptions-item label="自编号">
              {{shipmentObj.selfNo}}
            </el-descriptions-item>
            <el-descriptions-item label="运输方式">
              <dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="shipmentObj.transportType" />
            </el-descriptions-item>
huhaiqing's avatar
huhaiqing committed
23
            <!-- <el-descriptions-item label="出货渠道">
huhaiqing's avatar
huhaiqing committed
24
              {{getShipChannelName(shipmentObj.shippingChannelId)}}
huhaiqing's avatar
huhaiqing committed
25 26
            </el-descriptions-item> -->
            <el-descriptions-item label="柜型">
huhaiqing's avatar
huhaiqing committed
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
              {{getCabinetLabel(shipmentObj.cabinetId)}}
            </el-descriptions-item>
            <el-descriptions-item label="状态">
              {{getBoxStatus(shipmentObj)}}
            </el-descriptions-item>
            <el-descriptions-item label="总计">
              {{getBoxSum(shipmentObj.boxStatistics)}}
            </el-descriptions-item>
            <el-descriptions-item label="始发地">
              {{getCityName(shipmentObj.startWarehouseId)}}
            </el-descriptions-item>
            <el-descriptions-item label="目的地">
              {{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 48
        <el-tabs style="margin-top: 15px" type="border-card" value="detail">
          <el-tab-pane label="明细" name="detail">
49
            <div class="detail-pane">
huhaiqing's avatar
huhaiqing committed
50
              <div>当前部分:</div>
huhaiqing's avatar
huhaiqing committed
51
              <el-select placeholder="请选择" v-model="sectionId" @change="sectionChange">
huhaiqing's avatar
huhaiqing committed
52
                <el-option key="0" label="全部" 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 59 60 61 62 63
              <div class="document-status">
                <p>单证状态:</p>
                <template v-for="(item, index) in getDocStatus(sectionObj.sectionOrderList)">
                  <dict-tag :type="DICT_TYPE.ECW_CUSTOMS_TYPE" :value="item" :key="index" />
                </template>
              </div>
64
            </div>
huhaiqing's avatar
huhaiqing committed
65 66
            <el-table :data="sectionObj.sectionOrderList" style="width: 100%" border>
              <el-table-column type="index" align="center" label="序号" width="50" />
huhaiqing's avatar
huhaiqing committed
67 68 69 70 71
              <el-table-column prop="orderNo" label="订单号" align="center">
                <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
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
              <el-table-column prop="goodsList" label="货物信息" width="250px" align="center">
                <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>
              <el-table-column prop="num" label="计划箱数" align="center"></el-table-column>
              <el-table-column prop="installNum" label="实装箱数" align="center"></el-table-column>
              <el-table-column prop="unloadNum" label="卸柜箱数" align="center"></el-table-column>
              <el-table-column prop="destWarehouseName" label="提货点" align="center"></el-table-column>
              <el-table-column prop="volume" label="体积" align="center"></el-table-column>
              <el-table-column prop="weight" label="重量" align="center"></el-table-column>
              <el-table-column prop="totalWorth" label="货值" align="center"></el-table-column>
              <el-table-column prop="customsType" label="报关方式" align="center">
                <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>
              <el-table-column prop="customsFee" label="报关费用" align="center"></el-table-column>
96 97
            </el-table>
          </el-tab-pane>
huhaiqing's avatar
huhaiqing committed
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
          <el-tab-pane label="状态" name="status">
            <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">
                <div>{{item.titleZh}}</div>
                <div>
                  <p>{{formatDate(item.createTime)}}</p>
                  <p>{{item.operator}}</p>
                </div>
              </div>
            </div>
          </el-tab-pane>
          <el-tab-pane label="费用" name="fee">
            <el-table :data="costList" style="width: 100%" border>
              <el-table-column type="index" align="center" label="序号" width="50" />
              <el-table-column prop="costType" label="费用类型" align="center">
                <template slot-scope="scope">
                  <dict-tag :type="DICT_TYPE.FEE_TYPE" :value="scope.row.costType" />
                </template>
              </el-table-column>
              <el-table-column prop="supplierId" label="供应商" align="center">
                <template slot-scope="scope">
                  {{getSupplier(scope.row.supplierId)}}
                </template>
              </el-table-column>
              <el-table-column prop="price" label="金额" align="center"></el-table-column>
              <el-table-column prop="" label="实付金额" align="center"></el-table-column>
              <el-table-column prop="" label="实付日期" align="center"></el-table-column>
              <el-table-column prop="" label="操作" align="center">
                <template slot-scope="scope">
                  <el-button type="primary" size="small" @click="editCostClick(scope.row)" style="marginRight:10px;">编辑</el-button>
                  <el-popconfirm title="确定是否删除" @confirm="deleteCostClick(scope.row)">
                    <el-button type="danger" size="small" slot="reference">删除</el-button>
                  </el-popconfirm>
                </template>
              </el-table-column>
135 136
            </el-table>
          </el-tab-pane>
huhaiqing's avatar
huhaiqing committed
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
          <el-tab-pane label="异常" name="error">
            <el-table :data="errorList" style="width: 100%" border>
              <el-table-column type="index" align="center" label="序号" width="50" />
              <el-table-column prop="opStep" label="操作步骤" align="center">
                <template slot-scope="scope">
                  <dict-tag :type="DICT_TYPE.BOX_SHIPPING_PROCESS" :value="scope.row.opStep" />
                </template>
              </el-table-column>
              <el-table-column prop="billAbnId" label="异常" align="center">
                <template slot-scope="scope">
                  <dict-tag :type="DICT_TYPE.BOX_SHIPPING_TICKET_EXCEPTION" :value="scope.row.opStep" />
                </template>
              </el-table-column>
              <el-table-column prop="abnDetail" label="异常详情" align="center" width="800"></el-table-column>
              <el-table-column prop="" label="异常时间" align="center">
                <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>
157 158
            </el-table>
          </el-tab-pane>
huhaiqing's avatar
huhaiqing committed
159
          <el-tab-pane label="表单" name="download">
160 161 162 163 164 165 166 167
            <el-table :data="[]" style="width: 50%">
              <el-table-column prop="" label="文件类型"> </el-table-column>
              <el-table-column prop="" label="下载链接"> </el-table-column>
            </el-table>
          </el-tab-pane>
        </el-tabs>
      </el-col>
    </el-row>
huhaiqing's avatar
huhaiqing committed
168 169 170 171 172 173 174 175 176 177 178 179 180

    <!-- 对话框(添加 / 修改) -->
    <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'">
        <regError v-if="dialogConfig.visible" @closeDialog="closeDialog" :shipmentObj="shipmentObj" />
      </template>
    </el-dialog>
181 182 183 184
  </div>
</template>

<script>
huhaiqing's avatar
huhaiqing committed
185 186 187 188 189 190 191 192
import {
  getbox,
  getLogList,
  getCostList,
  getAbnormalList,
  deleteCost,
  deletebox,
} from "@/api/ecw/box";
huhaiqing's avatar
huhaiqing committed
193 194 195 196 197 198 199
import { getChannelList } from "@/api/ecw/channel";
import { getCabinetPage } from "@/api/ecw/cabinet";
import { getWarehouseList } from "@/api/ecw/warehouse";
import {
  getSeaStatus,
  getStatusName,
  getTotlContent,
huhaiqing's avatar
huhaiqing committed
200 201
  formatDate,
  serviceMsg,
huhaiqing's avatar
huhaiqing committed
202 203
} from "./shippingSea/utils";
import { getSectionList, boxGoodsDetail } from "@/api/ecw/boxSea";
huhaiqing's avatar
huhaiqing committed
204 205 206 207
import { getSupplierPage } from "@/api/ecw/supplier";
import costForm from "./costForm.vue";
import regError from "./regError.vue";
import editForm from "./editForm.vue";
208 209

export default {
huhaiqing's avatar
huhaiqing committed
210
  name: "boxDetail",
211
  props: {
huhaiqing's avatar
huhaiqing committed
212
    shipmentId: String,
213
  },
huhaiqing's avatar
huhaiqing committed
214 215 216 217 218
  components: {
    costForm,
    regError,
    editForm,
  },
219
  created() {
huhaiqing's avatar
huhaiqing committed
220 221 222 223 224
    this.transportTypes = this.getDictDatas(
      this.DICT_TYPE.ECW_TRANSPORT_TYPE
    ).filter((item) => item.value == "1" || item.value == "2");
    this.initData();
    this.queryAllData();
225 226 227
  },
  data() {
    return {
huhaiqing's avatar
huhaiqing committed
228 229 230 231 232 233 234 235
      // 出货对象
      shipmentObj: {},
      // 渠道
      channelList: [],
      // 柜型
      cabinetList: [],
      // 仓库
      warehouseList: [],
huhaiqing's avatar
huhaiqing committed
236 237
      // 供应商
      allSupplier: [],
huhaiqing's avatar
huhaiqing committed
238 239
      // 部分list
      sectionList: [],
huhaiqing's avatar
huhaiqing committed
240 241 242 243 244 245 246 247
      // 单证数组
      docStatus: [],
      // 操作日志
      logList: [],
      // 费用
      costList: [],
      // 异常
      errorList: [],
huhaiqing's avatar
huhaiqing committed
248 249 250 251 252
      // 部分订单商品
      sectionObj: {
        secStatistics: {},
        sectionOrderList: [],
        totalStatistics: {},
253
      },
huhaiqing's avatar
huhaiqing committed
254 255 256 257 258 259 260 261 262 263 264 265 266
      // 部分ID
      sectionId: "0",
      // 弹窗配置
      dialogConfig: {
        visible: false,
        title: "",
        width: "600px",
        type: "",
      },
      // 运输方式
      transportTypes: [],
      // 费用详情
      costDetail: {},
267 268
    };
  },
huhaiqing's avatar
huhaiqing committed
269
  methods: {
huhaiqing's avatar
huhaiqing committed
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286
    // 初始化字典数据
    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
287
    },
huhaiqing's avatar
huhaiqing committed
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338
    // 查询详情页所有数据
    queryAllData() {
      let param = { shipmentId: this.shipmentId };
      // 查询出货信息
      this.getBoxDetail();
      // 部分
      getSectionList(param).then((res) => {
        this.sectionList = res.data.map((item, index) => {
          return {
            ...item,
            title: `第${index + 1}部分`,
          };
        });
      });
      // 明细
      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
339 340 341
        this.sectionObj = res.data;
      });
    },
huhaiqing's avatar
huhaiqing committed
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357
    // 供应商
    getSupplier(id) {
      let arr = this.allSupplier.find((item) => item.id == id) ?? {};
      return arr.companyZh ?? "";
    },
    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
358 359 360 361 362 363 364
    /* 跳转订单详情 */
    jumpOrderDetail(row) {
      this.$router.push({
        path: "/order/detail",
        query: { orderId: row.orderId },
      });
    },
huhaiqing's avatar
huhaiqing committed
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388
    // 事件执行
    handleCommand(type) {
      switch (type) {
        case "edit":
          this.$set(this.dialogConfig, "visible", true);
          this.$set(this.dialogConfig, "title", "修改出货");
          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);
          this.$set(this.dialogConfig, "title", "费用登记");
          this.$set(this.dialogConfig, "type", "cost");
          break;
        case "error":
          this.$set(this.dialogConfig, "visible", true);
          this.$set(this.dialogConfig, "title", "异常登记");
          this.$set(this.dialogConfig, "type", "error");
          break;
        case "delete":
huhaiqing's avatar
huhaiqing committed
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410
          this.$modal
            .confirm(
              `是否确认删除出货编号为 ${this.shipmentObj.selfNo} 的数据项?`
            )
            .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
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429
          break;
      }
    },
    // 关闭弹框
    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;
        });
      }
    },
    formatDate,
huhaiqing's avatar
huhaiqing committed
430
  },
431
  computed: {
huhaiqing's avatar
huhaiqing committed
432 433 434
    visitedViews() {
      return this.$store.state.tagsView.visitedViews;
    },
huhaiqing's avatar
huhaiqing committed
435 436 437 438 439 440 441 442 443
    // 单证状态
    getDocStatus() {
      return (list = []) => {
        // 获取类型
        let customsTypes = list.map((item) => item.customsType);
        // 去重
        return Array.from(new Set(customsTypes));
      };
    },
huhaiqing's avatar
huhaiqing committed
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
    /* 渠道 */
    getShipChannelName() {
      return (shippingChannelId) => {
        for (const channelItem of this.channelList) {
          if (channelItem.channelId == shippingChannelId) {
            return channelItem.nameZh;
          }
        }
      };
    },
    /* 获取柜型 */
    getCabinetLabel() {
      return (cabinetId) => {
        for (const cabinetItem of this.cabinetList) {
          if (cabinetItem.id == cabinetId) {
            return cabinetItem.name;
          }
        }
      };
463
    },
huhaiqing's avatar
huhaiqing committed
464 465 466 467 468
    /* 状态 */
    getBoxStatus() {
      return (shippingVO) => {
        return getStatusName(getSeaStatus(shippingVO));
      };
469
    },
huhaiqing's avatar
huhaiqing committed
470 471 472 473 474 475 476 477 478 479
    /* 总计 */
    getBoxSum() {
      return (boxStatistics) => {
        if (boxStatistics) {
          return `${boxStatistics.num ?? 0} ${boxStatistics.volume ?? 0}m3 ${
            boxStatistics.weight ?? 0
          }kg`;
        }
        return;
      };
480
    },
huhaiqing's avatar
huhaiqing committed
481 482 483 484 485 486
    /* 获取仓库 */
    getCityName() {
      return (id) => {
        let arr = this.warehouseList.filter((item) => item.id == id);
        return arr.length > 0 ? arr[0].titleZh : "无";
      };
487
    },
huhaiqing's avatar
huhaiqing committed
488 489 490 491 492 493 494 495
    // 部分信息
    getSectionInfo() {
      const { totalStatistics, secStatistics } = this.sectionObj;
      if (!this.sectionId) {
        return getTotlContent(totalStatistics);
      } else {
        return getTotlContent(secStatistics);
      }
496 497 498 499 500
    },
  },
};
</script>

huhaiqing's avatar
huhaiqing committed
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518
<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;
      }
    }
519
  }
huhaiqing's avatar
huhaiqing committed
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572
  .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;
      }
    }
573 574 575
  }
}
</style>