<template>
	<view>
		<uni-section title="">
			<view class="example">
				<uni-forms ref="form" :modelValue="item" labelWidth="80px" :rules="rules">
					<uni-forms-item label="装箱单号" name="FBillNo">
						<uni-easyinput v-model="item['FENCHASENUM.LT']" disabled>
						</uni-easyinput>
					</uni-forms-item>
					
					<uni-forms-item label="调拨数量" name="FQty" >
						<uni-easyinput  v-model="item['FQty']"/>
					</uni-forms-item>
					
				</uni-forms>
				<button type="primary" @click="submit()">确认</button>
			</view>
		</uni-section>
	</view>
</template>

<script>
	import {
		getInfoByBarcode,
		getStockInfo
	} from '../../api/production_replenishment';
	import {
		playVoice,
		audioUrls
	} from '@/utils/audio.js'
	import modal from '../../uni_modules/uview-ui/libs/config/props/modal';
	export default {
		onLoad(option) {
			this.formId = uni.getStorageSync("formId")
			const item = JSON.parse(decodeURIComponent(option.item))
			const index = JSON.parse(decodeURIComponent(option.index))
			console.log(item)
			console.log(index)
			this.item = item
			this.index = index
		},
		data() {
			return {
				formId: '',
				item: {},
				index: '',
				isReplace: false,
				rules: {
					FActualQty: {
						rules: [{
								required: true,
								errorMessage: '请输入实发数量',
							},

						]
					},
					FQty: {
						rules: [{
								required: true,
								errorMessage: '请输入实发数量',
							},

						]
					},
					FRMREALQTY: {
						rules: [{
								required: true,
								errorMessage: '请输入实际作业数量',
							},

						]
					},
				},
			};
		},
		computed: {
			
		},
		methods: {
			handleError(error) {
				playVoice(audioUrls.failVoiceUrl)
				console.error('操作失败:', error);
				modal.confirm(error).then(res => {
					if (res) {} else {}
				})
			},
			submit() {
				console.log(this.item)
				this.$refs.form.validate().then(res => {
					
					
					this.item["index"] = this.index
					let self = this
					uni.navigateBack({
						success: function() {
							// 传递数据给上一页
							uni.$emit('item', self.item);
						}
					});
				}).catch(err => {
					console.log(err);
				})
			},
		}
	};
</script>
<style>
	/deep/ .is-disabled {
		background-color: #ffffff !important;
		color: #0d0d0d !important;
	}

	.example {
		padding-left: 10px;
		padding-right: 10px;
		background-color: #fff;
	}

	.segmented-control {
		margin-bottom: 15px;
	}

	.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;
	}
</style>