<template>
	<view class="page">
		<navBar title="收藏" :back="true" color="black" background="white" />

		<view class="con" v-if="list.length!=0">
			<view class="item" v-for="(item,index) in list" @click="goDetail(item)">
				<image :src="picBase+item.goods.cover" mode=""></image>
				<view class="bottom">
					<view class="txt">
						{{item.goods.name}}
					</view>
				</view>
			</view>
		</view>
		<view class="con" v-else style="justify-content: center;">
			<u-empty mode="data" text="暂无数据" width="160" height="160" :icon="picUrl+'/static/other/empty.png'">
			</u-empty>
		</view>
		<u-loadmore v-if="list.length!=0" style="" loadmoreText="已经到底啦" color="#CCCCCC" lineColor="#CCCCCC" line />

		<u-loading-page :loading="loading" image="/static/index/logo.png" loading-text="页面加载中..."></u-loading-page>
	</view>
</template>

<script>
	import {
		getMyCollectDataReq,
	} from '@/api/my/index.js'

	export default {
		components: {

		},
		data() {
			return {
				picUrl: this.$picUrl,
				picBase: this.$picBase,
				list: [],

				loading: true
			}
		},
		async onLoad(o) {

		},
		async onShow() {
			let res = await getMyCollectDataReq({
				page: 1,
				per_page: 1,
			})
			if (res.code == 0) {
				this.list = res.data.data
				this.loading = false
				console.log('我的收藏列表返回值',
					res);
				// console.log('我的收藏列表', this.list);
			} else {
				this.loading = false
				uni.showToast({
					title: res.message,
					icon: 'none'
				})
			}
		},
		methods: {
			goDetail(item) {
				getApp().Sid = item.goods_id
				uni.navigateTo({
					url: '/pages/my/collectDetail/index'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import "./index.scss";
</style>