<template>
	<view class="page">
		<navBar :title="from==0?'兑奖信息':'兑奖记录'" :back="true" color="black" background="white" />

		<view class="content" v-if="list.length!=0">
			<view class="item" v-for="(item,index) in list">
				<view class="line">
					<view class="left">
						姓名
					</view>
					<view class="right">
						{{item.name}}
					</view>
				</view>
				<view class="line">
					<view class="left">
						手机号
					</view>
					<view class="right">
						{{item.phone}}
					</view>
				</view>
				<view class="line">
					<view class="left">
						兑奖信息
					</view>
					<view class="right">
						{{item.award_content?item.award_content:'暂无'}}
					</view>
				</view>
				<view class="line">
					<view class="left">
						联系电话
					</view>
					<view class="right">
						{{item.phone}}
					</view>
				</view>
				<view class="line">
					<view class="left">
						是否邀约成功
					</view>
					<view class="right">
						{{item.state}}
					</view>
				</view>
				<view class="line">
					<view class="left">
						时间
					</view>
					<view class="right">
						{{item.created_at}}
					</view>
				</view>
			</view>
			<u-loadmore v-if="list.length!=0" style="" loadmoreText="已经到底啦" color="#CCCCCC" lineColor="#CCCCCC" line />
		</view>
		<view class="content" v-else>
			<u-empty mode="data" text="暂无数据" width="160" height="160" :icon="picUrl+'/static/other/empty.png'">
			</u-empty>
		</view>

		<u-loading-page :loading="loading" image="/static/index/logo.png" loading-text="页面加载中..."></u-loading-page>
	</view>
</template>

<script>
	import {
		getAwardDataReq,
	} from '@/api/test/index.js'
	export default {
		components: {

		},
		data() {
			return {
				picUrl: this.$picUrl,
				picBase: this.$picBase,
				list: [],
				loading: true,

				from: 0
			}
		},
		async onLoad(o) {
			if (o.from) {
				this.from = o.from
			}

			let res = await getAwardDataReq()
			if (res.code == 0) {
				console.log('获取我的兑奖信息返回值: ', res);
				this.list = res.data

				this.loading = false
			} else {
				this.loading = false
				uni.showToast({
					title: res.message,
					icon: 'none'
				})
			}
		},
		methods: {

		}
	}
</script>

<style lang="scss" scoped>
	@import "./index.scss";
</style>