<template>
	<view class="pad-x120">
		<!-- 头部 -->
		<status-nav navBarTitle="工资记录"></status-nav>
		<view class="content" :style="{'padding-top':statusHeight+50+'px'}">
			<!-- 工资记录 -->
			<view class="sign-record sign-record-other bg-white">
				<view class="item font26" v-for="(item,index) in wagesList" :key="index">
					<view class="info info-other">
						<text>{{item.date}}</text>
						<text :class="item.status==0?'color-blue':'color-66'">{{item.status_text}}</text>
					</view>
					<view class="wages-info">
						<view class="text">基本工资:{{item.base_amount}}元</view>
						<view class="text">加班工资:{{item.overtime_amount}}元</view>
						<view class="text">合计:<text class="font32">{{item.amount}}</text>元</view>
					</view>
				</view>
			</view>
			<!-- 加载更多 -->
			<view class="more-tips font24">{{wagesList.length==total?'没有更多数据了':'下滑获取更多'}}</view>
		</view>
		<!-- 尾部 -->
		<tabbar :userType="userType" current="2"></tabbar>
	</view>
</template>
<script>
	import tabbar from '@/components/tabbar/tabbar';
	export default {
		components:{
			tabbar
		},
		data() {
			return {
				statusHeight:uni.getSystemInfoSync().statusBarHeight, //状态栏高度
				userType:'worker', //账户类型 工人:worker 负责人:director
				wagesList:[], //加班列表
				page:1,
				size:10,
				total:0,
			}
		},
		onLoad() {
			// 获取工资列表
			this.getWagesList();
		},
		onReachBottom() {
			if(this.wagesList.length<this.total){
				this.page++;
				// 获取工资列表
				this.getWagesList();
			}
		},
		methods: {
			// 获取工资列表
			getWagesList(){
				let params = {
					page:this.page,
					size:this.size,
				}
				if(this.page==1) this.wagesList = [];
				this.$requst.post('/api/v1/worker/pay-list',params).then(res=>{
					if(res.code==0){
						console.log(res,'工资记录');
						this.total = res.data.total;
						this.wagesList = this.wagesList.concat(res.data.list);
					}
				})
			},
		}
	}
</script>
<style scoped>
	
</style>