<!--拆单审核中的申请信息部分-->
<template>
    <div v-if="order">
        <el-descriptions :column="3">
            <el-descriptions-item label="订单号">{{detail.orderNo}}</el-descriptions-item>
            <el-descriptions-item label="运输方式">
                <dict-tag :type="DICT_TYPE.TRANSPORT_TYPE" :value="order.transportId" />
            </el-descriptions-item>
            <el-descriptions-item label="出货方式">
                {{channelName}}
            </el-descriptions-item>
            <el-descriptions-item label="订单状态">
                <dict-tag :type="DICT_TYPE.ORDER_STATUS" :value="order.status" />
            </el-descriptions-item>
            <el-descriptions-item label="唛头">{{order.marks}}</el-descriptions-item>
            <el-descriptions-item label="始发仓">{{$l(order.logisticsInfoDto, 'startTitle')}}</el-descriptions-item>
            <el-descriptions-item label="目的仓">{{$l(order.logisticsInfoDto, 'destTitle')}}</el-descriptions-item>

            <!-- 放货修改 -->
            <el-descriptions-item label="放货件数" v-if="applyType == 7">
                【{{detail.pickNum}}】{{$t('改')}} {{detail.currentPickNum}}
            </el-descriptions-item>

            <!-- 反复核 -->
            <el-descriptions-item label="申请原因" v-if="applyType == 8">
                <dict-tag :type="DICT_TYPE.ECW_PICK_RECURRENT_NUCLEAR_TYPE" :value="detail.recurrentNuclearType" />
            </el-descriptions-item>
            
            <!-- 调货 -->
            <el-descriptions-item label="申请原因" v-if="applyType == 9">
                {{detail.reason}}
            </el-descriptions-item>

            <!-- 取消放货 -->
            <el-descriptions-item label="申请原因" v-if="applyType == 10">
                <dict-tag :type="DICT_TYPE.ECW_CANCEL_PICK_TYPE" :value="detail.cancelPickType" />
            </el-descriptions-item>

        </el-descriptions>
    </div>
</template>
<script>
import {getPickUpdateApproveInfo} from '@/api/ecw/orderCargoControl'
import {getOrder} from '@/api/ecw/order'
import {getChannelListByIds} from '@/api/ecw/channel'
import {parseTime} from '@/utils/ruoyi'
export default {
    filters: {parseTime},
    props:{
        id: [String, Number],
        applyType: Number, // 申请类型   7 放货修改申请 8 放货反复核申 9 调货审核
    },
    data(){
        return {
            detail: null,
            order: null,
            channels: [],
            channelName: '/'
        }
    },
    watch:{
        id(){
            this.getData()
        }
    },
    computed:{
        jsonParse(){
            return d => {
                return JSON.parse(d)
            }
        },
        getChannelName(){
            return id => {
                let channel = this.channels.find(item => item.channelId == id)
                return channel ? channel.nameZh : '/'
            }
        }
    },
    created(){
        if(this.id){
            this.getData()
        }
    },
    methods:{
        getData(){
            getPickUpdateApproveInfo({approveId: this.id}).then(res => {
                this.detail = res.data
                return getOrder(this.detail.orderId)
            }).then(res => {
                this.order = res.data
                this.getChannel()
            })
        },
         getChannel(){
            if(!this.order || !this.order.channelId) return 
            getChannel(this.order.channelId).then(res => {
                this.channelName = this.$l(res.data, 'name')
            })
        },
    }
}
</script>
<style scoped lang="scss">
.title{
    padding: 10px 0;
    span{
        font-size: 14px;
        font-weight: bold;
    }
}
</style>