<template>
	<ciy-header title="购买记录" ref="header"></ciy-header>
	<view v-if="init.code != 1" class="px4 py4">
		<view style="height:4em;width:100%;" class="ciy-skeleton"></view>
		<view style="height:6em;width:100%;" class="ciy-skeleton"></view>
		<view style="height:6em;width:100%;" class="ciy-skeleton"></view>
	</view>
	<view v-else>
		<view class="ciy-list" v-for="(item,index) in init.list" :key="item.id">
			<view class="rt">
				<text class="code" v-if="item.paytimes>0">已支付</text>
				<text class="code" v-else style="color:var(--txt1);">未支付</text>
			</view>
			<view class="l2">
				<text class="txt-lgg txt-wb px2">{{item.pnt}}</text>
				<text class="txt-smm">金币</text>
			</view>
			<view class="l2">支付流水</view>
			<view class="l3">{{item.name}}</view>
			<view class="lb">{{todatetime(item.addtimes)}}</view>
			<view class="rb">
				<text class="txt-lgg txt-wb px2">{{item.buypntmoney/100}}</text>
				<text class="txt-smm">元</text>
			</view>
		</view>
		<ciy-listend :page="pageno" :listlen="init.list.length" :nodataimg="file_stor('/img/mbnone.png')"></ciy-listend>
	</view>
</template>

<style>
</style>

<script>
	export default {
		data() {
			return {}
		},
		onLoad() {
			this.getlist();
		},
		onReachBottom(b) {
			if (this.init.code != 1)
				return;
			this.getlist();
		},
		onPullDownRefresh(b) {
			this.pageno = 0;
			this._stopPullDown = true;
			this.getlist();
		},
		watch: {},
		computed: {},
		methods: {
			async getlist() {
				if (this.pageno < 0)
					return;
				if (this._loading)
					return;
				this.pagepost.pageno = this.pageno + 1;
				this._loading = true;
				var retjson = await this.callfunc({
					func: 'me.pnt_buylst_list',
					data: this.pagepost
				});
				this._loading = false;
				if (retjson.code != 1)
					return this.alert(retjson.errmsg);
				this.pageno++;
				if (this.pageno == 1)
					this.init.list = [];
				this.init = this.objdeepmerge(this.init, retjson);
				if (retjson.list.length < retjson.pagecount)
					this.pageno = -1;
			},
		}
	}
</script>