<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)">
				<view class="topBox">
					<image :src="picBase+item.cover" mode=""></image>
				</view>
				<view class="bottom">
					<view class="txt">
						{{item.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 {
		getSerBackGoodsReq,
		getMallReq,
	} from '@/api/test/index.js'
	export default {
		components: {

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

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

		},
		async onShow() {
			let res = await getMallReq({
				isAfterSale: 1
			})
			if (res.code == 0) {
				console.log('售后商品列表返回值:', res);
				this.list = res.data
				this.loading = false
			} else {
				this.loading = false
				uni.showToast({
					title: res.message,
					icon: 'none'
				})
			}
		},
		methods: {
			goDetail(item) {
				getApp().mallItem = item
				getApp().isSellBack = false
				uni.navigateTo({
					url: '/pages/my/actGoodsDetail/index'
				})
			}
		}
	}
</script>

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