<template>
	<view class="content safe-area-inset-bottom">
		<MessageNotification />
		<!-- 描述 -->
			<view class="card" v-for="item in list" :key="item.id">
				<image src="/static/xx/cpdd.png" mode=""></image>
				<view class="info">
					<view class="infos_title">
						<text class="infos">订单</text>
						<text class="time">{{item.notice_at}}</text>
					</view>
					<view class="preview">
						{{item.content}}
					</view>
				</view>
			</view>

			<!-- 为空 -->
			<view class="empty">
				<u-empty text="暂无产品订单信息" mode="list" v-if="list.length==0"></u-empty>
			</view>
	</view>
</template>

<script>
	import {
		getOrderNoticeApi
	} from '../../request/api/systemNotice'
	export default {
		data() {
			return {
				list: [],
			}
		},
		onLoad() {
			
		},
		methods: {
			async goInfo() {
				try {
					const res = await getOrderNoticeApi({
						store_id: uni.getStorageSync('store_id') || 11001
					})
					if (res.data && res.data.result && res.data.result.items) {
						this.list = res.data.result.items
					}
				} catch (error) {
					console.error('获取订单消息失败:', error)
				}
			}
		},
		mounted() {
			this.goInfo()
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		width: 750rpx;
		max-height: 100%;
		min-height: 100vh;
		padding-bottom: env(safe-area-inset-bottom);
		background: #F5F5F5;

		.empty {
			width: 100vw;
			max-height: 100vh;
			margin: 0 auto;
			padding: 300rpx 0;
		}

		.card {
			width: 750rpx;
			height: 136rpx;
			padding: 28rpx 40rpx;
			background: #FFFFFF;
			margin-bottom: 20rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			display: flex;
			align-items: center;

			image {
				width: 80rpx;
				height: 80rpx;
				margin-right: 16rpx;
				vertical-align: middle;
				border-radius: 50%;
				background: #1777FF;
			}

			.info {
				flex: 1;

				.infos_title {
					display: flex;
					align-items: center;
					justify-content: space-between;
					margin-bottom: 8rpx;

					.infos {
						font-size: 28rpx;
						font-weight: bold;
						color: #232323;
						line-height: 42rpx;
					}

					.time {
						font-size: 22rpx;
						font-weight: 400;
						color: #999999;
					}
				}

				.preview {
					font-size: 24rpx;
					font-weight: 400;
					color: #999999;
					display: -webkit-box;
					-webkit-line-clamp: 1;
					-webkit-box-orient: vertical;
					text-overflow: ellipsis;
					overflow: hidden;
					margin-top: 16rpx;
				}
			}
		}
	}
</style>