<template>
	<view class="page" :style="themeColor">
		<view class="flex align-stretch benben-position-layout flex orderMessages_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex align-center justify-between flex-sub orderMessages_fd0_0'>
				<view class='flex align-center orderMessages_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
					data-url="1">
					<text class='fu-iconfont2  orderMessages_fd0_0_c0_c0'>&#xE794;</text>
				</view>
				<view class='flex align-center'>
					<text class='orderMessages_fd0_0_c1_c0'>订单通知</text>
				</view>
				<view class='flex align-center orderMessages_fd0_0_c2'>
				</view>
			</view>

		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
		<!---平台公告列表flex布局开始-->
		<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout orderMessages_flex_1">
			<view class='flex flex-direction align-stretch orderMessages_fd1_0' v-for="(item,index) in lists" :key="index">
				<text class='orderMessages_fd1_0_c0'>{{item.content}}</text>
				<text class='orderMessages_fd1_0_c1'>{{item.create_time}}</text>
			</view>
		</view>
		
		<!-- 空布局 start -->
		<fu-empty-ui v-if="lists.length == 0 && isInit"></fu-empty-ui>
		<!-- 空布局 end -->
		<!-- 页面加载 start -->
		
		<!-- 页面加载 end -->
		<!-- 底部数据加载状态  start-->
		<uni-load-more v-if="lists.length > 8" :status="status"></uni-load-more>

		<!---平台公告列表flex布局结束-->


	</view>
</template>
<script>
	export default {
		components: {},


		data() {
			return {
				lists: [], //订单列表
				page: 1, //页码说
				size: 10, //一页显示几条数据
				status: 'more', //  加载状态  more:有更多数据  noMore:已加载全部数据  loading:数据加载中
				isInit: false, //是否已经初始化
				isShowLoading: false, //是否显示页面初始化加载loading
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		onLoad(options) {
			this.getOrderList()
		},
		onPullDownRefresh() {
		  this.page = 1;
		  this.status = 'more';
		  this.getOrderList(false);
		},
		onReachBottom() {
		  this.getOrderList();
		},
		methods: {
			getOrderList(value) {
			  // this.isShow = false;
			  if (this.status != 'more') return;
			  this.status = 'loading';
			  let data = {
			    page: this.page,
			    list_rows: this.size,
					msgtype:1,
			  };
			  console.log('请求的数据', data);
			  if (this.page == 1 && value) {
			    this.isShowLoading = true;
			  }
			  this.$api.get(global.apiUrls.get6437c2dc0386c,data)
			    .then(res => {
			      console.log('抵用券明细', res);
			      this.isShowLoading = false;
			      if (res.data.code == 1) {
			        var curPageData = res.data.data.data;
			        let total = res.data.data.total;
			        if (this.page == 1) this.lists = [];
			        this.lists = this.lists.concat(curPageData);
			        if (this.lists.length < total) {
			          this.status = 'more';
			          this.page++;
			        } else {
			          this.status = 'noMore';
			        }
			      } else {
			        this.$message.info(res.data.msg);
			      }
			      this.isInit = true;
			      uni.stopPullDownRefresh();
			    })
			    .catch(err => {
			      this.isShowLoading = false;
			      uni.stopPullDownRefresh();
			    });
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #F8F8F8;
		background-size: 100% auto !important;
	}

	.orderMessages_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.orderMessages_fd0_0_c2 {
		width: 180rpx;
	}

	.orderMessages_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333;
	}

	.orderMessages_fd0_0_c0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: #333;
	}

	.orderMessages_fd0_0_c0 {
		width: 180rpx;
	}

	.orderMessages_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
	}

	.orderMessages_flex_1 {
		padding: 21rpx 32rpx 0rpx 32rpx;
	}

	.orderMessages_fd1_0_c1 {
		margin: 24rpx 0rpx 0rpx 0rpx;
		line-height: 29rpx;
		font-size: 24rpx;
		font-weight: 400;
		color: #999999;
		padding: 24rpx 0rpx 0rpx 0rpx;
		text-align: right;
	}

	.orderMessages_fd1_0_c0 {
		line-height: 36rpx;
		font-size: 28rpx;
		font-weight: 500;
		color: #333333;
		-webkit-line-clamp: 1;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
	}

	.orderMessages_fd1_0 {
		background: #fff;
		padding: 32rpx 24rpx 32rpx 24rpx;
		background-size: 100% auto !important;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		margin: 0rpx 0rpx 32rpx 0rpx;
		position: relative;
	}
</style>
