<template>
	<view class="box">

		<view class="header">
			<image :src="detailData.tSSetting.ruleImg" mode="widthFix" class="bar"></image>
			<image src="../../static/img/btn_act@2x.png" mode="" class="guizeBtn" @click="guize"></image>
		</view>

		<!-- 统计 -->
		<view class="sumBg">
			<view class="viewBg" @click="gonavigateTo('commissionHistory')">
				<view class="money" style="color: #FF4F00;">￥{{detailData.totalMoney}}</view>
				<view class="moneyTitle">累计佣金
					<image src="../../static/img/icon_arrow@2x.png" mode="" style="width: 18rpx; height: 18rpx;">
					</image>
				</view>
			</view>

			<view class="line"></view>
			<view class="viewBg" @click="gonavigateTo('extractHistory')">
				<view class="money">￥{{detailData.withdrawalMoney}}</view>
				<view class="moneyTitle">累计提现
					<image src="../../static/img/icon_arrow@2x.png" mode="" style="width: 18rpx; height: 18rpx;">
					</image>
				</view>
			</view>

			<view class="line"></view>
			<view class="viewBg" @click="gonavigateTo('invitePeople')">
				<view class="money">￥{{detailData.shareCount}}</view>
				<view class="moneyTitle">邀请人数
					<image src="../../static/img/icon_arrow@2x.png" mode="" style="width: 18rpx; height: 18rpx;">
					</image>
				</view>
			</view>
		</view>

		<!-- 明细 -->
		<view class="mingxiBg" v-if="arr.length > 0">
			<view class="mingxi">
				<view v-for="(item,index) in arr" :key="index">
					<view class="itemBg">
						<image :src='item.MemberHeadImg' mode=""
							style="width: 72rpx; height: 72rpx; border-radius: 36rpx;"></image>
						<view class="nickName" v-if="item.MemberNickName">{{item.MemberNickName}}</view>
						<view class="time">{{item.CreateTime.slice(0,item.CreateTime.length-8)}}</view>
						<view class="jine">+{{item.Money}}</view>
					</view>
				</view>
			</view>
			<!-- 查看更多 -->
			<view class="moreView">
				<view style="color: #3F90F7; font-size: 30rpx;" @click="gonavigateTo('commissionHistory')">查看更多</view>
				<image src="../../static/img/icon_arrow_blue.png" mode="" style="width: 24rpx; height: 24rpx;"></image>
			</view>
		</view>
		<view class="mingxiBg" v-else>
			<image :src="emptyImg" mode="" class="emptyImg"></image>
		</view>

		<view class="emptyView"></view>
		<view class="bottomView">
			<view class="bottomImg" @click="gonavigateTo('inviteImg')">
				<image src="../../static/img/icon_ma@2x.png" mode=""
					style="width: 30rpx; height: 30rpx; margin-right: 10rpx;">面对面邀请</image>
			</view>
			<button class="bottomImg2" open-type="share">立即邀请</button>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				detailData: {},
				arr: [],
				emptyImg: 'http://123.56.219.146:10086/keepCar/jqsy.png',
				uidStr: '',
				share: {
					title: '车蓝图4S店养车服务',
					path: 'pages/homePage/homePage?scene=' + this.uidStr,
					imageUrl: '',
					desc: '',
					content: ''
				},
			   shareID:'',
			}
		},
		onLoad() {
			this.uidStr = uni.getStorageSync("logodata").uid.replace(/\-/g, "");
			this.shareID=uni.getStorageSync("logodata").uid;
			console.log("shareID==="+this.shareID)
		},
		onShow() {
			this.getDetailData();
		},
		methods: {
			onShareAppMessage: function() {
                 return {
					 title: '车蓝图4S店养车服务',
					 path: 'pages/homePage/homePage?scene=' + this.shareID,
					 imageUrl: '',
					 desc: '',
					 content: ''
				 }
			},
			guize() {

				uni.navigateTo({
					url: 'guize'
				})
			},
			getDetailData() {
				uni.showLoading({
					title: '加载中'
				})
				let url = 'worldKeepCar/worldDistribution/queryDistributionIndexDetail',
					params = {

					}
				this.$http(url, params, 'GET').then(res => {
					uni.hideLoading();
					var data = res.data


					// 处理 undefined和null转为空白字符串

					for (const key in data) {
						data[key] = this.$praseStrEmpty(data[key])
					}

					this.detailData = data
					this.arr = this.detailData.recentEarnings


				})
			},
			gonavigateTo(url) {
				
				uni.navigateTo({
					url: url
				})
			}
		},

		// 下拉刷新 上拉加载更多
		onPullDownRefresh() {

			this.getDetailData()
			setTimeout(function() {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		// onReachBottom() {
		// 	this.page++;

		// 	this.getItemData()

		// },

	}
</script>

<style scoped>
	.box {
		min-height: 100vh;
		background: #F4F5F7;
	}

	.header {
		width: 100%;
		
		position: relative;
	}

	.bar {
		width: 100%;
		
	}

	.guizeBtn {
		position: absolute;

		right: 0;
		top: 48rpx;
		width: 169rpx;
		height: 56rpx;

	}

	.sumBg {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin: 20rpx 24rpx;
		padding: 36rpx 50rpx;
		background-color: #FFFFFF;
		border-radius: 10rpx;
	}

	.viewBg {
		display: flex;
		flex-direction: column;
		align-items: center;
		background-color: #FFFFFF;
	}

	.money {
		font-size: 38rpx;
		color: #000000;
		font-weight: bold;
	}

	.moneyTitle {
		font-size: 28rpx;
		color: #666666;
	}

	.line {
		width: 1rpx;
		height: 73rpx;

		background-color: #EEEEEE;
	}

	.mingxiBg {
		margin: 0rpx 24rpx;
		background-color: #FFFFFF;

		border-radius: 10rpx;
	}

	.mingxi {
		background-image: url('http://123.56.219.146:10086/keepCar/jqsy2.png');
		background-size: 100%;
		background-repeat: no-repeat;
		padding-top: 89rpx;

	}

	.emptyImg {

		height: 493rpx;
		width: 100%;
	}

	.itemBg {

		height: 98rpx;
		margin: 0 20rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.nickName {
		font-size: 30rpx;
		color: #3C3C3C;
		width: 30%;
		margin: 0 15rpx;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.time {
		font-size: 30rpx;
		color: #999999;

		width: 30%;
	}

	.jine {
		font-size: 32rpx;
		color: #FF4F00;
		font-weight: bold;
		margin: 0 15rpx;
		width: 20%;
		text-align: right;
	}

	.moreView {
		height: 92rpx;

		display: flex;
		justify-content: center;
		align-items: center;
	}

	.emptyView {
		height: 180rpx;
		padding-bottom: constant(safe-area-inset-bottom);
		padding-bottom: env(safe-area-inset-bottom);
	}

	.bottomView {
		background-color: #FFFFFF;
		width: 100%;
		height: 120rpx;
		position: fixed;
		bottom: 0rpx;
		display: flex;
		justify-content: space-around;
		align-items: center;
		padding-bottom: constant(safe-area-inset-bottom);
		padding-bottom: env(safe-area-inset-bottom);
	}


	.bottomImg {

		background-color: #FFFFFF;
		border: #FF4F00 1rpx solid;
		margin: 23rpx 30rpx;
		height: 74rpx;
		width: 50%;
		border-radius: 37rpx;
		color: #FF4F00;
		font-size: 30rpx;

		text-align: center;
		line-height: 74rpx;
		align-items: center;
		display: flex;
		justify-content: center;
	}

	.bottomImg2 {

		background: linear-gradient(135deg, #FD5300 0%, #FF270A 100%);
		margin: 23rpx 30rpx;
		height: 74rpx;
		width: 50%;
		border-radius: 37rpx;
		color: #FFFFFF;
		font-size: 30rpx;

		text-align: center;
	}
</style>
