<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="https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/cjx/logo.png"
						mode="aspectFit" />
				</u-col>
				<u-col span="4">
					<image class="commodity-img"
						src="https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/cjx/commodity.png"
						mode="aspectFit" />
				</u-col>
				<u-col span="4">
					<image class="logo-rules"
						src="https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/cjx/rules.png"  @click="openDetail"/>
				</u-col>
			</u-row>
		</view>
		<view class="topImg">
			<image class="img_1" src="https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/cjx/topImg.png"
				mode="heightFix" />
		</view>
		<!-- 公司简介内容卡片 -->
		<view class="content">
			<view class="cardTop"></view>
			<view class="content_text">
				<view class="content_imgView">
					<image class="img_2" src="https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/cjx/shangping.png"
						mode="heightFix" />
				</view>
			
				<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">超吉炫</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">低纤槟榔胶果（槟榔制品）</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">见包装喷码区</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">18个月</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">武汉市胜昌经贸有限公司</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">湖南长沙</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">湖南湘潭市湘潭县</view>
					</u-col>
				</u-row> -->
			</view>
			<view class="return_view">
				<view class="return-button" @click="goBack">返回</view>
			</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];
					}
				})
			},
			openDetail(){
				uni.navigateTo({
					url: '/pages/cjx/index/rules'
				});
			}

		}
	}
</script>

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

	.row-class {
		height: 60rpx;
	}

	.cardTop{
		background-image:
			url("https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/cjx/cpsy.png");
	}
	
	.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 {
		border-radius: 6rpx !important;
		text-align: center;
		width: 160rpx !important;
	}

	.item-text {
		font-weight: 500;
		font-size: 30rpx;
		color: #FFFFFF;
	}
	.content {
		height: 69vh;
		border-radius: 10rpx;
		margin: 0rpx 40rpx;
		padding: 10rpx 24rpx;
		overflow: auto;
		align-items: center;
		justify-content: center;
		background-image:
			url("https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/cjx/cardBgi.png");
		background-size: cover;
		background-position: center;
		background-repeat: no-repeat;
		
	}
	.img_2{
		height: 240rpx;
	}
	.content_imgView{
		display: flex;
		justify-content: center;
	}
</style>