<template>
	<view class="goods_con">
		<navigation :showBack="false">
			Home
		</navigation>
	<u-swiper :list="list" height="1000" mode="none"></u-swiper>
	
	<view class="goods_list_con">
		<view class="good_item" v-for="item,index in goods_list" :key="item.index" @click="goGoodsDetail(item.id)">
			<image :src="'https://apitest.luck-work.com'+item.goodsImgThumbUrl" mode="aspectFit"></image>
			<view class="text">
				{{item.goodsName}}
			</view>
			<view class="price">
				₹ {{item.goodsPrice}}
			</view>
		</view>
	</view>
	</view>
</template>

<script>
	import api from '@/utils/api'
	import utils from '@/utils'
	import md5 from 'js-md5'
	import store from '@/store'
	import cont from "@/components/navigation/navigation.vue"
	export default {
		data() {
			return {
				// banner
				list: [],
				// 商品
				goods_list:[],
				ticket:'',
			}
		},

		onLoad() {
	        this.ticket= uni.getStorageSync('logInfo').data;
			this.init();
		},
		
			onReady() {
			
			},
		methods: {
			goGoodsDetail(i){
				uni.navigateTo({
					url:'goodsDetail/index?id='+i
				})
			},
			init(){
				const post = api.banner({})
				.then(res =>{
					this.list=res.data;
					for(var i=0;i<this.list.length;i++){
						 this.list[i].adImgPath='https://apitest.luck-work.com'+this.list[i].adImgPath
					}
				}).catch(err =>{
					console.log(err)
				})
				
				
				const post2 = api.goodsList({})
				.then(res =>{
					this.goods_list=res.data;
				}).catch(err =>{
					console.log(err)
				})
			},
			},
	
		}
	
</script>

<style>
	@import './index.css';
</style>
