<template>
	<view class="myCard">
		<view class="cardTopName">
			<text>{{ item.order_no }}</text>
			<text class="statusTag" :class="'status-' + item.audit_status">{{ item.audit_status_name }}</text>
		</view>
		<view class="cardRow">
			<view>加工单位：</view>
			<view>{{ item.process_name || '-' }}</view>
		</view>
		<view class="cardRow">
			<view>仓库名称：</view>
			<view>{{ item.warehouse_name || '-' }}</view>
		</view>
		<view class="cardRow">
			<view>匹数总计：</view>
			<view>{{ item.total_roll != null ? item.total_roll : '-' }}</view>
		</view>
		<view class="cardRow">
			<view>创 建 人：</view>
			<view>{{ item.create_user_name }} {{ formatTime(item.create_time, 'YYYY-MM-DD') }}</view>
		</view>
		<view v-if="item.auditor_name" class="cardRow">
			<view>审 核 人：</view>
			<view>{{ item.auditor_name }} {{ formatTime(item.audit_date, 'YYYY-MM-DD') }}</view>
		</view>
		<view v-if="!isDetail && !isSelect" class="lookDetail">
			<text>查看详情</text>
			<u-icon name="arrow-right" size="36" />
		</view>
	</view>
</template>

<script>
import { formatDisplayTime } from '@/common/storeGoodsProcessIn';

export default {
	props: {
		item: { type: Object, default: () => ({}) },
		index: { type: Number, default: 0 },
		isSelect: { type: Boolean, default: false },
		isDetail: { type: Boolean, default: false },
	},
	methods: {
		formatTime: formatDisplayTime,
	},
};
</script>

<style scoped>
.cardTopName {
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.statusTag {
	font-size: 24rpx;
	padding: 4rpx 12rpx;
	border-radius: 6rpx;
	font-weight: normal;
}
.status-0 { background: #f0f0f0; color: #666; }
.status-1 { background: #fff7e6; color: #fa8c16; }
.status-2 { background: #f6ffed; color: #52c41a; }
.status-3 { background: #fff1f0; color: #f5222d; }
.status-4 { background: #f5f5f5; color: #999; }
</style>
