<template>
	<view
		style="display: flex;flex-direction: column;height: 100vh;background: -webkit-linear-gradient(left,#FEA65F,#FB9440);"
		class="app">
		<!-- 有列表的时候用 :auto='false' 需要你在onload等调用reload方法 -->
		<z-paging ref="paging" v-model="data" @query="queryList" :pagingStyle='styleObject' :auto='true'>

			<view v-for="(item,index) in data" style=" display: flex;flex-direction: column;margin-left: 10px;margin-right: 10px;
				padding: 5px 0px;">

				<view class="item">

					<view class="item_left">

						<text class="item_left_text1">{{item.name}}</text>
						<text class="item_left_text2">失效时间：{{item.periodValidity}}</text>

					</view>

					<text class="item_right">份数：{{item.goodsNumber}}</text>

				</view>

			</view>

		</z-paging>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				styleObject: {
					'padding-top': '10px',
					'padding-bottom': '10px',
					'background': '#F7F7F7'
				},
				data: []
			}
		},

		onLoad() {

		},

		methods: {
			// 分页的请求
			queryList(pageNo, pageSize) {
				let _this = this
				_this.$api.vegeCellarInvalidList({
					"current": pageNo,
					"size": pageSize,
					"params": {
						"customerSid": getApp().globalData.sid

					}
				}).then((resp) => {
					// 添加数据源
					this.$refs.paging.complete(resp.records)
				}).catch(e => {
					// 出错了，点击重试
					_this.$refs.paging.complete(false);
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.app {
		--bgcolor: #f2f2f2;

	}

	.item {
		display: flex;
		flex-direction: row;
		align-items: center;
		background: #fff;
		border-radius: 8px;
		padding: 12px;

		.item_left {
			flex: 1;
			display: flex;
			flex-direction: column;

			.item_left_text1 {
				font-size: 14px;
				color: #333;
			}

			.item_left_text2 {
				margin-top: 8px;
				font-size: 12px;
				color: #E36443;
			}

		}

		.item_right {
			font-size: 12px;
			color: #999;
		}
	}
</style>