<!--出库确认-->
<template>
    <view id="gasRecycle">
		<view class="title">{{form.gasName}}-{{form.levelName}}({{form.sizeName}})</view>
		<view class="register_li">
			<view class="register_li_min">
				<view>学院：</view>
				<input v-model="form.collegeName" disabled  type="text" >
			</view>
			<view class="register_li_min">
				<view>实验地点：</view>
				<input v-model="form.subjectName" disabled  type="text" >
			</view>
			<view class="register_li_min">
				<view>实际气压值：</view>
				<input v-model="form.gasPressure" placeholder="请输入实际气压值"  type="text" >
			</view>
			<view class="register_li_min">
				<view>最后使用人：</view>
				<input v-model="form2.user" disabled  type="text" >
			</view>
			<!-- 使用时间 -->
			<view class="register_li_min" style="border:none;">
				<view>最后使用时间：</view>
				<input v-model="form2.lastUseTime" disabled  type="text" >
			</view>
		</view>
		<view  class="sub_btn" @click="submitForm()">确认出库</view>
	</view>
</template>
<script>
	import { gasDetail,gasDetailRecord,gasBottleErrorList,gasStorageOut,airbottleStockFindById,airbottleStockOut} from '@/api/index.js'
	import { config } from '@/api/request/config.js'
    export default {
		
        name: "gasRecycle",
        data() {
            return {
				baseUrl:config.base_url,
				pageType:0,
				//列表请求参数
				getData:{
				    pageNum:1,
					pageSize:1,
					storageId:'',
				},
				gasBottleLevel:uni.getStorageSync('gasBottleLevel'),//  气瓶级别
				gasBottleSpecification:uni.getStorageSync('gasBottleSpecification'), // 气瓶规格
				form:{},
				id:'',
            }
        },
        onLoad(option) {
			if(option.id){
				this.id=option.id;
			}
        	
        },
        onShow() {
			
        },
		mounted(){
			this.getInfo();
		},
        methods: {
			
			//查询详情
			async getInfo(){
			  let self = this;
			  const {data} = await airbottleStockFindById({id:this.id});
			  if(data.code == 200){
				for(let b=0;b<this.gasBottleSpecification.length;b++){
					if(this.gasBottleSpecification[b].dictValue==data.data.size){
						data.data.sizeName=this.gasBottleSpecification[b].dictLabel
					}										
				}
				for(let t=0;t<this.gasBottleLevel.length;t++){
					if(this.gasBottleLevel[t].dictValue==data.data.level){
						data.data.levelName=this.gasBottleLevel[t].dictLabel
					}
				}
				  this.form=data.data;
			  }
			},
			//提交
			async submitForm(){
				let _this = this;
				let obj={
					id:this.form.id,
					gasPressure:this.form.gasPressure,
				}
				const {data} = await airbottleStockOut(obj);
				if(data.code == 200){
				    uni.showToast({
				        title: '出库成功!',
				        icon:"none",
				        mask:true,
				        duration: 2000
				    });
				    setTimeout(function(){
				       uni.redirectTo({
				            url: '/pages/gasBottle/gasManage/gasManage'
				        });
				    },2000);
				}
			},
        }
    }
</script>

<style lang="stylus" scoped>
    #gasRecycle {
        height: auto;
        width: 100%;
		flex :1;
        display flex;
        flex-direction column
        overflow hidden;
		padding-bottom: 300rpx;
		.title{
			width: 750rpx;
			height: 100rpx;
			background: #FFFFFF;
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #333333;
			line-height: 100rpx;
			padding-left: 40rpx;
		}
		.register_li{
			background #fff;
			border-radius:20rpx;
			margin:20rpx 20rpx 0;
			padding:20rpx 0;
			box-sizing: border-box;
			.register_li_min{
				margin:0 26rpx;
				display flex;
				align-items center;
				border-bottom: 1px solid #F5F5F5;
				.icon_img{
					width: 30rpx;
					height: 30rpx;
					margin-right: 12rpx;
				}
				view{
					//width:140rpx;
					font-size: 28rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #999999;
					line-height: 100rpx;
				}
				>view:nth-child(2){
					flex: 1;
					text-align: right;
					font-size: 24rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #333333;
				}
				>input{
					flex:1;
					text-align: right;
					font-size: 24rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #333333;
				}
				.mistake{
					font-size: 24rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #D60000;
					margin-left: 40rpx;
				}
				
				
			}
			/* 时间 */
			.register_li_min2{
				margin:0 26rpx;
				border-bottom: 1px solid #f5f5f5;
				height: 100rpx;
				display: flex;
				justify-content: flex-start;
				align-items: center;
				>view:nth-child(1){
					font-size: 28rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #999999;
					line-height: 100rpx;
					margin-right: 46rpx;
				}
				.picker-text{
					font-size: 24rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #333333;
					line-height: 100rpx;
					width: 210rpx;
					
				}
				>view:nth-child(2){
					font-size: 24rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #333333;
					line-height: 100rpx;
				}
				.picker-text2{
					font-size: 24rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #333333;
					line-height: 100rpx;
					width: 210rpx;
					text-align: right;
				}
			}
			
			.meter_img{
				margin:0 26rpx;
				display flex;
				justify-content: space-between;
				view{
					//width:140rpx;
					font-size: 28rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #999999;
					line-height: 100rpx;
				}
				>img{
					width: 150rpx;
					height: 150rpx;
					border-radius: 10rpx;
					margin:42rpx 0 20rpx 0;
				}
			}
		}
		/* 按钮 */
		.sub_btn{
			width: 650rpx;
			height: 100rpx;
			background: #0183FA;
			border-radius: 20rpx;
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			line-height: 100rpx;
			text-align: center;
			margin-left: 50rpx;
			position: fixed;
			bottom:30rpx;
			z-index: 1000;
		}
		.sub_btn2{
			width: 650rpx;
			height: 100rpx;
			border: 2rpx solid #0072DB;
			border-radius: 20rpx;
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #0183FA;
			line-height: 100rpx;
			text-align: center;
			margin-left: 50rpx;
			position: fixed;
			bottom:158rpx;
			z-index: 1000;
		}
		
	}
</style>
