<template>
	<view class="container">
		<view class="top">
			<view>
				可兑换
			</view>
			<view>
				{{exchangeAmount}}积分
			</view>
		</view>
		<view class="content_wrapper">
			<view class="item">
				<text>提现金额(税前)</text>
				<text>{{exchangeAmount}}</text>
			</view>
			<view class="item">
				<text>代缴税</text>
				<text>{{taxAmount}}</text>
			</view>
			<view class="item">
				<text>实际到账</text>
				<text>{{noTaxAmount}}</text>
			</view>
		</view>
		<view class="content_wrapper">
			<h4>提现到</h4>
			<view class="withdrawal_content">
				<view style="display: flex;align-items: center;">
					<text class="iconfont icon-py_weixinzhifu"></text>
					<h4>微信钱包</h4>
				</view>
				<text class="iconfont icon-gou"></text>
			</view>
			<view class="tips_wrapper">
				<view class="">
					提示:
				</view>
				<view class="">
					1、金额低于1元时无法提现;
				</view>
				<view class="">
					2、当前可提金额是您的税前收入，具体计税规则可参考 
				</view>
				<view class="">
					<navigator class="rule" url="/pages/taxRules/taxRules">《劳务报酬税缴纳规则》;</navigator>
				</view>
				<view class="">
					3、如需帮助，请联系CFFP财富中心客服电话:12345678;
				</view>
			</view>
			<view class="btn">
				确认提现
			</view>
		</view>
	</view>
</template>

<script>
	import api from '../../api/api';
	export default{
		data(){
			return {
				exchangeAmount:null,
				partnerTradeNo:null,
				taxAmount:null,
				noTaxAmount:null

			}
		},
		components:{},
		onLoad(options){
			this.exchangeAmount = options.exchangeAmount;
			this.partnerTradeNo = options.partnerTradeNo;
			this.goFortuneWithdrawal()
		},
		methods:{
			goFortuneWithdrawal(){
				const param = {
					userId:uni.getStorageSync('cffp_userId'),
					exchangeAmount:this.exchangeAmount,
					partnerTradeNo:this.partnerTradeNo?this.partnerTradeNo:null
				}
				api.goFortuneWithdrawal(param).then((res)=>{
					console.log(res)
					if(res['success']){
						const data = res['data']['cffpFortuneExchangeVO']
						this.exchangeAmount = data.exchangeAmount;
						this.partnerTradeNo = data.partnerTradeNo;
						this.taxAmount = data.taxAmount;
						this.noTaxAmount = data.noTaxAmount;
					}else{
						this.exchangeAmount = 0;
						this.partnerTradeNo = null;
						this.taxAmount = 0;
						this.noTaxAmount = 0;
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.top{
		width: 100%;
		text-align: center;
		padding: 20rpx 0;
		view:nth-child(1){
			font-size: 36rpx;
			color: #666;
			margin-bottom: 10rpx;
		}
		view:nth-child(2){
			font-size: 40rpx;
			color: #0A2F99;
		}
	}
	.content_wrapper{
		background: #fff;
		margin: 20rpx auto;
		padding:0 30rpx;
		.item{
			display: flex;
			padding: 20rpx 0;
			border-bottom: 2rpx solid #F2F2F2;
			justify-content: space-between;
		}
		.withdrawal_content{
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-top: 20rpx;
			margin-bottom: 20rpx;
			.icon-py_weixinzhifu{
				color:#09BB07;
				font-size: 80rpx;
				margin-right: 30rpx;
			}
			.icon-gou{
				font-size: 48rpx;
				color: #0A2F99;
			}
			
		}
		.tips_wrapper{
			font-size: 26rpx;
			view{
				color: #666666;
				margin-bottom: 10rpx;
			}
			.rule{
				color: #0A2F99;
			}
		}
	}
</style>