<template>
	<view class="intro-page common">
		<view class="top-class"></view>
		<view class="title">
			产品溯源
		</view>
		<view class="head">
			<u-row class="row-class">
				<u-col span="4">
					<image class="logo-img" src="/static/images/common/logo.png" mode="aspectFit" />
				</u-col>
				<u-col span="4">
					<image class="commodity-img" src="/static/images/common/commodity.png" mode="aspectFit" />
				</u-col>
				<u-col span="4">

				</u-col>
			</u-row>
		</view>

		<view class="theme-text">
			<image src="https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/guzhenganzi/text.png"
				class="textImage"></image>
		</view>
		<!-- 公司简介内容卡片 -->
		<view class="intro-card">
			<view class="image-display">
				<image class="company-img" src="https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/guzhenganzi/companyImg.png" mode="aspectFill" />
			</view>
			<view class="intro-view">
				<view class="intro-label">
					<view class="label-title">
						产品信息
					</view>
				</view>
				<view class="intro-content">
					<u-row class="row-class" customStyle="margin-bottom: 5px">
						<u-col span="4">
							<view class="item-left item-text">产品名称</view>
						</u-col>
						<u-col span="8">
							<view class="item-text">{{info.productName}}</view>
						</u-col>
					</u-row>
					<u-row class="row-class" customStyle="margin-bottom: 5px">
						<u-col span="4">
							<view class="item-left item-text">生产日期</view>
						</u-col>
						<u-col span="8">
							<view class="item-text">{{info.formatted_time}}</view>
						</u-col>
					</u-row>
					<u-row class="row-class" customStyle="margin-bottom: 5px">
						<u-col span="4">
							<view class="item-left item-text">批&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号</view>
						</u-col>
						<u-col span="8">
							<view class="item-text">{{info.pici}}</view>
						</u-col>
					</u-row>
					<u-row class="row-class" customStyle="margin-bottom: 5px">
						<u-col span="4">
							<view class="item-left item-text">保&nbsp;&nbsp;质&nbsp;&nbsp;期</view>
						</u-col>
						<u-col span="8">
							<view class="item-text">60天</view>
						</u-col>
					</u-row>
				</view>
			</view>
			<view class="intro-view" >
				<view class="intro-label" style="right: 20px;">
					<view class="label-title">
						产家信息
					</view>
				</view>
				<view class="intro-content">
					<u-row class="row-class" customStyle="margin-bottom: 5px">
						<u-col span="4">
							<view class="item-left item-text">出&nbsp;&nbsp;品&nbsp;&nbsp;商</view>
						</u-col>
						<u-col span="8">
							<view class="item-text">湖南王爷山食品股份有限公司</view>
						</u-col>
					</u-row>
					<u-row class="row-class" customStyle="margin-bottom: 5px">
						<u-col span="4">
							<view class="item-left item-text">生产地址</view>
						</u-col>
						<u-col span="8">
							<span class="item-text">湖南省娄底市新化县</span>
						</u-col>
					</u-row>
					<u-row class="row-class">
						<u-col span="4">
							<view class="item-left item-text">商标名称</view>
						</u-col>
						<u-col span="8">
							<view class="item-text">梅山古镇</view>
						</u-col>
					</u-row>
				</view>
			</view>
      <view style="height:5px"></view>
			
		</view>

		<!-- 返回按钮 -->
		<view class="footer-btn">
			<view  @click="goBack" class="return-button">返回</view>
		</view>
	</view>
</template>

<script>
	import {
		suyuanData
	} from '@/api/scan'
	export default {
		data() {
			return {
				scanCode:'',
				info:{}
			}
		},
		onLoad() {
			this.scanCode = uni.getStorageSync('scanCode');
			this.initData();
		},
		methods: {
			goBack() {
				uni.navigateBack();
			},
			initData(){
				suyuanData(this.scanCode).then(res => {
					console.log(res)
					if (res.code == 0) {
						this.info = res.data.info;
						this.info.formatted_time = this.info.create_time.split(' ')[0];
					}
				})
			}
			
		}
	}
</script>

<style lang="scss" scoped>
	@import url('../../../static/scss/common.css');

	.row-class {
		height: 60rpx;
	}

	.logo-img {
		background-size: cover;
		/* 确保背景图片自适应填充整个容器 */
		background-position: center;
		/* 背景图片居中显示 */
		background-repeat: no-repeat;
		/* 防止背景图重复 */
		height: 42rpx;
		width: 62%;
	}

	.commodity-img {
		background-size: cover;
		/* 确保背景图片自适应填充整个容器 */
		background-position: center;
		/* 背景图片居中显示 */
		background-repeat: no-repeat;
		/* 防止背景图重复 */
		height: 35rpx;
		width: 100%;
	}

	.theme-text {
		height: 10vh;
		text-align: center;
		line-height: 11vh;

		.textImage {
			height: 80rpx;
			width: 400rpx;
		}
	}

	.intro-card {
		margin: 0 32rpx;
		background: rgba(131, 100, 71, 0.5);
		border-radius: 10rpx;
    max-height: 65vh;
    overflow: auto;

		.intro-view {
			border: 2rpx solid #341B10;
			padding: 20rpx;
			margin: 20rpx;
			position: relative;
			margin-top: 30rpx;

			.intro-label {
				background-image:
					url("https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/guzhenganzi/label.png");
				/* 使用绝对路径 */
				background-size: contain;
				background-repeat: no-repeat;
				width: 220rpx;
				height: 120rpx;
				position: absolute;
				margin-top: -70rpx;
				align-content: center;
				margin-left: -28rpx;

				.label-title {
					font-weight: bold;
					font-size: 30rpx;
					color: #341B10;
					text-align: center;
					margin-left: 10px;
					height: 120rpx;
					line-height: 110rpx;
				}
			}

			.intro-content {
				font-size: 28rpx;
				color: #5c4322;
				line-height: 1.8;
				margin-top: 20rpx;
				text-align: justify;
			}


		}

	}
	.image-display{
		text-align: center;
		.company-img {
			width: 80%;
			height: 240rpx;
			border-radius: 12rpx;
			object-fit: cover;
			margin-top: 20rpx;
			background: #eee;
		}
	}
	::v-deep .item-left{
		background: #442812;
		border-radius: 6rpx !important;
		text-align: center;
		width: 160rpx !important;
	}
	.item-text{
		font-weight: 500;
		font-size: 30rpx;
		color: #FFFFFF;
	}


</style>