<template>
	<view class="container">
		<view class="tui-searchbox">
			<view class="tui-search-input">
				<icon type="search" :size='20' color='#333'></icon>
				<input confirm-type="search" placeholder="请输入箱号最后几位" :focus="true" auto-focus auto-blur
					placeholder-class="tui-input-plholder" class="tui-input" v-model.trim="postData.BoxCode"
					@confirm="searchInfo" />
				<icon type="clear" :size='20' color='#bcbcbc' @tap="cleanBoxCode" v-show="postData.BoxCode"></icon>
			</view>
		</view>
		<uni-card v-if="list" v-for="(item,index) in list" :title="item.OLD_CNTRNO" :key="index">
			<view class="example">
				<uni-forms ref="form" :modelValue="item" label-position="left">
					<uni-forms-item label="提单号" name="MBLNO">
						<uni-easyinput type="text" :disabled="true" v-model="item.MBLNO" />
					</uni-forms-item>
					<uni-forms-item label="客户名称" name="CUSTOMERNAME">
						<uni-easyinput type="text" :disabled="true" v-model="item.CUSTOMERNAME" />
					</uni-forms-item>
					<uni-forms-item label="货主" name="GOODSOWNER">
						<uni-easyinput type="text" :disabled="true" v-model="item.GOODSOWNER" />
					</uni-forms-item>
					<uni-forms-item label="货物名称" name="GOODSNAME">
						<uni-easyinput type="text" :disabled="true" v-model="item.GOODSNAME" />
					</uni-forms-item>
					<uni-forms-item label="毛重(千克)" name="KGS">
						<uni-easyinput type="text" v-model="item.KGS" :disabled="true" />
					</uni-forms-item>
					<uni-forms-item label="总件数" name="PKGS">
						<uni-easyinput type="text" v-model="item.PKGS" :disabled="true" />
					</uni-forms-item>
					<uni-forms-item label="仓库" name="STOREHOUSENAME">
						<uni-easyinput type="text" :disabled="true" v-model="item.STOREHOUSENAME" />
					</uni-forms-item>
					<uni-forms-item label="未确认明细数" name="NoStockInCount">
						<uni-easyinput type="text" v-model="item.NoStockInCount" :disabled="true" />
					</uni-forms-item>

					<!-- <uni-forms-item label="备注" name="REMARK">
						<uni-easyinput type="text" :disabled="true" v-model="item.REMARK" />
					</uni-forms-item> -->

				</uni-forms>
				<button @click="skip(item)">跳转计划明细</button>
			</view>
		</uni-card>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				info: [],
				loadData: [],
				pageIndex: 1,
				loadding: false,
				pullUpOn: true,
				isShow: false,
				postData: {
					BoxCode: ""
				},
				skipData: {
					WMSPLANID: "",
				},
				key: "",
				list: '',
				type: ''
			}
		},
		onLoad() {
			this.list = ''
			// this.skipData.type = ''
			this.postData.BoxCode = ''
		},
		// onLoad: function(option) {
		// 	var _this = this
		// 	console.log('跳转信息：', option.type)
		// 	_this.skipData.type = option.type 
		// },
		methods: {
			back: function() {
				uni.navigateBack();
			},
			cleanBoxCode: function() {
				this.postData.BoxCode = ''
			},
			searchInfo: function() {
				uni.showLoading()
				console.log(this.postData)
				this.tui.request("/StockIn/GetStockInPlanInfoByBoxCode?boxCode=" + this.postData.BoxCode, "GET", null,
						false, false, false)
					.then((
						res) => {
						console.log(res)
						if (res.Code == 0) {
							this.list = res.Data
							uni.hideLoading()
						} else if (res.Code == -1) {
							this.tui.toast(res.Message, 2000, 'none')
						}
					}).catch((err) => {
						console.log(err)
						this.tui.toast('异常:' + err, 2000, 'none')
						uni.hideLoading()
					})
			},
			skip: function(data) {
				uni.setStorageSync("WMSPLANID", data.WMSPLANID)
				uni.setStorageSync("OLD_CNTRNO",data.OLD_CNTRNO)
				uni.navigateTo({
					url: '../stockin-handle/stockin-handle'
				})
			}
		}
	}
</script>

<style>
	.example {
		padding: 15px;
		background-color: #fff;
	}

	.button-group {
		margin-top: 15px;
		display: flex;
		justify-content: space-around;
	}

	.form-item {
		display: flex;
		align-items: center;
	}

	.button {
		display: flex;
		align-items: center;
		height: 35px;
		margin-left: 10px;
	}

	/* @import '../../static/style/thorui.css'; */
	.tui-msg-box {
		display: flex;
		align-items: center;
	}

	.tui-msg-pic {
		width: 100rpx;
		height: 100rpx;
		border-radius: 50%;
		display: block;
		margin-right: 24rpx;
		flex-shrink: 0;
	}

	.tui-msg-item {
		max-width: 500rpx;
		/* min-height: 100rpx; */
		overflow: hidden;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}

	.tui-msg-name {
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
		font-size: 45rpx;
		line-height: 2;
		justify-content: space-between;
		color: #262b3a;
	}

	.tui-item-box {
		width: 100%;
		display: flex;
		align-items: center;
	}

	.tui-list-cell_name {
		padding-left: 20rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.tui-ml-auto {
		margin-left: auto;
	}

	.tui-right {
		margin-left: auto;
		margin-right: 34rpx;
		font-size: 26rpx;
		color: #999;
	}

	.tui-logo {
		height: 52rpx;
		width: 52rpx;
		flex-shrink: 0;
	}
</style>
<style lang='scss'>
	.tui-searchbox {
		padding: 30rpx 0;
		box-sizing: border-box;
		display: flex;
		align-items: center;
	}

	.tui-search-input {
		width: 100%;
		height: 66rpx;
		border-radius: 35rpx;
		padding: 0 30rpx;
		box-sizing: border-box;
		background: #f2f2f2;
		display: flex;
		align-items: center;
		flex-wrap: nowrap;
	}

	.tui-input {
		flex: 1;
		color: #333;
		padding: 0 16rpx;
		font-size: 28rpx;
	}

	.tui-input-plholder {
		font-size: 28rpx;
		color: #b2b2b2;
	}

	.fr-btn {
		float: right;
		height: 60upx;
		font-size: 28upx;
		line-height: 60upx;
		margin: 14upx 0;
	}
</style>
