<template>
    <view class="recommend">
        <view class="top">
            <text>今日拼团推荐</text>
			<view class="more" @click="toDetailsPage">
				<text>查看详情</text>
				<u-icon name="arrow-right" color="#999" size="22"></u-icon>
			</view>
        </view>
        <view class="connect">
            <view class="user">
                <view class="avatar">
					<image src="/static/image/common/32.png"></image>
					<image src="/static/image/common/31.png"></image>
				</view>
				<view class="num">{{ info.pintuan_limit_number }}人团</view>
            </view>
            <view class="info" @click="toDetailsPage">
                <text class="u-line-1">{{ info.groupbuy_name }}</text>
                <text class="u-line-2">{{ info.goods_name }}</text>
                <view>
                    <text>￥{{ info.groupbuy_price }}</text>
                    <text>￥{{ info.goods_price }}</text>
                </view>
            </view>
            <image class="img" :src="info.pintuan_image" @click="toDetailsPage" mode="aspectFill"></image>
        </view>
    </view>
</template>
<script>
export default {
	name:"recommend",
	data() {
		return {
			info: {}
		}
	},
	props: ['recommendData', 'type'],
	created() {
		this.info = this.recommendData;
		// console.log(this.recommendData);
	},
	methods: {
		toDetailsPage() {
			// this.$u.api.getPinTuanDetails({
			// 	pintuan_id: this.recommendData.pintuan_id
			// }).then(res => {
			// 	if(res.errCode == 0) {
			// 		const goods = {
			// 			goods: res.data.data,
			// 			type: 2,
			// 		}
			// 		this.$store.commit('setGoodsDetails', goods);
			// 		this.$store.commit('setGoodsId', this.recommendData.pintuan_id);
			// 		this.$u.route({
			// 			url: 'pageB/sdetails/index',
			// 		})
			// 	}
			// })
			this.$u.route({
				url: 'pageB/sdetails/index',
				params: {
					// id: this.recommendData.pintuan_id,
					id: this.recommendData.groupbuy_id,
					// type: 2,
				}
			})
		}
	}
}
</script>
<style lang="scss" scoped>
.recommend {
	margin-bottom: 20rpx;
	padding: 0 30rpx;
	background-color: #ffffff;
    .top {
        height: 90rpx;
        display: flex;
        align-items: center;
        justify-content: space-between;
        >text:first-child{
            font-size: 30rpx;
            color: #333;
        }
        .more {
			display: flex;
			align-items: center;
			color: #999;
            font-size: 20rpx;
		}
    }
    .connect{
		padding:10rpx 0 30rpx;
        display: flex;
		align-items: center;
        .user {
			margin-right: 16px;
			.avatar {
				width: 96rpx;
				height: 64rpx;
				margin-bottom: 16rpx;
				position: relative;
				> image {
					position: absolute;
					width: 64rpx;
					height: 64rpx;
					border-radius: 50%;
					&:first-child {
						left: 0;
						top: 0;
						z-index: 8;
					}
					&:last-child {
						left: 32rpx;
						top: 0;
						z-index: 9;
						background-color: antiquewhite;
					}
				}
			}
			.num {
				text-align: center;
				font-size: 28rpx;
				font-weight: 500;
				color: rgba(253,211,96,1);
			}
		}
        .info{
			width: 340rpx;
            display: flex;
            flex-direction: column;
            >text:nth-child(1){
                font-size: 28rpx;
                color: #333;
            }
            >text:nth-child(2){
                margin-top: 17rpx;
                line-height: 36rpx;
                font-size: 24rpx;
                color: #666;
            }
            >view{
                margin-top: 24rpx;
                display: flex;
                align-items: flex-end;
                
                >text:first-child{
                    font-size: 27rpx;
                    color: #FF3131;
                }
                >text:last-child{
                    font-size: 24rpx;
                    color: #999;
                    margin-left: 33rpx;
					text-decoration: line-through;
                }
            }
        }
        .img{
            flex-shrink: 0;
            width: 210rpx;
            height: 200rpx;
            margin-left: 10rpx;
            border-radius: 4rpx;
			background-color: antiquewhite;
        }
    }
}
</style>