<template>
	<view class="" style="text-align: center;">
			
		<view style="padding: 50rpx;padding-bottom: 0rpx;">
			<view style="color: #fff;">当前</view>
			<view style="color: #fff;font-size: 50rpx;line-height: 200%;">{{userinfo.tjprice}}</view>
		</view>	
		<button type="default" @click="zhuanzhang()" class="btn1" style="margin-bottom: 30rpx;">转乐票</button>
	    <view v-for="(item,index) in list" style="border-top: solid 1px gainsboro;padding:30rpx 10rpx;color: #fff;font-size:28rpx;line-height: 150%;">
			<view style="width: 100%;display: table;">
				<view style="float: left;">
					<view>
						<text v-if="item.type==0" style="color: #fff;">+{{item.price}}</text>
						<text v-if="item.type==1" style="color: #e8131a;font-weight: bold;">-{{item.price}}</text>
					</view>
				</view>
				<view style="float: right;">
					<view>{{item.time}}</view>
				</view>
			</view>			
			<view style="display: table;width: 100%;text-align: left;">{{item.content}}</view>
		</view>
		<uni-load-more :status="status"  :content-text="contentText" />
		<view v-if="list.length==0" style="padding: 20px;">
			暂无明细
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				constants: {},
				userinfo: null,
				data:{
					_token:"",
					uid:0,
				},
				num:"",
				mobile:"",
				jymm:"",
				list:[],
				page:1,
				status: 'more',
				contentText: {
					contentdown: '上拉加载更多',
					contentrefresh: '加载中',
					contentnomore: '到底了'
				}
			};
		},		
		onShow() {
			var user = this.$api.getUserinfo();	
			if (user) {
				this.userinfo = user;
				this.data._token=user._token;
				this.data.uid=user.id;
				this.page=1;
				this.list=[];
				this.MhMyInteger();
			} else {
				this.userinfo = null;
			}
		},
		onReachBottom() {
			this.status = 'loading';
			this.page++;
			this.MhMyInteger();
		},
		methods: {
			zhuanzhang(){
				//手动预约的  要求输入数量
				uni.navigateTo({
					url: 'syzlp'
				});
			},			
			MhMyInteger(){
				var data = this.data;
				data.page=this.page;
				this.$api
					.MhPostModel(data, 'user/tjsy')
					.then(res => {
						var shuju = res.data.data.data;
						this.list = this.list.concat(shuju)
						this.status = 'more';
						if (shuju.length == 0) {
							this.status = 'nomore';
						}	
					})
					.catch(err => {
						// console.log('request fail', JSON.stringify(err));
					});
			},
		}
	}
</script>
<style>
	page{padding: 15rpx;background:   #98a737;background-attachment: fixed !important;
	    background-repeat: no-repeat !important;}
	.btn1{background: #f2a50b; width:150rpx;text-align: center;color: #fff;font-size: 30rpx;line-height: 200%;border-radius: 10rpx;}
</style>
