<template>
	<view>
		<view class='commission-details'>
			<view class='promoterHeader bg-color'>
				<view class='headerCon acea-row row-between-wrapper'>
					<view>
						<view class='name'>{{name}}</view>
						<view class='money'>￥<text class='num'>{{recordCount}}</text></view>
					</view>
					<view class='iconfont icon-jinbi1'><image src='https://hy.liuniu946.com/app/img/yj.png' mode=""></image> </view>
				</view>
			</view>
			<view class='sign-record'>
				<block v-for="(item,index) in recordList" :key="index" v-if="recordList.length>0">
					<view class="time">{{item.time}}</view> 
					<block >
						<view class='list' v-for="(t,i) in item.list"> 
							<view class='item'>
								<view class='listn'>
									<view class='itemn acea-row row-between-wrapper'>
										<view>
											<view class='name line1'>{{t.title}}</view>
											<view class="time">{{t.add_time}}</view>
										</view>
										<view class='num' v-if="t.pm==0">-{{t.number}}</view>
										<view class='num font-color' v-else>+{{t.number}}</view>
									</view>
								</view>
							</view>
						</view>
					</block>
				</block>
				<view v-if="recordList.length == 0">
					<emptyPage title='暂无记录~'></emptyPage>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getCommissionInfo,
		spreadCount,
		getSpreadInfo,
		extractLst,
		spreadInfo
	} from '@/api/user.js';
	import { cashList, userBalance,spreadCommission} from '@/api/wallet.js';
	import {
		toLogin
	} from '@/libs/login.js';
	import emptyPage from '@/components/emptyPage.vue'
	export default {
		components: {
			
			emptyPage
		},
		data() {
			return {
				name: '佣金列表',
				type: 0,
				page: 1,
				limit: 12,
				recordList: [],
				recordType: 0,
				recordCount: 0,
				status: false,
				extractCount: 0,
			};
		},
		onLoad(options) {
			
		},
		onShow: function() {
			let type = this.type;
				uni.setNavigationBarTitle({
					title: "佣金列表"
				});
				this.recordType = 2;
			this.spreadInfo();
			this.getRecordList();
		},
		methods: {
			spreadInfo(){
				let that=this;
				spreadInfo().then(res => {
					that.recordCount = res.data.commissionCount;
					that.extractCount = res.data.extractCount;
				});
			},
			getRecordList: function() {
				console.log("0000")
				let that = this;
				let page = that.page;
				let limit = that.limit;
				let status = that.status;
				let recordType = that.recordType;
				let recordList = that.recordList;
				let recordListNew = [];
					spreadCommission({
						page: page,
						limit: limit
					},3)
					.then(res => {
						let ln=res.data.length;
						
						console.log(ln)
						let recordListData =res.data;
						recordListNew = recordList.concat(recordListData);
						that.page+=1;
						that.$set(that, 'recordList', recordListNew);
					});
					console.log(recordList.length)
			},
		},
	}
</script>

<style scoped lang="scss">
	.sign-record .num{
		color: red;
	}
	.time{
		margin: 10rpx;
		font-size: 24rpx;
		color: #606266;
	}
	.list{
		border-radius: 10rpx;
		background-color: #fff;
		padding: 10rpx;
		width: 98%;
		margin: 1%;
	}
	.icon-jinbi1 image{
		opacity: 0.6;
		margin: 40rpx;
		width: 120rpx;
		height: 120rpx;
	}
	.bg-color{
		color: #fff;
		border-bottom-left-radius: 20rpx;
		border-bottom-right-radius: 20rpx;
		height: 220rpx;
		background-color: #f75022 !important;
	}
	.commission-details .promoterHeader .headerCon .money {
		margin: 10rpx;
		font-size: 36rpx;
	}

	.commission-details .promoterHeader .headerCon .money .num {
		font-family: 'Guildford Pro';
	}
	.message{
		font-size: 18rpx;
		color: #fc4141;
	}
	.name {
	    margin:20rpx;
	}
	
</style>
