<template>
	<view class="subgiftList_content">
		<view class="subgift_summary">
			<view class="subgift_share"><text>{{shareType==1?"分享次数":"转赠次数"}}</text><text>{{ init_num }}</text></view>
			<view :class="['subgift_share','subgift_receive']"><text>领取次数</text><text>{{num}}</text></view>
		</view>
		<view class="subgift_list" v-show="list.length>0" >
			<view v-for="(item,index) in list" :key="index" class="subgift_list_item" >
				<view>{{item.get_time}}</view>
				<view class="subgift_user" >用户<text>{{item.nickname}}</text>已领取</view>
			</view>
		</view>
		<view>
			<u-loadmore :status="status" />
		</view>
	</view>
</template>

<script>
import {
	getAmountList,
} from "@/request/recharge/index.js";
export default {

	
	data() {
		return {
			list: [
			],
			limit:10,
		   page:1,
		   init_num:0,
		   num:0,
		 
		   last_page:1,
		   id:"",
		   status: 'loading',
		   shareType:0,
		}
	},
	methods: {
 //获取列表
 getList() {

	const params={
		limit:this.limit,
		page:this.page,
		id:this.id
	}
	getAmountList({...params}).then((res) => {
	
				if (res) {
					const {
						code,
						data
					} = res
					if (code==200) {
			 
	
						 const  {list,init_num,num} =data
						  this.init_num=init_num
						  this.num=num
					   this.last_page=list.last_page
					   this.page=this.page+1
						  if(this.page==1){
							this.list = list.data
						
						  }else{
							var listArr=this.list
							this.list = listArr.concat(list.data)
						  
						  }
						  this.status = '';
					}
				}
			}).catch((error) => {
				this.status = 'nomore';
			})
		}

	},
	onLoad(parameters) {
		this.id=parameters.id
		this.shareType=parameters.shareType
	    this.getList()
	},
	onReachBottom() {
		if (this.page>this.last_page){
				this.status='nomore'
				return;
			}
			this.status = 'loading';
			this.getList()
	}

};
</script>

<style lang="scss" scoped>
	page {
		background: #f5f5f5;
	}

	.subgiftList_content {
		padding: 20rpx 24rpx;

		.subgift_summary {
			display: flex;
			justify-content: center;
			align-items: center;
			height: 176rpx;
			background: #FFFFFF;
			border-radius: 20rpx;
			margin-bottom: 20rpx;

			view {
				display: flex;
				flex-direction: column;
				align-items: center;
				width: 50%;
				font-size: 24rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #999999
			}

			.subgift_share {
				position: relative;

				text:nth-child(2) {
					font-size: 36rpx;
					font-family: SourceHanSansCN-Bold, SourceHanSansCN;
					font-weight: bold;
					color: #333333;
					padding-top: 10rpx;
				}
			}

			.subgift_receive {
				text:nth-child(2) {
					color: #FF7700;
				}
			}

			.subgift_share:nth-child(1) {
				border-right: 2rpx solid #EDEDED;
			}

		}

		.subgift_list {
			.subgift_list_item {
				display: flex;
				justify-content: space-between;
				height: 126rpx;
				line-height: 126rpx;
				border-bottom: 2rpx solid #EDEDED;

				view:nth-child(1) {
					font-size: 24rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #999999;
					padding-left: 24rpx;
				}

				.subgift_user {
					font-size: 32rpx;
					font-family: PingFangSC-Semibold, PingFang SC;
					font-weight: 600;
					color: #333333;
					padding-bottom: 24rpx;

					text {
						color: #FF7700
					}
				}
			}
		}
	}
</style>
