<template>
	<view class="m-b20 statistics_title">
		<view class="row-justify-sb center">
			<view class="row-c left">
				<view class="circle column-c justify-center">
					<view class="outer" :style="{background:bgColor[genre]}"></view>
					<view class="inside" :style="{background:bgColor[genre]}"></view>
				</view>
				<text class="size-28 text-color-12 sys-weight-600 m-l16">{{leftText}}</text>
			</view>
			<view class="row-c line-40" v-if="is_right && !is_age" @click="onHandle">
				<text class="size-24 text-color-8F9 m-r6">{{rightText}}</text>
				<uni-icons type="forward" size="16" color="#8F99B1"></uni-icons>
			</view>
			<view v-else></view>
			<view class="row-c" v-if="is_age">
				<view class="row-c m-l20" v-for="(item,index) in list" :key="index">
					<view class="wh-14 m-r10" :style="{background:item.color}"></view>
					<text class="size-24 text-color-576">{{item.name}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'statistics_title',
		props: {
			genre: {
				type: Number,
				default: 0
			},
			leftText: {
				type: String,
				default: ''
			},
			rightText: {
				type: String,
				default: ''
			},
			is_right: {
				type: Boolean,
				default: true
			},
			is_age: {
				type: Boolean,
				default: false
			},
		},
		data() {
			return {
				bgColor: ['#0FB160', '#FE7F37', '#10A2B0', '#DE2519'],
				list: [{
          color: '#2B7DFA'
        },{
					name: '数量',
					color: '#2B7DFA'
				}, {
					name: '金额',
					color: '#00BF8A'
				}, {
					name: '金额',
					color: '#ED9A2C'
				}, ]
			};
		},
		methods: {
			onHandle() {
				this.$emit('onHandle')
			}
		}
	}
</script>

<style lang="scss" scoped>
	.statistics_title {
		.left {
			line-height: 40rpx;

			.circle {
				position: relative;

				.outer {
					width: 35rpx;
					height: 35rpx;
					opacity: 0.2;
					border-radius: 50%;
				}

				.inside {
					width: 12rpx;
					height: 12rpx;
					border-radius: 50%;
					position: absolute;
					top: calc(50% - 6rpx);
				}
			}
		}

		.right {
			line-height: 35rpx;
		}
	}
</style>