<template>
<div>
  <h1>{{ $t('申请信息【订单信息】') }}</h1>
  <el-descriptions :column="4" border>
    <el-descriptions-item :label="$t('订单号')">{{ order.orderNo }}</el-descriptions-item>
    <el-descriptions-item :label="$t('运输方式')">
      <dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="order.transportId"></dict-tag>
    </el-descriptions-item>
    <el-descriptions-item :label="$t('出货方式')">
      {{ order.channelName }}
    </el-descriptions-item>
    <el-descriptions-item :label="$t('订单状态')">
      {{ order.statusMsg }}
    </el-descriptions-item>
    <el-descriptions-item :label="$t('唛头')">
      {{ order.marks }}
    </el-descriptions-item>
    <el-descriptions-item :label="$t('始发仓')">{{ order.logisticsInfoDto.startTitleZh }}</el-descriptions-item>
    <el-descriptions-item :label="$t('目的仓')">{{ order.logisticsInfoDto.destTitleZh }}</el-descriptions-item>
  </el-descriptions>

  <div style="font-size: 14px">
    <p>{{ $t('申请理由') }}</p>
    <div v-for="(item, index) in feeList" :key="item.id">
      {{index + 1}}、【<dict-tag :type="DICT_TYPE.FEE_TYPE" :value="item.feeType" />】，
      <dict-tag :value="item.payType" :type="DICT_TYPE.PAYMENT_TYPE" ></dict-tag>，
      {{ item.applicationFee }}{{ currencyName(item.applicationFeeCurrency) }}
      {{$t('备注')}}：{{ item.remarks || $t('无')}}
    </div>
  </div>
</div>
</template>

<script>
import {
  warehouseApprovalGetByFormId,
  warehouseApprovalGetById,
  warehouseAreaPositionList
} from "@/api/ecw/batchSingleApplication";
import {
  applicationGetOrderByProcessId,
  feeApplicationGet, feeApplicationGetBatch, getBatchFeeByBusinessId, getBatchFeeByProcessId,
  getOrder,
  getOrderPage,
  getWarehouseUpdateApprovalInfo, qetBatchFeeByBusinessId
} from '@/api/ecw/order'

import { getChannelList } from '@/api/ecw/channel';
import Template from "@/views/cms/template";
import {getSupplierPage} from "@/api/ecw/supplier";
import { DICT_TYPE } from "@/utils/dict";

import { getCurrencyList } from "@/api/ecw/currency";
import {arrryToKeyedObjectBy} from '@/utils/index'
export default {
  components: {Template},
  props:{
    businessId: [Number, String],
    processInstanceId: String
  },
  name: "BatchFeeApplicationDetail",
  data(){
    return{
      order: null,
      feeList: [],
      currencyList:[]
    }
  },
  computed:{
    currencyMap(){
      return arrryToKeyedObjectBy(this.currencyList, 'id')
    },
    currencyName(){
      return id => {
        let obj = this.currencyMap[id]
        if(obj) return this.$l(obj, 'title')
        return this.$t('未知')
      }
    }
  },
  created() {
    getCurrencyList().then(res => {
      this.currencyList = res.data
    })
    getBatchFeeByBusinessId(this.businessId).then(res => {
      console.log({res})
      this.feeList = res.data
      return getOrder(res.data[0].orderId)
    }).then(res => {
      this.order = res.data
    })
  },
  methods:{

  }
}
</script>
