shippingDetail.vue 10.5 KB
Newer Older
lanbaoming's avatar
lanbaoming committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 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 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
<template>
  <div class="app-approvalShipping">
    <h1>{{$t('申请信息')}}{{$t('出货信息')}}</h1>
    <el-descriptions :column="6" border>
      <el-descriptions-item :label="$t('自编号')">{{boxBackVO.selfNo}}</el-descriptions-item>
      <el-descriptions-item :label="$t('运输方式')">
        <dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="boxBackVO.transportType" />
      </el-descriptions-item>
      <el-descriptions-item :label="$t('出货渠道')">
        {{getShipChannelName(boxBackVO.shippingChannelId)}}
      </el-descriptions-item>
      <el-descriptions-item :label="$t('柜型')" v-if="boxBackVO.transportType != 3&&type!='air_warehouse'">
        {{cabinetLabel}}
      </el-descriptions-item>
      <el-descriptions-item :label="$t('体积/重量')">
        {{getVolumeWeight(loadDetail.totalStatistics)}}
      </el-descriptions-item>
      <el-descriptions-item :label="$t('货柜状态')">
        {{boxBackVO.shipmentStatusText}}
      </el-descriptions-item>
    </el-descriptions>

    <div class="mt-20" v-if="type === 'shipment'">
      <el-descriptions :column="1" v-if="boxAirShipmentBackVO" border :label-style="{width: '200px'}">
        <el-descriptions-item :label="$t('出货方式')">
          {{deliverType}}
        </el-descriptions-item>
        <el-descriptions-item :label="$t('送货时间') + '/' + $t('自提时间')">
          {{parseTime(boxAirShipmentBackVO.deliverTime)}}
        </el-descriptions-item>
        <el-descriptions-item :label="$t('送货地址') + '/' + $t('自提地址')">
          {{boxAirShipmentBackVO.deliverAddress}}
        </el-descriptions-item>
        <el-descriptions-item :label="$t('车牌')">
          {{boxAirShipmentBackVO.licensePlate}}
        </el-descriptions-item>
        <el-descriptions-item :label="$t('司机')">
          {{boxAirShipmentBackVO.driver}}
        </el-descriptions-item>
        <el-descriptions-item :label="$t('司机联系方式')">
          {{boxAirShipmentBackVO.driverPhone}}
        </el-descriptions-item>
      </el-descriptions>
      <template v-else>暂无出货审核信息</template>
    </div>

    <el-row style="marginTop:15px">
      <el-button type="primary" @click="showOrder">{{$t('订单列表')}}</el-button>
    </el-row>

    <div v-if="approvalInfo.applyReason">
      <h1>{{$t('申请原因')}}</h1>
      <div>
        {{approvalInfo.applyReason}}
      </div>
    </div>

    <div v-if="(type === 'unload_container' || type === 'close_container') && srcStrs" style="marginTop:15px">
      <h1>{{$t('图片')}}</h1>
      <!-- <ImagePreview :src="srcStrs" :width="146" :height="146" /> -->
      <div style="display:flex">
        <el-image v-for="(srcStr, i) in srcStrs" :key="i" :src="srcStr" fit="cover" style="width:146px;height:146px;margin-right:10px" :preview-src-list="[srcStr]">
          <div slot="error" class="image-slot">
            <i class="el-icon-picture-outline"></i>
          </div>
        </el-image>
      </div>

    </div>

    <el-dialog :title="dialogConfig.title" :visible.sync="dialogConfig.visible" fullscreen :modal-append-to-body=false append-to-body>
      <el-descriptions :column="6" border>
        <el-descriptions-item :label="$t('自编号')">{{boxBackVO.selfNo}}</el-descriptions-item>
        <el-descriptions-item :label="$t('运输方式')">
          <dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="boxBackVO.transportType" />
        </el-descriptions-item>
        <!-- <el-descriptions-item :label="$t('出货渠道')">
          {{getShipChannelName(boxBackVO.shippingChannelId)}}
        </el-descriptions-item> -->
        <el-descriptions-item v-if="type!='air_warehouse'" :label="$t('柜型')">
          {{cabinetLabel}}
        </el-descriptions-item>
        <el-descriptions-item :label="$t('体积') + '/' + $t('重量')">
          {{getVolumeWeight(loadDetail.totalStatistics)}}
        </el-descriptions-item>
        <el-descriptions-item :label="$t('货柜状态')">
          {{boxBackVO.shipmentStatusText}}
        </el-descriptions-item>
      </el-descriptions>

      <el-row style="marginTop:15px">
        <el-table :data="loadDetail.sectionOrderList" border>
          <el-table-column prop="sectionName" :label="$t('部分')" align="center"></el-table-column>
          <el-table-column prop="orderNo" :label="$t('订单号')" align="center">
            <template v-slot="{row}">
              <el-button type="text" @click="jumpOrderDetail(row)">{{row.orderNo}}</el-button>
            </template>
          </el-table-column>
          <el-table-column :label="$t('货物信息')" align="center" width="500px">
            <template v-slot="{row}">
              <section>
                <div v-for="(item, index) in row.goodsList" :key="index">
                  <div>{{index+1}}{{item.prodTitleZh}}</div>
                  <div>{{index+1}}{{item.prodTitleEn}}</div>
                </div>
              </section>
            </template>
          </el-table-column>
          <el-table-column :label="$t('入仓货物属性')" align="center">
            <template v-slot="{row}">
              <section>
                <div>{{$t('合计')}}{{calcSum(row.goodsList)}}{{$t('')}}</div>
                <div v-for="(item, index) in row.goodsList" :key="index">
                  {{getTotlContent(item,['volume','weight'])}}
                </div>
              </section>
            </template>
          </el-table-column>
          <el-table-column prop="installNum" :label="$t('实装箱数')" align="center"></el-table-column>
          <el-table-column prop="volume" label="体积m³" align="center"></el-table-column>
          <el-table-column prop="weight" :label="$t('重量')" align="center"></el-table-column>
          <el-table-column prop="unloadNum" :label="type=='air_warehouse'?$t('到仓箱数'):$t('卸柜箱数')" align="center" v-if="isShowColumn(boxBackVO)"></el-table-column>
        </el-table>
      </el-row>
    </el-dialog>
  </div>
</template>

<script>
import {approvalDetail, getbox} from "@/api/ecw/box";
import { getSeaStatus, getTotlContent } from "./shippingSea/utils";
import { getCabinetPage } from "@/api/ecw/cabinet";
import { getChannelList } from "@/api/ecw/channel";
import Decimal from "decimal.js";
import ImagePreview from "@/components/ImagePreview";
import {constantDict} from "@/views/ecw/box/shippingAir/utils";
import {parseTime} from "../../../utils/ruoyi";

/**
 * 出货审核详情
 */
export default {
  name: "shippingDetail",
  components: { ImagePreview },
  props: {
    processId: {
      type: [Number, String],
    },
    type: String,
  },
  data() {
    return {
      approvalInfo: {},
      boxBackVO: {},
      loadDetail: {},
      // 柜型
      cabinetLabel: "",
      //渠道
      channelList: [],
      // 弹出配置
      dialogConfig: {
        title: "",
        visible: false,
      },
      srcStrs: [],
      // 出货审核详情
      boxAirShipmentBackVO: null
    };
  },
  created() {
    getChannelList().then((res) => (this.channelList = res.data));
  },
  methods: {
      parseTime,
    getTotlContent,
    /* 获取详情 */
    getApprovalDetail(processId) {
      approvalDetail({ approvalId: processId }).then((res) => {
        this.approvalInfo = res.data.approvalInfo;
        this.boxBackVO = res.data.boxBackVO;
        this.loadDetail = res.data.loadDetail;
        if (this.type === "close_container" && res.data.cabinetVO) {
          const ldPictures = res.data.cabinetVO.ldPictures
            ? JSON.parse(res.data.cabinetVO.ldPictures)
            : [];
          this.srcStrs = ldPictures.map((item) => item.url);
        }
        if (this.type === "unload_container" && res.data.cabinetUnloadVO) {
          this.srcStrs = res.data.cabinetUnloadVO.ulImgs
            ? res.data.cabinetUnloadVO.ulImgs.split(",")
            : [];
        }
        // 如果是出货审核则需要调用出货详情获取出货信息
        if (this.type === "shipment") {
          this.getShipmentDetail();
        }
        if (this.type === "deleteExit") {
          this.getDeleteExit();
        }
      });
    },
    getShipmentDetail(){
      getbox(this.boxBackVO.id).then(res => {
        this.boxAirShipmentBackVO = res.data.boxAirShipmentBackVO
      })
    },
    /* 获取柜型 */
    getCabinetLabel(cabinetId) {
      getCabinetPage(null).then((response) => {
        const cabinetList = response.data.list;
        for (const cabinetItem of cabinetList) {
          if (cabinetItem.id == cabinetId) {
            this.cabinetLabel = cabinetItem.name;
            break;
          }
        }
      });
    },
    /* 打开订单列表 */
    showOrder() {
      this.$set(
        this.dialogConfig,
        "title",
        `${this.boxBackVO.selfNo} ` + this.$t("订单列表")
      );
      this.$set(this.dialogConfig, "visible", true);
    },
    /* 合计 */
    calcSum(goodsList) {
      let sum = 0;
      goodsList.forEach((element) => {
        sum = Decimal.add(sum, element.num).toNumber();
      });
      return sum;
    },
    /* 跳转订单详情 */
    jumpOrderDetail(row) {
      this.$router.push("/order/detail?orderId=" + row.orderId);
    },
  },
  watch: {
    processId: {
      immediate: true,
      handler(val) {
        this.getApprovalDetail(val);
      },
    },
    boxBackVO(val) {
      // 柜型
      this.getCabinetLabel(val.cabinetId);
    },
  },
  computed: {
    constantDict() {
      return constantDict
    },
    /* 渠道 */
    getShipChannelName() {
      return (shippingChannelId) => {
        for (const channelItem of this.channelList) {
          if (channelItem.channelId == shippingChannelId) {
            return this.$l(channelItem, "name");
          }
        }
      };
    },
    /* 体积重量 */
    getVolumeWeight() {
      return (total) => {
        return this.getTotlContent(total);
      };
    },
    /* 是否显示卸柜箱数 */
    isShowColumn() {
      return (shippingVO) => {
        return getSeaStatus(shippingVO) >= 182 ? true : false;
      };
    },
    // 出乎方式
    deliverType(){
      if(!this.boxAirShipmentBackVO) return ''
      return constantDict.deliverType.find(item => item.value == this.boxAirShipmentBackVO.deliverType)?.label
    }
  },
};
</script>

<style lang="scss" scoped>
.el-image {
  border-radius: 5px;
  background-color: #ebeef5;
  box-shadow: 0 0 5px 1px #ccc;
  ::v-deep .el-image__inner {
    transition: all 0.3s;
    cursor: pointer;
    &:hover {
      transform: scale(1.2);
    }
  }
  ::v-deep .image-slot {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    color: #909399;
    font-size: 30px;
  }
}
</style>