<template>
	<view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
		<cus-header title='仓库管理'></cus-header>
		<template v-if="list.length">
			<div class="list">
				<div class="item" v-for="item in list" :key="item.id">
					<div class="name">{{item.warehouseName}}</div>
					<div class="info">
						<div class="left">仓库编号</div>
						<div class="right">{{item.warehouseCode||''}}</div>
					</div>
					<div class="info">
						<div class="left">创建时间</div>
						<div class="right">{{item.createDate||''}}</div>
					</div>
				</div>
			</div>
		</template>
		<template v-else>
			<page-empty :height="'calc(100vh - '+mt+'px)'"></page-empty>
		</template>
	</view>
</template>

<script>
	export default {
		data(){
			return {
				list:[]
			}
		},
		onLoad() {
			this.getList();
		},
		onPullDownRefresh() {
			this.getList();
		},
		methods:{
			getList(){
				this.$api.get('/wms/warehouse/page').then(res=>{
					if(res.data.code===0) this.list = res.data.data.list;
					else this.$showModal(res.data.msg)
				});
			}
		}
	}
</script>

<style scoped lang="less">
	.page{
		width: 100%;
		padding: 0 24rpx 20rpx;
		box-sizing: border-box;
		background: #F5F8FA;
		
		.list{
			width: 100%;
			.item{
				width: 100%;
				padding: 40rpx 24rpx;
				box-sizing: border-box;
				background: #FFFFFF;
				border-radius: 16rpx;
				margin-top: 20rpx;
				.name{
					font-family: PingFang-SC, PingFang-SC;
					font-weight: bold;
					font-size: 36rpx;
					color: #1D2129;
					line-height: 36rpx;
					text-align: left;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
				}
				.info{
					width: 100%;
					margin-top: 32rpx;
					display: flex;
					.left{
						width: 160rpx;
						font-family: PingFangSC, PingFang SC;
						font-weight: 400;
						font-size: 28rpx;
						color: #86909C;
						line-height: 28rpx;
						text-align: left;
					}
					.right{
						width: calc(100% - 160rpx);
						font-family: PingFangSC, PingFang SC;
						font-weight: 400;
						font-size: 28rpx;
						color: #333333;
						line-height: 28rpx;
						text-align: left;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}
				}
			}
		}
	}
</style>