<template>
	<view class="container">
		<view class="card" v-for="(item, index) in list">
			<view class="leftIcon" ></view>
			<view class="left"  >
				￥<span style="font-size: 18px;">{{item.discount}}</span>
			</view>
			<view class="right">
				<view class="row title">
					{{item.name}}
				</view>
				<view class="row endTime">
					{{item.endTime}}到期
				</view>
				<view class="row desc">
					{{item.desc}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		couponListApi
	} from "@/api/coupon.js"
	export default {
		onLoad() {
			this.getList()
		},
		data() {
			return {
				list: [],
				params: {
					limit: 999,
					page: 1,
					status: 0
				}
			}
		},
		methods: {
			getList() {
				couponListApi(this.params).then(res => {
					console.log(res, '我的优惠券')
					this.list = res.data.list
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.container {
		background: #eaeaea;
		padding: 10px;
		
		.card {
			background: #fff;
			border-radius: 8px;
			overflow: hidden;
			display: flex;
			
			.leftIcon {
				height: auto; 
				width: 8px; 
				background: #FF2C43;
			}
			.left {
				width: 80px;
				display: inline-flex;
				justify-content: center;
				align-items: center;
				color: #FF2C43;
				font-weight: 600;
			}
			.right {
				padding: 10px;
				.row {
					margin-bottom: 4px;
					font-size: 12px;
				}
				.title {
					font-size: 14px;
					font-weight: 600;
				}
				.endTime {
					color: #FF2C43;
				}
				.desc {
					margin-top: 5px;
					color: #8c8c8c;
				}
			}
		}
	}
	
</style>
