2026-05-25 09:27:16 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<view class="recent-scan-list">
|
|
|
|
|
|
<view v-if="records.length === 0" class="recent-scan-list__empty">
|
|
|
|
|
|
暂无扫码记录
|
|
|
|
|
|
</view>
|
2026-05-26 10:39:41 +08:00
|
|
|
|
|
2026-05-25 09:27:16 +08:00
|
|
|
|
<view
|
|
|
|
|
|
v-for="(record, index) in records"
|
|
|
|
|
|
:key="record.id || index"
|
2026-05-26 10:39:41 +08:00
|
|
|
|
class="scan-card"
|
|
|
|
|
|
:class="{ 'scan-card--latest': latestIndex === index }"
|
2026-05-25 09:27:16 +08:00
|
|
|
|
>
|
2026-05-26 10:39:41 +08:00
|
|
|
|
<view class="scan-card__header">
|
|
|
|
|
|
<text class="scan-card__name">{{ record.productName || '-' }}</text>
|
|
|
|
|
|
<text class="scan-card__delete" @tap="$emit('delete', index)">删除</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
<view class="scan-card__meta">
|
|
|
|
|
|
<text>条码:{{ record.productBarCode || '-' }}</text>
|
|
|
|
|
|
<text>规格:{{ record.productSpec || '-' }}</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="scan-card__meta">
|
|
|
|
|
|
<text>仓库:{{ record.warehouseName || '-' }}</text>
|
|
|
|
|
|
<text>单位:{{ record.productUnit || '-' }}</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="scan-card__meta">
|
|
|
|
|
|
<text>库位:{{ record.locationCode || '-' }}</text>
|
|
|
|
|
|
<text>批次:{{ record.batchNo || '-' }}</text>
|
2026-05-25 09:27:16 +08:00
|
|
|
|
</view>
|
2026-05-26 10:39:41 +08:00
|
|
|
|
<view class="scan-card__footer">
|
|
|
|
|
|
<text class="scan-card__time">{{ formatTime(record.scanTime) }}</text>
|
|
|
|
|
|
<text class="scan-card__count">{{ record.scanCount }}</text>
|
2026-05-25 09:27:16 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2026-05-26 10:39:41 +08:00
|
|
|
|
import type { ScanRecord } from '../index.vue'
|
|
|
|
|
|
|
2026-05-25 09:27:16 +08:00
|
|
|
|
defineProps<{
|
2026-05-26 10:39:41 +08:00
|
|
|
|
records: ScanRecord[]
|
2026-05-25 09:27:16 +08:00
|
|
|
|
latestIndex?: number
|
|
|
|
|
|
}>()
|
|
|
|
|
|
|
|
|
|
|
|
defineEmits<{
|
|
|
|
|
|
(event: 'delete', index: number): void
|
2026-05-26 10:39:41 +08:00
|
|
|
|
(event: 'clear'): void
|
2026-05-25 09:27:16 +08:00
|
|
|
|
}>()
|
|
|
|
|
|
|
2026-05-26 10:39:41 +08:00
|
|
|
|
function formatTime(time?: string) {
|
|
|
|
|
|
if (!time) return '-'
|
|
|
|
|
|
const date = new Date(time)
|
|
|
|
|
|
return `${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}:${date.getSeconds().toString().padStart(2, '0')}`
|
2026-05-25 09:27:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
.recent-scan-list {
|
|
|
|
|
|
&__empty {
|
2026-05-26 10:39:41 +08:00
|
|
|
|
padding: 48rpx;
|
|
|
|
|
|
border-radius: 16rpx;
|
|
|
|
|
|
background: #fff;
|
2026-05-25 09:27:16 +08:00
|
|
|
|
color: #86909c;
|
2026-05-26 10:39:41 +08:00
|
|
|
|
text-align: center;
|
|
|
|
|
|
font-size: 26rpx;
|
2026-05-25 09:27:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-26 10:39:41 +08:00
|
|
|
|
.scan-card {
|
|
|
|
|
|
margin-bottom: 16rpx;
|
|
|
|
|
|
padding: 24rpx;
|
|
|
|
|
|
border: 2rpx solid transparent;
|
|
|
|
|
|
border-radius: 16rpx;
|
|
|
|
|
|
background: #fff;
|
2026-05-25 09:27:16 +08:00
|
|
|
|
|
2026-05-26 10:39:41 +08:00
|
|
|
|
&--latest {
|
|
|
|
|
|
border-color: #1677ff;
|
|
|
|
|
|
box-shadow: 0 8rpx 20rpx rgba(22, 119, 255, 0.12);
|
2026-05-25 09:27:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-26 10:39:41 +08:00
|
|
|
|
&__header,
|
|
|
|
|
|
&__meta,
|
|
|
|
|
|
&__footer {
|
2026-05-25 09:27:16 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: space-between;
|
2026-05-26 10:39:41 +08:00
|
|
|
|
gap: 16rpx;
|
2026-05-25 09:27:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-26 10:39:41 +08:00
|
|
|
|
&__header {
|
|
|
|
|
|
margin-bottom: 10rpx;
|
2026-05-25 09:27:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&__name {
|
|
|
|
|
|
color: #1f2329;
|
2026-05-26 10:39:41 +08:00
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
font-weight: 600;
|
2026-05-25 09:27:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-26 10:39:41 +08:00
|
|
|
|
&__delete {
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
color: #f53f3f;
|
|
|
|
|
|
font-size: 24rpx;
|
2026-05-25 09:27:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&__meta {
|
2026-05-26 10:39:41 +08:00
|
|
|
|
margin-top: 6rpx;
|
|
|
|
|
|
color: #4e5969;
|
|
|
|
|
|
font-size: 22rpx;
|
|
|
|
|
|
flex-wrap: wrap;
|
2026-05-25 09:27:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-26 10:39:41 +08:00
|
|
|
|
&__footer {
|
|
|
|
|
|
margin-top: 10rpx;
|
|
|
|
|
|
padding-top: 10rpx;
|
|
|
|
|
|
border-top: 2rpx solid #f2f3f5;
|
2026-05-25 09:27:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&__time {
|
|
|
|
|
|
color: #86909c;
|
2026-05-26 10:39:41 +08:00
|
|
|
|
font-size: 22rpx;
|
2026-05-25 09:27:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-26 10:39:41 +08:00
|
|
|
|
&__count {
|
|
|
|
|
|
color: #1677ff;
|
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
font-weight: 700;
|
2026-05-25 09:27:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|