<template>
	<view>
		<u-navbar title="设备详情"></u-navbar>
		<view class="details">
			<view class="details-title">
				<h4>充电桩分润信息</h4>
			</view>
			<view class="details-row"><p>所属站点</p><span>{{detail.stationName}}</span></view>
			<view class="details-row"><p>桩号</p><span>{{detail.deviceNo}}</span></view>
			<view class="details-row"><p>充电桩类型</p><span v-if="detail.type">{{options0[detail.type].label}}</span></view>
			<view class="details-row"><p>设备状态</p><span>{{detail.online?'在线':'离线'}}</span></view>
			<view class="details-row"><p>我的身份</p><span>{{detail.roleName}}</span></view>
			<view class="details-row"><p>分润标准</p><span>{{detail.disProportion}}%</span></view>
		<view class="details-row"><p>收费标准(元/度)</p><span
		 style="
		     color: #5a8eef;
		 "
		 @click="gotoUrl('pagesFinance/user/chargingDetails?id='+id)" >查看详情</span></view>
		
		
		</view>
		<!-- <view class="details">
			<view class="details-title">
				<h4>设备相关信息</h4>
			</view>
			<view class="details-row"><p>设备型号</p><span>HCD0001-A</span></view>
			<view class="details-row"><p>初次安装时间</p><span>2022-05-01</span></view>
			<view class="details-row"><p>输出功率范围(瓦)</p><span>100-400</span></view>
		</view> -->
		<view class="detailsBtn">
			<u-button class="detailsBtn-btn" type="primary" @click="back" plain>返回</u-button>
		</view>
	</view>
</template>

<script>
	import * as API from '@/apis/finance.js'
	
	export default {
		data() {
			return {
				id:'',
				
				detail:{
					
				},
				options0: [
					
					{
						label: '自行车充电',
						value: 0,
					},
					
					{
						label: '直流快充',
						value: 1,
					},
					{
						label: '交流慢充',
						value: 2,
					},
				],
				form: {
					name: '',
					intro: '',
				},
			}
		},
		onLoad(op){
			
			this.id=op.id;
			this.getInfo()
		},
		methods: {
			back(){
				uni.navigateBack()
			},
			getInfo(){
				uni.showLoading({
					title:"加载中",mask:true,
				})
				API.deviceDetail({
					deviceId:this.id
				}).then((res) => {
					this.detail=res.data.device	 
					
					uni.hideLoading()
					 
				}).catch(error => {
						uni.showToast({
							
							title:error
						})
				})
			}
		}
	}
</script>
<style>
	page{
		background-color: #F7F7F7;
	}
</style>
<style lang="scss" scoped>
	.detailsBtn{
		margin: 16px;
		.detailsBtn-btn{
			border-color:#185AC6!important;
			border-radius: 8px!important;
			background: none!important;
			color:#185AC6!important;
		}
	}
	.details-title{
		margin-bottom: 16px;
		h4{
			font-weight: normal;
			font-size: 16px;
			position: relative;
			padding-left:10px;
			&::after{
				content: '';
				position: absolute;
				height: 12px;
				width: 4px;
				background-color: #27B148;
				left: 0;
				top:5px;
			}
		}
	}
	.details-row{
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-top: 15px;
		p{color:#888}
	}
	.details{
		margin: 16px;
		padding: 20px;
		background-color: #fff;
		border-radius: 8px;
		.details-head{
			display: flex;
			align-items: center;
			justify-content: center;
			h4{
				font-size: 18px;
				font-weight: normal;
				margin-left: 4px;
			}
		}
		.details-price{
			margin-top: 28px;
			display: flex;
			align-items: flex-end;
			justify-content: center;
			h3{
				font-size: 36px;
				color:#27B148;
				line-height: 36px;
				margin: 0  4px;
				font-weight: normal;
			}
			span{
				font-size: 20px;
				color:#27B148;
			}
		}
		.details-main{
			text-align: center;
			margin-bottom: 20px;
			p{
				color:#777;
				margin-top: 4px;
			}
		}
	}
</style>
