<template>
	<view class="device-detail">
		<app-top-push-notice />
		<view class="bj"></view>
		<!-- 头部保持原样 -->
		<view class="tabback">
			<view style="font-size: 36rpx;font-weight: 600;" class="" @click="onCancel">
				←
			</view>
			<view class="name">{{ $i18n.t('addHubTitle') }}</view>
			<view class="add-btn" style="width: 50rpx;"></view>
		</view>

		<view class="content-container" style="background-color: #F3F5F6;">
	          <view class="tit">
	          	  {{ $i18n.t('addSuccessTitle') }}
	          </view>
		   <view class="img">
		   	  <image src="https://api.ccttiot.com/smartmeter/img/static/uwcx3DCVeSnkZtb7PEK4" mode="aspectFill"></image>
		   </view>
		   <view class="wgname">
		  	  {{ $i18n.t('deviceNameLabel') }}{{sbobj.name}}
		   </view>
		   <view class="xinghao">
		  	  {{ $i18n.t('deviceModelLabel') }}{{sbobj.productName}}
		   </view>
		   <view class="banben">
		  	  {{ $i18n.t('deviceSnLabel') }}{{sbobj.sn}}
		   </view>
		</view>
		<view class="anniu">
			<view class="btnan" @click="btnjx">
				{{ pwflag == true ? $i18n.t('continueText') : $i18n.t('finishText') }}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
               deviceid:'',
			   sbobj:{},
			   pwflag:false
			}
		},
		computed: {

		},
		onLoad(option) {
            this.deviceid = option.sn
			this.getsb()
		},
		methods: {
			// 查询设备详情
			getsb(){
				this.$http.get(`/bst/device/detail?sn=${this.deviceid}`).then(res =>{
					if(res.code == 200){
						this.sbobj = res.data
						res.data.productNets.forEach(item =>{
							if(item == 'WIFI'){
								this.pwflag = true
							}
						})
					}
				})
			},
			// 点击返回上一级
			onCancel() {
				uni.reLaunch({
					url:'/pages/index/index'
				})
			},
			// 点击继续下一步
			btnjx(){
				uni.navigateTo({
					url:'/pages/device/addhubwifi?mac=' + this.sbobj.mac
				})
			}
		}
	}
</script>

<style scoped lang="less">
	.saoma{
		width: 750rpx;
		height: 128rpx;
		background: #FFFFFF;
		margin-top: 26rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 32rpx;
		box-sizing: border-box;
		.lt{
			display: flex;
			align-items: center;
			font-size: 30rpx;
			color: #3D3D3D;
			image{
				width: 64rpx;
				height: 64rpx;
				margin-right: 46rpx;
			}
		}
		.rt{
			width: 56rpx;
			height: 56rpx;
			image{
				width: 56rpx;
				height: 56rpx;
			}
		}
	}
	.centxt{
		font-size: 28rpx;
		color: #727272;
		margin-top: 90rpx;
		width: 100%;
		text-align: center;
	}
	.names{
		width: 750rpx;
		height: 200rpx;
		background: #FFFFFF;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin-top: 54rpx;
		padding: 34rpx 48rpx;
		box-sizing: border-box;
		.tit{
			font-size: 28rpx;
			color: #7F7F7F;
		}
		input{
			font-size: 32rpx;
			color: #B9B9B9;
			margin-top: 22rpx;
			border-bottom: 1px solid #9E9E9E;
			padding-bottom: 26rpx;
		}
	}
    .anniu{
		width: 750rpx;
		height: 126rpx;
		padding-top: 24rpx;
		box-sizing: border-box;
		background: #FFFFFF;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		position: fixed;
		left: 0;
		bottom: 0;
		.btnan{
			width: 674rpx;
			height: 80rpx;
			background: #0F0F0F;
			font-size: 32rpx;
			color: #FFFFFF;
			text-align: center;
			line-height: 80rpx;
			border-radius: 50rpx;
			margin: auto;
		}
	}
	.crop-container {
		width: 100%;
		height: 100%;
		display: flex;
		flex-direction: column;
		background-color: #000;
	}

	.bj {
		width: 100%;
		height: 50vh;
		position: fixed;
		top: 0;
		z-index: -1;
		background-color: #0F0F0F;
	}

	.tabback {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		height: 126rpx;
		padding: 0 20rpx;
		box-sizing: border-box;
		background-color: #fff;
		margin-top: 102rpx;
		border-radius: 30rpx 30rpx 0 0;

		.rtjt {
			font-size: 36rpx;
			color: #333;
		}

		.name {
			font-size: 36rpx;
			font-weight: bold;
			color: #333;
			margin: 0 auto;
		}

		.add-btn {
			font-size: 32rpx;
			color: #ccc;
			transition: color 0.3s;

			&.active {
				color: #333;
			}
		}
	}



	.content-container {
		display: flex;
		flex-direction: column;
		min-height: calc(100vh - 228rpx);
		padding-bottom: 200rpx;
		.tit{
			font-weight: 500;
			font-size: 36rpx;
			color: #0F0F0F;
			width: 100%;
			text-align: center;
			margin-top: 110rpx;
		}
		.img{
			width: 100%;
			height: 410rpx;
			text-align: center;
			margin-top: 136rpx;
			image{
				width: 410rpx;
				height: 410rpx;
			}
		}
		.wgname{
			font-size: 32rpx;
			color: #727272;
			margin-top: 86rpx;
			width: 100%;
			text-align: center;
			box-sizing: border-box;
		}
		.xinghao{
			font-size: 32rpx;
			color: #727272;
			margin-top: 36rpx;
			width: 100%;
			text-align: center;
			box-sizing: border-box;
		}
		.banben{
			font-size: 32rpx;
			color: #727272;
			margin-top: 36rpx;
			width: 100%;
			text-align: center;
			box-sizing: border-box;
		}
	}

	.instruction-section {
		background: #f3f5f6;
		text-align: center;
		width: 100%;
		height: 448rpx;

		view {
			position: relative;
			left: 50%;
			transform: translateX(-50%);
			width: 272rpx;
			margin-top: 88rpx;
		}

		.da {
			width: 272rpx;
			height: 272rpx;
			border-radius: 50%;
		}

		.xiao {
			width: 116rpx;
			height: 72rpx;
			position: absolute;
			right: 0;
			bottom: 0;
		}

		.instruction-text {
			font-size: 28rpx;
			color: #666;
			line-height: 1.6;
			margin-top: 30rpx;
		}
	}

	.input-section {
		background: #fff;
		padding: 40rpx 32rpx;
		margin-top: 40rpx;

		.input-group {
			margin-bottom: 40rpx;
		}

		.input-label {
			display: block;
			font-size: 28rpx;
			color: #666;
			margin-bottom: 20rpx;
		}

		.code-input {
			width: 100%;
			height: 80rpx;
			border: none;
			border-bottom: 2rpx solid #e5e5e5;
			font-size: 32rpx;
			color: #333;
			background: transparent;
			padding: 0;

			&::placeholder {
				color: #bbb;
				letter-spacing: 8rpx;
			}

			&:focus {
				border-bottom-color: #000;
				outline: none;
			}
		}
	}

	.help-section {
		background: #f3f5f6;
		padding: 40rpx 0;
		padding-top: 20rpx;
		padding-left: 48rpx;
	}

	.help-text {
		font-size: 28rpx;
		color: #727272;
	}

	.button-section {
		margin-top: auto;
		padding-top: 42rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		width: 750rpx;
		height: 220rpx;
		background: #FFFFFF;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		position: fixed;
		left: 50%;
		transform: translateX(-50%);
		bottom: 0;

		.continue-btn {
			width: 674rpx;
			height: 80rpx;
			line-height: 80rpx;
			background: #BBBBBB;
			color: #fff;
			border: none;
			border-radius: 50rpx;
			font-size: 32rpx;
			font-weight: 600;
		}

		.continue-btn.active {
			background: #000;
		}

		.cancel-btn {
			margin-top: 34rpx;
			font-size: 28rpx;
			color: #000;
		}
	}
</style>