<template>
	<view class="content">
		<u-list @scrolltolower="scrolltolower">
			<u-list-item v-for="(item, index) in pageList" :key="index">
				<view class="productModel" @click="$utils.goProductDetails(item.goods_id)">
					<view class="productImg">
						<image class="init_image" :src="item.cover_img" mode=""></image>
					</view>
					<view class="pruductInfo">
						<view class="productName">
							<span class="certifiedIcon"
								v-show="item.tags.field1 && item.tags.field1 != ''">{{item.tags.field1}}</span>
							{{item.goods_name}}
						</view>
						<view class="productEvaluate">
							<span v-show="item.tags.field2 && item.tags.field2 != ''">{{item.tags.field2}}</span>
							<span v-show="item.tags.field3 && item.tags.field3 != ''"
								style="margin-left: 5px;">{{item.tags.field3}}</span>
						</view>
						<view class="productPrice">
							<span class="productPriceIcon">¥</span>{{item.dg_price}} <span
								style="text-decoration-line: line-through;font-size: 10px;margin-left: 5px;color: #999999;">零售价
								¥{{item.market_price}}</span><span class="productByeNum"
								style="font-size: 10px;margin-left: 5px;"
								v-show="item.tags.field4 && item.tags.field4 != ''">{{item.tags.field4}}</span>
						</view>
						<view class="productTagList">
							<view class="productTag"
								style="background-image: url('http://amy.yyinhong.cn/uploads/wximg/sptop.png');background-repeat: no-repeat;background-size: 100% 100%;background-position: 0 0;color: #ffffff;border: none;padding: 0 2px"
								v-if="item.tags.field5 && item.tags.field5 != ''&&item.tags.field6 && item.tags.field6 != ''">
								<span style="margin-left: 5px;"></span>{{item.tags.field5.substring(0, 4)}}<span
									style="margin-left: 15px;"></span> {{item.tags.field6.substring(0, 2)}}
							</view>
							<view class="productTag" v-show="item.tags.field7 && item.tags.field7 != ''">
								{{item.tags.field7}}
							</view>
							<view class="productTag" v-show="item.tags.field8 && item.tags.field8 != ''">
								{{item.tags.field8}}
							</view>
						</view>
						<view class="pruductfrom"
							v-if="item.tags.field9 && item.tags.field9 != '' && item.tags.field10">
							<span class="pruductfromLeft">{{item.tags.field9}}</span>
							<view class="pruductfromRight">
								{{item.tags.field10}}
							</view>
						</view>
					</view>
				</view>
			</u-list-item>
		</u-list>
		<u-empty :show="pageList.length == 0" mode="list" icon="http://cdn.uviewui.com/uview/empty/list.png"></u-empty>
		<u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pageList: [],
				pageNum: 1
			}
		},
		onLoad() {
			this.getCollectionList();
		},
		methods: {
			scrolltolower() {
				this.pageNum += 1;
				this.getCollectionList();
			},
			//获取我的收藏
			getCollectionList() {
				this.$request('/get-collect-list', 'GET', {
					page: this.pageNum
				}).then(res => {
					console.log(res.data)
					this.pageList = [...this.pageList, ...res.data.list];
				}).catch(err => {
					uni.showToast({

						icon: 'error',

						title: '' + err.message

					})
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		width: 100vw;
		background: #ffffff;
	}
</style>