<template>
    <div>
        <div style="padding: 16px">
            <div>
                <div>
                    <span style="font-size: 18px;font-weight: 600;"> 分配入库详情</span>
                </div>
                <div style="margin-top: 16px">
                    <a-descriptions bordered :column="{  sm: 2, xs: 1 }" class="dis_title_local">
                        <a-descriptions-item label="发货单位">
                            {{detailInfo.sendUnitName || '--'}}
                        </a-descriptions-item>
                        <a-descriptions-item label="分配日期">
                            {{detailInfo.sendDate || '--'}}
                        </a-descriptions-item>
                        <a-descriptions-item label="发货人姓名">
                            {{detailInfo.sendContact || '--'}}
                        </a-descriptions-item>
                        <a-descriptions-item label="联系电话">
                            {{detailInfo.sendPhone || '--'}}
                        </a-descriptions-item>
                        <a-descriptions-item label="供应商">
                            {{detailInfo.supplierName || '--'}}
                        </a-descriptions-item>
                        <a-descriptions-item label="品牌">
                            {{detailInfo.brandName || '--'}}
                        </a-descriptions-item>
                        <a-descriptions-item label="批次号">
                            {{detailInfo.batchNumber || '--'}}
                        </a-descriptions-item>
                        <a-descriptions-item label="生产日期">
                            {{detailInfo.produceDate || '--'}}
                        </a-descriptions-item>
                        <a-descriptions-item label="有效期至">
                            {{detailInfo.expireDate || '--'}}
                        </a-descriptions-item>
                        <a-descriptions-item label="单价">
                            {{detailInfo.unitPrice || '--'}}<span>元</span>
                        </a-descriptions-item>
                        <a-descriptions-item label="数量">
                            {{detailInfo.sendNum || '--'}}
                        </a-descriptions-item>

                        <a-descriptions-item label="入库状态">
                           <!-- <div :class="detailInfo.statusName == '待入库' ? 'ready_stock' : 'in_stock'">
                                <span> {{detailInfo.statusName || '&#45;&#45;'}}</span>
                            </div>-->
                            <a-tag color="green" v-if="detailInfo.status == 2" >
                                {{detailInfo.statusName || '--'}}
                            </a-tag>
                            <a-tag color="orange" v-if="detailInfo.status == 1" >
                                {{detailInfo.statusName || '--'}}
                            </a-tag>
                        </a-descriptions-item>
                        <a-descriptions-item label="入库操作人" v-if="detailInfo.status == 2">
                            {{detailInfo.receiver || '--'}}
                        </a-descriptions-item>
                        <a-descriptions-item label="入库时间" v-if="detailInfo.status == 2">
                            {{detailInfo.receiveDate || '--'}}
                        </a-descriptions-item>
                        <a-descriptions-item label="备注" :span="3">
                            {{detailInfo.remarks || '--'}}
                        </a-descriptions-item>
                    </a-descriptions>
                    <!--<a-form-model ref="formRef"
                                  :labelCol="{span: 4}"
                                  :wrapperCol="{span: 16}"
                                  style="margin-top: 20px"
                    >
                        <a-form-model-item label="备注"
                                           prop="remarks"
                                           :labelCol="{span: 5}"
                                           :wrapperCol="{span: 15}">
                            <a-textarea
                                    :disabled="true"
                                    v-toRemarkNum
                                    :rows="6"
                                    v-model="detailInfo.remarks"
                                    placeholder="请输入备注"></a-textarea>
                        </a-form-model-item>
                    </a-form-model>-->
                </div>
            </div>
            <div style="text-align: center;margin-top: 16px">
                <a-button class="ant-table-btn" @click="goBack">关闭</a-button>
            </div>
        </div>
    </div>
</template>
<script>
    import moment from 'moment';
    import {closedDetail} from "../../../utils/common";

    export default {
        data() {
            return {
                routerParams: {},
                detailInfo: {},
            }
        },
        created() {
            this.routerParams = this.$route.query
            this.getReceiveDetails()
        },
        methods: {
            getReceiveDetails() {
                let par = {
                    id: this.routerParams.id,
                    menuId: this.routerParams.menuId
                }
                this.$api.stockManage.fetchReceiveDetails(par).then(({data = [], code}) => {
                    this.detailInfo = data
                })
            },
            goBack() {
                window.top.postMessage({messageType:'THIRD_PAGECHANGE',name:`${this.routerParams.menuCode}`,source:"yesuan"}, '*')
                // closedDetail('/inStock/inStockManageDetail', '/Home/distributionWarehousing')
            }
        },
    }
</script>
<style lang="less" scoped>
    .ready_stock {
        border-radius: 2px;
        width: 62px;
        text-align: center;
        padding: 2px 8px;
        background:#FFF7E6;
        border: 1px solid #FFD591;
        color: #FA8C16
    }
    .in_stock {
        border-radius: 2px;
        width: 62px;
        text-align: center;
        padding: 2px 8px;
        /*background: lightgreen;*/
        border: 1px solid #52C41A;
        color: #52C41A
    }
</style>

<style lang="less">
    .dis_title_local {
        .ant-descriptions-item-label {
            width: 120px;
        }
    }
</style>
