<template>
    <view class="goods-activity-popup">
        <uni-popup ref="activitypPopup" type="bottom">
            <view class="activity-price" :style="{ paddingBottom: safeArea ? 0 : '32rpx' }">
                <view class="close iconfont icon-iconfontguanbi" @click="close"></view>
                <view class="popup-content">
                    <view class="row th">
                        <view class="label">购买数</view>
                        <view class="content">价格（元）</view>
                    </view>
                    <view class="row" v-for="(item, index) in ladderList" :key="index">
                        <view class="label">{{ item.buyNum }}</view>
                        <view class="content">{{ item.buyPrice | priceFormat }}</view>
                    </view>
                </view>
            </view>
        </uni-popup>
    </view>
</template>

<script>
import { mapGetters } from 'vuex'
export default {
    name: 'goods-activity-popup',
    props: {
        ladderList: {
            type: Array,
            default: () => []
        }
    },
    computed: {
        ...mapGetters(['safeArea'])
    },
    methods: {
        open() {
            this.$refs.activitypPopup.open()
            this.$emit('open')
        },
        close() {
            this.$refs.activitypPopup.close()
            this.$emit('close')
        }
    }
}
</script>

<style lang="scss" scoped>
.activity-price {
    padding: 32rpx;
    padding-top: 64rpx;
    position: relative;

    background-color: #fff;
    border-radius: 16rpx 16rpx 0 0;

    &::after {
        position: absolute;
        content: '';
        width: 100%;
        height: 80rpx;
        left: 0;
        bottom: -80rpx;
        background-color: #fff;
    }

    .close {
        position: absolute;
        right: 24rpx;
        top: 24rpx;
        color: #999;
        font-size: 32rpx;
    }

    .popup-content {
        padding: 24rpx 0;
    }

    .row {
        @extend .cm-flex-between;
        color: #333333;
        text-align: center;
        border-top: 1rpx solid;
        border-left: 1rpx solid;
        border-right: 1rpx solid;
        border-color: #e1e1e1;

        &:last-child {
            border-bottom: 1rpx solid #e1e1e1;
        }

        &.th {
            font-size: 32rpx;
        }

        .label {
            flex: 1;
            font-size: 26rpx;
            padding: 24rpx 8rpx;
            border-right: 1rpx solid #e1e1e1;
        }
        .content {
            flex: 1;
            padding: 24rpx 8rpx;
            font-size: 26rpx;
        }
    }
}
</style>
