<template>
    <view class="cu-modal" :class="{ show: visible }">
        <view class="rule-mask" @click="close"></view>
        <view class="cu-dialog" style="background-color: transparent; width: 100%">
            <view class="relative wrapper">
                <view class="title">
                    <image :src="ossurl.welfare.toys.recordTitle" mode="aspectFit" />
                </view>
                <view v-if="prizeResilt.length === 1" class="prize_one">
                    <view class="box">
                        <view class="img">
                            <image
                                :src="prizeResilt[0].cover"
                                class="width100 height100"
                                mode="aspectFit"
                            />
                        </view>
                        <view class="text line-ellipsis">{{ prizeResilt[0].name }}</view>
                    </view>
                </view>
                <view v-else class="prize_five">
                    <view v-for="item in prizeResilt" :key="item.spuId" class="five_item">
                        <div class="box">
                            <view class="five_img">
                                <image :src="item.cover"  mode="aspectFit" />
                            </view>
                            <view class="five_text line-ellipsis">{{ item.name }}</view>
                        </div>
                    </view>
                </view>
            </view>
            <view class="paddingT30 flex-align-center">
                <view class="close cuIcon-close" @click="close"></view>
            </view>
        </view>
    </view>
</template>

<script>
    import ossurl from '@/utils/ossurl'
    export default {
        props: {
            luckKing: Object
        },
        data() {
            return {
                ossurl,
                visible: false,
                type: 5,
                prizeResilt: [] // 抽到的奖励
            }
        },
        methods: {
            show(data) {
                this.visible = true
                this.$parent.$parent.$parent.lock = true
                this.prizeResilt = data
            },
            close() {
                this.visible = false
                this.$parent.$parent.$parent.lock = false
            }
        }
    }
</script>

<style lang="scss" scoped>
    .rule-mask {
        position: absolute;
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
    }
    .wrapper {
        z-index: 1001;
        width: 750rpx;
        height: 705rpx;
        margin: 0 auto;
        text-align: center;
        .rule {
            width: 581rpx;
            height: 0;
        }
        .doll_close {
            position: absolute;
            top: 0;
            right: -8rpx;
            .x {
                width: 64rpx;
                height: 64rpx;
            }
        }
        .doll_know {
            position: absolute;
            bottom: 45rpx;

            .k {
                width: 252rpx;
                height: 88rpx;
            }
        }
        .prize_one {
            display: inline-block;
            width: 444rpx;
            padding: 10rpx;
            height: 612rpx;
            background: linear-gradient(
                136deg,
                rgba(255, 255, 255, 0.28) 0%,
                rgba(255, 255, 255, 0.2) 100%
            );
            overflow: hidden;
            opacity: 1;
            border: 4rpx solid;
            border-image: linear-gradient(
                    155deg,
                    rgba(255, 255, 255, 0.27000001072883606),
                    rgba(255, 255, 255, 0.07999999821186066)
                )
                4 4;

            border-radius: 20rpx 20rpx 20rpx 20rpx;
            .box {
                background: #ffffff;
                border-radius: 12rpx 12rpx 12rpx 12rpx;
                height: 100%;
            }
            .img {
                height: 480rpx;
            }
            .text {
                color: #b58100;
                width: 100%;
                margin-top: 31rpx;
                text-align: center;
            }
        }
        .prize_five {
            display: inline-block;
            width: 90%;
            .five_item {
                width: 200rpx;
                height: 276rpx;
                display: inline-block;
                background: linear-gradient(
                    136deg,
                    rgba(255, 255, 255, 0.28) 0%,
                    rgba(255, 255, 255, 0.2) 100%
                );
                border-radius: 15rpx 15rpx 15rpx 15rpx;
                opacity: 1;
                border: 2rpx solid;
                border-image: linear-gradient(
                        155deg,
                        rgba(255, 255, 255, 0.27000001072883606),
                        rgba(255, 255, 255, 0.07999999821186066)
                    )
                    2 2;
                padding: 8rpx;
                margin-right: 14rpx;
                margin-top: 23rpx;
                .box {
                    background: #ffffff;
                    border-radius: 10rpx 10rpx 10rpx 10rpx;
                    height: 100%;
                    opacity: 1;
                }
                .five_img {
                    width: 100%;
                    height: 200rpx;
                    image{
                      height: 200rpx;
                    }
                }
                .five_text {
                    color: #b58100;
                    text-align: center;
                }
            }
            .five_item:nth-child(3) {
                margin-right: 0;
            }
        }
    }
    .close {
        width: 64rpx;
        height: 64rpx;
        background: #d8d8d8;
        font-size: 32rpx;
        text-align: center;
        line-height: 64rpx;
        color: #444;
        border-radius: 50%;
    }
    .title {
        text-align: center;
        image {
            height: 126rpx;
            width: 388rpx;
        }
    }
</style>
