<template>
	<view class="subgiftList_content">
		<!-- <view class="subgift_summary">
			<view class="subgift_share"><text>总分享次数</text><text>{{init_num}}</text></view>
			<view :class="['subgift_share','subgift_receive']"><text>总领取次数</text><text>{{num}}</text></view>
		</view> -->
		<view class="subgift_list_total"  v-show="list.length">
			<view v-for="(item,index) in list" :key="index" class="subgift_list_item" @click="toGet(item)">
				<view>发放时间：<text>{{item.c_time}}</text></view>
				<view>发放金额：<text>{{item.amount&&item.amount/100}}元消费补贴</text></view>

				<view class="subgift_user">
					<view>{{item.type==1?"分享次数":"转赠次数"}}：<text>{{item.init_num}}</text></view>
					<view>领取人数：<text>{{item.num}}</text></view>
				</view>
			</view>
		</view>
		<view>
			<u-loadmore :status="status" />
		</view>
	</view>
</template>

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

		
		data() {
			return {
				list: [
				],
				limit:10,
		       page:1,
			   init_num:0,
			   num:0,
			   last_page:1,
			   status: 'loading',
			}
		},
		methods: {
     //获取列表
	    getShareList() {
			console.log("哈哈静安寺飞书发")
		const params={
			limit:this.limit,
		    page:this.page
		}
 
	  	getShareList({...params}).then((res) => {
					if (res) {
						const {
							code,
							data
						} = res
						console.log(data,code == 200,"你好")
						if (code == 200) {
				  console.log("呼呼哈吉斯")
							 const  {init_num,num,list} =data
			 
							  this.init_num=init_num?init_num:0
							  this.num=num?num:0
							  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'
				})
			},
			//跳转领取列表
			toGet(item){
				uni.navigateTo({
					url:`/pages/pages-recharge/subgiftList/index?id=${item.id}&shareType=${item.type}`
				}) 
			}

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

	};
</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_total {
			.subgift_list_item {

				border-radius: 20rpx;

				background: #fff;

				margin-bottom: 24rpx;
				padding: 24rpx;

				view {
					font-size: 28rpx;
					font-family: SourceHanSansCN-Bold, SourceHanSansCN;
					color: #333333;
					line-height: 26px;
				}

				;

				text {
					font-size: 24rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #999999;
				}

				.subgift_user {
					display: flex;

					view:nth-child(1) {
						margin-right: 40rpx;
					}
				}
			}
		}
	}
</style>
