<template>
	<view>
		<view class="bill-details">
			<view class="sign-record">
				<z-paging ref="paging" v-model="dataList" @query="queryList">
					<view class="list pad30" style="margin-bottom: 15rpx" v-for="(vo, index) in dataList" :key="index">
						<view class="item">
							<view class="listn borRadius14">
								<view style="height: 130rpx;" class="itemn acea-row row-between-wrapper">
									<view>
										<view class="name line1">{{ vo.recordName }}</view>
										<view v-if="vo.infoName" style="margin-bottom: 10rpx;">订单号：{{ vo.infoName }}</view>
										<view>{{ vo.createTime }}</view>
									</view>
									<view class="num">{{ vo.amount }}</view>
								</view>
							</view>
						</view>
					</view>
				</z-paging>
			</view>
		</view>
		<!-- #ifdef MP -->
		<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
		<!-- #endif -->
		<home></home>
	</view>
</template>

<script>
import { getBillList, getUsersMoneyRecord } from '@/api/user.js';
import { toLogin } from '@/libs/login.js';
import { mapGetters } from 'vuex';
// #ifdef MP
import authorize from '@/components/Authorize';
// #endif
import emptyPage from '@/components/emptyPage.vue';
import home from '@/components/home';
export default {
	components: {
		// #ifdef MP
		authorize,
		// #endif
		emptyPage,
		home
	},
	data() {
		return {
			dataList: [],
			isAuto: false, //没有授权的不会自动授权
			isShowAuth: false //是否隐藏授权
		};
	},
	computed: mapGetters(['isLogin']),
	onShow() {
		if (this.isLogin) {
			this.getUserBillList();
		} else {
			toLogin();
		}
	},
	/**
	 * 生命周期函数--监听页面加载
	 */
	onLoad: function (options) {
		this.type = options.type;
	},
	/**
	 * 页面上拉触底事件的处理函数
	 */
	onReachBottom: function () {
		this.getUserBillList();
	},
	methods: {
		/**
		 * 授权回调
		 */
		onLoadFun: function () {
			this.getUserBillList();
		},
		// 授权关闭
		authColse: function (e) {
			this.isShowAuth = e;
		},

		queryList(pageNo, pageSize) {
			const params = {
				page: pageNo,
				limit: pageSize
			};
			getUsersMoneyRecord(params)
				.then(({ data }) => {
					this.$refs.paging.complete(data);
				})
				.catch((res) => {
					this.$refs.paging.complete(false);
				});
		}
	}
};
</script>

<style>
.zp-paging-container-content {
	padding: 15rpx 0 !important;
}
</style>

<style scoped lang="scss">
.sign-record {
}
.bill-details .nav {
	background-color: #fff;
	height: 90rpx;
	width: 100%;
	line-height: 90rpx;
}

.bill-details .nav .item {
	flex: 1;
	text-align: center;
	font-size: 30rpx;
	color: #282828;
}

.bill-details .nav .item.on {
	color: $theme-color;
	border-bottom: 3rpx solid $theme-color;
}
</style>
