<template>
	<view class="app">
		<view class="productlist">
			<view class="item" @tap='goCommodityDetails' v-for="(item,index) in goodsList" :key="index">
				<!-- <image src="../../static/shoppingcs.png" mode=""></image> -->
				<image :src="baseUrl + item.goodsPictureUrl" mode=""></image>
				<view class="title">
					{{item.goodsName}}
				</view>
				<view class="price">
					￥{{item.goodsPrice}}
				</view>
			</view>
			<!-- <view class="item">
				<image src="../../static/shoppingcs.png" mode=""></image>
				<view class="title">
					燕麦麸皮 1盒
				</view>
				<view class="price">
					￥42.9
				</view>
			</view>
			<view class="item">
				<image src="../../static/shoppingcs.png" mode=""></image>
				<view class="title">
					燕麦麸皮 1盒
				</view>
				<view class="price">
					￥42.9
				</view>
			</view>
			<view class="item">
				<image src="../../static/shoppingcs.png" mode=""></image>
				<view class="title">
					燕麦麸皮 1盒
				</view>
				<view class="price">
					￥42.9
				</view>
			</view> -->
		</view>
	</view>
</template>

<script>
	import {
		goodsList
	} from '@/api/ProductList/ProductList.js';
	import baseurl from '@/api/baseurl.js'
	export default {
		data() {
			return {
				title: '医路优品', //导航栏标题
				pageNum: 1,
				pageSize: 999,
				goodsCategoryId:"",
				goodsList:[],
			};
		},
		onReady() {
			//更改导航栏文字
			uni.setNavigationBarTitle({
				title: this.title,
			});
		},
		onLoad(options) {
			//获取传值
			console.log(options)
			this.title = options.title
			this.goodsListinfo()
		},
		methods: {
			goodsListinfo(){
				goodsList(this.pageSize, this.pageNum,this.goodsCategoryId).then(res => {
					this.goodsList = res.data
					console.log(this.goodsCategoryList)
				})
			},
			//跳转详情页
			goCommodityDetails() {
				uni.navigateTo({
					url: '/pages/CommodityDetails/CommodityDetails'
				})
			},
		},
	}
</script>

<style lang="scss">
	.app {
		.productlist {
			width: 100%;
			margin: 0 auto;
			padding: 40rpx 0 0 0;
			display: flex;
			flex-wrap: wrap;
			justify-content: space-evenly;

			.item {
				width: 45%;
				background: #FFFFFF;
				border-radius: 25rpx;
				padding-bottom: 10rpx;
				box-shadow: 0px 4rpx 8rpx 4rpx rgba(199, 200, 202, 0.8);
				margin-bottom: 40rpx;

				.price {
					font-size: 42rpx;
					color: #D43953;
					line-height: 79rpx;
					padding-left: 20rpx;
				}

				.title {
					font-size: 39rpx;
					color: #000000;
					line-height: 69rpx;
					padding-left: 20rpx;
				}

				image {
					width: 100%;
					height: 340rpx;
				}
			}
		}
	}
</style>
