<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="intro-view">
				<view class="intro-label">
					<view class="label-title">
						扫码记录
					</view>
				</view>
				<view class="intro-content">
					<view class="filter-btn-group">
						<view class="row-text">发放状态：</view>
						<view v-for="(item, idx) in filterOptions" :key="idx"
							:class="['filter-btn', filterStatus === item.value ? 'active' : '']"
							@click="onFilterChange(item.value)">
							{{ item.label }}
						</view>
					</view>
					<view class="filter-btn-group list-title">
						<view class="son">
							奖品名称
						</view>
						<view class="son">
							中奖时间
						</view>
						<view class="son">
							兑换状态
						</view>

						<view>
							操作
						</view>
					</view>
					<view class="content-list">
						<image v-if="list == null || list.length == 0 " src="https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/guzhenganzi/noData.png" mode="aspectFit"></image>
						<template v-for="(item, index) in list" >
							<view class="row-one" :key="index">
								<view class="filter-btn-group">
									<view class="son">
										{{ item.prize_name }}
									</view>
									<view class="son">
										{{ item.zhongjiang_time }}
									</view>
									<view class="son">
										{{ item.duijiang_status }}
									</view>
									<view class="detail-btn" @click="toggleDetail(index)">
										详情
									</view>
								</view>

								<!-- 只有当 detailVisible 为 true 时才显示 detail 部分 -->
								<view class="detail" v-if="item.detailVisible">
									<view class="text-one">
										盲盒名称：{{item.prize_detail}}
									</view>
									<view class="text-two">
										发放时间：{{ item.send_time != undefined ? item.send_time : '--'  }} <!-- 这里可以填入合适的数据 -->
									</view>
								</view>
							</view>
						</template>

					</view>
				</view>

			</view>

		</view>

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

<script>
import {
  scanQuery
} from '@/api/scan'
import recordMixin from '@/mixins/recordMixin.js'

export default {
  mixins: [recordMixin],
  onLoad() {
    this.scanCode = uni.getStorageSync('scanCode');
    // 调用 mixin 中的通用方法
    this.baseInitGetlist(scanQuery);
  },
  methods: {
    initGetlist() {
      // 调用 mixin 中的通用方法
      this.baseInitGetlist(scanQuery);
    },
    openDetail() {
      uni.navigateTo({
        url: '/pages/lgz/index/rules'
      });
    },
  }
}
</script>

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

	.row-class {
		height: 80rpx;
	}

	.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: 0rpx 24rpx;
		padding: 30rpx 0rpx 24rpx 0rpx;
		background: rgba(131, 100, 71, 0.5);
		border-radius: 10rpx;

		.intro-view {
			border: 1px solid #341B10;
			padding: 20rpx 4rpx;
			margin: 20rpx;
			position: relative;
			height: 56vh;

			.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;

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

			.intro-content {
				height: 100%;
				margin: 30rpx 4rpx;
			}



		}

	}

	.filter-btn-group {
		display: flex;
		justify-content: flex-start;
		align-items: center;
		gap: 24rpx;
		margin: 10rpx 0 10rpx 0;
	}

	.filter-btn {
		padding: 4rpx 20rpx;
		border: 2rpx solid #b22222;
		color: #b22222;
		font-size: 28rpx;
		transition: all 0.2s;
	}

	.filter-btn.active {
		background: #b22222;
		color: #fff;
		border: 2rpx solid #b22222;
	}

	.row-text {
		font-weight: bold;
		font-size: 14px;
		color: #FFFFFF;
	}

	.list-title {
		font-weight: bold;
		font-size: 28rpx;
		color: #FFFFFF;
	}

	.son {
		width: 140rpx;
	}

	.row-one {
		font-weight: 400;
		font-size: 28rpx;
		color: #FFFFFF;
	}

	.detail {
		background-image: url("https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/guzhenganzi/detailImg.png");
		background-size: cover;
		/* 确保背景图片自适应填充整个容器 */
		background-position: inherit;
		/* 背景图片居中显示 */
		background-repeat: no-repeat;
		/* 防止背景图重复 */
		height: 134rpx;

		.text-one{
			height: 70rpx;
			line-height: 90rpx;
			text-align: left;
			margin-left: 20rpx;
		}
		.text-two{
			text-align: left;
			height: 60rpx;
			line-height: 60rpx;
			margin-left: 20rpx;

		}

	}



	.detail-btn {
		color: #9B0000;
	}

	.content-list {
		overflow: auto;
		text-align: center;
    height: calc(100% - 120rpx);
	}
</style>
