<!--拆单审核中的申请信息部分-->
<template>
    <div v-if="detail && order">
        <el-descriptions :column="4" v-if="order" :colon="false">
            <el-descriptions-item :label="$t('订单号')">{{order.orderNo}}</el-descriptions-item>
            <el-descriptions-item :label="$t('运输方式')">
                <dict-tag class="mr-10" :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="order.transportId" />
            </el-descriptions-item>
            <el-descriptions-item :label="$t('出货方式')">
                {{channel ? channel.nameZh : '/'}}
            </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('目的仓')" :span="2">
                {{order.logisticsInfoDto.destAddressZh}}
            </el-descriptions-item>

            <!-- 提单审核 -->
            <el-descriptions-item v-if="path == 'order_landing_bill'">
                <el-button type="primary" @click="ShowLandingBill=true">查看提单</el-button>
            </el-descriptions-item>
        </el-descriptions>

        <PrintLandingBill :order-id="order.orderId" v-if="ShowLandingBill" @close="ShowLandingBill=false"/>
    </div>
</template>
<script>
import {getOrder, getApproval} from '@/api/ecw/order'
import {getChannel} from '@/api/ecw/channel'
/* 
优惠申请	1
管理优惠	2
佣金设置	3
重货优惠	4
泡货优惠	5
拆单申请	6
控货订单放货修改	7
控货订单反复核	8
控货订单已放货记录调货审批	9
控货订单取消放货	10
合单申请	11
费用申请	12
调仓申请	13
订单修改	14
预装审核	18
封柜审核	19
入仓修改	22
退仓	23
*/
export default {
    name: 'OrderApprovalDetail',
    props:{
        id: [String, Number],
        path: String
    },
    components:{
        PrintLandingBill: () => import('./PrintLadingBill.vue')
    },
    data(){
        return {
            detail: null,
            order: null,
            channel: null,
            ShowLandingBill: false
        }
    },
    watch:{
        id(){
            this.getData()
        },
        detail(){
            this.getOrder()
        },
        order(){
            if(this.order.channelId){
                this.getChannel()
            }
        }
    },
    created(){
        if(this.id){
            this.getData()
        }
    },
    methods:{
        getData(){
            getApproval(this.id).then(res => {
                this.detail = JSON.parse(res.data.details)
            })
        },
        getOrder(){
            getOrder(this.detail.orderId).then(res => {
                this.order = res.data
            })
        },
        getChannel(){
            getChannel(this.order.channelId).then(res => {
                this.channel = res.data
            })
        },
    }
}
</script>
<style scoped lang="scss">
.title{
    padding: 10px 0;
    span{
        font-size: 14px;
        font-weight: bold;
    }
}
</style>