<template>
	<view>
		<view class="item-box" v-for="(item, index) in listData" :key="index">
			<view class=" d-b-c mb20">
				<view class="label-name">{{$t('N_I_124')}}</view>
				<view class="item-content f26 gray3">{{item.memberCode}}</view>
			</view>
			<view class=" d-b-c mb20">
				<view class="label-name">{{$t('CK_KS_14')}}</view>
				<view class="item-content f26 gray3">{{item.memberName}}</view>
			</view>

			<view class=" d-b-c mb20">
				<view class="label-name">{{$t('PER_DA_5')}}</view>
				<view class="item-content f26 gray3">{{item.pkRegisterGradeStr}}</view>
			</view>
			<view class=" d-b-c mb20">
				<view class="label-name">{{$t('w_0141')}}</view>
				<view class="item-content f26 gray3">{{item.creationTime}}</view>
			</view>
			<view class=" d-b-c mb20">
				<view class="label-name">{{$t('N_I_103')}}</view>
				<view class="item-content f26 gray3">{{formatNum(item.consumeAchieve || 0)}}</view>
			</view>
		</view>
		<view class="d-c-c p30" v-if="listData.length == 0 && !loading">
			<text class="iconfont icon-wushuju"></text>
			<text class="cont">{{$t('w_0405')}}</text>
		</view>
		<uni-load-more v-else :loadingType="loadingType"></uni-load-more>
	</view>
</template>

<script>
	import uniLoadMore from '@/components/uni-load-more.vue';
	export default {
		data() {
			return {
				/*有没有等多*/
				no_more: false,
				/*是否正在加载*/
				loading: true,
				listData: [],
				form: {
					pageNum: 0,
					pageSize: 10
				},
				total: 0,
			};
		},
		computed: {
			/*加载中状态*/
			loadingType() {
				if (this.loading) {
					return 1;
				} else {
					if (this.listData.length != 0 && this.no_more) {
						return 2;
					} else {
						return 0;
					}
				}
			}
		},
		onReachBottom() {
			let self = this;
			if (self.form.pageNum * self.form.pageSize < self.total) {
				self.form.pageNum++;
				self.getData();
			}
			self.no_more = true;
		},
		onShow(e) {
			/*获取数据*/
			this.listData = [];
			this.form.pageNum = 1;
			this.getData();
		},
		methods: {
			getData() {
				let self = this;
				self.loading = true;
				var formdata = self.form;
				self._get(
					'member/api/member/parent-list', formdata,
					function(res) {
						self.listData = self.listData.concat(res.rows) ;
						self.total = res.total;
						if (self.total < (self.form.pageNum * self.form.pageSize)) {
							self.no_more = true;
						}
					}, {},
					() => {
						self.loading = false;
					}
				);
			},
		}
	};
</script>

<style lang="scss">
	.label-name {
		font-size: 26rpx;
		color: #999;
		word-break: break-all;
		width: 40%;
		flex-shrink: 0;
		line-height: 1.5;
	}

	.item-content {
		flex-shrink: 0;
		width: 60%;
		word-break: break-all;
		line-height: 1.5;
		text-align: right;
	}

	.item-box {
		width: 750rpx;
		box-sizing: border-box;
		margin-bottom: 20rpx;
		padding: 32rpx 26rpx;
		background: #ffffff;
	}
</style>