<template>
	<view>
		<view 
			class="single-detail"
			v-for="(detail, index) in detailList"
			:key="index"
		>
			<view>
				<h4>序号</h4>
				<span>{{ index + 1 }}</span>
			</view>
			<view>
				<h4>机具名称</h4>
				<span>{{ detail.typeName }}</span>
			</view>
			<view>
				<h4>规格型号</h4>
				<span>{{ detail.typeCode }}</span>
			</view>
			<view>
				<h4>退料数量</h4>
				<span>{{ detail.backNum }}</span>
			</view>
			<view>
				<h4>机具编号</h4>
				<span>{{ detail.maCode }}</span>
			</view>
			<view>
				<h4>退料时间</h4>
				<span>{{ detail.backTime }}</span>
			</view>
			<view>
				<h4>接收状态</h4>
				<span>{{ detail.backStatus }}</span>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				detailList: []
			}
		},
		methods: {
			
		},
		onLoad(params) {
			let that = this
			console.log(params.id);
			// 初始化查询退料明细
			that.$api.backMaterialReceive.seeBackMaterialDetail({
				parentId: params.id
			}).then(res => {
				console.log(res);
				if (res.data.code == 200) {
					for (let i = 0; i < res.data.data.length; i++) {
						switch (res.data.data[i].backStatus) {
							case '1':
								res.data.data[i].backStatus = '合格'
								break;
							case '2':
								res.data.data[i].backStatus = '维修'
								break;
							case '3':
								res.data.data[i].backStatus = '待报废'
								break;
						}
						if (res.data.data[i].maCode == null) {
							res.data.data[i].maCode = '暂无'
						}
					}
					that.detailList = res.data.data
				}
			}).catch(err => {
				console.log(err);
			})
		}
	}
</script>

<style lang="scss">
	.single-detail{
		width: 100%;
		box-sizing: border-box;
		padding: 25rpx;
		border-bottom: 1px solid #989898;
		view{
			width: 100%;
			margin-bottom: 20rpx;
			display: flex;
			align-items: center;
			h4{
				width: 30%;
				display: flex;
				align-items: center;
				font-weight: normal;
				font-size: 16px;
				color: #8D94A2;
			}
			span{
				font-size: 16px;
			}
		}
	}
</style>
