<template>
	<view class="box">
		<view class="mainBox">

			<view class="workBox2" v-for="(item,index) in itemList" :key="index">
				<view class="leftBox">
					<view class="name">{{item.name}}</view>
					<view @click="goModelThree(item)" class="code">{{item.partnum}}</view>
					<view class="comment">{{item.caption}}</view>
					<view class="comment">{{item.group}}</view>
				</view>
				<image src="../../static/img/rightArrow.png" mode="" style="width: 12rpx; height: 20rpx"></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				epc_id: '',
				token: '',
				param: '',
				access_time: '',
				itemData: {},
				itemList: [],
				page: 1,
				total_page: 1
			}
		},
		onLoad(opt) {
			this.epc_id = opt.epc_id;
			this.token = opt.token;
			this.param = opt.param;
			this.access_time = opt.access_time;
			this.getItemData();
		},
		methods: {
			// 配件组别
			getItemData() {
				uni.showLoading({
					title: '加载中'
				});
				this.$http('advancedEpc/findInModel', {
					epc_id: this.epc_id,
					token: this.token,
					param: this.param,
					access_time: this.access_time,
					page: this.page
				}, 'GET').then(res => {
					uni.hideLoading();

					this.itemData = res.data.result;

					this.total_page = res.data.result.total_page;
					var list = res.data.result.list;
					if (list.length != 0) {
						this.itemList = this.itemList.concat(list)
					}
				});
			},
			goModelThree(item) {
				// console.log('num==',item);
				uni.navigateTo({
					url: 'modelThree?epc_id=' + this.epc_id + '&token=' + item.token + '&param=' + item.param +
						'&access_time=' + this.itemData.access_time + '&oemSearch=true'

				})
			}
		},
		onReachBottom() {
			if (this.page <= this.total_page) {
				this.page++;

				this.getItemData()()
			}
		}
	}
</script>

<style>
	.box {
		min-height: 100vh;
		background: #F4F5F7;
		padding-top: 20rpx;
	}

	.mainBox {
		background: #FFFFFF;

	}

	.workBox2 {

		background: #FFFFFF;
		border-bottom: 1rpx solid #EEEEEE;
		padding: 20rpx 24rpx 0rpx;

		display: flex;
		align-items: center;
	}

	.leftBox {
		width: calc(100vw - 20rpx);
	}

	.name {
		color: #333333;
		font-size: 26rpx;
		font-weight: bold;

		padding-bottom: 15rpx;
	}

	.comment {
		color: #999999;
		font-size: 24rpx;
		padding-bottom: 15rpx;
	}

	.code {
		color: #3F90F7;
		font-size: 24rpx;
		padding-bottom: 15rpx;
	}

	.rightBox {
		width: 20rpx;
	}
</style>
