<template>
    <view>
        <view>
            <view class="detailInfo mb-2">
                <view class="line title">
                    <p> {{ typeName + '单号' }}：{{ detailInfo?.billNo }}</p>
                    <span :style="getColor(detailInfo?.billType)">
                        {{ getBillType(detailInfo?.billType, detailInfo?.status, flag) }}
                    </span>

                </view>
                <p class="line content">仓库：
                    <span> {{ detailInfo?.warehouseName }}</span>
                </p>
                <p class="line content">存储区：
                    <span> {{ detailInfo?.areaName }}</span>
                </p>
                <p class="line content">开单时间：
                    <span>{{ formatDate(detailInfo?.createTime) }}</span>
                </p>
                <p class="line content" v-if="detailInfo?.inboundTime">{{ typeName + '时间' }} ：
                    <span>{{ formatDate(detailInfo?.inboundTime) }}</span>
                </p>
            </view>
            <view class="detailInfo mb-6">
                <p class="line content">
                    <span class="grey" style="font-weight: 600;">详细备注：</span>

                    <span>{{ detailInfo?.billRemark || '-' }}</span>
                </p>
            </view>
        </view>
        <!-- 物料列表 -只读 -->
        <view>
            <material-list ref="materialRef" isEdit="3" :extendData="{ billType: detailInfo?.billType }"
                :pathParams="{ billNo: detailInfo?.billNo }" backStr="stockInDetail"
                :formData="{ material: detailInfo.itemList }" />
        </view>

    </view>

</template>
<script setup>
import { getBillType, formatDate, getColor } from '../until'
import { computed, toRefs } from 'vue';
import MaterialList from './MaterialList.vue'
import { includes } from 'lodash';
const props = defineProps({
    // 查询列表类型 stockIn:入库  stockOut：出库
    type: {
        type: String,
        default: '',
        required: true
    },
    detailInfo: {
        type: Object,
        default: {},
        required: true
    }

})
const { type, detailInfo } = toRefs(props)
const typeName = computed(() => includes(type.value, 'stockIn') ? '入库单' : '出库单')
const flag = computed(() => includes(type.value, 'stockIn') ? 0 : 1)
</script>

<style scoped lang="scss">
.line {
    display: flex;
    background-color: #fff;
    align-items: center;
    padding: 6rpx 20rpx;
}

.title {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 13px;
}

.content {
    font-weight: 500;
    font-size: 13px;
}
</style>