<template>
	<view class="pages">
		<u-navbar title="设备详情" :border-bottom="false" :background="bgc" back-icon-color="#3D3D3D" title-color='#3D3D3D'
			title-size='36' height='44'></u-navbar>
		<view class="list_item">
			<view class="top">
				<view class="bh">设备编号：{{obj.deviceNo == undefined ? '--' : obj.deviceNo}}</view>
				<view class="zx" v-if="obj.onlineStatus == 1">
					<view class="yuan"></view>
					<view class="wz">在线</view>
				</view>
				<view class="zx" v-else>
					<view class="yuan" style="background-color: red;"></view>
					<view style="color: red;">离线</view>
				</view>
			</view>
			<view class="devixexq">
				<view class="xiaoav">
					<view class="">设备状态</view>
					<view style="color: springgreen;" v-if="obj.status == 2">使用中</view>
					<view style="color: springgreen;" v-if="obj.status == 1">正常</view>
					<view style="color: red;" v-if="obj.status == 3">不可用</view>
				</view>
				<view class="xiaoav">
					<view class="">所属合作伙伴</view>
					<view class="">{{obj.agentName == undefined ? '--' : obj.agentName}}</view>
				</view>
				<view class="xiaoav">
					<view class="">所属渠道商</view>
					<view class="">{{obj.bizManName == undefined ? '--' : obj.bizManName}}</view>
				</view>
				<view class="xiaoav">
					<view class="">所属创业者</view>
					<view class="">{{obj.userName == undefined ? '--' : obj.userName}}</view>
				</view>
			</view>
			<view class="zong">
				<view class="xiaoav">
					<view class="">订单总数</view>
					<view class="">{{obj.orderCount == undefined ? '--' : obj.orderCount}}</view>
				</view>
				<view class="xiaoav">
					<view class="">订单总金额</view>
					<view class="">￥{{obj.orderAmount == undefined ? '--' : obj.orderAmount}}</view>
				</view>
			</view>
		</view>
		<!-- 商家信息 -->
		<view class="sjmsg">
			<view class="tit">
				商家信息
			</view>
			<view class="jy">
				<view class="one">经营场所：</view>
				<view class="thr">{{obj.storeName == undefined ? '--' : obj.storeName}}</view>
			</view>
			<view class="jy">
				<view class="one">经营地址：</view>
				<view class="two">{{obj.storeAddress == undefined ? '--' : obj.storeAddress}}</view>
			</view>
			<view class="jy">
				<view class="one">所在房间：</view>
				<view class="two">{{obj.room == undefined ? '--' : obj.room}}号</view>
			</view>
		</view>
		<!-- 设备规格 -->
		<view class="sjmsg">
			<view class="tit">
				设备规格
			</view>
			<view class="jy">
				<view class="one">设备名称：</view>
				<view class="two">{{obj.deviceName == undefined ? '--' : obj.deviceName}}</view>
			</view>
			<view class="jy">
				<view class="one">设备尺寸：</view>
				<view class="two">{{obj.size == undefined ? '--' : obj.size}}</view>
			</view>
			<view class="jy">
				<view class="one">设备面料：</view>
				<view class="two">{{obj.fabric == undefined ? '--' : obj.fabric}}</view>
			</view>
			<view class="jy">
				<view class="one">设备填充物：</view>
				<view class="two">{{obj.fill == undefined ? '--' : obj.fill}}</view>
			</view>
		</view>
		<!-- 在线信息 -->
		<view class="sjmsg">
			<view class="tit">
				在线信息
			</view>
			<view class="jy">
				<view class="one">首次上线时间：</view>
				<view class="two">{{obj.firstOnlineTime == undefined ? '--' : obj.firstOnlineTime}}</view>
			</view>
			<view class="jy">
				<view class="one">最后登录时间：</view>
				<view class="two">{{obj.lastOnlineTime == undefined ? '--' : obj.lastOnlineTime}}</view>
			</view>
		</view>
		<!-- 收益明细 -->
		<view class="sjmsg">
			<view class="tit">
				收益明细
			</view>
			<view class="jy" v-for="(item,index) in obj.bonusList" :key="index">
				<view class="one">{{item.arrivalName == undefined ? '--' : item.arrivalName}}（<text v-if="item.arrivalType == 1">平台</text><text v-if="item.arrivalType == 2">公司</text><text v-if="item.arrivalType == 3">合作伙伴商</text><text v-if="item.arrivalType == 4">渠道商</text><text v-if="item.arrivalType == 5">创业者</text><text v-if="item.arrivalType == 6">经营场所</text>）{{item.point}}%</view>
				<view class="two">￥{{item.amount== undefined ? '--' : otem.amount}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				bgc: {
					backgroundColor: "#F7FAFE",
				},
				deviceId:'',
				obj:{}
			}
		},
		onLoad(option) {
            this.deviceId = option.deviceId
			this.getxq()
		},
		// 分享到好友（会话）
		onShareAppMessage: function() {
			return {
				title: '创亿康',
				path: '/pages/index/index'
			}
		},

		// 分享到朋友圈  
		onShareTimeline: function() {
			return {
				title: '创亿康',
				query: '',
				path: '/pages/index/index'
			}
		},
		methods: {
             getxq(){
             	this.$u.get(`/agent/device/${this.deviceId}`).then(res =>{
             		if(res.code == 200){
             			this.obj = res.data
             		}
             	})
             }

		}
	}
</script>

<style lang="scss" scoped>
	/deep/ .u-title {
		padding-bottom: 15rpx;
	}

	/deep/ .u-icon__icon {
		padding-bottom: 15rpx;
	}

	.pages {
		background-color: #F7FAFE !important;
		height: 100%;
		width: 100%;
		padding-bottom: 100rpx !important;
		padding: 0 38rpx;
		box-sizing: border-box;

		.sjmsg {
			margin-top: 50rpx;

			.tit {
				font-size: 28rpx;
				color: #3D3D3D;
				font-weight: 600;
			}

			.jy {
				margin-top: 24rpx;
				display: flex;
				justify-content: space-between;

				.one {
					font-size: 28rpx;
					color: #808080;
				}

				.two {
					font-size: 28rpx;
					color: #3D3D3D;
				}

				.thr {
					font-size: 28rpx;
					color: #8883F0;
				}
			}
		}

		.list_item {
			margin-top: 32rpx;
			height: 348rpx;
			padding: 24rpx 28rpx;
			box-sizing: border-box;
			background-color: #fff;
			background: #FFFFFF;
			box-shadow: 0rpx 4rpx 22rpx 0rpx rgba(0, 0, 0, 0.07);
			border-radius: 20rpx 20rpx 20rpx 20rpx;
			.devixexq {
				display: flex;
				justify-content: space-between;
				margin-top: 14rpx;
				text-align: center;

				.xiaoav {
					font-size: 24rpx;
					color: #3D3D3D;

					view {
						margin-top: 12rpx;
					}
				}
			}

			.zong {
				margin-top: 30rpx;
				display: flex;
				justify-content: space-between;
				text-align: center;
				padding: 0 50rpx;
				box-sizing: border-box;
				font-size: 24rpx;
				color: #3D3D3D;

				view {
					margin-top: 12rpx;
				}
			}

			.cen {
				display: flex;
				justify-content: space-between;
				margin-top: 22rpx;
				align-items: center;
				border-bottom: 1px solid #D8D8D8;
				padding-bottom: 34rpx;
				box-sizing: border-box;

				.fj {
					font-size: 24rpx;
					color: #3D3D3D;
				}

				input {
					width: 346rpx;
					height: 38rpx;
					background: #F0F0F0;
					border-radius: 8rpx 8rpx 8rpx 8rpx;
				}

				.btn {
					width: 110rpx;
					height: 38rpx;
					background: #8883F0;
					border-radius: 8rpx 8rpx 8rpx 8rpx;
					text-align: center;
					line-height: 38rpx;
					font-size: 20rpx;
					color: #FFFFFF;
				}
			}

			.top {
				display: flex;
				justify-content: space-between;
				border-bottom: 1px solid #D8D8D8;
				padding-bottom: 26rpx;
				box-sizing: border-box;

				.bh {
					font-size: 24rpx;
					color: #3D3D3D;
				}

				.zx {
					display: flex;
					align-items: center;

					.yuan {
						width: 14rpx;
						height: 14rpx;
						background: #12D2AC;
						border-radius: 50%;
						margin-right: 10rpx;
					}

					.wz {
						font-size: 24rpx;
						color: #12D2AC;
					}
				}
			}
		}
	}
</style>