<template>
	<view>
		<view class="header">
			<view class="header-lef">消息<span>({{ msgList.length }})</span></view>
			<view 
				class="header-rig"
				@click="sweepNote"
			>
				<image src="/static/sweep.png" mode=""></image>
				清除未读
			</view>
		</view>
		<view class="lower-cont">
			<view 
				class="single-msg"
				v-for="(msg, index) in msgList"
				:key="index"
			>
				<view class="single-lef">
					<image :src="msg.pic" mode=""></image>
				</view>
				<view class="single-rig">
					<view class="rig-upper">
						<h4>{{ msg.name }}</h4>
						<span>{{ msg.time }}</span>
					</view>
					<view class="rig-lower">
						<h5>{{ msg.content }}</h5>
						<view>
							{{ msg.dot }}
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				msgList: [
					{
						name: '老张租赁',
						time: '09:12',
						pic: '/static/bg1.jpg',
						content: '公司诚信经营！价格亲民，您可以再多看看',
						dot: '1'
					},
					{
						name: '老王租赁',
						time: '11:17',
						pic: '/static/bg2.jpg',
						content: '我们的宗旨是能卖一千，绝不八百',
						dot: '3'
					},
					{
						name: '老李租赁',
						time: '18:02',
						pic: '/static/bg3.jpg',
						content: '在吗，有想我吗？',
						dot: '7'
					}
				]
			}
		},
		methods: {
			sweepNote () {
				console.log(2);
			}
		}
	}
</script>

<style lang="scss">
	body{
		background: linear-gradient(#E5F1FD, #fff);
	}
	.header{
		width: 90%;
		margin: 25rpx auto;
		margin-top: 60rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		.header-lef{
			font-weight: bold;
			font-size: 18px;
			span{
				font-size: 14px;
			}
		}
		.header-rig{
			width: 20%;
			font-size: 12px;
			color: #9BA6B3;
			image{
				width: 20%;
				height: 20rpx;
			}
		}
	}
	.lower-cont{
		width: 90%;
		margin: 0 auto;
		background-color: #fff;
		box-sizing: border-box;
		padding: 15rpx;
		border-radius: 20rpx;
		.single-msg{
			width: 100%;
			box-sizing: border-box;
			padding: 15rpx;
			border-bottom: 1px solid #F5F5F5;
			display: flex;
			.single-lef{
				width: 20%;
				height: 120rpx;
				border-radius: 50%;
				overflow: hidden;
				image{
					width: 100%;
					height: 100%;
				}
			}
			.single-rig{
				flex: 1;
				box-sizing: border-box;
				padding: 10rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-around;
				align-items: center;
				.rig-upper, .rig-lower{
					width: 100%;
					display: flex;
					justify-content: space-between;
					align-items: center;
					h5{
						width: 80%;
						overflow: hidden;
						white-space: nowrap;
						text-overflow: ellipsis;
						font-weight: normal;
						color: #ABABAB;
						font-size: 12px;
					}
					span{
						color: #ABABAB;
						font-size: 12px;
					}
				}
				.rig-lower{
					view{
						width: 8%;
						height: 100%;
						background-color: red;
						border-radius: 50%;
						color: #fff;
						display: flex;
						justify-content: center;
						align-items: center;
						font-size: 14px;
					}
				}
			}
		}
		.single-msg:last-child{
			border-bottom: none;
		}
	}
</style>
