<template>
	<view class="content">
	   <navigation>
		   Recharge Record
	   </navigation>
    <view class="record_body" :class="totalPage>0?'auto':''">
  	<view class="record_item flex" v-for="(item,index) in record_list" :key="item.orderNo">
    		<view class="numcon flex">
    			<image src="../../../../static/login/list_icon_card@2x.png" mode="aspectFit" class="img1"></image>
    		    <view class="num">
    		    	<view class="rec">
    		    		{{item.tranAmt}} Wait
    		    	</view>
					<view class="cpay">
						CPAY
					</view>
    		    </view>
			</view>
			<view class="time">
				{{item.addTime}}
			</view>
    	</view>
		<view class="noRes" v-show="totalPage<0">
			<view class="imgcon">
				<image src="../../../../static/promo/menban@3x.png" mode="aspectFit"></image>
			</view>
		    <view class="res">
		    	No results
		    </view>
		</view>
    </view>
	 
	</view>
	
</template>

<script>
	import api from '@/utils/api'
	import utils from '@/utils'
	import cont from "@/components/navigation/navigation.vue"
	import index from '@/utils/index.js'
	export default{
		data(){
			return{
			pageNumber:1,
			pageSize:8,
			record_list:[],
			totalPage:0,
				}
			},
		
		onLoad() {
			this.getRechardRecord()
},
		onReachBottom() {
	this.pageSize += 8;
	if(this.pageSize>this.totalPage){
		return;
	}
			this.getRechardRecord();
			},
		
		methods:{
			getRechardRecord(){
				
				
				
				const post2 = api.rechargeList({
					"ticket": uni.getStorageSync('logInfo').data,
					"pageNumber":this.pageNumber,
					"pageSize":this.pageSize,
				})
				post2.then(res => {
					if(res.data.content){
					this.record_list=res.data.content;
					for(var i=0;i<this.record_list[i].addTime;i++){
						this.record_list[i].addTime=index.formatyymmddhhmmss(this.record_list[i].addTime);
					}	
					this.totalPage=res.data.totalElements;

					}

		
					})
					.catch(e => {
						uni.showToast({
							title: e,
							icon: 'none',
							duration: 2500
						})
					})
				
				
				},
			},
				
	}
</script>

<style>
@import './index.css';
</style>
