<template>
	<!-- 系统消息页面 -->
	<view class="header">
		<view class="content" v-for="(item,index) in orderList" @click="inDetails" :key="index">
			<view class="content-one">
				<text class="content-one-first">{{item.msgTitle}}</text>
				<text class="content-one-second">{{item.data}}</text>
			</view>
			<!-- 中间的虚线 -->
			<view class="content-two">
			</view>

			<text class="content-three">
				{{msgContent.replace(/<[^>]+>/g,"")}}
			</text>
			<view class="content-five" v-if="item.sendUserId==17||item.sendUserId==19">
				<text class="content-five-first">查看订单详情</text>
				<text class="content-five-second">
					<u-icon name="arrow-right"></u-icon>
				</text>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		request
	} from '../../../common/request/request'
	require("promise.prototype.finally").shim()
	export default {
		data() {
			return {
				msgContent: '',
				orderList: []
			}
		},

		onLoad() {

		},
		onLoad(options) {
			console.log(options.sendUserId)
			this.sendUserId = options.sendUserId
		},
		created() {
			this.getDate()
			this.getList()
		},
		methods: {
			// 获取列表
			getDate() {
				request({
						url: '/appMessage/getMessageList',
						method: 'post',
						data: {
							"acceptUserId":this.$store.state.storeInfo.storeId,
							"sendUserId": this.sendUserId,
							'userId':this.$store.state.storeInfo.userId

						}
					}).then(res => {
						console.log(res)
						this.orderList = res.data.list
						// this.msgContent = res.data.list[0].msgContent
						for(var i = 0; i<res.data.list.length; i++) {
							this.msgContent = res.data.list[i].msgContent
						}



					}).catch(err => {
						console.log(err)
					})
					.finally(() => {
						setTimeout(() => {
							uni.hideLoading();
							this.loading = false;
						}, 300)
					})
			},
			// 获取消息状态
			getList() {
				request({
						url: '/appMessage/updateMessage',
						method: 'post',
						data: {
							"acceptUserId":this.$store.state.storeInfo.storeId,
							"sendUserId": this.sendUserId,
							'userId':this.$store.state.storeInfo.userId
			
						}
					}).then(res => {
						console.log(res)
						
			
			
			
					}).catch(err => {
						console.log(err)
					})
					.finally(() => {
						setTimeout(() => {
							uni.hideLoading();
							this.loading = false;
						}, 300)
					})
			},
			inDetails() {
				this.$u.route({
					url: 'pages/msg/Order-details/index',
				})
			}
		},
	}
</script>

<style lang="scss" scoped>
	.content {
		width: 702rpx;
		// height: 447rpx;
		margin: 0 auto;
		background: #FFFFFF;
		margin-top: 20rpx;
		box-shadow: 0rpx 0rpx 17rpx 0rpx rgba(78, 60, 63, 0.2);
		border-radius: 10rpx;
	}

	.content-one {
		display: flex;
		justify-content: space-between;
	}

	.content-one-first {
		font-size: 28rpx;
		font-weight: bold;
		margin: 20rpx;
	}

	.content-one-second {
		font-size: 24rpx;
		color: #B2B2B2;
		margin: 20rpx;
	}

	.content-five {
		display: flex;
		justify-content: space-between;
	}

	.content-five-first {
		font-size: 24rpx;
		font-weight: bold;
		margin: 20rpx;
	}

	.content-five-second {
		font-size: 24rpx;
		color: #B2B2B2;
		margin: 20rpx;
	}

	// 中间虚线
	.content-two {
		width: 670rpx;
		margin: 0 auto;
		border-top: 1rpx solid #ededed;
	}

	.content-three {
		display: inline-block;
		margin-left: 30rpx;
		color: #aeaeae;
		margin-top: 20rpx;
		font-size: 24rpx;
		margin-bottom: 27rpx;
	}

	.content-four {
		color: #aeaeae;
		margin-left: 20rpx;
		margin-top: 6rpx;
		font-size: 24rpx;
	}

	.content-four-tail {
		color: #000;
		margin-left: 20rpx;
		margin-top: 10rpx;
		font-size: 24rpx;
	}
</style>
