<template>
	<view class="addQrcode">
		<uni-search-bar @confirm="getData" v-model="req.keyword" @cancel="reload">
		</uni-search-bar>
		
		<view class="addQrcode-list" v-for="i in listData" :key="i.materialId" @click="toRouter(i)">
			<view class="fl">
				<view class="code">
					<view class="">
						{{i.code}}
					</view>
					<view class="">
						{{i.count}}个入库单
					</view>
				</view>
				<view class="name">
					{{i.name}}
				</view>
			</view>
			<view class="fr">
				<uni-icons type="forward" size="30"></uni-icons>
			</view>
		</view>
		<view class="commons-no-data" v-if="listData.length == 0">
			已经没有数据了。。
		</view>
	</view>
</template>

<script>
	import {
	    getInfo
	} from "@/util/api.js";
	export default {
		data() {
			return {
				listData:[],
				req:{
					keyword:null,
				}
			}
		},
		onLoad() {
			const v = this
			v.getData()
			
		},
		methods: {
			reload(){
				this.req.keyword = null
				this.getData()
			},
			getData(){
				const v = this
				v.$post('/wx/createQrcode/getMaterialGroupList',v.req).then(res=>{
					v.listData = res.data
					
				})
			},
			toRouter(i){
				uni.navigateTo({
					url: '/pages/addQrcode/selectQrcode?data=' + encodeURIComponent(JSON.stringify(i))
				})
			},
		},
	}
</script>

<style lang="less">
	.addQrcode-list {
		height: 100rpx;
		display: flex;
		justify-content: space-between;
		padding: 15rpx;
		border-bottom: 1rpx solid #dcdcdc;

		.fl {
			display: flex;

			.code {
				margin-right: 20rpx;
			}
		}

		.fr {
			line-height: 100rpx;
		}
	}
</style>
