<template>
	<view class="container">
		<view class="record_wrapper" v-if="cffpFortuneDeductionList.length > 0">
			<view class="recordContent" v-for="(item,index) in cffpFortuneDeductionList" :key="index">
				<image :src="item.deductionUrl" mode="widthFix"></image>
				<view class="detail">
					<h4>{{item.productTypeName}}</h4>
					<view class="">
						{{item.deductionDate}}
					</view>
				</view>
				<view class="score" @click="toWithdralDtl(item)">
					-{{item.integralExchange}}积分
					<text v-if="item.productType=='2' || item.productTypeName=='兑换提现'">></text>
				</view>
			</view>
		</view>
		<view class="noListTip" v-else>暂无数据！</view>
	</view>
</template>

<script>
	import api from '../../api/api';
	export default{
		data(){
			return {
				userId: uni.getStorageSync('cffp_userId'),
				cffpFortuneDeductionList:[],
			}
		},
		components:{},
		onLoad(){
			this.findByUserIdForWithdralHis()
		},
		methods:{
			findByUserIdForWithdralHis(){
				api.findByUserIdForWithdralHis({userId:this.userId}).then((res)=>{
					console.log(res)
					if(res['success']){
						this.cffpFortuneDeductionList = res['data']['cffpFortuneDeductionList']
					}
				})
			},
			toWithdralDtl(item){
				if(item.productType == '2' || item.productTypeName =='兑换提现' ){
					uni.navigateTo({
						url:`/pages/withdrawal/withdrawalDetail?partnerTradeNo=${item.partnerTradeNo}`
					})
				}
			}
		}
	}
</script>

<style lang="scss">
	.record_wrapper{
		.recordContent{
			display: flex;
			margin-bottom: 20rpx;
			background: #fff;
			justify-content: space-between;
			padding: 30rpx;
			align-items: center;
			uni-image {
			    width: 28%!important;
				border-radius: 10rpx;
			}
			.detail{
				width: 40%;
				h4{
					margin-bottom: 20rpx;
				}
				view{
					color: #666;
				}
			}
			.score{
				width: 28%;
				color: #06A632;
				text-align: right;
			}
		}
	}
</style>