<template>
	<view class="content">

		<mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback">
			<view class="title_ipt">
				<image :src="z_imgPath+'search.png'"></image>
				<input type="text" placeholder="请输入关键字" placeholder-style="color:rgba(255,255,255,0.6)"
					onfirm-type="search" v-model="keyword" @confirm="show='',loadData(1)" />
				<view>搜索</view>
			</view>

			<view v-for="(item,index) in listdata" :key="index" class="qbt_con_item"
				@click="gotoPage('/pages/chouka/detail?goods_id=' + item.goods_id)">
				<view class="list_1">
					<image :src="item.goods_imgurl"></image>
					<view>{{item.goods_title}}</view>
					<view class="redu">
						<view> 收集进度: <text>{{item.buy_count}}</text> /{{item.all_count}}</view>
						<view>
							<cmd-progress :percent="item.gailv" :show-info="false" stroke-color="#FF7514"
								:strokeWidth="8" :is_img="true">
							</cmd-progress>

						</view>
					</view>
				</view>
				<view class="list_2">
					<view>{{item.goods_title}}</view>
					<view>进入卡册</view>
				</view>
			</view>

		</mescroll-body>

	</view>
</template>

<script>
	export default {

		data() {
			return {
				z_imgPath: this.$z_img + 'chouka/',
				downOption: {
					auto: false
				},
				listdata: [],
				keyword: '',


			}
		},

		methods: {
			downCallback() {
				this.mescroll.resetUpScroll()
			},
			upCallback(page) {
				this.loadData(page.num);
			},
			loadData(pageNo) {
				// 模拟接口
				let that = this;
				that.req({
					url: 'warehouse_index',
					data: {
						page: pageNo,
						type: 3,
						keyword: that.keyword
					},
					success(res) {
						if (res.status == 1) {
							that.mescroll.endByPage(res.data.data.length, res.data.last_page);
							if (pageNo == 1) {
								that.listdata = res.data.data;
							} else {
								that.listdata = that.listdata.concat(res.data.data);
							}
						}
					}
				})
			},

		}
	}
</script>

<style>
	.content {
		background: #222222;
		width: 100vw;
		/* height: 100vh; */
		box-sizing: border-box;
		position: relative;
		background-attachment: fixed;
		position: relative;
	}

	.title_ipt {
		display: flex;
		align-items: center;
		margin: 20rpx auto;
		border-radius: 30rpx;
		padding-left: 30rpx;
		width: 652rpx;
		height: 64rpx;
		background: rgba(0, 0, 0, 0.7);
		border-radius: 32rpx;
		box-sizing: border-box;
	}

	.title_ipt>image {
		width: 26rpx;
		height: 26rpx;
	}

	.title_ipt>input {
		width: 77%;
		height: 60rpx;
		box-sizing: border-box;
		border-radius: 105rpx;
		font-size: 28rpx;
		line-height: 60rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: rgba(255, 255, 255, 0.6);
		padding-left: 20rpx;
	}

	.title_ipt>view {
		width: 94rpx;
		height: 35rpx;
		background: #FF7514;
		border-radius: 18rpx;
		font-size: 23rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-right: 20rpx;
	}



	.qbt_con_item {
		width: 680rpx;
		margin: 20rpx auto;
	}

	.list_1 {
		width: 680rpx;
		height: 305rpx;
		border-radius: 7rpx;
		position: relative;
	}

	.list_1>image {
		width: 680rpx;
		height: 305rpx;
		border-radius: 7rpx;
	}

	.list_1>view:nth-of-type(1) {
		position: absolute;
		top: 0;
		left: 0;
		padding: 6rpx 60rpx 4rpx 20rpx;
		background: #FFFFFF;
		border-radius: 0 0 40rpx 0;
		color: #1734f4;
		font-size: 28rpx;
		box-sizing: border-box;
	}

	.redu {
		position: absolute;
		bottom: 0;
		left: 0;
		background: rgba(22, 22, 22, 0.6);
		width: 100%;
		padding: 6rpx 20rpx;
		box-sizing: border-box;
		height: 82rpx;
		color: #FFFFFF;
		font-size: 20rpx;
		border-radius: 0 0 7rpx 7rpx;
	}

	.list_2 {
		padding: 20rpx;
		color: #FFFFFF;
		display: flex;
		align-items: baseline;
		justify-content: space-between;
		font-size: 28rpx;
	}

	.list_2>view:nth-of-type(2) {
		width: 130rpx;
		height: 38rpx;
		background: #FF7514;
		border-radius: 18rpx;
		font-size: 20rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: center;
	}
</style>
