<template>
	<view>
		<view class="list" v-if="pageList && pageList.length > 0">
			<view class="li ddflex" v-for="(item, index) in pageList">
				<view class="fflex">
					<view class="id">订单编号：{{ item.id }}</view>
					<view class="time">{{ item.payTime }}</view>
				</view>
				<view class="money">
					<text>￥</text>
					{{ item.payMoney }}
				</view>
			</view>
		</view>
		<view class="nodata" v-else>
			<image :src="picUrlss + 'empty_dd.png'"></image>
			<text>暂无记录</text>
		</view>
	</view>
</template>

<script>
const req = require('../../utils/request.js');
const api = require('../../utils/api.js');
const util = require('../../utils/util.js');
const app = getApp();
export default {
	data() {
		return {
			picUrlss: req.public.picUrls,
			form: {
				page: 1,
				limit: 10
			},
			pageList: [],
			isLoad: true,
			openId: ''
		};
	},
	onLoad(options) {
		this.openId = options.openId;
		this.getList();
	},
	onReachBottom() {
		this.form.page++;
		this.getList();
	},
	onShow() {},

	methods: {
		getList() {
			if (!this.isLoad) return false;
			this.isLoad = false;
			if (this.form.page == 1) {
				uni.showLoading();
			}
			let form = this.form;
			form.openId = this.openId;
			req.getRequest(///api/receipt/receiptLogs
				'/api/v3/collection/logs',
				form,
				res => {
					if (res.list && res.list.length == this.form.limit) this.isLoad = true;
					if (this.form.page > 1) res.list = this.pageList.concat(res.list);
					this.pageList = res.list;
					uni.hideLoading();
				},
				true
			);
		}
	}
};
</script>

<style>
@import './paymentList.css';
</style>
