<!-- 电影列表 -->
<template>
	<view class="main" @tap="TofilmDesc(data)">
		<view class="main-data" v-if="data.publishStatus == 'WAIT'">{{data.publishDate}}</view>
		<view class="main-wrap">
			<view class="main-image">
				<image :src="data.posterUrl"></image>
			</view>
			<view class="main-content">
				<view class="main-left">
					<view class="main-title">{{data.movieName}}</view>
					<view class="main-sub">导演：{{data.director}}</view>
					<view class="main-role">主演：{{data.cast}}</view>
					<view class="main-tag">
						<text class="tag" v-if="data.versionType">
							{{data.versionType}}
						</text>
						<text class="tag" v-if="data.movieType">
							{{data.movieType}}
						</text>
					</view>
					<view class="main-score" v-if="tabActive == 0">
						评分：<text>{{data.grade}}</text>
					</view>
					<view class="main-score" v-else>
						<text>100</text>人想看
					</view>
				</view>
				<view class="main-right" v-if="data.publishStatus == 'HOT'">
					<view class="stop" v-if="data.stopSellTime">
						停售
					</view>
					<view class="buy" v-else @tap.stop="buyBill(data)">
						购票
					</view>
				</view>
				<view class="main-right" v-else>
					<view class="presell">
						预售
					</view>
					<!-- <view class="want">
						想看
					</view> -->
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "film-item",
		props: {
			tabActive: {
				type: Number,
				default: function () {
					return 0
				}
			},
			// 电影数据
			data: {
				type: Object,
				default: function () {
					return {}
				}
			},
			cinemaData: {
				type: Object,
				default: function () {
					return {}
				}
			},
			// 跳转场次or影院(默认影院)
			isPlay: {
				type: Boolean,
				default: function () {
					return false
				}
			},
		},
		computed: {
		},
		methods: {
			// 详情
			TofilmDesc(data) {
				uni.navigateTo({
					url: `../../pages/film/filmDesc?filmData=${encodeURIComponent(JSON.stringify(data))}`
				})
			},
			// 购票
			buyBill(data) {
				// 去场次
				if (this.isPlay) {
					uni.navigateTo({
						url: `../../pages/film/filmPlay?cinemaData=${encodeURIComponent(JSON.stringify(this.cinemaData))}&filmData=${encodeURIComponent(JSON.stringify(data))}`,
					})
				} else {
					// 查影院
					uni.navigateTo({
						url: `../../pages/film/filmYuan?filmData=${encodeURIComponent(JSON.stringify(data))}`
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.main {
		margin-bottom: 20rpx;
		.main-data {
			margin-bottom: 24rpx;
			font-size: 26rpx;
			font-family: PingFangSC-Semibold, PingFang SC;
			font-weight: 600;
			color: #333333;
			line-height: 40rpx;
		}
		.main-wrap {
			padding: 24rpx;
			width: 100%;
			height: 260rpx;
			background: #FFFFFF;
			box-shadow: 0rpx 1rpx 4rpx 0rpx rgba(0,0,0,0.1);
			border-radius: 20rpx;
			display: flex;
			.main-image {
				width: 164rpx;
				height: 216rpx;
				margin-right: 20rpx;
				image {
					width: 164rpx;
					height: 216rpx;
					border-radius: 10rpx;
				}
			}
			.main-content {
				display: flex;
				justify-content: space-between;
				align-items: center;
				width: 100%;
				height: 216rpx;
				.main-left {
					height: 216rpx;
					display: flex;
					flex-direction: column;
					justify-content: space-between;
					.main-title {
						font-size: 30rpx;
						font-family: PingFangSC-Semibold, PingFang SC;
						font-weight: 600;
						color: #333333;
						line-height: 40rpx;
					}
					.main-sub, .main-role {
						font-size: 24rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						font-weight: 400;
						color: #666666;
						line-height: 32rpx;
						
						width: 300rpx !important;
						display: inline-block;
						white-space: nowrap; 
						width: 100%; 
						overflow: hidden;
						text-overflow:ellipsis;
					}
					.main-tag {
						.tag {
							display: inline-block;
							border: 2rpx solid #999999;
							font-size: 24rpx;
							color: #999999;
							line-height: 26rpx;
							margin-right: 10rpx;
							padding: 1rpx 6rpx;
						}
					}
					.main-score {
						font-size: 24rpx;
						font-family: PingFangSC-Regular, PingFang SC;
						font-weight: 400;
						color: #666666;
						line-height: 32rpx;
						text {
							color: #FF6D04;
							font-weight: 900;
						}
					}
				}
				.main-right {
					display: flex;
					justify-content: space-between;
					align-items: end;
					width: 170rpx;
					height: 216rpx;
					flex-wrap: wrap;
					.stop {
						width: 170rpx;
						height: 80rpx;
						background: #DEDEDE;
						box-shadow: 0rpx 2rpx 8rpx 0rpx rgba(0,0,0,0.1);
						border-radius: 40rpx;
						color: #666666;
						text-align: center;
						line-height: 80rpx;
						font-size: 24rpx;
					}
					.buy {
						width: 170rpx;
						height: 80rpx;
						background: linear-gradient(136deg, #FC4B5C 0%, #FD8D3D 100%);
						box-shadow: 0rpx 2rpx 8rpx 0rpx rgba(0,0,0,0.1);
						border-radius: 40rpx;
						color: #FFFFFF;
						text-align: center;
						line-height: 80rpx;
						font-size: 24rpx;
					}
					.presell {
						width: 170rpx;
						height: 80rpx;
						background: linear-gradient(136deg, #9A00FF 0%, #FF6500 100%);
						box-shadow: 0rpx 2rpx 8rpx 0rpx rgba(0,0,0,0.1);
						border-radius: 40rpx;
						color: #FFFFFF;
						text-align: center;
						line-height: 80rpx;
						font-size: 24rpx;
					}
					.want {
						width: 180rpx;
						height: 80rpx;
						background: linear-gradient(136deg, #FFD500 0%, #FF6500 100%);
						box-shadow: 0rpx 2rpx 8rpx 0rpx rgba(0,0,0,0.1);
						border-radius: 40rpx;
						color: #FFFFFF;
						text-align: center;
						line-height: 80rpx;
						font-size: 24rpx;
					}
				}
			}
		}
	}
</style>