<template>
	<view class="page">
		<navBar title="活动商品" :back="true" color="black" background="white" />

		<view class="con">
			<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>
		<u-loadmore style="" loadmoreText="已经到底啦" color="#CCCCCC" lineColor="#CCCCCC" line />
	</view>
</template>

<script>
	import {
		getMallReq,
	} from '@/api/test/index.js'
	export default {
		components: {},
		data() {
			return {
				picBase: this.$picBase,
				list: []
			}
		},
		async onLoad(o) {

		},
		async onShow() {
			let res = await getMallReq({
				isActivity: 1
			})
			if (res.code == 0) {
				this.list = res.data
				console.log('活动商品返回值:', res.data);
			} else {
				uni.showToast({
					title: res.message,
					icon: 'none'
				})
			}
		},
		methods: {
			goDetail(item) {
				getApp().isSellBack = true
				getApp().mallItem = item

				uni.navigateTo({
					url: '/pages/my/actGoodsDetail/index'
				})
			}
		}
	}
</script>

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