<template>
	<!-- 查看详情页面 -->
	<view class="detail_con">
		<view class="detail_box">
			<view class="top_box">
				<view class="top_item">
					<view class="unit_left">
						<view class="unit">车站名称</view>
						<view class="unit_name">{{ roadData.railwayName }}</view>
					</view>
					<view class="unit_time">{{ roadData.statDate || '' }} {{ roadData.statPeriodValue || '' }}</view>
				</view>

				<!-- 入青 -->
				<view class="con_item">
					<view class="spread_box">
						<view class="item_con first">
							<view class="left">进青岛车次信息</view>
						</view>
						<view class="item_con">
							<view class="left">终到车次(辆)：</view>
							<view class="right">{{ roadData.inboundRailwayDo === 0 ? roadData.inboundRailwayDo : roadData.inboundRailwayDo || '' }}</view>
						</view>
						<view class="item_con">
							<view class="left">过路车次：</view>
							<view class="right">
								{{ roadData.inboundPassengersDo === 0 ? roadData.inboundPassengersDo : roadData.inboundPassengersDo || '' }}
							</view>
						</view>
						<view class="item_content">
							<view class="content top">
								<view class="left">终到车次环比(%)</view>
								<view class="right" :class="roadData.inRailwayYomDo > 0 ? 'green' : roadData.inRailwayYomDo < 0 ? 'red' : ''">
									{{ roadData.inRailwayYomDo === 0 ? roadData.inRailwayYomDo : roadData.inRailwayYomDo ? roadData.inRailwayYomDo.toFixed(2) : '' }}
								</view>
							</view>
							<view class="content">
								<view class="left">终到车次同比(%)</view>
								<view class="right" :class="roadData.inRailwayMomDo > 0 ? 'green' : roadData.inRailwayMomDo < 0 ? 'red' : ''">
									{{ roadData.inRailwayMomDo === 0 ? roadData.inRailwayMomDo : roadData.inRailwayMomDo ? roadData.inRailwayMomDo.toFixed(2) : '' }}
								</view>
							</view>
						</view>
						
						<view class="item_con">
							<view class="left">人数(人)：</view>
							<view class="right">{{ roadData.inPepole === 0 ? roadData.inPepole : roadData.inPepole || '' }}</view>
						</view>
						<view class="item_content">
							<view class="content top">
								<view class="left">人数环比(%)</view>
								<view class="right" :class="roadData.inPepoleYoyDo > 0 ? 'green' : roadData.inPepoleYoyDo < 0 ? 'red' : ''">
									{{ roadData.inPepoleYoyDo === 0 ? roadData.inPepoleYoyDo : roadData.inPepoleYoyDo ? roadData.inPepoleYoyDo.toFixed(2) : '' }}
								</view>
							</view>
							<view class="content">
								<view class="left">人数同比(%)</view>
								<view class="right" :class="roadData.inPepoleMomDo > 0 ? 'green' : roadData.inPepoleMomDo < 0 ? 'red' : ''">
									{{ roadData.inPepoleMomDo === 0 ? roadData.inPepoleMomDo : roadData.inPepoleMomDo ? roadData.inPepoleMomDo.toFixed(2) : '' }}
								</view>
							</view>
						</view>
						
						<view class="item_con">
							<view class="left">备注：</view>
							<view class="right">{{ item.inMark || '' }}</view>
						</view>
					</view>
				</view>
				<!-- 出青 -->
				<view class="con_item">
					<view class="spread_box">
						<view class="item_con first">
							<view class="left">出青岛车次信息</view>
						</view>
						<view class="item_con">
							<view class="left">终到车次(辆)：</view>
							<view class="right">{{ roadData.outboundRailwayDo === 0 ? roadData.outboundRailwayDo : roadData.outboundRailwayDo || '' }}</view>
						</view>
						<view class="item_con">
							<view class="left">过路车次：</view>
							<view class="right">
								{{ roadData.outboundPassengersDo === 0 ? roadData.outboundPassengersDo : roadData.outboundPassengersDo || '' }}
							</view>
						</view>
						<view class="item_content">
							<view class="content top">
								<view class="left">终到车次环比(%)</view>
								<view class="right" :class="roadData.outRailwayYomDo > 0 ? 'green' : roadData.outRailwayYomDo < 0 ? 'red' : ''">
									{{ roadData.outRailwayYomDo === 0 ? roadData.outRailwayYomDo : roadData.outRailwayYomDo ? roadData.outRailwayYomDo.toFixed(2) : '' }}
								</view>
							</view>
							<view class="content">
								<view class="left">终到车次同比(%)</view>
								<view class="right" :class="roadData.outRailwayMomDo > 0 ? 'green' : roadData.outRailwayMomDo < 0 ? 'red' : ''">
									{{ roadData.outRailwayMomDo === 0 ? roadData.outRailwayMomDo : roadData.outRailwayMomDo ? roadData.outRailwayMomDo.toFixed(2) : '' }}
								</view>
							</view>
						</view>
						
						<view class="item_con">
							<view class="left">人数(人)：</view>
							<view class="right">{{ roadData.outPepole === 0 ? roadData.outPepole : roadData.outPepole || '' }}</view>
						</view>
						<view class="item_content">
							<view class="content top">
								<view class="left">人数环比(%)</view>
								<view class="right" :class="roadData.outPepoleYoyDo > 0 ? 'green' : roadData.outPepoleYoyDo < 0 ? 'red' : ''">
									{{ roadData.outPepoleYoyDo === 0 ? roadData.outPepoleYoyDo : roadData.outPepoleYoyDo ? roadData.outPepoleYoyDo.toFixed(2) : '' }}
								</view>
							</view>
							<view class="content">
								<view class="left">人数同比(%)</view>
								<view class="right" :class="roadData.outPepoleMomDo > 0 ? 'green' : roadData.outPepoleMomDo < 0 ? 'red' : ''">
									{{ roadData.outPepoleMomDo === 0 ? roadData.outPepoleMomDo : roadData.outPepoleMomDo ? roadData.outPepoleMomDo.toFixed(2) : '' }}
								</view>
							</view>
						</view>
						
						<view class="item_con">
							<view class="left">备注：</view>
							<view class="right">{{ item.outMark || '' }}</view>
						</view>
					</view>
				</view>
				
			</view>
			<view class="bottom_box">
				<p class="edit_btn" @click="goEditPage">编辑</p>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				roadData: {},
				tabType: 1,
			}
		},
		onLoad(options) {
			let item = JSON.parse(options.item)
			console.log(item)
			let item1 = JSON.parse(JSON.stringify(item));
			this.roadData = item1;
			// this.getDetail()
		},
		methods: {
			//跳转到编辑
			goEditPage() {
				uni.navigateTo({
					url: '/pages/railway/railwayRunData/form?item=' + JSON.stringify(this.roadData)
				})
			},
			getDetail() {
				this.$request(getApp().globalData.baseUrl + '/api/biz/highSpeedOperationController/selectById/' +
					'8A47103EE00000018772BC97AE50FFB7', {}, "GET").then(res => {
					console.log(res)
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.detail_con {
		width: 100%;
		height: 100%;
		overflow-y: auto;

		.detail_box {
			background: #fff;
			border-radius: 30rpx;
			margin: 30rpx 30rpx 0;

			.top_box {
				width: 630rpx;
				padding: 38rpx 30rpx 0rpx;
				display: flex;
				flex-direction: column;

				.top_item {
					width: 100%;
					// margin-top: 38rpx;
					// margin-bottom: 60rpx;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: space-between;

					.unit_left {
						width: 100%;
						display: flex;

						.unit {
							width: 102rpx;
							height: 37rpx;
							background: #FFF7E4;
							border-radius: 10rpx;
							border: 1rpx solid #EF9A4F;
							font-size: 20rpx;
							color: #E37616;
							display: flex;
							align-items: center;
							justify-content: center;
						}

						.unit_name {
							font-size: 30rpx;
							color: #333;
							font-weight: bold;
							line-height: 48rpx;
							margin-left: 20rpx;
						}
					}

					.unit_time {
						margin-top: 30rpx;
						width: 100%;
						display: flex;
						align-items: center;
						justify-content: center;
						font-size: 24rpx;
						color: #999999;
					}
				}

				.all_item {
					width: 100%;
					display: flex;
					align-items: center;
					justify-content: space-between;
					margin-top: 32rpx;

					&.first {
						margin-top: 0rpx;
					}

					&.last {
						margin-bottom: 30rpx;
					}

					.all_left {
						color: #666666;
						font-size: 26rpx;
					}

					.all_right {
						font-size: 28rpx;
						color: #333;
					}
				}

				.con_item {
					width: 570rpx;
					background: #F8F8F8;
					border-radius: 30rpx;
					margin: 0 auto;
					margin-top: 30rpx;
					padding: 30rpx 30rpx;

					.spread_box {
						width: 100%;

						.item_con {
							width: 100%;
							display: flex;
							align-items: center;
							justify-content: space-between;
							margin-top: 32rpx;

							&.first {
								color: #333;
								font-size: 30rpx;
								font-weight: bold;
								margin-top: 0rpx;
							}

							.left {
								color: #666666;
								font-size: 26rpx;
							}

							.right {
								font-size: 28rpx;
								color: #333;
							}
						}

						.item_content {
							width: 570rpx;
							margin: 0 auto;
							background-color: #fff;
							border-radius: 30rpx;
							margin-top: 30rpx;


							.content {
								width: 516rpx;
								padding: 34rpx 32rpx 30rpx 22rpx;
								display: flex;
								justify-content: space-between;
								align-items: center;

								&.top {
									border-bottom: 1rpx solid #F2F2F2;
								}


								.left {
									font-size: 24rpx;
									color: #666;
								}

								.right {
									color: #333;
									font-size: 28rpx;

									&.green {
										color: #1ECE5F;
									}

									&.red {
										color: #EB4747;
									}
								}
							}
						}

						.expand_box {
							width: 100%;
							display: flex;
							margin-top: 30rpx;
							align-items: center;
							justify-content: center;

							.img {
								width: 40rpx;
								height: 40rpx;
							}

							.tit {
								color: #2D8CF0;
								font-size: 24rpx;
								margin-left: 12rpx;
							}
						}
					}

					.no_spread {
						width: 100%;
						background: #F8F8F8;
						border-radius: 30rpx;

						.item_con {
							width: 100%;
							display: flex;
							align-items: center;
							justify-content: space-between;
							margin-top: 32rpx;

							&.first {
								margin-top: 0rpx;
							}

							.left {
								color: #666666;
								font-size: 26rpx;
							}

							.right {
								font-size: 28rpx;
								color: #333;
							}
						}
					}
				}
			}

			.bottom_box {
				width: 100%;
				padding: 40rpx 0;
				display: flex;
				justify-content: flex-end;

				.edit_btn {
					width: 180rpx;
					height: 70rpx;
					background: #2D8CF0;
					border-radius: 100rpx;
					color: #fff;
					font-size: 28rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					margin-right: 30rpx;
				}
			}
		}

		.tab_box {
			display: flex;
			justify-content: space-around;

			.tab_nav {
				color: #999999;
				line-height: 42rpx;
				font-size: 30rpx;
				font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				padding-bottom: 25rpx;

				&.active {
					position: relative;
					color: #2D8CF0;
					font-weight: bold;

					&::after {
						position: absolute;
						content: '';
						left: 50%;
						bottom: 0;
						width: 74rpx;
						height: 6rpx;
						background: #2D8CF0;
						border-radius: 100rpx;
						margin-left: -37rpx;
					}
				}
			}
		}

	}
</style>