<template>
	<view class="topTitle">
		耗材信息
	</view>
	<view class="addConsumables">
		<view>
			<view>
				<view> 单位 </view>
				<view> <input type="text" placeholder="请输入单位" v-model="datas.form.conUnit" name="" id=""> </view>
			</view>
			<view>
				<view> 耗材名称 </view>
				<view> <input type="text" placeholder="请输入耗材名称" v-model="datas.form.conName" name="" id=""> </view>
			</view>
			<view>
				<view> 耗材价格 </view>
				<view> <input class="uni-input" placeholder="请输入耗材价格" type="number" v-model="datas.form.price"> </view>
			</view>
			<view>
				<view> 预警值 </view>
				<view> <input type="number" placeholder="请输入预警值" v-model="datas.form.conWarning" name="" id=""> </view>
			</view>
		</view>
	</view>
	<view class="bottombutton">
		<up-button type="primary" style="background-color:  #318AFE;color: #fff;" @tap="sumbit" :plain="true"
			text="保存"></up-button>
	</view>
</template>

<script setup>
	import { reactive, computed, onMounted } from 'vue';
	import { editCons } from '@/api/cons.js';
	import color from '@/commons/color.js';
	import go from '@/commons/utils/go.js';
	
	
	const props = defineProps({
		item: {
			type: String
		}
	})
	let datas = reactive({
		form: {
			conWarning: 999
		},
	})
	onMounted(() => {
		let obj = JSON.parse(props.item)
		datas.form = obj
	})

	
	let sumbit = () => {
		editCons(datas.form).then(res => {
			go.back()
		})
	}
	
</script>
<style>
	page {
		background-color: #f9f9f9;
	}
</style>
<style scoped lang="less">
	
	.topTitle {
		font-weight: 400;
		font-size: 32rpx;
		color: #333333;
		margin: 32rpx 28rpx;
	}

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

		>view {
			>view {
				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;
		padding: 0 24rpx;

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

	.df() {
		display: flex;
		align-items: center;
	}
</style>