Files
sh-app/scanpages/hj/materials_detail.vue
T
2026-06-18 15:10:50 +08:00

271 lines
5.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="detail-page">
<!-- 代码标识 MaterialCode 拆解展示 -->
<view class="code-hero">
<view class="code-hero__tag">扫描结果</view>
<view class="code-hero__body">
<text class="code-hero__text">{{ info.MaterialCode || '--' }}</text>
</view>
</view>
<!-- 身份信息 -->
<view class="section">
<view class="section__header">
<view class="section__bar"></view>
<text class="section__title">材料信息</text>
</view>
<view class="card">
<view class="card__row">
<text class="card__label">编码</text>
<text class="card__value card__value--mono">{{ info.Code || '--' }}</text>
</view>
<view class="card__row">
<text class="card__label">炉号</text>
<text class="card__value card__value--mono">{{ info.HeatNo || '--' }}</text>
</view>
<view class="card__row">
<text class="card__label">批号</text>
<text class="card__value card__value--mono">{{ info.BatchNo || '--' }}</text>
</view>
<view class="card__row">
<text class="card__label">名称</text>
<text class="card__value">{{ info.MaterialName || '--' }}</text>
</view>
<view class="card__row">
<text class="card__label">规格</text>
<view class="card__value-wrap">
<text class="card__value">{{ info.MaterialSpec || '--' }}</text>
</view>
</view>
<view class="card__row">
<text class="card__label">单位</text>
<view class="card__value-wrap">
<view class="badge badge--unit">{{ info.MaterialUnit || '--' }}</view>
</view>
</view>
</view>
</view>
<!-- 描述 -->
<view class="section" v-if="info.MaterialDef">
<view class="section__header">
<view class="section__bar"></view>
<text class="section__title">描述</text>
</view>
<view class="card">
<text class="desc-text">{{ info.MaterialDef }}</text>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { reqMaterialInfoByMaterialCode } from '@/api/hj.js'
const info = ref({})
onLoad((opt) => {
if (opt.id) {
try {
reqMaterialInfoByMaterialCode(encodeURIComponent(opt.id)).then(res=>{
if(res.code == 1){
info.value = res.data
}
})
} catch (e) {
console.error('解析材料数据失败:', e)
}
}
})
</script>
<style lang="scss" scoped>
$primary: #2979ff;
$primary-light: #e8f0fe;
$primary-dark: #1a56cc;
$bg: #f5f7fa;
$text: #1a2332;
$text-secondary: #6b7c93;
$border: #e2e8f0;
$card-bg: #ffffff;
$radius: 16rpx;
.detail-page {
min-height: 100vh;
background: $bg;
padding-bottom: 48rpx;
}
// ===== 代码标识区 =====
.code-hero {
margin: 24rpx;
background: $card-bg;
border-radius: $radius;
overflow: hidden;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
padding-bottom: 24rpx;
&__tag {
display: inline-flex;
align-items: center;
margin: 28rpx 0 0 28rpx;
padding: 4rpx 16rpx;
font-size: 22rpx;
color: $primary;
background: $primary-light;
border-radius: 6rpx;
font-weight: 500;
}
&__body {
padding: 20rpx 28rpx 0;
}
&__text {
display: block;
font-size: 34rpx;
font-weight: 700;
color: $text;
line-height: 1.4;
word-break: break-all;
font-family: monospace;
letter-spacing: 0.5rpx;
}
}
// ===== 区块标题 =====
.section {
margin: 0 24rpx 20rpx;
&__header {
display: flex;
align-items: center;
gap: 12rpx;
margin-bottom: 16rpx;
padding: 0 4rpx;
}
&__bar {
width: 6rpx;
height: 28rpx;
background: $primary;
border-radius: 3rpx;
flex-shrink: 0;
}
&__title {
font-size: 28rpx;
font-weight: 600;
color: $text;
}
}
// ===== 卡片 =====
.card {
background: $card-bg;
border-radius: $radius;
overflow: hidden;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
&__row {
display: flex;
align-items: center;
padding: 24rpx 28rpx;
border-bottom: 1rpx solid $border;
&:last-child {
border-bottom: none;
}
}
&__label {
width: 120rpx;
font-size: 26rpx;
color: $text-secondary;
flex-shrink: 0;
}
&__value {
flex: 1;
font-size: 28rpx;
color: $text;
font-weight: 500;
&--mono {
font-family: monospace;
color: $primary-dark;
}
}
&__value-wrap {
flex: 1;
display: flex;
align-items: center;
gap: 12rpx;
}
}
// ===== 单位徽章 =====
.badge--unit {
display: inline-flex;
align-items: center;
padding: 4rpx 16rpx;
font-size: 22rpx;
font-weight: 600;
color: $primary;
background: $primary-light;
border-radius: 6rpx;
letter-spacing: 2rpx;
}
// ===== 描述文本 =====
.desc-text {
display: block;
padding: 28rpx;
font-size: 28rpx;
color: $text;
line-height: 1.6;
}
// ===== 批次追溯网格 =====
.trace-grid {
display: flex;
gap: 16rpx;
.trace-cell {
flex: 1;
background: $card-bg;
border-radius: $radius;
padding: 28rpx 20rpx 24rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
display: flex;
flex-direction: column;
align-items: center;
gap: 8rpx;
border-top: 4rpx solid $primary;
&__label {
font-size: 22rpx;
color: $text-secondary;
font-weight: 500;
}
&__value {
font-size: 32rpx;
font-weight: 700;
color: $text;
font-family: monospace;
text-align: center;
word-break: break-all;
}
&__sub {
font-size: 20rpx;
color: #b0bccf;
letter-spacing: 1rpx;
}
}
}
</style>