<template>
	<view class='cotainer'>
		<view>
			<!-- <u-empty v-if="dataList.length==0" marginTop="250"></u-empty> -->
			<view class="ordertop">
				<view>{{totalScore}}</view>
				<view>
					<!-- <text>积分规则</text>
					<u-icon name="arrow-right" size="24"></u-icon> -->
				</view>
			</view>
			<view class="orderlist" v-if="showLog">
				<view class="orderlist-item" v-for="item in scoreLog">
					<view>
						<view>积分获取</view>
						<view>
							<text>{{item.created_at}}</text>
						</view>
					</view>
					<view>
						+{{item.score}}
					</view>
				</view>
			</view>
			<view v-else style="height:80vh">
				<u-empty mode="data"></u-empty>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				isLoading: false,
				totalScore: 0,
				scoreLog: [],
				showLog:true
			}
		},
		onLoad() {
			// this.loadOrder(1)
			this.loadScore()
		},


		methods: {
			async loadScore() {
				const res = await this.$u.api.user()
				this.totalScore = res.user.score
				this.scoreLog = res.scoreLog
				if(res.scoreLog && res.scoreLog.length>0){
					this.showLog = true
				}else{
					this.showLog = false
				}
				
			}
		}
	}
</script>

<style lang="scss">
	.cotainer {
		padding: 40rpx;
		background-color: #f0efed;
		height: 100vh;
		overflow: scroll;
	}

	.ordertop {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 30rpx;

		>view {
			&:first-child {
				font-size: 52rpx;
				color: #ba8b45;
			}

			&:last-child {
				font-size: 24rpx;
				color: #666666;
			}
		}
	}

	.orderlist {
		padding: 30rpx;
		// padding-bottom: 150rpx;
		background-color: #fff;
		border-radius: 10rpx;

		&-item {
			border-bottom: 1px solid #f3f3f3;
			padding: 20rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			font-size: 28rpx;

			>view {
				&:first-child {
					font-size: 28rpx;
					color: #000;

					>view {
						&:last-child {
							font-size: 20rpx;
							margin-top: 10rpx;
							color: #adadac;

							text {
								margin-right: 20rpx;

								font-size: 26rpx;
							}
						}
					}
				}

				&:last-child {
					color: #ba8b45;
					font-size: 36rpx;
				}
			}
		}
	}
</style>