<template>
		<view class="goodsItem" @click="goGoodsDetail(data)">
			<view class="list_left">
				<!-- <image :src="data.cover" mode="aspectFit"></image>  width="360rpx" height="360rpx"-->
				<u-image class="goods_img" width="170rpx" height="170rpx" mode="aspectFit" :src="data.cover" error-icon="https://shuhi.oss-cn-qingdao.aliyuncs.com/mini/quesheng.png"></u-image>
			</view>
			<view class="list_right">
				<view class="goods_title shu-elip-2">{{ data.title }}</view>
				<view class="goods_titlesm shu-elip-1" v-if="data.publish">{{data.publish}}</view>
				<view class="right_bottom">
					<view class="money">
						<view class="now">
							<text>￥</text>
							<text>{{data.price_selling}}</text>
						</view>
					</view>
					<!-- <view class="bottom_right" @click.stop="addCart(data)">
						<u-icon name="shopping-cart"></u-icon>
					</view> -->
				</view>
			</view>
		</view>
</template>

<script>
export default {
	name: 'pionts',
	props: {
		data: {
			type: Object,
			default: () => {
				return {};
			}
		}
	},
	methods: {
		goGoodsDetail(item) {
			uni.navigateTo({
				url: '/pages-mall/pages/goods/detail?goodsId='+item.id
			});
		},
		addCart(item){
			this.$u.api.addCartAjax({
				goods_id:item.id,
				nums: 1,
				sku_id:1,//1是测试，应该传入skuId，外层没有返回，需要接口返回一下
			}).then(({code})=>{
				if(code==1){
					this.$u.toast('添加购物车成功')
				}
			})
		}
	}
};
</script>

<style lang="scss" scoped>
.slot {
	position: relative;
}
.money {
	display: flex;
	align-items: flex-end;
	.now {
		font-weight: bold;
		text:nth-child(1) {
			font-size: 20rpx;
			color: $app-theme-text-money-color;
		}
		text:nth-child(2) {
			font-size: 30rpx;
			color: $app-theme-text-money-color;
		}
	}
	.old {
		text {
			font-size: 20rpx;
			color: $app-theme-card-gray-color;
			text-decoration-line: line-through;
		}
	}
}
.list_item{
	padding: 0 25rpx;
}
.goodsItem {
	display: flex;
	// padding: 24rpx 24rpx 24rpx 24rpx;
	padding: 20rpx;
	border-bottom: 1rpx solid #efefef;
	.list_left {
		.goods_img {
			width: 170rpx;
			height: 170rpx;
		}
	}

	.list_right {
		margin-left: 24rpx;
		width: 100%;

		.goods_title {
			font-size: 28rpx;
			font-weight: 400;
			color: #171717;
			height: 3em;
			margin-top: 6rpx;
			line-height: 1.5;
		}
		.goods_titlesm{
			font-size: 24rpx;
			font-weight: 400;
			color: #999;
			
		}
		.right_bottom {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-top: 10rpx;

			.bottom_left {
				display: flex;
				align-items: center;
				image {
					width: 32rpx;
					height: 32rpx;
					margin-right: 10rpx;
				}

				span {
					font-size: 24rpx;
					font-weight: 400;
					color: #696969;
					line-height: 34rpx;
				}

				.bottom_num {
					font-size: 32rpx;
					font-weight: 500;
					color: #fd4558;
					line-height: 44rpx;
					margin-right: 8rpx;
				}
			}

			.bottom_right {
				font-size: 40rpx;
				font-weight: 400;
				text-align: center;
				color: $app-theme-color;
				// line-height: 56rpx;
				// width: 56rpx;
				// height: 56rpx;
				// background: rgba( $app-theme-color, .6);
				// border-radius: 30rpx;
			}
		}
	}
}
	
</style>
