<template>
		<view class="goodsItem" @click="goGoodsDetail(data)">
			<view class="list_left">
				<image :src="data.cover" mode="aspectFit" error-icon="https://shuhi.oss-cn-qingdao.aliyuncs.com/mini/quesheng.png"></image>
				<view class="xiajia" v-if="data.goods_status==2">
					已下架
				</view>
			</view>
			<view class="list_right" :class="{'disabled':data.goods_status==2}">
				<view class="goods_title shu-elip-2">{{ data.title }}</view>
				<!-- <view class="goods_titlesm" v-if="data.goods.publish">{{data.goods.publish}}</view> -->
				<view class="right_bottom">
					<view class="money">
						<view class="now" v-if="data.price_selling">
							<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(data) {
			if(data.goods_status==2)return false;
			uni.navigateTo({
				url: '/pages-mall/pages/goods/detail?goodsId='+data.goods.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;
	flex: 1;
	// padding: 24rpx 24rpx 24rpx 24rpx;
	padding: 20rpx 10rpx;
	border-bottom: 1rpx solid #efefef;
	.list_left {
		width: 170rpx;
		height: 170rpx;
		position: relative;
		image {
			width: 170rpx;
			height: 170rpx;
		}
		.xiajia{
			position: absolute;
			width: 90rpx;
			height: 90rpx;
			border-radius: 50%;
			color: #fff;
			display: flex;
			align-items: center;
			justify-content: center;
			background-color: rgba(0, 0, 0, .5);
			top: 40rpx;
			left: 40rpx;
			transform: rotate(30deg);
			font-size: 24rpx;
		}
	}

	.list_right {
		margin-left: 24rpx;
		width: 100%;
		.goods_title {
			font-size: 28rpx;
			font-weight: 400;
			color: #171717;
			height: 3em;
			line-height: 1.5;
			margin-top: 6rpx;
		}
		.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;
			}
		}
	}
}
	
	.disabled{
		// filter: grayscale(1)
		// filter: brightness(0.7) opacity(0.5)
		filter: brightness(0.7) opacity(0.5)
	}
</style>
