<template>
	<view class="previous" style="padding: 30upx;">
		<far-bottom></far-bottom>
		<view >
			<view >
				<view >
					<view  style="padding:30upx;background-color: #FFFFFF;margin-bottom: 30upx;border-radius: 10upx;position: relative;" v-for="(item,index) in previousList" :key="index" >
						<view class="dis-flex" style="position: absolute;right: 0;top: 0;" v-if="item.is_over == '1'">
							<view class="negSix">
								
							</view>
							<view class="f-20 f-w" style="height: 30upx;padding: 0upx 20upx;background-color: #FF4444;color: #FFFFFF;">
								已过期
							</view>
						</view>
						<view class="dis-flex" style="padding-bottom: 20upx;">
							<view class="t-l flex-box f-w">
								<text class="iconfont icon-activityfill" style="font-size: 24upx;color: #FF4444;"></text>
								<text style="font-size: 30upx;padding-left: 30upx;">{{item.title}}</text>
							</view>
							<view class="t-r flex-box" style="font-size: 30upx;color: #FF4444;font-weight: 600;">
								<text>-{{item.allmoney}}</text>
							</view>
						</view>
						<view class="f-26" style="color: #999999;padding-left: 50upx;padding-bottom: 30upx;">
							<view  style="padding-bottom: 20upx;">
								<text>发布时间:</text>
								<text style="padding-left: 20upx;">{{item.createtime}}</text>
							</view>
							<view >
								<text>转赠数量:</text>
								<text style="padding-left: 20upx;">{{item.allnum}}个,剩余{{item.surplus}}个</text>
							</view>
						</view>
						<view class="dis-flex">
							<view  style="flex: 0.6;">
								
							</view>
							<view class="flex-box dis-flex">
								<view class="flex-box t-r">
									<button class="mini-btn" style="border: 2upx solid #F1F1F1;" type="default" plain="true" size="mini" @click="gowq(item)" v-if="item.is_over !== '1'">查看详情</button>
								</view>
								<view class="flex-box t-r">
									<button class="mini-btn" style="border: 2upx solid #FF4444;" type="warn" plain="true" size="mini" @click="gojl(item)">领取记录</button>
								</view>
							</view>
						</view>
					</view>
					
				</view>
			</view>
		</view>
		<load-more :isMore="isMore" v-if="count > 1"></load-more>
	</view>
</template>

<script>
	import App from '@/common/js/app.js';
	import noneMores from '@/components/template/nonemores.vue';
	import loadMore from '@/components/template/loadmore.vue';
	// #ifdef H5
	import wxApi from '@/common/js/wxApi.js';
	// #endif
	export default{
		components:{
			loadMore
		},
		data(){
			return{
				previousList:[],
				count:1,
				page:1,
				isMore:false
			}
		},
		onLoad() {
			this.getPreviousList();
		},
		methods:{
			gojl(item){
				App.navigationTo({
					url:'pages/subPages/balance/getTheDetails/getTheDetails' + '?id=' + item.id
				})
			},
			gowq(item){
				App.navigationTo({
					url:'pages/subPages/balance/activityEntry/activityEntry' + '?id=' + item.id
				})
			},
			getPreviousList(flag){
				App._post_form(`&p=member&do=oldTransferList&page=${this.page}`,{},res=>{
					if(flag){
						this.previousList.push(...res.data.list);
					}else{
						this.setData({
							previousList:res.data.list,
							count:res.data.pagetotal
						});
					}
				})
			},
		},
		onReachBottom() {
			if(this.page == this.count){
				this.isMore = true;
				return
			};
			this.page++;
			this.getPreviousList(true);
		},
	}
</script>

<style>
	page{
		background-color: #F8F8F8;
	}
	.negSix{
		width: 0;
		height: 0;
		border-top: 30upx solid #FF4444;
		border-left: 30upx solid transparent;
	}
</style>
