<template>
	<view class="shareMoneyStyle" :style="{'height':contentHeight}">
		<view class="box">
			<view class="box_top" :style="{background:mainColor}">
				<view class="box_tl">
					<Text>分销佣金</Text>
					<Text style='font-size: 22px;'>{{money.CommissionInfo.TotalCommission}}元</Text>
				</view>
				<view class="box_tr" @click="gocash()">
					<Text>提现明细</Text>
				</view>
			</view>
			<view class="kti" style="height: 50px;">
				<Text>可提现金佣金</Text>
				<Text class='moneytext'>{{money.CommissionInfo.CommissionWithdrawal}}元</Text>
				
			</view>
			<view class="ofmoney">
				<view class="ofmoneyitem" style="border-bottom: 1px solid #f5f5f5;">
					<Text>已提现佣金</Text>
					<Text class='moneytext'>{{money.CommissionInfo.TXCommission}}元</Text>
				</view>
				<view class="ofmoneyitem" style="border-bottom: 1px solid #f5f5f5;">
					<Text>{{money.CustomModel.CommissionTobePaidName}}</Text>
					<Text class='moneytext'>{{money.CommissionInfo.WJSCommission}}元</Text>
				</view>
			</view>
			<view class="kti" style="margin-top: 15px">
				<!-- <Text>用户须知</Text> -->
				<u-collapse style='width: 100%;'>
						<u-collapse-item :title="money.CustomModel.UserNotesName" >
							<!-- TODO无数据 -->
						</u-collapse-item>
				</u-collapse>
			</view>

			<View class='getapply' :style="{background:mainColor}" @click='tixian'>
				<Text>{{money.CustomModel.IWantToWithdrawName}}</Text>
			</View>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				pageTitle: "分销佣金",
				contentHeight:0,
				mainColor:'',
				secondary:'',
				money:{},
			
			}
		},
		created(){
			 this.contentHeight = this.$utils.calcContentHeight(-40)+'px';
			 this.mainColor = this.$uiConfig.mainColor;
			 this.secondary = this.$uiConfig.secondary;
			 this.init()
		},
		mounted() {
			let currentPages = getCurrentPages();
			 let u = "/" + currentPages[currentPages.length-1].route;
			 let pages = wx.getStorageSync("basedata")
			   ? wx.getStorageSync("basedata").bar_title
			   : [];
			 pages.forEach((x) => {
			   if (x.value == u) {
			     this.pageTitle = x.new_name ? x.new_name : x.name;
			   }
			 });
			 uni.setNavigationBarTitle({
			   title: this.pageTitle,
			 });
		},
		methods: {
			init(){
				uni.showNavigationBarLoading();
				
				this.request2(
					 {
					 	url: '/api/AppletUser/GetUserDistrbutorCommissionInfo',
					 	data: {}
					 },	
				  (res) => {
					uni.hideNavigationBarLoading()
					this.money = res.data
					
				  }
				);
			},
		
			tixian(){
				let amount = this.money.money
				uni.navigateTo({
				  url: '/pages/share/cash/cash?u='+ amount
				});
			},
			gocash(){
				uni.navigateTo({
				  url: '/pages/cash-detail/cash-detail'
				});
			}
		}
	}
</script>

<style>
.shareMoneyStyle{
	background: #f3f4f6;
	
}
.shareMoneyStyle .box{
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.shareMoneyStyle .getapply{
	width: 94%;
	height: 45px;
	border-radius: 22.5px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	margin-top: 20px;
}
.shareMoneyStyle .box_top{
	width: 100%;
	padding: 15px;
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
}
.shareMoneyStyle .box_top .box_tl{
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	height: 60px;
	color: #fff;
}
.shareMoneyStyle .box_top .box_tr{
	width: 90px;
	height: 26px;
	border: 1px solid #fff;
	color: #fff;
	border-radius: 13px;
	display: flex;
	align-items: center;
	justify-content: center;
}
.shareMoneyStyle .kti{
	background: #fff;
	width: 100%;
	
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
	padding: 0 15px;
}
.shareMoneyStyle .moneytext{
	font-size: 16px;
	color: #666666;
}
.shareMoneyStyle .ofmoney{
	width: 100%;
	padding: 0 15px;
	background: #fff;
	margin-top: 15px;
	
}
.shareMoneyStyle .ofmoneyitem{
	display: flex;
	flex-direction: row;
	align-items: center;
	width: 100%;
	height:50px;
	justify-content: space-between;
}
</style>
