<template>
	<!-- 积分记录 -->
	<view class="IntegralRecord">
		<navbar :title="title" leftClick @leftClick="leftClick" />
		
		<view class="const">
			<view class="number">
				当前积分
				<view>
					{{ userInfo.integerPrice }}
				</view>
			</view>
			<!-- <view class="bottom">
				<view>
					正式积分：{{ formal.formalScore }}
				</view>
				<view>
					临时积分：{{ formal.tempScore }}
				</view>
			</view> -->
		</view>
		
		<view class="">
			<uv-tabs :list="tabs"
			lineColor="#3796F8"
			lineHeight="8rpx"
			lineWidth="50rpx"
			@click="clickTabs"></uv-tabs>
		</view>
		
		<view class="tab-box">
			<view class="tab-box1" v-if="total">
				<uv-cell center border :title="item.title"
				v-for="(item, index) in list"
				:value="x[item.type] + item.score" :label="item.createTime" />
			</view>
			<view 
			style="padding: 100rpx 0;"
			v-else>
				<uv-empty 
				mode="history"
				textSize="28rpx"
				iconSize="100rpx"/>
			</view>
		</view>
	</view>
</template>

<script>
	import mixinList from '@/mixins/list.js'
	export default {
		mixins : [mixinList],
		data() {
			return {
				title : '积分记录',
				x : ['+', '-'],
				status : 0,
				tabs: [
					{
						name: '收入'
					},
					{
						name: '消耗'
					},
				],
				type : 0,
				mixinsListApi : 'commonQueryScoreRecord',
				// 积分
				formal : {},
			}
		},
		onLoad(e) {
			this.status = e.status
			this.queryParams.type = this.type
		},
		onShow() {
			this.getCounst()
			this.$store.commit('getUserInfo')
		},
		methods: {
			leftClick() {		//返回钱包
				uni.navigateBack(-1)
			},
			clickTabs({index}) {
				this.type = index
				this.queryParams.type = this.type
				this.getData()
			},
			getCounst(){
				this.$api('commonQueryScore', res => {
					if(res.code == 200){
						this.formal = res.result
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
.IntegralRecord{
	width: 750rpx;
	background: #fff;
	margin: 0 auto;
	min-height: 100vh;
	.const{
		display: flex;
		flex-direction: column;
		margin: 40rpx 20rpx;
		box-shadow: 0 0 6rpx 6rpx #00000011;
		border-radius: 20rpx;
		overflow: hidden;
		.number{
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			padding: 40rpx;
			background-color: $uni-color;
			color: #fff;
			view{
				font-size: 40rpx;
				font-weight: 900;
			}
		}
		.bottom{
			color: $uni-color;
			display: flex;
			view{
				flex: 1;
				display: flex;
				justify-content: center;
				align-items: center;
				padding: 20rpx;
			}
			view:nth-child(1){
				border-right: 1rpx solid $uni-color;
			}
		}
	}
	.tab-box{
		margin: 20rpx;
		background-color: #fff;
		border-radius: 20rpx;
		overflow: hidden;
	}
}
</style>
