<template>
	<view class="warehouseEntry">
		<ul>
			<li>
				<view>
					耗材名称
				</view>
				<view>
					耗材
				</view>
			</li>
			<li>
				<view>
					现有库存
				</view>
				<view>
					耗材
				</view>
			</li>
			<li>
				<view>
					出库数量
				</view>
				<view>
					<input type="text" placeholder="输入数量" name="" id="">
				</view>
			</li>
			<li>
				<view>
					总价值
				</view>
				<view>
					<input type="text" placeholder="输入总价值(元)" name="" id="">
				</view>
			</li>
			<li>
				<view>
					单价
				</view>
				<view>
					耗材
				</view>
			</li>
			<li style="justify-content: space-between;">
				<view>
					供应商
				</view>
				<view style="width: 54%;" @tap="showStatusToggle">
					{{status[nowStatusIndex]}}
				</view>
				<uni-icons type="bottom" size="16"></uni-icons>
				<up-button type="text" style="color: #318AFE;width: 64rpx;" @tap="toggle" :plain="true"
					text="新增"></up-button>
			</li>
		</ul>
		<view :style="{height:showStatus?statusHeight:0}" class="tranistion status  overflow-hide">
			<view @tap="changeNowStatusIndex(index)" class="u-flex u-p-l-30 lh30 u-p-r-30 u-row-between"
				v-for="(item,index) in status" :key="index">
				<view :class="{'color-main':nowStatusIndex===index}">{{item}}</view>
				<uni-icons v-if="nowStatusIndex===index" type="checkmarkempty" :color="color.ColorMain"></uni-icons>
			</view>
			<view :style="{height: '14px'}"></view>
		</view>
	</view>
	<view class="bottombutton">
		<up-button type="primary" style="background-color:  #318AFE;color: #fff;" @tap="toggle" :plain="true"
			text="保存"></up-button>
		<up-button type="text" style="background-color:  #f9f9f9;color: #999;" @tap="toggle" :plain="true"
			text="取消"></up-button>
	</view>
</template>


<script setup>
	import {
		ref,
		computed
	} from 'vue';
	import color from '@/commons/color.js';
	let showStatus = ref(false)

	function showStatusToggle() {
		showStatus.value = !showStatus.value
	}
	let nowStatusIndex = ref(0)

	function changeNowStatusIndex(i) {
		nowStatusIndex.value = i
		showStatus.value = false
	}
	const status = ['开多钱', '好像上次', '海峡市场']
	const statusHeight = computed(() => {
		return 30 * status.length + 14 + 'px'
	})
</script>

<style scoped lang="less">
	page {
		background-color: #f9f9f9;
	}

	.df() {
		display: flex;
		align-items: center;
	}

	ul,
	li {
		list-style: none;
		padding: 0;
	}

	.status {
		margin: 0 32rpx;
		position: absolute;
		// top: 100%;
		left: 0;
		right: 0;
		z-index: 10;
		background-color: #fff;
	}

	.warehouseEntry {
		width: 694rpx;
		height: 740rpx;
		background: #FFFFFF;
		border-radius: 18rpx 18rpx 18rpx 18rpx;
		margin: 32rpx;
		padding: 1rpx 24rpx;
		box-sizing: border-box;

		>ul {
			>li {
				width: 646rpx;
				height: 84rpx;
				background: #fcfcfc;
				border: 2rpx solid #F9F9F9;
				margin-top: 32rpx;
				.df;

				>view:first-child {
					width: 190rpx;
					height: 84rpx;
					line-height: 84rpx;
					// text-align: left;
					padding-left: 24rpx;
					background: #F9F9F9;
					border-radius: 8rpx 0rpx 0rpx 8rpx;
					border: 2rpx solid #F9F9F9;
					font-family: Source Han Sans CN, Source Han Sans CN;
					font-weight: 400;
					font-size: 32rpx;
					color: #333333;
				}
			}
		}
	}

	.bottombutton {
		margin-top: 84rpx;

		>button {
			width: 530rpx;
			height: 80rpx;
			border-radius: 56rpx 56rpx 56rpx 56rpx;
		}
	}
</style>