<template>
	<view>
		<view class="status_bar">
			<!-- 这里是状态栏 -->
		</view>
		<uni-nav-bar shadow left-icon="left" title="入库列表" @clickLeft="back" />
		<view v-for="item in dataList" :key="item.id">
			<uni-card :is-shadow="false" margin="5px" @click='goPage(item)'>
				<template v-slot:title>
					<uni-list>
						<uni-list-item :title="'入库单号:'+item.fBillno" showArrow />
					</uni-list>
				</template>
				<view class="card-content">
					<text>提单号/入库日期:{{item.fMblno}}/{{item.fBsdate}}</text>
					<text>客户名称:{{item.fName}}</text>
					<text>货物名称:{{item.goodsName}}</text>
					<text>库区:{{item.fWarehouseInformation}}</text>
					<text>件数/重量:{{item.fQty}}/{{item.fGrossweight}}</text>
					<text>属性/属性详情:{{item.fBusinessType|storageFilters}}/{{item.fMarks}}</text>
				</view>

			</uni-card>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList: [],
				query: {
					billtype: "SJRK",
				},
				userName: null,
			};
		},
		onLoad() {
			uni.setStorageSync('type', 1);
			this.userName = uni.getStorageSync('userName')
			this.getList()
		},
		onPullDownRefresh() {
			this.getList()
		},
		filters: {
			storageFilters: function(row) {
				let list = uni.getStorageSync('storageType');
				let name = ""
				if (row) {
					list.forEach(e => {
						if (e.dictValue == row) {
							name = e.dictLabel
						}
					})
				}
				return name
			}
		},
		methods: {
			back() {
				uni.navigateBack({
					delta: 1
				})
			},
			goPage(row) {
				uni.navigateTo({
					url: `../addTags?fId=${row.fId}&itemId=${row.itemId}&fType=1&storekeeper=${this.userName}&fQty=${row.fQty}`,
				});
			},
			getList() {
				this.query.storekeeper = this.userName
				uni.showLoading({
					title: '加载中...'
				});
				this.$u.get('/appHold/warehouseBills/list', this.query).then(res => {
						this.dataList = res.rows
						uni.stopPullDownRefresh();
					})
					.finally(() => {
						uni.hideLoading();
					});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.status_bar {
		height: var(--status-bar-height);
		width: 100%;
		background-color: rgb(52, 120, 243);
	}

	.card-content {
		display: flex;
		flex-direction: column;

		text: {
			color: #000000
		}
	}
</style>
