<template>
	<view class="consume-list-box">
		<view class="consume-list">
			<view class="consume-title">
				<text class="consume-title-left"></text>
				<view class="consume-title-text">{{ title }}</view>
				<text class="consume-title-right"></text>
			</view>
			<block v-for="item in list">
				<view class="consume-list-item">
					<view class="item-val">
						<text class="item-val-title">{{ item[keys.title] }}</text>
						<text class="item-val-time">{{ item[keys.time] }}</text>
					</view>
					<view :class="['item-val-num' , item[keys.type] === 1 ? '' : 'red-color']">
						{{ item[keys.type] === 1 ? '+' : '-'}}{{ item[keys.val]}}
					</view>
				</view>
			</block>
			<loadMore v-if="list.length>0 || status === 'loading'" :status="status"></loadMore>
			<nodata v-else :config="{ top: 1, content: '暂无数据~' }"></nodata>
		</view>
	</view>
</template>

<script>
	import {
		refillCardInfo
	} from "@/api/personal-center.js"
	export default {
		name: "consume-list",
		props: {
			title: {
				type: String,
				default: ''
			},
			keys: {
				type: Object,
				default: () => {
					return {
						title: 'remark',
						time: 'formatCreateTimeMillis',
						val: 'entryValue',
						type: 'billType'
					}
				}
			},
			status: {
				type: String,
				default: ''
			},
			list: {
				type: Array,
				default: () => {
					return []
				}
			},
		},
		data() {
			return {

			};
		},
		methods: {

		}
	}
</script>

<style lang="scss" scoped>
	.consume-list-box{
		width: 100%;
		position: relative;
	}
	.consume-list {
		width: 100%;
		padding: 0 60rpx;
		
		position: absolute;
		top: -113rpx;
		// transform: translateY(-113rpx);
		background-color: #fff;
		border-radius: 40rpx 40rpx 0 0;
		min-height: 120rpx;

		.consume-title {
			background-color: #fff; 
			width: 100%;
			height: 113rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			font-size: 32rpx;
			font-family: PingFang SC, PingFang SC-Bold;
			font-weight: 700;
			color: #FA6138;
		}

		.consume-title-text {
			padding: 0 22rpx;
		}

		.consume-title-left {
			width: 60rpx;
			height: 2rpx;
			background: linear-gradient(90deg, #ffffff, #3775f6);
			border-radius: 1px;
			position: relative;

			&:before {
				content: '';
				position: absolute;
				right: 0;
				top: -50%;
				width: 6rpx;
				height: 6rpx;
				background: #FA6138;
				border-radius: 50%;
			}
		}

		.consume-title-right {
			width: 60rpx;
			height: 2rpx;
			background: linear-gradient(270deg, #ffffff, #3775f6);
			border-radius: 1px;
			position: relative;

			&:before {
				content: '';
				position: absolute;
				left: 0;
				top: -50%;
				width: 6rpx;
				height: 6rpx;
				background: #FA6138;
				border-radius: 50%;
			}
		}

		.consume-list-item {
			width: 100%;
			height: 151rpx;
			border-bottom: 1rpx solid #e6e6e6;
			display: flex;
			justify-content: space-between;
			align-items: center;
			font-family: PingFang SC, PingFang SC-Regular;
			font-weight: 400;

			.item-val {
				font-family: PingFang SC, PingFang SC-Regular;
				font-weight: 400;
				display: flex;
				flex-direction: column;

				.item-val-title {
					font-size: 28rpx;
					color: #1a1a1a;
					padding-bottom: 14rpx;
				}

				.item-val-time {
					font-size: 24rpx;
					color: #999999;
				}
			}

			.item-val-num {
				flex-shrink: 0;
				font-size: 30rpx;
				color: #FA6138;
			}
			.red-color{
				color: #FF3B3B;
			}
		}
	}
</style>
