<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="index">
    		<view class="numcon">
    			
    		    <view class="">
    		    	<view class="rec">
						<view class="">
						<!-- <image src="../../../../static/login/list_icon_card@2x.png" mode="aspectFit" class="img1"></image> -->
    		    		{{currencySymbol}}{{item.tranAmt}}
							</view>
						<view class="time">
							{{item.orderNo}}
						</view>
						<view class="time">
					    {{item.addTime}}
						</view>
    		    	</view>
		
    		    </view>
			</view>
			<!--  -->
			<view class="status_con">
				<view class="status" :class="item.orderStatus=='pay_unpaid'?'red':'green'">
					<text v-if="item.orderStatus=='pay_unpaid'">Unpaid</text>
					<text v-if="item.orderStatus=='pay_success'">Paid</text>
				</view>
				<view class="cpay">
						{{item.payTypeName}}
				</view>
			</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>
	 <tab-bar :selectActive="5"></tab-bar>
	</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:10,
			record_list:[],
			totalPage:0,
			currencySymbol:'',
				}
			},
			
		
		onLoad() {
			this.currencySymbol=uni.getStorageSync('siteInfo').currencySymbol;
			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!=undefined){
					this.record_list=res.data.content;
					for(var i=0;i<this.record_list.length;i++){
						this.record_list[i].addTime=index.formatyymmddhhmmss(this.record_list[i].addTime);
						this.record_list[i].tranAmt=this.record_list[i].tranAmt.toFixed(2);
					}	
					this.totalPage=res.data.totalElements;
                     console.log(this.record_list,3333333333)
					}

		
					})
					.catch(e => {
						uni.showToast({
							title: e,
							icon: 'none',
							duration: 2500
						})
					})
				
				
				},
			},
			onReachBottom(){
				this.pageSize+=10;
				this.getRechardRecord()
			}
				
	}
</script>

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