<template>
	<view class="warp">
		<view class="title">
			基本信息
		</view>
		<view class="content">
			<view class="row">
				<view class="left">仓库</view>
				<view class="right">{{detailData.warehouseName}}</view>
			</view>
			<view class="row">
				<view class="left">编号</view>
				<view class="right">{{detailData.number}}</view>
			</view>
			<view class="row">
				<view class="left">客户</view>
				<view class="right">{{detailData.customer}}</view>
			</view>
			<view class="row">
				<view class="left">车牌号</view>
				<view class="right">{{detailData.carNumber}}</view>
			</view>
			<view class="row">
				<view class="left">仓位号</view>
				<view class="right">{{detailData.binNumber}}</view>
			</view>
			<view class="row">
				<view class="left">囤位号</view>
				<view class="right">{{detailData.storageNumber}}</view>
			</view>
			<view class="row">
				<view class="left">货名</view>
				<view class="right">{{detailData.goodsName}}</view>
			</view>
			<view class="row row-bottom">
				<view class="left">毛重（公斤）</view>
				<input class="right-bottom" placeholder="输入毛重" v-model="detailData.grossWeight"></input>
			</view>
		</view>
		<u-button v-if='tabbar' type="primary" class="submit" @click="submit">提交</u-button>
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabbar:true,
				windowHeight: '',
				detailData: {
					grossWeight:''
				}
			}
		},
		onShow() {},
		onLoad(options) {
			uni.onWindowResize((res) => {
			    if(res.size.windowHeight < this.windowHeight){
			        this.tabbar = false
			    }else{
			        this.tabbar = true
			   }
			   })
			this.detailData = JSON.parse(options.detailData)
			uni.getSystemInfo({
				success:(res) => {
					this.windowHeight = res.windowHeight;
					// console.log(res)
					this.system = res.system  // ios
					this.platform = res.platform  // 14.3
				}
			})
			console.log(this.detailData)
		},
		methods: {
			submit(){
				let that = this
				uni.showModal({
					content:"确定提交检斤信息?",
					success:function(res) {
						   if (res.confirm) {
						           that.$api.doRequest('post', '/weighingManagement/api/editGrossWeight',that.detailData).then(res => {
						           	if(res.data.code==200){
						           		that.$refs.uToast.show({
						           			title: '提交成功',
						           			type: 'success'
						           		})
										uni.navigateBack({
										})
						           	}else{
						           		that.$refs.uToast.show({
						           			title: '提交失败',
						           			type: 'error',
						           		})
						           	}
						           })
						        } else if (res.cancel) {
						            console.log('用户点击取消');
						        }
						console.log(that.detailData)
				
					}
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	uni-page-body{
		overflow: hidden;
	}
	.warp{
		background: white;
		margin: 20rpx;
		padding: 20rpx;
		border-radius: 20rpx;
		.title{
			font-size: 28rpx;
			font-weight: 500;
			color: #333333;
		}
	}
.content{
	.row{
		display: flex;
		justify-content: space-between;
		padding:31rpx 0;
		.right{
			font-size: 28rpx;
			font-weight: 600;
			color: #333333;
		}
	}
	.row-bottom{
		border: 0;
		.right-bottom{
			width: 300rpx;
			text-align: right;
			font-size: 28rpx;
			font-weight: 600;
			color: #333333;
		}
	}
}
.submit{
		position: fixed;
		bottom:40rpx;
		width: 90%;
		background: #22C572;
		border-radius: 50rpx;
		
	}
</style>
