<template>
	<view>
		<ujp-navbar>分润详情</ujp-navbar>
		<view class="details">
		
			<view class="details-main">
				<view class="details-price">
					<h3>{{rentCardShareProfit.shareProfitAmount?rentCardShareProfit.shareProfitAmount.toFixed(2):0}}<span style="font-size: 12px;">元</span></h3>
				</view>
				<p>分润金额</p>
				<img 
				v-if="rentCardShareProfit.status==2"
				class="withdraw" src="../..//assets/img/withdraw.png" alt="">
			</view>
		</view>
		<view class="details">
			
			<view class="details-title">
				<h4>订单明细</h4>
			</view>
			<template v-if="rentCardShareProfit.stationName">
				<!-- 庄主显示内容 -->
			</template>
			<template v-else>
				<!-- 平台显示内容 -->
				<view class="details-row">
					<p>平台收益</p>
					<span>{{rentCardShareProfit.disProportion}}%</span>
				</view>
			</template>
			
			
		
			<view class="details-row">
				<p>月卡总金额</p>
				<span>{{regUserCard.payFee?regUserCard.payFee.toFixed(2):0}}元</span>
			</view>
			<view class="details-row" v-if="rentCardShareProfit.stationName" >
				<p>服务费总金额</p>
				<span>{{rentCardShareProfit.serviceTotalAmount?rentCardShareProfit.serviceTotalAmount.toFixed(2):0}}元</span>
			</view>
			
			<view class="details-row" v-if="rentCardShareProfit.stationName">
				<p>分润比例</p>
				<span>{{rentCardShareProfit.stationProportion}}%</span>
			</view>
			
			<view class="details-row">
				<p>月卡分润金额</p>
				<span>{{rentCardShareProfit.shareProfitAmount?rentCardShareProfit.shareProfitAmount.toFixed(2):0}}元</span>
			</view>
			
			<view class="details-row" v-if="rentCardShareProfit.stationName">
				<p>周期内充电次数</p>
				<span>{{rentCardShareProfit.chargingCount}}次</span>
			</view>
		</view>

<view class="details">
			<view class="details-title">
				<h4>更多信息</h4>
			</view>
			<view class="details-row" v-if="rentCardShareProfit.stationName">
				<p>来源站点 </p>
				<span>{{rentCardShareProfit.stationName}}</span>
			</view>
			
			
			<view class="details-row"  v-if="rentCardShareProfit.stationName" >
				<p>设备名称</p>
				<span>{{rentCardShareProfit.deviceName}}</span>
			</view>
			
			
			<view class="details-row">
				<p>用户姓名 </p>
				<span>{{regUser.realName?regUser.realName:'未命名'}}</span>
			</view>
			<view class="details-row">
				<p>车牌号 </p>
				<span>{{regUser.carNum?regUser.carNum:'未绑定'}}</span>
			</view>
			<view class="details-row">
				<p>月卡卡号</p>
				<span>{{regUserCard.cardNo}}</span>
			</view>
<view class="details-row">
				<p>月卡有效期</p>
				<span>{{regUserCard.startTime?regUserCard.startTime.slice(0,10):''}}至{{regUserCard.endTime?regUserCard.endTime.slice(0,10):''}}</span>
				
			</view>
<view class="details-row">
				<p>结算时间</p>
				<span>{{rentCardShareProfit.createTime}}</span>
			</view>


		</view>


		
	</view>
</template>

<script>
	import {
		parseUnixTime,
		substrMb
	} from '@/utils'
	
	import * as API from '@/apis/finance.js'
	
	export default {
		data() {
			return {
				regUser: {},
				rentCardShareProfit: {},
				regUserCard: {},
			}
		},
		onLoad(op) {
	
	
	
			this.id = op.id;
			this.getInfo()
		},
		methods: {
		getPhone(phone){
				var backphone="";
				if(phone){
					backphone=substrMb(phone,0,3)+"****"+substrMb(phone,7,4)
				}
				
				return backphone;
			},
			getInfo() {
				uni.showLoading({
					title: "加载中",
					mask: true,
				})
				API.cardProfitDataDetail({
					id: this.id
				}).then((res) => {
					this.regUser = res.data.regUser
					this.regUserCard = res.data.regUserCard
					this.rentCardShareProfit = res.data.rentCardShareProfit
	
					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: 20px;

		h4 {
			font-weight: normal;
			font-size: 16px;
			position: relative;
			padding-left: 10px;

			&::after {
				content: '';
				position: absolute;
				height: 12px;
				width: 4px;
				background-color: #185ac6;
				left: 0;
				top: 5px;
			}
		}
	}

	.details-row {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-top: 15px;

		p {
			color: #86898C;
			
		}

	}

	.details-row-sum {
		float: right;
		color: #101010;
		font-size: 14px;

	}

	.details {
		margin: 16px;
		padding: 20px;
		background-color: #fff;
		border-radius: 8px;
        position: relative;
		.details-head {
			text-align: center;
			display: flex;
			align-items: center;
			justify-content: center;

			h4 {
				font-size: 18px;
				font-weight: normal;
				margin-left: 4px;
			}
		}

		.details-price {
			margin-top: 12px;
			margin-bottom: 4px;
			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;
             
           .withdraw{
			   width: 21.3vw;
			   height: 21.3vw;
			   position: absolute;
			   top: 2vw;
			   right: 2.5vw;
		   }
			p {
				color: #777;
				margin-top: 4px;
			}
		}
	}
</style>
